import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.genius.infra.Datastore.Configuration;
+import org.opendaylight.genius.infra.Datastore.Operational;
import org.opendaylight.genius.infra.TypedReadTransaction;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.infra.TypedWriteTransaction;
@Deprecated
void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, WriteTransaction writeConfigTxn);
+ String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx);
void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, TypedWriteTransaction<Configuration> confTx);
+ String intfName, TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx);
@Deprecated
- void removePrefixFromBGP(String primaryRd, String rd, String vpnName, String prefix, String nextHop,
- String tunnelIp, BigInteger dpnId, WriteTransaction writeConfigTxn);
+ void removePrefixFromBGP(String vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
+ String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId, WriteTransaction writeConfigTxn,
+ WriteTransaction writeOperTx);
- void removePrefixFromBGP(String primaryRd, String rd, String vpnName, String prefix, String nextHop,
- String tunnelIp, BigInteger dpnId, TypedWriteTransaction<Configuration> confTx);
+ void removePrefixFromBGP(String vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
+ String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId,
+ TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx);
boolean isVPNConfigured();
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void withdrawAdjacenciesForVpnFromBgp(final InstanceIdentifier<VpnInterfaceOpDataEntry> identifier,
- String vpnName, String interfaceName, WriteTransaction writeConfigTxn) {
+ String vpnName, String interfaceName, WriteTransaction writeConfigTxn,
+ WriteTransaction writeOperTx) {
//Read NextHops
InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
String rd = vpnUtil.getVpnRd(interfaceName);
String allocatedRd = nextHop.getVrfId();
for (String nh : nextHop.getNextHopIpList()) {
deleteExtraRouteFromCurrentAndImportingVpns(
- vpnName, nextHop.getIpAddress(), nh, allocatedRd, interfaceName, writeConfigTxn);
+ vpnName, nextHop.getIpAddress(), nh, allocatedRd, interfaceName, writeConfigTxn,
+ writeOperTx);
}
}
} catch (Exception e) {
} else {
// Interface is retained in the DPN, but its Link Down.
// Only withdraw the prefixes for this interface from BGP
- withdrawAdjacenciesForVpnFromBgp(identifier, vpnName, interfaceName, writeConfigTxn);
+ withdrawAdjacenciesForVpnFromBgp(identifier, vpnName, interfaceName, writeConfigTxn, writeOperTxn);
}
}
//this is an internal vpn - the rd is assigned to the vpn instance name;
//remove from FIB directly
nhList.forEach(removeAdjacencyFromInternalVpn(nextHop, vpnName,
- interfaceName, dpnId, writeConfigTxn));
+ interfaceName, dpnId, writeConfigTxn, writeOperTxn));
} else {
removeAdjacencyFromBgpvpn(nextHop, nhList, vpnName, primaryRd, dpnId, rd,
- interfaceName, writeConfigTxn);
+ interfaceName, writeConfigTxn, writeOperTxn);
}
} else {
LOG.error("removeAdjacenciesFromVpn: nextHop empty for ip {} rd {} adjacencyType {}"
}
}
- private Consumer<String> removeAdjacencyFromInternalVpn(Adjacency nextHop, String vpnName,
- String interfaceName, BigInteger dpnId,
- WriteTransaction writeConfigTxn) {
+ private Consumer<String> removeAdjacencyFromInternalVpn(Adjacency nextHop, String vpnName, String interfaceName,
+ BigInteger dpnId, WriteTransaction writeConfigTxn,
+ WriteTransaction writeOperTx) {
return (nh) -> {
- fibManager.removeOrUpdateFibEntry(vpnName, nextHop.getIpAddress(), nh,
- writeConfigTxn);
+ String primaryRd = vpnUtil.getVpnRd(vpnName);
+ String prefix = nextHop.getIpAddress();
+ String vpnNamePrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
+ LOG.info("remove adjacencies for nexthop {} vpnName {} interfaceName {} dpnId {}",
+ nextHop, vpnName, interfaceName, dpnId);
+ synchronized (vpnNamePrefixKey.intern()) {
+ if (vpnUtil.removeOrUpdateDSForExtraRoute(vpnName, primaryRd, dpnId.toString(), interfaceName,
+ prefix, nextHop.getNextHopIpList().get(0), nh, writeOperTx)) {
+ //If extra-route is present behind at least one VM, then do not remove or update
+ //fib entry for route-path representing that CSS nexthop, just update vpntoextraroute and
+ //prefixtointerface DS
+ return;
+ }
+ fibManager.removeOrUpdateFibEntry(vpnName, nextHop.getIpAddress(), nh,
+ writeConfigTxn);
+ }
LOG.info("removeAdjacenciesFromVpn: removed/updated FIB with rd {} prefix {}"
+ " nexthop {} for interface {} on dpn {} for internal vpn {}",
vpnName, nextHop.getIpAddress(), nh, interfaceName, dpnId, vpnName);
private void removeAdjacencyFromBgpvpn(Adjacency nextHop, List<String> nhList, String vpnName, String primaryRd,
BigInteger dpnId, String rd, String interfaceName,
- WriteTransaction writeConfigTxn) {
+ WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
List<VpnInstanceOpDataEntry> vpnsToImportRoute =
vpnUtil.getVpnsImportingMyRoute(vpnName);
nhList.forEach((nh) -> {
//IRT: remove routes from other vpns importing it
- vpnManager.removePrefixFromBGP(primaryRd, rd, vpnName, nextHop.getIpAddress(),
- nextHop.getNextHopIpList().get(0), nh, dpnId, writeConfigTxn);
+ vpnManager.removePrefixFromBGP(vpnName, primaryRd, rd, interfaceName, nextHop.getIpAddress(),
+ nextHop.getNextHopIpList().get(0), nh, dpnId, writeConfigTxn, writeOperTx);
for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
String vpnRd = vpn.getVrfId();
if (vpnRd != null) {
for (String nh : adj.getNextHopIpList()) {
deleteExtraRouteFromCurrentAndImportingVpns(
currVpnIntf.getVpnInstanceName(), adj.getIpAddress(), nh, rd,
- currVpnIntf.getName(), writeConfigTxn);
+ currVpnIntf.getName(), writeConfigTxn, writeOperTxn);
}
} else if (adj.isPhysNetworkFunc()) {
LOG.info("delAdjFromVpnInterface: deleting PNF adjacency prefix {} subnet {}",
}
private void deleteExtraRouteFromCurrentAndImportingVpns(String vpnName, String destination, String nextHop,
- String rd, String intfName, WriteTransaction writeConfigTxn) {
- vpnManager.delExtraRoute(vpnName, destination, nextHop, rd, vpnName, intfName, writeConfigTxn);
+ String rd, String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
+ vpnManager.delExtraRoute(vpnName, destination, nextHop, rd, vpnName, intfName, writeConfigTxn, writeOperTx);
List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
String vpnRd = vpn.getVrfId();
if (vpnRd != null) {
- vpnManager.delExtraRoute(vpnName, destination, nextHop, vpnRd, vpnName, intfName, writeConfigTxn);
+ vpnManager.delExtraRoute(vpnName, destination, nextHop, vpnRd, vpnName, intfName, writeConfigTxn,
+ writeOperTx);
}
}
}
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.infra.Datastore.Configuration;
+import org.opendaylight.genius.infra.Datastore.Operational;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TransactionAdapter;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.FlowEntity;
-import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.genius.mdsalutil.MetaDataUtil;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.UpgradeState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.SubnetsAssociatedToRouteTargets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTarget;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.RouteTargetKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.subnets.associated.to.route.targets.route.target.AssociatedSubnet;
@Override
public void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, TypedWriteTransaction<Configuration> confTx) {
+ String intfName, TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx) {
delExtraRoute(vpnName, destination, nextHop, rd, routerID, intfName,
- TransactionAdapter.toWriteTransaction(confTx));
+ TransactionAdapter.toWriteTransaction(confTx), TransactionAdapter.toWriteTransaction(operTx));
}
@Override
public void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, WriteTransaction writeConfigTxn) {
+ String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
if (writeConfigTxn == null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- delExtraRoute(vpnName, destination, nextHop, rd, routerID, intfName, tx)),
- LOG, "Error deleting extra route");
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ delExtraRoute(vpnName, destination, nextHop, rd, routerID, intfName, tx, writeOperTx);
+ }), LOG, "Error deleting extra route");
+ return;
+ }
+ if (writeOperTx == null) {
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ delExtraRoute(vpnName, destination, nextHop, rd, routerID, intfName, writeConfigTxn, tx);
+ }), LOG, "Error deleting extra route");
return;
}
BigInteger dpnId = null;
}
if (rd != null) {
String primaryRd = vpnUtil.getVpnRd(vpnName);
- removePrefixFromBGP(primaryRd, rd, vpnName, destination, nextHop, tunnelIp, dpnId, writeConfigTxn);
+ removePrefixFromBGP(vpnName, primaryRd, rd, intfName, destination, nextHop, tunnelIp, dpnId,
+ writeConfigTxn, writeOperTx);
LOG.info("delExtraRoute: Removed extra route {} from interface {} for rd {}", destination, intfName, rd);
} else {
// add FIB route directly
}
@Override
- public void removePrefixFromBGP(String primaryRd, String rd, String vpnName, String prefix, String nextHop,
- String tunnelIp, BigInteger dpnId, TypedWriteTransaction<Configuration> confTx) {
- removePrefixFromBGP(primaryRd, rd, vpnName, prefix, nextHop, tunnelIp, dpnId,
- TransactionAdapter.toWriteTransaction(confTx));
+ public void removePrefixFromBGP(String vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
+ String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId,
+ TypedWriteTransaction<Configuration> confTx,
+ TypedWriteTransaction<Operational> operTx) {
+ removePrefixFromBGP(vpnName, primaryRd, extraRouteRd, vpnInterfaceName, prefix, nextHop, nextHopTunnelIp,
+ dpnId, TransactionAdapter.toWriteTransaction(confTx), TransactionAdapter.toWriteTransaction(operTx));
}
// TODO Clean up the exception handling
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
- public void removePrefixFromBGP(String primaryRd, String rd, String vpnName, String prefix, String nextHop,
- String tunnelIp, BigInteger dpnId, WriteTransaction writeConfigTxn) {
+ public void removePrefixFromBGP(String vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
+ String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId, WriteTransaction writeConfigTxn,
+ WriteTransaction writeOperTx) {
try {
- LOG.info("removePrefixFromBGP: VPN WITHDRAW: Removing Fib Entry rd {} prefix {} nexthop {}", rd, prefix,
- nextHop);
String vpnNamePrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
synchronized (vpnNamePrefixKey.intern()) {
- Optional<Routes> optVpnExtraRoutes = VpnExtraRouteHelper
- .getVpnExtraroutes(dataBroker, vpnName, rd, prefix);
- if (optVpnExtraRoutes.isPresent()) {
- List<String> nhList = optVpnExtraRoutes.get().getNexthopIpList();
- if (nhList != null && nhList.size() > 1) {
- // If nhList is more than 1, just update vpntoextraroute and prefixtointerface DS
- // For other cases, remove the corresponding tep ip from fibentry and withdraw prefix
- nhList.remove(nextHop);
- vpnUtil.syncWrite(LogicalDatastoreType.OPERATIONAL,
- VpnExtraRouteHelper.getVpnToExtrarouteVrfIdIdentifier(vpnName, rd, prefix),
- VpnUtil.getVpnToExtraroute(prefix, nhList));
- MDSALUtil.syncDelete(dataBroker,
- LogicalDatastoreType.CONFIGURATION, VpnExtraRouteHelper.getUsedRdsIdentifier(
- vpnUtil.getVpnId(vpnName), prefix, nextHop));
- LOG.debug("removePrefixFromBGP: Removed vpn-to-extraroute with rd {} prefix {} nexthop {}",
- rd, prefix, nextHop);
- fibManager.refreshVrfEntry(primaryRd, prefix);
- long vpnId = vpnUtil.getVpnId(vpnName);
- Optional<Prefixes> prefixToInterface = vpnUtil.getPrefixToInterface(vpnId, nextHop);
- if (prefixToInterface.isPresent()) {
- writeConfigTxn.delete(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getAdjacencyIdentifier(prefixToInterface.get().getVpnInterfaceName(),
- prefix));
- }
- LOG.info("VPN WITHDRAW: removePrefixFromBGP: Removed Fib Entry rd {} prefix {} nexthop {}",
- rd, prefix, tunnelIp);
- return;
- }
+ if (vpnUtil.removeOrUpdateDSForExtraRoute(vpnName, primaryRd, extraRouteRd, vpnInterfaceName, prefix,
+ nextHop, nextHopTunnelIp, writeOperTx)) {
+ return;
}
- fibManager.removeOrUpdateFibEntry(primaryRd, prefix, tunnelIp, writeConfigTxn);
- if (VpnUtil.isEligibleForBgp(primaryRd, vpnName, dpnId, null /*networkName*/)) {
+ fibManager.removeOrUpdateFibEntry(primaryRd, prefix, nextHopTunnelIp, writeConfigTxn);
+ if (VpnUtil.isEligibleForBgp(extraRouteRd, vpnName, dpnId, null /*networkName*/)) {
// TODO: Might be needed to include nextHop here
- bgpManager.withdrawPrefix(rd, prefix);
+ bgpManager.withdrawPrefix(extraRouteRd, prefix);
}
}
- LOG.info("removePrefixFromBGP: VPN WITHDRAW: Removed Fib Entry rd {} prefix {} nexthop {}", rd, prefix,
- nextHop);
+ LOG.info("removePrefixFromBGP: VPN WITHDRAW: Removed Fib Entry rd {} prefix {} nexthop {}", extraRouteRd,
+ prefix, nextHop);
} catch (RuntimeException e) {
- LOG.error("removePrefixFromBGP: Delete prefix {} rd {} nextHop {} failed", prefix, rd, nextHop);
+ LOG.error("removePrefixFromBGP: Delete prefix {} rd {} nextHop {} failed", prefix, extraRouteRd, nextHop);
}
}
bgpManager.withdrawPrefix(vpnRd, destination);
} else {
vpnManager.delExtraRoute(vpnInstanceName, destination,
- nexthop, vpnRd, null /* routerId */, null /* intfName */, (WriteTransaction) null);
+ nexthop, vpnRd, null /* routerId */, null /* intfName */, (WriteTransaction) null,
+ (WriteTransaction) null);
}
result.set(RpcResultBuilder.success(new RemoveStaticRouteOutputBuilder().build()).build());
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.genius.infra.Datastore;
import org.opendaylight.genius.infra.Datastore.Configuration;
+import org.opendaylight.genius.infra.Datastore.Operational;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TypedReadTransaction;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.netvirt.fibmanager.api.FibHelper;
+import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
import org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice;
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
private final DataBroker dataBroker;
private final IdManagerService idManager;
+ private final IFibManager fibManager;
private final IBgpManager bgpManager;
private final LockManagerService lockManager;
private final INeutronVpnManager neutronVpnService;
}
}
- public VpnUtil(DataBroker dataBroker, IdManagerService idManager, IBgpManager bgpManager,
- LockManagerService lockManager, INeutronVpnManager neutronVpnService,
- IMdsalApiManager mdsalManager, JobCoordinator jobCoordinator,
- IInterfaceManager interfaceManager, OdlInterfaceRpcService ifmRpcService) {
+ public VpnUtil(DataBroker dataBroker, IdManagerService idManager, IFibManager fibManager,
+ IBgpManager bgpManager, LockManagerService lockManager, INeutronVpnManager neutronVpnService,
+ IMdsalApiManager mdsalManager, JobCoordinator jobCoordinator, IInterfaceManager interfaceManager,
+ OdlInterfaceRpcService ifmRpcService) {
this.dataBroker = dataBroker;
this.idManager = idManager;
+ this.fibManager = fibManager;
this.bgpManager = bgpManager;
this.lockManager = lockManager;
this.neutronVpnService = neutronVpnService;
});
}
+ public boolean removeOrUpdateDSForExtraRoute(String vpnName, String primaryRd, String extraRouteRd,
+ String vpnInterfaceName, String prefix, String nextHop,
+ String nextHopTunnelIp, WriteTransaction operTx) {
+ LOG.info("removeOrUpdateDSForExtraRoute: VPN WITHDRAW: Removing Fib Entry rd {} prefix {} nexthop {}",
+ extraRouteRd, prefix, nextHop);
+ boolean areNextHopsClearedForRd = false;
+ Optional<Routes> optVpnExtraRoutes = VpnExtraRouteHelper
+ .getVpnExtraroutes(dataBroker, vpnName, extraRouteRd, prefix);
+ if (optVpnExtraRoutes.isPresent()) {
+ List<String> nhList = optVpnExtraRoutes.get().getNexthopIpList();
+ if (nhList != null && nhList.size() > 1) {
+ // If nhList is more than 1, just update vpntoextraroute and prefixtointerface DS
+ // For other cases, remove the corresponding tep ip from fibentry and withdraw prefix
+ nhList.remove(nextHop);
+ syncWrite(LogicalDatastoreType.OPERATIONAL,
+ VpnExtraRouteHelper.getVpnToExtrarouteVrfIdIdentifier(vpnName, extraRouteRd, prefix),
+ VpnUtil.getVpnToExtraroute(prefix, nhList));
+ MDSALUtil.syncDelete(dataBroker,
+ LogicalDatastoreType.CONFIGURATION, VpnExtraRouteHelper.getUsedRdsIdentifier(getVpnId(vpnName),
+ prefix, nextHop));
+ LOG.debug("removeOrUpdateDSForExtraRoute: Removed vpn-to-extraroute with rd {} prefix {} nexthop {}",
+ extraRouteRd, prefix, nextHop);
+ fibManager.refreshVrfEntry(primaryRd, prefix);
+ operTx.delete(LogicalDatastoreType.OPERATIONAL, VpnUtil
+ .getVpnInterfaceOpDataEntryAdjacencyIdentifier(vpnInterfaceName, vpnName, prefix));
+ LOG.info("VPN WITHDRAW: removeOrUpdateDSForExtraRoute: Removed Fib Entry rd {} prefix {} nexthop {}",
+ extraRouteRd, prefix, nextHopTunnelIp);
+ areNextHopsClearedForRd = true;
+ }
+ }
+ return areNextHopsClearedForRd;
+ }
+
static org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance
getVpnInstanceToVpnId(String vpnName, long vpnId, String rd) {
return new VpnInstanceBuilder().setVpnId(vpnId).setVpnInstanceName(vpnName).setVrfId(rd).build();
}
static void removePrefixToInterfaceForVpnId(long vpnId,
- @Nonnull TypedWriteTransaction<Datastore.Operational> operTx) {
+ @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up PrefixToInterface Operational DS
operTx.delete(InstanceIdentifier.builder(
PrefixToInterface.class).child(VpnIds.class, new VpnIdsKey(vpnId)).build());
}
static void removeVpnExtraRouteForVpn(String vpnName,
- @Nonnull TypedWriteTransaction<Datastore.Operational> operTx) {
+ @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up VPNExtraRoutes Operational DS
operTx.delete(InstanceIdentifier.builder(VpnToExtraroutes.class).child(Vpn.class, new VpnKey(vpnName)).build());
}
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
static void removeVpnOpInstance(String vpnName,
- @Nonnull TypedWriteTransaction<Datastore.Operational> operTx) {
+ @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up VPNInstanceOpDataEntry
operTx.delete(getVpnInstanceOpDataIdentifier(vpnName));
}
}
static void removeL3nexthopForVpnId(long vpnId,
- @Nonnull TypedWriteTransaction<Datastore.Operational> operTx) {
+ @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up L3NextHop Operational DS
operTx.delete(InstanceIdentifier.builder(L3nexthop.class).child(
VpnNexthops.class, new VpnNexthopsKey(vpnId)).build());
}
- void scheduleVpnInterfaceForRemoval(String interfaceName, BigInteger dpnId,
- String vpnInstanceName,
- TypedWriteTransaction<Datastore.Operational> writeOperTxn) {
+ void scheduleVpnInterfaceForRemoval(String interfaceName, BigInteger dpnId, String vpnInstanceName,
+ TypedWriteTransaction<Operational> writeOperTxn) {
InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnInstanceName);
VpnInterfaceOpDataEntry interfaceToUpdate =
}
void createLearntVpnVipToPort(String vpnName, String fixedIp, String
- portName, String macAddress, TypedWriteTransaction<Datastore.Operational> writeOperTxn) {
+ portName, String macAddress, TypedWriteTransaction<Operational> writeOperTxn) {
synchronized ((vpnName + fixedIp).intern()) {
InstanceIdentifier<LearntVpnVipToPort> id = buildLearntVpnVipToPortIdentifier(vpnName, fixedIp);
LearntVpnVipToPortBuilder builder =
}
void removeLearntVpnVipToPort(String vpnName, String fixedIp,
- TypedWriteTransaction<Datastore.Operational> writeOperTxn) {
+ TypedWriteTransaction<Operational> writeOperTxn) {
synchronized ((vpnName + fixedIp).intern()) {
InstanceIdentifier<LearntVpnVipToPort> id = buildLearntVpnVipToPortIdentifier(vpnName, fixedIp);
if (writeOperTxn != null) {
public void createLearntVpnVipToPortEvent(String vpnName, String srcIp, String destIP, String portName,
String macAddress, LearntVpnVipToPortEventAction action,
- TypedWriteTransaction<Datastore.Operational> writeOperTxn) {
+ TypedWriteTransaction<Operational> writeOperTxn) {
String eventId = MicroTimestamp.INSTANCE.get();
InstanceIdentifier<LearntVpnVipToPortEvent> id = buildLearntVpnVipToPortEventIdentifier(eventId);
return id;
}
- void removeLearntVpnVipToPortEvent(String eventId, TypedWriteTransaction<Datastore.Operational> writeOperTxn) {
+ void removeLearntVpnVipToPortEvent(String eventId, TypedWriteTransaction<Operational> writeOperTxn) {
InstanceIdentifier<LearntVpnVipToPortEvent> id = buildLearntVpnVipToPortEventIdentifier(eventId);
if (writeOperTxn != null) {
writeOperTxn.delete(id);
.augmentation(Adjacencies.class).child(Adjacency.class, new AdjacencyKey(ipAddress)).build();
}
+ static InstanceIdentifier<Adjacency> getVpnInterfaceOpDataEntryAdjacencyIdentifier(String intfName, String vpnName,
+ String ipAddress) {
+ return InstanceIdentifier.builder(VpnInterfaceOpData.class)
+ .child(VpnInterfaceOpDataEntry.class, new VpnInterfaceOpDataEntryKey(intfName, vpnName))
+ .augmentation(AdjacenciesOp.class).child(Adjacency.class, new AdjacencyKey(ipAddress)).build();
+ }
+
public static List<String> getIpsListFromExternalIps(List<ExternalIps> externalIps) {
if (externalIps == null) {
return Collections.emptyList();
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
+import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
import org.opendaylight.netvirt.vpnmanager.VpnOperDsUtils;
import org.opendaylight.netvirt.vpnmanager.VpnUtil;
@Mock
IdManagerService idManager;
@Mock
+ IFibManager fibManager;
+ @Mock
IBgpManager bgpManager;
@Mock
LockManagerService lockManager;
dataBroker = getDataBroker();
- vpnUtil = new VpnUtil(dataBroker, idManager, bgpManager, lockManager, neutronVpnService, mdsalManager,
- jobCoordinator, interfaceManager, ifmRpcService);
+ vpnUtil = new VpnUtil(dataBroker, idManager, fibManager, bgpManager, lockManager, neutronVpnService,
+ mdsalManager, jobCoordinator, interfaceManager, ifmRpcService);
// Creating both empty containers: InterVpnLinks and InterVpnLinkStates
WriteTransaction writeTx = dataBroker.newWriteOnlyTransaction();