blob: d7aad0311be92a8b76476dcb16d8f427ab8dc37e [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
13 WITH_SIM_ADAPTERS="n"
14 WITH_RADIUS="y"
15 WITH_BBSIM="y"
16 DEPLOY_K8S="y"
17 VOLTHA_LOG_LEVEL="DEBUG"
18 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 }
22
Matteo Scandolo51b76302020-02-05 12:07:23 -080023 stages {
24 stage('checkout') {
25 steps {
26 checkout([
27 $class: 'GitSCM',
28 userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]],
29 branches: [[ name: "master", ]],
30 extensions: [
31 [$class: 'WipeWorkspace'],
Shrey Baid00ff5c42020-02-07 15:14:08 -080032 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
Matteo Scandolo51b76302020-02-05 12:07:23 -080033 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
34 ],
35 ])
36 script {
Shrey Baid00ff5c42020-02-07 15:14:08 -080037 git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim()
Matteo Scandolo51b76302020-02-05 12:07:23 -080038 }
39 }
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 '''
52 cd kind-voltha
53
54 EXTRA_HELM_FLAGS="--set onu=${onuCount},pon=${ponCount}" ./voltha up
55
56 '''
57 }
58 }
Shrey Baid0d4e31d2020-02-11 13:28:47 -080059 stage('MIB-template') {
60 steps {
61 sh '''
62 if [ "$withMibTemplate" = true ] ; then
63 git clone https://github.com/opencord/voltha-openonu-adapter.git
64 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
65 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
74 if [ "$withOnosApps" = false ] ; then
75 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 Baid00ff5c42020-02-07 15:14:08 -080082 stage('activate-ONUs') {
83 steps {
84 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -080085 if [ -z "$onuTarget" ]
86 then
87 echo -e "You need to set the target ONU number\n"
88 exit 1
89 fi
90
91 voltctl device create -t openolt -H bbsim:50060
92 voltctl device enable $(voltctl device list --filter Type~openolt -q)
93 SECONDS=0
94
95 # check ONUs reached Active State in VOLTHA
96 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
97 until [ $i -eq $onuTarget ]
98 do
99 echo "$i ONUs ACTIVE of $onuTarget expected (time: $SECONDS)"
Shrey Baid6777d2c2020-02-10 11:36:55 -0800100 sleep $pollInterval
Shrey Baid00ff5c42020-02-07 15:14:08 -0800101 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
102 done
103 echo "$onuTarget ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baidb001c712020-02-11 11:12:46 -0800104 #exit 0
Shrey Baid00ff5c42020-02-07 15:14:08 -0800105
106 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -0800107 }
108 }
Shrey Baidb001c712020-02-11 11:12:46 -0800109 stage('ONOS-ports') {
110 steps {
111 sh '''
112 # Check ports showed up in ONOS
113 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
114 until [ $z -eq "$onuTarget" ]
115 do
116 echo "${z} enabled ports of "$onuTarget" expected (time: $SECONDS)"
117 sleep $pollInterval
118 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
119 done
120 echo "$onuTarget ports enabled in $SECONDS seconds (time: $SECONDS)"
121 '''
122 }
123 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800124 }
125 post {
126 cleanup {
127 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800128 #!/usr/bin/env bash
129 set -euo pipefail
130 cd $WORKSPACE/kind-voltha
131
Matteo Scandolo51b76302020-02-05 12:07:23 -0800132 WAIT_ON_DOWN=y ./voltha down
133 cd $WORKSPACE/
134 rm -rf kind-voltha/ || true
135 '''
136 }
137 }
138}