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 |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 13 | SECONDS=0 |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 14 | WITH_SIM_ADAPTERS="n" |
| 15 | WITH_RADIUS="y" |
| 16 | WITH_BBSIM="y" |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 17 | VOLTHA_LOG_LEVEL="WARN" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 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 | } |
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 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 48 | stage('deploy-voltha') { |
| 49 | steps { |
| 50 | sh ''' |
| 51 | cd kind-voltha |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 52 | DEPLOY_K8S=n EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimEapol},dhcp=${bbsimDhcp}" ./voltha up |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 53 | ''' |
| 54 | } |
| 55 | } |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 56 | stages { |
| 57 | stage('MIB-template') { |
| 58 | steps { |
| 59 | sh ''' |
| 60 | if [ ${withMibTemplate} = true ] ; then |
| 61 | wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json |
| 62 | cat 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 |
| 63 | fi |
| 64 | ''' |
| 65 | } |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 66 | } |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 67 | stage('disable-ONOS-apps') { |
| 68 | steps { |
| 69 | sh ''' |
| 70 | #Check withOnosApps and disable apps accordingly |
| 71 | if [ ${withOnosApps} = false ] ; then |
| 72 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt |
| 73 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa |
| 74 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay |
| 75 | fi |
| 76 | ''' |
| 77 | } |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 78 | } |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 79 | stage('configuration') { |
| 80 | steps { |
| 81 | sh ''' |
| 82 | #Setting LOG level to WARN |
| 83 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN |
| 84 | kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false |
| 85 | #Setting link discovery |
| 86 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery} |
| 87 | #Setting the flow stats collection interval |
| 88 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval} |
| 89 | #Setting the ports stats collection interval |
| 90 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval} |
| 91 | ''' |
| 92 | } |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 93 | } |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 94 | stage('execute') { |
| 95 | options { |
| 96 | timeout(time:10) |
| 97 | } |
| 98 | stage('ONUs-enabled') { |
| 99 | steps { |
| 100 | sh ''' |
| 101 | if [ -z ${expectedOnus} ] |
| 102 | then |
| 103 | echo -e "You need to set the target ONU number\n" |
| 104 | exit 1 |
| 105 | fi |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 106 | |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 107 | voltctl device create -t openolt -H bbsim:50060 |
| 108 | voltctl device enable $(voltctl device list --filter Type~openolt -q) |
| 109 | # check ONUs reached Active State in VOLTHA |
| 110 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 111 | until [ $i -eq ${expectedOnus} ] |
| 112 | do |
| 113 | echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)" |
| 114 | sleep ${pollInterval} |
| 115 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 116 | done |
| 117 | echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)" |
| 118 | ''' |
| 119 | } |
| 120 | } |
| 121 | stage('ONOS-ports') { |
| 122 | steps { |
| 123 | sh ''' |
| 124 | # Check ports showed up in ONOS |
| 125 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 126 | until [ $z -eq ${expectedOnus} ] |
| 127 | do |
| 128 | echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)" |
| 129 | sleep ${pollInterval} |
| 130 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 131 | done |
| 132 | echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)" |
| 133 | ''' |
| 134 | } |
| 135 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 136 | } |
| 137 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 138 | } |
| 139 | post { |
| 140 | cleanup { |
| 141 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 142 | #!/usr/bin/env bash |
| 143 | set -euo pipefail |
| 144 | cd $WORKSPACE/kind-voltha |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 145 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 146 | cd $WORKSPACE/ |
| 147 | rm -rf kind-voltha/ || true |
| 148 | ''' |
| 149 | } |
| 150 | } |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame] | 151 | } |