[VOL-5464] - Reduce call flows in voltha during ONU reboot
Change-Id: I081dabb9d5fa5a5d177a4fee03879e207caa4dc8
Signed-off-by: Sridhar Ravindra <sridhar.ravindra@radisys.com>
diff --git a/internal/pkg/mib/mib_sync.go b/internal/pkg/mib/mib_sync.go
index 036a694..13f4047 100755
--- a/internal/pkg/mib/mib_sync.go
+++ b/internal/pkg/mib/mib_sync.go
@@ -505,39 +505,54 @@
// no need to reconcile additional data for MibDownloadFsm, LockStateFsm, or UnlockStateFsm
- if oo.baseDeviceHandler.ReconcileDeviceTechProf(ctx) {
- // start go routine with select() on reconciling flow channel before
- // starting flow reconciling process to prevent loss of any signal
- syncChannel := make(chan struct{})
- go func(aSyncChannel chan struct{}) {
- // 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
- // flow data is finished.
- expiry := oo.baseDeviceHandler.GetReconcileExpiryVlanConfigAbort()
- oo.setReconcilingFlows(true)
- aSyncChannel <- struct{}{}
- select {
- case success := <-oo.chReconcilingFlowsFinished:
- if success {
- logger.Debugw(ctx, "reconciling flows has been finished in time",
- log.Fields{"device-id": oo.deviceID})
- _ = oo.PMibUploadFsm.PFsm.Event(UlEvSuccess)
-
- } else {
- logger.Debugw(ctx, "wait for reconciling flows aborted",
- log.Fields{"device-id": oo.deviceID})
- }
- case <-time.After(expiry):
- logger.Errorw(ctx, "timeout waiting for reconciling flows to be finished!",
- log.Fields{"device-id": oo.deviceID, "expiry": expiry})
- _ = oo.PMibUploadFsm.PFsm.Event(UlEvMismatch)
+ // During reboot, if the adapter restarted while configuring TP or flows, we need to continue with flow configurations now.
+ // Set the mibUpload FSM as success and proceed with flow configs
+ oo.MutexPersOnuConfig.RLock()
+ if oo.SOnuPersistentData.PersRebootInProgress {
+ oo.MutexPersOnuConfig.RUnlock()
+ logger.Debugw(ctx, "Set mib upload as success before proceeding with flow configuration", log.Fields{"device-id": oo.deviceID})
+ go func() {
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvSuccess)
+ if oo.baseDeviceHandler.CheckForDeviceTechProf(ctx) {
+ oo.baseDeviceHandler.DeviceFlowConfigOnReboot(ctx)
}
- oo.setReconcilingFlows(false)
- }(syncChannel)
- // block further processing until the above Go routine has really started
- // and is ready to receive values from chReconcilingFlowsFinished
- <-syncChannel
- oo.baseDeviceHandler.ReconcileDeviceFlowConfig(ctx)
+ }()
+ } else {
+ oo.MutexPersOnuConfig.RUnlock()
+ if oo.baseDeviceHandler.ReconcileDeviceTechProf(ctx) {
+ // start go routine with select() on reconciling flow channel before
+ // starting flow reconciling process to prevent loss of any signal
+ syncChannel := make(chan struct{})
+ go func(aSyncChannel chan struct{}) {
+ // 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
+ // flow data is finished.
+ expiry := oo.baseDeviceHandler.GetReconcileExpiryVlanConfigAbort()
+ oo.setReconcilingFlows(true)
+ aSyncChannel <- struct{}{}
+ select {
+ case success := <-oo.chReconcilingFlowsFinished:
+ if success {
+ logger.Debugw(ctx, "reconciling flows has been finished in time",
+ log.Fields{"device-id": oo.deviceID})
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvSuccess)
+
+ } else {
+ logger.Debugw(ctx, "wait for reconciling flows aborted",
+ log.Fields{"device-id": oo.deviceID})
+ }
+ case <-time.After(expiry):
+ logger.Errorw(ctx, "timeout waiting for reconciling flows to be finished!",
+ log.Fields{"device-id": oo.deviceID, "expiry": expiry})
+ _ = oo.PMibUploadFsm.PFsm.Event(UlEvMismatch)
+ }
+ oo.setReconcilingFlows(false)
+ }(syncChannel)
+ // block further processing until the above Go routine has really started
+ // and is ready to receive values from chReconcilingFlowsFinished
+ <-syncChannel
+ oo.baseDeviceHandler.ReconcileDeviceFlowConfig(ctx)
+ }
}
} else {
logger.Debugw(ctx, "MibSync FSM",
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index c5f9365..cbeb76d 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -162,6 +162,7 @@
PersIsExtOmciSupported bool `json:"is_ext_omci_supported"`
PersUniUnlockDone bool `json:"uni_unlock_done"`
PersUniDisableDone bool `json:"uni_disable_done"`
+ PersRebootInProgress bool `json:"reboot_in_progress"`
PersMibDataSyncAdpt uint8 `json:"mib_data_sync_adpt"`
}