blob: 55af1aa9c2d4c2ae08e3dd16a20b219202bffd39 [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"
17 DEPLOY_K8S="y"
Shrey Baid7cbb06e2020-02-11 17:45:07 -080018 VOLTHA_LOG_LEVEL="WARN"
Shrey Baid00ff5c42020-02-07 15:14:08 -080019 CONFIG_SADIS="n"
20 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False"
Shrey Baidb001c712020-02-11 11:12:46 -080021 SSHPASS="karaf"
Shrey Baid00ff5c42020-02-07 15:14:08 -080022 }
23
Matteo Scandolo51b76302020-02-05 12:07:23 -080024 stages {
25 stage('checkout') {
26 steps {
27 checkout([
28 $class: 'GitSCM',
29 userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]],
30 branches: [[ name: "master", ]],
31 extensions: [
32 [$class: 'WipeWorkspace'],
Shrey Baid00ff5c42020-02-07 15:14:08 -080033 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
Matteo Scandolo51b76302020-02-05 12:07:23 -080034 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
35 ],
36 ])
37 script {
Shrey Baid00ff5c42020-02-07 15:14:08 -080038 git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim()
Matteo Scandolo51b76302020-02-05 12:07:23 -080039 }
40 }
41 }
42 stage('start') {
43 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080044 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080045 #!/usr/bin/env bash
46 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080047 '''
48 }
49 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080050 stage('deploy-voltha') {
51 steps {
52 sh '''
53 cd kind-voltha
Shrey Baid7cbb06e2020-02-11 17:45:07 -080054 EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay}" ./voltha up
Shrey Baid00ff5c42020-02-07 15:14:08 -080055 '''
56 }
57 }
Shrey Baid0d4e31d2020-02-11 13:28:47 -080058 stage('MIB-template') {
59 steps {
60 sh '''
Shrey Baid7cbb06e2020-02-11 17:45:07 -080061 if [ ${withMibTemplate} = true ] ; then
Shrey Baidba6e9852020-02-12 11:19:33 -080062 rm -rf voltha-openonu-adapter
Shrey Baid0d4e31d2020-02-11 13:28:47 -080063 git clone https://github.com/opencord/voltha-openonu-adapter.git
Shrey Baidba6e9852020-02-12 11:19:33 -080064 cat voltha-openonu-adapter/templates/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
Shrey Baid0d4e31d2020-02-11 13:28:47 -080065 rm -rf voltha-openonu-adapter
66 fi
67 '''
68 }
69 }
70 stage('disable-ONOS-apps') {
71 steps {
72 sh '''
73 #Check withOnosApps and disable apps accordingly
Shrey Baid7cbb06e2020-02-11 17:45:07 -080074 if [ ${withOnosApps} = false ] ; then
Shrey Baid0d4e31d2020-02-11 13:28:47 -080075 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt
76 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
77 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
78 fi
79 '''
80 }
81 }
Shrey Baid7cbb06e2020-02-11 17:45:07 -080082 stage('configuration') {
83 steps {
84 sh '''
85 #Setting LOG level to WARN
86 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN
Shrey Baidba6e9852020-02-12 11:19:33 -080087 kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baid7cbb06e2020-02-11 17:45:07 -080088 #Setting link discovery
89 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}
90 #Setting the flow stats collection interval
91 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}
92 #Setting the ports stats collection interval
93 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}
94 '''
95 }
96 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080097 stage('activate-ONUs') {
98 steps {
99 sh '''
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800100 if [ -z ${expectedOnus} ]
Shrey Baid00ff5c42020-02-07 15:14:08 -0800101 then
102 echo -e "You need to set the target ONU number\n"
103 exit 1
104 fi
105
106 voltctl device create -t openolt -H bbsim:50060
107 voltctl device enable $(voltctl device list --filter Type~openolt -q)
Shrey Baid00ff5c42020-02-07 15:14:08 -0800108
109 # check ONUs reached Active State in VOLTHA
110 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800111 until [ $i -eq ${expectedOnus} ]
Shrey Baid00ff5c42020-02-07 15:14:08 -0800112 do
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800113 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
114 sleep ${pollInterval}
Shrey Baid00ff5c42020-02-07 15:14:08 -0800115 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
116 done
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800117 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baid00ff5c42020-02-07 15:14:08 -0800118 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -0800119 }
120 }
Shrey Baidb001c712020-02-11 11:12:46 -0800121 stage('ONOS-ports') {
122 steps {
123 sh '''
124 # Check ports showed up in ONOS
125 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800126 until [ $z -eq ${expectedOnus} ]
Shrey Baidb001c712020-02-11 11:12:46 -0800127 do
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800128 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
129 sleep ${pollInterval}
Shrey Baidb001c712020-02-11 11:12:46 -0800130 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
131 done
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800132 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baidb001c712020-02-11 11:12:46 -0800133 '''
134 }
135 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800136 }
137 post {
138 cleanup {
139 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800140 #!/usr/bin/env bash
141 set -euo pipefail
142 cd $WORKSPACE/kind-voltha
143
Matteo Scandolo51b76302020-02-05 12:07:23 -0800144 WAIT_ON_DOWN=y ./voltha down
145 cd $WORKSPACE/
146 rm -rf kind-voltha/ || true
147 '''
148 }
149 }
Shrey Baidba6e9852020-02-12 11:19:33 -0800150}