fixes for vgc add device config and IsNniPort func

Change-Id: Id7002792a5a811ebaca630bde5dadadc10dff048
diff --git a/internal/pkg/application/application.go b/internal/pkg/application/application.go
index 730be6c..73a88a9 100644
--- a/internal/pkg/application/application.go
+++ b/internal/pkg/application/application.go
@@ -237,7 +237,7 @@
 	d.GlobalDhcpFlowAdded = false
 	if config, ok := GetApplication().DevicesConfig.Load(slno); ok {
 		//Update nni dhcp vid
-		deviceConfig := config.(DeviceConfig)
+		deviceConfig := config.(*DeviceConfig)
 		d.NniDhcpTrapVid = of.VlanType(deviceConfig.NniDhcpTrapVid)
 	}
 	return &d
@@ -455,7 +455,7 @@
 	SerialNumber       string `json:"id"`
 	HardwareIdentifier string `json:"hardwareIdentifier"`
 	IPAddress          string `json:"ipAddress"`
-	UplinkPort         int    `json:"uplinkPort"`
+	UplinkPort         string `json:"uplinkPort"`
 	NasID              string `json:"nasId"`
 	NniDhcpTrapVid     int    `json:"nniDhcpTrapVid"`
 }
@@ -573,7 +573,7 @@
 	return nil
 }
 
