[VOL-1890] Flow decomposition fails after a core switch over

This commit fixes the issue reported in VOL-1890 by doing
the following:
1) Update the device graph if the device graph was built
with an older logical device topology (this can happen in
the standby by core as currently the model does not trigger
a core callback after it updates its data in memory following
a watch event from the KV store - this is a TODO item).
2) Update flows in a logical device without using the data
model proxy to flows directly.
3) Reconcile the list of devices and logical devices in the
core memory after a restart upon receive a reconcile request
from the api server.

After first review:
1) Update the code as per the comments
2) Change the device loading channel to have two simultaneous
routines invoking the device loading for the same device to
return the same result (i.e. if it's a success then both
should return success and conversely in the failure case)

After second review:
Change the sync map controlling the device in loading state
to regular map.

Change-Id: I4331ac2a8f87a7de272e919a31dfe4bbaaf327a0
diff --git a/rw_core/graph/device_graph.go b/rw_core/graph/device_graph.go
index ec6f8d2..357a709 100644
--- a/rw_core/graph/device_graph.go
+++ b/rw_core/graph/device_graph.go
@@ -210,6 +210,25 @@
 	return nil
 }
 
+func (dg *DeviceGraph) IsUpToDate(ld *voltha.LogicalDevice) bool {
+	if ld != nil {
+		if len(dg.boundaryPorts) != len(ld.Ports) {
+			return false
+		}
+		var portId string
+		var val uint32
+		var exist bool
+		for _, lp := range ld.Ports {
+			portId = concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
+			if val, exist = dg.boundaryPorts[portId]; !exist || val != lp.OfpPort.PortNo {
+				return false
+			}
+		}
+		return true
+	}
+	return len(dg.boundaryPorts) == 0
+}
+
 //getDevice returns the device either from the local cache (default) or from the model.
 //TODO: Set a cache timeout such that we do not use invalid data.  The full device lifecycle should also
 //be taken in consideration