Skip to content

Commit

Permalink
Fix missing isis-level1 prefix routes
Browse files Browse the repository at this point in the history
Signed-off-by: jensenzhang <jingxuan.n.zhang@gmail.com>
  • Loading branch information
fno2010 committed Mar 2, 2021
1 parent 1e6b7e7 commit 98213eb
Show file tree
Hide file tree
Showing 3 changed files with 1,680 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ private void loadTopology() {
Tables table = optional.get();
if (table.getRoutes() instanceof LinkstateRoutesCase) {
loadTopologyFromLinkstate(((LinkstateRoutesCase) table.getRoutes()).getLinkstateRoutes());
topology.prepareDefaultIntraArea();
} else {
LOG.error("Unsupported route type");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,35 @@ public boolean containsNode(Long areaId, Long nodeId) {
return multigraph.containsKey(areaId) && multigraph.get(areaId).containsVertex(nodeId);
}

public void prepareDefaultIntraArea() {
Set<String> allPrefixes = multiFirstHops.keySet();
for (String prefix : allPrefixes) {
FirstHops origin = multiFirstHops.get(prefix);
if (origin.intraAreaId == null || origin.intraOriginId == null) {
Long metric = 0L;
Long defaultIntraArea = null;
Long defaultIntraOrigin = null;
for (Long interArea : origin.interOriginIds.keySet()) {
if (defaultIntraArea == null) {
defaultIntraArea = interArea;
}
for (Long interOrigin : origin.interOriginIds.get(interArea).keySet()) {
Long currentMetric = origin.interOriginIds.get(interArea).get(interOrigin);
if (defaultIntraOrigin == null) {
defaultIntraOrigin = interOrigin;
metric = currentMetric;
}
if (currentMetric < metric) {
defaultIntraArea = interArea;
defaultIntraOrigin = interOrigin;
}
}
}
addIntraPrefix(prefix, defaultIntraArea, defaultIntraOrigin);
}
}
}

public int getDistance(Long areaId, Long sourceId, Long destId) {
int d = 0;
try {
Expand Down
Loading

0 comments on commit 98213eb

Please sign in to comment.