VOL-3112 Group removal support by Open OLT Adapter
Change-Id: I2a21741faa2631aca5e727f73b42aa04018a2059
diff --git a/internal/pkg/core/openolt_flowmgr.go b/internal/pkg/core/openolt_flowmgr.go
index 28d2065..520ee7a 100644
--- a/internal/pkg/core/openolt_flowmgr.go
+++ b/internal/pkg/core/openolt_flowmgr.go
@@ -2672,6 +2672,32 @@
return nil
}
+// DeleteGroup deletes a group from the device
+func (f *OpenOltFlowMgr) DeleteGroup(ctx context.Context, group *ofp.OfpGroupEntry) error {
+ logger.Debugw(ctx, "delete-group", log.Fields{"group": group})
+ if group == nil {
+ logger.Error(ctx, "unable-to-delete-group--invalid-argument--group-is-nil")
+ return olterrors.NewErrInvalidValue(log.Fields{"group": group}, nil)
+ }
+
+ groupToOlt := openoltpb2.Group{
+ GroupId: group.Desc.GroupId,
+ }
+
+ logger.Debugw(ctx, "deleting-group-from-device", log.Fields{"groupToOlt": groupToOlt})
+ _, err := f.deviceHandler.Client.DeleteGroup(ctx, &groupToOlt)
+ if err != nil {
+ logger.Errorw(ctx, "delete-group-failed-on-dev", log.Fields{"groupToOlt": groupToOlt, "err": err})
+ return olterrors.NewErrAdapter("delete-group-operation-failed", log.Fields{"groupToOlt": groupToOlt}, err)
+ }
+ //remove group from the store
+ if err := f.resourceMgr.RemoveFlowGroupFromKVStore(ctx, group.Desc.GroupId, false); err != nil {
+ return olterrors.NewErrPersistence("delete", "flow-group", group.Desc.GroupId, log.Fields{"group": group}, err)
+ }
+ logger.Debugw(ctx, "delete-group-operation-performed-on-the-device-successfully ", log.Fields{"groupToOlt": groupToOlt})
+ return nil
+}
+
//buildGroupAction creates and returns a group action
func (f *OpenOltFlowMgr) buildGroupAction() *openoltpb2.Action {
var actionCmd openoltpb2.ActionCmd