[VOL-3780] Using different S-Tags in multiple BBSim deployments

Change-Id: I9a3ad351ce6c324625c0cabc26266afba3c15e91
diff --git a/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy b/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy
index 0001fac..eeca95a 100644
--- a/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy
+++ b/jjb/pipeline/voltha/master/openonu-go-periodic-test-bbsim.groovy
@@ -51,7 +51,7 @@
         }
 
         // NOTE temporary workaround expose ONOS node ports
-        def localHelmFlags = extraHelmFlags + " --set onos-classic.onosSshPort=30115 " +
+        def localHelmFlags = extraHelmFlags + " --set global.log_level=DEBUG --set onos-classic.onosSshPort=30115 " +
         " --set onos-classic.onosApiPort=30120 " +
         " --set onos-classic.onosOfPort=31653 " +
         " --set onos-classic.individualOpenFlowNodePorts=true " + testSpecificHelmFlags
diff --git a/vars/volthaStackDeploy.groovy b/vars/volthaStackDeploy.groovy
index b39c84f..b7e43fc 100644
--- a/vars/volthaStackDeploy.groovy
+++ b/vars/volthaStackDeploy.groovy
@@ -41,13 +41,32 @@
     """
 
     for(int i = 0;i<cfg.bbsimReplica;i++) {
-      // TODO differentiate olt_id between different stacks
-       sh """
-         helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} bbsim${i} onf/bbsim \
-         --set olt_id="${cfg.stackId}${i}" \
-         -f $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml \
-         ${cfg.extraHelmFlags}
-       """
+      // NOTE we don't need to update the tag for DT
+      script {
+        sh """
+        rm -f $WORKSPACE/bbsimCfg${cfg.stackId}${i}.yaml
+        """
+        if (cfg.workflow == "att" || cfg.workflow == "tt") {
+          def startingStag = 900
+          def bbsimCfg = readYaml file: "$WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml"
+          // NOTE we assume that the only service that needs a different s_tag is the first one in the list
+          bbsimCfg["servicesConfig"]["services"][0]["s_tag"] = startingStag + i
+          println "Using BBSim Service config ${bbsimCfg}"
+          writeYaml file: "$WORKSPACE/bbsimCfg${cfg.stackId}${i}.yaml", data: bbsimCfg
+        } else {
+          // NOTE if it's DT just copy the file over
+          sh """
+          cp $WORKSPACE/voltha-helm-charts/examples/${cfg.workflow}-values.yaml $WORKSPACE/bbsimCfg${cfg.stackId}${i}.yaml
+          """
+        }
+      }
+
+      sh """
+        helm upgrade --install --create-namespace -n ${cfg.volthaNamespace} bbsim${i} onf/bbsim \
+        --set olt_id="${cfg.stackId}${i}" \
+        -f $WORKSPACE/bbsimCfg${cfg.stackId}${i}.yaml \
+        ${cfg.extraHelmFlags}
+      """
     }
 
     println "Wait for VOLTHA Stack ${cfg.stackName} to start"