blob: 60d0ab9a3090e8a7582ce386c48a29bb610c591a [file] [log] [blame]
Andy Bavier0088c212020-01-08 13:44:03 -07001// 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
19pipeline {
20
21 /* no label, executor is determined by JJB */
22 agent {
23 label "${params.buildNode}"
24 }
25 options {
Andrea Campanella2f21f982020-09-11 13:26:40 +020026 timeout(time: 60, unit: 'MINUTES')
Andy Bavier0088c212020-01-08 13:44:03 -070027 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Matteo Scandolo4548f092020-09-29 11:27:35 -070031 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Andy Bavier0088c212020-01-08 13:44:03 -070032 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"
Andrea Campanella2f21f982020-09-11 13:26:40 +020039 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
Andy Bavier0088c212020-01-08 13:44:03 -070041 }
42 stages {
Matteo Scandolo4548f092020-09-29 11:27:35 -070043 stage('Clone kind-voltha') {
Andy Bavier0088c212020-01-08 13:44:03 -070044 steps {
45 step([$class: 'WsCleanup'])
Matteo Scandolo4548f092020-09-29 11:27:35 -070046 checkout([
47 $class: 'GitSCM',
48 userRemoteConfigs: [[
49 url: "https://gerrit.opencord.org/kind-voltha",
50 refspec: "${kindVolthaChange}"
51 ]],
52 branches: [[ name: "master", ]],
53 extensions: [
54 [$class: 'WipeWorkspace'],
55 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
56 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
57 ],
58 ])
Andy Bavier0088c212020-01-08 13:44:03 -070059 }
60 }
Matteo Scandolo4548f092020-09-29 11:27:35 -070061 stage('Clone voltha-system-tests') {
Andy Bavier0088c212020-01-08 13:44:03 -070062 steps {
Matteo Scandolo4548f092020-09-29 11:27:35 -070063 checkout([
64 $class: 'GitSCM',
65 userRemoteConfigs: [[
66 url: "https://gerrit.opencord.org/voltha-system-tests",
67 refspec: "${volthaSystemTestsChange}"
68 ]],
69 branches: [[ name: "${branch}", ]],
70 extensions: [
71 [$class: 'WipeWorkspace'],
72 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
73 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
74 ],
75 ])
Andy Bavier0088c212020-01-08 13:44:03 -070076 }
77 }
78
79 stage('Deploy Voltha') {
80 steps {
81 sh """
Andy Bavierdc8bc2c2020-03-29 16:25:02 -070082 export EXTRA_HELM_FLAGS=""
Andy Bavier6dfaf7e2020-03-30 14:52:59 -070083 if [ "${branch}" != "master" ]; then
84 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo4548f092020-09-29 11:27:35 -070085 source "$WORKSPACE/kind-voltha/releases/${branch}"
Andy Bavier10926f12020-03-27 16:53:43 -070086 else
87 echo "on master, using default settings for kind-voltha"
88 fi
89
90 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
91
Matteo Scandolo4548f092020-09-29 11:27:35 -070092 cd $WORKSPACE/kind-voltha/
Andy Bavier36c688c2020-03-17 07:32:30 -070093 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -070094 ./voltha up
95 """
96 }
97 }
98
99 stage('Run E2E Tests') {
100 steps {
Matteo Scandolo4548f092020-09-29 11:27:35 -0700101 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -0700102 set +e
Andy Bavier0088c212020-01-08 13:44:03 -0700103 mkdir -p $WORKSPACE/RobotLogs
Andy Bavier36c688c2020-03-17 07:32:30 -0700104
Matteo Scandolo4548f092020-09-29 11:27:35 -0700105 cd $WORKSPACE/kind-voltha/scripts
Andy Bavier36c688c2020-03-17 07:32:30 -0700106 ./log-collector.sh > /dev/null &
107 ./log-combine.sh > /dev/null &
108
Andy Bavier0d101392020-03-17 09:36:41 -0700109 for i in \$(seq 1 ${testRuns})
Andy Bavier0088c212020-01-08 13:44:03 -0700110 do
Matteo Scandolo4548f092020-09-29 11:27:35 -0700111 export ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs/\$i -e PowerSwitch"
112 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
Andy Bavier0088c212020-01-08 13:44:03 -0700113 echo "Completed run: \$i"
114 echo ""
Andy Bavier0088c212020-01-08 13:44:03 -0700115 done
Matteo Scandolo4548f092020-09-29 11:27:35 -0700116 """
Andy Bavier0088c212020-01-08 13:44:03 -0700117 }
118 }
119 }
120
121 post {
122 always {
123 sh '''
124 set +e
Matteo Scandolo4548f092020-09-29 11:27:35 -0700125 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700126 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
127 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Andy Bavier0088c212020-01-08 13:44:03 -0700128 kubectl get nodes -o wide
129 kubectl get pods -o wide
130 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700131
Andy Bavier36c688c2020-03-17 07:32:30 -0700132 sleep 60 # Wait for log-collector and log-combine to complete
Andy Bavier4af02722020-01-15 10:24:24 -0700133
134 ## Pull out errors from log files
135 extract_errors_go() {
136 echo
137 echo "Error summary for $1:"
Matteo Scandolo4548f092020-09-29 11:27:35 -0700138 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700139 echo
140 }
141
142 extract_errors_python() {
143 echo
144 echo "Error summary for $1:"
Matteo Scandolo4548f092020-09-29 11:27:35 -0700145 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700146 echo
147 }
148
149 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
150 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
151 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
Andy Bavier36c688c2020-03-17 07:32:30 -0700152 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
153 extract_errors_python onos >> $WORKSPACE/error-report.log
Andy Bavier4af02722020-01-15 10:24:24 -0700154
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200155 gzip error-report.log || true
156
Matteo Scandolo4548f092020-09-29 11:27:35 -0700157 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Andy Bavier36c688c2020-03-17 07:32:30 -0700158 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier2178d102020-02-06 16:22:11 -0700159
Andy Bavier36c688c2020-03-17 07:32:30 -0700160 cd $WORKSPACE
161 gzip *-combined.log || true
162
163 ## shut down voltha but leave kind-voltha cluster
Matteo Scandolo4548f092020-09-29 11:27:35 -0700164 cd $WORKSPACE/kind-voltha/
Andy Bavier36c688c2020-03-17 07:32:30 -0700165 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -0700166 '''
Andrea Campanellacd025202020-07-31 13:29:40 +0200167 step([$class: 'RobotPublisher',
Andy Bavier0088c212020-01-08 13:44:03 -0700168 disableArchiveOutput: false,
Andrea Campanellacd025202020-07-31 13:29:40 +0200169 logFileName: '**/log*.html',
Andy Bavier0088c212020-01-08 13:44:03 -0700170 otherFiles: '',
Andrea Campanellacd025202020-07-31 13:29:40 +0200171 outputFileName: '**/output*.xml',
172 outputPath: 'RobotLogs',
Andy Bavier0088c212020-01-08 13:44:03 -0700173 passThreshold: 100,
Andrea Campanellacd025202020-07-31 13:29:40 +0200174 reportFileName: '**/report*.html',
Andy Bavier0088c212020-01-08 13:44:03 -0700175 unstableThreshold: 0]);
Andy Bavier36c688c2020-03-17 07:32:30 -0700176 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Andy Bavier0088c212020-01-08 13:44:03 -0700177
178 }
179 }
180}