blob: d95f23ba51ae188cd97b0f3e94190deee5ea5e7d [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 Bavier4af02722020-01-15 10:24:24 -070040 EXTRA_HELM_FLAGS="--set log_agent.enabled=False ${params.extraHelmFlags}"
Andy Bavier4a02b232020-01-09 14:50:30 -070041 ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs"
Andy Bavier0088c212020-01-08 13:44:03 -070042 }
43 stages {
44
45 stage('Repo') {
46 steps {
47 step([$class: 'WsCleanup'])
48 checkout(changelog: true,
49 poll: false,
50 scm: [$class: 'RepoScm',
51 manifestRepositoryUrl: "${params.manifestUrl}",
52 manifestBranch: "${params.manifestBranch}",
53 currentBranch: true,
54 destinationDir: 'voltha',
55 forceSync: true,
56 resetFirst: true,
57 quiet: true,
58 jobs: 4,
59 showAllChanges: true]
60 )
61 }
62 }
63
64 stage('Download kind-voltha') {
65 steps {
66 sh """
Andy Bavier36c688c2020-03-17 07:32:30 -070067 cd $HOME
68 [ -d kind-voltha ] || git clone https://github.com/ciena/kind-voltha.git
69 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 Bavier36c688c2020-03-17 07:32:30 -070078 cd $HOME/kind-voltha/
79 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -070080 ./voltha up
81 """
82 }
83 }
84
85 stage('Run E2E Tests') {
86 steps {
87 sh '''
Andy Bavier36c688c2020-03-17 07:32:30 -070088 set +e
Andy Bavier0088c212020-01-08 13:44:03 -070089 mkdir -p $WORKSPACE/RobotLogs
90 git clone https://gerrit.opencord.org/voltha-system-tests
Andy Bavier36c688c2020-03-17 07:32:30 -070091
92 cd $HOME/kind-voltha/scripts
93 ./log-collector.sh > /dev/null &
94 ./log-combine.sh > /dev/null &
95
Andy Bavier0d101392020-03-17 09:36:41 -070096 for i in \$(seq 1 ${testRuns})
Andy Bavier0088c212020-01-08 13:44:03 -070097 do
98 make -C $WORKSPACE/voltha-system-tests ${makeTarget}
99 echo "Completed run: \$i"
100 echo ""
Andy Bavier0088c212020-01-08 13:44:03 -0700101 done
102 '''
103 }
104 }
105 }
106
107 post {
108 always {
109 sh '''
110 set +e
Andy Bavier36c688c2020-03-17 07:32:30 -0700111 cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/
Andy Bavier0088c212020-01-08 13:44:03 -0700112 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
113 kubectl get nodes -o wide
114 kubectl get pods -o wide
115 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700116
Andy Bavier36c688c2020-03-17 07:32:30 -0700117 sleep 60 # Wait for log-collector and log-combine to complete
Andy Bavier4af02722020-01-15 10:24:24 -0700118
119 ## Pull out errors from log files
120 extract_errors_go() {
121 echo
122 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700123 grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700124 echo
125 }
126
127 extract_errors_python() {
128 echo
129 echo "Error summary for $1:"
Andy Bavier36c688c2020-03-17 07:32:30 -0700130 grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1*
Andy Bavier4af02722020-01-15 10:24:24 -0700131 echo
132 }
133
134 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
135 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
136 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
Andy Bavier36c688c2020-03-17 07:32:30 -0700137 extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log
138 extract_errors_python onos >> $WORKSPACE/error-report.log
Andy Bavier4af02722020-01-15 10:24:24 -0700139
Andy Bavier36c688c2020-03-17 07:32:30 -0700140 cd $HOME/kind-voltha/scripts/logger/combined/
141 tar czf $WORKSPACE/container-logs.tgz *
Andy Bavier2178d102020-02-06 16:22:11 -0700142
Andy Bavier36c688c2020-03-17 07:32:30 -0700143 cd $WORKSPACE
144 gzip *-combined.log || true
145
146 ## shut down voltha but leave kind-voltha cluster
147 cd $HOME/kind-voltha/
148 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Andy Bavier0088c212020-01-08 13:44:03 -0700149 '''
150 step([$class: 'RobotPublisher',
151 disableArchiveOutput: false,
152 logFileName: 'RobotLogs/log*.html',
153 otherFiles: '',
154 outputFileName: 'RobotLogs/output*.xml',
155 outputPath: '.',
156 passThreshold: 100,
157 reportFileName: 'RobotLogs/report*.html',
158 unstableThreshold: 0]);
Andy Bavier36c688c2020-03-17 07:32:30 -0700159 archiveArtifacts artifacts: '*.log,*.gz,*.tgz'
Andy Bavier0088c212020-01-08 13:44:03 -0700160
161 }
162 }
163}