blob: aa08ecb93001b8b7c0579d4ae00451cf7b797af0 [file] [log] [blame]
hwchiufdc49242019-11-18 16:37:22 -08001// 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
hwchiu8585b572019-12-16 11:20:43 -080019
hwchiufdc49242019-11-18 16:37:22 -080020pipeline {
21
22 /* no label, executor is determined by JJB */
23 agent {
24 label "${params.buildNode}"
25 }
26 options {
hwchiu8585b572019-12-16 11:20:43 -080027 timeout(time: 80, unit: 'MINUTES')
hwchiufdc49242019-11-18 16:37:22 -080028 }
29 environment {
hwchiu593a95a2020-01-30 10:09:39 -080030 KUBECONFIG="$HOME/.kube/kind-config-voltha-full"
31 VOLTCONFIG="$HOME/.volt/config-full"
hwchiufdc49242019-11-18 16:37:22 -080032 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$WORKSPACE/kind-voltha/bin"
hwchiu593a95a2020-01-30 10:09:39 -080033 TYPE="full"
hwchiufdc49242019-11-18 16:37:22 -080034 FANCY=0
35 WITH_SIM_ADAPTERS="n"
36 WITH_RADIUS="y"
37 WITH_BBSIM="y"
38 DEPLOY_K8S="y"
39 VOLTHA_LOG_LEVEL="DEBUG"
Andrea Campanellaf300fc32020-09-11 14:01:12 +020040 CONFIG_SADIS="external"
41 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
hwchiufdc49242019-11-18 16:37:22 -080042 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
Matteo Scandolob611b1f2021-01-05 09:11:49 -080043 NUM_OF_ETCD=3
44 SCHEDULE_ON_CONTROL_NODES="y"
hwchiufdc49242019-11-18 16:37:22 -080045 }
hwchiu593a95a2020-01-30 10:09:39 -080046
hwchiufdc49242019-11-18 16:37:22 -080047 stages {
hwchiucd8fc952020-02-04 13:01:48 -080048 stage('Create Kubernetes Cluster') {
hwchiufdc49242019-11-18 16:37:22 -080049 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -070050 timeout(time: 10, unit: 'MINUTES') {
51 sh """
52 git clone https://gerrit.opencord.org/kind-voltha
53 pushd kind-voltha/
54 if [ "${branch}" != "master" ]; then
55 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
56 source "$WORKSPACE/kind-voltha/releases/${branch}"
57 else
58 echo "on master, using default settings for kind-voltha"
59 fi
60 JUST_K8S=y ./voltha up
61 popd
62 """
63 }
hwchiucd8fc952020-02-04 13:01:48 -080064 }
65 }
66
67 stage('Setup log collector') {
68 steps {
69 sh """
hwchiu593a95a2020-01-30 10:09:39 -080070 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
hwchiucd8fc952020-02-04 13:01:48 -080071 kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
72 """
73 }
74 }
75
76 stage('Deploy Voltha') {
77 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -070078 timeout(time: 10, unit: 'MINUTES') {
79 sh """
80 export EXTRA_HELM_FLAGS=""
81 if [ "${branch}" != "master" ]; then
82 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
83 source "$WORKSPACE/kind-voltha/releases/${branch}"
84 else
85 echo "on master, using default settings for kind-voltha"
86 fi
Andy Bavier10926f12020-03-27 16:53:43 -070087
Matteo Scandoloe4abf852021-05-18 09:12:11 -070088 EXTRA_HELM_FLAGS+="${params.extraHelmFlags} "
89 echo \$EXTRA_HELM_FLAGS
Andy Bavierb567af72020-03-30 10:27:15 -070090
Matteo Scandoloe4abf852021-05-18 09:12:11 -070091 pushd kind-voltha/
92 ./voltha up
93 popd
94 """
95 }
hwchiufdc49242019-11-18 16:37:22 -080096 }
97 }
98
99 stage('Run E2E Tests') {
100 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700101 timeout(time: 10, unit: 'MINUTES') {
102 sh '''
103 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
104 git clone -b ${branch} https://gerrit.opencord.org/voltha-system-tests
105 make ROBOT_DEBUG_LOG_OPT="-l sanity_log.html -r sanity_report.html -o sanity_output.xml" -C $WORKSPACE/voltha-system-tests ${makeTarget}
106 '''
107 }
hwchiufdc49242019-11-18 16:37:22 -0800108 }
109 }
110
Andy Bavier4be37062020-06-29 15:17:26 -0700111 stage('Kubernetes ETCD Scale Test') {
hwchiufdc49242019-11-18 16:37:22 -0800112 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700113 timeout(time: 10, unit: 'MINUTES') {
114 sh '''
115 make ROBOT_DEBUG_LOG_OPT="-l functional_log.html -r functional_report.html -o functional_output.xml" -C $WORKSPACE/voltha-system-tests system-scale-test
116 '''
117 }
hwchiufdc49242019-11-18 16:37:22 -0800118 }
119 }
hwchiu8585b572019-12-16 11:20:43 -0800120
Andy Bavier4be37062020-06-29 15:17:26 -0700121 stage('Kubernetes ETCD Failure Test') {
hwchiu8585b572019-12-16 11:20:43 -0800122 steps {
Matteo Scandoloe4abf852021-05-18 09:12:11 -0700123 timeout(time: 10, unit: 'MINUTES') {
124 sh '''
125 make ROBOT_DEBUG_LOG_OPT="-l failure_log.html -r failure_report.html -o failure_output.xml" -C $WORKSPACE/voltha-system-tests failure-test
126 '''
127 }
hwchiu8585b572019-12-16 11:20:43 -0800128 }
129 }
130
hwchiufdc49242019-11-18 16:37:22 -0800131 }
132
133 post {
hwchiu593a95a2020-01-30 10:09:39 -0800134 always {
135 sh '''
136 set +e
137 cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700138 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
139 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
hwchiu593a95a2020-01-30 10:09:39 -0800140 kubectl get nodes -o wide
141 kubectl get pods -o wide
142 kubectl get pods -n voltha -o wide
hwchiu8585b572019-12-16 11:20:43 -0800143
hwchiu593a95a2020-01-30 10:09:39 -0800144 sync
145 pkill kail || true
146
147 ## Pull out errors from log files
148 extract_errors_go() {
149 echo
150 echo "Error summary for $1:"
151 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
152 echo
153 }
154
155 extract_errors_python() {
156 echo
157 echo "Error summary for $1:"
158 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
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_python voltha-ofagent >> $WORKSPACE/error-report.log
166
167 ## shut down kind-voltha
Andrea Campanella57735a82021-05-18 13:22:49 +0200168 if [ "${branch}" != "master" ]; then
169 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
170 source "$WORKSPACE/kind-voltha/releases/${branch}"
171 else
172 echo "on master, using default settings for kind-voltha"
173 fi
hwchiu593a95a2020-01-30 10:09:39 -0800174 cd $WORKSPACE/kind-voltha
175 WAIT_ON_DOWN=y ./voltha down
176
177 '''
hwchiufdc49242019-11-18 16:37:22 -0800178 step([$class: 'RobotPublisher',
179 disableArchiveOutput: false,
180 logFileName: 'RobotLogs/*log*.html',
181 otherFiles: '',
182 outputFileName: 'RobotLogs/*output*.xml',
183 outputPath: '.',
184 passThreshold: 100,
185 reportFileName: 'RobotLogs/*report*.html',
186 unstableThreshold: 0]);
187 archiveArtifacts artifacts: '*.log'
188
189 }
190 }
191}