use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.l3vpn.rev200204.adjacency.list.AdjacencyBuilder in project netvirt by opendaylight.
the class NeutronvpnManager method getAdjacencyforExtraRoute.
@NonNull
protected List<Adjacency> getAdjacencyforExtraRoute(List<Routes> routeList, String fixedIp) {
List<Adjacency> adjList = new ArrayList<>();
Map<String, List<String>> adjMap = new HashMap<>();
for (Routes route : routeList) {
if (route == null || route.getNexthop() == null || route.getDestination() == null) {
LOG.error("Incorrect input received for extra route. {}", route);
} else {
String nextHop = route.getNexthop().stringValue();
String destination = route.getDestination().stringValue();
if (!nextHop.equals(fixedIp)) {
LOG.trace("FixedIP {} is not extra route nexthop for destination {}", fixedIp, destination);
continue;
}
LOG.trace("Adding extra route for destination {} with nexthop {} ", destination, nextHop);
List<String> hops = adjMap.computeIfAbsent(destination, k -> new ArrayList<>());
if (!hops.contains(nextHop)) {
hops.add(nextHop);
}
}
}
for (Entry<String, List<String>> entry : adjMap.entrySet()) {
final String destination = entry.getKey();
final List<String> ipList = entry.getValue();
Adjacency erAdj = new AdjacencyBuilder().setIpAddress(destination).setAdjacencyType(AdjacencyType.ExtraRoute).setNextHopIpList(ipList).withKey(new AdjacencyKey(destination)).build();
adjList.add(erAdj);
}
return adjList;
}
Aggregations