blob: 3e72f32e34c68ab0f41f22d3f69a0446ffa3cc53 [file] [log] [blame]
Kailashaad71012019-08-27 10:36:53 -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 {
Zack Williamsb3292082019-10-11 17:15:18 -070023 label "${params.buildNode}"
Kailashaad71012019-08-27 10:36:53 -070024 }
25 options {
Andy Bavier4af02722020-01-15 10:24:24 -070026 timeout(time: 90, unit: 'MINUTES')
27 }
28 environment {
Matteo Scandolo9aae4952020-09-14 13:05:53 -070029 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Andy Bavier8b118b72020-04-28 12:59:30 -070030 VOLTHA_LOG_LEVEL="DEBUG"
Andy Bavier4af02722020-01-15 10:24:24 -070031 FANCY=0
32 WITH_SIM_ADAPTERS="n"
Matteo Scandolo39045a92020-07-29 08:58:29 -070033 NAME="test"
34 VOLTCONFIG="$HOME/.volt/config-$NAME"
35 KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME"
Kailashaad71012019-08-27 10:36:53 -070036 }
37
38 stages {
Matteo Scandolo9aae4952020-09-14 13:05:53 -070039 stage('Clone kind-voltha') {
Kailashaad71012019-08-27 10:36:53 -070040 steps {
Matteo Scandolo9aae4952020-09-14 13:05:53 -070041 checkout([
42 $class: 'GitSCM',
43 userRemoteConfigs: [[
44 url: "https://gerrit.opencord.org/kind-voltha",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000045 refspec: "${kindVolthaChange}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -070046 ]],
47 branches: [[ name: "master", ]],
48 extensions: [
49 [$class: 'WipeWorkspace'],
50 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
51 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
52 ],
53 ])
Matteo Scandolo57a06632020-09-18 18:38:54 -070054 sh """
55 if [ '${kindVolthaChange}' != '' ] ; then
56 cd $WORKSPACE/kind-voltha
57 git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
58 fi
59 """
Kailashaad71012019-08-27 10:36:53 -070060 }
61 }
Matteo Scandolo9aae4952020-09-14 13:05:53 -070062 stage('Clone voltha-system-tests') {
Kailashaad71012019-08-27 10:36:53 -070063 steps {
Matteo Scandolo9aae4952020-09-14 13:05:53 -070064 checkout([
65 $class: 'GitSCM',
66 userRemoteConfigs: [[
67 url: "https://gerrit.opencord.org/voltha-system-tests",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000068 refspec: "${volthaSystemTestsChange}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -070069 ]],
70 branches: [[ name: "${branch}", ]],
71 extensions: [
72 [$class: 'WipeWorkspace'],
73 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
74 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
75 ],
76 ])
Matteo Scandolo57a06632020-09-18 18:38:54 -070077 sh """
78 if [ '${volthaSystemTestsChange}' != '' ] ; then
79 cd $WORKSPACE/voltha-system-tests
80 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
81 fi
82 """
Matteo Scandolo9aae4952020-09-14 13:05:53 -070083 }
84 }
Matteo Scandolo8fc674c2020-09-14 18:05:37 -070085 // If the repo under test is not kind-voltha
86 // then download it and checkout the patch
Matteo Scandolo9aae4952020-09-14 13:05:53 -070087 stage('Download Patch') {
Matteo Scandolo8fc674c2020-09-14 18:05:37 -070088 when {
89 expression {
90 return "${gerritProject}" != 'kind-voltha';
91 }
92 }
Matteo Scandolo9aae4952020-09-14 13:05:53 -070093 steps {
94 checkout([
95 $class: 'GitSCM',
96 userRemoteConfigs: [[
97 url: "https://gerrit.opencord.org/${gerritProject}",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000098 refspec: "${gerritRefspec}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -070099 ]],
100 branches: [[ name: "${branch}", ]],
101 extensions: [
102 [$class: 'WipeWorkspace'],
103 [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"],
104 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
105 ],
106 ])
Kailashaad71012019-08-27 10:36:53 -0700107 sh """
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700108 pushd $WORKSPACE/${gerritProject}
Matteo Scandolo57a06632020-09-18 18:38:54 -0700109 git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD
110
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700111 echo "Currently on commit: \n"
112 git log -1 --oneline
113 popd
114 """
Kailashaad71012019-08-27 10:36:53 -0700115 }
116 }
Matteo Scandolo8fc674c2020-09-14 18:05:37 -0700117 // If the repo under test is kind-voltha we don't need to download it again,
118 // as we already have it, simply checkout the patch
119 stage('Checkout kind-voltha patch') {
120 when {
121 expression {
122 return "${gerritProject}" == 'kind-voltha';
123 }
124 }
125 steps {
126 sh """
127 cd $WORKSPACE/kind-voltha
128 git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD
129 """
130 }
131 }
Kailashaad71012019-08-27 10:36:53 -0700132 stage('Create K8s Cluster') {
133 steps {
134 sh """
Zack Williams03ebb272020-03-27 09:42:33 -0700135 if [ "${branch}" != "master" ]; then
136 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700137 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700138 else
139 echo "on master, using default settings for kind-voltha"
140 fi
141
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700142 cd $WORKSPACE/kind-voltha/
Andy Bavier4af02722020-01-15 10:24:24 -0700143 JUST_K8S=y ./voltha up
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700144 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
Kailashaad71012019-08-27 10:36:53 -0700145 """
146 }
147 }
148
149 stage('Build Images') {
150 steps {
151 sh """
Andy Bavierb99c3d32020-02-18 11:14:17 -0700152 make-local () {
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700153 make -C $WORKSPACE/\$1 DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
Andy Bavierb99c3d32020-02-18 11:14:17 -0700154 }
Andy Bavier0ed77062020-02-18 10:09:19 -0700155 if [ "${gerritProject}" = "pyvoltha" ]; then
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700156 make -C $WORKSPACE/pyvoltha/ dist
157 export LOCAL_PYVOLTHA=$WORKSPACE/pyvoltha/
Andy Bavierb99c3d32020-02-18 11:14:17 -0700158 make-local voltha-openonu-adapter
159 elif [ "${gerritProject}" = "voltha-lib-go" ]; then
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700160 make -C $WORKSPACE/voltha-lib-go/ build
161 export LOCAL_LIB_GO=$WORKSPACE/voltha-lib-go/
Andy Bavierb99c3d32020-02-18 11:14:17 -0700162 make-local voltha-go
163 make-local voltha-openolt-adapter
164 elif [ "${gerritProject}" = "voltha-protos" ]; then
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700165 make -C $WORKSPACE/voltha-protos/ build
166 export LOCAL_PROTOS=$WORKSPACE/voltha-protos/
Andy Bavierb99c3d32020-02-18 11:14:17 -0700167 make-local voltha-go
168 make-local voltha-openolt-adapter
169 make-local voltha-openonu-adapter
170 make-local ofagent-py
Andy Bavier178c47b2020-04-01 13:05:43 -0700171 elif [ "${gerritProject}" = "voltctl" ]; then
Andy Bavierdecde3f2020-04-01 15:29:43 -0700172 # Set and handle GOPATH and PATH
173 export GOPATH=\${GOPATH:-$WORKSPACE/go}
174 export PATH=\$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:\$GOPATH/bin
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700175 make -C $WORKSPACE/voltctl/ build
Andy Bavier4318f8d2020-04-09 13:50:53 -0700176 elif ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|kind-voltha)\$ ]]; then
Andy Bavierb99c3d32020-02-18 11:14:17 -0700177 make-local ${gerritProject}
Andy Bavier07615f92019-10-03 12:31:18 -0700178 fi
Kailashaad71012019-08-27 10:36:53 -0700179 """
180 }
181 }
182
183 stage('Push Images') {
184 steps {
185 sh '''
Zack Williams03ebb272020-03-27 09:42:33 -0700186 if [ "${branch}" != "master" ]; then
187 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700188 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700189 else
190 echo "on master, using default settings for kind-voltha"
191 fi
192
Andy Bavierb5c8caf2020-04-06 14:12:07 -0700193 if ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|voltctl|kind-voltha)\$ ]]; then
Andy Bavier07615f92019-10-03 12:31:18 -0700194 export GOROOT=/usr/local/go
195 export GOPATH=\$(pwd)
Andy Bavier07615f92019-10-03 12:31:18 -0700196 docker images | grep citest
Matteo Scandolo2e64c102020-07-29 19:41:02 -0700197 for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2; done
Andy Bavier07615f92019-10-03 12:31:18 -0700198 fi
Kailashaad71012019-08-27 10:36:53 -0700199 '''
200 }
201 }
Andy Bavier8b118b72020-04-28 12:59:30 -0700202
203 stage('ATT workflow') {
204 environment {
205 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow"
206 }
Kailashaad71012019-08-27 10:36:53 -0700207 steps {
Kailash Khalasiaf3a2a62019-10-02 09:44:08 -0700208 sh '''
Zack Williams03ebb272020-03-27 09:42:33 -0700209 if [ "${branch}" != "master" ]; then
210 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700211 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700212 else
213 echo "on master, using default settings for kind-voltha"
214 fi
215
Andy Bavier8b118b72020-04-28 12:59:30 -0700216 # Workflow-specific flags
217 export WITH_RADIUS=yes
218 export WITH_BBSIM=yes
219 export DEPLOY_K8S=yes
Matteo Scandolo3d6a21d2020-09-04 07:34:24 -0700220 export CONFIG_SADIS="external"
221 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
Andy Bavier8b118b72020-04-28 12:59:30 -0700222
Zack Williams03ebb272020-03-27 09:42:33 -0700223 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
Kailashaad71012019-08-27 10:36:53 -0700224
Andy Bavier4af02722020-01-15 10:24:24 -0700225 IMAGES=""
Kailashaad71012019-08-27 10:36:53 -0700226 if [ "${gerritProject}" = "voltha-go" ]; then
Andy Bavier4af02722020-01-15 10:24:24 -0700227 IMAGES="rw_core ro_core "
228 elif [ "${gerritProject}" = "ofagent-py" ]; then
Andy Bavier8d816422020-03-23 15:34:26 -0700229 IMAGES="ofagent_py "
230 EXTRA_HELM_FLAGS+="--set use_ofagent_go=false "
Andy Bavier9c412a82020-03-23 12:00:28 -0700231 elif [ "${gerritProject}" = "ofagent-go" ]; then
Andy Bavier8d816422020-03-23 15:34:26 -0700232 IMAGES="ofagent_go "
Andy Bavier4af02722020-01-15 10:24:24 -0700233 elif [ "${gerritProject}" = "voltha-onos" ]; then
234 IMAGES="onos "
235 elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then
236 IMAGES="adapter_open_olt "
237 elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then
238 IMAGES="adapter_open_onu "
239 elif [ "${gerritProject}" = "voltha-api-server" ]; then
240 IMAGES="afrouter afrouterd "
241 elif [ "${gerritProject}" = "bbsim" ]; then
242 IMAGES="bbsim "
Andy Bavierec0c10d2020-02-14 13:06:27 -0700243 elif [ "${gerritProject}" = "pyvoltha" ]; then
244 IMAGES="adapter_open_onu "
Andy Bavierb99c3d32020-02-18 11:14:17 -0700245 elif [ "${gerritProject}" = "voltha-lib-go" ]; then
246 IMAGES="rw_core ro_core adapter_open_olt "
247 elif [ "${gerritProject}" = "voltha-protos" ]; then
248 IMAGES="rw_core ro_core adapter_open_olt adapter_open_onu ofagent "
Zack Williams04997502019-10-04 14:32:20 -0700249 else
Andy Bavier4af02722020-01-15 10:24:24 -0700250 echo "No images to push"
Scott Baker9ac23712019-10-02 09:26:50 -0700251 fi
252
Andy Bavier4af02722020-01-15 10:24:24 -0700253 for I in \$IMAGES
254 do
255 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
256 done
257
Kailash Khalasiaf3a2a62019-10-02 09:44:08 -0700258 if [ "${gerritProject}" = "voltha-helm-charts" ]; then
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700259 export CHART_PATH=$WORKSPACE/voltha-helm-charts
Andy Bavier45406342019-10-02 16:45:40 -0700260 export VOLTHA_CHART=\$CHART_PATH/voltha
261 export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt
262 export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu
Kailash Khalasiaf3a2a62019-10-02 09:44:08 -0700263 helm dep update \$VOLTHA_CHART
264 helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART
265 helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART
266 fi
267
Andy Bavier178c47b2020-04-01 13:05:43 -0700268 if [ "${gerritProject}" = "voltctl" ]; then
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700269 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
270 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
271 md5sum $WORKSPACE/kind-voltha/bin/voltctl
Andy Bavier178c47b2020-04-01 13:05:43 -0700272 fi
273
Andy Bavier8b118b72020-04-28 12:59:30 -0700274 printenv
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800275
276 # start logging
277 mkdir -p $WORKSPACE/att
278 _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log &
Kailashaad71012019-08-27 10:36:53 -0700279
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700280 cd $WORKSPACE/kind-voltha/
Andy Bavier8b118b72020-04-28 12:59:30 -0700281 ./voltha up
282
Matteo Scandolo39045a92020-07-29 08:58:29 -0700283 # $NAME-env.sh contains the environment we used
Andy Bavier8b118b72020-04-28 12:59:30 -0700284 # Save value of EXTRA_HELM_FLAGS there to use in subsequent stages
Matteo Scandolo39045a92020-07-29 08:58:29 -0700285 echo export EXTRA_HELM_FLAGS=\\"\$EXTRA_HELM_FLAGS\\" >> $NAME-env.sh
Andy Bavier8b118b72020-04-28 12:59:30 -0700286
287 mkdir -p $ROBOT_LOGS_DIR
Andy Bavierd9870042020-06-23 13:16:47 -0700288 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
Andy Bavierdb003082020-02-04 11:57:36 -0700289
290 # By default, all tests tagged 'sanity' are run. This covers basic functionality
291 # like running through the ATT workflow for a single subscriber.
Andy Bavier8b118b72020-04-28 12:59:30 -0700292 export TARGET=sanity-single-kind
Andy Bavierdb003082020-02-04 11:57:36 -0700293
294 # If the Gerrit comment contains a line with "functional tests" then run the full
295 # functional test suite. This covers tests tagged either 'sanity' or 'functional'.
296 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
297 REGEX="functional tests"
298 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
Andy Bavier8b118b72020-04-28 12:59:30 -0700299 TARGET=functional-single-kind
Andy Bavierdb003082020-02-04 11:57:36 -0700300 fi
301
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700302 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800303
304 # stop logging
305 P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')"
306 if [ -n "$P_IDS" ]; then
307 echo $P_IDS
308 for P_ID in $P_IDS; do
309 kill -9 $P_ID
310 done
311 fi
312
313 # get pods information
314 kubectl get pods -o wide > $WORKSPACE/att/pods.txt || true
315 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-images.txt || true
316 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/att/pod-imagesId.txt || true
Andy Bavier8b118b72020-04-28 12:59:30 -0700317 '''
318 }
319 }
320
321 stage('DT workflow') {
322 environment {
323 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow"
324 }
325 steps {
326 sh '''
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700327 cd $WORKSPACE/kind-voltha/
Matteo Scandolo39045a92020-07-29 08:58:29 -0700328 source $NAME-env.sh
Andy Bavier8b118b72020-04-28 12:59:30 -0700329 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
330
331 # Workflow-specific flags
332 export WITH_RADIUS=no
333 export WITH_EAPOL=no
334 export WITH_DHCP=no
335 export WITH_IGMP=no
Matteo Scandolo3d6a21d2020-09-04 07:34:24 -0700336 export CONFIG_SADIS="external"
337 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
Andy Bavier8b118b72020-04-28 12:59:30 -0700338
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800339 # start logging
340 mkdir -p $WORKSPACE/dt
341 _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log &
342
Andy Bavier8b118b72020-04-28 12:59:30 -0700343 DEPLOY_K8S=n ./voltha up
344
345 mkdir -p $ROBOT_LOGS_DIR
Andy Bavierd9870042020-06-23 13:16:47 -0700346 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
Andy Bavier8b118b72020-04-28 12:59:30 -0700347
348 # By default, all tests tagged 'sanityDt' are run. This covers basic functionality
349 # like running through the DT workflow for a single subscriber.
350 export TARGET=sanity-kind-dt
351
352 # If the Gerrit comment contains a line with "functional tests" then run the full
353 # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'.
354 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
355 REGEX="functional tests"
356 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
357 TARGET=functional-single-kind-dt
358 fi
359
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700360 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800361
362 # stop logging
363 P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')"
364 if [ -n "$P_IDS" ]; then
365 echo $P_IDS
366 for P_ID in $P_IDS; do
367 kill -9 $P_ID
368 done
369 fi
370
371 # get pods information
372 kubectl get pods -o wide > $WORKSPACE/dt/pods.txt || true
373 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-images.txt || true
374 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/dt/pod-imagesId.txt || true
Kailashaad71012019-08-27 10:36:53 -0700375 '''
376 }
377 }
Matteo Scandolo294133a2020-09-04 11:19:43 -0700378
379 stage('TT workflow') {
380 environment {
381 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow"
382 }
383 steps {
384 sh '''
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700385 cd $WORKSPACE/kind-voltha/
Matteo Scandolo294133a2020-09-04 11:19:43 -0700386 source $NAME-env.sh
387 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
388
389 # Workflow-specific flags
390 export WITH_RADIUS=no
391 export WITH_EAPOL=no
392 export WITH_DHCP=yes
393 export WITH_IGMP=yes
394 export CONFIG_SADIS="external"
395 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
396
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800397 # start logging
398 mkdir -p $WORKSPACE/tt
399 _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log &
400
Matteo Scandolo294133a2020-09-04 11:19:43 -0700401 DEPLOY_K8S=n ./voltha up
402
403 mkdir -p $ROBOT_LOGS_DIR
404 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
405
406 # By default, all tests tagged 'sanityTt' are run. This covers basic functionality
407 # like running through the TT workflow for a single subscriber.
408 export TARGET=sanity-kind-tt
409
410 # If the Gerrit comment contains a line with "functional tests" then run the full
411 # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'.
412 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
413 REGEX="functional tests"
414 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
415 TARGET=functional-single-kind-tt
416 fi
417
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700418 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800419
420 # stop logging
421 P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')"
422 if [ -n "$P_IDS" ]; then
423 echo $P_IDS
424 for P_ID in $P_IDS; do
425 kill -9 $P_ID
426 done
427 fi
428
429 # get pods information
430 kubectl get pods -o wide > $WORKSPACE/tt/pods.txt || true
431 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-images.txt || true
432 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/tt/pod-imagesId.txt || true
Matteo Scandolo294133a2020-09-04 11:19:43 -0700433 '''
434 }
435 }
Kailashaad71012019-08-27 10:36:53 -0700436 }
437
438 post {
439 always {
440 sh '''
Andy Bavier07615f92019-10-03 12:31:18 -0700441 set +e
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700442 cp $WORKSPACE/kind-voltha/install-$NAME.log $WORKSPACE/
Andy Bavier4af02722020-01-15 10:24:24 -0700443
444 sync
Matteo Scandolo9aae4952020-09-14 13:05:53 -0700445 md5sum $WORKSPACE/kind-voltha/bin/voltctl
Andy Bavier4af02722020-01-15 10:24:24 -0700446
447 ## Pull out errors from log files
448 extract_errors_go() {
449 echo
450 echo "Error summary for $1:"
451 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
452 echo
453 }
454
455 extract_errors_python() {
456 echo
457 echo "Error summary for $1:"
458 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
459 echo
460 }
461
462 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
463 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
464 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
465 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
466
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800467 gzip $WORKSPACE/att/onos-voltha-combined.log
468 gzip $WORKSPACE/dt/onos-voltha-combined.log
469 gzip $WORKSPACE/tt/onos-voltha-combined.log
Kailashaad71012019-08-27 10:36:53 -0700470 '''
471 step([$class: 'RobotPublisher',
472 disableArchiveOutput: false,
Andy Bavier8b118b72020-04-28 12:59:30 -0700473 logFileName: 'RobotLogs/*/log*.html',
Kailashaad71012019-08-27 10:36:53 -0700474 otherFiles: '',
Andy Bavier8b118b72020-04-28 12:59:30 -0700475 outputFileName: 'RobotLogs/*/output*.xml',
Kailashaad71012019-08-27 10:36:53 -0700476 outputPath: '.',
Andy Bavier8b118b72020-04-28 12:59:30 -0700477 passThreshold: 100,
478 reportFileName: 'RobotLogs/*/report*.html',
Kailashaad71012019-08-27 10:36:53 -0700479 unstableThreshold: 0]);
Matteo Scandolobafd4f02020-12-09 12:14:55 -0800480 archiveArtifacts artifacts: '*.log,**/*.log,**/*.gz,*.gz'
Kailashaad71012019-08-27 10:36:53 -0700481 }
482 }
483}