use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.RoutesKey in project netvirt by opendaylight.
the class IVpnLinkServiceImpl method handleStaticRoutes.
@Override
public void handleStaticRoutes(InterVpnLinkDataComposite ivpnLink) {
/*
* Checks if there are any static routes pointing to any of both
* InterVpnLink's endpoints. Goes through all routers checking if they have
* a route whose nexthop is an InterVpnLink endpoint
*/
// Map that corresponds a routerId with the L3VPN that it's been assigned to.
Map<String, String> routerXL3VpnMap = buildRouterXL3VPNMap();
// Retrieving all Routers
InstanceIdentifier<Routers> routersIid = InstanceIdentifier.builder(Neutron.class).child(Routers.class).build();
Optional<Routers> routerOpData = Optional.empty();
try {
routerOpData = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, routersIid);
} catch (ExecutionException | InterruptedException e) {
LOG.error("handleStaticRoutes: Exception while reading routers DS", e);
}
if (!routerOpData.isPresent()) {
return;
}
Map<RouterKey, Router> keyRouterMap = routerOpData.get().nonnullRouter();
for (Router router : keyRouterMap.values()) {
String vpnId = routerXL3VpnMap.get(router.getUuid().getValue());
if (vpnId == null) {
LOG.warn("Could not find suitable VPN for router {}", router.getUuid());
// with next router
continue;
}
Map<RoutesKey, Routes> routesKeyRoutesMap = router.nonnullRoutes();
if (routesKeyRoutesMap != null) {
for (Routes route : routesKeyRoutesMap.values()) {
handleStaticRoute(vpnId, route, ivpnLink);
}
}
}
}
Aggregations