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" |
| 17 | DEPLOY_K8S="y" |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 18 | VOLTHA_LOG_LEVEL="WARN" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 19 | CONFIG_SADIS="n" |
| 20 | ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False" |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 21 | SSHPASS="karaf" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 22 | } |
| 23 | |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 24 | stages { |
| 25 | stage('checkout') { |
| 26 | steps { |
| 27 | checkout([ |
| 28 | $class: 'GitSCM', |
| 29 | userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]], |
| 30 | branches: [[ name: "master", ]], |
| 31 | extensions: [ |
| 32 | [$class: 'WipeWorkspace'], |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 33 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 34 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 35 | ], |
| 36 | ]) |
| 37 | script { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 38 | 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] | 39 | } |
| 40 | } |
| 41 | } |
| 42 | stage('start') { |
| 43 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 44 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 45 | #!/usr/bin/env bash |
| 46 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 47 | ''' |
| 48 | } |
| 49 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 50 | stage('deploy-voltha') { |
| 51 | steps { |
| 52 | sh ''' |
| 53 | cd kind-voltha |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 54 | EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay}" ./voltha up |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 55 | ''' |
| 56 | } |
| 57 | } |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 58 | stage('MIB-template') { |
| 59 | steps { |
| 60 | sh ''' |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 61 | if [ ${withMibTemplate} = true ] ; then |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame^] | 62 | rm -rf voltha-openonu-adapter |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 63 | git clone https://github.com/opencord/voltha-openonu-adapter.git |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame^] | 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 |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 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 |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 74 | if [ ${withOnosApps} = false ] ; then |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 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 | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 82 | stage('configuration') { |
| 83 | steps { |
| 84 | sh ''' |
| 85 | #Setting LOG level to WARN |
| 86 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame^] | 87 | kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 88 | #Setting link discovery |
| 89 | 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} |
| 90 | #Setting the flow stats collection interval |
| 91 | 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} |
| 92 | #Setting the ports stats collection interval |
| 93 | 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} |
| 94 | ''' |
| 95 | } |
| 96 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 97 | stage('activate-ONUs') { |
| 98 | steps { |
| 99 | sh ''' |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 100 | if [ -z ${expectedOnus} ] |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 101 | then |
| 102 | echo -e "You need to set the target ONU number\n" |
| 103 | exit 1 |
| 104 | fi |
| 105 | |
| 106 | voltctl device create -t openolt -H bbsim:50060 |
| 107 | voltctl device enable $(voltctl device list --filter Type~openolt -q) |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 108 | |
| 109 | # check ONUs reached Active State in VOLTHA |
| 110 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 111 | until [ $i -eq ${expectedOnus} ] |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 112 | do |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 113 | echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)" |
| 114 | sleep ${pollInterval} |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 115 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 116 | done |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 117 | echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 118 | ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 119 | } |
| 120 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 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) |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 126 | until [ $z -eq ${expectedOnus} ] |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 127 | do |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 128 | echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)" |
| 129 | sleep ${pollInterval} |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 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 |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 132 | echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 133 | ''' |
| 134 | } |
| 135 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 136 | } |
| 137 | post { |
| 138 | cleanup { |
| 139 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 140 | #!/usr/bin/env bash |
| 141 | set -euo pipefail |
| 142 | cd $WORKSPACE/kind-voltha |
| 143 | |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 144 | WAIT_ON_DOWN=y ./voltha down |
| 145 | cd $WORKSPACE/ |
| 146 | rm -rf kind-voltha/ || true |
| 147 | ''' |
| 148 | } |
| 149 | } |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame^] | 150 | } |