blob: 67bc458f355bf38cea2e52120b1d4fd9de6bc3f5 [file] [log] [blame]
Andy Bavier0088c212020-01-08 13:44:03 -07001// 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: 40, unit: 'MINUTES')
27 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Andy Bavier36c688c2020-03-17 07:32:30 -070031 PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/kind-voltha/bin"
Andy Bavier0088c212020-01-08 13:44:03 -070032 TYPE="minimal"
33 FANCY=0
34 WITH_SIM_ADAPTERS="n"
35 WITH_RADIUS="y"
36 WITH_BBSIM="y"
37 DEPLOY_K8S="y"
38 VOLTHA_LOG_LEVEL="DEBUG"
39 CONFIG_SADIS="n"
Andy Bavier4a02b232020-01-09 14:50:30 -070040 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs"
Andy Bavier0088c212020-01-08 13:44:03 -070041 }
42 stages {
43
44 stage('Repo') {
45 steps {
46 step([$class: 'WsCleanup'])
47 checkout(changelog: true,
48 poll: false,
49 scm: [$class: 'RepoScm',
50 manifestRepositoryUrl: "${params.manifestUrl}",
51 manifestBranch: "${params.manifestBranch}",
52 currentBranch: true,
53 destinationDir: 'voltha',
54 forceSync: true,
55 resetFirst: true,
56 quiet: true,
57 jobs: 4,
58 showAllChanges: true]
59 )
60 }
61 }
62
63 stage('Download kind-voltha') {
64 steps {
65 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -070066 cd $HOME
67 [ -d kind-voltha ] || git clone https://github.com/ciena/kind-voltha.git
Andy Bavier2e009302020-03-19 08:46:13 -070068 rm -rf $HOME/kind-voltha/scripts/logger
Andy Bavier36c688c2020-03-17 07:32:30 -070069 cd $HOME/kind-voltha
70 git pull
Andy Bavier0088c212020-01-08 13:44:03 -070071 """
72 }
73 }
74
75 stage('Deploy Voltha') {
76 steps {
77 sh """
Andy Bavier10926f12020-03-27 16:53:43 -070078 if [ "${manifestBranch}" != "master" ]; then
79 echo "on branch: ${manifestBranch}, sourcing kind-voltha/releases/${manifestBranch}"
80 source "$HOME/kind-voltha/releases/${manifestBranch}"
81 else
82 echo "on master, using default settings for kind-voltha"
83 fi
84
85 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} "
86
Andy Bavier36c688c2020-03-17 07:32:30 -070087 cd $HOME/kind-voltha/
88 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -070089 ./voltha up
90 """
91 }
92 }
93
94 stage('Run E2E Tests') {
95 steps {
96 sh '''
Andy Bavier36c688c2020-03-17 07:32:30 -070097 set +e
Andy Bavier0088c212020-01-08 13:44:03 -070098 mkdir -p $WORKSPACE/RobotLogs
99 git clone https://gerrit.opencord.org/voltha-system-tests
Andy Bavier36c688c2020-03-17 07:32:30 -0700100
101 cd $HOME/kind-voltha/scripts
102 ./log-collector.sh > /dev/null &
103 ./log-combine.sh > /dev/null &
104
Andy Bavier0d101392020-03-17 09:36:41 -0700105 for i in \$(seq 1 ${testRuns})
Andy Bavier0088c212020-01-08 13:44:03 -0700106 do
107 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
108 echo "Completed run: \$i"
109 echo ""
Andy Bavier0088c212020-01-08 13:44:03 -0700110 done
111 '''
112 }
113 }
114 }
115
116 post {
117 always {
118 sh '''
119 set +e
Andy Bavier36c688c2020-03-17 07:32:30 -0700120 cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
Andy Bavier0088c212020-01-08 13:44:03 -0700121 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
122 kubectl get nodes -o wide
123 kubectl get pods -o wide
124 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700125
Andy Bavier36c688c2020-03-17 07:32:30 -0700126 sleep 60 # Wait for log-collector and log-combine to complete
Andy Bavier4af02722020-01-15 10:24:24 -0700127
128 ## Pull out errors from log files
129 extract_errors_go() {
130 echo
131 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700132 grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700133 echo
134 }
135
136 extract_errors_python() {
137 echo
138 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700139 grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700140 echo
141 }
142
143 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
144 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
145 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
Andy Bavier36c688c2020-03-17 07:32:30 -0700146 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
147 extract_errors_python onos >> $WORKSPACE/error-report.log
Andy Bavier4af02722020-01-15 10:24:24 -0700148
Andy Bavier36c688c2020-03-17 07:32:30 -0700149 cd $HOME/kind-voltha/scripts/logger/combined/
150 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier2178d102020-02-06 16:22:11 -0700151
Andy Bavier36c688c2020-03-17 07:32:30 -0700152 cd $WORKSPACE
153 gzip *-combined.log || true
154
155 ## shut down voltha but leave kind-voltha cluster
156 cd $HOME/kind-voltha/
157 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -0700158 '''
159 step([$class: 'RobotPublisher',
160 disableArchiveOutput: false,
161 logFileName: 'RobotLogs/log*.html',
162 otherFiles: '',
163 outputFileName: 'RobotLogs/output*.xml',
164 outputPath: '.',
165 passThreshold: 100,
166 reportFileName: 'RobotLogs/report*.html',
167 unstableThreshold: 0]);
Andy Bavier36c688c2020-03-17 07:32:30 -0700168 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Andy Bavier0088c212020-01-08 13:44:03 -0700169
170 }
171 }
172}