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" |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 20 | SSHPASS="karaf" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 21 | } |
| 22 | |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 23 | 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 Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 32 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 33 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 34 | ], |
| 35 | ]) |
| 36 | script { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 37 | 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] | 38 | } |
| 39 | } |
| 40 | } |
| 41 | stage('start') { |
| 42 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 43 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 44 | #!/usr/bin/env bash |
| 45 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 46 | ''' |
| 47 | } |
| 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 | } |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 59 | 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 Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 82 | stage('activate-ONUs') { |
| 83 | steps { |
| 84 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 85 | 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 Baid | 6777d2c | 2020-02-10 11:36:55 -0800 | [diff] [blame] | 100 | sleep $pollInterval |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 101 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 102 | done |
| 103 | echo "$onuTarget ONUs Activated in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 104 | #exit 0 |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 105 | |
| 106 | ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 107 | } |
| 108 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 109 | 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 Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 124 | } |
| 125 | post { |
| 126 | cleanup { |
| 127 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 128 | #!/usr/bin/env bash |
| 129 | set -euo pipefail |
| 130 | cd $WORKSPACE/kind-voltha |
| 131 | |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 132 | WAIT_ON_DOWN=y ./voltha down |
| 133 | cd $WORKSPACE/ |
| 134 | rm -rf kind-voltha/ || true |
| 135 | ''' |
| 136 | } |
| 137 | } |
| 138 | } |