VOL-4278 rw-core currently rejects the EnableDevice call if the admin-state of device is already ENABLE.
rw-core should check the operational-state in this case and let the call proceed,
if the operational-state is FAILED
Change-Id: Ic5f53cd93d47a65a733511569813c8009c74c177
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 1a83cb2..a33765b 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -382,8 +382,9 @@
err = status.Errorf(codes.FailedPrecondition, "cannot complete operation as device deletion is in progress or reconciling is in progress/failed: %s", agent.deviceID)
return err
}
-
- if oldDevice.AdminState == voltha.AdminState_ENABLED {
+ //vol-4275 TST meeting 08/04/2021: Let EnableDevice to be called again if device is in FAILED operational state,
+ //even the admin state is ENABLED.
+ if oldDevice.AdminState == voltha.AdminState_ENABLED && oldDevice.OperStatus != voltha.OperStatus_FAILED {
logger.Warnw(ctx, "device-already-enabled", log.Fields{"device-id": agent.deviceID})
agent.requestQueue.RequestComplete()
err = status.Errorf(codes.FailedPrecondition, fmt.Sprintf("cannot-enable-an-already-enabled-device: %s", oldDevice.Id))