[VOL-1385] Remove parent's device flows after child deletion
This commit fixes the following:
1) Do not automatically raise an error when no routes can be
found when decomposing a flow. In some cases flows can still
be decomposed (e.g. some trap flows).
2) Delete flows from a parent device when receiving delete flow
instructions from the OF controller after a child device has
been deleted (previously was failing as no route could be
obtained).
Change-Id: I33dd45d52626146f0a6b4668048c979b5c931f9c
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 48edc5b..cd73f35 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -764,6 +764,18 @@
return status.Errorf(codes.NotFound, "%s", deviceID)
}
+// deleteParentFlows removes flows from the parent device based on specific attributes
+func (dMgr *Manager) deleteParentFlows(ctx context.Context, deviceID string, uniPort uint32, metadata *voltha.FlowMetadata) error {
+ logger.Debugw("deleteParentFlows", log.Fields{"device-id": deviceID, "uni-port": uniPort, "metadata": metadata})
+ if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {
+ if !agent.isRootdevice {
+ return status.Errorf(codes.FailedPrecondition, "not-a-parent-device-%s", deviceID)
+ }
+ return agent.filterOutFlows(ctx, uniPort, metadata)
+ }
+ return status.Errorf(codes.NotFound, "%s", deviceID)
+}
+
func (dMgr *Manager) deleteFlowsAndGroups(ctx context.Context, deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
logger.Debugw("deleteFlowsAndGroups", log.Fields{"deviceid": deviceID})
if agent := dMgr.getDeviceAgent(ctx, deviceID); agent != nil {