Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 1 | /* voltha-scale-measurements pipeline */ |
| 2 | pipeline { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 3 | /* no label, executor is determined by JJB */ |
| 4 | agent { |
| 5 | label "${params.buildNode}" |
| 6 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 7 | 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 Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 22 | 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 Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 31 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 32 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 33 | ], |
| 34 | ]) |
| 35 | script { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 36 | git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim() |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 37 | } |
| 38 | } |
| 39 | } |
| 40 | stage('start') { |
| 41 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 42 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 43 | #!/usr/bin/env bash |
| 44 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 45 | ''' |
| 46 | } |
| 47 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 48 | |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 49 | 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)" |
| 78 | sleep 20 |
| 79 | 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 Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 85 | } |
| 86 | } |
| 87 | } |
| 88 | post { |
| 89 | cleanup { |
| 90 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 91 | #!/usr/bin/env bash |
| 92 | set -euo pipefail |
| 93 | cd $WORKSPACE/kind-voltha |
| 94 | |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 95 | WAIT_ON_DOWN=y ./voltha down |
| 96 | cd $WORKSPACE/ |
| 97 | rm -rf kind-voltha/ || true |
| 98 | ''' |
| 99 | } |
| 100 | } |
| 101 | } |