Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 15 | node("intel-102") { |
| 16 | timeout (120) { |
| 17 | try { |
| 18 | stage("Cleanup") { |
| 19 | sh returnStdout: true, script: """ |
| 20 | ssh c3po-mme1 "killall mme-app" |
| 21 | """ |
| 22 | // TODO add kill and cleanup steps |
| 23 | } |
| 24 | stage("Lisitng the VM") { |
| 25 | sh returnStdout: true, script: """ |
| 26 | virsh list --all |
| 27 | """ |
| 28 | timeout(1) { |
| 29 | waitUntil { |
| 30 | running_vms = sh returnStdout: true, script: """ |
| 31 | virsh list --all | grep "c3po-mme1\|c3po-hss1\|ngic-cp1\|ngic-dp1\|c3po-dbn1" | grep -i running | wc -l |
| 32 | """ |
| 33 | return running_vms.toInteger() >= 5 |
| 34 | } |
Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 35 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 36 | } |
| 37 | stage("Connecting to ngic-dp1") { |
| 38 | sh returnStdout: true, script: """ |
| 39 | ssh ngic-dp1 "test.sh" |
| 40 | """ |
| 41 | } |
| 42 | stage("Connecting to ngic-cp1") { |
| 43 | sh returnStdout: true, script: """ |
| 44 | sleep 10; |
| 45 | ssh ngic-cp1 "test.sh" |
| 46 | """ |
| 47 | } |
| 48 | stage("Connecting to c3po-hss1") { |
| 49 | sh returnStdout: true, script: """ |
| 50 | ssh c3po-hss1 "test.sh" |
| 51 | """ |
| 52 | } |
| 53 | stage("Connecting to c3po-mme1") { |
| 54 | sh returnStdout: true, script: """ |
| 55 | ssh c3po-mme1 "test.sh" |
| 56 | """ |
| 57 | } |
| 58 | stage("Connecting to Polaris") { |
| 59 | sh returnStdout: true, script: """ |
| 60 | ssh polaris "> test-output.log" |
| 61 | ssh polaris "test.sh > test-output.log" |
| 62 | """ |
| 63 | timeout(10) { |
| 64 | waitUntil { |
| 65 | test_output = sh returnStdout: true, script: """ |
| 66 | ssh polaris "cat test-output.log | grep -i SUCCESS | wc -l" |
| 67 | """ |
| 68 | return test_output.toInteger() >= 1 |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | currentBuild.result = 'SUCCESS' |
| 73 | } catch (err) { |
| 74 | currentBuild.result = 'FAILURE' |
| 75 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 76 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 77 | echo "RESULT: ${currentBuild.result}" |
| 78 | } |
Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 79 | } |