blob: d37ca51ff9c5bb6ffcb1b12e34510dc4245e3b0f [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 Baid00ff5c42020-02-07 15:14:08 -080021 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080022 stages {
23 stage('checkout') {
24 steps {
25 checkout([
26 $class: 'GitSCM',
27 userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]],
28 branches: [[ name: "master", ]],
29 extensions: [
30 [$class: 'WipeWorkspace'],
Shrey Baid00ff5c42020-02-07 15:14:08 -080031 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
Matteo Scandolo51b76302020-02-05 12:07:23 -080032 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
33 ],
34 ])
35 script {
Shrey Baid00ff5c42020-02-07 15:14:08 -080036 git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim()
Matteo Scandolo51b76302020-02-05 12:07:23 -080037 }
38 }
39 }
40 stage('start') {
41 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080042 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080043 #!/usr/bin/env bash
44 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080045 '''
46 }
47 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080048 stage('deploy-voltha') {
49 steps {
50 sh '''
51 cd kind-voltha
Shrey Baida3b8aa62020-02-13 11:22:51 -080052 DEPLOY_K8S=n EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimEapol},dhcp=${bbsimDhcp}" ./voltha up
Shrey Baid00ff5c42020-02-07 15:14:08 -080053 '''
54 }
55 }
Shrey Baida3b8aa62020-02-13 11:22:51 -080056 stages {
57 stage('MIB-template') {
58 steps {
59 sh '''
60 if [ ${withMibTemplate} = true ] ; then
61 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
62 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
63 fi
64 '''
65 }
Shrey Baid0d4e31d2020-02-11 13:28:47 -080066 }
Shrey Baida3b8aa62020-02-13 11:22:51 -080067 stage('disable-ONOS-apps') {
68 steps {
69 sh '''
70 #Check withOnosApps and disable apps accordingly
71 if [ ${withOnosApps} = false ] ; then
72 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt
73 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
74 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
75 fi
76 '''
77 }
Shrey Baid0d4e31d2020-02-11 13:28:47 -080078 }
Shrey Baida3b8aa62020-02-13 11:22:51 -080079 stage('configuration') {
80 steps {
81 sh '''
82 #Setting LOG level to WARN
83 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN
84 kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
85 #Setting link discovery
86 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}
87 #Setting the flow stats collection interval
88 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}
89 #Setting the ports 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.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval}
91 '''
92 }
Shrey Baid7cbb06e2020-02-11 17:45:07 -080093 }
Shrey Baida3b8aa62020-02-13 11:22:51 -080094 stage('execute') {
95 options {
96 timeout(time:10)
97 }
98 stage('ONUs-enabled') {
99 steps {
100 sh '''
101 if [ -z ${expectedOnus} ]
102 then
103 echo -e "You need to set the target ONU number\n"
104 exit 1
105 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800106
Shrey Baida3b8aa62020-02-13 11:22:51 -0800107 voltctl device create -t openolt -H bbsim:50060
108 voltctl device enable $(voltctl device list --filter Type~openolt -q)
109 # check ONUs reached Active State in VOLTHA
110 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
111 until [ $i -eq ${expectedOnus} ]
112 do
113 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
114 sleep ${pollInterval}
115 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
116 done
117 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
118 '''
119 }
120 }
121 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)
126 until [ $z -eq ${expectedOnus} ]
127 do
128 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
129 sleep ${pollInterval}
130 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
131 done
132 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
133 '''
134 }
135 }
Shrey Baidb001c712020-02-11 11:12:46 -0800136 }
137 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800138 }
139 post {
140 cleanup {
141 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800142 #!/usr/bin/env bash
143 set -euo pipefail
144 cd $WORKSPACE/kind-voltha
Shrey Baida3b8aa62020-02-13 11:22:51 -0800145 DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
Matteo Scandolo51b76302020-02-05 12:07:23 -0800146 cd $WORKSPACE/
147 rm -rf kind-voltha/ || true
148 '''
149 }
150 }
Shrey Baidba6e9852020-02-12 11:19:33 -0800151}