blob: bafca7544b203833139fc3aa32c9097de8415754 [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 {
Andrea Campanella2f21f982020-09-11 13:26:40 +020026 timeout(time: 60, unit: 'MINUTES')
Kailash4b323ff2019-08-02 17:52:49 -070027 }
Andy Bavier218385e2019-11-13 09:51:38 -070028 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Andy Bavier292121d2020-04-09 12:50:35 -070031 PATH="$HOME/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Andy Bavier218385e2019-11-13 09:51:38 -070032 TYPE="minimal"
33 FANCY=0
Hung-Wei Chiuf284d3f2020-04-08 11:38:13 -070034 WITH_SIM_ADAPTERS="no"
35 WITH_RADIUS="yes"
36 WITH_BBSIM="yes"
37 DEPLOY_K8S="yes"
Andy Bavier218385e2019-11-13 09:51:38 -070038 VOLTHA_LOG_LEVEL="DEBUG"
Andrea Campanellafe950382020-09-10 18:12:11 +020039 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
Andy Bavierd9870042020-06-23 13:16:47 -070041 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs -e PowerSwitch"
pierventref48ebc12020-07-17 16:01:32 +020042 KARAF_HOME="${params.karafHome}"
43 DIAGS_PROFILE="VOLTHA_PROFILE"
Andy Bavier218385e2019-11-13 09:51:38 -070044 }
Kailash8b8de742019-07-30 08:54:51 -070045 stages {
46
Andy Bavier4c8b3232019-11-22 16:17:47 -070047 stage('Repo') {
48 steps {
Andy Bavier2c9ce042019-11-23 07:36:31 -070049 step([$class: 'WsCleanup'])
Andy Bavier4c8b3232019-11-22 16:17:47 -070050 checkout(changelog: true,
51 poll: false,
52 scm: [$class: 'RepoScm',
53 manifestRepositoryUrl: "${params.manifestUrl}",
Andy Bavier6dfaf7e2020-03-30 14:52:59 -070054 manifestBranch: "${params.branch}",
Andy Bavier4c8b3232019-11-22 16:17:47 -070055 currentBranch: true,
56 destinationDir: 'voltha',
57 forceSync: true,
58 resetFirst: true,
59 quiet: true,
60 jobs: 4,
61 showAllChanges: true]
62 )
63 }
64 }
65
Kailash8b8de742019-07-30 08:54:51 -070066 stage('Download kind-voltha') {
67 steps {
68 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -070069 cd $HOME
Andy Bavierb5c8caf2020-04-06 14:12:07 -070070 [ -d kind-voltha ] || git clone https://gerrit.opencord.org/kind-voltha
Andy Bavier2e009302020-03-19 08:46:13 -070071 rm -rf $HOME/kind-voltha/scripts/logger
Andy Bavier36c688c2020-03-17 07:32:30 -070072 cd $HOME/kind-voltha
73 git pull
Kailash8b8de742019-07-30 08:54:51 -070074 """
75 }
76 }
77
78 stage('Deploy Voltha') {
79 steps {
80 sh """
Andy Bavierdc8bc2c2020-03-29 16:25:02 -070081 export EXTRA_HELM_FLAGS=""
Andy Bavier6dfaf7e2020-03-30 14:52:59 -070082 if [ "${branch}" != "master" ]; then
83 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
84 source "$HOME/kind-voltha/releases/${branch}"
Andy Bavier10926f12020-03-27 16:53:43 -070085 else
86 echo "on master, using default settings for kind-voltha"
87 fi
88
Hung-Wei Chiuf284d3f2020-04-08 11:38:13 -070089 if [ "${workFlow}" == "DT" ]; then
90 export WITH_DHCP=no
91 export WITH_IGMP=no
92 export WITH_EAPOL=no
93 export WITH_RADIUS=no
Andrea Campanellafe950382020-09-10 18:12:11 +020094 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
Hung-Wei Chiuf284d3f2020-04-08 11:38:13 -070095 fi
96
Andy Bavier10926f12020-03-27 16:53:43 -070097 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
98
Andy Bavier36c688c2020-03-17 07:32:30 -070099 cd $HOME/kind-voltha/
100 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
Andy Bavier218385e2019-11-13 09:51:38 -0700101 ./voltha up
Kailash8b8de742019-07-30 08:54:51 -0700102 """
103 }
104 }
105
Kailash8b8de742019-07-30 08:54:51 -0700106 stage('Run E2E Tests') {
107 steps {
108 sh '''
Andy Bavier4af02722020-01-15 10:24:24 -0700109 set +e
Andy Bavier2c9ce042019-11-23 07:36:31 -0700110 mkdir -p $WORKSPACE/RobotLogs
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700111
Andy Bavier36c688c2020-03-17 07:32:30 -0700112 cd $HOME/kind-voltha/scripts
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700113 ./log-collector.sh > /dev/null &
Andy Bavier7afb11c2020-02-13 11:25:20 -0700114 ./log-combine.sh > /dev/null &
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700115
Andy Bavier6612f072020-04-16 10:22:19 -0700116 make -C $WORKSPACE/voltha/voltha-system-tests ${makeTarget} || true
Kailash8b8de742019-07-30 08:54:51 -0700117 '''
118 }
119 }
120 }
121
122 post {
123 always {
124 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -0700125 set +e
Andy Bavier36c688c2020-03-17 07:32:30 -0700126 cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700127 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
128 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Kailash887a2962019-08-14 13:26:33 -0700129 kubectl get nodes -o wide
130 kubectl get pods -o wide
131 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700132
Andy Bavier7afb11c2020-02-13 11:25:20 -0700133 sleep 60 # Wait for log-collector and log-combine to complete
134
Andy Bavierb30c0a02020-03-03 17:21:23 -0700135 ## Pull out errors from log files
136 extract_errors_go() {
137 echo
138 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700139 grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700140 echo
141 }
142
143 extract_errors_python() {
144 echo
145 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700146 grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700147 echo
148 }
149
150 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
151 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
152 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
153 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
154 extract_errors_python onos >> $WORKSPACE/error-report.log
155
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200156 gzip error-report.log || true
157
Andy Bavier36c688c2020-03-17 07:32:30 -0700158 cd $HOME/kind-voltha/scripts/logger/combined/
Andy Bavier7afb11c2020-02-13 11:25:20 -0700159 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier4af02722020-01-15 10:24:24 -0700160
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700161 cd $WORKSPACE
Andy Bavierb86ca422020-02-13 05:19:43 -0700162 gzip *-combined.log || true
Andy Bavier2178d102020-02-06 16:22:11 -0700163
Andy Bavier36c688c2020-03-17 07:32:30 -0700164 ## shut down voltha but leave kind-voltha cluster
165 cd $HOME/kind-voltha/
166 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavierfcae3832020-06-04 08:51:10 -0700167 kubectl delete deployment voltctl || true
Kailash8b8de742019-07-30 08:54:51 -0700168 '''
169 step([$class: 'RobotPublisher',
170 disableArchiveOutput: false,
171 logFileName: 'RobotLogs/log*.html',
172 otherFiles: '',
173 outputFileName: 'RobotLogs/output*.xml',
174 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700175 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700176 reportFileName: 'RobotLogs/report*.html',
177 unstableThreshold: 0]);
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700178 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Kailash8b8de742019-07-30 08:54:51 -0700179
180 }
181 }
182}