[VOL-2643] Removing unused UpdateOnuGemInfo
Change-Id: I08a633ff2488e495dfd67be501a0b9a74055603d
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 3d7a5ad..74e1f30 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1959,30 +1959,44 @@
}
//clear PON resources associated with ONU
var onuGemData []rsrcMgr.OnuGemInfo
- if err := dh.resourceMgr.ResourceMgrs[IntfID].GetOnuGemInfo(ctx, IntfID, &onuGemData); err != nil {
- logger.Warnw("Failed-to-get-onu-info-for-pon-port ", log.Fields{
+ if onuMgr, ok := dh.resourceMgr.ResourceMgrs[IntfID]; !ok {
+ logger.Warnw("failed-to-get-resource-manager-for-interface-Id", log.Fields{
"device-id": dh.deviceID,
- "interface-id": IntfID,
- "error": err})
+ "interface-id": IntfID})
} else {
- for i, onu := range onuGemData {
- if onu.OnuID == onuID && onu.SerialNumber == onuDevice.(*OnuDevice).serialNumber {
- logger.Debugw("onu-data ", log.Fields{"onu": onu})
- if err := dh.clearUNIData(ctx, &onu); err != nil {
- logger.Warnw("Failed-to-clear-uni-data-for-onu", log.Fields{
- "device-id": dh.deviceID,
- "onu-device": onu,
- "error": err})
+ if err := onuMgr.GetOnuGemInfo(ctx, IntfID, &onuGemData); err != nil {
+ logger.Warnw("failed-to-get-onu-info-for-pon-port ", log.Fields{
+ "device-id": dh.deviceID,
+ "interface-id": IntfID,
+ "error": err})
+ } else {
+ for i, onu := range onuGemData {
+ if onu.OnuID == onuID && onu.SerialNumber == onuDevice.(*OnuDevice).serialNumber {
+ logger.Debugw("onu-data ", log.Fields{"onu": onu})
+ if err := dh.clearUNIData(ctx, &onu); err != nil {
+ logger.Warnw("failed-to-clear-uni-data-for-onu", log.Fields{
+ "device-id": dh.deviceID,
+ "onu-device": onu,
+ "error": err})
+ }
+ // Clear flowids for gem cache.
+ for _, gem := range onu.GemPorts {
+ dh.resourceMgr.DeleteFlowIDsForGem(ctx, IntfID, gem)
+ }
+ onuGemData = append(onuGemData[:i], onuGemData[i+1:]...)
+ err := onuMgr.AddOnuGemInfo(ctx, IntfID, onuGemData)
+ if err != nil {
+ logger.Warnw("persistence-update-onu-gem-info-failed", log.Fields{
+ "interface-id": IntfID,
+ "onu-device": onu,
+ "onu-gem": onuGemData,
+ "error": err})
+ //Not returning error on cleanup.
+ }
+ logger.Debugw("removed-onu-gem-info", log.Fields{"intf": IntfID, "onu-device": onu, "onugem": onuGemData})
+ dh.resourceMgr.FreeonuID(ctx, IntfID, []uint32{onu.OnuID})
+ break
}
- // Clear flowids for gem cache.
- for _, gem := range onu.GemPorts {
- dh.resourceMgr.DeleteFlowIDsForGem(ctx, IntfID, gem)
- }
- onuGemData = append(onuGemData[:i], onuGemData[i+1:]...)
- dh.resourceMgr.UpdateOnuGemInfo(ctx, IntfID, onuGemData)
-
- dh.resourceMgr.FreeonuID(ctx, IntfID, []uint32{onu.OnuID})
- break
}
}
}
diff --git a/internal/pkg/resourcemanager/resourcemanager.go b/internal/pkg/resourcemanager/resourcemanager.go
index d3a9789..906fd94 100755
--- a/internal/pkg/resourcemanager/resourcemanager.go
+++ b/internal/pkg/resourcemanager/resourcemanager.go
@@ -1053,23 +1053,6 @@
return nil
}
-// UpdateOnuGemInfo updates Onuinfo on the kvstore per interface
-func (RsrcMgr *OpenOltResourceMgr) UpdateOnuGemInfo(ctx context.Context, IntfID uint32, onuGem []OnuGemInfo) error {
-
- // TODO: VOL-2643
- err := RsrcMgr.ResourceMgrs[IntfID].AddOnuGemInfo(ctx, IntfID, onuGem)
- if err != nil {
- logger.Debugw("persistence-update-failed", log.Fields{
- "interface-id": IntfID,
- "gem-info": onuGem,
- "error": err})
- return err
- }
-
- logger.Debugw("updated onugeminfo", log.Fields{"intf": IntfID, "onugem": onuGem})
- return nil
-}
-
// AddUniPortToOnuInfo adds uni port to the onuinfo kvstore. check if the uni is already present if not update the kv store.
func (RsrcMgr *OpenOltResourceMgr) AddUniPortToOnuInfo(ctx context.Context, intfID uint32, onuID uint32, portNo uint32) {
var onuGemData []OnuGemInfo