[VOL-3959] Reconciling on MDS match: Replace timer approach by IPC (2)
Change-Id: Ic12daf00e330634725713abbc7e400cf2b3dc314
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 93c4fe5..ca3f4f7 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -2120,7 +2120,7 @@
for uniNo, uniPort := range dh.uniEntityMap {
// only if this port is validated for operState transfer
if (1<<uniPort.uniID)&activeUniPortStateUpdateMask == (1 << uniPort.uniID) {
- logger.Infow(ctx, "onuUniPort-forced-OperState-ACTIVE", log.Fields{"for PortNo": uniNo})
+ logger.Infow(ctx, "onuUniPort-forced-OperState-ACTIVE", log.Fields{"for PortNo": uniNo, "device-id": dh.deviceID})
uniPort.setOperState(vc.OperStatus_ACTIVE)
if !dh.isReconciling() {
//maybe also use getter functions on uniPort - perhaps later ...
@@ -2139,7 +2139,7 @@
for uniNo, uniPort := range dh.uniEntityMap {
// only if this port is validated for operState transfer
if (1<<uniPort.uniID)&activeUniPortStateUpdateMask == (1 << uniPort.uniID) {
- logger.Infow(ctx, "onuUniPort-forced-OperState-UNKNOWN", log.Fields{"for PortNo": uniNo})
+ logger.Infow(ctx, "onuUniPort-forced-OperState-UNKNOWN", log.Fields{"for PortNo": uniNo, "device-id": dh.deviceID})
uniPort.setOperState(vc.OperStatus_UNKNOWN)
if !dh.isReconciling() {
//maybe also use getter functions on uniPort - perhaps later ...
@@ -3186,7 +3186,7 @@
}
func (dh *deviceHandler) startReconciling(ctx context.Context, skipOnuConfig bool) {
- logger.Debugw(ctx, "start reconciling", log.Fields{"withOnuConfig": skipOnuConfig, "device-id": dh.deviceID})
+ logger.Debugw(ctx, "start reconciling", log.Fields{"skipOnuConfig": skipOnuConfig, "device-id": dh.deviceID})
if !dh.isReconciling() {
go func() {
diff --git a/internal/pkg/onuadaptercore/mib_sync.go b/internal/pkg/onuadaptercore/mib_sync.go
index 15868fc..8ae5742 100644
--- a/internal/pkg/onuadaptercore/mib_sync.go
+++ b/internal/pkg/onuadaptercore/mib_sync.go
@@ -80,7 +80,8 @@
func (oo *OnuDeviceEntry) enterResettingMibState(ctx context.Context, e *fsm.Event) {
logger.Debugw(ctx, "MibSync FSM", log.Fields{"Start MibTemplate processing in State": e.FSM.Current(), "device-id": oo.deviceID})
- if !oo.isNewOnu() && !oo.baseDeviceHandler.isReconciling() {
+ if (!oo.isNewOnu() && !oo.baseDeviceHandler.isReconciling()) || //use case: re-auditing failed
+ oo.baseDeviceHandler.isSkipOnuConfigReconciling() { //use case: reconciling without omci-config failed
oo.baseDeviceHandler.prepareReconcilingWithActiveAdapter(ctx)
oo.devState = DeviceStatusInit
}
@@ -235,14 +236,9 @@
// no need to reconcile additional data for MibDownloadFsm, LockStateFsm, or UnlockStateFsm
oo.baseDeviceHandler.reconcileDeviceTechProf(ctx)
- oo.baseDeviceHandler.reconcileDeviceFlowConfig(ctx)
- if oo.sOnuPersistentData.PersUniDisableDone {
- oo.baseDeviceHandler.disableUniPortStateUpdate(ctx)
- oo.baseDeviceHandler.setDeviceReason(drOmciAdminLock)
- } else {
- oo.baseDeviceHandler.enableUniPortStateUpdate(ctx)
- }
+ // start go routine with select() on reconciling flow channel before
+ // starting flow reconciling process to prevent loss of any signal
go func() {
// In multi-ONU/multi-flow environment stopping reconcilement has to be delayed until
// we get a signal that the processing of the last step to rebuild the adapter internal
@@ -252,22 +248,29 @@
if success {
logger.Debugw(ctx, "reconciling flows has been finished in time",
log.Fields{"device-id": oo.deviceID})
+ oo.baseDeviceHandler.stopReconciling(ctx)
_ = oo.pMibUploadFsm.pFsm.Event(ulEvSuccess)
+
} else {
logger.Debugw(ctx, "wait for reconciling flows aborted",
log.Fields{"device-id": oo.deviceID})
oo.baseDeviceHandler.setReconcilingFlows(false)
- return
}
- case <-time.After(100 * time.Millisecond):
+ case <-time.After(500 * time.Millisecond):
logger.Errorw(ctx, "timeout waiting for reconciling flows to be finished!",
log.Fields{"device-id": oo.deviceID})
oo.baseDeviceHandler.setReconcilingFlows(false)
_ = oo.pMibUploadFsm.pFsm.Event(ulEvMismatch)
}
- oo.baseDeviceHandler.stopReconciling(ctx)
}()
+ oo.baseDeviceHandler.reconcileDeviceFlowConfig(ctx)
+ if oo.sOnuPersistentData.PersUniDisableDone {
+ oo.baseDeviceHandler.disableUniPortStateUpdate(ctx)
+ oo.baseDeviceHandler.setDeviceReason(drOmciAdminLock)
+ } else {
+ oo.baseDeviceHandler.enableUniPortStateUpdate(ctx)
+ }
} else {
logger.Debugw(ctx, "MibSync FSM",
log.Fields{"Getting MIB from template not successful": e.FSM.Current(), "device-id": oo.deviceID})
@@ -859,7 +862,8 @@
func (oo *OnuDeviceEntry) getMibFromTemplate(ctx context.Context) bool {
oo.mibTemplatePath = oo.buildMibTemplatePath()
- logger.Debugw(ctx, "MibSync FSM - get Mib from template", log.Fields{"path": fmt.Sprintf("%s/%s", cBasePathMibTemplateKvStore, oo.mibTemplatePath)})
+ logger.Debugw(ctx, "MibSync FSM - get Mib from template", log.Fields{"path": fmt.Sprintf("%s/%s", cBasePathMibTemplateKvStore, oo.mibTemplatePath),
+ "device-id": oo.deviceID})
restoredFromMibTemplate := false
Value, err := oo.mibTemplateKVStore.Get(log.WithSpanFromContext(context.TODO(), ctx), oo.mibTemplatePath)