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 { |
| 23 | label "${params.executorNode}" |
| 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 """ |
| 34 | git clone https://github.com/ciena/kind-voltha.git |
| 35 | """ |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | stage('Deploy Voltha') { |
| 40 | steps { |
| 41 | sh """ |
| 42 | cd kind-voltha/ |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 43 | TYPE=minimal WITH_RADIUS=y WITH_TP=no ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 44 | """ |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | stage('Install BBSIM') { |
| 49 | steps { |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 50 | sh ''' |
| 51 | cd kind-voltha/ |
| 52 | export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")" |
| 53 | export VOLTCONFIG="/home/jenkins/.volt/config-minimal" |
| 54 | export PATH=/w/workspace/kind-voltha-minimal/kind-voltha/bin:$PATH |
| 55 | helm install --set onus_per_pon_port=1 onf/bbsim -n bbsim |
| 56 | ''' |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | stage('Run E2E Tests') { |
| 61 | steps { |
| 62 | sh ''' |
| 63 | git clone https://gerrit.opencord.org/voltha-system-tests |
| 64 | cd kind-voltha/ |
| 65 | export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")" |
| 66 | export VOLTCONFIG="/home/jenkins/.volt/config-minimal" |
| 67 | export PATH=/w/workspace/kind-voltha-minimal/kind-voltha/bin:$PATH |
| 68 | cd $WORKSPACE/voltha-system-tests/tests/sanity |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 69 | robot -e notready -v num_onus:1 sanity.robot || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 70 | ''' |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | post { |
| 76 | always { |
| 77 | sh ''' |
| 78 | # copy robot logs |
| 79 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 80 | cp -r $WORKSPACE/voltha-system-tests/tests/sanity/*ml ./RobotLogs || true |
| 81 | cd kind-voltha/ |
| 82 | cp install-minimal.log $WORKSPACE/ |
| 83 | export KUBECONFIG="$(./bin/kind get kubeconfig-path --name="voltha-minimal")" |
| 84 | export VOLTCONFIG="/home/jenkins/.volt/config-minimal" |
| 85 | export PATH=/w/workspace/kind-voltha-minimal/kind-voltha/bin:$PATH |
| 86 | kubectl get pods --all-namespaces |
| 87 | kubectl describe pods -n voltha |
| 88 | voltctl || true |
| 89 | ## get default pod logs |
| 90 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 91 | do |
| 92 | if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then |
| 93 | kubectl logs \$pod onos> $WORKSPACE/\$pod.log; |
| 94 | else |
| 95 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
| 96 | fi |
| 97 | done |
| 98 | ## get voltha pod logs |
| 99 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 100 | do |
| 101 | if [[ \$pod == *"arouter"* ]]; then |
| 102 | kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log; |
| 103 | else |
| 104 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 105 | fi |
| 106 | done |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 107 | ''' |
| 108 | step([$class: 'RobotPublisher', |
| 109 | disableArchiveOutput: false, |
| 110 | logFileName: 'RobotLogs/log*.html', |
| 111 | otherFiles: '', |
| 112 | outputFileName: 'RobotLogs/output*.xml', |
| 113 | outputPath: '.', |
| 114 | passThreshold: 100, |
| 115 | reportFileName: 'RobotLogs/report*.html', |
| 116 | unstableThreshold: 0]); |
| 117 | archiveArtifacts artifacts: '*.log' |
| 118 | |
| 119 | } |
| 120 | } |
| 121 | } |