Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [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 | |
| 15 | // voltha-2.x e2e tests |
| 16 | // uses kind-voltha to deploy voltha-2.X |
| 17 | // uses bbsim to simulate OLT/ONUs |
| 18 | |
| 19 | pipeline { |
| 20 | |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame^] | 23 | label "${params.buildNode}" |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 24 | } |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 25 | options { |
| 26 | timeout(time: 40, unit: 'MINUTES') |
| 27 | } |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 28 | |
| 29 | stages { |
| 30 | |
| 31 | stage('Download kind-voltha') { |
| 32 | steps { |
| 33 | sh """ |
Andy Bavier | 7787d46 | 2019-08-21 15:56:17 -0700 | [diff] [blame] | 34 | git clone https://github.com/ciena/kind-voltha.git |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 35 | """ |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | stage('Deploy Voltha') { |
| 40 | steps { |
| 41 | sh """ |
| 42 | cd kind-voltha/ |
Andy Bavier | d2216f8 | 2019-10-04 17:04:38 -0700 | [diff] [blame] | 43 | EXTRA_HELM_FLAGS="${params.extraHelmFlags}" VOLTHA_LOG_LEVEL=DEBUG TYPE=minimal WITH_RADIUS=y WITH_BBSIM=y INSTALL_ONOS_APPS=y CONFIG_SADIS=y WITH_SIM_ADAPTERS=n FANCY=0 ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 44 | """ |
| 45 | } |
| 46 | } |
| 47 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 48 | stage('Run E2E Tests') { |
| 49 | steps { |
| 50 | sh ''' |
| 51 | git clone https://gerrit.opencord.org/voltha-system-tests |
| 52 | cd kind-voltha/ |
| 53 | export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")" |
| 54 | export VOLTCONFIG="/home/jenkins/.volt/config-minimal" |
Andy Bavier | f96864e | 2019-09-20 15:10:14 -0700 | [diff] [blame] | 55 | export PATH=$WORKSPACE/kind-voltha/bin:$PATH |
Andy Bavier | dabe9fc | 2019-10-24 17:10:48 -0700 | [diff] [blame] | 56 | export ROBOT_VAR_FILE=$WORKSPACE/voltha-system-tests/tests/data/${robotVarFile} |
Andy Bavier | 69e67d5 | 2019-10-11 14:10:57 -0700 | [diff] [blame] | 57 | make -C $WORKSPACE/voltha-system-tests sanity-kind || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 58 | ''' |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | post { |
| 64 | always { |
| 65 | sh ''' |
| 66 | # copy robot logs |
| 67 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Andy Bavier | bdecd99 | 2019-10-15 17:41:26 -0700 | [diff] [blame] | 68 | cp -r $WORKSPACE/voltha-system-tests/tests/*/*.html ./RobotLogs || true |
| 69 | cp -r $WORKSPACE/voltha-system-tests/tests/*/*.xml ./RobotLogs || true |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 70 | cd kind-voltha/ |
| 71 | cp install-minimal.log $WORKSPACE/ |
| 72 | export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")" |
| 73 | export VOLTCONFIG="/home/jenkins/.volt/config-minimal" |
Andy Bavier | f96864e | 2019-09-20 15:10:14 -0700 | [diff] [blame] | 74 | export PATH=$WORKSPACE/kind-voltha/bin:$PATH |
Andy Bavier | aec6038 | 2019-10-29 15:09:04 -0700 | [diff] [blame] | 75 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
Kailash | 887a296 | 2019-08-14 13:26:33 -0700 | [diff] [blame] | 76 | kubectl get nodes -o wide |
| 77 | kubectl get pods -o wide |
| 78 | kubectl get pods -n voltha -o wide |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 79 | ## get default pod logs |
| 80 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 81 | do |
| 82 | if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then |
| 83 | kubectl logs \$pod onos> $WORKSPACE/\$pod.log; |
| 84 | else |
| 85 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
| 86 | fi |
| 87 | done |
| 88 | ## get voltha pod logs |
| 89 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 90 | do |
Kailash | 6be1aa9 | 2019-08-05 18:11:11 -0700 | [diff] [blame] | 91 | if [[ \$pod == *"-api-"* ]]; then |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 92 | kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log; |
Andy Bavier | d55712a | 2019-10-18 16:00:29 -0700 | [diff] [blame] | 93 | elif [[ \$pod == "bbsim-"* ]]; then |
| 94 | kubectl logs \$pod -n voltha -p > $WORKSPACE/\$pod.log; |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 95 | else |
| 96 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 97 | fi |
| 98 | done |
Andy Bavier | 3a58ba3 | 2019-09-20 16:31:40 -0700 | [diff] [blame] | 99 | ## clean up node |
| 100 | WAIT_ON_DOWN=y ./voltha down |
| 101 | cd $WORKSPACE/ |
| 102 | rm -rf kind-voltha/ voltha-system-tests/ || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 103 | ''' |
| 104 | step([$class: 'RobotPublisher', |
| 105 | disableArchiveOutput: false, |
| 106 | logFileName: 'RobotLogs/log*.html', |
| 107 | otherFiles: '', |
| 108 | outputFileName: 'RobotLogs/output*.xml', |
| 109 | outputPath: '.', |
Matteo Scandolo | 26bc17e | 2019-09-24 09:03:01 -0700 | [diff] [blame] | 110 | passThreshold: 100, |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 111 | reportFileName: 'RobotLogs/report*.html', |
| 112 | unstableThreshold: 0]); |
| 113 | archiveArtifacts artifacts: '*.log' |
| 114 | |
| 115 | } |
| 116 | } |
| 117 | } |