alshabib | 08d0a1f | 2017-01-05 15:04:28 -0800 | [diff] [blame] | 1 | def filename = 'manifest-${branch}.xml' |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 2 | def manifestUrl = 'https://gerrit.opencord.org/manifest' |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 3 | def config = null; |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 4 | |
alshabib | 41f74fd | 2017-01-07 09:48:00 -0800 | [diff] [blame] | 5 | node ('master') { |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 6 | checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestBranch: params.branch, manifestRepositoryUrl: "${manifestUrl}", quiet: true] |
alshabib | 41f74fd | 2017-01-07 09:48:00 -0800 | [diff] [blame] | 7 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 8 | stage ("Generate and Copy Manifest file") { |
| 9 | sh returnStdout: true, script: 'repo manifest -r -o ' + filename |
| 10 | sh returnStdout: true, script: 'cp ' + filename + ' ' + env.JENKINS_HOME + '/tmp' |
| 11 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 12 | |
Jonathan Hart | 9bd4a82 | 2017-08-10 09:08:12 -0700 | [diff] [blame] | 13 | stage ("Parse deployment configuration file") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 14 | sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}' |
Luca Prete | 1125f60 | 2017-06-30 14:39:53 +0200 | [diff] [blame] | 15 | sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}' |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 16 | config = readYaml file: "${configRepoBaseDir}${configRepoFile}" |
| 17 | } |
alshabib | 41f74fd | 2017-01-07 09:48:00 -0800 | [diff] [blame] | 18 | } |
| 19 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 20 | node ("${config.dev_node.name}") { |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 21 | timeout (time: 240) { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 22 | stage ('Checkout cord repo') { |
| 23 | checkout changelog: false, poll: false, scm: [$class: 'RepoScm', currentBranch: true, manifestBranch: params.branch, manifestRepositoryUrl: "${manifestUrl}", quiet: true] |
| 24 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 25 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 26 | dir('build') { |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 27 | try { |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 28 | stage ("Re-deploy head node and Build Vagrant box") { |
| 29 | parallel( |
| 30 | maasOps: { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 31 | sh "maas login maas http://${config.maas.ip}/MAAS/api/2.0 ${config.maas.api_key}" |
| 32 | sh "maas maas machine release ${config.maas.head_system_id}" |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 33 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 34 | timeout(time: 15) { |
| 35 | waitUntil { |
| 36 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 37 | sh "maas maas machine read ${config.maas.head_system_id} | grep Ready" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 38 | return true |
| 39 | } catch (exception) { |
| 40 | return false |
| 41 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 42 | } |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame] | 43 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 44 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 45 | sh 'maas maas machines allocate' |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 46 | sh "maas maas machine deploy ${config.maas.head_system_id}" |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 47 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 48 | timeout(time: 30) { |
| 49 | waitUntil { |
| 50 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 51 | sh "maas maas machine read ${config.maas.head_system_id} | grep Deployed" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 52 | return true |
| 53 | } catch (exception) { |
| 54 | return false |
| 55 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 56 | } |
alshabib | ef06994 | 2016-09-09 17:08:36 -0700 | [diff] [blame] | 57 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 58 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 59 | }, vagrantOps: { |
| 60 | sh 'vagrant up corddev' |
| 61 | }, failFast : true |
| 62 | ) |
| 63 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 64 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 65 | stage ("Fetch CORD packages") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 66 | sh "vagrant ssh -c \"cd /opt/cord/build; ./gradlew fetch\" corddev" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 67 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 68 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 69 | stage ("Build CORD Images") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 70 | sh "vagrant ssh -c \"cd /opt/cord/build; ./gradlew buildImages\" corddev" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 71 | } |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 72 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 73 | stage ("Downloading CORD POD configuration") { |
Luca Prete | 1125f60 | 2017-06-30 14:39:53 +0200 | [diff] [blame] | 74 | sh "vagrant ssh -c \"cd /opt/cord/build/config; git clone -b ${branch} ${config.pod_config.repo_url}\" corddev" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 75 | } |
Jonathan Hart | 1719e9a | 2017-03-13 21:53:47 -0700 | [diff] [blame] | 76 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 77 | stage ("Publish to headnode") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 78 | sh "vagrant ssh -c \"cd /opt/cord/build; ./gradlew -PtargetReg=${config.head.ip}:5000 -PdeployConfig=config/pod-configs/${config.pod_config.file_name} publish\" corddev" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 79 | } |
alshabib | 61509fb | 2016-09-09 02:43:20 -0700 | [diff] [blame] | 80 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 81 | stage ("Deploy") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 82 | sh "vagrant ssh -c \"cd /opt/cord/build; ./gradlew -PtargetReg=${config.head.ip}:5000 -PdeployConfig=config/pod-configs/${config.pod_config.file_name} deploy\" corddev" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 83 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 84 | |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 85 | stage ("Power cycle compute nodes") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 86 | for(int i=0; i < config.compute_nodes.size(); i++) { |
| 87 | sh "ipmitool -U ${config.compute_nodes[i].ipmi.user} -P ${config.compute_nodes[i].ipmi.pass} -H ${config.compute_nodes[i].ipmi.ip} power cycle" |
| 88 | } |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 89 | } |
alshabib | 7f3be8d | 2016-09-27 18:04:56 -0700 | [diff] [blame] | 90 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 91 | stage ("Wait for compute nodes to get deployed") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 92 | sh "ssh-keygen -f /home/${config.dev_node.user}/.ssh/known_hosts -R ${config.head.ip}" |
| 93 | def cordApiKey = runCmd("${config.head.ip}", |
| 94 | "${config.head.user}", |
| 95 | "${config.head.pass}", |
| 96 | "sudo maas-region-admin apikey --username ${config.head.user}") |
| 97 | runCmd("${config.head.ip}", |
| 98 | "${config.head.user}", |
| 99 | "${config.head.pass}", |
| 100 | "maas login pod-maas http://${config.head.ip}/MAAS/api/1.0 ${cordApiKey}") |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 101 | timeout(time: 45) { |
| 102 | waitUntil { |
| 103 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 104 | num = runCmd("${config.head.ip}", |
| 105 | "${config.head.user}", |
| 106 | "${config.head.pass}", |
| 107 | "maas pod-maas nodes list | grep -i deployed | wc -l").trim() |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame] | 108 | return num.toInteger() == config.compute_nodes.size() |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 109 | } catch (exception) { |
| 110 | return false |
| 111 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 112 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 113 | } |
| 114 | } |
alshabib | 4e1c96e | 2016-09-28 16:26:24 -0700 | [diff] [blame] | 115 | |
You Wang | b364dce | 2017-09-11 13:46:43 -0700 | [diff] [blame] | 116 | stage ("Wait for compute nodes to be provisioned") { |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 117 | timeout(time:45) { |
| 118 | waitUntil { |
| 119 | try { |
You Wang | b364dce | 2017-09-11 13:46:43 -0700 | [diff] [blame] | 120 | num = runCmd("${config.head.ip}", |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 121 | "${config.head.user}", |
| 122 | "${config.head.pass}", |
You Wang | b364dce | 2017-09-11 13:46:43 -0700 | [diff] [blame] | 123 | "cord prov list '|' grep -i node '|' grep -i complete '|' wc -l").trim() |
| 124 | return num.toInteger() == config.compute_nodes.size() |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 125 | } catch (exception) { |
| 126 | return false |
| 127 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 128 | } |
alshabib | 7f3be8d | 2016-09-27 18:04:56 -0700 | [diff] [blame] | 129 | } |
| 130 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 131 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 132 | if (config.fabric_switches != null) { |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 133 | stage("Reserve IPs for fabric switches and restart maas-dhcp service") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 134 | for(int i=0; i < config.fabric_switches.size(); i++) { |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 135 | def append = ""; |
| 136 | if (i!=0) { |
| 137 | append = "-a"; |
| 138 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 139 | def str = createMACIPbindingStr(i+1, |
| 140 | "${config.fabric_switches[i].mac}", |
| 141 | "${config.fabric_switches[i].ip}") |
| 142 | runCmd("${config.head.ip}", |
| 143 | "${config.head.user}", |
| 144 | "${config.head.pass}", |
| 145 | "echo -e $str '|' sudo tee $append /etc/dhcp/dhcpd.reservations > /dev/null") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 146 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 147 | runCmd("${config.head.ip}", |
| 148 | "${config.head.user}", |
| 149 | "${config.head.pass}", |
| 150 | "sudo restart maas-dhcpd") |
| 151 | |
| 152 | runCmd("${config.head.ip}", |
| 153 | "${config.head.user}", |
| 154 | "${config.head.pass}", |
| 155 | "cord harvest go") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | stage ("Wait for fabric switches to get deployed") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 159 | for(int i=0; i < config.fabric_switches.size(); i++) { |
| 160 | runFabricCmd("${config.head.ip}", |
| 161 | "${config.head.user}", |
| 162 | "${config.head.pass}", |
| 163 | "${config.fabric_switches[i].ip}", |
| 164 | "${config.fabric_switches[i].user}", |
| 165 | "${config.fabric_switches[i].pass}", |
| 166 | "sudo onl-onie-boot-mode install") |
| 167 | |
| 168 | runFabricCmd("${config.head.ip}", |
| 169 | "${config.head.user}", |
| 170 | "${config.head.pass}", |
| 171 | "${config.fabric_switches[i].ip}", |
| 172 | "${config.fabric_switches[i].user}", |
| 173 | "${config.fabric_switches[i].pass}", |
| 174 | "sudo reboot") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 175 | } |
| 176 | timeout(time: 45) { |
| 177 | waitUntil { |
| 178 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 179 | def harvestCompleted = runCmd("${config.head.ip}", |
| 180 | "${config.head.user}", |
| 181 | "${config.head.pass}", |
| 182 | "cord harvest list '|' grep -i fabric '|' wc -l").trim() |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame] | 183 | return harvestCompleted.toInteger() == config.fabric_switches.size() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 184 | } catch (exception) { |
| 185 | return false |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | stage ("Wait for fabric switches to be provisioned") { |
| 192 | timeout(time:45) { |
| 193 | waitUntil { |
| 194 | try { |
| 195 | def provCompleted = 0 |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 196 | for(int i=0; i < config.fabric_switches.size(); i++) { |
| 197 | def count = runCmd("${config.head.ip}", |
| 198 | "${config.head.user}", |
| 199 | "${config.head.pass}", |
| 200 | "cord prov list '|' grep -i ${config.fabric_switches[i].ip} '|' grep -i complete '|' wc -l").trim() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 201 | provCompleted = provCompleted + count.toInteger() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 202 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 203 | return provCompleted == config.fabric_switches.size() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 204 | } catch (exception) { |
| 205 | return false |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 212 | if (config.make_release == true) { |
| 213 | stage ("Trigger Build") { |
| 214 | url = 'https://jenkins.opencord.org/job/release-build/job/' + params.branch + '/build' |
| 215 | httpRequest authentication: 'auto-release', httpMode: 'POST', url: url, validResponseCodes: '201' |
| 216 | } |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 217 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 218 | |
| 219 | currentBuild.result = 'SUCCESS' |
| 220 | } catch (err) { |
| 221 | currentBuild.result = 'FAILURE' |
Jonathan Hart | 1719e9a | 2017-03-13 21:53:47 -0700 | [diff] [blame] | 222 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 223 | } finally { |
| 224 | sh 'vagrant destroy -f corddev' |
Jonathan Hart | 1719e9a | 2017-03-13 21:53:47 -0700 | [diff] [blame] | 225 | sh 'rm -rf config/pod-configs' |
alshabib | 7f3be8d | 2016-09-27 18:04:56 -0700 | [diff] [blame] | 226 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 227 | echo "RESULT: ${currentBuild.result}" |
| 228 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 229 | } |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 230 | } |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 231 | |
| 232 | /** |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 233 | * Returns a string used to bind IPs and MAC addresses, substituting the values |
| 234 | * given. |
| 235 | * |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 236 | * @param counter the counter used to generate the host name |
| 237 | * @param mac the MAC address to substitute |
| 238 | * @param ip the IP address to substitute |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 239 | */ |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 240 | def createMACIPbindingStr(counter, mac, ip) { |
| 241 | return """\\'host fabric${counter} {'\n'hardware ethernet ${mac}';''\n'fixed-address ${ip}';''\n'}\\'""" |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | /** |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 245 | * Runs a command on a remote host using sshpass. |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 246 | * |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 247 | * @param ip the node IP address |
| 248 | * @param user the node user name |
| 249 | * @param pass the node password |
| 250 | * @param command the command to run |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 251 | * @return the output of the command |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 252 | */ |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 253 | def runCmd(ip, user, pass, command) { |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame] | 254 | return sh(returnStdout: true, script: "sshpass -p ${pass} ssh -oStrictHostKeyChecking=no -l ${user} ${ip} ${command}") |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 255 | } |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * Runs a command on a fabric switch. |
| 259 | * |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 260 | * @param headIp the head node IP address |
| 261 | * @param headUser the head node user name |
| 262 | * @param headPass the head node password |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 263 | * @param ip the mgmt IP of the fabric switch, reachable from the head node |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 264 | * @param user the mgmt user name of the fabric switch |
| 265 | * @param pass the mgmt password of the fabric switch |
| 266 | * @param command the command to run on the fabric switch |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 267 | * @return the output of the command |
| 268 | */ |
Luca Prete | d642a59 | 2017-06-30 11:11:35 +0200 | [diff] [blame] | 269 | def runFabricCmd(headIp, headUser, headPass, ip, user, pass, command) { |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame] | 270 | return sh(returnStdout: true, script: "sshpass -p ${headPass} ssh -oStrictHostKeyChecking=no -l ${headUser} ${headIp} \"sshpass -p ${pass} ssh -oStrictHostKeyChecking=no -l ${user} ${ip} ${command}\"") |
Jonathan Hart | 9bd4a82 | 2017-08-10 09:08:12 -0700 | [diff] [blame] | 271 | } |