T3: HAG scenario fixes
Change-Id: I5a7b9bc6212f946b7c34a6dca64ee1f6a0f7d401
(cherry picked from commit e3cb7a8a4b733e93d943b07bf09bbb753ce3d158)
diff --git a/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java b/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
index f9d1b2a..526367a 100644
--- a/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
+++ b/apps/t3/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
@@ -391,6 +391,8 @@
//if the trace already contains the input connect point there is a loop
if (pathContainsDevice(completePath, in.deviceId())) {
trace.addResultMessage("Loop encountered in device " + in.deviceId());
+ completePath.add(in);
+ trace.addCompletePath(completePath);
return trace;
}
@@ -461,10 +463,14 @@
}
}
}
+
//we use the pre-existing path up to the point we fork to a new output
if (inputForOutput != null && completePath.contains(inputForOutput)) {
List<ConnectPoint> temp = new ArrayList<>(previousPath);
- completePath = temp.subList(0, previousPath.indexOf(inputForOutput) + 1);
+ temp = temp.subList(0, previousPath.indexOf(inputForOutput) + 1);
+ if (completePath.containsAll(temp)) {
+ completePath = temp;
+ }
}
}
@@ -652,7 +658,7 @@
traverseList.add(output);
}
if (!trace.getCompletePaths().contains(traverseList)) {
- trace.addCompletePath(traverseList);
+ trace.addCompletePath(ImmutableList.copyOf(traverseList));
return true;
}
return false;