blob: 6b0e44d877283c30fed552585e06013d71a338a2 [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"
40 CONFIG_SADIS="y"
hwchiufdc49242019-11-18 16:37:22 -080041 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
42 }
hwchiu593a95a2020-01-30 10:09:39 -080043
hwchiufdc49242019-11-18 16:37:22 -080044 stages {
hwchiucd8fc952020-02-04 13:01:48 -080045 stage('Create Kubernetes Cluster') {
hwchiufdc49242019-11-18 16:37:22 -080046 steps {
47 sh """
48 git clone https://github.com/ciena/kind-voltha.git
hwchiuc7d5d032019-12-03 16:42:47 -080049 pushd kind-voltha/
hwchiucd8fc952020-02-04 13:01:48 -080050 JUST_K8S=y ./voltha up
51 popd
52 """
53 }
54 }
55
56 stage('Setup log collector') {
57 steps {
58 sh """
hwchiu593a95a2020-01-30 10:09:39 -080059 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
hwchiucd8fc952020-02-04 13:01:48 -080060 kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
61 """
62 }
63 }
64
65 stage('Deploy Voltha') {
66 steps {
67 sh """
Andy Bavierb567af72020-03-30 10:27:15 -070068 EXTRA_HELM_FLAGS=""
69 if [ "${manifestBranch}" != "master" ]; then
Andy Bavier10926f12020-03-27 16:53:43 -070070 echo "on branch: ${manifestBranch}, sourcing kind-voltha/releases/${manifestBranch}"
Andy Bavierb567af72020-03-30 10:27:15 -070071 source "$WORKSPACE/kind-voltha/releases/${manifestBranch}"
Andy Bavier10926f12020-03-27 16:53:43 -070072 else
73 echo "on master, using default settings for kind-voltha"
74 fi
75
Andy Bavierb567af72020-03-30 10:27:15 -070076 EXTRA_HELM_FLAGS+="${params.extraHelmFlags} --set voltha-etcd-cluster.clusterSize=3 "
77
hwchiucd8fc952020-02-04 13:01:48 -080078 pushd kind-voltha/
79 ./voltha up
hwchiuc7d5d032019-12-03 16:42:47 -080080 popd
hwchiufdc49242019-11-18 16:37:22 -080081 """
82 }
83 }
84
85 stage('Run E2E Tests') {
86 steps {
87 sh '''
88 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
Andy Bavier10926f12020-03-27 16:53:43 -070089 git clone -b ${manifestBranch} https://gerrit.opencord.org/voltha-system-tests
hwchiu593a95a2020-01-30 10:09:39 -080090 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 -080091 '''
92 }
93 }
94
hwchiufdc49242019-11-18 16:37:22 -080095 stage('Kubernetes Functional Tests') {
96 steps {
97 sh '''
hwchiu593a95a2020-01-30 10:09:39 -080098 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 -080099 '''
100 }
101 }
hwchiu8585b572019-12-16 11:20:43 -0800102
hwchiu8585b572019-12-16 11:20:43 -0800103 stage('Kubernetes Failure Scenario Tests') {
104 steps {
105 sh '''
hwchiu593a95a2020-01-30 10:09:39 -0800106 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 -0800107 '''
108 }
109 }
110
hwchiufdc49242019-11-18 16:37:22 -0800111 }
112
113 post {
hwchiu593a95a2020-01-30 10:09:39 -0800114 always {
115 sh '''
116 set +e
117 cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/
118 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
119 kubectl get nodes -o wide
120 kubectl get pods -o wide
121 kubectl get pods -n voltha -o wide
hwchiu8585b572019-12-16 11:20:43 -0800122
hwchiu593a95a2020-01-30 10:09:39 -0800123 sync
124 pkill kail || true
125
126 ## Pull out errors from log files
127 extract_errors_go() {
128 echo
129 echo "Error summary for $1:"
130 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
131 echo
132 }
133
134 extract_errors_python() {
135 echo
136 echo "Error summary for $1:"
137 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
138 echo
139 }
140
141 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
142 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
143 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
144 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
145
146 ## shut down kind-voltha
147 cd $WORKSPACE/kind-voltha
148 WAIT_ON_DOWN=y ./voltha down
149
150 '''
hwchiufdc49242019-11-18 16:37:22 -0800151 step([$class: 'RobotPublisher',
152 disableArchiveOutput: false,
153 logFileName: 'RobotLogs/*log*.html',
154 otherFiles: '',
155 outputFileName: 'RobotLogs/*output*.xml',
156 outputPath: '.',
157 passThreshold: 100,
158 reportFileName: 'RobotLogs/*report*.html',
159 unstableThreshold: 0]);
160 archiveArtifacts artifacts: '*.log'
161
162 }
163 }
164}