blob: b81f670332bdb591765a2ff97abb3359737a86d5 [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"
43 }
hwchiu593a95a2020-01-30 10:09:39 -080044
hwchiufdc49242019-11-18 16:37:22 -080045 stages {
hwchiucd8fc952020-02-04 13:01:48 -080046 stage('Create Kubernetes Cluster') {
hwchiufdc49242019-11-18 16:37:22 -080047 steps {
48 sh """
Andy Bavierb5c8caf2020-04-06 14:12:07 -070049 git clone https://gerrit.opencord.org/kind-voltha
hwchiuc7d5d032019-12-03 16:42:47 -080050 pushd kind-voltha/
hwchiucd8fc952020-02-04 13:01:48 -080051 JUST_K8S=y ./voltha up
52 popd
53 """
54 }
55 }
56
57 stage('Setup log collector') {
58 steps {
59 sh """
hwchiu593a95a2020-01-30 10:09:39 -080060 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
hwchiucd8fc952020-02-04 13:01:48 -080061 kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
62 """
63 }
64 }
65
66 stage('Deploy Voltha') {
67 steps {
68 sh """
Andy Bavier22a8da02020-03-31 12:40:09 -070069 export EXTRA_HELM_FLAGS=""
Andy Baviercf2afa42020-03-31 10:20:27 -070070 if [ "${branch}" != "master" ]; then
71 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
72 source "$WORKSPACE/kind-voltha/releases/${branch}"
Andy Bavier10926f12020-03-27 16:53:43 -070073 else
74 echo "on master, using default settings for kind-voltha"
75 fi
76
Andy Bavierb567af72020-03-30 10:27:15 -070077 EXTRA_HELM_FLAGS+="${params.extraHelmFlags} --set voltha-etcd-cluster.clusterSize=3 "
Andy Bavier22a8da02020-03-31 12:40:09 -070078 echo \$EXTRA_HELM_FLAGS
Andy Bavierb567af72020-03-30 10:27:15 -070079
hwchiucd8fc952020-02-04 13:01:48 -080080 pushd kind-voltha/
81 ./voltha up
hwchiuc7d5d032019-12-03 16:42:47 -080082 popd
hwchiufdc49242019-11-18 16:37:22 -080083 """
84 }
85 }
86
87 stage('Run E2E Tests') {
88 steps {
89 sh '''
90 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
Andy Baviercf2afa42020-03-31 10:20:27 -070091 git clone -b ${branch} https://gerrit.opencord.org/voltha-system-tests
hwchiu593a95a2020-01-30 10:09:39 -080092 make ROBOT_DEBUG_LOG_OPT="-l sanity_log.html -r sanity_report.html -o sanity_output.xml" -C $WORKSPACE/voltha-system-tests ${makeTarget}
hwchiufdc49242019-11-18 16:37:22 -080093 '''
94 }
95 }
96
Andy Bavier4be37062020-06-29 15:17:26 -070097 stage('Kubernetes ETCD Scale Test') {
hwchiufdc49242019-11-18 16:37:22 -080098 steps {
99 sh '''
hwchiu593a95a2020-01-30 10:09:39 -0800100 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
hwchiufdc49242019-11-18 16:37:22 -0800101 '''
102 }
103 }
hwchiu8585b572019-12-16 11:20:43 -0800104
Andy Bavier4be37062020-06-29 15:17:26 -0700105 stage('Kubernetes ETCD Failure Test') {
hwchiu8585b572019-12-16 11:20:43 -0800106 steps {
107 sh '''
hwchiu593a95a2020-01-30 10:09:39 -0800108 make ROBOT_DEBUG_LOG_OPT="-l failure_log.html -r failure_report.html -o failure_output.xml" -C $WORKSPACE/voltha-system-tests failure-test
hwchiu8585b572019-12-16 11:20:43 -0800109 '''
110 }
111 }
112
hwchiufdc49242019-11-18 16:37:22 -0800113 }
114
115 post {
hwchiu593a95a2020-01-30 10:09:39 -0800116 always {
117 sh '''
118 set +e
119 cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700120 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
121 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
hwchiu593a95a2020-01-30 10:09:39 -0800122 kubectl get nodes -o wide
123 kubectl get pods -o wide
124 kubectl get pods -n voltha -o wide
hwchiu8585b572019-12-16 11:20:43 -0800125
hwchiu593a95a2020-01-30 10:09:39 -0800126 sync
127 pkill kail || true
128
129 ## Pull out errors from log files
130 extract_errors_go() {
131 echo
132 echo "Error summary for $1:"
133 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
134 echo
135 }
136
137 extract_errors_python() {
138 echo
139 echo "Error summary for $1:"
140 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
141 echo
142 }
143
144 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
145 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
146 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
147 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
148
149 ## shut down kind-voltha
150 cd $WORKSPACE/kind-voltha
151 WAIT_ON_DOWN=y ./voltha down
152
153 '''
hwchiufdc49242019-11-18 16:37:22 -0800154 step([$class: 'RobotPublisher',
155 disableArchiveOutput: false,
156 logFileName: 'RobotLogs/*log*.html',
157 otherFiles: '',
158 outputFileName: 'RobotLogs/*output*.xml',
159 outputPath: '.',
160 passThreshold: 100,
161 reportFileName: 'RobotLogs/*report*.html',
162 unstableThreshold: 0]);
163 archiveArtifacts artifacts: '*.log'
164
165 }
166 }
167}