[VOL-4459] ONU connection state may be wrong or misleading after ONU soft reboot
Change-Id: I97979ff245b95f75cff42a894c00ec84f8d6b014
diff --git a/VERSION b/VERSION
index df1fe2f..5bc23cd 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.3.22
+1.3.23
diff --git a/internal/pkg/onuadaptercore/device_handler.go b/internal/pkg/onuadaptercore/device_handler.go
index 929d81d..4a831eb 100644
--- a/internal/pkg/onuadaptercore/device_handler.go
+++ b/internal/pkg/onuadaptercore/device_handler.go
@@ -52,6 +52,13 @@
)
const (
+ // dummy constant - irregular value for ConnState - used to avoiding setting this state in the updateDeviceState()
+ // should better be defined in voltha protobuf or best solution would be to define an interface to just set the OperState
+ // as long as such is not available by the libraries - use this workaround
+ connectStatusINVALID = 255 // as long as not used as key in voltha.ConnectStatus_Types_name
+)
+
+const (
// events of Device FSM
devEvDeviceInit = "devEvDeviceInit"
devEvGrpcConnected = "devEvGrpcConnected"
@@ -805,10 +812,12 @@
dh.runUniLockFsm(ctx, true)
}
} else {
- logger.Debugw(ctx, "DeviceStateUpdate upon disable", log.Fields{"ConnectStatus": voltha.ConnectStatus_REACHABLE,
+ logger.Debugw(ctx, "DeviceStateUpdate upon disable", log.Fields{
"OperStatus": voltha.OperStatus_UNKNOWN, "device-id": dh.deviceID})
- if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx),
- dh.deviceID, voltha.ConnectStatus_REACHABLE, voltha.OperStatus_UNKNOWN); err != nil {
+ // disable device should have no impact on ConnStatus
+ if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx), dh.deviceID,
+ connectStatusINVALID, //use some dummy value to prevent modification of the ConnStatus
+ voltha.OperStatus_UNKNOWN); err != nil {
//TODO with VOL-3045/VOL-3046: return the error and stop further processing
logger.Errorw(ctx, "error-updating-device-state", log.Fields{"device-id": dh.deviceID, "error": err})
}
@@ -1151,9 +1160,11 @@
//transfer the possibly modified logical uni port state
dh.disableUniPortStateUpdate(ctx)
- logger.Debugw(ctx, "call DeviceStateUpdate upon reboot", log.Fields{"ConnectStatus": voltha.ConnectStatus_REACHABLE,
+ logger.Debugw(ctx, "call DeviceStateUpdate upon reboot", log.Fields{
"OperStatus": voltha.OperStatus_DISCOVERED, "device-id": dh.deviceID})
- if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx), dh.deviceID, voltha.ConnectStatus_REACHABLE,
+ // do not set the ConnStatus here as it may conflict with the parallel setting from ONU down indication (updateInterface())
+ if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx), dh.deviceID,
+ connectStatusINVALID, //use some dummy value to prevent modification of the ConnStatus
voltha.OperStatus_DISCOVERED); err != nil {
//TODO with VOL-3045/VOL-3046: return the error and stop further processing
logger.Errorw(ctx, "error-updating-device-state", log.Fields{"device-id": dh.deviceID, "error": err})
@@ -2027,8 +2038,7 @@
_ = dh.deleteDevicePersistencyData(ctx) //ignore possible errors here and continue, hope is that data is synchronized with new ONU-Up
//deviceEntry stop without omciCC reset here, regarding the OMCI_CC still valid for this ONU
- // - in contrary to disableDevice - compare with processUniDisableStateDoneEvent
- //stop the device entry which resets the attached omciCC
+ //stop the device entry to allow for all system event transfers again
pDevEntry := dh.getOnuDeviceEntry(ctx, false)
if pDevEntry == nil {
logger.Errorw(ctx, "No valid OnuDevice -aborting", log.Fields{"device-id": dh.deviceID})
@@ -2317,10 +2327,12 @@
}
func (dh *deviceHandler) processUniDisableStateDoneEvent(ctx context.Context, devEvent OnuDeviceEvent) {
- logger.Debugw(ctx, "DeviceStateUpdate upon disable", log.Fields{"ConnectStatus": voltha.ConnectStatus_REACHABLE,
+ logger.Debugw(ctx, "DeviceStateUpdate upon disable", log.Fields{
"OperStatus": voltha.OperStatus_UNKNOWN, "device-id": dh.deviceID})
- if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx),
- dh.deviceID, voltha.ConnectStatus_REACHABLE, voltha.OperStatus_UNKNOWN); err != nil {
+ // disable device should have no impact on ConnStatus
+ if err := dh.coreProxy.DeviceStateUpdate(log.WithSpanFromContext(context.TODO(), ctx), dh.deviceID,
+ connectStatusINVALID, //use some dummy value to prevent modification of the ConnStatus
+ voltha.OperStatus_UNKNOWN); err != nil {
//TODO with VOL-3045/VOL-3046: return the error and stop further processing
logger.Errorw(ctx, "error-updating-device-state", log.Fields{"device-id": dh.deviceID, "error": err})
}