blob: 4f45d153b719d4e5ccb36f24662617ccc3e574e6 [file] [log] [blame]
Andrea Campanellaf3c32af2020-12-10 12:21:57 +01001// 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 {
26 timeout(time: 190, unit: 'MINUTES')
27 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
31 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
32 NAME="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"
39 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
41 ROBOT_MISC_ARGS="-e PowerSwitch ${params.extraRobotArgs}"
42 KARAF_HOME="${params.karafHome}"
43 DIAGS_PROFILE="VOLTHA_PROFILE"
44 NUM_OF_BBSIM="${olts}"
45 }
46 stages {
47 stage('Clone kind-voltha') {
48 steps {
49 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 ])
62 }
63 }
64 stage('Cleanup') {
65 steps {
66 sh """
Andrea Campanella57735a82021-05-18 13:22:49 +020067 if [ "${branch}" != "master" ]; then
68 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
69 source "$WORKSPACE/kind-voltha/releases/${branch}"
70 else
71 echo "on master, using default settings for kind-voltha"
72 fi
Andrea Campanellaf3c32af2020-12-10 12:21:57 +010073 cd $WORKSPACE/kind-voltha/
74 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
75 """
76 }
77 }
78 stage('Clone voltha-system-tests') {
79 steps {
80 checkout([
81 $class: 'GitSCM',
82 userRemoteConfigs: [[
83 url: "https://gerrit.opencord.org/voltha-system-tests",
84 // refspec: "${volthaSystemTestsChange}"
85 ]],
86 branches: [[ name: "${branch}", ]],
87 extensions: [
88 [$class: 'WipeWorkspace'],
89 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
90 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
91 ],
92 ])
93 }
94 }
95
96 stage('Deploy Voltha') {
97 steps {
98 sh """
99 export EXTRA_HELM_FLAGS=""
100 if [ "${branch}" != "master" ]; then
101 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
102 source "$WORKSPACE/kind-voltha/releases/${branch}"
103 else
104 echo "on master, using default settings for kind-voltha"
105 fi
106
107 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags}"
108
109 cd $WORKSPACE/kind-voltha/
110 ./voltha up
111 """
112 }
113 }
114
115 stage('Device Management Interface Tests') {
116 environment {
117 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DMITests"
118 }
119 steps {
120 sh '''
121 set +e
122 mkdir -p $ROBOT_LOGS_DIR
123 cd $WORKSPACE/kind-voltha/scripts
124 ./log-collector.sh > /dev/null &
125 ./log-combine.sh > /dev/null &
126
Andrea Campanellae9739492020-12-17 09:54:04 +0100127 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Andrea Campanellaf3c32af2020-12-10 12:21:57 +0100128 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
129 '''
130 }
131 }
132 }
133
134 post {
135 always {
136 sh '''
137 set +e
138 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
139 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
140 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
141 kubectl get nodes -o wide
142 kubectl get pods -o wide
143 kubectl get pods -n voltha -o wide
144
145 sleep 60 # Wait for log-collector and log-combine to complete
146
147 ## Pull out errors from log files
148 extract_errors_go() {
149 echo
150 echo "Error summary for $1:"
151 grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
152 echo
153 }
154
155 extract_errors_python() {
156 echo
157 echo "Error summary for $1:"
158 grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1*
159 echo
160 }
161
162 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
163 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
164 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
165 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
166 extract_errors_python onos >> $WORKSPACE/error-report.log
167
168 gzip error-report.log || true
169
170 cd $WORKSPACE/kind-voltha/scripts/logger/combined/
171 tar czf $WORKSPACE/container-logs.tgz *
172
173 cd $WORKSPACE
174 gzip *-combined.log || true
175
176 ## shut down voltha but leave kind-voltha cluster
Andrea Campanella57735a82021-05-18 13:22:49 +0200177 if [ "${branch}" != "master" ]; then
178 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
179 source "$WORKSPACE/kind-voltha/releases/${branch}"
180 else
181 echo "on master, using default settings for kind-voltha"
182 fi
Andrea Campanellaf3c32af2020-12-10 12:21:57 +0100183 cd $WORKSPACE/kind-voltha/
184 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
185 kubectl delete deployment voltctl || true
186 '''
187 step([$class: 'RobotPublisher',
188 disableArchiveOutput: false,
189 logFileName: '**/log*.html',
190 otherFiles: '',
191 outputFileName: '**/output*.xml',
192 outputPath: 'RobotLogs',
193 passThreshold: 100,
194 reportFileName: '**/report*.html',
195 unstableThreshold: 0]);
196
197 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
198
199 }
200 }
201}