Merge "[VOL-3918] Updating ONOS apps release pipeline with API change support"
diff --git a/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy b/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
index e3d0710..4536656 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-multi-stack.groovy
@@ -22,6 +22,14 @@
       remote: 'https://gerrit.opencord.org/ci-management.git'
 ])
 
+def ofAgentConnections(numOfOnos, releaseName, namespace) {
+    def params = " "
+    numOfOnos.times {
+        params += "--set voltha.services.controller[${it}].address=${releaseName}-onos-classic-${it}.${releaseName}-onos-classic-hs.${namespace}.svc:6653 "
+    }
+    return params
+}
+
 pipeline {
 
   /* no label, executor is determined by JJB */
@@ -140,11 +148,11 @@
           sh returnStdout: false, script: """
 
           # forward ETCD port
-          _TAG=etcd-port-forward kubectl -n infra port-forward --address 0.0.0.0 service/etcd 9999:2379& 2>&1 > /dev/null
+          JENKINS_NODE_COOKIE="dontKillMe" _TAG=etcd-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/etcd 9999:2379; done 2>&1 " &
 
           # forward ONOS ports
-          _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8101:8101& 2>&1 > /dev/null
-          _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8181:8181& 2>&1 > /dev/null
+          JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8101:8101; done 2>&1 " &
+          JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8181:8181; done 2>&1 " &
 
           # make sure the the port-forward has started before moving forward
           sleep 5
@@ -157,8 +165,9 @@
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${withLLDP}
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager allowExtraneousRules true
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager importExtraneousRules true
-          sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 1000
+          sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 900
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxIdleMillis 500
+          sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.opencord.olt.impl.Olt provisionDelay 1000
 
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject
           sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord
@@ -367,13 +376,9 @@
       // ${logLevel}
       def extraHelmFlags = "${extraHelmFlags} --set global.log_level=${logLevel},enablePerf=true,onu=${onus},pon=${pons} "
       extraHelmFlags += " --set securityContext.enabled=false,atomix.persistence.enabled=false "
-      // FIXME having to set all of these values is annoying, is there a better solution?
-      def controllerFlags = " "
-      onosReplicas.toInteger().times {
-        controllerFlags += " --set services.controller[${it}].address=onos-onos-classic-${it}.onos-onos-classic-hs.infra.svc:6653"
-      }
 
-      def volthaHelmFlags = "${controllerFlags} " + extraHelmFlags +
+      // FIXME having to set all of these values is annoying, is there a better solution?
+      def volthaHelmFlags = extraHelmFlags +
         "--set voltha.services.kafka.adapter.address=kafka.infra.svc:9092 " +
         "--set voltha.services.kafka.cluster.address=kafka.infra.svc:9092 " +
         "--set voltha.services.etcd.address=etcd.infra.svc:2379 " +
@@ -382,7 +387,9 @@
         "--set voltha-adapter-openolt.services.etcd.address=etcd.infra.svc:2379 " +
         "--set voltha-adapter-openonu.services.kafka.adapter.address=kafka.infra.svc:9092 " +
         "--set voltha-adapter-openonu.services.kafka.cluster.address=kafka.infra.svc:9092 " +
-        "--set voltha-adapter-openonu.services.etcd.address=etcd.infra.svc:2379"
+        "--set voltha-adapter-openonu.services.etcd.address=etcd.infra.svc:2379" +
+        ofAgentConnections(onosReplicas.toInteger(), "voltha-infra", "infra")
+
       volthaStackDeploy([
         bbsimReplica: olts.toInteger(),
         infraNamespace: "infra",
diff --git a/jjb/pipeline/voltha/master/voltha-scale-test.groovy b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
index e901649..8e8443e 100644
--- a/jjb/pipeline/voltha/master/voltha-scale-test.groovy
+++ b/jjb/pipeline/voltha/master/voltha-scale-test.groovy
@@ -14,6 +14,16 @@
 
 // deploy VOLTHA and performs a scale test
 
+// this function generates the correct parameters for ofAgent
+// to connect to multple ONOS instances
+def ofAgentConnections(numOfOnos, releaseName, namespace) {
+    def params = " "
+    numOfOnos.times {
+        params += "--set voltha.services.controller[${it}].address=${releaseName}-onos-classic-${it}.${releaseName}-onos-classic-hs.${namespace}.svc:6653 "
+    }
+    return params
+}
+
 pipeline {
 
   /* no label, executor is determined by JJB */
@@ -28,36 +38,12 @@
     KUBECONFIG="$HOME/.kube/config"
     VOLTCONFIG="$HOME/.volt/config"
     SSHPASS="karaf"
-    // PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-    // SCHEDULE_ON_CONTROL_NODES="yes"
-    // FANCY=0
-    // WITH_SIM_ADAPTERS="no"
-    // WITH_RADIUS="${withRadius}"
-    // WITH_BBSIM="yes"
-    // LEGACY_BBSIM_INDEX="no"
-    // DEPLOY_K8S="no"
-    // CONFIG_SADIS="external"
-    // WITH_KAFKA="kafka.default.svc.cluster.local"
-    // WITH_ETCD="etcd.default.svc.cluster.local"
-    // VOLTHA_ETCD_PORT=9999
-
-    // configurable options
-    // WITH_EAPOL="${withEapol}"
-    // WITH_DHCP="${withDhcp}"
-    // WITH_IGMP="${withIgmp}"
     VOLTHA_LOG_LEVEL="${logLevel}"
     NUM_OF_BBSIM="${olts}"
     NUM_OF_OPENONU="${openonuAdapterReplicas}"
     NUM_OF_ONOS="${onosReplicas}"
     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}"
-    // VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}"
-    // ONOS_CLASSIC_CHART="${onosChart}"
-    // RADIUS_CHART="${radiusChart}"
 
     APPS_TO_LOG="etcd kafka onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server onos-config-loader"
     LOG_FOLDER="$WORKSPACE/logs"
@@ -296,6 +282,7 @@
                 --set global.voltha_infra_name=voltha-infra \
                 --set global.voltha_infra_namespace=default \
                 --set global.log_level=${logLevel} \
+                ${ofAgentConnections(onosReplicas.toInteger(), "voltha-infra", "default")} \
                 --set voltha.services.kafka.adapter.address=kafka.default.svc:9092 \
                 --set voltha.services.kafka.cluster.address=kafka.default.svc:9092 \
                 --set voltha.services.etcd.address=etcd.default.svc:2379 \
@@ -371,10 +358,10 @@
           sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set ${logLevel} org.onosproject
           sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set ${logLevel} org.opencord
 
-          sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.cordmcast
-          sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.onosproject.mcast
-          sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.igmpproxy
-          sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.olt
+          # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.cordmcast
+          # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.onosproject.mcast
+          # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.igmpproxy
+          # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.olt
 
           kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
 
diff --git a/jjb/voltha-scale.yaml b/jjb/voltha-scale.yaml
index 9d90ec2..1a7d53e 100644
--- a/jjb/voltha-scale.yaml
+++ b/jjb/voltha-scale.yaml
@@ -9,84 +9,6 @@
     jobs:
       # name format is <job-template>-<olts>-<pon>-<onus>-<setup>
 
-      # OpenONU PY Scale
-      - 'voltha-scale-measurements':
-          name: 'voltha-openonu-py-scale-measurements-2.6-2-16-32-dt-subscribers'
-          pipeline-script: 'voltha-scale-test-2.6.groovy'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 2
-          pons: 16
-          onus: 32
-          withFlows: true
-          provisionSubscribers: true
-          workflow: dt
-          release: voltha-2.6
-          withEapol: false
-          withDhcp: false
-          withIgmp: false
-          openonuAdapterReplicas: 8
-          extraHelmFlags: '--set use_openonu_adapter_go=false'
-          bbsimImg: ''
-          rwCoreImg: ''
-          ofAgentImg: ''
-          openoltAdapterImg: ''
-          openonuAdapterImg: ''
-          openonuAdapterGoImg: ''
-          onosImg: ''
-
-      - 'voltha-scale-measurements':
-          name: 'voltha-openonu-py-scale-measurements-2.6-2-16-32-att-subscribers'
-          pipeline-script: 'voltha-scale-test-2.6.groovy'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 2
-          pons: 16
-          onus: 32
-          withFlows: true
-          provisionSubscribers: true
-          release: voltha-2.6
-          withEapol: true
-          withDhcp: true
-          withIgmp: false
-          openonuAdapterReplicas: 8
-          extraHelmFlags: '--set use_openonu_adapter_go=false,authRetry=true,dhcpRetry=true'
-          bbsimImg: ''
-          rwCoreImg: ''
-          ofAgentImg: ''
-          openoltAdapterImg: ''
-          openonuAdapterImg: ''
-          openonuAdapterGoImg: ''
-          onosImg: ''
-
-      - 'voltha-scale-measurements':
-          name: 'voltha-openonu-py-scale-measurements-2.6-2-16-32-tt-subscribers'
-          pipeline-script: 'voltha-scale-test-2.6.groovy'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 2
-          pons: 16
-          onus: 32
-          withFlows: true
-          workflow: tt
-          provisionSubscribers: true
-          release: voltha-2.6
-          withEapol: false
-          withDhcp: true
-          withIgmp: false
-          openonuAdapterReplicas: 8
-          extraHelmFlags: '--set use_openonu_adapter_go=false,dhcpRetry=true,defaults.incremental_evto_update=true'
-          bbsimImg: ''
-          rwCoreImg: ''
-          ofAgentImg: ''
-          openoltAdapterImg: ''
-          openonuAdapterImg: ''
-          openonuAdapterGoImg: ''
-          onosImg: ''
-
       # this job will be used to test custom images without disrupting tests on master
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-experimental'
@@ -126,55 +48,6 @@
           withDhcp: false
           withIgmp: false
 
-
-      # jobs for 512 ONUs with a 8 openonu-adapters and clustered ONOS (1 OLT)
-      - 'voltha-scale-measurements':
-          name: 'voltha-scale-measurements-master-1-16-32-att-subscribers'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 1
-          pons: 16
-          onus: 32
-          withFlows: true
-          provisionSubscribers: true
-          withEapol: true
-          withDhcp: true
-          withIgmp: false
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
-
-      - 'voltha-scale-measurements':
-          name: 'voltha-scale-measurements-master-1-16-32-tt-subscribers'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 1
-          pons: 16
-          onus: 32
-          withFlows: true
-          provisionSubscribers: true
-          workflow: tt
-          withEapol: false
-          withDhcp: true
-          withIgmp: true
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
-
-      - 'voltha-scale-measurements':
-          name: 'voltha-scale-measurements-master-1-16-32-dt-subscribers'
-          'disable-job': true
-          build-node: 'voltha-scale-1'
-          time-trigger: "H H/4 * * *"
-          olts: 1
-          pons: 16
-          onus: 32
-          withFlows: true
-          provisionSubscribers: true
-          workflow: dt
-          withEapol: false
-          withDhcp: false
-          withIgmp: false
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
-
       # jobs for 1024 ONUs with openonu-go and clustered ONOS (2 OLTs)
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-2-16-32-att-subscribers'
@@ -190,13 +63,13 @@
           withDhcp: true
           withIgmp: false
           extraHelmFlags: '--set authRetry=true,dhcpRetry=true --set global.log_correlation.enabled=true -f /home/jenkins/voltha-scale/voltha-values.yaml'
-          # onosImg: registry.menlo.onlab.us/voltha-dev/voltha-onos:default-tp
+          # onosImg: registry.menlo.onlab.us/voltha-dev/voltha-onos:teo-olt
           # volthaHelmChartsChange: refs/changes/29/23729/3
           openoltAdapterImg: gcgirish/voltha-openolt-adapter:meter
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-2-16-32-dt-subscribers'
-          'disable-job': true
+          'disable-job': false
           build-node: 'voltha-scale-1'
           time-trigger: "H H/4 * * *"
           olts: 2
@@ -208,12 +81,12 @@
           withEapol: false
           withDhcp: false
           withIgmp: false
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
+          extraHelmFlags: '--set authRetry=true,dhcpRetry=true --set global.log_correlation.enabled=true -f /home/jenkins/voltha-scale/voltha-values.yaml '
 #          onosImg: andreacampanella/voltha-onos:olt-mac-integration
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-2-16-32-tt-subscribers'
-          'disable-job': true
+          'disable-job': false
           build-node: 'voltha-scale-1'
           time-trigger: "H H/4 * * *"
           olts: 2
@@ -227,7 +100,7 @@
           withIgmp: true
           onosReplicas: 3
           atomixReplicas: 3
-          extraHelmFlags: '--set authRetry=true,dhcpRetry=true'
+          extraHelmFlags: '--set authRetry=true,dhcpRetry=true --set global.log_correlation.enabled=true -f /home/jenkins/voltha-scale/voltha-values.yaml '
           onosImg: andreacampanella/voltha-onos:olt-group-pkt-req-mcast-fix
 
       # multi-stack jobs
@@ -249,7 +122,7 @@
           withEapol: true
           withDhcp: true
           withIgmp: false
-          #onosImg: andreacampanella/voltha-onos:olt-mac-integration
+          extraHelmFlags: "-f /home/jenkins/voltha-scale/voltha-values.yaml "
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-dt-subscribers'
@@ -269,7 +142,7 @@
           withEapol: false
           withDhcp: false
           withIgmp: false
-          #onosImg: andreacampanella/voltha-onos:olt-mac-integration
+          extraHelmFlags: "-f /home/jenkins/voltha-scale/voltha-values.yaml "
 
       - 'voltha-scale-measurements':
           name: 'voltha-scale-measurements-master-10-stacks-2-16-32-tt-subscribers'
@@ -289,7 +162,7 @@
           withEapol: false
           withDhcp: true
           withIgmp: true
-          onosImg: andreacampanella/voltha-onos:olt-group-pkt-req-mcast-fix
+          extraHelmFlags: "-f /home/jenkins/voltha-scale/voltha-values.yaml "
 
       # voltha-2.6 Jobs
       - 'voltha-scale-measurements':