blob: 9b5930c0a1599988f059c505ebc0f129f335e275 [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 Baid0d4e31d2020-02-11 13:28:47 -080062 git clone https://github.com/opencord/voltha-openonu-adapter.git
Shrey Baidba6e9852020-02-12 11:19:33 -080063 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 -080064 rm -rf voltha-openonu-adapter
65 fi
66 '''
67 }
68 }
69 stage('disable-ONOS-apps') {
70 steps {
71 sh '''
72 #Check withOnosApps and disable apps accordingly
Shrey Baid7cbb06e2020-02-11 17:45:07 -080073 if [ ${withOnosApps} = false ] ; then
Shrey Baid0d4e31d2020-02-11 13:28:47 -080074 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt
75 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
76 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
77 fi
78 '''
79 }
80 }
Shrey Baid7cbb06e2020-02-11 17:45:07 -080081 stage('configuration') {
82 steps {
83 sh '''
84 #Setting LOG level to WARN
85 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 -080086 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 -080087 #Setting link discovery
88 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}
89 #Setting the flow stats collection interval
90 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}
91 #Setting the ports stats collection interval
92 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}
93 '''
94 }
95 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080096 stage('activate-ONUs') {
97 steps {
98 sh '''
Shrey Baid7cbb06e2020-02-11 17:45:07 -080099 if [ -z ${expectedOnus} ]
Shrey Baid00ff5c42020-02-07 15:14:08 -0800100 then
101 echo -e "You need to set the target ONU number\n"
102 exit 1
103 fi
104
105 voltctl device create -t openolt -H bbsim:50060
106 voltctl device enable $(voltctl device list --filter Type~openolt -q)
Shrey Baid00ff5c42020-02-07 15:14:08 -0800107
108 # check ONUs reached Active State in VOLTHA
109 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800110 until [ $i -eq ${expectedOnus} ]
Shrey Baid00ff5c42020-02-07 15:14:08 -0800111 do
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800112 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
113 sleep ${pollInterval}
Shrey Baid00ff5c42020-02-07 15:14:08 -0800114 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
115 done
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800116 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baid00ff5c42020-02-07 15:14:08 -0800117 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -0800118 }
119 }
Shrey Baidb001c712020-02-11 11:12:46 -0800120 stage('ONOS-ports') {
121 steps {
122 sh '''
123 # Check ports showed up in ONOS
124 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 -0800125 until [ $z -eq ${expectedOnus} ]
Shrey Baidb001c712020-02-11 11:12:46 -0800126 do
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800127 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
128 sleep ${pollInterval}
Shrey Baidb001c712020-02-11 11:12:46 -0800129 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
130 done
Shrey Baid7cbb06e2020-02-11 17:45:07 -0800131 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baidb001c712020-02-11 11:12:46 -0800132 '''
133 }
134 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800135 }
136 post {
137 cleanup {
138 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800139 #!/usr/bin/env bash
140 set -euo pipefail
141 cd $WORKSPACE/kind-voltha
142
Matteo Scandolo51b76302020-02-05 12:07:23 -0800143 WAIT_ON_DOWN=y ./voltha down
144 cd $WORKSPACE/
145 rm -rf kind-voltha/ || true
146 '''
147 }
148 }
Shrey Baidba6e9852020-02-12 11:19:33 -0800149}