Merge "[VOL-3254] Adding support for tcpdump in ofagent and set custom images"
diff --git a/jjb/pipeline/voltha-scale-test.groovy b/jjb/pipeline/voltha-scale-test.groovy
index ffcb706..cc9c924 100644
--- a/jjb/pipeline/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha-scale-test.groovy
@@ -168,10 +168,12 @@
     stage('Deploy Voltha') {
       steps {
         script {
-          // TODO install etcd outside kind-voltha (no need to redeploy the operator everytime)
           sh returnStdout: false, script: """
             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 '
+
             # BBSim custom image handling
             IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
             EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
@@ -259,6 +261,15 @@
 
           # Set extra logs on olt app in onos
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.olt
+
+          # Start the tcp-dump in ofagent
+          if [ ${withPcap} = true ] ; then
+            export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}')
+            kubectl exec $OF_AGENT -- apk update
+            kubectl exec $OF_AGENT -- apk add tcpdump
+            kubectl exec $OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
+            _TAG=ofagent-tcpdump kubectl exec $OF_AGENT -- tcpdump -nei eth0 -w out.pcap&
+          fi
         '''
       }
     }
@@ -349,6 +360,19 @@
       // collect result, done in the "post" step so it's executed even in the
       // event of a timeout in the tests
       sh '''
+
+        if [ ${withPcap} = true ] ; then
+          # stop ofAgent tcpdump
+          P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')"
+          if [ -n "\$P_ID" ]; then
+            kill -9 \$P_ID
+          fi
+
+          # copy the file
+          export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}')
+          kubectl cp $OF_AGENT:out.pcap $WORKSPACE/logs/ofagent.pcap
+        fi
+
         cd voltha-system-tests
         source ./vst_venv/bin/activate
         python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 6207bad..48bb57d 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -111,10 +111,9 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi '
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
+          openonuAdapterImg: gcgirish/voltha-openonu-adapter:VOL3202
+          openoltAdapterImg: gcgirish/voltha-openolt-adapter:VOL3202
+          rwCoreImg: volthacore/voltha-rw-core:khen_pcap
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-1-16-32-att-flows'
@@ -132,10 +131,9 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set auth=false --set limits.memory=8192Mi '
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
+          openonuAdapterImg: gcgirish/voltha-openonu-adapter:VOL3202
+          openoltAdapterImg: gcgirish/voltha-openolt-adapter:VOL3202
+          rwCoreImg: volthacore/voltha-rw-core:khen_pcap
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-1-16-32-att-subscribers'
@@ -153,7 +151,7 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi --set defaults.rw_core.timeout=30s'
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
+          withPcap: true
           rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
           ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
           onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
@@ -176,10 +174,9 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi '
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
+          openonuAdapterImg: gcgirish/voltha-openonu-adapter:VOL3202
+          openoltAdapterImg: gcgirish/voltha-openolt-adapter:VOL3202
+          rwCoreImg: volthacore/voltha-rw-core:khen_pcap
 
       # jobs for 1024 ONUs with a 8 openonu-adapters and clustered ONOS (2 OLTs)
       - 'voltha-scale-measurements':
@@ -199,10 +196,6 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi '
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
 
       - 'voltha-scale-measurements':
           disabled: true
@@ -221,10 +214,9 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi --set auth=false '
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
+          openonuAdapterImg: gcgirish/voltha-openonu-adapter:VOL3202
+          openoltAdapterImg: gcgirish/voltha-openolt-adapter:VOL3202
+          rwCoreImg: volthacore/voltha-rw-core:khen_pcap
 
       - 'voltha-scale-measurements':
           disabled: true
@@ -266,10 +258,6 @@
           onosReplicas: 3
           atomixReplicas: 3
           extraHelmFlags: '--set limits.memory=8192Mi --set defaults.rw_core.timeout=30s'
-          openonuAdapterImg: matteoscandolo/voltha-openonu-adapter:adopt-retry
-          rwCoreImg: matteoscandolo/voltha-rw-core:flow-remove-log
-          ofAgentImg: matteoscandolo/voltha-ofagent-go:flow-remove-log
-          onosImg: andreacampanella/voltha-onos:onos-extended-timeouts
 
       # development pipeline
       - 'voltha-scale-measurements-dev':
@@ -324,6 +312,7 @@
     withMibTemplate: true
     withMonitoring: true
     withProfiling: false
+    withPcap: false
     openonuAdapterReplicas: 1
     onosReplicas: 1
     atomixReplicas: 0
@@ -408,6 +397,11 @@
           default: '{withProfiling}'
           description: 'Option to collect profiling informations from rw-core and openolt (note that the appropriate -profile images needs to be used)'
 
+      - bool:
+          name: withPcap
+          default: '{withPcap}'
+          description: 'Capture a .pcap on the OpenFlow connection from the ofAgent side'
+
       - string:
           name: extraHelmFlags
           default: '{extraHelmFlags}'