[VOL-1614] Device Management update in the Core

This commit went over the device management of devices in the Core
and made the following changes:
1) Update the device state machine to not remove logical
device or ports when a device is disabled.
2) Fix some issues around device deletion
3) Add additional APIs between the Core and Adapters to handle
the scenarios of enable/disable/delete a device
4) Update the simulated Adapters to handle disable/reenable/delete
5) Add a new set of tests for teh device state machine.

Change-Id: Ib2be87ec011762d5315a6d54581a87c1891e92be
diff --git a/adapters/simulated_olt/adaptercore/device_handler.go b/adapters/simulated_olt/adaptercore/device_handler.go
index 07f31ff..f64f99b 100644
--- a/adapters/simulated_olt/adaptercore/device_handler.go
+++ b/adapters/simulated_olt/adaptercore/device_handler.go
@@ -218,6 +218,13 @@
 		log.Errorw("device-state-update-failed", log.Fields{"deviceId": device.Id, "error": err})
 		return
 	}
+
+	// Tell the Core that all child devices have been disabled (by default it's an action already taken by the Core
+	if err := dh.coreProxy.ChildDevicesLost(nil, cloned.Id); err != nil {
+		log.Errorw("lost-notif-of-child-devices-failed", log.Fields{"deviceId": device.Id, "error": err})
+		return
+	}
+
 	log.Debugw("DisableDevice-end", log.Fields{"deviceId": device.Id})
 }
 
@@ -239,5 +246,23 @@
 		log.Errorw("device-state-update-failed", log.Fields{"deviceId": device.Id, "error": err})
 		return
 	}
+
+	// Tell the Core that all child devices have been enabled
+	if err := dh.coreProxy.ChildDevicesDetected(nil, cloned.Id); err != nil {
+		log.Errorw("detection-notif-of-child-devices-failed", log.Fields{"deviceId": device.Id, "error": err})
+		return
+	}
+
 	log.Debugw("ReEnableDevice-end", log.Fields{"deviceId": device.Id})
 }
+
+func (dh *DeviceHandler) DeleteDevice(device *voltha.Device) {
+	cloned := proto.Clone(device).(*voltha.Device)
+	// Update the all ports state on that device to disable
+	if err := dh.coreProxy.DeleteAllPorts(nil, cloned.Id); err != nil {
+		log.Errorw("delete-ports-failed", log.Fields{"deviceId": device.Id, "error": err})
+		return
+	}
+
+	log.Debugw("DeleteDevice-end", log.Fields{"deviceId": device.Id})
+}