blob: 025eb75623415f3e7e9642f429e3d09d153b9b0e [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"
20 }
21
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 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080048
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 }
59 stage('activate-ONUs') {
60 steps {
61 sh '''
62 export SSHPASS=karaf
63 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)"
82 exit 0
83
84 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080085 }
86 }
87 }
88 post {
89 cleanup {
90 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -080091 #!/usr/bin/env bash
92 set -euo pipefail
93 cd $WORKSPACE/kind-voltha
94
Matteo Scandolo51b76302020-02-05 12:07:23 -080095 WAIT_ON_DOWN=y ./voltha down
96 cd $WORKSPACE/
97 rm -rf kind-voltha/ || true
98 '''
99 }
100 }
101}