blob: 1b291f233981c0e56396a3c3226aaa38ecb0e122 [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"
41 EXTRA_HELM_FLAGS="${params.extraHelmFlags} --set voltha-etcd-cluster.clusterSize=3"
42 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
43 }
hwchiu593a95a2020-01-30 10:09:39 -080044
hwchiufdc49242019-11-18 16:37:22 -080045 stages {
hwchiu593a95a2020-01-30 10:09:39 -080046 stage('Create K8s Cluster') {
hwchiufdc49242019-11-18 16:37:22 -080047 steps {
48 sh """
49 git clone https://github.com/ciena/kind-voltha.git
hwchiuc7d5d032019-12-03 16:42:47 -080050 pushd kind-voltha/
hwchiufdc49242019-11-18 16:37:22 -080051 ./voltha up
hwchiu593a95a2020-01-30 10:09:39 -080052 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
hwchiuc7d5d032019-12-03 16:42:47 -080053 popd
hwchiufdc49242019-11-18 16:37:22 -080054 """
55 }
56 }
57
58 stage('Run E2E Tests') {
59 steps {
60 sh '''
61 rm -rf $WORKSPACE/RobotLogs; mkdir -p $WORKSPACE/RobotLogs
62 git clone https://gerrit.opencord.org/voltha-system-tests
hwchiu593a95a2020-01-30 10:09:39 -080063 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 -080064 '''
65 }
66 }
67
hwchiufdc49242019-11-18 16:37:22 -080068 stage('Kubernetes Functional Tests') {
69 steps {
70 sh '''
hwchiu593a95a2020-01-30 10:09:39 -080071 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 -080072 '''
73 }
74 }
hwchiu8585b572019-12-16 11:20:43 -080075
hwchiu8585b572019-12-16 11:20:43 -080076 stage('Kubernetes Failure Scenario Tests') {
77 steps {
78 sh '''
hwchiu593a95a2020-01-30 10:09:39 -080079 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 -080080 '''
81 }
82 }
83
hwchiufdc49242019-11-18 16:37:22 -080084 }
85
86 post {
hwchiu593a95a2020-01-30 10:09:39 -080087 always {
88 sh '''
89 set +e
90 cp $WORKSPACE/kind-voltha/install-full.log $WORKSPACE/
91 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
92 kubectl get nodes -o wide
93 kubectl get pods -o wide
94 kubectl get pods -n voltha -o wide
hwchiu8585b572019-12-16 11:20:43 -080095
hwchiu593a95a2020-01-30 10:09:39 -080096 sync
97 pkill kail || true
98
99 ## Pull out errors from log files
100 extract_errors_go() {
101 echo
102 echo "Error summary for $1:"
103 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
104 echo
105 }
106
107 extract_errors_python() {
108 echo
109 echo "Error summary for $1:"
110 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
111 echo
112 }
113
114 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
115 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
116 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
117 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
118
119 ## shut down kind-voltha
120 cd $WORKSPACE/kind-voltha
121 WAIT_ON_DOWN=y ./voltha down
122
123 '''
hwchiufdc49242019-11-18 16:37:22 -0800124 step([$class: 'RobotPublisher',
125 disableArchiveOutput: false,
126 logFileName: 'RobotLogs/*log*.html',
127 otherFiles: '',
128 outputFileName: 'RobotLogs/*output*.xml',
129 outputPath: '.',
130 passThreshold: 100,
131 reportFileName: 'RobotLogs/*report*.html',
132 unstableThreshold: 0]);
133 archiveArtifacts artifacts: '*.log'
134
135 }
136 }
137}