[VOL-2404] : RW-Core changes for handling OLT Reboot Scenario

- When the OLT's connection status goes from REACHABLE to UNREACHABLE
  in ENABLED/DISABLED admin state, delete all the logical ports,
  child devices, logical device and device flows.

- When OLT's connection status becomes reachable again, child devices,
  ports will be re-discovered again. The logical device will be recreated
  again.

- Will not handle the case where OLT goes UNREACHABLE when OLT is disabled
  as part of voltha2.3 release

Change-Id: I34c0c538b44afa19e889e9631f0a738060a58fef
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index f145ab6..46f0e28 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -193,9 +193,9 @@
 			log.Warnw("updating-ports-failed", log.Fields{"deviceId": device.Id, "error": err})
 		}
 
-		//Update the device state
-		cloned.ConnectStatus = voltha.ConnectStatus_UNREACHABLE
+		//Update the device operational state
 		cloned.OperStatus = voltha.OperStatus_UNKNOWN
+		// The device is still reachable after it has been disabled, so the connection status should not be changed.
 
 		if err := oltA.coreProxy.DeviceStateUpdate(context.TODO(), cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
 			// Device may already have been deleted in the core
@@ -230,7 +230,6 @@
 		}
 
 		//Update the device state
-		cloned.ConnectStatus = voltha.ConnectStatus_REACHABLE
 		cloned.OperStatus = voltha.OperStatus_ACTIVE
 
 		if err := oltA.coreProxy.DeviceStateUpdate(context.TODO(), cloned.Id, cloned.ConnectStatus, cloned.OperStatus); err != nil {
@@ -296,6 +295,21 @@
 	return nil
 }
 
+// Reboot_device -
+func (oltA *OLTAdapter) Reboot_device(device *voltha.Device) error { // nolint
+	log.Infow("reboot-device", log.Fields{"deviceId": device.Id})
+
+	go func() {
+		if err := oltA.coreProxy.DeviceStateUpdate(context.TODO(), device.Id, voltha.ConnectStatus_UNREACHABLE, voltha.OperStatus_UNKNOWN); err != nil {
+			log.Fatalf("device-state-update-failed", log.Fields{"device-id": device.Id})
+		}
+		if err := oltA.coreProxy.PortsStateUpdate(context.TODO(), device.Id, voltha.OperStatus_UNKNOWN); err != nil {
+			log.Fatalf("port-update-failed", log.Fields{"device-id": device.Id})
+		}
+	}()
+	return nil
+}
+
 // GetFlowCount returns the total number of flows presently under this adapter
 func (oltA *OLTAdapter) GetFlowCount() int {
 	oltA.lock.Lock()