Merge "[VOL-2585] Variable refrences fixed - awk"
diff --git a/jjb/pipeline/voltha-scale-measurements.groovy b/jjb/pipeline/voltha-scale-measurements.groovy
index d7aad03..02a4f8d 100644
--- a/jjb/pipeline/voltha-scale-measurements.groovy
+++ b/jjb/pipeline/voltha-scale-measurements.groovy
@@ -10,11 +10,12 @@
     PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
     TYPE="minimal"
     FANCY=0
+    SECONDS=0
     WITH_SIM_ADAPTERS="n"
     WITH_RADIUS="y"
     WITH_BBSIM="y"
     DEPLOY_K8S="y"
-    VOLTHA_LOG_LEVEL="DEBUG"
+    VOLTHA_LOG_LEVEL="WARN"
     CONFIG_SADIS="n"
     ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False"
     SSHPASS="karaf"
@@ -51,7 +52,7 @@
         sh '''
           cd kind-voltha
 
-          EXTRA_HELM_FLAGS="--set onu=${onuCount},pon=${ponCount}" ./voltha up
+          EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay}" ./voltha up
 
           '''
       }
@@ -59,9 +60,9 @@
     stage('MIB-template') {
       steps {
         sh '''
-          if [ "$withMibTemplate" = true ] ; then
+          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
+            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
         '''
@@ -71,7 +72,7 @@
       steps {
          sh '''
           #Check withOnosApps and disable apps accordingly
-          if [ "$withOnosApps" = false ] ; then
+          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
@@ -79,10 +80,25 @@
          '''
       }
     }
+    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 "$onuTarget" ]
+          if [ -z ${expectedOnus} ]
           then
             echo -e "You need to set the target ONU number\n"
             exit 1
@@ -90,19 +106,16 @@
 
           voltctl device create -t openolt -H bbsim:50060
           voltctl device enable $(voltctl device list --filter Type~openolt -q)
-          SECONDS=0
 
           # check ONUs reached Active State in VOLTHA
           i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
-          until [ $i -eq $onuTarget ]
+          until [ $i -eq ${expectedOnus} ]
           do
-            echo "$i ONUs ACTIVE of $onuTarget expected (time: $SECONDS)"
-            sleep $pollInterval
+            echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
+            sleep ${pollInterval}
             i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
           done
-          echo "$onuTarget ONUs Activated in $SECONDS seconds (time: $SECONDS)"
-          #exit 0
-
+          echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
         '''
       }
     }
@@ -111,13 +124,13 @@
         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 "$onuTarget" ]
+          until [ $z -eq ${expectedOnus} ]
           do
-            echo "${z} enabled ports of "$onuTarget" expected (time: $SECONDS)"
-            sleep $pollInterval
+            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 "$onuTarget ports enabled in $SECONDS seconds (time: $SECONDS)"
+          echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
         '''
       }
     }
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index db8bc45..67edb38 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -39,23 +39,23 @@
           description: 'Name of the Jenkins node to run the job on'
 
       - string:
-          name: onuCount
+          name: onuPerPon
           default: 1
           description: 'Number of ONUs to provision'
 
       - string:
-          name: ponCount
+          name: ponPorts
           default: 1
           description: 'Number of PONs to provision'
 
       - string:
-          name: onuTarget
+          name: expectedOnus
           default: 1
           description: 'Expected number of activated ONUs'
 
       - string:
           name: pollInterval
-          default: 20
+          default: 5
           description: 'Sleep time between ONU activation checks'
       
       - bool:
@@ -67,7 +67,26 @@
           name: withMibTemplate
           default: false
           description: 'Option to trigger MIB template command'
-    
+
+      - bool:
+          name: setLinkDiscovery
+          default: false
+          description: 'Option to toggle Link Discovery'
+
+      - string:
+          name: BBSIMdelay
+          default: 200
+          description: 'BBSIM Delay, milliseconds'
+
+      - string:
+          name: flowStatInterval
+          default: 600
+          description: 'Flow Stats Collection Interval, milliseconds'
+
+      - string:
+          name: portsStatInterval
+          default: 600
+          description: 'Ports Stats Collection Interval, milliseconds'
 
     project-type: pipeline
     concurrent: true