blob: 61f600c61a4709f22c10198b7c117aedd88d47c4 [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"
Andrea Campanella88f01ea2021-01-04 11:36:25 +010031 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Matteo Scandolo4d1a12f2020-12-07 16:17:12 -080032 NAME="minimal"
Andy Bavier218385e2019-11-13 09:51:38 -070033 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
Andrea Campanella88f01ea2021-01-04 11:36:25 +010047 stage('Clone kind-voltha') {
Andy Bavier4c8b3232019-11-22 16:17:47 -070048 steps {
Andrea Campanella88f01ea2021-01-04 11:36:25 +010049 checkout([
50 $class: 'GitSCM',
51 userRemoteConfigs: [[
52 url: "https://gerrit.opencord.org/kind-voltha",
53 // refspec: "${kindVolthaChange}"
54 ]],
55 branches: [[ name: "master", ]],
56 extensions: [
57 [$class: 'WipeWorkspace'],
58 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
59 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
60 ],
61 ])
Andy Bavier4c8b3232019-11-22 16:17:47 -070062 }
63 }
Andrea Campanella88f01ea2021-01-04 11:36:25 +010064 stage('Cleanup') {
Kailash8b8de742019-07-30 08:54:51 -070065 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -070066 timeout(time: 10, unit: 'MINUTES') {
67 sh """
68 if [ "${branch}" != "master" ]; then
69 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
70 source "$WORKSPACE/kind-voltha/releases/${branch}"
71 else
72 echo "on master, using default settings for kind-voltha"
73 fi
74 cd $WORKSPACE/kind-voltha/
75 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || true
76 """
77 }
Andrea Campanella88f01ea2021-01-04 11:36:25 +010078 }
79 }
80 stage('Clone voltha-system-tests') {
81 steps {
82 checkout([
83 $class: 'GitSCM',
84 userRemoteConfigs: [[
85 url: "https://gerrit.opencord.org/voltha-system-tests",
86 // refspec: "${volthaSystemTestsChange}"
87 ]],
Suchitra Vemuri1143ae32021-03-26 01:08:37 +000088 branches: [[ name: "${branch}", ]],
Andrea Campanella88f01ea2021-01-04 11:36:25 +010089 extensions: [
90 [$class: 'WipeWorkspace'],
91 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
92 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
93 ],
94 ])
Kailash8b8de742019-07-30 08:54:51 -070095 }
96 }
97
98 stage('Deploy Voltha') {
99 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700100 timeout(time: 10, unit: 'MINUTES') {
101 sh """
102 export EXTRA_HELM_FLAGS=""
103 if [ "${branch}" != "master" ]; then
104 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
105 source "$WORKSPACE/kind-voltha/releases/${branch}"
106 else
107 echo "on master, using default settings for kind-voltha"
108 fi
Andy Bavier10926f12020-03-27 16:53:43 -0700109
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700110 if [ "${workFlow}" == "DT" ]; then
111 export WITH_DHCP=no
112 export WITH_IGMP=no
113 export WITH_EAPOL=no
114 export WITH_RADIUS=no
115 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
116 fi
Hung-Wei Chiuf284d3f2020-04-08 11:38:13 -0700117
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700118 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
119 cd $WORKSPACE/kind-voltha/
120 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
121 ./voltha up
122 """
123 }
Kailash8b8de742019-07-30 08:54:51 -0700124 }
125 }
126
Kailash8b8de742019-07-30 08:54:51 -0700127 stage('Run E2E Tests') {
128 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700129 timeout(time: 5, unit: 'MINUTES') {
130 sh '''
131 set +e
132 mkdir -p $WORKSPACE/RobotLogs
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700133
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700134 cd $WORKSPACE/kind-voltha/scripts
135 ./log-collector.sh > /dev/null &
136 ./log-combine.sh > /dev/null &
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700137
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700138 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
139 '''
140 }
Kailash8b8de742019-07-30 08:54:51 -0700141 }
142 }
143 }
144
145 post {
146 always {
147 sh '''
Andy Bavier218385e2019-11-13 09:51:38 -0700148 set +e
Andrea Campanella88f01ea2021-01-04 11:36:25 +0100149 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700150 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
151 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Kailash887a2962019-08-14 13:26:33 -0700152 kubectl get nodes -o wide
153 kubectl get pods -o wide
154 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700155
Andy Bavier7afb11c2020-02-13 11:25:20 -0700156 sleep 60 # Wait for log-collector and log-combine to complete
157
Andy Bavierb30c0a02020-03-03 17:21:23 -0700158 ## Pull out errors from log files
159 extract_errors_go() {
160 echo
161 echo "Error summary for $1:"
Andrea Campanella88f01ea2021-01-04 11:36:25 +0100162 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700163 echo
164 }
165
166 extract_errors_python() {
167 echo
168 echo "Error summary for $1:"
Andrea Campanella88f01ea2021-01-04 11:36:25 +0100169 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
Andy Bavierb30c0a02020-03-03 17:21:23 -0700170 echo
171 }
172
173 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
174 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
175 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
176 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
177 extract_errors_python onos >> $WORKSPACE/error-report.log
178
Andrea Campanella9a95cb72020-09-03 11:28:35 +0200179 gzip error-report.log || true
180
Andrea Campanella88f01ea2021-01-04 11:36:25 +0100181 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
Andy Bavier7afb11c2020-02-13 11:25:20 -0700182 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier4af02722020-01-15 10:24:24 -0700183
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700184 cd $WORKSPACE
Andy Bavierb86ca422020-02-13 05:19:43 -0700185 gzip *-combined.log || true
Andy Bavier2178d102020-02-06 16:22:11 -0700186
Andy Bavier36c688c2020-03-17 07:32:30 -0700187 ## shut down voltha but leave kind-voltha cluster
Andrea Campanella57735a82021-05-18 13:22:49 +0200188 if [ "${branch}" != "master" ]; then
189 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
190 source "$WORKSPACE/kind-voltha/releases/${branch}"
191 else
192 echo "on master, using default settings for kind-voltha"
193 fi
Andrea Campanella88f01ea2021-01-04 11:36:25 +0100194 cd $WORKSPACE/kind-voltha/
Andy Bavier36c688c2020-03-17 07:32:30 -0700195 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavierfcae3832020-06-04 08:51:10 -0700196 kubectl delete deployment voltctl || true
Kailash8b8de742019-07-30 08:54:51 -0700197 '''
198 step([$class: 'RobotPublisher',
199 disableArchiveOutput: false,
200 logFileName: 'RobotLogs/log*.html',
201 otherFiles: '',
202 outputFileName: 'RobotLogs/output*.xml',
203 outputPath: '.',
Matteo Scandolo26bc17e2019-09-24 09:03:01 -0700204 passThreshold: 100,
Kailash8b8de742019-07-30 08:54:51 -0700205 reportFileName: 'RobotLogs/report*.html',
206 unstableThreshold: 0]);
Andy Bavier3c1ccca2020-02-12 16:50:04 -0700207 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Kailash8b8de742019-07-30 08:54:51 -0700208
209 }
210 }
211}