[VOL-4814] Adding Rest interfaces for flow and subscribers
Change-Id: I7da50b14e7600884a8b38c37b63704241942d8af
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index e11960c..85de6dc 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -513,7 +513,7 @@
vpv.printAssociatedVPVs(false)
}
- logger.Infow(ctx, "Associating VPV and Device", log.Fields{"Device": vpv.Device, "Port": vpv.Port, "SVlan": vpv.SVlan})
+ logger.Infow(ctx, "Associating VPV and Device", log.Fields{"Device": device, "Port": vpv.Port, "SVlan": vpv.SVlan})
vpv.Device = device
GetApplication().AssociateVpvsToDevice(device, vpv)
@@ -1036,7 +1036,10 @@
//TODO-COMM: vpv.FlowInstallFailure("VGC processing failure", statusCode, statusMessage)
return
}
-
+ if !svc.IsActivated {
+ logger.Warn(ctx, "Not pushing Service Flows: Service Not activated")
+ return
+ }
//Push Service Flows if DHCP relay is not configured
//or already DHCP flows are configured for the VPV
//to which the serivce is associated
@@ -2244,6 +2247,17 @@
// Add the service that is causing the VNET to be added to the port
vpv.AddSvc(cntx, vs)
+ if !vs.IsActivated {
+ logger.Warn(ctx, "Not Checking port state: Service Not activated")
+ // Process the PORT UP if the port is already up
+ d, err := va.GetDeviceFromPort(port)
+ if err == nil {
+ vpv.setDevice(d.Name)
+ }
+ vpv.WriteToDb(cntx)
+ return vpv
+ }
+
// Process the PORT UP if the port is already up
d, err := va.GetDeviceFromPort(port)
if err == nil {
@@ -3206,3 +3220,17 @@
DhcpPbit: vpv.DhcpPbit,
})
}
+
+func (vpv *VoltPortVnet) IsServiceActivated(cntx context.Context) bool {
+ isActivated := false
+ vpv.services.Range(func(key, value interface{}) bool {
+ svc := value.(*VoltService)
+ if svc.IsActivated {
+ logger.Infow(ctx, "Found activated service on the vpv", log.Fields{"Name": svc.Name})
+ isActivated = true
+ return false //to exit loop
+ }
+ return true
+ })
+ return isActivated
+}