blob: d98ddcb5358e0b53d5a3145f229d6ce0560262bc [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
58 NUM_OF_ONOS="1"
59 NUM_OF_ATOMIX="0"
60 NUM_OF_KAFKA="1"
61 NUM_OF_ETCD="1"
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 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700135 stage('Deploy monitoring infrastructure') {
136 steps {
137 sh '''
138 helm install nem-monitoring cord/nem-monitoring \
139 -f $HOME/voltha-scale/grafana.yaml \
140 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
141 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
142
143 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
144 bash /home/cord/voltha-scale/wait_for_pods.sh
145 '''
146 }
147 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700148 stage('Deploy and test') {
Matteo Scandolo52749cb2020-08-27 16:33:13 -0700149 steps {
150 repeat_deploy_and_test(topologies)
151 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700152 }
153 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700154 post {
155 always {
156 archiveArtifacts artifacts: '*-install-minimal.log,*-minimal-env.sh,RobotLogs/**/*,stats/**/*'
157 }
158 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700159}
160
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700161def repeat_deploy_and_test(list) {
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700162 for (int i = 0; i < list.size(); i++) {
163 stage('Deploy topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
164 timeout(time: 10, unit: 'MINUTES') {
165 script {
166 now = new Date();
167 currentRunStart = now.getTime() / 1000;
168 println("Start: " + currentRunStart)
169 }
170 sh returnStdout: false, script: """
171 for hchart in \$(helm list -q | grep -E -v 'bbsim-sadis-server|kafka|onos|radius|monitoring');
172 do
173 echo "Purging chart: \${hchart}"
174 helm delete "\${hchart}"
175 done
176 bash /home/cord/voltha-scale/wait_for_pods.sh
177 """
178 sh returnStdout: false, script: """
179 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']} "
192 ./voltha up
193
194 cp minimal-env.sh ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-minimal-env.sh
195 cp install-minimal.log ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-install-minimal.log
196 """
197 //sleep(120) // TODO can we improve and check once the bbsim-sadis-server is actually done loading subscribers??
198 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700199 }
Matteo Scandolo5fec8022020-08-27 17:29:35 -0700200 stage('Test topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
201 timeout(time: 10, unit: 'MINUTES') {
202 sh returnStdout: false, script: """
203 mkdir -p $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
204 cd $WORKSPACE/voltha-system-tests
205 make vst_venv
206
207 export ROBOT_PARAMS=" \
208 -v olt:${list[i]['olt']} \
209 -v pon:${list[i]['pon']} \
210 -v onu:${list[i]['onu']} \
211 -v workflow:dt \
212 -v withEapol:false \
213 -v withDhcp:false \
214 -v withIgmp:false \
215 --noncritical non-critical \
216 -e teardown \
217 -e authentication \
218 -e dhcp"
219
220 cd $WORKSPACE/voltha-system-tests
221 source ./vst_venv/bin/activate
222 robot -d $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} \
223 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
224 """
225 }
226 }
227 stage('Collect metrics: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) {
228 script {
229 now = new Date();
230 currentRunEnd = now.getTime() / 1000;
231 println("End: " + currentRunEnd)
232 delta = currentRunEnd - currentRunStart
233 println("Delta: " + delta)
234 minutesDelta = Math.ceil(delta / 60).toInteger()
235 println("Delta in minutes: " + minutesDelta)
236 }
237 sh returnStdout: false, script: """
238 export LOG_FOLDER=$WORKSPACE/stats/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}
239 mkdir -p \$LOG_FOLDER
240 cd $WORKSPACE/voltha-system-tests
241 make vst_venv
242 source ./vst_venv/bin/activate
243
244 python tests/scale/sizing.py -o \$LOG_FOLDER -s ${minutesDelta}|| true
245 """
246 }
247 }
Matteo Scandoloc88d3132020-08-27 15:24:34 -0700248}