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. |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 14 | node("intel-102") { |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 15 | timeout (120) { |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 16 | try { |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 17 | stage("Listing the VM") { |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 18 | timeout(1) { |
| 19 | waitUntil { |
| 20 | running_vms = sh returnStdout: true, script: """ |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 21 | virsh list --all |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 22 | """ |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 23 | echo "Running VMs: ${running_vms}" |
| 24 | return true |
| 25 | } |
| 26 | } |
| 27 | timeout(1) { |
| 28 | waitUntil { |
| 29 | running_vms = sh returnStdout: true, script: """ |
| 30 | virsh list --all | grep "c3po-mme1\\|c3po-hss1\\|ngic-cp1\\|ngic-dp1\\|c3po-dbn1" | grep -i running | wc -l |
| 31 | """ |
| 32 | echo "Running VMs: ${running_vms}" |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 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 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 37 | stage("Connecting to ngic-cp1") { |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 38 | // ssh ngic-cp1 'sh test.sh' |
| 39 | timeout(10) { |
| 40 | waitUntil { |
| 41 | ngic_cp1_output = sh returnStdout: true, script: """ |
| 42 | ssh ngic-cp1 'if pgrep -f [n]gic_controlplane; then pkill -f [n]gic_controlplane; fi' |
| 43 | ssh ngic-cp1 'cd /home/ngic-rtc/cp && (./run.sh 2>/var/log/cicd_cp1.stderr 1>/var/log/cicd_cp1.stdout &)' |
| 44 | sleep 1; |
| 45 | ssh ngic-cp1 'pgrep -fl [n]gic_controlplane || (cat /var/log/cicd_cp1.stderr && cat /var/log/cicd_cp1.stdout && exit 1)' |
| 46 | """ |
| 47 | echo "${ngic_cp1_output}" |
| 48 | return true |
| 49 | } |
| 50 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 51 | sh returnStdout: true, script: """ |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 52 | ssh ngic-cp1 'pgrep -fl [n]gic_controlplane' |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 53 | """ |
| 54 | } |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 55 | stage("Connecting to ngic-dp1") { |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 56 | timeout(10) { |
| 57 | waitUntil { |
| 58 | ngic_dp1_output = sh returnStdout: true, script: """ |
| 59 | ssh ngic-dp1 'if pgrep -f [n]gic_dataplane; then pkill -f [n]gic_dataplane; fi' |
| 60 | ssh ngic-dp1 'cd /home/ngic-rtc/dp && (./run.sh 2>/var/log/cicd_dp1.stderr 1>/var/log/cicd_dp1.stdout &)' |
| 61 | sleep 10; |
| 62 | ssh ngic-dp1 'cd /home/ngic-rtc/kni_ifcfg && ./kni-SGIdevcfg.sh' |
| 63 | ssh ngic-dp1 'cd /home/ngic-rtc/kni_ifcfg && ./kni-S1Udevcfg.sh' |
| 64 | ssh ngic-dp1 'pgrep -fl [n]gic_dataplane || (cat /var/log/cicd_dp1.stderr && cat /var/log/cicd_dp1.stdout && exit 1)' |
| 65 | """ |
| 66 | echo "${ngic_dp1_output}" |
| 67 | return true |
| 68 | } |
| 69 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 70 | sh returnStdout: true, script: """ |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 71 | ssh ngic-dp1 'pgrep -fl [n]gic_dataplane' |
| 72 | """ |
| 73 | } |
| 74 | stage("Connecting to c3po-hss1") { |
| 75 | timeout(10) { |
| 76 | waitUntil { |
| 77 | c3po_hss1_output = sh returnStdout: true, script: """ |
| 78 | ssh c3po-hss1 'if pgrep -f [h]ss; then pkill -f [h]ss; fi' |
| 79 | ssh c3po-hss1 'cd /home/c3po/hss && (./bin/hss -j conf/hss.json 2>/var/log/cicd_hss1.stderr 1>/var/log/cicd_hss1.stdout &)' |
| 80 | sleep 2; |
| 81 | ssh c3po-hss1 'pgrep -fl [h]ss || (cat /var/log/cicd_hss1.stderr && cat /var/log/cicd_hss1.stdout && exit 1)' |
| 82 | """ |
| 83 | echo "${c3po_hss1_output}" |
| 84 | return true |
| 85 | } |
| 86 | } |
| 87 | sh returnStdout: true, script: """ |
| 88 | ssh c3po-hss1 'pgrep -fl [h]ss' |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 89 | """ |
| 90 | } |
| 91 | stage("Connecting to c3po-mme1") { |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 92 | timeout(10) { |
| 93 | waitUntil { |
| 94 | c3po_mme1_output = sh returnStdout: true, script: """ |
| 95 | ssh c3po-mme1 'if pgrep -f [m]me-app; then pkill -f [m]me-app; fi' |
| 96 | ssh c3po-mme1 'if pgrep -f [s]1ap-app; then pkill -f [s]1ap-app; fi' |
| 97 | ssh c3po-mme1 'if pgrep -f [s]11-app; then pkill -f [s]11-app; fi' |
| 98 | ssh c3po-mme1 'if pgrep -f [s]6a-app; then pkill -f [s]6a-app; fi' |
| 99 | sleep 1; |
| 100 | ssh c3po-mme1 'cd /home/openmme/src/mme-app && export LD_LIBRARY_PATH=../common/ && (./mme-app 2>/var/log/cicd_mme_mme_app.stderr 1>/var/log/cicd_mme_mme_app.stdout &)' |
| 101 | ssh c3po-mme1 'cd /home/openmme/src/s1ap && export LD_LIBRARY_PATH=../common/ && (./s1ap-app 2>/var/log/cicd_mme_s1ap_app.stderr 1>/var/log/cicd_mme_s1ap_app.stdout &)' |
| 102 | ssh c3po-mme1 'cd /home/openmme/src/s11 && export LD_LIBRARY_PATH=../common/ && (./s11-app 2>/var/log/cicd_mme_s11_app.stderr 1>/var/log/cicd_mme_s11_app.stdout &)' |
| 103 | ssh c3po-mme1 'cd /home/openmme/src/s6a && export LD_LIBRARY_PATH=../common/ && (./s6a-app 2>/var/log/cicd_mme_s6a_app.stderr 1>/var/log/cicd_mme_s6a_app.stdout &)' |
| 104 | sleep 2; |
| 105 | ssh c3po-mme1 'pgrep -fl [m]me-app || (cat /var/log/cicd_mme_mme_app.stderr && cat /var/log/cicd_mme_mme_app.stdout && exit 1)' |
| 106 | ssh c3po-mme1 'pgrep -fl [s]1ap-app || (cat /var/log/cicd_mme_s1ap_app.stderr && cat /var/log/cicd_mme_s1ap_app.stdout && exit 1)' |
| 107 | ssh c3po-mme1 'pgrep -fl [s]11-app || (cat /var/log/cicd_mme_s11_app.stderr && cat /var/log/cicd_mme_s11_app.stdout && exit 1)' |
| 108 | ssh c3po-mme1 'pgrep -fl [s]6a-app || (cat /var/log/cicd_mme_s6a_app.stderr && cat /var/log/cicd_mme_s6a_app.stdout && exit 1)' |
| 109 | """ |
| 110 | echo "${c3po_mme1_output}" |
| 111 | return true |
| 112 | } |
| 113 | sh returnStdout: true, script: """ |
| 114 | ssh c3po-mme1 'pgrep -f [m]me-app && pgrep -f [s]1ap-app && pgrep -f [s]11-app && pgrep -fl [s]6a-app ' |
| 115 | """ |
| 116 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 117 | } |
| 118 | stage("Connecting to Polaris") { |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 119 | timeout(10) { |
| 120 | waitUntil { |
| 121 | test_output = sh returnStdout: true, script: """ |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 122 | ssh polaris 'cd /root/LTELoadTester && nettest -emulator 127.0.0.1:5678:enb,127.0.0.1:6789:ipte Attach-Detach-wdata.tcl > test-output.log' |
| 123 | ssh polaris 'cd /root/LTELoadTester && cat test-output.log' |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 124 | """ |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 125 | echo "Polaris log: ${test_output}" |
| 126 | return true |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 127 | } |
| 128 | } |
Ganeshbabu | e1611ac | 2019-02-14 11:36:51 +0000 | [diff] [blame] | 129 | sh returnStdout: true, script: """ |
| 130 | ssh polaris 'cd /root/LTELoadTester && grep -P -o "Test pass percentage.*?100%" test-output.log' |
| 131 | """ |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 132 | } |
michele.pezzutti | ec84ec5 | 2019-02-18 10:51:52 +0100 | [diff] [blame^] | 133 | /* |
| 134 | stage("Kill apps") { |
| 135 | sh returnStdout: true, script: """ |
| 136 | ssh ngic-cp1 'if pgrep -f [n]gic_controlplane; then pkill -f [n]gic_controlplane; fi' |
| 137 | ssh ngic-dp1 'if pgrep -f [n]gic_dataplane; then pkill -f [n]gic_dataplane; fi' |
| 138 | ssh c3po-hss1 'if pgrep -f [h]ss; then pkill -f [h]ss; fi' |
| 139 | ssh c3po-mme1 'if pgrep -f [m]me-app; then pkill -f [m]me-app; fi' |
| 140 | ssh c3po-mme1 'if pgrep -f [s]1ap-app; then pkill -f [s]1ap-app; fi' |
| 141 | ssh c3po-mme1 'if pgrep -f [s]11-app; then pkill -f [s]11-app; fi' |
| 142 | ssh c3po-mme1 'if pgrep -f [s]6a-app; then pkill -f [s]6a-app; fi' |
| 143 | """ |
| 144 | } |
| 145 | */ |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 146 | currentBuild.result = 'SUCCESS' |
| 147 | } catch (err) { |
| 148 | currentBuild.result = 'FAILURE' |
Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 149 | } |
Luca Prete | 19723d9 | 2019-02-07 10:05:29 -0800 | [diff] [blame] | 150 | echo "RESULT: ${currentBuild.result}" |
| 151 | } |
Luca Prete | 271bf5a | 2019-01-23 14:50:01 -0800 | [diff] [blame] | 152 | } |