VOL-4251: Delete device immediately after (without any delay)
volt-remove-subscriber access leaves stale resources on the OLT device
The delete device cleans up everything for the device including the
TpInstance even before volt-remove-subscriber-access has completed
the processing. The volt-remove-subscriber cleans up scheduler
and queues at the end of removing all the flows. But it needs the
tp-instance reference to clean up the schedulers and queues, but
it has already been deleted. So, it aborts the scheduler/queue
cleanup on the OLT and this causes issues when configuring the
scheduler again on the OLT during a fresh setup as there are some
stale entries on the ONU.
The fix here is to force cleanup the resources on the OLT when the
ONU device is being deleted on the OLT.
Change-Id: I54cd3ef0d5bd41cd901f3bb8917927336b84ea27
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index 60bd3bd..9c45250 100644
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -1143,7 +1143,7 @@
func (dh *DeviceHandler) activateONU(ctx context.Context, intfID uint32, onuID int64, serialNum *oop.SerialNumber, serialNumber string) error {
logger.Debugw(ctx, "activate-onu", log.Fields{"intf-id": intfID, "onu-id": onuID, "serialNum": serialNum, "serialNumber": serialNumber, "device-id": dh.device.Id, "OmccEncryption": dh.openOLT.config.OmccEncryption})
- if err := dh.flowMgr[intfID].UpdateOnuInfo(ctx, intfID, uint32(onuID), serialNumber); err != nil {
+ if err := dh.flowMgr[intfID].AddOnuInfoToFlowMgrCacheAndKvStore(ctx, intfID, uint32(onuID), serialNumber); err != nil {
return olterrors.NewErrAdapter("onu-activate-failed", log.Fields{"onu": onuID, "intf-id": intfID}, err)
}
var pir uint32 = 1000000
@@ -2182,8 +2182,7 @@
for _, gem := range onuGem.GemPorts {
dh.resourceMgr[intfID].DeleteFlowIDsForGem(ctx, intfID, gem)
}
- err := dh.resourceMgr[intfID].DelOnuGemInfo(ctx, intfID, onuID)
- if err != nil {
+ if err := dh.flowMgr[intfID].RemoveOnuInfoFromFlowMgrCacheAndKvStore(ctx, intfID, onuID); err != nil {
logger.Warnw(ctx, "persistence-update-onu-gem-info-failed", log.Fields{
"intf-id": intfID,
"onu-device": onu,