blob: e7bb4f0cbc272ef9a557790e6e83f45d0f2b876c [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"
Matteo Scandolo4d1a12f2020-12-07 16:17:12 -080032 NAME="minimal"
Andy Bavier0088c212020-01-08 13:44:03 -070033 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 ]],
Suchitra Vemuri1143ae32021-03-26 01:08:37 +000069 branches: [[ name: "${branch}", ]],
Matteo Scandolo4548f092020-09-29 11:27:35 -070070 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 {
Matteo Scandoloe4abf852021-05-18 09:12:11 -070081 timeout(time: 15, unit: 'MINUTES') {
82 sh """
83 export EXTRA_HELM_FLAGS=""
84 if [ "${branch}" != "master" ]; then
85 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
86 source "$WORKSPACE/kind-voltha/releases/${branch}"
87 else
88 echo "on master, using default settings for kind-voltha"
89 fi
Andy Bavier10926f12020-03-27 16:53:43 -070090
Matteo Scandoloe4abf852021-05-18 09:12:11 -070091 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
Andy Bavier10926f12020-03-27 16:53:43 -070092
Matteo Scandoloe4abf852021-05-18 09:12:11 -070093 cd $WORKSPACE/kind-voltha/
94 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
95 ./voltha up
96 """
97 }
Andy Bavier0088c212020-01-08 13:44:03 -070098 }
99 }
100
101 stage('Run E2E Tests') {
102 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700103 // this may potentially fail as we don't know how many times we repeat this tests
104 timeout(time: 30, unit: 'MINUTES') {
105 sh """
106 set +e
107 mkdir -p $WORKSPACE/RobotLogs
Andy Bavier36c688c2020-03-17 07:32:30 -0700108
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700109 cd $WORKSPACE/kind-voltha/scripts
110 ./log-collector.sh > /dev/null &
111 ./log-combine.sh > /dev/null &
Andy Bavier36c688c2020-03-17 07:32:30 -0700112
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700113 for i in \$(seq 1 ${testRuns})
114 do
115 export ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs/\$i -e PowerSwitch"
116 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
117 echo "Completed run: \$i"
118 echo ""
119 done
120 """
121 }
Andy Bavier0088c212020-01-08 13:44:03 -0700122 }
123 }
124 }
125
126 post {
127 always {
128 sh '''
129 set +e
Matteo Scandolo4548f092020-09-29 11:27:35 -0700130 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700131 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
132 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Andy Bavier0088c212020-01-08 13:44:03 -0700133 kubectl get nodes -o wide
134 kubectl get pods -o wide
135 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700136
Andy Bavier36c688c2020-03-17 07:32:30 -0700137 sleep 60 # Wait for log-collector and log-combine to complete
Andy Bavier4af02722020-01-15 10:24:24 -0700138
139 ## Pull out errors from log files
140 extract_errors_go() {
141 echo
142 echo "Error summary for $1:"
Matteo Scandolo4548f092020-09-29 11:27:35 -0700143 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700144 echo
145 }
146
147 extract_errors_python() {
148 echo
149 echo "Error summary for $1:"
Matteo Scandolo4548f092020-09-29 11:27:35 -0700150 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700151 echo
152 }
153
154 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
155 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
156 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
Andy Bavier36c688c2020-03-17 07:32:30 -0700157 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
158 extract_errors_python onos >> $WORKSPACE/error-report.log
Andy Bavier4af02722020-01-15 10:24:24 -0700159
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200160 gzip error-report.log || true
161
Matteo Scandolo4548f092020-09-29 11:27:35 -0700162 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Andy Bavier36c688c2020-03-17 07:32:30 -0700163 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier2178d102020-02-06 16:22:11 -0700164
Andy Bavier36c688c2020-03-17 07:32:30 -0700165 cd $WORKSPACE
166 gzip *-combined.log || true
167
168 ## shut down voltha but leave kind-voltha cluster
Andrea Campanella57735a82021-05-18 13:22:49 +0200169 if [ "${branch}" != "master" ]; then
170 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
171 source "$WORKSPACE/kind-voltha/releases/${branch}"
172 else
173 echo "on master, using default settings for kind-voltha"
174 fi
Matteo Scandolo4548f092020-09-29 11:27:35 -0700175 cd $WORKSPACE/kind-voltha/
Andy Bavier36c688c2020-03-17 07:32:30 -0700176 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -0700177 '''
Andrea Campanellacd025202020-07-31 13:29:40 +0200178 step([$class: 'RobotPublisher',
Andy Bavier0088c212020-01-08 13:44:03 -0700179 disableArchiveOutput: false,
Andrea Campanellacd025202020-07-31 13:29:40 +0200180 logFileName: '**/log*.html',
Andy Bavier0088c212020-01-08 13:44:03 -0700181 otherFiles: '',
Andrea Campanellacd025202020-07-31 13:29:40 +0200182 outputFileName: '**/output*.xml',
183 outputPath: 'RobotLogs',
Andy Bavier0088c212020-01-08 13:44:03 -0700184 passThreshold: 100,
Andrea Campanellacd025202020-07-31 13:29:40 +0200185 reportFileName: '**/report*.html',
Andy Bavier0088c212020-01-08 13:44:03 -0700186 unstableThreshold: 0]);
Andy Bavier36c688c2020-03-17 07:32:30 -0700187 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Andy Bavier0088c212020-01-08 13:44:03 -0700188
189 }
190 }
191}