Merge "Alternating karaf versions between 2.4 and master"
diff --git a/jjb/pipeline/voltha-scale-test.groovy b/jjb/pipeline/voltha-scale-test.groovy
index 42276a4..dd19425 100644
--- a/jjb/pipeline/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha-scale-test.groovy
@@ -58,7 +58,6 @@
     NUM_OF_ATOMIX="${atomixReplicas}"
     WITH_PPROF="${withProfiling}"
     EXTRA_HELM_FLAGS="${extraHelmFlags} " // note that the trailing space is required to separate the parameters from appends done later
-
     VOLTHA_CHART="${volthaChart}"
     VOLTHA_BBSIM_CHART="${bbsimChart}"
     VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}"
@@ -174,10 +173,7 @@
 
             cd $WORKSPACE/kind-voltha/
 
-            export EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
-
-            # disable the securityContext, this is a development cluster
-            EXTRA_HELM_FLAGS+='--set securityContext.enabled=false '
+            export EXTRA_HELM_FLAGS+=' '
 
             if [ '${release}' == 'master' ]; then
               # BBSim custom image handling
@@ -204,6 +200,12 @@
               source $WORKSPACE/kind-voltha/releases/${release}
             fi
 
+            # set BBSim parameters
+            EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
+
+            # disable the securityContext, this is a development cluster
+            EXTRA_HELM_FLAGS+='--set securityContext.enabled=false '
+
             # No persistent-volume-claims in Atomix
             EXTRA_HELM_FLAGS+="--set atomix.persistence.enabled=false "
 
@@ -374,8 +376,6 @@
         source ./vst_venv/bin/activate
         python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
         cat $WORKSPACE/execution-time.txt
-
-        python tests/scale/sizing.py -o $WORKSPACE/plots
       '''
       sh '''
         if [ ${withProfiling} = true ] ; then
@@ -440,7 +440,7 @@
         # TODO remove hardcoded karaf version
         printf '%s\n' $(kubectl get pods -l app=onos-onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I@ bash -c "kubectl cp @:${karafHome}/data/log/karaf.log $LOG_FOLDER/@.log"
       '''
-      // dump all the BBSim(s) ONU informations
+      // dump all the BBSim(s) ONU information
       sh '''
       BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
       IDS=($BBSIM_IDS)
@@ -472,10 +472,6 @@
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 dhcpl2relay-allocations > $WORKSPACE/logs/onos-dhcp-allocations.txt
         fi
       '''
-      // get cpu usage by container
-      sh '''
-        curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=avg(rate(container_cpu_usage_seconds_total[10m])*100) by (pod_name)' | jq . > $WORKSPACE/cpu-usage.json
-      '''
       // collect etcd metrics
       sh '''
         mkdir $WORKSPACE/etcd-metrics
@@ -493,11 +489,11 @@
           rm $WORKSPACE/logs/device-list.json
           voltctl device list > $WORKSPACE/logs/voltha-devices-list.txt
 
-          printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device flows @ > $WORKSPACE/logs/voltha-device-flows-@.txt"
-          printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' @ > $WORKSPACE/logs/voltha-device-ports-@.txt"
+          printf '%s\n' $(voltctl -m 8MB device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl -m 8MB device flows @ > $WORKSPACE/logs/voltha-device-flows-@.txt"
+          printf '%s\n' $(voltctl -m 8MB device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl -m 8MB device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' @ > $WORKSPACE/logs/voltha-device-ports-@.txt"
 
-          printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice flows @ > $WORKSPACE/logs/voltha-logicaldevice-flows-@.txt"
-          printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice port list @ > $WORKSPACE/logs/voltha-logicaldevice-ports-@.txt"
+          printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs -I@ bash -c "voltctl -m 8MB logicaldevice flows @ > $WORKSPACE/logs/voltha-logicaldevice-flows-@.txt"
+          printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs -I@ bash -c "voltctl -m 8MB logicaldevice port list @ > $WORKSPACE/logs/voltha-logicaldevice-ports-@.txt"
           '''
         } catch(e) {
           sh '''
@@ -505,6 +501,13 @@
           '''
         }
       }
+      // get cpu usage by container
+      sh '''
+      cd $WORKSPACE/voltha-system-tests
+      source ./vst_venv/bin/activate
+      sleep 60 # we have to wait for prometheus to collect all the information
+      python tests/scale/sizing.py -o $WORKSPACE/plots
+      '''
       archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*.txt,plots/*.pdf,etcd-metrics/*'
     }
   }
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 7eaa258..56d9c44 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -430,7 +430,7 @@
       - string:
           name: extraHelmFlags
           default: '{extraHelmFlags}'
-          description: 'Any extra helm parameters you want (passed to every helm install command)'
+          description: 'Any extra helm parameters you want (passed to every helm install command, not available if release != master)'
 
       - string:
           name: openonuAdapterReplicas