Fix a bug of splitting the label stacks
Change-Id: I0f4c60c4deb15d1b5822a73c580fbba0f135d44b
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingTunnel.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingTunnel.java
index 11cad0d..91acfe5 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingTunnel.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingTunnel.java
@@ -139,9 +139,16 @@
String newStitchingRouterId =
lastToSecond.getRoute().get(lastToSecond.getRoute().size()-2);
+ // Needs to convert any adjacency Sid to node Sid
if (srManager.isAdjacencySid(newStitchingRouterId)) {
String orgNodeSid =
lastToSecond.getRoute().get(lastToSecond.getRoute().size()-3);
+ if (srManager.isAdjacencySid(orgNodeSid)) {
+ String firstLabelOrgNodeSid =
+ srManager.getMplsLabel(lastToSecond.getFwdSwDpid().get(0).toString());
+ List<Switch> destNodes = getAdjacencyDestinationNode(firstLabelOrgNodeSid, orgNodeSid);
+ orgNodeSid = srManager.getMplsLabel(destNodes.get(0).getDpid().toString());
+ }
List<Switch> destNodes = getAdjacencyDestinationNode(orgNodeSid, newStitchingRouterId);
newStitchingRouterId = srManager.getMplsLabel(destNodes.get(0).getDpid().toString());
}