[VOL-5472] store the logical agent only after logical ports are created

Change-Id: Ic7c18b341df3804f61e986f4ce6d60e398bf8416
Signed-off-by: Akash Reddy Kankanala <akash.kankanala@radisys.com>
diff --git a/VERSION b/VERSION
index 2d6744e..395f634 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.6.23
+3.6.24
diff --git a/rw_core/core/device/logical_agent.go b/rw_core/core/device/logical_agent.go
index adcaba3..406b869 100644
--- a/rw_core/core/device/logical_agent.go
+++ b/rw_core/core/device/logical_agent.go
@@ -154,22 +154,19 @@
 		logger.Debugw(ctx, "Switch-capability", log.Fields{"Desc": ld.Desc, "fromAd": switchCap.Desc})
 		ld.SwitchFeatures = (proto.Clone(switchCap.SwitchFeatures)).(*ofp.OfpSwitchFeatures)
 
+		// Setup the logicalports - internal processing, no need to propagate the client context
+		err = agent.setupLogicalPorts(ctx)
+		if err != nil {
+			logger.Errorw(ctx, "unable-to-setup-logical-ports", log.Fields{"error": err})
+		}
 		// Save the logical device
 		if err = agent.ldProxy.Set(ctx, ld.Id, ld); err != nil {
 			logger.Errorw(ctx, "failed-to-add-logical-device", log.Fields{"logical-device-id": agent.logicalDeviceID})
 			return
 		}
 		logger.Debugw(ctx, "logical-device-created", log.Fields{"logical-device-id": agent.logicalDeviceID, "root-id": ld.RootDeviceId})
-
 		agent.logicalDevice = ld
 
-		// Setup the logicalports - internal processing, no need to propagate the client context
-
-		err = agent.setupLogicalPorts(ctx)
-		if err != nil {
-			logger.Errorw(ctx, "unable-to-setup-logical-ports", log.Fields{"error": err})
-		}
-
 	} else {
 		// Check to see if we need to load from dB
 		ld = logicalDevice