[VOL-1974] ONUs can not be discovered after hard rebooting the OLT

When the OLT is rebooted, it starts to send ONU discover indications
again and to process them the discovered onu cache should be cleared.
Also necessary lock mechanism added.

Change-Id: Iaf31bdec06ed24605aa5879d1246c38dcdf3cb25
diff --git a/adaptercore/device_handler.go b/adaptercore/device_handler.go
index ab30edd..9ad9941 100644
--- a/adaptercore/device_handler.go
+++ b/adaptercore/device_handler.go
@@ -382,6 +382,8 @@
 // doStateDown handle the olt down indication
 func (dh *DeviceHandler) doStateDown() error {
+	dh.lockDevice.Lock()
+	defer dh.lockDevice.Unlock()
 	device, err := dh.coreProxy.GetDevice(context.TODO(), dh.device.Id, dh.device.Id)
@@ -424,9 +426,12 @@
 		if er != nil {
 			log.Errorw("Failed to send inter-adapter-message", log.Fields{"OnuInd": onuInd,
 				"From Adapter": "openolt", "DevieType": onuDevice.Type, "DeviceID": onuDevice.Id})
-			return er
+			//Do not return here and continue to process other ONUs
+	/* Discovered ONUs entries need to be cleared , since after OLT
+	   is up, it starts sending discovery indications again*/
+	dh.discOnus = make(map[string]bool)
 	log.Debugw("do-state-down-end", log.Fields{"deviceID": device.Id})
 	return nil