[VOL-5395]-Flow routine stuck fix

Change-Id: Icde9bce07d6a2b0a706cef7fb6f94e3d02bbce66
Signed-off-by: Akash Soni <akash.soni@radisys.com>
diff --git a/VERSION b/VERSION
index 06b755c..fa11c47 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.12.10-dev9
+2.12.10-dev10
\ No newline at end of file
diff --git a/internal/pkg/avcfg/omci_ani_config.go b/internal/pkg/avcfg/omci_ani_config.go
index bbcc41a..b58d772 100755
--- a/internal/pkg/avcfg/omci_ani_config.go
+++ b/internal/pkg/avcfg/omci_ani_config.go
@@ -1192,6 +1192,9 @@
 				_ = aPAFsm.PFsm.Event(aniEvRestart)
 			}
 		}(pConfigAniStateAFsm)
+		logger.Warnf(ctx, "calling  HandleAniConfigFSMFailure resetting", log.Fields{
+			"device-id": oFsm.deviceID, "uni-id": oFsm.pOnuUniPort.UniID})
+		oFsm.pDeviceHandler.HandleAniConfigFSMFailure(ctx, oFsm.pOnuUniPort.UniID)
 	}
 }
 
diff --git a/internal/pkg/common/interfaces.go b/internal/pkg/common/interfaces.go
index ce91062..e761a3d 100755
--- a/internal/pkg/common/interfaces.go
+++ b/internal/pkg/common/interfaces.go
@@ -115,6 +115,7 @@
 
 	VerifyUniVlanConfigRequest(context.Context, *OnuUniPort, uint8)
 	VerifyVlanConfigRequest(context.Context, uint8, uint8)
+	HandleAniConfigFSMFailure(ctx context.Context, uniID uint8)
 	AddAllUniPorts(context.Context)
 	RemoveVlanFilterFsm(context.Context, *OnuUniPort)
 
diff --git a/internal/pkg/core/device_handler.go b/internal/pkg/core/device_handler.go
index e5cc1e0..8daca76 100755
--- a/internal/pkg/core/device_handler.go
+++ b/internal/pkg/core/device_handler.go
@@ -3574,6 +3574,35 @@
 	}
 }
 
+// handleAniConfigFSMFailure handles the failure of the ANI config FSM by resetting the VLAN filter FSM
+func (dh *deviceHandler) HandleAniConfigFSMFailure(ctx context.Context, uniID uint8) {
+	dh.lockVlanConfig.Lock()
+	defer dh.lockVlanConfig.Unlock()
+
+	if pVlanFilterFsm, exist := dh.UniVlanConfigFsmMap[uniID]; exist {
+		pVlanFilterStatemachine := pVlanFilterFsm.PAdaptFsm.PFsm
+		if pVlanFilterStatemachine != nil {
+			if err := pVlanFilterStatemachine.Event(avcfg.VlanEvReset); err != nil {
+				logger.Warnw(ctx, "Failed to reset UniVlanConfigFsm", log.Fields{
+					"err": err, "device-id": dh.DeviceID, "UniPort": uniID, "FsmState": pVlanFilterStatemachine.Current(),
+				})
+			} else {
+				logger.Infow(ctx, "Successfully reset UniVlanConfigFsm", log.Fields{
+					"state": pVlanFilterStatemachine.Current(), "device-id": dh.DeviceID, "UniPort": uniID,
+				})
+			}
+		} else {
+			logger.Debugw(ctx, "UniVlanConfigFsm StateMachine does not exist, no reset performed", log.Fields{
+				"device-id": dh.DeviceID, "UniPort": uniID,
+			})
+		}
+	} else {
+		logger.Debugw(ctx, "No UniVlanConfigFsm found for the UNI ID", log.Fields{
+			"device-id": dh.DeviceID, "UniPort": uniID,
+		})
+	}
+}
+
 // RemoveVlanFilterFsm deletes the stored pointer to the VlanConfigFsm
 // intention is to provide this method to be called from VlanConfigFsm itself, when resources (and methods!) are cleaned up
 func (dh *deviceHandler) RemoveVlanFilterFsm(ctx context.Context, apUniPort *cmn.OnuUniPort) {