blob: 3635c100c7661e3dd74fe95544bf8f21e7e8d1dd [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 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080049
Shrey Baid00ff5c42020-02-07 15:14:08 -080050 stage('deploy-voltha') {
51 steps {
52 sh '''
53 cd kind-voltha
54
55 EXTRA_HELM_FLAGS="--set onu=${onuCount},pon=${ponCount}" ./voltha up
56
57 '''
58 }
59 }
60 stage('activate-ONUs') {
61 steps {
62 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -080063 if [ -z "$onuTarget" ]
64 then
65 echo -e "You need to set the target ONU number\n"
66 exit 1
67 fi
68
69 voltctl device create -t openolt -H bbsim:50060
70 voltctl device enable $(voltctl device list --filter Type~openolt -q)
71 SECONDS=0
72
73 # check ONUs reached Active State in VOLTHA
74 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
75 until [ $i -eq $onuTarget ]
76 do
77 echo "$i ONUs ACTIVE of $onuTarget expected (time: $SECONDS)"
Shrey Baid6777d2c2020-02-10 11:36:55 -080078 sleep $pollInterval
Shrey Baid00ff5c42020-02-07 15:14:08 -080079 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
80 done
81 echo "$onuTarget ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baidb001c712020-02-11 11:12:46 -080082 #exit 0
Shrey Baid00ff5c42020-02-07 15:14:08 -080083
84 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080085 }
86 }
Shrey Baidb001c712020-02-11 11:12:46 -080087 stage('ONOS-ports') {
88 steps {
89 sh '''
90 # Check ports showed up in ONOS
91 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
92 until [ $z -eq "$onuTarget" ]
93 do
94 echo "${z} enabled ports of "$onuTarget" expected (time: $SECONDS)"
95 sleep $pollInterval
96 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
97 done
98 echo "$onuTarget ports enabled in $SECONDS seconds (time: $SECONDS)"
99 '''
100 }
101 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800102 }
103 post {
104 cleanup {
105 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800106 #!/usr/bin/env bash
107 set -euo pipefail
108 cd $WORKSPACE/kind-voltha
109
Matteo Scandolo51b76302020-02-05 12:07:23 -0800110 WAIT_ON_DOWN=y ./voltha down
111 cd $WORKSPACE/
112 rm -rf kind-voltha/ || true
113 '''
114 }
115 }
116}