blob: 0c59b5312a1824d733d760f36b209d82a8a31821 [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 }
Shrey Baidb0447182020-02-27 16:39:35 -080032 stage('cleanup') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080033 steps {
Shrey Baidb0447182020-02-27 16:39:35 -080034 sh '''
35 helm del --purge onos voltha openolt openonu bbsim radius
36 bash /home/cord/voltha-scale/wait_for_pods.sh
37 bash /home/cord/voltha-scale/stop_port_forward.sh
38 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080039 }
40 }
41 stage('start') {
42 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080043 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080044 #!/usr/bin/env bash
45 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080046 '''
47 }
48 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080049 stage('deploy-voltha') {
50 steps {
51 sh '''
Shrey Baidb0447182020-02-27 16:39:35 -080052 helm install -n onos onf/onos --set images.onos.repository=voltha/voltha-onos --set images.onos.tag=4.0.1
53 helm install -n voltha onf/voltha -f /home/cord/voltha-scale/voltha-values.yaml
54 helm install -n openolt onf/voltha-adapter-openolt -f /home/cord/voltha-scale/voltha-values.yaml
55 helm install -n openonu onf/voltha-adapter-openonu -f /home/cord/voltha-scale/voltha-values.yaml
56
57 helm install -n bbsim onf/bbsim --set pon=${ponPorts},onu=${onuPerPon},auth=${bbsimAuth},dhcp=${bbsimDhcp},delay=${BBSIMdelay}
58 helm install -n radius onf/freeradius
59
Shrey Baide7614d02020-02-25 10:26:42 -080060 if [ ! -z ${bbsimImg} ];
61 then
62 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
63 EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}"
64 fi
65 if [ ! -z ${volthaImg} ];
66 then
67 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
68 EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}"
69 fi
Shrey Baidb0447182020-02-27 16:39:35 -080070 bash /home/cord/voltha-scale/wait_for_pods.sh
71 bash /home/cord/voltha-scale/start_port_forward.sh
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
Shrey Baidb0447182020-02-27 16:39:35 -080079 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -080080 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -080081 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
Shrey Baide7614d02020-02-25 10:26:42 -080082 fi
83 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080084 }
Shrey Baide7614d02020-02-25 10:26:42 -080085 }
86 stage('disable-ONOS-apps') {
87 steps {
88 sh '''
89 #Check withOnosApps and disable apps accordingly
90 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -080091 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
92 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
93 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.dhcpl2relay
Shrey Baide7614d02020-02-25 10:26:42 -080094 fi
95 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080096 }
Shrey Baide7614d02020-02-25 10:26:42 -080097 }
98 stage('configuration') {
99 steps {
100 sh '''
101 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800102 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
103 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800104 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800105 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery}
Shrey Baide7614d02020-02-25 10:26:42 -0800106 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800107 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval}
Shrey Baide7614d02020-02-25 10:26:42 -0800108 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800109 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval}
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800110 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800111 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800112 '''
113 }
114 }
115 stage('execute') {
116 options {
117 timeout(time:10)
118 }
119 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800120 stage('ONUs-enabled') {
121 steps {
122 sh '''
123 if [ -z ${expectedOnus} ]
124 then
125 echo -e "You need to set the target ONU number\n"
126 exit 1
127 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800128
Shrey Baida3b8aa62020-02-13 11:22:51 -0800129 voltctl device create -t openolt -H bbsim:50060
130 voltctl device enable $(voltctl device list --filter Type~openolt -q)
131 # check ONUs reached Active State in VOLTHA
132 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
133 until [ $i -eq ${expectedOnus} ]
134 do
135 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
136 sleep ${pollInterval}
137 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
138 done
139 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800140 echo $SECONDS > activation-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800141 '''
142 }
143 }
144 stage('ONOS-ports') {
145 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800146 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800147 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800148 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800149 until [ $z -eq ${expectedOnus} ]
150 do
151 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
152 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800153 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800154 done
155 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800156 echo $SECONDS > port-recognition.txt
Shrey Baidb0447182020-02-27 16:39:35 -0800157 echo "ONOS-Duration(s)" > total-time.txt
158 echo "VOLTHA-Duration(s)" > onu-activation.txt
Shrey Baide7614d02020-02-25 10:26:42 -0800159 cat activation-time.txt >> onu-activation.txt
160 paste activation-time.txt port-recognition.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800161 '''
162 }
163 }
Shrey Baidb001c712020-02-11 11:12:46 -0800164 }
165 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800166 }
167 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800168 always {
169 plot([
170 csvFileName: 'plot-onu-activation.csv',
Shrey Baidb0447182020-02-27 16:39:35 -0800171 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']],
172 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
Shrey Baide7614d02020-02-25 10:26:42 -0800173 ])
174 archiveArtifacts artifacts: '*.log,*.txt'
Shrey Baid18165a32020-02-27 11:01:13 -0800175 script {
176 sh '''
177 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
178 '''
Shrey Baide7614d02020-02-25 10:26:42 -0800179 }
Shrey Baid18165a32020-02-27 11:01:13 -0800180 }
Shrey Baide7614d02020-02-25 10:26:42 -0800181 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800182 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800183 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800184 set +e
185 rm onu-activation.txt
186 rm total-time.txt
187 rm port-recognition.txt
188 rm activation-time.txt
Matteo Scandolo51b76302020-02-05 12:07:23 -0800189 '''
190 }
191 }
Shrey Baidb0447182020-02-27 16:39:35 -0800192}