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 | } |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 28 | environment { |
| 29 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 30 | VOLTCONFIG="$HOME/.volt/config-minimal" |
| 31 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin" |
| 32 | TYPE="minimal" |
| 33 | FANCY=0 |
| 34 | WITH_SIM_ADAPTERS="n" |
| 35 | WITH_RADIUS="y" |
| 36 | WITH_BBSIM="y" |
| 37 | DEPLOY_K8S="y" |
| 38 | VOLTHA_LOG_LEVEL="DEBUG" |
| 39 | CONFIG_SADIS="y" |
| 40 | EXTRA_HELM_FLAGS="${params.extraHelmFlags}" |
Andy Bavier | 3708d07 | 2019-12-10 15:22:18 -0700 | [diff] [blame^] | 41 | ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 42 | } |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 43 | stages { |
| 44 | |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 45 | stage('Repo') { |
| 46 | steps { |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 47 | step([$class: 'WsCleanup']) |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 48 | checkout(changelog: true, |
| 49 | poll: false, |
| 50 | scm: [$class: 'RepoScm', |
| 51 | manifestRepositoryUrl: "${params.manifestUrl}", |
| 52 | manifestBranch: "${params.manifestBranch}", |
| 53 | currentBranch: true, |
| 54 | destinationDir: 'voltha', |
| 55 | forceSync: true, |
| 56 | resetFirst: true, |
| 57 | quiet: true, |
| 58 | jobs: 4, |
| 59 | showAllChanges: true] |
| 60 | ) |
| 61 | } |
| 62 | } |
| 63 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 64 | stage('Download kind-voltha') { |
| 65 | steps { |
| 66 | sh """ |
Andy Bavier | 7787d46 | 2019-08-21 15:56:17 -0700 | [diff] [blame] | 67 | git clone https://github.com/ciena/kind-voltha.git |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 68 | """ |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | stage('Deploy Voltha') { |
| 73 | steps { |
| 74 | sh """ |
| 75 | cd kind-voltha/ |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 76 | ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 77 | """ |
| 78 | } |
| 79 | } |
| 80 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 81 | stage('Run E2E Tests') { |
| 82 | steps { |
| 83 | sh ''' |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 84 | mkdir -p $WORKSPACE/RobotLogs |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 85 | git clone https://gerrit.opencord.org/voltha-system-tests |
Andy Bavier | 3708d07 | 2019-12-10 15:22:18 -0700 | [diff] [blame^] | 86 | for i in \$(seq 1 ${testRuns}) |
| 87 | do |
| 88 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} |
| 89 | kubectl -n voltha delete pod -lapp=bbsim # VOL-2342 |
| 90 | kubectl -n voltha wait pod -lapp=bbsim --for condition=Ready --timeout=60s # VOL-2342 |
| 91 | http -a karaf:karaf --ignore-stdin DELETE http://localhost:8101/onos/v1/applications/org.opencord.dhcpl2relay/active > /dev/null # VOL-2343 |
| 92 | http -a karaf:karaf --ignore-stdin POST http://localhost:8101/onos/v1/applications/org.opencord.dhcpl2relay/active > /dev/null # VOL-2343 |
| 93 | done |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 94 | ''' |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | post { |
| 100 | always { |
| 101 | sh ''' |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 102 | set +e |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 103 | cd kind-voltha/ |
| 104 | cp install-minimal.log $WORKSPACE/ |
Andy Bavier | aec6038 | 2019-10-29 15:09:04 -0700 | [diff] [blame] | 105 | 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] | 106 | kubectl get nodes -o wide |
| 107 | kubectl get pods -o wide |
| 108 | kubectl get pods -n voltha -o wide |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 109 | ## get default pod logs |
| 110 | for pod in \$(kubectl get pods --no-headers | awk '{print \$1}'); |
| 111 | do |
| 112 | if [[ \$pod == *"onos"* && \$pod != *"onos-service"* ]]; then |
| 113 | kubectl logs \$pod onos> $WORKSPACE/\$pod.log; |
| 114 | else |
| 115 | kubectl logs \$pod> $WORKSPACE/\$pod.log; |
| 116 | fi |
| 117 | done |
| 118 | ## get voltha pod logs |
| 119 | for pod in \$(kubectl get pods --no-headers -n voltha | awk '{print \$1}'); |
| 120 | do |
Kailash | 6be1aa9 | 2019-08-05 18:11:11 -0700 | [diff] [blame] | 121 | if [[ \$pod == *"-api-"* ]]; then |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 122 | kubectl logs \$pod arouter -n voltha > $WORKSPACE/\$pod.log; |
| 123 | else |
| 124 | kubectl logs \$pod -n voltha > $WORKSPACE/\$pod.log; |
| 125 | fi |
| 126 | done |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 127 | ## shut down voltha |
Andy Bavier | 3a58ba3 | 2019-09-20 16:31:40 -0700 | [diff] [blame] | 128 | WAIT_ON_DOWN=y ./voltha down |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 129 | ''' |
| 130 | step([$class: 'RobotPublisher', |
| 131 | disableArchiveOutput: false, |
| 132 | logFileName: 'RobotLogs/log*.html', |
| 133 | otherFiles: '', |
| 134 | outputFileName: 'RobotLogs/output*.xml', |
| 135 | outputPath: '.', |
Matteo Scandolo | 26bc17e | 2019-09-24 09:03:01 -0700 | [diff] [blame] | 136 | passThreshold: 100, |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 137 | reportFileName: 'RobotLogs/report*.html', |
| 138 | unstableThreshold: 0]); |
| 139 | archiveArtifacts artifacts: '*.log' |
| 140 | |
| 141 | } |
| 142 | } |
| 143 | } |