blob: b225b1f16b7f7e1f3fc1a111cd9aabde195eb36d [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 Baid00ff5c42020-02-07 15:14:08 -080022 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080023 stages {
Shrey Baide7614d02020-02-25 10:26:42 -080024 stage('set-description') {
25 steps {
26 script {
27 currentBuild.description = "${onuPerPon} ONU x ${ponPorts} PON"
28 }
29 }
30 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080031 stage('checkout') {
32 steps {
33 checkout([
34 $class: 'GitSCM',
35 userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]],
36 branches: [[ name: "master", ]],
37 extensions: [
38 [$class: 'WipeWorkspace'],
Shrey Baid00ff5c42020-02-07 15:14:08 -080039 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
Matteo Scandolo51b76302020-02-05 12:07:23 -080040 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
41 ],
42 ])
43 script {
Shrey Baid00ff5c42020-02-07 15:14:08 -080044 git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim()
Matteo Scandolo51b76302020-02-05 12:07:23 -080045 }
46 }
47 }
48 stage('start') {
49 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080050 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080051 #!/usr/bin/env bash
52 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080053 '''
54 }
55 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080056 stage('deploy-voltha') {
57 steps {
58 sh '''
59 cd kind-voltha
Shrey Baide7614d02020-02-25 10:26:42 -080060 EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimAuth},dhcp=${bbsimDhcp}"
61 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
90 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app dfctivate org.opencord.olt
91 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}
109 '''
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800110 }
Shrey Baide7614d02020-02-25 10:26:42 -0800111 }
112 stage('cpu-usage') {
113 steps {
114 sh '''
115 psrecord $(ps aux | grep -v "grep" | grep rw_core | awk 'NR==1{print $2}') --log rwcore-activity.txt --interval 1 &
116 '''
117 }
118 }
119 stage('execute') {
120 options {
121 timeout(time:10)
122 }
123 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800124 stage('ONUs-enabled') {
125 steps {
126 sh '''
127 if [ -z ${expectedOnus} ]
128 then
129 echo -e "You need to set the target ONU number\n"
130 exit 1
131 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800132
Shrey Baida3b8aa62020-02-13 11:22:51 -0800133 voltctl device create -t openolt -H bbsim:50060
134 voltctl device enable $(voltctl device list --filter Type~openolt -q)
135 # check ONUs reached Active State in VOLTHA
136 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
137 until [ $i -eq ${expectedOnus} ]
138 do
139 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
140 sleep ${pollInterval}
141 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
142 done
143 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800144 echo $SECONDS > activation-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800145 '''
146 }
147 }
148 stage('ONOS-ports') {
149 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800150 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800151 # Check ports showed up in ONOS
152 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
153 until [ $z -eq ${expectedOnus} ]
154 do
155 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
156 sleep ${pollInterval}
157 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
158 done
159 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800160 echo $SECONDS > port-recognition.txt
161 echo "Duration(s)" > total-time.txt
162 echo "Duration(s)" > onu-activation.txt
163 cat activation-time.txt >> onu-activation.txt
164 paste activation-time.txt port-recognition.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800165 '''
166 }
167 }
Shrey Baidb001c712020-02-11 11:12:46 -0800168 }
169 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800170 }
171 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800172 always {
173 plot([
174 csvFileName: 'plot-onu-activation.csv',
175 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: '']],
176 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'ONU Activation Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
177 ])
178
179 plot([
180 csvFileName: 'plot-total-time.csv',
181 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']],
182 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Port Recognition Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
183 ])
184 archiveArtifacts artifacts: '*.log,*.txt'
185 }
186 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800187 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800188 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800189 set +e
190 rm onu-activation.txt
191 rm total-time.txt
192 rm port-recognition.txt
193 rm activation-time.txt
194 cp kind-voltha/install-minimal.log $WORKSPACE/
195 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
196 '''
197 }
198 cleanup {
199 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800200 set -euo pipefail
201 cd $WORKSPACE/kind-voltha
Shrey Baida3b8aa62020-02-13 11:22:51 -0800202 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Matteo Scandolo51b76302020-02-05 12:07:23 -0800203 cd $WORKSPACE/
204 rm -rf kind-voltha/ || true
205 '''
206 }
207 }
Shrey Baidba6e9852020-02-12 11:19:33 -0800208}