VOL-389: The device_graph should compute routes between NNI & UNI (VENET) ports only
Change-Id: I785ce5f7e3061ef88cc83a017fead003aaba7209
diff --git a/voltha/core/device_graph.py b/voltha/core/device_graph.py
index 8fe6fee..a4e6d85 100644
--- a/voltha/core/device_graph.py
+++ b/voltha/core/device_graph.py
@@ -28,7 +28,7 @@
def compute_routes(self, root_proxy, logical_ports):
boundary_ports, graph = self._build_graph(root_proxy, logical_ports)
- routes = self._build_routes(boundary_ports, graph)
+ routes = self._build_routes(boundary_ports, graph, logical_ports)
return graph, routes
def _build_graph(self, root_proxy, logical_ports):
@@ -81,7 +81,10 @@
return boundary_ports, graph
- def _build_routes(self, boundary_ports, graph):
+ def _build_routes(self, boundary_ports, graph, logical_ports):
+
+ root_ports = dict((lp.ofp_port.port_no, lp.root_port)
+ for lp in logical_ports if lp.root_port == True)
routes = {}
@@ -91,6 +94,16 @@
if source is target:
continue
+ # Ignore NNI - NNI routes
+ if source_port_no in root_ports \
+ and target_port_no in root_ports:
+ continue
+
+ # Ignore UNI - UNI routes
+ if source_port_no not in root_ports \
+ and target_port_no not in root_ports:
+ continue
+
path = nx.shortest_path(graph, source, target)
# number of nodes in valid paths is always multiple of 3