blob: 38efb38cea812f92c3de839b8840a9c9f50a6a3c [file] [log] [blame]
Kailash8b8de742019-07-30 08:54:51 -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}"
Kailash8b8de742019-07-30 08:54:51 -070024 }
Kailash4b323ff2019-08-02 17:52:49 -070025 options {
26 timeout(time: 40, unit: 'MINUTES')
27 }
Andy Bavier218385e2019-11-13 09:51:38 -070028 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Andy Bavier36c688c2020-03-17 07:32:30 -070031 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/kind-voltha/bin"
Andy Bavier218385e2019-11-13 09:51:38 -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"
Andy Bavier0088c212020-01-08 13:44:03 -070039 CONFIG_SADIS="n"
Andy Bavier4af02722020-01-15 10:24:24 -070040 EXTRA_HELM_FLAGS="--set log_agent.enabled=False ${params.extraHelmFlags}"
Andy Bavier3708d072019-12-10 15:22:18 -070041 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs"
Andy Bavier218385e2019-11-13 09:51:38 -070042 }
Kailash8b8de742019-07-30 08:54:51 -070043 stages {
44
Andy Bavier4c8b3232019-11-22 16:17:47 -070045 stage('Repo') {
46 steps {
Andy Bavier2c9ce042019-11-23 07:36:31 -070047 step([$class: 'WsCleanup'])
Andy Bavier4c8b3232019-11-22 16:17:47 -070048 checkout(changelog: true,
49 poll: false,
50 scm: [$class: 'RepoScm',
51 manifestRepositoryUrl: "${params.manifestUrl}",
52 manifestBranch: "${params.manifestBranch}",
53 currentBranch: true,
54 destinationDir: 'voltha',
55 forceSync: true,
56 resetFirst: true,
57 quiet: true,
58 jobs: 4,
59 showAllChanges: true]
60 )
61 }
62 }
63
Kailash8b8de742019-07-30 08:54:51 -070064 stage('Download kind-voltha') {
65 steps {
66 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -070067 cd $HOME
68 [ -d kind-voltha ] || git clone https://github.com/ciena/kind-voltha.git
Andy Bavier2e009302020-03-19 08:46:13 -070069 rm -rf $HOME/kind-voltha/scripts/logger
Andy Bavier36c688c2020-03-17 07:32:30 -070070 cd $HOME/kind-voltha
71 git pull
Kailash8b8de742019-07-30 08:54:51 -070072 """
73 }
74 }
75
76 stage('Deploy Voltha') {
77 steps {
78 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -070079 cd $HOME/kind-voltha/
80 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
Andy Bavier218385e2019-11-13 09:51:38 -070081 ./voltha up
Kailash8b8de742019-07-30 08:54:51 -070082 """
83 }
84 }
85
Kailash8b8de742019-07-30 08:54:51 -070086 stage('Run E2E Tests') {
87 steps {
88 sh '''
Andy Bavier4af02722020-01-15 10:24:24 -070089 set +e
Andy Bavier2c9ce042019-11-23 07:36:31 -070090 mkdir -p $WORKSPACE/RobotLogs
Kailash8b8de742019-07-30 08:54:51 -070091 git clone https://gerrit.opencord.org/voltha-system-tests
Andy Bavier3c1ccca2020-02-12 16:50:04 -070092
Andy Bavier36c688c2020-03-17 07:32:30 -070093 cd $HOME/kind-voltha/scripts
Andy Bavier3c1ccca2020-02-12 16:50:04 -070094 ./log-collector.sh > /dev/null &
Andy Bavier7afb11c2020-02-13 11:25:20 -070095 ./log-combine.sh > /dev/null &
Andy Bavier3c1ccca2020-02-12 16:50:04 -070096
Andy Bavier4af02722020-01-15 10:24:24 -070097 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
Kailash8b8de742019-07-30 08:54:51 -070098 '''
99 }
100 }
101 }
102
103 post {
104 always {
105 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -0700106 set +e
Andy Bavier36c688c2020-03-17 07:32:30 -0700107 cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
Andy Bavieraec60382019-10-29 15:09:04 -0700108 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
Kailash887a2962019-08-14 13:26:33 -0700109 kubectl get nodes -o wide
110 kubectl get pods -o wide
111 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700112
Andy Bavier7afb11c2020-02-13 11:25:20 -0700113 sleep 60 # Wait for log-collector and log-combine to complete
114
Andy Bavierb30c0a02020-03-03 17:21:23 -0700115 ## Pull out errors from log files
116 extract_errors_go() {
117 echo
118 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700119 grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700120 echo
121 }
122
123 extract_errors_python() {
124 echo
125 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700126 grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700127 echo
128 }
129
130 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
131 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
132 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
133 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
134 extract_errors_python onos >> $WORKSPACE/error-report.log
135
Andy Bavier36c688c2020-03-17 07:32:30 -0700136 cd $HOME/kind-voltha/scripts/logger/combined/
Andy Bavier7afb11c2020-02-13 11:25:20 -0700137 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier4af02722020-01-15 10:24:24 -0700138
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700139 cd $WORKSPACE
Andy Bavierb86ca422020-02-13 05:19:43 -0700140 gzip *-combined.log || true
Andy Bavier2178d102020-02-06 16:22:11 -0700141
Andy Bavier36c688c2020-03-17 07:32:30 -0700142 ## shut down voltha but leave kind-voltha cluster
143 cd $HOME/kind-voltha/
144 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Kailash8b8de742019-07-30 08:54:51 -0700145 '''
146 step([$class: 'RobotPublisher',
147 disableArchiveOutput: false,
148 logFileName: 'RobotLogs/log*.html',
149 otherFiles: '',
150 outputFileName: 'RobotLogs/output*.xml',
151 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700152 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700153 reportFileName: 'RobotLogs/report*.html',
154 unstableThreshold: 0]);
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700155 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Kailash8b8de742019-07-30 08:54:51 -0700156
157 }
158 }
159}