Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -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.buildNode}" |
| 24 | } |
| 25 | options { |
| 26 | timeout(time: 40, unit: 'MINUTES') |
| 27 | } |
| 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="n" |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 40 | EXTRA_HELM_FLAGS="--set log_agent.enabled=False ${params.extraHelmFlags}" |
Andy Bavier | 4a02b23 | 2020-01-09 14:50:30 -0700 | [diff] [blame] | 41 | ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 42 | } |
| 43 | stages { |
| 44 | |
| 45 | stage('Repo') { |
| 46 | steps { |
| 47 | step([$class: 'WsCleanup']) |
| 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 | |
| 64 | stage('Download kind-voltha') { |
| 65 | steps { |
| 66 | sh """ |
| 67 | git clone https://github.com/ciena/kind-voltha.git |
| 68 | """ |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | stage('Deploy Voltha') { |
| 73 | steps { |
| 74 | sh """ |
| 75 | cd kind-voltha/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 76 | JUST_K8S=y ./voltha up |
| 77 | kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log & |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 78 | ./voltha up |
| 79 | """ |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | stage('Run E2E Tests') { |
| 84 | steps { |
| 85 | sh ''' |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 86 | mkdir -p $WORKSPACE/RobotLogs |
| 87 | git clone https://gerrit.opencord.org/voltha-system-tests |
| 88 | cd kind-voltha |
| 89 | for i in \$(seq 1 ${testRuns}) |
| 90 | do |
| 91 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} |
| 92 | echo "Completed run: \$i" |
| 93 | echo "" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 94 | done |
| 95 | ''' |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | post { |
| 101 | always { |
| 102 | sh ''' |
| 103 | set +e |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 104 | cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/ |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 105 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
| 106 | kubectl get nodes -o wide |
| 107 | kubectl get pods -o wide |
| 108 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 109 | |
| 110 | sync |
| 111 | pkill kail || true |
| 112 | |
| 113 | ## Pull out errors from log files |
| 114 | extract_errors_go() { |
| 115 | echo |
| 116 | echo "Error summary for $1:" |
| 117 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 118 | echo |
| 119 | } |
| 120 | |
| 121 | extract_errors_python() { |
| 122 | echo |
| 123 | echo "Error summary for $1:" |
| 124 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 125 | echo |
| 126 | } |
| 127 | |
| 128 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 129 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 130 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 131 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 132 | |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 133 | gzip $WORKSPACE/onos-voltha-combined.log |
| 134 | |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 135 | ## shut down voltha |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 136 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 137 | WAIT_ON_DOWN=y ./voltha down |
| 138 | ''' |
| 139 | step([$class: 'RobotPublisher', |
| 140 | disableArchiveOutput: false, |
| 141 | logFileName: 'RobotLogs/log*.html', |
| 142 | otherFiles: '', |
| 143 | outputFileName: 'RobotLogs/output*.xml', |
| 144 | outputPath: '.', |
| 145 | passThreshold: 100, |
| 146 | reportFileName: 'RobotLogs/report*.html', |
| 147 | unstableThreshold: 0]); |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 148 | archiveArtifacts artifacts: '*.log,*.gz' |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 149 | |
| 150 | } |
| 151 | } |
| 152 | } |