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 | |
| 13 | stage ("Parse deployment configuartion file") { |
| 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 | |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 116 | stage ("Wait for computes nodes to be provisioned") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 117 | ip = runCmd("${config.head.ip}", |
| 118 | "${config.head.user}", |
| 119 | "${config.head.pass}", |
| 120 | "docker inspect --format '{{.NetworkSettings.Networks.maas_default.IPAddress}}' provisioner").trim() |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 121 | timeout(time:45) { |
| 122 | waitUntil { |
| 123 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 124 | out = runCmd("${config.head.ip}", |
| 125 | "${config.head.user}", |
| 126 | "${config.head.pass}", |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame^] | 127 | "curl -sS http://$ip:4243/provision/ | jq -c \".[] | select(.status | contains(${config.compute_nodes.size()}))\"".trim()) |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 128 | return out != "" |
| 129 | } catch (exception) { |
| 130 | return false |
| 131 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 132 | } |
alshabib | 7f3be8d | 2016-09-27 18:04:56 -0700 | [diff] [blame] | 133 | } |
| 134 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 135 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 136 | if (config.fabric_switches != null) { |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 137 | stage("Reserve IPs for fabric switches and restart maas-dhcp service") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 138 | for(int i=0; i < config.fabric_switches.size(); i++) { |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 139 | def append = ""; |
| 140 | if (i!=0) { |
| 141 | append = "-a"; |
| 142 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 143 | def str = createMACIPbindingStr(i+1, |
| 144 | "${config.fabric_switches[i].mac}", |
| 145 | "${config.fabric_switches[i].ip}") |
| 146 | runCmd("${config.head.ip}", |
| 147 | "${config.head.user}", |
| 148 | "${config.head.pass}", |
| 149 | "echo -e $str '|' sudo tee $append /etc/dhcp/dhcpd.reservations > /dev/null") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 150 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 151 | runCmd("${config.head.ip}", |
| 152 | "${config.head.user}", |
| 153 | "${config.head.pass}", |
| 154 | "sudo restart maas-dhcpd") |
| 155 | |
| 156 | runCmd("${config.head.ip}", |
| 157 | "${config.head.user}", |
| 158 | "${config.head.pass}", |
| 159 | "cord harvest go") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | stage ("Wait for fabric switches to get deployed") { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 163 | for(int i=0; i < config.fabric_switches.size(); i++) { |
| 164 | runFabricCmd("${config.head.ip}", |
| 165 | "${config.head.user}", |
| 166 | "${config.head.pass}", |
| 167 | "${config.fabric_switches[i].ip}", |
| 168 | "${config.fabric_switches[i].user}", |
| 169 | "${config.fabric_switches[i].pass}", |
| 170 | "sudo onl-onie-boot-mode install") |
| 171 | |
| 172 | runFabricCmd("${config.head.ip}", |
| 173 | "${config.head.user}", |
| 174 | "${config.head.pass}", |
| 175 | "${config.fabric_switches[i].ip}", |
| 176 | "${config.fabric_switches[i].user}", |
| 177 | "${config.fabric_switches[i].pass}", |
| 178 | "sudo reboot") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 179 | } |
| 180 | timeout(time: 45) { |
| 181 | waitUntil { |
| 182 | try { |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 183 | def harvestCompleted = runCmd("${config.head.ip}", |
| 184 | "${config.head.user}", |
| 185 | "${config.head.pass}", |
| 186 | "cord harvest list '|' grep -i fabric '|' wc -l").trim() |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame^] | 187 | return harvestCompleted.toInteger() == config.fabric_switches.size() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 188 | } catch (exception) { |
| 189 | return false |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | stage ("Wait for fabric switches to be provisioned") { |
| 196 | timeout(time:45) { |
| 197 | waitUntil { |
| 198 | try { |
| 199 | def provCompleted = 0 |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 200 | for(int i=0; i < config.fabric_switches.size(); i++) { |
| 201 | def count = runCmd("${config.head.ip}", |
| 202 | "${config.head.user}", |
| 203 | "${config.head.pass}", |
| 204 | "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] | 205 | provCompleted = provCompleted + count.toInteger() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 206 | } |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 207 | return provCompleted == config.fabric_switches.size() |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 208 | } catch (exception) { |
| 209 | return false |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | } |
| 215 | |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 216 | if (config.make_release == true) { |
| 217 | stage ("Trigger Build") { |
| 218 | url = 'https://jenkins.opencord.org/job/release-build/job/' + params.branch + '/build' |
| 219 | httpRequest authentication: 'auto-release', httpMode: 'POST', url: url, validResponseCodes: '201' |
| 220 | } |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 221 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 222 | |
| 223 | currentBuild.result = 'SUCCESS' |
| 224 | } catch (err) { |
| 225 | currentBuild.result = 'FAILURE' |
Jonathan Hart | 1719e9a | 2017-03-13 21:53:47 -0700 | [diff] [blame] | 226 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 227 | } finally { |
| 228 | sh 'vagrant destroy -f corddev' |
Jonathan Hart | 1719e9a | 2017-03-13 21:53:47 -0700 | [diff] [blame] | 229 | sh 'rm -rf config/pod-configs' |
alshabib | 7f3be8d | 2016-09-27 18:04:56 -0700 | [diff] [blame] | 230 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 231 | echo "RESULT: ${currentBuild.result}" |
| 232 | } |
alshabib | 1930266 | 2017-01-05 14:27:41 -0800 | [diff] [blame] | 233 | } |
alshabib | 152823c | 2016-09-07 23:49:12 -0700 | [diff] [blame] | 234 | } |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 235 | |
| 236 | /** |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 237 | * Returns a string used to bind IPs and MAC addresses, substituting the values |
| 238 | * given. |
| 239 | * |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 240 | * @param counter the counter used to generate the host name |
| 241 | * @param mac the MAC address to substitute |
| 242 | * @param ip the IP address to substitute |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 243 | */ |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 244 | def createMACIPbindingStr(counter, mac, ip) { |
| 245 | 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] | 246 | } |
| 247 | |
| 248 | /** |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 249 | * Runs a command on a remote host using sshpass. |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 250 | * |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 251 | * @param ip the node IP address |
| 252 | * @param user the node user name |
| 253 | * @param pass the node password |
| 254 | * @param command the command to run |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 255 | * @return the output of the command |
Luca Prete | 283f80a | 2017-05-18 15:21:24 -0700 | [diff] [blame] | 256 | */ |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 257 | def runCmd(ip, user, pass, command) { |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame^] | 258 | 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] | 259 | } |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 260 | |
| 261 | /** |
| 262 | * Runs a command on a fabric switch. |
| 263 | * |
Luca Prete | 782d941 | 2017-06-29 10:21:43 +0200 | [diff] [blame] | 264 | * @param headIp the head node IP address |
| 265 | * @param headUser the head node user name |
| 266 | * @param headPass the head node password |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 267 | * @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] | 268 | * @param user the mgmt user name of the fabric switch |
| 269 | * @param pass the mgmt password of the fabric switch |
| 270 | * @param command the command to run on the fabric switch |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 271 | * @return the output of the command |
| 272 | */ |
Luca Prete | d642a59 | 2017-06-30 11:11:35 +0200 | [diff] [blame] | 273 | def runFabricCmd(headIp, headUser, headPass, ip, user, pass, command) { |
Luca Prete | 512389a | 2017-07-07 12:33:29 +0200 | [diff] [blame^] | 274 | return sh(returnStdout: true, script: "sshpass -p ${headPass} ssh -oStrictHostKeyChecking=no -l ${headUser} ${headIp} \"sshpass -p ${pass} ssh -oStrictHostKeyChecking=no -l ${user} ${ip} ${command}\"") |
Luca Prete | 607c2d5 | 2017-05-24 09:56:06 -0700 | [diff] [blame] | 275 | } |