VOL-3887 Device data (logical&physical) fetched from device agents instead of KV store.

Change-Id: I6c5b05595b13fade37edc9cf68306b1a991427cc
diff --git a/rw_core/core/device/logical_manager.go b/rw_core/core/device/logical_manager.go
index 9ea12fa..48aa38f 100644
--- a/rw_core/core/device/logical_manager.go
+++ b/rw_core/core/device/logical_manager.go
@@ -102,10 +102,14 @@
 	logger.Debug(ctx, "list-all-logical-devices")
 
 	var logicalDevices []*voltha.LogicalDevice
-	if err := ldMgr.ldProxy.List(ctx, &logicalDevices); err != nil {
-		logger.Errorw(ctx, "failed-to-list-logical-devices-from-cluster-proxy", log.Fields{"error": err})
-		return nil, err
-	}
+	ldMgr.logicalDeviceAgents.Range(func(key, value interface{}) bool {
+		if ld, err := value.(*LogicalAgent).GetLogicalDeviceReadOnly(ctx); err == nil {
+			logicalDevices = append(logicalDevices, ld)
+		} else {
+			logger.Errorw(ctx, "unable-to-get-logical-device", log.Fields{"err": err})
+		}
+		return true
+	})
 	return &voltha.LogicalDevices{Items: logicalDevices}, nil
 }
 
diff --git a/rw_core/core/device/manager.go b/rw_core/core/device/manager.go
index 461a0b8..a33f778 100755
--- a/rw_core/core/device/manager.go
+++ b/rw_core/core/device/manager.go
@@ -456,25 +456,11 @@
 	logger.Debug(ctx, "list-devices")
 	result := &voltha.Devices{}
 
-	var devices []*voltha.Device
-	if err := dMgr.dProxy.List(ctx, &devices); err != nil {
-		logger.Errorw(ctx, "failed-to-list-devices-from-cluster-proxy", log.Fields{"error": err})
-		return nil, err
-	}
+	dMgr.deviceAgents.Range(func(key, value interface{}) bool {
+		result.Items = append(result.Items, value.(*Agent).device)
+		return true
+	})
 
-	for _, device := range devices {
-		// If device is not in memory then set it up
-		if !dMgr.IsDeviceInCache(device.Id) {
-			logger.Debugw(ctx, "loading-device-from-Model", log.Fields{"device-id": device.Id})
-			agent := newAgent(dMgr.adapterProxy, device, dMgr, dMgr.dbPath, dMgr.dProxy, dMgr.defaultTimeout)
-			if _, err := agent.start(ctx, nil); err != nil {
-				logger.Warnw(ctx, "failure-starting-agent", log.Fields{"device-id": device.Id})
-			} else {
-				dMgr.addDeviceAgentToMap(agent)
-			}
-		}
-		result.Items = append(result.Items, device)
-	}
 	logger.Debugw(ctx, "list-devices-end", log.Fields{"len": len(result.Items)})
 	return result, nil
 }