[VOL-5484]: ONU/OLT reboot conditions added
Signed-off-by: balaji.nagarajan <balaji.nagarajan@radisys.com>
Change-Id: Ic492b6a645d303d7bfc467df97c94ba9d0a4b615
diff --git a/VERSION b/VERSION
index f9fb0e4..1bff231 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.20
+3.6.21
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 9136174..040d65a 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -628,6 +628,11 @@
device := agent.getDeviceReadOnlyWithoutLock()
+ if device.ConnectStatus != voltha.ConnectStatus_REACHABLE {
+ err = status.Errorf(codes.FailedPrecondition, "cannot complete operation as device :%s is in operstatus:%s ,connect-status:%s", agent.deviceID, device.OperStatus, device.ConnectStatus)
+ return err
+ }
+
if !agent.proceedWithRequest(device) {
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
diff --git a/rw_core/core/device/manager_nbi.go b/rw_core/core/device/manager_nbi.go
index 92071d6..1e0da90 100644
--- a/rw_core/core/device/manager_nbi.go
+++ b/rw_core/core/device/manager_nbi.go
@@ -101,6 +101,17 @@
if agent == nil {
return nil, status.Errorf(codes.NotFound, "%s", id.Id)
}
+ if !agent.isRootDevice {
+ parentAgent := dMgr.getDeviceAgent(ctx, agent.device.ParentId)
+ if parentAgent != nil {
+ parentDevice := parentAgent.getDeviceReadOnlyWithoutLock()
+ if parentDevice.ConnectStatus != voltha.ConnectStatus_REACHABLE {
+ return nil, status.Errorf(codes.FailedPrecondition, "cannot complete operation as parent device :%s is in operstatus:%s ,connect-status:%s", parentAgent.deviceID, parentDevice.OperStatus, parentDevice.ConnectStatus)
+ }
+ } else {
+ return nil, status.Errorf(codes.NotFound, "device agent for parent id %s for child %s", agent.device.ParentId, id.Id)
+ }
+ }
return &empty.Empty{}, agent.rebootDevice(ctx)
}