-func (va *VoltApplication) AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress string, uplinkPort, nniDhcpTrapId int) error {
+func (va *VoltApplication) AddDeviceConfig(cntx context.Context, serialNum, hardwareIdentifier, nasID, ipAddress, uplinkPort string, nniDhcpTrapId int) error {
 	var dc *DeviceConfig
 
 	deviceConfig := &DeviceConfig{
@@ -832,7 +832,7 @@
 // protection mechanism (LAG, ERPS, etc.). The aggregate of the such protection
 // is represented by a single NNI port
 func (va *VoltApplication) AddDevice(cntx context.Context, device string, slno, southBoundID string) {
-	logger.Warnw(ctx, "Received Device Ind: Add", log.Fields{"Device": device, "SrNo": slno})
+	logger.Warnw(ctx, "Received Device Ind: Add", log.Fields{"Device": device, "SrNo": slno, "southBoundID": southBoundID})
 	if _, ok := va.DevicesDisc.Load(device); ok {
 		logger.Warnw(ctx, "Device Exists", log.Fields{"Device": device})
 	}
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index a95104c..548879f 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -510,16 +510,6 @@
 	vpv.IgmpEnabled = false
 	vpv.MacAddr, _ = net.ParseMAC("00:00:00:00:00:00")
 	vpv.LearntMacAddr, _ = net.ParseMAC("00:00:00:00:00:00")
-	// for OLTCVLAN SVLAN=CVLAN, UNIVLAN can differ.
-	/*
-	if vpv.VlanControl == ONUCVlan {
-		vpv.CVlan = vpv.SVlan
-	}
-	// for OLTSVLAN  CVLAN=UNIVLAN , SVLAN can differ,
-	// hence assigning UNIVLAN to CVLAN, so that ONU will transparently forward the packet.
-	if vpv.VlanControl == OLTSVlan {
-		vpv.CVlan = vpv.UniVlan
-	}*/
 	vpv.servicesCount = atomic.NewUint64(0)
 	vpv.SchedID = 0
 	vpv.PendingDeleteFlow = make(map[string]bool)
@@ -781,20 +771,13 @@
 		//If NNI port is not mached to nb nni port dont send flows
 		devConfig := GetApplication().GetDeviceConfig(device.SerialNum)
 		if devConfig != nil {
-			if devConfig.UplinkPort != int(nniPort.ID) {
-				logger.Errorw(ctx, "NNI port not configured from NB, not pushing flows", log.Fields{"NNI Port": devConfig.UplinkPort, "NB NNI port": nniPort.ID})
+			if devConfig.UplinkPort != strconv.Itoa(int(nniPort.ID)) {
+				logger.Errorw(ctx, "NNI port not configured from NB, not pushing flows", log.Fields{"NB NNI Port": devConfig.UplinkPort, "SB NNI port": nniPort.ID})
 				return
 			}
 		}
 	}
 
-	if vp := device.GetPort(port); vp != nil {
-		if vpv.PonPort != 0xFF && vpv.PonPort != vp.PonPort {
-			logger.Errorw(ctx, "UNI port discovered on wrong PON Port. Dropping Flow Config for VPV", log.Fields{"Device": device.Name, "Port": port, "DetectedPon": vp.PonPort, "ExpectedPon": vpv.PonPort, "Vnet": vpv.VnetName})
-			return
-		}
-	}
-
 	if vpv.Blocked {
 		logger.Errorw(ctx, "VPV Bocked for Processing. Ignoring flow push request", log.Fields{"Port": vpv.Port, "Vnet": vpv.VnetName})
 		return
@@ -815,13 +798,13 @@
 		if vpv.MacLearning == MacLearningNone || NonZeroMacAddress(vpv.MacAddr) {
 			logger.Infow(ctx, "Port Up - DS Flows", log.Fields{"Device": device.Name, "Port": port})
 			/*In case of DPU_MGMT_TRAFFIC, need to install both US and DS traffic */
-			if  vpv.VnetType == DPU_MGMT_TRAFFIC {
+			if vpv.VnetType == DPU_MGMT_TRAFFIC {
 				vpv.RangeOnServices(cntx, AddUsHsiaFlows)
 			}
 			// US & DS DHCP, US HSIA flows are already installed
 			// install only DS HSIA flow here.
 			// no HSIA flows for multicast service
-			if !vpv.McastService  {
+			if !vpv.McastService {
 				vpv.RangeOnServices(cntx, AddDsHsiaFlows)
 			}
 		}
@@ -1051,17 +1034,6 @@
 	logger.Debugw(ctx, "Added MAC to VPV", log.Fields{"MacLearning": vpv.MacLearning, "VPV": vpv})
 	//Reconfigure Vlans based on Vlan Control type
 	svc.VlanControl = vpv.VlanControl
-	//TODO Is it good to change NB config?? commenting for now
-	/*
-	// for OLTCVLAN SVLAN=CVLAN, UNIVLAN can differ.
-	if vpv.VlanControl == ONUCVlan {
-		svc.CVlan = svc.SVlan
-	}
-	// for OLTSVLAN  CVLAN=UNIVLAN , SVLAN can differ,
-	// hence assigning UNIVLAN to CVLAN, so that ONU will transparently forward the packet.
-	if vpv.VlanControl == OLTSVlan {
-		svc.CVlan = svc.UniVlan
-	}*/
 	if svc.McastService {
 		vpv.McastService = true
 		vpv.McastTechProfileID = svc.TechProfileID
@@ -1099,8 +1071,8 @@
 	//If NNI port is not mached to nb nni port
 	devConfig := GetApplication().GetDeviceConfig(voltDevice.SerialNum)
 
-	if strconv.Itoa(devConfig.UplinkPort) != voltDevice.NniPort {
-		logger.Errorw(ctx, "NNI port mismatch", log.Fields{"NNI Port": devConfig.UplinkPort, "NB NNI port": voltDevice.NniPort})
+	if devConfig.UplinkPort != voltDevice.NniPort {
+		logger.Errorw(ctx, "NNI port mismatch", log.Fields{"NB NNI Port": devConfig.UplinkPort, "SB NNI port": voltDevice.NniPort})
 		return
 	}
 	//Push Service Flows if DHCP relay is not configured
@@ -1234,7 +1206,7 @@
 // AddMeterToDevice to add meter config to device, used in FTTB case
 func AddMeterToDevice(cntx context.Context, key, value interface{}) bool {
 	svc := value.(*VoltService)
-	if err:= svc.AddMeterToDevice(cntx); err != nil {
+	if err := svc.AddMeterToDevice(cntx); err != nil {
 		logger.Warnw(ctx, "Add Meter failed", log.Fields{"service": svc.Name, "Error": err})
 	}
 	return true
@@ -1706,7 +1678,6 @@
 	subFlow := of.NewVoltSubFlow()
 	subFlow.SetTableID(0)
 
-
 	if vpv.VnetType == DPU_MGMT_TRAFFIC {
 		subFlow.SetMatchVlan(vpv.CVlan)
 		subFlow.SetMatchPbit(vpv.UsPonCTagPriority)