Merge "[VOL-2662]"
diff --git a/jjb/pipeline/voltha-scale-measurements.groovy b/jjb/pipeline/voltha-scale-measurements.groovy
index 9b5930c..d37ca51 100644
--- a/jjb/pipeline/voltha-scale-measurements.groovy
+++ b/jjb/pipeline/voltha-scale-measurements.groovy
@@ -14,13 +14,11 @@
     WITH_SIM_ADAPTERS="n"
     WITH_RADIUS="y"
     WITH_BBSIM="y"
-    DEPLOY_K8S="y"
     VOLTHA_LOG_LEVEL="WARN"
     CONFIG_SADIS="n"
     ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False"
     SSHPASS="karaf"
   }
-
   stages {
     stage('checkout') {
       steps {
@@ -51,85 +49,90 @@
       steps {
         sh '''
           cd kind-voltha
-          EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay}" ./voltha up
+          DEPLOY_K8S=n EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimEapol},dhcp=${bbsimDhcp}" ./voltha up
           '''
       }
     }
-    stage('MIB-template') {
-      steps {
-        sh '''
-          if [ ${withMibTemplate} = true ] ; then
-            git clone https://github.com/opencord/voltha-openonu-adapter.git
-            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
-            rm -rf voltha-openonu-adapter
-          fi
-        '''
+    stages {
+      stage('MIB-template') {
+        steps {
+          sh '''
+            if [ ${withMibTemplate} = true ] ; then
+              wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
+              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
+            fi
+          '''
+        }
       }
-    }
-    stage('disable-ONOS-apps') {
-      steps {
-         sh '''
-          #Check withOnosApps and disable apps accordingly
-          if [ ${withOnosApps} = false ] ; then
-            sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt
-            sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
-            sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
-          fi
-         '''
+      stage('disable-ONOS-apps') {
+        steps {
+          sh '''
+            #Check withOnosApps and disable apps accordingly
+            if [ ${withOnosApps} = false ] ; then
+              sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.olt
+              sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa
+              sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay
+            fi
+          '''
+        }
       }
-    }
-    stage('configuration') {
-      steps {
-        sh '''
-          #Setting LOG level to WARN
-          sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN
-          kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
-          #Setting link discovery
-          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}
-          #Setting the flow stats collection interval
-          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}
-          #Setting the ports stats collection interval
-          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}
-        '''
+      stage('configuration') {
+        steps {
+          sh '''
+            #Setting LOG level to WARN
+            sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN
+            kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
+            #Setting link discovery
+            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}
+            #Setting the flow stats collection interval
+            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}
+            #Setting the ports stats collection interval
+            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}
+          '''
+        }
       }
-    }
-    stage('activate-ONUs') {
-      steps {
-        sh '''
-          if [ -z ${expectedOnus} ]
-          then
-            echo -e "You need to set the target ONU number\n"
-            exit 1
-          fi
+      stage('execute') {
+        options {
+            timeout(time:10)
+          }
+        stage('ONUs-enabled') {
+          steps {
+            sh '''
+              if [ -z ${expectedOnus} ]
+              then
+                echo -e "You need to set the target ONU number\n"
+                exit 1
+              fi
 
-          voltctl device create -t openolt -H bbsim:50060
-          voltctl device enable $(voltctl device list --filter Type~openolt -q)
-
-          # check ONUs reached Active State in VOLTHA
-          i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
-          until [ $i -eq ${expectedOnus} ]
-          do
-            echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
-            sleep ${pollInterval}
-            i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
-          done
-          echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
-        '''
-      }
-    }
-    stage('ONOS-ports') {
-      steps {
-        sh '''    
-          # Check ports showed up in ONOS
-          z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
-          until [ $z -eq ${expectedOnus} ]
-          do
-            echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
-            sleep ${pollInterval}
-            z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
-          done
-          echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
-        '''
+              voltctl device create -t openolt -H bbsim:50060
+              voltctl device enable $(voltctl device list --filter Type~openolt -q)
+              # check ONUs reached Active State in VOLTHA
+              i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
+              until [ $i -eq ${expectedOnus} ]
+              do
+                echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
+                sleep ${pollInterval}
+                i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
+              done
+              echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
+            '''
+          }
+        }
+        stage('ONOS-ports') {
+          steps {
+            sh '''    
+              # Check ports showed up in ONOS
+              z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
+              until [ $z -eq ${expectedOnus} ]
+              do
+                echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
+                sleep ${pollInterval}
+                z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l)
+              done
+              echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
+            '''
+          }
+        }
       }
     }
   }
@@ -139,8 +142,7 @@
         #!/usr/bin/env bash
         set -euo pipefail
         cd $WORKSPACE/kind-voltha
-
-        WAIT_ON_DOWN=y ./voltha down
+        DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down
         cd $WORKSPACE/
         rm -rf kind-voltha/ || true
       '''
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 33bdd49..fde524f 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -88,6 +88,16 @@
           default: 600
           description: 'Ports Stats Collection Interval, milliseconds'
 
+      - string:
+          name: bbsimEapol
+          default: true
+          description: 'Option to toggle BBSIM EAPOL true/false'
+
+      - string:
+          name: bbsimDhcp
+          default: true
+          description: 'Option to toggle BBSIM DHCP true/false'
+
     project-type: pipeline
     concurrent: true
 
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
index c433d2d..41c358c 100644
--- a/packer/provision/basebuild.sh
+++ b/packer/provision/basebuild.sh
@@ -146,7 +146,7 @@
         grpcio-tools \
         httpie==1.0.3 \
         isort \
-        linkchecker \
+        git+https://github.com/linkchecker/linkchecker.git@v9.4.0 \
         more-itertools==5.0.0 \
         mock \
         netaddr \