blob: 8e2a0066fba81a9b0b8fb8e018c6281dd9be90b7 [file] [log] [blame]
Matteo Scandolo51b76302020-02-05 12:07:23 -08001/* voltha-scale-measurements pipeline */
2pipeline {
Matteo Scandolo51b76302020-02-05 12:07:23 -08003 /* no label, executor is determined by JJB */
4 agent {
5 label "${params.buildNode}"
6 }
Shrey Baid00ff5c42020-02-07 15:14:08 -08007 environment {
8 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
9 VOLTCONFIG="$HOME/.volt/config-minimal"
10 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
11 TYPE="minimal"
12 FANCY=0
Shrey Baid7cbb06e2020-02-11 17:45:07 -080013 SECONDS=0
Shrey Baid00ff5c42020-02-07 15:14:08 -080014 WITH_SIM_ADAPTERS="n"
15 WITH_RADIUS="y"
16 WITH_BBSIM="y"
Shrey Baid7cbb06e2020-02-11 17:45:07 -080017 VOLTHA_LOG_LEVEL="WARN"
Shrey Baid00ff5c42020-02-07 15:14:08 -080018 CONFIG_SADIS="n"
19 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False"
Shrey Baidb001c712020-02-11 11:12:46 -080020 SSHPASS="karaf"
Shrey Baide7614d02020-02-25 10:26:42 -080021 DEPLOY_K8S="n"
Shrey Baid67486582020-02-25 10:26:42 -080022 EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimAuth},dhcp=${bbsimDhcp}"
Shrey Baid00ff5c42020-02-07 15:14:08 -080023 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080024 stages {
Shrey Baide7614d02020-02-25 10:26:42 -080025 stage('set-description') {
26 steps {
27 script {
Matteo Scandolo7b3fde92020-02-26 16:17:16 -080028 currentBuild.description = "${onuPerPon} ONU x ${ponPorts} PON - BBSIM Delay ${BBSIMdelay}"
Shrey Baide7614d02020-02-25 10:26:42 -080029 }
30 }
31 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080032 stage('checkout') {
33 steps {
34 checkout([
35 $class: 'GitSCM',
36 userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]],
37 branches: [[ name: "master", ]],
38 extensions: [
39 [$class: 'WipeWorkspace'],
Shrey Baid00ff5c42020-02-07 15:14:08 -080040 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
Matteo Scandolo51b76302020-02-05 12:07:23 -080041 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
42 ],
43 ])
44 script {
Shrey Baid00ff5c42020-02-07 15:14:08 -080045 git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim()
Matteo Scandolo51b76302020-02-05 12:07:23 -080046 }
47 }
48 }
49 stage('start') {
50 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080051 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080052 #!/usr/bin/env bash
53 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080054 '''
55 }
56 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080057 stage('deploy-voltha') {
58 steps {
59 sh '''
60 cd kind-voltha
Shrey Baide7614d02020-02-25 10:26:42 -080061 if [ ! -z ${bbsimImg} ];
62 then
63 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
64 EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}"
65 fi
66 if [ ! -z ${volthaImg} ];
67 then
68 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
69 EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}"
70 fi
71 ./voltha up
Shrey Baid00ff5c42020-02-07 15:14:08 -080072 '''
73 }
74 }
Shrey Baide7614d02020-02-25 10:26:42 -080075 stage('MIB-template') {
76 steps {
77 sh '''
78 if [ ${withMibTemplate} = true ] ; then
79 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
80 cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it -n voltha $(kubectl get pods -n voltha | grep etcd-cluster | awk 'NR==1{print $1}') etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001
81 fi
82 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080083 }
Shrey Baide7614d02020-02-25 10:26:42 -080084 }
85 stage('disable-ONOS-apps') {
86 steps {
87 sh '''
88 #Check withOnosApps and disable apps accordingly
89 if [ ${withOnosApps} = false ] ; then
Shrey Baid67486582020-02-25 10:26:42 -080090 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deativate org.opencord.olt
Shrey Baide7614d02020-02-25 10:26:42 -080091 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
92 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
93 fi
94 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080095 }
Shrey Baide7614d02020-02-25 10:26:42 -080096 }
97 stage('configuration') {
98 steps {
99 sh '''
100 #Setting LOG level to WARN
101 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN
102 kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
103 #Setting link discovery
104 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery}
105 #Setting the flow stats collection interval
106 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval}
107 #Setting the ports stats collection interval
108 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval}
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800109 # extending voltctl timeout
110 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config-minimal
Shrey Baide7614d02020-02-25 10:26:42 -0800111 '''
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800112 }
Shrey Baide7614d02020-02-25 10:26:42 -0800113 }
114 stage('cpu-usage') {
115 steps {
116 sh '''
117 psrecord $(ps aux | grep -v "grep" | grep rw_core | awk 'NR==1{print $2}') --log rwcore-activity.txt --interval 1 &
118 '''
119 }
120 }
121 stage('execute') {
122 options {
123 timeout(time:10)
124 }
125 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800126 stage('ONUs-enabled') {
127 steps {
128 sh '''
129 if [ -z ${expectedOnus} ]
130 then
131 echo -e "You need to set the target ONU number\n"
132 exit 1
133 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800134
Shrey Baida3b8aa62020-02-13 11:22:51 -0800135 voltctl device create -t openolt -H bbsim:50060
136 voltctl device enable $(voltctl device list --filter Type~openolt -q)
137 # check ONUs reached Active State in VOLTHA
138 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
139 until [ $i -eq ${expectedOnus} ]
140 do
141 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
142 sleep ${pollInterval}
143 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
144 done
145 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800146 echo $SECONDS > activation-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800147 '''
148 }
149 }
150 stage('ONOS-ports') {
151 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800152 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800153 # Check ports showed up in ONOS
154 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
155 until [ $z -eq ${expectedOnus} ]
156 do
157 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
158 sleep ${pollInterval}
159 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
160 done
161 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800162 echo $SECONDS > port-recognition.txt
163 echo "Duration(s)" > total-time.txt
164 echo "Duration(s)" > onu-activation.txt
165 cat activation-time.txt >> onu-activation.txt
166 paste activation-time.txt port-recognition.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800167 '''
168 }
169 }
Shrey Baidb001c712020-02-11 11:12:46 -0800170 }
171 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800172 }
173 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800174 always {
175 plot([
176 csvFileName: 'plot-onu-activation.csv',
177 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: '']],
178 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'ONU Activation Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
179 ])
180
181 plot([
182 csvFileName: 'plot-total-time.csv',
183 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']],
184 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Port Recognition Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
185 ])
186 archiveArtifacts artifacts: '*.log,*.txt'
187 }
188 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800189 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800190 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800191 set +e
192 rm onu-activation.txt
193 rm total-time.txt
194 rm port-recognition.txt
195 rm activation-time.txt
196 cp kind-voltha/install-minimal.log $WORKSPACE/
197 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
198 '''
199 }
200 cleanup {
201 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800202 set -euo pipefail
203 cd $WORKSPACE/kind-voltha
Shrey Baida3b8aa62020-02-13 11:22:51 -0800204 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Matteo Scandolo51b76302020-02-05 12:07:23 -0800205 cd $WORKSPACE/
206 rm -rf kind-voltha/ || true
207 '''
208 }
209 }
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800210}