blob: 7a8b4a22efae560d48ea5c3aa61cc6838be95078 [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
Matteo Scandolo52749cb2020-08-27 16:33:13 -070015topologies = [
Matteo Scandolo5fec8022020-08-27 17:29:35 -070016 ['olt': 1, 'onu': 1, 'pon': 1],
17 ['olt': 1, 'onu': 2, 'pon': 1],
18 ['olt': 1, 'onu': 2, 'pon': 2],
Matteo Scandolo52749cb2020-08-27 16:33:13 -070019]
20
Matteo Scandoloc88d3132020-08-27 15:24:34 -070021pipeline {
22
23 agent {
24 label "${params.buildNode}"
25 }
26 options {
Matteo Scandolo5fec8022020-08-27 17:29:35 -070027 timeout(time: 120, unit: 'MINUTES')
Matteo Scandoloc88d3132020-08-27 15:24:34 -070028 }
29 environment {
Matteo Scandolo52749cb2020-08-27 16:33:13 -070030 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
31 KUBECONFIG="$HOME/.kube/config"
32 VOLTCONFIG="$HOME/.volt/config"
33 SCHEDULE_ON_CONTROL_NODES="yes"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070034 FANCY=0
35 NAME="minimal"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070036
Matteo Scandolo52749cb2020-08-27 16:33:13 -070037 WITH_SIM_ADAPTERS="no"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070038 WITH_RADIUS="no"
Matteo Scandolo52749cb2020-08-27 16:33:13 -070039 WITH_BBSIM="yes"
40 LEGACY_BBSIM_INDEX="no"
41 DEPLOY_K8S="no"
42 CONFIG_SADIS="external"
Matteo Scandolo5fec8022020-08-27 17:29:35 -070043 VOLTHA_LOG_LEVEL="WARN"
44
45 // install everything in the default namespace
46 VOLTHA_NS="default"
47 ADAPTER_NS="default"
48 INFRA_NS="default"
49 BBSIM_NS="default"
50
51 // workflow
52 WITH_EAPOL="no"
53 WITH_DHCP="no"
54 WITH_IGMP="no"
55
56 // infrastructure size
57 NUM_OF_OPENONU=1
Matteo Scandolof6e86582020-11-03 17:53:01 -080058 NUM_OF_ONOS="${onosReplicas}"
59 NUM_OF_ATOMIX="${atomixReplicas}"
60 NUM_OF_KAFKA="${kafkaReplicas}"
61 NUM_OF_ETCD="${etcdReplicas}"
Matteo Scandoloc88d3132020-08-27 15:24:34 -070062 }
63
64 stages {
65 stage ('Cleanup') {
66 steps {
Matteo Scandolo5fec8022020-08-27 17:29:35 -070067 timeout(time: 10, unit: 'MINUTES') {
Matteo Scandoloc88d3132020-08-27 15:24:34 -070068 sh returnStdout: false, script: """
69 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
70 helm repo add stable https://kubernetes-charts.storage.googleapis.com
71 helm repo add onf https://charts.opencord.org
72 helm repo add cord https://charts.opencord.org
73 helm repo add onos https://charts.onosproject.org
74 helm repo add atomix https://charts.atomix.io
75 helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts
76 helm repo update
77
Matteo Scandoloc88d3132020-08-27 15:24:34 -070078 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat');
79 do
80 echo "Purging chart: \${hchart}"
81 helm delete "\${hchart}"
82 done
83 bash /home/cord/voltha-scale/wait_for_pods.sh
84
Matteo Scandoloc88d3132020-08-27 15:24:34 -070085 cd $WORKSPACE
86 rm -rf $WORKSPACE/*
87 """
88 }
89 }
90 }
91 stage('Clone kind-voltha') {
92 steps {
93 checkout([
94 $class: 'GitSCM',
95 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
96 branches: [[ name: "master", ]],
97 extensions: [
98 [$class: 'WipeWorkspace'],
99 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
100 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
101 ],
102 ])
103 script {
104 sh(script:"""
105 if [ '${kindVolthaChange}' != '' ] ; then
106 cd $WORKSPACE/kind-voltha;
107 git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD
108 fi
109 """)
110 }
111 }
112 }
113 stage('Clone voltha-system-tests') {
114 steps {
115 checkout([
116 $class: 'GitSCM',
117 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
118 branches: [[ name: "${release}", ]],
119 extensions: [
120 [$class: 'WipeWorkspace'],
121 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
122 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
123 ],
124 ])
125 script {
126 sh(script:"""
127 if [ '${volthaSystemTestsChange}' != '' ] ; then
128 cd $WORKSPACE/voltha-system-tests;
129 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
130 fi
131 """)
132 }
133 }
134 }
135 stage('Deploy and test') {
Matteo Scandolo52749cb2020-08-27 16:33:13 -0700136 steps {
137 repeat_deploy_and_test(topologies)
138 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700139 }
140 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700141 post {
142 always {
143 archiveArtifacts artifacts: '*-install-minimal.log,*-minimal-env.sh,RobotLogs/**/*,stats/**/*'
144 }
145 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700146}
147
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700148def repeat_deploy_and_test(list) {
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700149 for (int i = 0; i < list.size(); i++) {
Matteo Scandolof6e86582020-11-03 17:53:01 -0800150 stage('Cleanup') {
151 sh returnStdout: false, script: """
152 for hchart in \$(helm list -q | grep -E -v 'bbsim-sadis-server|onos|radius');
153 do
154 echo "Purging chart: \${hchart}"
155 helm delete "\${hchart}"
156 done
157 bash /home/cord/voltha-scale/wait_for_pods.sh
158 """
159 }
160 stage('Deploy monitoring infrastructure') {
161 sh returnStdout: false, script: '''
162 helm install nem-monitoring cord/nem-monitoring \
163 -f $HOME/voltha-scale/grafana.yaml \
164 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
165 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
166
167 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
168 bash /home/cord/voltha-scale/wait_for_pods.sh
169 '''
170 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700171 stage('Deploy topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
172 timeout(time: 10, unit: 'MINUTES') {
173 script {
174 now = new Date();
175 currentRunStart = now.getTime() / 1000;
176 println("Start: " + currentRunStart)
177 }
178 sh returnStdout: false, script: """
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700179 cd $WORKSPACE/kind-voltha/
180
181 if [ '${release.trim()}' != 'master' ]; then
182 source $WORKSPACE/kind-voltha/releases/${release}
183 fi
184
185 # if it's newer than voltha-2.4 set the correct BBSIM_CFG
186 if [ '${release.trim()}' != 'voltha-2.4' ]; then
187 export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-dt.yaml"
188 fi
189
190 export NUM_OF_BBSIM=${list[i]['olt']}
191 export EXTRA_HELM_FLAGS+="--set enablePerf=true,pon=${list[i]['pon']},onu=${list[i]['onu']} "
Matteo Scandolof6e86582020-11-03 17:53:01 -0800192 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 -0700193 ./voltha up
194
195 cp minimal-env.sh ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-minimal-env.sh
196 cp install-minimal.log ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-install-minimal.log
197 """
198 //sleep(120) // TODO can we improve and check once the bbsim-sadis-server is actually done loading subscribers??
199 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700200 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700201 stage('Test topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
202 timeout(time: 10, unit: 'MINUTES') {
203 sh returnStdout: false, script: """
204 mkdir -p $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
205 cd $WORKSPACE/voltha-system-tests
206 make vst_venv
207
208 export ROBOT_PARAMS=" \
209 -v olt:${list[i]['olt']} \
210 -v pon:${list[i]['pon']} \
211 -v onu:${list[i]['onu']} \
212 -v workflow:dt \
213 -v withEapol:false \
214 -v withDhcp:false \
215 -v withIgmp:false \
216 --noncritical non-critical \
217 -e teardown \
218 -e authentication \
219 -e dhcp"
220
221 cd $WORKSPACE/voltha-system-tests
222 source ./vst_venv/bin/activate
223 robot -d $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} \
224 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
225 """
226 }
227 }
228 stage('Collect metrics: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
229 script {
230 now = new Date();
231 currentRunEnd = now.getTime() / 1000;
232 println("End: " + currentRunEnd)
233 delta = currentRunEnd - currentRunStart
234 println("Delta: " + delta)
235 minutesDelta = Math.ceil(delta / 60).toInteger()
236 println("Delta in minutes: " + minutesDelta)
237 }
238 sh returnStdout: false, script: """
239 export LOG_FOLDER=$WORKSPACE/stats/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
240 mkdir -p \$LOG_FOLDER
241 cd $WORKSPACE/voltha-system-tests
242 make vst_venv
243 source ./vst_venv/bin/activate
244
Matteo Scandolof6e86582020-11-03 17:53:01 -0800245 sleep 60 # we have to wait for prometheus to collect all the information
246
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700247 python tests/scale/sizing.py -o \$LOG_FOLDER -s ${minutesDelta}|| true
248 """
249 }
250 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700251}