[VOL-2442] Fix for Core panic

The logical device agent was receiving logical ports creation
while the logical device was not ready - it was waiting for
switch capability data from the OLT device.  This was causing
a panic.  The fix prevents logical port creation to be
trigerred when the logical device is not ready.  Once the
logical device is ready it will go over the ports data from the
OLT device and automatically create the logical ports.

Change-Id: Iad62302eda80fa158e59852810ad272a8aeedb7b
diff --git a/rw_core/core/logical_device_manager.go b/rw_core/core/logical_device_manager.go
index 6f8b2fa..6783e29 100644
--- a/rw_core/core/logical_device_manager.go
+++ b/rw_core/core/logical_device_manager.go
@@ -99,7 +99,15 @@
 func (ldMgr *LogicalDeviceManager) getLogicalDeviceAgent(logicalDeviceID string) *LogicalDeviceAgent {
 	agent, ok := ldMgr.logicalDeviceAgents.Load(logicalDeviceID)
 	if ok {
-		return agent.(*LogicalDeviceAgent)
+		lda := agent.(*LogicalDeviceAgent)
+		if lda.logicalDevice == nil {
+			// This can happen when an agent for the logical device has been created but the logical device
+			// itself is not ready for action as it is waiting for switch and port capabilities from the
+			// relevant adapter.  In such a case prevent any request aimed at that logical device.
+			log.Debugf("Logical device %s is not ready to serve requests", logicalDeviceID)
+			return nil
+		}
+		return lda
 	}
 	//	Try to load into memory - loading will also create the logical device agent
 	if err := ldMgr.load(logicalDeviceID); err == nil {