VOL-2523: Enhance scale tester app with LLDP flow for DT workflow and test provisioning 512 subscribers

          512 subscriber provisioning tested with DT workflow enabled, results as below
          1) one tm queue map created as for all subs DT use 1T8G techprofile
          2) 1 ACL for LLDP flow created
          3) 4096 HSIA flows added (upstream & Downstream share same flow ID)
          4) 4096 Gemports created (GemID starts from 1024 to 5119)
          5) 512 ALLOC objects created
          6) (8*512 subs) + (4*16 PON) + 4 NNI = 4164 TM Queues created
          7) (1*512 subs) + (1*16 PON) + 1 NNI = 529 TM Scheds created

Change-Id: I7efa0c30f364866cf51e6930c0d3ab7a40fde0a8
diff --git a/VERSION b/VERSION
index 3eefcb9..7dea76e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.0
+1.0.1
diff --git a/core/att_workflow.go b/core/att_workflow.go
index 4417c27..a96bbe1 100644
--- a/core/att_workflow.go
+++ b/core/att_workflow.go
@@ -113,44 +113,6 @@
 	return nil
 }
 
-func AddLldpFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error {
-	var flowID []uint32
-	var err error
-
-	if flowID, err = rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].GetResourceID(uint32(config.NniIntfID),
-		ponresourcemanager.FLOW_ID, 1); err != nil {
-		return err
-	}
-
-	// DHCP IPV4
-	flowClassifier := &oop.Classifier{EthType: 35020, PktTagType: "untagged"}
-	actionCmd := &oop.ActionCmd{TrapToHost: true}
-	actionInfo := &oop.Action{Cmd: actionCmd}
-
-	flow := oop.Flow{AccessIntfId: -1, OnuId: -1, UniId: -1, FlowId: flowID[0],
-		FlowType: "downstream", AllocId: -1, GemportId: -1,
-		Classifier: flowClassifier, Action: actionInfo,
-		Priority: 1000, PortNo: uint32(config.NniIntfID)}
-
-	_, err = oo.FlowAdd(context.Background(), &flow)
-
-	st, _ := status.FromError(err)
-	if st.Code() == codes.AlreadyExists {
-		log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow})
-		return nil
-	}
-
-	if err != nil {
-		log.Errorw("Failed to Add LLDP flow to device", log.Fields{"err": err, "deviceFlow": flow})
-		rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].FreeResourceID(uint32(config.NniIntfID),
-			ponresourcemanager.FLOW_ID, flowID)
-		return err
-	}
-	log.Debugw("LLDP flow added to device successfully ", log.Fields{"flow": flow})
-
-	return nil
-}
-
 func ProvisionAttNniTrapFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error {
 	_ = AddDhcpIPV4Flow(oo, config, rsrMgr)
 	_ = AddDhcpIPV6Flow(oo, config, rsrMgr)
diff --git a/core/dt_workflow.go b/core/dt_workflow.go
index 46608ee..7aa5746 100644
--- a/core/dt_workflow.go
+++ b/core/dt_workflow.go
@@ -19,8 +19,10 @@
 import (
 	"errors"
 
+	"github.com/opencord/openolt-scale-tester/config"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager"
+	oop "github.com/opencord/voltha-protos/v2/go/openolt"
 	tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
 	"golang.org/x/net/context"
 )
@@ -33,6 +35,12 @@
 type DtWorkFlow struct {
 }
 
+func ProvisionDtNniTrapFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error {
+	_ = AddLldpFlow(oo, config, rsrMgr)
+
+	return nil
+}
+
 func (dt DtWorkFlow) ProvisionScheds(subs *Subscriber) error {
 	var trafficSched []*tp_pb.TrafficScheduler
 
diff --git a/core/olt_manager.go b/core/olt_manager.go
index efd1489..6d18b7e 100644
--- a/core/olt_manager.go
+++ b/core/olt_manager.go
@@ -176,10 +176,8 @@
 	go om.readIndications()
 
 	// Provision OLT NNI Trap flows as needed by the Workflow
-	if om.testConfig.WorkflowName != DTWorkFlow {
-		if err = ProvisionNniTrapFlow(om.openOltClient, om.testConfig, om.rsrMgr); err != nil {
-			log.Error("failed-to-add-nni-trap-flow", log.Fields{"err": err})
-		}
+	if err = ProvisionNniTrapFlow(om.openOltClient, om.testConfig, om.rsrMgr); err != nil {
+		log.Error("failed-to-add-nni-trap-flow", log.Fields{"err": err})
 	}
 
 	// Provision ONUs one by one
diff --git a/core/workflow_manager.go b/core/workflow_manager.go
index 7a6860d..8ab8551 100644
--- a/core/workflow_manager.go
+++ b/core/workflow_manager.go
@@ -104,6 +104,11 @@
 			log.Error("error-installing-flow", log.Fields{"err": err})
 			return err
 		}
+	case "DT":
+		if err := ProvisionDtNniTrapFlow(oo, config, rsrMgr); err != nil {
+			log.Error("error-installing-flow", log.Fields{"err": err})
+			return err
+		}
 	// TODO: Add new items here
 	default:
 		log.Errorw("operator-workflow-not-supported-yet", log.Fields{"workflowName": config.WorkflowName})
diff --git a/core/workflow_utils.go b/core/workflow_utils.go
index e078e6d..656b8ec 100644
--- a/core/workflow_utils.go
+++ b/core/workflow_utils.go
@@ -19,7 +19,9 @@
 import (
 	"errors"
 
+	"github.com/opencord/openolt-scale-tester/config"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
+	"github.com/opencord/voltha-lib-go/v2/pkg/ponresourcemanager"
 	oop "github.com/opencord/voltha-protos/v2/go/openolt"
 	tp_pb "github.com/opencord/voltha-protos/v2/go/tech_profile"
 	"golang.org/x/net/context"
@@ -193,3 +195,40 @@
 
 	return nil
 }
+
+func AddLldpFlow(oo oop.OpenoltClient, config *config.OpenOltScaleTesterConfig, rsrMgr *OpenOltResourceMgr) error {
+	var flowID []uint32
+	var err error
+
+	if flowID, err = rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].GetResourceID(uint32(config.NniIntfID),
+		ponresourcemanager.FLOW_ID, 1); err != nil {
+		return err
+	}
+
+	flowClassifier := &oop.Classifier{EthType: 35020, PktTagType: "untagged"}
+	actionCmd := &oop.ActionCmd{TrapToHost: true}
+	actionInfo := &oop.Action{Cmd: actionCmd}
+
+	flow := oop.Flow{AccessIntfId: -1, OnuId: -1, UniId: -1, FlowId: flowID[0],
+		FlowType: "downstream", AllocId: -1, GemportId: -1,
+		Classifier: flowClassifier, Action: actionInfo,
+		Priority: 1000, PortNo: uint32(config.NniIntfID)}
+
+	_, err = oo.FlowAdd(context.Background(), &flow)
+
+	st, _ := status.FromError(err)
+	if st.Code() == codes.AlreadyExists {
+		log.Debugw("Flow already exists", log.Fields{"err": err, "deviceFlow": flow})
+		return nil
+	}
+
+	if err != nil {
+		log.Errorw("Failed to Add LLDP flow to device", log.Fields{"err": err, "deviceFlow": flow})
+		rsrMgr.ResourceMgrs[uint32(config.NniIntfID)].FreeResourceID(uint32(config.NniIntfID),
+			ponresourcemanager.FLOW_ID, flowID)
+		return err
+	}
+	log.Debugw("LLDP flow added to device successfully ", log.Fields{"flow": flow})
+
+	return nil
+}