VOL-4392 All ONUIDs allocated for the device should be cleared during cleanup
Change-Id: I24238b2cf61201a901c9719a8aaafb8c363b4cb7
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 33e2f5a..e882cd5 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1874,7 +1874,6 @@
var err error
onuGemData := dh.flowMgr[ponPort].getOnuGemInfoList(ctx)
for i, onu := range onuGemData {
- onuID := make([]uint32, 1)
logger.Debugw(ctx, "onu-data", log.Fields{"onu": onu})
if err = dh.clearUNIData(ctx, &onuGemData[i]); err != nil {
logger.Errorw(ctx, "failed-to-clear-data-for-onu", log.Fields{"onu-device": onu})
@@ -1883,8 +1882,6 @@
for _, gem := range onu.GemPorts {
dh.resourceMgr[ponPort].DeleteFlowIDsForGem(ctx, ponPort, gem)
}
- onuID[0] = onu.OnuID
- dh.resourceMgr[ponPort].FreeonuID(ctx, ponPort, onuID)
err = dh.resourceMgr[ponPort].DelOnuGemInfo(ctx, ponPort, onu.OnuID)
if err != nil {
logger.Errorw(ctx, "failed-to-update-onugem-info", log.Fields{"intfid": ponPort, "onugeminfo": onuGemData})
@@ -2331,8 +2328,9 @@
//Not returning error on cleanup.
}
logger.Debugw(ctx, "removed-onu-gem-info", log.Fields{"intf": intfID, "onu-device": onu, "onugem": onuGem})
- dh.resourceMgr[intfID].FreeonuID(ctx, intfID, []uint32{onuGem.OnuID})
+
}
+ dh.resourceMgr[intfID].FreeonuID(ctx, intfID, []uint32{onuID})
dh.onus.Delete(onuKey)
dh.discOnus.Delete(onuSn)