use of org.opendaylight.netvirt.bgpmanager.thrift.gen.Update in project netvirt by opendaylight.
the class BgpConfigurationManager method doRouteSync.
private void doRouteSync() {
LOG.error("Starting BGP route sync");
try {
bgpRouter.initRibSync(bgpSyncHandle);
} catch (BgpRouterException e) {
LOG.error("Route sync aborted, exception when initializing", e);
return;
}
while (bgpSyncHandle.getState() != BgpSyncHandle.DONE) {
for (af_afi afi : af_afi.values()) {
Routes routes = null;
try {
routes = bgpRouter.doRibSync(bgpSyncHandle, afi);
} catch (TException | BgpRouterException e) {
LOG.error("Route sync aborted, exception when syncing", e);
return;
}
Iterator<Update> updates = routes.getUpdatesIterator();
while (updates.hasNext()) {
Update update = updates.next();
String rd = update.getRd();
String nexthop = update.getNexthop();
// TODO: decide correct label here
int label = update.getL3label();
int l2label = update.getL2label();
String prefix = update.getPrefix();
int plen = update.getPrefixlen();
// TODO: protocol type will not be available in "update"
// use "rd" to query vrf table and obtain the protocol_type.
// Currently using PROTOCOL_EVPN as default.
onUpdatePushRoute(protocol_type.PROTOCOL_EVPN, rd, prefix, plen, nexthop, update.getMacaddress(), label, l2label, update.getRoutermac(), afi);
}
}
}
try {
LOG.error("Ending BGP route-sync");
bgpRouter.endRibSync(bgpSyncHandle);
} catch (BgpRouterException e) {
// Ignored?
}
}
Aggregations