use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey in project netvirt by opendaylight.
the class BgpRouteVrfEntryHandler method deleteRemoteRoute.
public void deleteRemoteRoute(final BigInteger localDpnId, final BigInteger remoteDpnId, final long vpnId, final VrfTablesKey vrfTableKey, final VrfEntry vrfEntry, Optional<Routes> extraRouteOptional, WriteTransaction tx, List<SubTransaction> subTxns) {
Boolean wrTxPresent = true;
if (tx == null) {
wrTxPresent = false;
tx = dataBroker.newWriteOnlyTransaction();
}
LOG.debug("deleting remote route: prefix={}, vpnId={} localDpnId {} remoteDpnId {}", vrfEntry.getDestPrefix(), vpnId, localDpnId, remoteDpnId);
String rd = vrfTableKey.getRouteDistinguisher();
if (localDpnId != null && localDpnId != BigInteger.ZERO) {
// localDpnId is not known when clean up happens for last vm for a vpn on a dpn
if (extraRouteOptional.isPresent()) {
nexthopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
false);
}
deleteFibEntryForBgpRoutes(remoteDpnId, vpnId, vrfEntry, rd, tx, subTxns);
return;
}
// below two reads are kept as is, until best way is found to identify dpnID
VpnNexthop localNextHopInfo = nexthopManager.getVpnNexthop(vpnId, vrfEntry.getDestPrefix());
if (extraRouteOptional.isPresent()) {
nexthopManager.setupLoadBalancingNextHop(vpnId, remoteDpnId, vrfEntry.getDestPrefix(), Collections.emptyList(), /*listBucketInfo*/
false);
} else {
checkDpnDeleteFibEntry(localNextHopInfo, remoteDpnId, vpnId, vrfEntry, rd, tx, subTxns);
}
if (!wrTxPresent) {
tx.submit();
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey in project netvirt by opendaylight.
the class EvpnVrfEntryHandler method deleteRemoteEvpnFlows.
private void deleteRemoteEvpnFlows(String rd, VrfEntry vrfEntry, VpnInstanceOpDataEntry vpnInstance, VrfTablesKey vrfTableKey, List<BigInteger> localDpnIdList) {
List<VpnToDpnList> vpnToDpnList = vpnInstance.getVpnToDpnList();
List<SubTransaction> subTxns = new ArrayList<>();
if (vpnToDpnList != null) {
jobCoordinator.enqueueJob("FIB" + rd + vrfEntry.getDestPrefix(), () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
final Optional<Routes> extraRouteOptional = Optional.absent();
if (localDpnIdList.size() <= 0) {
for (VpnToDpnList curDpn1 : vpnToDpnList) {
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
if (curDpn1.getDpnState() == VpnToDpnList.DpnState.Active) {
bgpRouteVrfEntryHandler.deleteRemoteRoute(BigInteger.ZERO, curDpn1.getDpnId(), vpnInstance.getVpnId(), vrfTableKey, vrfEntry, extraRouteOptional, tx, subTxns);
}
} else {
deleteRemoteRoute(BigInteger.ZERO, curDpn1.getDpnId(), vpnInstance.getVpnId(), vrfTableKey, vrfEntry, extraRouteOptional, tx);
}
}
} else {
for (BigInteger localDpnId : localDpnIdList) {
for (VpnToDpnList curDpn2 : vpnToDpnList) {
if (!curDpn2.getDpnId().equals(localDpnId)) {
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
if (curDpn2.getDpnState() == VpnToDpnList.DpnState.Active) {
bgpRouteVrfEntryHandler.deleteRemoteRoute(localDpnId, curDpn2.getDpnId(), vpnInstance.getVpnId(), vrfTableKey, vrfEntry, extraRouteOptional, tx, subTxns);
}
} else {
deleteRemoteRoute(localDpnId, curDpn2.getDpnId(), vpnInstance.getVpnId(), vrfTableKey, vrfEntry, extraRouteOptional, tx);
}
}
}
}
}
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(tx.submit());
return futures;
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey in project netvirt by opendaylight.
the class EvpnVrfEntryHandler method removeFlows.
@Override
public void removeFlows(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
final VrfTablesKey vrfTableKey = identifier.firstKeyOf(VrfTables.class);
final VpnInstanceOpDataEntry vpnInstance = getFibUtil().getVpnInstanceOpData(vrfTableKey.getRouteDistinguisher()).get();
if (vpnInstance == null) {
LOG.error("VPN Instance for rd {} is not available from VPN Op Instance Datastore", rd);
return;
}
VpnNexthop localNextHopInfo = nexthopManager.getVpnNexthop(vpnInstance.getVpnId(), vrfEntry.getDestPrefix());
List<BigInteger> localDpnId = checkDeleteLocalEvpnFLows(vpnInstance.getVpnId(), rd, vrfEntry, localNextHopInfo);
deleteRemoteEvpnFlows(rd, vrfEntry, vpnInstance, vrfTableKey, localDpnId);
vrfEntryListener.cleanUpOpDataForFib(vpnInstance.getVpnId(), rd, vrfEntry);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey in project netvirt by opendaylight.
the class EvpnTestHelper method deleteMacVrfEntryToDS.
public void deleteMacVrfEntryToDS(String rd, String macAddress) throws TransactionCommitFailedException {
InstanceIdentifier<MacVrfEntry> macEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(MacVrfEntry.class, new MacVrfEntryKey(macAddress)).build();
singleTxdataBroker.syncDelete(LogicalDatastoreType.CONFIGURATION, macEntryId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey in project netvirt by opendaylight.
the class EvpnTestHelper method addMacVrfEntryToDS.
public void addMacVrfEntryToDS(String rd, String macAddress, String prefix, List<String> nextHopList, VrfEntry.EncapType encapType, long l2vni, String gatewayMacAddress, RouteOrigin origin) throws TransactionCommitFailedException {
MacVrfEntryBuilder macEntryBuilder = new MacVrfEntryBuilder().setOrigin(origin.getValue());
buildVpnEncapSpecificInfo(macEntryBuilder, encapType, l2vni, macAddress, gatewayMacAddress, nextHopList);
macEntryBuilder.setMac(macAddress);
macEntryBuilder.setDestPrefix(prefix);
InstanceIdentifier<MacVrfEntry> macEntryId = InstanceIdentifier.builder(FibEntries.class).child(VrfTables.class, new VrfTablesKey(rd)).child(MacVrfEntry.class, new MacVrfEntryKey(macAddress)).build();
singleTxdataBroker.syncWrite(LogicalDatastoreType.CONFIGURATION, macEntryId, macEntryBuilder.build());
}
Aggregations