blob: 56c629144b02f9f19e5543cc480907200ad3b5e8 [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 Scandolo861a53a2020-09-16 11:39:42 -070052 ]],
53 branches: [[ name: "master", ]],
54 extensions: [
55 [$class: 'WipeWorkspace'],
56 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
57 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
58 ],
59 ])
60 }
61 }
Matteo Scandolofa90bb12020-09-18 11:00:50 -070062 stage('Cleanup') {
63 steps {
64 sh """
65 cd $WORKSPACE/kind-voltha/
66 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
67 """
68 }
69 }
Matteo Scandolo861a53a2020-09-16 11:39:42 -070070 stage('Clone voltha-system-tests') {
71 steps {
72 checkout([
73 $class: 'GitSCM',
74 userRemoteConfigs: [[
75 url: "https://gerrit.opencord.org/voltha-system-tests",
Matteo Scandolo861a53a2020-09-16 11:39:42 -070076 ]],
77 branches: [[ name: "${branch}", ]],
78 extensions: [
79 [$class: 'WipeWorkspace'],
80 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
81 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
82 ],
83 ])
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070084 }
85 }
86
87 stage('Deploy Voltha') {
88 steps {
89 sh """
90 export EXTRA_HELM_FLAGS=""
91 if [ "${branch}" != "master" ]; then
92 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo861a53a2020-09-16 11:39:42 -070093 source "$WORKSPACE/kind-voltha/releases/${branch}"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070094 else
95 echo "on master, using default settings for kind-voltha"
96 fi
97
Matteo Scandolo861a53a2020-09-16 11:39:42 -070098 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags}"
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -070099
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700100 cd $WORKSPACE/kind-voltha/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700101 ./voltha up
102 """
103 }
104 }
105
106 stage('Functional Tests') {
107 environment {
108 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FunctionalTests"
109 }
110 steps {
111 sh '''
112 set +e
113 mkdir -p $ROBOT_LOGS_DIR
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700114 cd $WORKSPACE/kind-voltha/scripts
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700115 ./log-collector.sh > /dev/null &
116 ./log-combine.sh > /dev/null &
117
118 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700119 make -C $WORKSPACE/voltha-system-tests functional-single-kind || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700120 '''
121 }
122 }
123
Hung-Wei Chiuc72fe1f2020-05-04 13:54:32 -0700124 stage('Alarm Tests') {
125 environment {
126 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/AlarmTests"
127 }
128 steps {
129 sh '''
130 set +e
131 mkdir -p $WORKSPACE/RobotLogs
132
133 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700134 make -C $WORKSPACE/voltha-system-tests bbsim-alarms-kind || true
Hung-Wei Chiuc72fe1f2020-05-04 13:54:32 -0700135 '''
136 }
137 }
138
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700139 stage('Failure/Recovery Tests') {
140 environment {
141 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FailureTests"
142 }
143 steps {
144 sh '''
145 set +e
146 mkdir -p $WORKSPACE/RobotLogs
147
148 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700149 make -C $WORKSPACE/voltha-system-tests bbsim-failurescenarios || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700150 '''
151 }
152 }
153
154 stage('Error Tests') {
155 environment {
156 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ErrorTests"
157 }
158 steps {
159 sh '''
160 set +e
161 mkdir -p $WORKSPACE/RobotLogs
162
163 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700164 make -C $WORKSPACE/voltha-system-tests bbsim-errorscenarios || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700165 '''
166 }
167 }
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700168 }
169
170 post {
171 always {
172 sh '''
173 set +e
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700174 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700175 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
176 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
177 kubectl get nodes -o wide
178 kubectl get pods -o wide
179 kubectl get pods -n voltha -o wide
180
181 sleep 60 # Wait for log-collector and log-combine to complete
182
183 ## Pull out errors from log files
184 extract_errors_go() {
185 echo
186 echo "Error summary for $1:"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700187 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700188 echo
189 }
190
191 extract_errors_python() {
192 echo
193 echo "Error summary for $1:"
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700194 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700195 echo
196 }
197
198 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
199 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
200 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
201 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
202 extract_errors_python onos >> $WORKSPACE/error-report.log
203
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200204 gzip error-report.log || true
205
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700206 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700207 tar czf $WORKSPACE/container-logs.tgz *
208
209 cd $WORKSPACE
210 gzip *-combined.log || true
211
212 ## shut down voltha but leave kind-voltha cluster
Matteo Scandolo861a53a2020-09-16 11:39:42 -0700213 cd $WORKSPACE/kind-voltha/
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700214 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavierfcae3832020-06-04 08:51:10 -0700215 kubectl delete deployment voltctl || true
Hung-Wei Chiu5ec2edf2020-04-30 14:53:13 -0700216 '''
217 step([$class: 'RobotPublisher',
218 disableArchiveOutput: false,
219 logFileName: '**/log*.html',
220 otherFiles: '',
221 outputFileName: '**/output*.xml',
222 outputPath: 'RobotLogs',
223 passThreshold: 100,
224 reportFileName: '**/report*.html',
225 unstableThreshold: 0]);
226
227 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
228
229 }
230 }
231}