use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry in project netvirt by opendaylight.
the class FibEntriesListener method remove.
@Override
protected void remove(InstanceIdentifier<VrfEntry> identifier, VrfEntry del) {
LOG.trace("Remove Fib event - Key : {}, value : {} ", identifier, del);
final VrfTablesKey key = identifier.firstKeyOf(VrfTables.class, VrfTablesKey.class);
String rd = key.getRouteDistinguisher();
List<RoutePaths> routePaths = del.getRoutePaths();
removeLabelFromVpnInstance(rd, routePaths);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry in project netvirt by opendaylight.
the class BgpConfigurationManager method createStaleFibMap.
/*
* BGP restart scenario, ODL-BGP manager was/is running.
* On re-sync notification, Get a copy of FIB database.
*/
public void createStaleFibMap() {
totalStaledCount = 0;
try {
staledFibEntriesMap.clear();
InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
Optional<FibEntries> fibEntries = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
if (fibEntries.isPresent()) {
List<VrfTables> staleVrfTables = fibEntries.get().getVrfTables();
for (VrfTables vrfTable : staleVrfTables) {
Map<String, Long> staleFibEntMap = new HashMap<>();
for (VrfEntry vrfEntry : vrfTable.getVrfEntry()) {
if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
// Stale marking and cleanup is only meant for the routes learned through BGP.
continue;
}
if (Thread.interrupted()) {
break;
}
totalStaledCount++;
// Create MAP from staleVrfTables.
vrfEntry.getRoutePaths().forEach(routePath -> staleFibEntMap.put(appendNextHopToPrefix(vrfEntry.getDestPrefix(), routePath.getNexthopAddress()), routePath.getLabel()));
}
staledFibEntriesMap.put(vrfTable.getRouteDistinguisher(), staleFibEntMap);
}
} else {
LOG.error("createStaleFibMap:: FIBentries.class is not present");
}
} catch (ReadFailedException e) {
LOG.error("createStaleFibMap:: error ", e);
}
LOG.error("created {} staled entries ", totalStaledCount);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry in project netvirt by opendaylight.
the class BgpUtil method removeVrfEntry.
public void removeVrfEntry(String rd, VrfEntry vrfEntry) {
LOG.debug("removeVrfEntry : vrf {} prefix {}", rd, vrfEntry.getDestPrefix());
InstanceIdentifier<VrfEntry> vrfEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(vrfEntry.getDestPrefix())).build();
delete(vrfEntryId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry in project netvirt by opendaylight.
the class FibDSWriter method addFibEntryToDS.
public synchronized void addFibEntryToDS(String rd, String prefix, List<String> nextHopList, VrfEntry.EncapType encapType, int label, long l3vni, String gatewayMacAddress, RouteOrigin origin) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
return;
}
Preconditions.checkNotNull(nextHopList, "NextHopList can't be null");
for (String nextHop : nextHopList) {
if (nextHop == null || nextHop.isEmpty()) {
LOG.error("nextHop list contains null element");
return;
}
LOG.debug("Created vrfEntry for {} nexthop {} label {}", prefix, nextHop, label);
}
// Looking for existing prefix in MDSAL database
InstanceIdentifier<VrfEntry> vrfEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(prefix)).build();
VrfEntryBuilder vrfEntryBuilder = new VrfEntryBuilder().setDestPrefix(prefix).setOrigin(origin.getValue());
buildVpnEncapSpecificInfo(vrfEntryBuilder, encapType, label, l3vni, gatewayMacAddress, nextHopList);
bgpUtil.update(vrfEntryId, vrfEntryBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry in project netvirt by opendaylight.
the class FibDSWriter method removeFibEntryFromDS.
public synchronized void removeFibEntryFromDS(String rd, String prefix) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
return;
}
LOG.debug("Removing fib entry with destination prefix {} from vrf table for rd {}", prefix, rd);
InstanceIdentifierBuilder<VrfEntry> idBuilder = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(prefix));
InstanceIdentifier<VrfEntry> vrfEntryId = idBuilder.build();
bgpUtil.delete(vrfEntryId);
}
Aggregations