blob: 8fa37251d0ca3db759d74499a02da0540baa5cae [file] [log] [blame]
Matteo Scandolofbcbdb82020-05-06 15:41:32 -07001// Copyright 2019-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// deploy VOLTHA using kind-voltha and performs a scale test
16
17pipeline {
18
19 /* no label, executor is determined by JJB */
20 agent {
21 label "${params.buildNode}"
22 }
23 options {
24 timeout(time: 30, unit: 'MINUTES')
25 }
26 environment {
27 KUBECONFIG="$HOME/.kube/config"
28 VOLTCONFIG="$HOME/.volt/config"
29 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
30 TYPE="minimal"
31 FANCY=0
32 WITH_SIM_ADAPTERS="no"
33 WITH_RADIUS="yes"
34 WITH_BBSIM="yes"
35 LEGACY_BBSIM_INDEX="no"
36 DEPLOY_K8S="no"
37 CONFIG_SADIS="external"
Matteo Scandolo0430f672020-05-07 11:50:26 -070038 WITH_KAFKA="kafka.default.svc.cluster.local"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070039
40 // install everything in the default namespace
41 VOLTHA_NS="default"
42 ADAPTER_NS="default"
43 INFRA_NS="default"
44 BBSIM_NS="default"
45
Matteo Scandolo0430f672020-05-07 11:50:26 -070046 // configurable options
47 WITH_EAPOL="${withEapol}"
48 WITH_DHCP="${withDhcp}"
49 WITH_IGMP="${withIgmp}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070050 VOLTHA_LOG_LEVEL="${logLevel}"
51 NUM_OF_BBSIM="${olts}"
Matteo Scandolo0430f672020-05-07 11:50:26 -070052 NUM_OF_OPENONU="${openonuAdapterReplicas}"
53 NUM_OF_ONOS="${onosReplicas}"
54 NUM_OF_ATOMIX="${atomixReplicas}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070055
Matteo Scandolo0430f672020-05-07 11:50:26 -070056 VOLTHA_CHART="${volthaChart}"
57 VOLTHA_BBSIM_CHART="${bbsimChart}"
58 VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}"
59 VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070060 }
61
62 stages {
63 stage ('Cleanup') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070064 steps {
65 sh returnStdout: false, script: """
66 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
67 cd $WORKSPACE
68 rm -rf $WORKSPACE/*
69 """
70 }
71 }
72 stage('Clone kind-voltha') {
73 steps {
74 checkout([
75 $class: 'GitSCM',
76 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
77 branches: [[ name: "master", ]],
78 extensions: [
79 [$class: 'WipeWorkspace'],
80 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
81 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
82 ],
83 ])
84 }
85 }
86 stage('Clone voltha-system-tests') {
87 steps {
88 checkout([
89 $class: 'GitSCM',
90 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
91 branches: [[ name: "master", ]],
92 extensions: [
93 [$class: 'WipeWorkspace'],
94 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
95 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
96 ],
97 ])
98 // TODO use master once the tests are merged
99 script {
100 sh(script:"cd voltha-system-tests; git fetch https://gerrit.opencord.org/voltha-system-tests refs/changes/79/18779/13 && git checkout FETCH_HEAD")
101 }
102 }
103 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700104 stage('Deploy common infrastructure') {
105 // includes monitoring, kafka, etcd-operator
106 steps {
107 sh '''
108 helm install -n kafka incubator/kafka -f /home/cord/voltha-scale/voltha-values.yaml --version 0.13.3 --set replicas=3 --set persistence.enabled=false --set zookeeper.replicaCount=3 --set zookeeper.persistence.enabled=false --version=0.15.3
109
110 if [ ${withMonitoring} = true ] ; then
111 helm install -n nem-monitoring cord/nem-monitoring --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
112 fi
113
114 bash /home/cord/voltha-scale/wait_for_pods.sh
115 '''
116 }
117 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700118 stage('Deploy Voltha') {
119 steps {
120 script {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700121 // TODO install etcd outside kind-voltha (no need to redeploy the operator everytime)
122 sh returnStdout: false, script: """
Matteo Scandolo0430f672020-05-07 11:50:26 -0700123 export EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
124
125 # BBSim custom image handling
126 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
127 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag} "
128
129 # VOLTHA and ofAgent custom image handling
130 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
131 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
132 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=${volthaRepo},images.rw_core.tag=${volthaTag},images.ofagent_go.repository=${ofAgentRepo},images.ofagent_go.tag=${ofAgentTag} "
133
134 # OpenOLT custom image handling
135 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
136 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=${openoltAdapterRepo},images.adapter_open_olt.tag=${openoltAdapterTag} "
137
138 # OpenONU custom image handling
139 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
140 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=${openonuAdapterRepo},images.adapter_open_onu.tag=${openonuAdapterTag} "
141
142 # ONOS custom image handling
143 IFS=: read -r onosRepo onosTag <<< ${onosImg}
144 EXTRA_HELM_FLAGS+="--set images.onos.repository=${onosRepo},images.onos.tag=${onosTag} "
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700145
146
147 cd $WORKSPACE/kind-voltha/
148
149 ./voltha up
150 """
151 }
152 }
153 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700154 stage('Configuration') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700155 steps {
156 sh '''
Matteo Scandolo0430f672020-05-07 11:50:26 -0700157 # Always deactivate org.opencord.kafka
158 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.kafka
159
160 #Setting link discovery
161 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${withLLDP}
162
163 #Setting LOG level to ${logLevel}
164 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set ${logLevel}
165 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log ${logLevel} false
166
167 if [ ${withEapol} = false ] || [ ${withFlows} = false ]; then
168 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.aaa
169 fi
170
171 if [ ${withDhcp} = false ] || [ ${withFlows} = false ]; then
172 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.dhcpl2relay
173 fi
174
175 if [ ${withIgmp} = false ] || [ ${withFlows} = false ]; then
176 # FIXME will actually affected the tests only after VOL-3054 is addressed
177 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.igmpproxy
178 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.mcast
179 fi
180
181 if [ ${withFlows} = false ]; then
182 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.olt
183 fi
184
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700185 if [ ${withMibTemplate} = true ] ; then
186 rm -f BBSM-12345123451234512345-00000000000001-v1.json
187 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
188 cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it $(kubectl get pods | grep etcd-cluster | awk 'NR==1{print $1}') etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001
189 fi
190 '''
191 }
192 }
193 stage('Run Test') {
194 steps {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700195 sh '''
Matteo Scandolo0430f672020-05-07 11:50:26 -0700196 ROBOT_PARAMS="-v olt:${olts} \
197 -v pon:${pons} \
198 -v onu:${onus} \
199 -v workflow:${workflow} \
200 -e teardown "
201
202 if [ ${withEapol} = false ] ; then
203 ROBOT_PARAMS+="-e authentication"
204 fi
205
206 if [ ${withDhcp} = false ] ; then
207 ROBOT_PARAMS+="-e dhcp"
208 fi
209
210 if [ ${provisionSubscribers} = false ] ; then
211 ROBOT_PARAMS+="-e provision -e flow-after"
212 fi
213
214 if [ ${withFlows} = false ] ; then
215 ROBOT_PARAMS+="-i setup -i activation"
216 fi
217
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700218 mkdir -p $WORKSPACE/RobotLogs
219 cd voltha-system-tests
220 make vst_venv
221 source ./vst_venv/bin/activate
222 robot -d $WORKSPACE/RobotLogs \
Matteo Scandolo0430f672020-05-07 11:50:26 -0700223 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700224 '''
225 }
226 }
227 stage('Collect results') {
228 steps {
229 sh '''
230 cd voltha-system-tests
231 source ./vst_venv/bin/activate
Matteo Scandolo0430f672020-05-07 11:50:26 -0700232 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700233 '''
234 }
235 }
236 }
237 post {
238 always {
239 plot([
240 csvFileName: 'scale-test.csv',
241 csvSeries: [
Matteo Scandolo0430f672020-05-07 11:50:26 -0700242 [file: '$WORKSPACE/plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
243 [file: '$WORKSPACE/plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
244 [file: '$WORKSPACE/plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
245 [file: '$WORKSPACE/plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
246 [file: '$WORKSPACE/plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
247 [file: '$WORKSPACE/plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
248 [file: '$WORKSPACE/plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
249 [file: '$WORKSPACE/plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700250 ],
251 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
252 ])
253 step([$class: 'RobotPublisher',
254 disableArchiveOutput: false,
Matteo Scandolo0430f672020-05-07 11:50:26 -0700255 logFileName: '$WORKSPACE/RobotLogs/log*.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700256 otherFiles: '',
Matteo Scandolo0430f672020-05-07 11:50:26 -0700257 outputFileName: '$WORKSPACE/RobotLogs/output*.xml',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700258 outputPath: '.',
259 passThreshold: 100,
Matteo Scandolo0430f672020-05-07 11:50:26 -0700260 reportFileName: '$WORKSPACE/RobotLogs/report*.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700261 unstableThreshold: 0]);
Matteo Scandolo0430f672020-05-07 11:50:26 -0700262 // get all the logs from kubernetes PODs
263 sh '''
264 mkdir $WORKSPACE/logs
265 kubectl get pods -o wide > $WORKSPACE/logs/pods.txt
266 kubectl logs -l app=adapter-open-olt > $WORKSPACE/logs/open-olt-logs.logs
267 kubectl logs -l app=adapter-open-onu > $WORKSPACE/logs/open-onu-logs.logs
268 kubectl logs -l app=rw-core > $WORKSPACE/logs/voltha-rw-core-logs.logs
269 kubectl logs -l app=ofagent > $WORKSPACE/logs/voltha-ofagent-logs.logs
270 kubectl logs -l app=bbsim > $WORKSPACE/logs/bbsim-logs.logs
271 kubectl logs -l app=onos > $WORKSPACE/logs/onos-logs.logs
272 '''
273 archiveArtifacts artifacts: '$WORKSPACE/kind-voltha/install-minimal.log,$WORKSPACE/execution-time.txt,$WORKSPACE/logs/*'
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700274 }
275 }
276}