Fix for bug ONOS-243
Check the port status of a switch when computing the shortest path
and ignore ports whose status is not "ACTIVE".
diff --git a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
index 59e76ca..a784d7d 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/routing/TopoRouteService.java
@@ -202,6 +202,10 @@
// The local Port info
//
for (Vertex myPortVertex : nodeVertex.getVertices(Direction.OUT, "on")) {
+ // Ignore inactive ports
+ if (! myPortVertex.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
short myPort = 0;
Object obj = myPortVertex.getProperty("number");
if (obj instanceof Short) {
@@ -215,6 +219,10 @@
// The neighbor Port info
//
for (Vertex neighborPortVertex : myPortVertex.getVertices(Direction.OUT, "link")) {
+ // Ignore inactive ports
+ if (! neighborPortVertex.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
short neighborPort = 0;
obj = neighborPortVertex.getProperty("number");
if (obj instanceof Short) {
@@ -448,7 +456,15 @@
break;
}
for (Vertex parentPort : nextVertex.getVertices(Direction.OUT, "on")) {
+ // Ignore inactive ports
+ if (! parentPort.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
for (Vertex childPort : parentPort.getVertices(Direction.OUT, "link")) {
+ // Ignore inactive ports
+ if (! childPort.getProperty("state").toString().equals("ACTIVE"))
+ continue;
+
for (Vertex child : childPort.getVertices(Direction.IN, "on")) {
// Ignore inactive switches
String state = child.getProperty("state").toString();