blob: 7cc810b3041d138fc18d4b45dd0068a472262686 [file] [log] [blame]
Matteo Scandoloc88d3132020-08-27 15:24:34 -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
15pipeline {
16
17 agent {
18 label "${params.buildNode}"
19 }
20 options {
Matteo Scandolo5fec8022020-08-27 17:29:35 -070021 timeout(time: 120, unit: 'MINUTES')
Matteo Scandoloc88d3132020-08-27 15:24:34 -070022 }
23 environment {
Matteo Scandolo52749cb2020-08-27 16:33:13 -070024 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
25 KUBECONFIG="$HOME/.kube/config"
26 VOLTCONFIG="$HOME/.volt/config"
Matteo Scandolo154df532020-11-08 12:20:08 -080027 SSHPASS="karaf"
Matteo Scandolo52749cb2020-08-27 16:33:13 -070028 SCHEDULE_ON_CONTROL_NODES="yes"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070029 FANCY=0
30 NAME="minimal"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070031
Matteo Scandolo52749cb2020-08-27 16:33:13 -070032 WITH_SIM_ADAPTERS="no"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070033 WITH_RADIUS="no"
Matteo Scandolo52749cb2020-08-27 16:33:13 -070034 WITH_BBSIM="yes"
35 LEGACY_BBSIM_INDEX="no"
36 DEPLOY_K8S="no"
37 CONFIG_SADIS="external"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070038 VOLTHA_LOG_LEVEL="WARN"
39
40 // install everything in the default namespace
41 VOLTHA_NS="default"
42 ADAPTER_NS="default"
43 INFRA_NS="default"
44 BBSIM_NS="default"
45
46 // workflow
47 WITH_EAPOL="no"
48 WITH_DHCP="no"
49 WITH_IGMP="no"
50
51 // infrastructure size
Matteo Scandoloe5d41f62020-11-04 15:43:50 -080052 NUM_OF_OPENONU="${openonuAdapterReplicas}"
Matteo Scandolof6e86582020-11-03 17:53:01 -080053 NUM_OF_ONOS="${onosReplicas}"
54 NUM_OF_ATOMIX="${atomixReplicas}"
55 NUM_OF_KAFKA="${kafkaReplicas}"
56 NUM_OF_ETCD="${etcdReplicas}"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070057 }
58
59 stages {
Matteo Scandoloffc7f842020-11-04 13:43:21 -080060 stage ('Parse parameters') {
61 steps {
62 script {
63 format = "format is 'olt-pon-onu' separated bya comma, eg: '1-16-16, 1-16-32, 2-16-32'"
64 source = params.topologies
65
66 if (source == null || source == "") {
67 throw new Exception("You need to specify some deployment topologies, " + format)
68 }
69
70 topologies = []
71
72 for(topo in source.split(",")) {
73 t = topo.split("-")
74 topologies.add(['olt': t[0].trim(), 'pon': t[1].trim(), 'onu': t[2].trim()])
75 }
76
77 if (topologies.size() == 0) {
78 throw new Exception("Not enough topologies defined, " + format)
79 }
80 println "Deploying topologies:"
81 println topologies
82 }
83 }
84 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -070085 stage ('Cleanup') {
86 steps {
Matteo Scandolo5fec8022020-08-27 17:29:35 -070087 timeout(time: 10, unit: 'MINUTES') {
Matteo Scandoloc88d3132020-08-27 15:24:34 -070088 sh returnStdout: false, script: """
89 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
90 helm repo add stable https://kubernetes-charts.storage.googleapis.com
91 helm repo add onf https://charts.opencord.org
92 helm repo add cord https://charts.opencord.org
93 helm repo add onos https://charts.onosproject.org
94 helm repo add atomix https://charts.atomix.io
95 helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts
96 helm repo update
97
Matteo Scandoloc88d3132020-08-27 15:24:34 -070098 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat');
99 do
100 echo "Purging chart: \${hchart}"
101 helm delete "\${hchart}"
102 done
103 bash /home/cord/voltha-scale/wait_for_pods.sh
104
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700105 cd $WORKSPACE
106 rm -rf $WORKSPACE/*
107 """
108 }
109 }
110 }
111 stage('Clone kind-voltha') {
112 steps {
113 checkout([
114 $class: 'GitSCM',
115 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
116 branches: [[ name: "master", ]],
117 extensions: [
118 [$class: 'WipeWorkspace'],
119 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
120 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
121 ],
122 ])
123 script {
124 sh(script:"""
125 if [ '${kindVolthaChange}' != '' ] ; then
126 cd $WORKSPACE/kind-voltha;
127 git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD
128 fi
129 """)
130 }
131 }
132 }
133 stage('Clone voltha-system-tests') {
134 steps {
135 checkout([
136 $class: 'GitSCM',
137 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
138 branches: [[ name: "${release}", ]],
139 extensions: [
140 [$class: 'WipeWorkspace'],
141 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
142 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
143 ],
144 ])
145 script {
146 sh(script:"""
147 if [ '${volthaSystemTestsChange}' != '' ] ; then
148 cd $WORKSPACE/voltha-system-tests;
149 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
150 fi
151 """)
152 }
153 }
154 }
155 stage('Deploy and test') {
Matteo Scandolo52749cb2020-08-27 16:33:13 -0700156 steps {
157 repeat_deploy_and_test(topologies)
158 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700159 }
Matteo Scandoloe5d41f62020-11-04 15:43:50 -0800160 stage('Aggregate stats') {
161 steps {
162 sh returnStdout: false, script: """
163 export IN_FOLDER=$WORKSPACE/stats/
164 export OUT_FOLDER=$WORKSPACE/plots/
165 mkdir -p \$OUT_FOLDER
166 cd $WORKSPACE/voltha-system-tests
167 make vst_venv
168 source ./vst_venv/bin/activate
169
170 sleep 60 # we have to wait for prometheus to collect all the information
171
Matteo Scandolob7d60ba2020-11-06 09:46:11 -0800172 python tests/scale/stats-aggregation.py -s \$IN_FOLDER -o \$OUT_FOLDER
Matteo Scandoloe5d41f62020-11-04 15:43:50 -0800173 """
174 }
175 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700176 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700177 post {
178 always {
Matteo Scandolob7d60ba2020-11-06 09:46:11 -0800179 archiveArtifacts artifacts: '*-install-minimal.log,*-minimal-env.sh,RobotLogs/**/*,stats/**/*,logs/**/*'
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700180 }
181 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700182}
183
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700184def repeat_deploy_and_test(list) {
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700185 for (int i = 0; i < list.size(); i++) {
Matteo Scandolof6e86582020-11-03 17:53:01 -0800186 stage('Cleanup') {
187 sh returnStdout: false, script: """
188 for hchart in \$(helm list -q | grep -E -v 'bbsim-sadis-server|onos|radius');
189 do
190 echo "Purging chart: \${hchart}"
191 helm delete "\${hchart}"
192 done
193 bash /home/cord/voltha-scale/wait_for_pods.sh
194 """
195 }
196 stage('Deploy monitoring infrastructure') {
197 sh returnStdout: false, script: '''
198 helm install nem-monitoring cord/nem-monitoring \
199 -f $HOME/voltha-scale/grafana.yaml \
200 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
201 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
202
203 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
204 bash /home/cord/voltha-scale/wait_for_pods.sh
205 '''
206 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700207 stage('Deploy topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
208 timeout(time: 10, unit: 'MINUTES') {
209 script {
210 now = new Date();
211 currentRunStart = now.getTime() / 1000;
212 println("Start: " + currentRunStart)
213 }
214 sh returnStdout: false, script: """
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700215 cd $WORKSPACE/kind-voltha/
216
217 if [ '${release.trim()}' != 'master' ]; then
218 source $WORKSPACE/kind-voltha/releases/${release}
219 fi
220
221 # if it's newer than voltha-2.4 set the correct BBSIM_CFG
222 if [ '${release.trim()}' != 'voltha-2.4' ]; then
223 export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-dt.yaml"
224 fi
225
226 export NUM_OF_BBSIM=${list[i]['olt']}
227 export EXTRA_HELM_FLAGS+="--set enablePerf=true,pon=${list[i]['pon']},onu=${list[i]['onu']} "
Matteo Scandolof6e86582020-11-03 17:53:01 -0800228 export EXTRA_HELM_FLAGS+="--set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default"
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700229 ./voltha up
230
Matteo Scandolo8d61e102020-11-06 15:46:19 -0800231 # disable LLDP
232 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 false
233
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700234 cp minimal-env.sh ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-minimal-env.sh
235 cp install-minimal.log ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-install-minimal.log
236 """
Matteo Scandolob7d60ba2020-11-06 09:46:11 -0800237 sleep(120) // TODO can we improve and check once the bbsim-sadis-server is actually done loading subscribers??
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700238 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700239 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700240 stage('Test topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
Matteo Scandolob7d60ba2020-11-06 09:46:11 -0800241 timeout(time: 15, unit: 'MINUTES') {
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700242 sh returnStdout: false, script: """
243 mkdir -p $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
244 cd $WORKSPACE/voltha-system-tests
245 make vst_venv
246
247 export ROBOT_PARAMS=" \
248 -v olt:${list[i]['olt']} \
249 -v pon:${list[i]['pon']} \
250 -v onu:${list[i]['onu']} \
251 -v workflow:dt \
252 -v withEapol:false \
253 -v withDhcp:false \
254 -v withIgmp:false \
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700255 -e authentication \
256 -e dhcp"
257
258 cd $WORKSPACE/voltha-system-tests
259 source ./vst_venv/bin/activate
260 robot -d $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} \
261 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
262 """
263 }
264 }
265 stage('Collect metrics: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
266 script {
267 now = new Date();
268 currentRunEnd = now.getTime() / 1000;
269 println("End: " + currentRunEnd)
270 delta = currentRunEnd - currentRunStart
271 println("Delta: " + delta)
272 minutesDelta = Math.ceil(delta / 60).toInteger()
273 println("Delta in minutes: " + minutesDelta)
274 }
275 sh returnStdout: false, script: """
276 export LOG_FOLDER=$WORKSPACE/stats/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
277 mkdir -p \$LOG_FOLDER
278 cd $WORKSPACE/voltha-system-tests
279 make vst_venv
280 source ./vst_venv/bin/activate
281
Matteo Scandolof6e86582020-11-03 17:53:01 -0800282 sleep 60 # we have to wait for prometheus to collect all the information
283
Matteo Scandolob7d60ba2020-11-06 09:46:11 -0800284 python tests/scale/sizing.py -o \$LOG_FOLDER -s ${minutesDelta}
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700285 """
286 }
287 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700288}