blob: 73346b9a4fcd981ad04402a45fe0206d2149b1f1 [file] [log] [blame]
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -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 Campanella5e352622020-09-09 20:33:29 +020026 timeout(time: 90, unit: 'MINUTES')
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070027 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Matteo Scandolo861a53a2020-09-16 11:39:42 -070031 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070032 TYPE="minimal"
33 FANCY=0
34 WITH_SIM_ADAPTERS="no"
35 WITH_RADIUS="yes"
36 WITH_BBSIM="yes"
37 DEPLOY_K8S="yes"
38 VOLTHA_LOG_LEVEL="DEBUG"
Andrea Campanella2a01b5a2020-09-09 11:38:18 +020039 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
Andy Bavier4be37062020-06-29 15:17:26 -070041 ROBOT_MISC_ARGS="-e PowerSwitch ${params.extraRobotArgs}"
pierventref48ebc12020-07-17 16:01:32 +020042 KARAF_HOME="${params.karafHome}"
43 DIAGS_PROFILE="VOLTHA_PROFILE"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070044 }
45 stages {
Matteo Scandolo861a53a2020-09-16 11:39:42 -070046 stage('Clone kind-voltha') {
47 steps {
48 checkout([
49 $class: 'GitSCM',
50 userRemoteConfigs: [[
51 url: "https://gerrit.opencord.org/kind-voltha",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000052 // refspec: "${kindVolthaChange}"
Matteo Scandolo861a53a2020-09-16 11:39:42 -070053 ]],
54 branches: [[ name: "master", ]],
55 extensions: [
56 [$class: 'WipeWorkspace'],
57 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
58 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
59 ],
60 ])
61 }
62 }
Matteo Scandolofa90bb12020-09-18 11:00:50 -070063 stage('Cleanup') {
64 steps {
65 sh """
66 cd $WORKSPACE/kind-voltha/
67 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
68 """
69 }
70 }
Matteo Scandolo861a53a2020-09-16 11:39:42 -070071 stage('Clone voltha-system-tests') {
72 steps {
73 checkout([
74 $class: 'GitSCM',
75 userRemoteConfigs: [[
76 url: "https://gerrit.opencord.org/voltha-system-tests",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000077 // refspec: "${volthaSystemTestsChange}"
Matteo Scandolo861a53a2020-09-16 11:39:42 -070078 ]],
79 branches: [[ name: "${branch}", ]],
80 extensions: [
81 [$class: 'WipeWorkspace'],
82 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
83 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
84 ],
85 ])
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070086 }
87 }
88
89 stage('Deploy Voltha') {
90 steps {
91 sh """
92 export EXTRA_HELM_FLAGS=""
93 if [ "${branch}" != "master" ]; then
94 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo861a53a2020-09-16 11:39:42 -070095 source "$WORKSPACE/kind-voltha/releases/${branch}"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070096 else
97 echo "on master, using default settings for kind-voltha"
98 fi
99
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700100 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags}"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700101
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700102 cd $WORKSPACE/kind-voltha/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700103 ./voltha up
104 """
105 }
106 }
107
108 stage('Functional Tests') {
109 environment {
110 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FunctionalTests"
111 }
112 steps {
113 sh '''
114 set +e
115 mkdir -p $ROBOT_LOGS_DIR
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700116 cd $WORKSPACE/kind-voltha/scripts
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700117 ./log-collector.sh > /dev/null &
118 ./log-combine.sh > /dev/null &
119
120 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700121 make -C $WORKSPACE/voltha-system-tests functional-single-kind || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700122 '''
123 }
124 }
125
Hung-Wei Chiuc72fe1f2020-05-04 13:54:32 -0700126 stage('Alarm Tests') {
127 environment {
128 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/AlarmTests"
129 }
130 steps {
131 sh '''
132 set +e
133 mkdir -p $WORKSPACE/RobotLogs
134
135 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700136 make -C $WORKSPACE/voltha-system-tests bbsim-alarms-kind || true
Hung-Wei Chiuc72fe1f2020-05-04 13:54:32 -0700137 '''
138 }
139 }
140
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700141 stage('Failure/Recovery Tests') {
142 environment {
143 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FailureTests"
144 }
145 steps {
146 sh '''
147 set +e
148 mkdir -p $WORKSPACE/RobotLogs
149
150 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700151 make -C $WORKSPACE/voltha-system-tests bbsim-failurescenarios || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700152 '''
153 }
154 }
155
156 stage('Error Tests') {
157 environment {
158 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ErrorTests"
159 }
160 steps {
161 sh '''
162 set +e
163 mkdir -p $WORKSPACE/RobotLogs
164
165 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700166 make -C $WORKSPACE/voltha-system-tests bbsim-errorscenarios || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700167 '''
168 }
169 }
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700170 }
171
172 post {
173 always {
174 sh '''
175 set +e
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700176 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700177 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
178 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
179 kubectl get nodes -o wide
180 kubectl get pods -o wide
181 kubectl get pods -n voltha -o wide
182
183 sleep 60 # Wait for log-collector and log-combine to complete
184
185 ## Pull out errors from log files
186 extract_errors_go() {
187 echo
188 echo "Error summary for $1:"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700189 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700190 echo
191 }
192
193 extract_errors_python() {
194 echo
195 echo "Error summary for $1:"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700196 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700197 echo
198 }
199
200 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
201 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
202 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
203 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
204 extract_errors_python onos >> $WORKSPACE/error-report.log
205
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200206 gzip error-report.log || true
207
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700208 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700209 tar czf $WORKSPACE/container-logs.tgz *
210
211 cd $WORKSPACE
212 gzip *-combined.log || true
213
214 ## shut down voltha but leave kind-voltha cluster
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700215 cd $WORKSPACE/kind-voltha/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700216 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavierfcae3832020-06-04 08:51:10 -0700217 kubectl delete deployment voltctl || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700218 '''
219 step([$class: 'RobotPublisher',
220 disableArchiveOutput: false,
221 logFileName: '**/log*.html',
222 otherFiles: '',
223 outputFileName: '**/output*.xml',
224 outputPath: 'RobotLogs',
225 passThreshold: 100,
226 reportFileName: '**/report*.html',
227 unstableThreshold: 0]);
228
229 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
230
231 }
232 }
233}