import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.genius.infra.Datastore;
+import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface;
void addOrUpdateFibEntry(String rd, String macAddress, String prefix, List<String> nextHopList,
VrfEntry.EncapType encapType, long label, long l3vni, String gwMacAddress,
- String parentVpnRd, RouteOrigin origin, WriteTransaction writeConfigTxn);
+ String parentVpnRd, RouteOrigin origin,
+ TypedWriteTransaction<Configuration> writeConfigTxn);
void addFibEntryForRouterInterface(String rd, String prefix,
- RouterInterface routerInterface, long label, WriteTransaction writeConfigTxn);
+ RouterInterface routerInterface, long label,
+ TypedWriteTransaction<Configuration> writeConfigTxn);
void removeOrUpdateFibEntry(String rd, String prefix, String nextHopToRemove,
- WriteTransaction writeConfigTxn);
+ TypedWriteTransaction<Configuration> writeConfigTxn);
- void removeFibEntry(String rd, String prefix, WriteTransaction writeConfigTxn);
+ void removeFibEntry(String rd, String prefix, TypedWriteTransaction<Configuration> writeConfigTxn);
void updateRoutePathForFibEntry(String rd, String prefix, String nextHop,
long label, boolean nextHopAdd, WriteTransaction writeConfigTxn);
void addVrfTable(String rd, WriteTransaction writeConfigTxn);
- void removeVrfTable(String rd, TypedWriteTransaction<Datastore.Configuration> writeConfigTxn);
+ void removeVrfTable(String rd, TypedWriteTransaction<Configuration> writeConfigTxn);
void removeInterVPNLinkRouteFlows(String interVpnLinkName,
boolean isVpnFirstEndPoint,
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.genius.infra.Datastore;
+import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
public void addOrUpdateFibEntry(String rd, String macAddress, String prefix,
List<String> nextHopList, VrfEntry.EncapType encapType, long label,
long l3vni, String gwMacAddress, String parentVpnRd, RouteOrigin origin,
- WriteTransaction writeConfigTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn) {
fibUtil.addOrUpdateFibEntry(rd, macAddress, prefix, nextHopList , encapType, label, l3vni, gwMacAddress,
parentVpnRd, origin, writeConfigTxn);
}
@Override
public void addFibEntryForRouterInterface(String rd, String prefix,
RouterInterface routerInterface, long label,
- WriteTransaction writeConfigTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn) {
fibUtil.addFibEntryForRouterInterface(rd, prefix, routerInterface, label, writeConfigTxn);
}
@Override
public void removeOrUpdateFibEntry(String rd, String prefix,
- String nextHopToRemove, WriteTransaction writeConfigTxn) {
+ String nextHopToRemove, TypedWriteTransaction<Configuration> writeConfigTxn) {
fibUtil.removeOrUpdateFibEntry(rd, prefix, nextHopToRemove, writeConfigTxn);
}
@Override
- public void removeFibEntry(String rd, String prefix, WriteTransaction writeConfigTxn) {
+ public void removeFibEntry(String rd, String prefix, TypedWriteTransaction<Configuration> writeConfigTxn) {
fibUtil.removeFibEntry(rd, prefix, writeConfigTxn);
}
}
@Override
- public void removeVrfTable(String rd, TypedWriteTransaction<Datastore.Configuration> writeConfigTxn) {
+ public void removeVrfTable(String rd, TypedWriteTransaction<Configuration> writeConfigTxn) {
fibUtil.removeVrfTable(rd, writeConfigTxn);
}
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
@SuppressWarnings("checkstyle:IllegalCatch")
public void addOrUpdateFibEntry(String rd, String macAddress, String prefix, List<String> nextHopList,
VrfEntry.EncapType encapType, long label, long l3vni, String gwMacAddress, String parentVpnRd,
- RouteOrigin origin, WriteTransaction writeConfigTxn) {
+ RouteOrigin origin, TypedWriteTransaction<Configuration> writeConfigTxn) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
return;
@SuppressWarnings("checkstyle:IllegalCatch")
public void writeFibEntryToDs(InstanceIdentifier<VrfEntry> vrfEntryId, String prefix, List<String> nextHopList,
long label, Long l3vni, VrfEntry.EncapType encapType, RouteOrigin origin, String macAddress,
- String gatewayMacAddress, String parentVpnRd, WriteTransaction writeConfigTxn) {
+ String gatewayMacAddress, String parentVpnRd, TypedWriteTransaction<Configuration> writeConfigTxn) {
VrfEntryBuilder vrfEntryBuilder = new VrfEntryBuilder().setDestPrefix(prefix).setOrigin(origin.getValue());
if (parentVpnRd != null) {
vrfEntryBuilder.setParentVpnRd(parentVpnRd);
}
buildVpnEncapSpecificInfo(vrfEntryBuilder, encapType, label, l3vni, macAddress, gatewayMacAddress, nextHopList);
if (writeConfigTxn != null) {
- writeConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntryBuilder.build(), true);
+ writeConfigTxn.merge(vrfEntryId, vrfEntryBuilder.build(), CREATE_MISSING_PARENTS);
} else {
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntryBuilder.build());
}
@SuppressWarnings("checkstyle:IllegalCatch")
public void addFibEntryForRouterInterface(String rd, String prefix, RouterInterface routerInterface, long label,
- WriteTransaction writeConfigTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
return;
.addAugmentation(RouterInterface.class, routerInterface).build();
if (writeConfigTxn != null) {
- writeConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntry, true);
+ writeConfigTxn.merge(vrfEntryId, vrfEntry, CREATE_MISSING_PARENTS);
} else {
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfEntryId, vrfEntry);
}
builder.setRoutePaths(routePaths);
}
- public void removeFibEntry(String rd, String prefix, WriteTransaction writeConfigTxn) {
+ public void removeFibEntry(String rd, String prefix, TypedWriteTransaction<Configuration> writeConfigTxn) {
if (rd == null || rd.isEmpty()) {
LOG.error("Prefix {} not associated with vpn", prefix);
.child(VrfTables.class, new VrfTablesKey(rd)).child(VrfEntry.class, new VrfEntryKey(prefix));
InstanceIdentifier<VrfEntry> vrfEntryId = idBuilder.build();
if (writeConfigTxn != null) {
- writeConfigTxn.delete(LogicalDatastoreType.CONFIGURATION, vrfEntryId);
+ writeConfigTxn.delete(vrfEntryId);
} else {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfEntryId);
}
* If null or empty, then the whole VrfEntry is removed
*/
public void removeOrUpdateFibEntry(String rd, String prefix, String nextHopToRemove,
- WriteTransaction writeConfigTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn) {
LOG.debug("Removing fib entry with destination prefix {} from vrf table for rd {} nextHop {}", prefix, rd,
nextHopToRemove);
if (routePaths.size() == 1) {
// Remove the whole entry
if (writeConfigTxn != null) {
- writeConfigTxn.delete(LogicalDatastoreType.CONFIGURATION, vrfEntryId);
+ writeConfigTxn.delete(vrfEntryId);
} else {
MDSALUtil.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, vrfEntryId);
}
RoutePaths routePaths = FibHelper.buildRoutePath(nextHop, label);
if (writeConfigTxn != null) {
writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, routePathId, routePaths,
- WriteTransaction.CREATE_MISSING_PARENTS);
+ CREATE_MISSING_PARENTS);
} else {
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION, routePathId, routePaths);
}
import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
-import org.opendaylight.genius.infra.TransactionAdapter;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
removeFlow(confTx, dpnId, NwConstants.L3_FIB_TABLE, flowRef);
String rd = NatUtil.getVpnRd(dataBroker, subNetId);
String ipPrefix = externalIp + "/32";
- fibManager.removeFibEntry(rd, ipPrefix, TransactionAdapter.toWriteTransaction(confTx));
+ fibManager.removeFibEntry(rd, ipPrefix, confTx);
NatUtil.deletePrefixToInterface(dataBroker, NatUtil.getVpnId(dataBroker, subNetId), ipPrefix);
}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.genius.infra.Datastore.Configuration;
-import org.opendaylight.genius.infra.TransactionAdapter;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
fibManager.addOrUpdateFibEntry(rd, null /*macAddress*/, prefix,
Collections.singletonList(nextHopIp), VrfEntry.EncapType.Vxlan, NatConstants.DEFAULT_LABEL_VALUE,
- l3Vni, gwMacAddress, null /* parent-vpn-rd */, origin, TransactionAdapter.toWriteTransaction(writeTx));
+ l3Vni, gwMacAddress, null /* parent-vpn-rd */, origin, writeTx);
/* Publish to Bgp only if its an INTERNET VPN */
if (rd != null && !rd.equalsIgnoreCase(vpnName)) {
bgpManager.advertisePrefix(rd, null /*macAddress*/, prefix, Collections.singletonList(nextHopIp),
import java.util.concurrent.ExecutionException;
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;
public interface IVpnManager {
- @Deprecated
- void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- Long l3vni, RouteOrigin origin, String intfName, Adjacency operationalAdj,
- VrfEntry.EncapType encapType, WriteTransaction writeConfigTxn);
-
void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
Long l3vni, RouteOrigin origin, String intfName, Adjacency operationalAdj,
VrfEntry.EncapType encapType, TypedWriteTransaction<Configuration> confTx);
- @Deprecated
- void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx);
-
void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
String intfName, TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx);
- @Deprecated
- 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 vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
- String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId,
- TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx);
+ String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId,
+ TypedWriteTransaction<Configuration> confTx,
+ TypedWriteTransaction<Operational> operTx);
boolean isVPNConfigured();
String getPrimaryRdFromVpnInstance(VpnInstance vpnInstance);
- @Deprecated
- void addSubnetMacIntoVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
- BigInteger dpnId, WriteTransaction tx) throws ExecutionException, InterruptedException;
-
void addSubnetMacIntoVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
BigInteger dpnId, TypedWriteTransaction<Configuration> confTx) throws ExecutionException, InterruptedException;
- @Deprecated
- void removeSubnetMacFromVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
- BigInteger dpnId, WriteTransaction tx) throws ExecutionException, InterruptedException;
-
void removeSubnetMacFromVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
BigInteger dpnId, TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException;
- @Deprecated
- void addRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
- String subnetVpnName, WriteTransaction writeTx) throws ExecutionException, InterruptedException;
-
void addRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
String subnetVpnName, TypedWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException;
- @Deprecated
- void removeRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
- String subnetVpnName, WriteTransaction writeTx) throws ExecutionException, InterruptedException;
-
void removeRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
String subnetVpnName, TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException;
- @Deprecated
- void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress,
- BigInteger dpnId, Uuid extNetworkId, WriteTransaction writeTx);
-
void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress,
BigInteger dpnId, Uuid extNetworkId);
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import java.math.BigInteger;
import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
+import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
+import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
@Override
protected void remove(InstanceIdentifier<RouterToNaptSwitch> key, RouterToNaptSwitch routerToNaptSwitch) {
LOG.debug("Removing {}", routerToNaptSwitch);
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- setupRouterGwFlows(routerToNaptSwitch, tx, NwConstants.DEL_FLOW)), LOG,
- "Error processing switch removal for {}", routerToNaptSwitch);
+ ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx ->
+ setupRouterGwFlows(routerToNaptSwitch, tx, NwConstants.DEL_FLOW)), LOG,
+ "Error processing switch removal for {}", routerToNaptSwitch);
}
@Override
LOG.debug("Updating old {} new {}", origRouterToNaptSwitch, updatedRouterToNaptSwitch);
if (!Objects.equals(updatedRouterToNaptSwitch.getPrimarySwitchId(),
origRouterToNaptSwitch.getPrimarySwitchId())) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> {
setupRouterGwFlows(origRouterToNaptSwitch, tx, NwConstants.DEL_FLOW);
setupRouterGwFlows(updatedRouterToNaptSwitch, tx, NwConstants.ADD_FLOW);
}), LOG, "Error updating switch {} to {}", origRouterToNaptSwitch, updatedRouterToNaptSwitch);
@Override
protected void add(InstanceIdentifier<RouterToNaptSwitch> key, RouterToNaptSwitch routerToNaptSwitch) {
LOG.debug("Adding {}", routerToNaptSwitch);
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
+ ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx ->
setupRouterGwFlows(routerToNaptSwitch, tx, NwConstants.ADD_FLOW)), LOG,
"Error processing switch addition for {}", routerToNaptSwitch);
}
return this;
}
- private void setupRouterGwFlows(RouterToNaptSwitch routerToNaptSwitch, WriteTransaction writeTx, int addOrRemove)
- throws ExecutionException, InterruptedException {
+ private void setupRouterGwFlows(RouterToNaptSwitch routerToNaptSwitch,
+ TypedReadWriteTransaction<Configuration> confTx, int addOrRemove)
+ throws ExecutionException, InterruptedException {
Routers router = null;
if (addOrRemove == NwConstants.ADD_FLOW) {
router = vpnUtil.getExternalRouter(routerToNaptSwitch.getRouterName());
Uuid subnetVpnName = extIp.getSubnetId();
if (addOrRemove == NwConstants.ADD_FLOW) {
vpnManager.addRouterGwMacFlow(routerName, extGwMacAddress, primarySwitchId, extNetworkId,
- subnetVpnName.getValue(), writeTx);
+ subnetVpnName.getValue(), confTx);
externalRouterDataUtil.addtoRouterMap(router);
} else {
vpnManager.removeRouterGwMacFlow(routerName, extGwMacAddress, primarySwitchId, extNetworkId,
- subnetVpnName.getValue(), writeTx);
+ subnetVpnName.getValue(), confTx);
externalRouterDataUtil.removeFromRouterMap(router);
}
}
if (addOrRemove == NwConstants.ADD_FLOW) {
vpnManager.addArpResponderFlowsToExternalNetworkIps(routerName,
VpnUtil.getIpsListFromExternalIps(router.getExternalIps()),
- extGwMacAddress, primarySwitchId, extNetworkId, writeTx);
+ extGwMacAddress, primarySwitchId, extNetworkId);
} else {
vpnManager.removeArpResponderFlowsToExternalNetworkIps(routerName,
VpnUtil.getIpsListFromExternalIps(router.getExternalIps()),
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.base.Optional;
import java.math.BigInteger;
import java.util.Collection;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+import org.opendaylight.genius.infra.Datastore.Operational;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.netvirt.vpnmanager.api.VpnHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AddDpnEvent;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AddInterfaceToDpnOnVpnEvent;
}
if (flushDpnsOnVpn) {
try {
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> deleteDpn(vpnToDpnList, rd, tx))
- .get();
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL,
+ tx -> deleteDpn(vpnToDpnList, rd, tx)).get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error removing dpnToVpnList for vpn {} ", vpnName);
throw new RuntimeException(e.getMessage(), e);
}
}
- protected void deleteDpn(Collection<VpnToDpnList> vpnToDpnList, String rd, WriteTransaction writeTxn) {
+ protected void deleteDpn(Collection<VpnToDpnList> vpnToDpnList, String rd, TypedWriteTransaction<Operational> tx) {
for (final VpnToDpnList curDpn : vpnToDpnList) {
InstanceIdentifier<VpnToDpnList> vpnToDpnId = VpnHelper.getVpnToDpnListIdentifier(rd, curDpn.getDpnId());
- writeTxn.delete(LogicalDatastoreType.OPERATIONAL, vpnToDpnId);
+ tx.delete(vpnToDpnId);
}
}
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
routeIds.add(label);
}
});
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.put(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getVpnInstanceOpDataIdentifier(rd),
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx ->
+ tx.put(VpnUtil.getVpnInstanceOpDataIdentifier(rd),
new VpnInstanceOpDataEntryBuilder(vpnInstanceOpData).setRouteEntryId(routeIds)
.build())),
LOG, "Error adding label to VPN instance");
} else {
LOG.debug("Removing label from vpn info - {}", labels);
routeIds.removeAll(labels);
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.put(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getVpnInstanceOpDataIdentifier(rd),
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx ->
+ tx.put(VpnUtil.getVpnInstanceOpDataIdentifier(rd),
new VpnInstanceOpDataEntryBuilder(vpnInstanceOpData).setRouteEntryId(routeIds)
.build())),
LOG, "Error removing label from VPN instance");
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.base.Optional;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
intrf.getName());
jobCoordinator.enqueueJob("VPNINTERFACE-" + intrf.getName(), () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>(3);
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
+ futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
ListenableFuture<Void> configFuture
- = txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeConfigTxn -> {
+ = txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, writeConfigTxn -> {
ListenableFuture<Void> operFuture
- = txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeOperTxn -> {
+ = txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, writeOperTxn -> {
final String interfaceName = intrf.getName();
LOG.info("Detected interface add event for interface {}", interfaceName);
final VpnInterface vpnIf = vpnUtil.getConfiguredVpnInterface(interfaceName);
final BigInteger inputDpId = dpId;
jobCoordinator.enqueueJob("VPNINTERFACE-" + ifName, () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>(3);
- ListenableFuture<Void> configFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeOperTxn -> futures.add(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
+ ListenableFuture<Void> configFuture =
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL,
+ writeOperTxn -> futures.add(
+ txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
VpnInterface cfgVpnInterface =
- vpnUtil.getConfiguredVpnInterface(ifName);
+ vpnUtil.getConfiguredVpnInterface(ifName);
if (cfgVpnInterface == null) {
LOG.debug("Interface {} is not a vpninterface, ignoring.", ifName);
return;
}
for (VpnInstanceNames vpnInterfaceVpnInstance :
- cfgVpnInterface.getVpnInstanceNames()) {
+ cfgVpnInterface.getVpnInstanceNames()) {
String vpnName = vpnInterfaceVpnInstance.getVpnName();
Optional<VpnInterfaceOpDataEntry> optVpnInterface =
- vpnUtil.getVpnInterfaceOpDataEntry(ifName, vpnName);
+ vpnUtil.getVpnInterfaceOpDataEntry(ifName, vpnName);
if (!optVpnInterface.isPresent()) {
LOG.debug("Interface {} vpn {} is not a vpninterface, or deletion"
- + " triggered by northbound agent. ignoring.", ifName, vpnName);
+ + " triggered by northbound agent. ignoring.", ifName, vpnName);
continue;
}
final VpnInterfaceOpDataEntry vpnInterface = optVpnInterface.get();
String gwMac = intrf.getPhysAddress() != null ? intrf.getPhysAddress()
- .getValue() : vpnInterface.getGatewayMacAddress();
+ .getValue() : vpnInterface.getGatewayMacAddress();
BigInteger dpnId = inputDpId;
if (dpnId == null || dpnId.equals(BigInteger.ZERO)) {
dpnId = vpnInterface.getDpnId();
}
final int ifIndex = intrf.getIfIndex();
LOG.info("VPN Interface remove event - intfName {} onto vpnName {}"
- + " running oper-driver", vpnInterface.getName(), vpnName);
+ + " running oper-driver", vpnInterface.getName(), vpnName);
vpnInterfaceManager.processVpnInterfaceDown(dpnId, ifName, ifIndex, gwMac,
- vpnInterface, false, writeConfigTxn, writeOperTxn, writeInvTxn);
+ vpnInterface, false, writeConfigTxn, writeOperTxn, writeInvTxn);
}
})))));
futures.add(configFuture);
update.getName());
jobCoordinator.enqueueJob("VPNINTERFACE-" + ifName, () -> {
List<ListenableFuture<Void>> futures = new ArrayList<>(3);
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeOperTxn -> futures.add(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeConfigTxn -> futures.add(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
- final VpnInterface vpnIf =
+ futures.add(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, writeOperTxn -> futures.add(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ writeConfigTxn -> futures.add(
+ txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
+ final VpnInterface vpnIf =
vpnUtil.getConfiguredVpnInterface(ifName);
- if (vpnIf != null) {
- final int ifIndex = update.getIfIndex();
- BigInteger dpnId = BigInteger.ZERO;
- try {
- dpnId = InterfaceUtils.getDpIdFromInterface(update);
- } catch (Exception e) {
- LOG.error("remove: Unable to retrieve dpnId for interface {}", ifName, e);
- return;
- }
- IntfTransitionState state = getTransitionState(original.getOperStatus(),
+ if (vpnIf != null) {
+ final int ifIndex = update.getIfIndex();
+ BigInteger dpnId;
+ try {
+ dpnId = InterfaceUtils.getDpIdFromInterface(update);
+ } catch (Exception e) {
+ LOG.error("remove: Unable to retrieve dpnId for interface {}", ifName,
+ e);
+ return;
+ }
+ IntfTransitionState state = getTransitionState(original.getOperStatus(),
update.getOperStatus());
- if (state.equals(IntfTransitionState.STATE_IGNORE)) {
- LOG.info("InterfaceStateChangeListener: Interface {} state original {}"
- + "updated {} not handled", ifName, original.getOperStatus(),
+ if (state.equals(IntfTransitionState.STATE_IGNORE)) {
+ LOG.info("InterfaceStateChangeListener: Interface {} state original {}"
+ + "updated {} not handled", ifName, original.getOperStatus(),
update.getOperStatus());
- return;
- }
- if (state.equals(IntfTransitionState.STATE_UP)) {
- for (VpnInstanceNames vpnInterfaceVpnInstance :
+ return;
+ }
+ if (state.equals(IntfTransitionState.STATE_UP)) {
+ for (VpnInstanceNames vpnInterfaceVpnInstance :
vpnIf.getVpnInstanceNames()) {
- String vpnName = vpnInterfaceVpnInstance.getVpnName();
- String primaryRd = vpnUtil.getPrimaryRd(vpnName);
- if (!vpnInterfaceManager.isVpnInstanceReady(vpnName)) {
- LOG.error(
+ String vpnName = vpnInterfaceVpnInstance.getVpnName();
+ String primaryRd = vpnUtil.getPrimaryRd(vpnName);
+ if (!vpnInterfaceManager.isVpnInstanceReady(vpnName)) {
+ LOG.error(
"VPN Interface update event - intfName {} onto vpnName {} "
- + "running oper-driven UP, VpnInstance not ready,"
- + " holding on", vpnIf.getName(), vpnName);
- } else if (vpnUtil.isVpnPendingDelete(primaryRd)) {
- LOG.error("update: Ignoring UP event for vpnInterface {}, as "
+ + "running oper-driven UP, VpnInstance not ready,"
+ + " holding on", vpnIf.getName(), vpnName);
+ } else if (vpnUtil.isVpnPendingDelete(primaryRd)) {
+ LOG.error("update: Ignoring UP event for vpnInterface {}, as "
+ "vpnInstance {} with primaryRd {} is already marked for"
+ " deletion", vpnIf.getName(), vpnName, primaryRd);
- } else {
- vpnInterfaceManager.processVpnInterfaceUp(dpnId, vpnIf, primaryRd,
+ } else {
+ vpnInterfaceManager.processVpnInterfaceUp(dpnId, vpnIf,
+ primaryRd,
ifIndex, true, writeConfigTxn, writeOperTxn, writeInvTxn,
update, vpnName);
+ }
}
- }
- } else if (state.equals(IntfTransitionState.STATE_DOWN)) {
- for (VpnInstanceNames vpnInterfaceVpnInstance :
+ } else if (state.equals(IntfTransitionState.STATE_DOWN)) {
+ for (VpnInstanceNames vpnInterfaceVpnInstance :
vpnIf.getVpnInstanceNames()) {
- String vpnName = vpnInterfaceVpnInstance.getVpnName();
- LOG.info("VPN Interface update event - intfName {} onto vpnName {}"
- + " running oper-driven DOWN", vpnIf.getName(), vpnName);
- Optional<VpnInterfaceOpDataEntry> optVpnInterface =
- vpnUtil.getVpnInterfaceOpDataEntry(vpnIf.getName(), vpnName);
- if (optVpnInterface.isPresent()) {
- VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
- vpnInterfaceManager.processVpnInterfaceDown(dpnId, vpnIf.getName(),
+ String vpnName = vpnInterfaceVpnInstance.getVpnName();
+ LOG.info("VPN Interface update event - intfName {} onto vpnName {}"
+ + " running oper-driven DOWN", vpnIf.getName(), vpnName);
+ Optional<VpnInterfaceOpDataEntry> optVpnInterface =
+ vpnUtil.getVpnInterfaceOpDataEntry(vpnIf.getName(), vpnName);
+ if (optVpnInterface.isPresent()) {
+ VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
+ vpnInterfaceManager.processVpnInterfaceDown(dpnId,
+ vpnIf.getName(),
ifIndex, update.getPhysAddress().getValue(), vpnOpInterface,
true, writeConfigTxn, writeOperTxn, writeInvTxn);
- } else {
- LOG.error(
+ } else {
+ LOG.error(
"InterfaceStateChangeListener Update DOWN - vpnInterface {}"
- + " not available, ignoring event", vpnIf.getName());
- continue;
+ + " not available, ignoring event", vpnIf.getName());
+ continue;
+ }
}
}
+ } else {
+ LOG.debug("Interface {} is not a vpninterface, ignoring.", ifName);
}
- } else {
- LOG.debug("Interface {} is not a vpninterface, ignoring.", ifName);
- }
- }))))));
+ }))))));
return futures;
});
}
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
}
final int lPortTag = interfaceState.getIfIndex();
List<ListenableFuture<Void>> futures = new ArrayList<>();
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeOperTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeInvTxn -> vpnInterfaceManager.processVpnInterfaceAdjacencies(
- dpnId, lPortTag, vpnName, primaryRd, vpnInterfaceName, vpnId,
- writeConfigTxn, writeOperTxn, writeInvTxn, interfaceState)))))));
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ writeConfigTxn -> futures.add(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL,
+ writeOperTxn -> futures.add(
+ txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION,
+ writeInvTxn -> vpnInterfaceManager.processVpnInterfaceAdjacencies(
+ dpnId, lPortTag, vpnName, primaryRd, vpnInterfaceName, vpnId,
+ writeConfigTxn, writeOperTxn, writeInvTxn,
+ interfaceState)))))));
LOG.trace("add: Handled TEP {} add for VPN instance {} VPN interface {}",
tep.getInterfaceName(), vpnName, vpnInterfaceName);
return futures;
package org.opendaylight.netvirt.vpnmanager;
import static java.util.stream.Collectors.toList;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.vpnmanager.api.InterfaceUtils;
import org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper;
LOG.trace("update: No vpnInstanceOpdata present");
return;
}
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx ->
- vpnInstanceOpData.stream()
- .filter(opData -> opData.getVpnToDpnList() != null
- && opData.getVpnToDpnList().stream().anyMatch(
- vpnToDpn -> vpnToDpn.getDpnId().equals(srcDpnId)))
- .forEach(opData -> {
- List<DestPrefixes> prefixes = VpnExtraRouteHelper.getExtraRouteDestPrefixes(dataBroker,
- opData.getVpnId());
- prefixes.forEach(destPrefix -> {
- VrfEntry vrfEntry = vpnUtil.getVrfEntry(opData.getVrfId(),
- destPrefix.getDestPrefix());
- if (vrfEntry == null || vrfEntry.getRoutePaths() == null) {
- return;
+ vpnInstanceOpData.stream()
+ .filter(opData -> opData.getVpnToDpnList() != null
+ && opData.getVpnToDpnList().stream().anyMatch(
+ vpnToDpn -> vpnToDpn.getDpnId().equals(srcDpnId)))
+ .forEach(opData -> {
+ List<DestPrefixes> prefixes = VpnExtraRouteHelper.getExtraRouteDestPrefixes(dataBroker,
+ opData.getVpnId());
+ prefixes.forEach(destPrefix -> {
+ VrfEntry vrfEntry = vpnUtil.getVrfEntry(opData.getVrfId(),
+ destPrefix.getDestPrefix());
+ if (vrfEntry == null || vrfEntry.getRoutePaths() == null) {
+ return;
+ }
+ List<RoutePaths> routePaths = vrfEntry.getRoutePaths();
+ routePaths.forEach(routePath -> {
+ if (routePath.getNexthopAddress().equals(srcTepIp)) {
+ String prefix = destPrefix.getDestPrefix();
+ String vpnPrefixKey = VpnUtil.getVpnNamePrefixKey(opData.getVpnInstanceName(),
+ prefix);
+ synchronized (vpnPrefixKey.intern()) {
+ fibManager.refreshVrfEntry(opData.getVrfId(), prefix);
}
- List<RoutePaths> routePaths = vrfEntry.getRoutePaths();
- routePaths.forEach(routePath -> {
- if (routePath.getNexthopAddress().equals(srcTepIp)) {
- String prefix = destPrefix.getDestPrefix();
- String vpnPrefixKey = VpnUtil.getVpnNamePrefixKey(opData.getVpnInstanceName(),
- prefix);
- synchronized (vpnPrefixKey.intern()) {
- fibManager.refreshVrfEntry(opData.getVrfId(), prefix);
- }
- }
- });
- });
- })
- ), LOG, "Error updating route paths for FIB entries");
+ }
+ });
+ });
+ });
}
@Override
@Override
public List<ListenableFuture<Void>> call() {
List<ListenableFuture<Void>> futures = new ArrayList<>(2);
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx ->
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx -> {
- if (tunnelAction == TunnelAction.TUNNEL_EP_ADD) {
- vpnInterfaceManager.updateVpnInterfaceOnTepAdd(vpnInterface, stateTunnelList, confTx,
- operTx);
- }
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx ->
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx -> {
+ if (tunnelAction == TunnelAction.TUNNEL_EP_ADD) {
+ vpnInterfaceManager.updateVpnInterfaceOnTepAdd(vpnInterface, stateTunnelList, confTx, operTx);
+ }
- if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE && isTepDeletedOnDpn) {
- vpnInterfaceManager.updateVpnInterfaceOnTepDelete(vpnInterface, stateTunnelList, confTx,
- operTx);
- }
- }))));
+ if (tunnelAction == TunnelAction.TUNNEL_EP_DELETE && isTepDeletedOnDpn) {
+ vpnInterfaceManager.updateVpnInterfaceOnTepDelete(vpnInterface, stateTunnelList, confTx,
+ operTx);
+ }
+ }))));
return futures;
}
}
DcGatewayIpList dcGatewayIpListConfig =
MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, dcGatewayIpListid).orNull();
if (dcGatewayIpListConfig == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
return dcGatewayIpListConfig.getDcGatewayIp()
.stream()
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import java.util.ArrayList;
import java.util.List;
}
InstanceIdentifier<VpnInterface> vpnInterfaceIdentifier = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.delete(LogicalDatastoreType.CONFIGURATION, vpnInterfaceIdentifier)), LOG,
- "Error removing VPN interface {}", vpnInterfaceIdentifier);
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.delete(vpnInterfaceIdentifier)), LOG, "Error removing VPN interface {}", vpnInterfaceIdentifier);
LOG.info("remove: Removed VPN interface {}", interfaceName);
}
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+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.TypedWriteTransaction;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
return;
} else {
jobCoordinator.enqueueJob("VPN-" + vpnName, () ->
- Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
VpnInstanceOpDataEntryBuilder builder = new VpnInstanceOpDataEntryBuilder().setVrfId(primaryRd)
.setVpnState(VpnInstanceOpDataEntry.VpnState.PendingDelete);
InstanceIdentifier<VpnInstanceOpDataEntry> id =
VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd);
- tx.merge(LogicalDatastoreType.OPERATIONAL, id, builder.build());
+ tx.merge(id, builder.build());
LOG.info("{} call: Operational status set to PENDING_DELETE for vpn {} with rd {}",
LOGGING_PREFIX_DELETE, vpnName, primaryRd);
// If another renderer(for eg : CSS) needs to be supported, check can be performed here
// to call the respective helpers.
List<ListenableFuture<Void>> futures = new ArrayList<>(2);
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
- ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx ->
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
+ ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx ->
addVpnInstance(vpnInstance, confTx, operTx));
ListenableFutures.addErrorLogging(future, LOG, "{} call: error creating VPN {}", LOGGING_PREFIX_ADD,
vpnInstance.getVpnInstanceName());
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
- private void addVpnInstance(VpnInstance value, WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn) {
+ private void addVpnInstance(VpnInstance value, TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn) {
if (writeConfigTxn == null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
addVpnInstance(value, tx, writeOperTxn)), LOG, "Error adding VPN instance {}", value);
return;
}
if (writeOperTxn == null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx ->
addVpnInstance(value, writeConfigTxn, tx)), LOG, "Error adding VPN instance {}", value);
return;
}
org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id.VpnInstance
vpnInstanceToVpnId = VpnUtil.getVpnInstanceToVpnId(vpnInstanceName, vpnId, primaryRd);
- writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION,
- VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName),
- vpnInstanceToVpnId, WriteTransaction.CREATE_MISSING_PARENTS);
+ writeConfigTxn.put(VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnInstanceName),
+ vpnInstanceToVpnId, CREATE_MISSING_PARENTS);
VpnIds vpnIdToVpnInstance = VpnUtil.getVpnIdToVpnInstance(vpnId, value.getVpnInstanceName(),
primaryRd, VpnUtil.isBgpVpn(vpnInstanceName, primaryRd));
- writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION,
- VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId),
- vpnIdToVpnInstance, WriteTransaction.CREATE_MISSING_PARENTS);
+ writeConfigTxn.put(VpnUtil.getVpnIdToVpnInstanceIdentifier(vpnId), vpnIdToVpnInstance, CREATE_MISSING_PARENTS);
try {
String cachedTransType = fibManager.getConfTransType();
} else {
builder.setBgpvpnType(VpnInstanceOpDataEntry.BgpvpnType.VPN);
}
- writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd),
- builder.build(), true);
+ writeOperTxn.merge(VpnUtil.getVpnInstanceOpDataIdentifier(primaryRd), builder.build(), CREATE_MISSING_PARENTS);
LOG.info("{} addVpnInstance: VpnInstanceOpData populated successfully for vpn {} rd {}", LOGGING_PREFIX_ADD,
vpnInstanceName, primaryRd);
}
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Iterators;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
+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.TypedReadWriteTransaction;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.NWUtil;
import org.opendaylight.genius.mdsalutil.NwConstants;
// TODO Deal with sequencing — the config tx must only submitted if the oper tx goes in
// (the inventory tx goes in last)
List<ListenableFuture<Void>> futures = new ArrayList<>();
- ListenableFuture<Void> confFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- confTx -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- operTx -> futures.add(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(invTx -> {
+ ListenableFuture<Void> confFuture =
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ confTx -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL,
+ operTx -> futures.add(
+ txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, invTx -> {
LOG.info(
- "addVpnInterface: VPN Interface add event - intfName {} vpnName {}"
+ "addVpnInterface: VPN Interface add event - intfName {} vpnName {}"
+ " on dpn {}",
- vpnInterface.getName(), vpnName, vpnInterface.getDpnId());
+ vpnInterface.getName(), vpnName, vpnInterface.getDpnId());
processVpnInterfaceUp(dpnId, vpnInterface, primaryRd, ifIndex, false,
- confTx, operTx, invTx, interfaceState, vpnName);
+ confTx, operTx, invTx, interfaceState, vpnName);
if (oldAdjs != null && !oldAdjs.equals(newAdjs)) {
LOG.info("addVpnInterface: Adjacency changed upon VPNInterface {}"
- + " Update for swapping VPN {} case.", interfaceName, vpnName);
+ + " Update for swapping VPN {} case.", interfaceName, vpnName);
if (newAdjs != null) {
for (Adjacency adj : newAdjs) {
if (oldAdjs.contains(adj)) {
oldAdjs.remove(adj);
} else {
if (!isBgpVpnInternetVpn
- || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+ || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
addNewAdjToVpnInterface(vpnInterfaceOpIdentifier,
- primaryRd, adj, dpnId, operTx, confTx);
+ primaryRd, adj, dpnId, operTx, confTx);
}
}
}
}
for (Adjacency adj : oldAdjs) {
if (!isBgpVpnInternetVpn
- || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
+ || vpnUtil.isAdjacencyEligibleToVpnInternet(adj)) {
delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
- operTx, confTx);
+ operTx, confTx);
}
}
}
})))));
futures.add(confFuture);
Futures.addCallback(confFuture, new PostVpnInterfaceWorker(interfaceName, true, "Config"),
- MoreExecutors.directExecutor());
+ MoreExecutors.directExecutor());
LOG.info("addVpnInterface: Addition of interface {} in VPN {} on dpn {}"
- + " processed successfully", interfaceName, vpnName, dpnId);
+ + " processed successfully", interfaceName, vpnName, dpnId);
return futures;
});
} catch (NumberFormatException | IllegalStateException e) {
LOG.error("addVpnInterface: Unable to retrieve dpnId from interface operational data store for "
- + "interface {}. Interface addition on vpn {} failed", interfaceName,
- vpnName, e);
+ + "interface {}. Interface addition on vpn {} failed", interfaceName,
+ vpnName, e);
return;
}
} else if (Boolean.TRUE.equals(vpnInterface.isRouterInterface())) {
jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getName(),
() -> {
- ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
- createFibEntryForRouterInterface(primaryRd, vpnInterface, interfaceName,
+ ListenableFuture<Void> future =
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
+ createFibEntryForRouterInterface(primaryRd, vpnInterface, interfaceName,
confTx, vpnName);
- LOG.info("addVpnInterface: Router interface {} for vpn {} on dpn {}", interfaceName,
+ LOG.info("addVpnInterface: Router interface {} for vpn {} on dpn {}", interfaceName,
vpnName, vpnInterface.getDpnId());
- });
+ });
ListenableFutures.addErrorLogging(future, LOG,
- "Error creating FIB entry for interface {} on VPN {}", vpnInterface.getName(), vpnName);
+ "Error creating FIB entry for interface {} on VPN {}", vpnInterface.getName(), vpnName);
return Collections.singletonList(future);
});
} else {
LOG.info("addVpnInterface: Handling addition of VPN interface {} on vpn {} skipped as interfaceState"
- + " is not available", interfaceName, vpnName);
+ + " is not available", interfaceName, vpnName);
}
} else {
LOG.error("addVpnInterface: Handling addition of VPN interface {} on vpn {} dpn {} skipped"
- + " as vpn is pending delete", interfaceName, vpnName,
- vpnInterface.getDpnId());
+ + " as vpn is pending delete", interfaceName, vpnName,
+ vpnInterface.getDpnId());
}
}
@SuppressFBWarnings({"UW_UNCOND_WAIT", "WA_NOT_IN_LOOP"})
protected void processVpnInterfaceUp(final BigInteger dpId, VpnInterface vpnInterface, final String primaryRd,
final int lportTag, boolean isInterfaceUp,
- WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn,
- WriteTransaction writeInvTxn,
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn,
+ TypedReadWriteTransaction<Configuration> writeInvTxn,
Interface interfaceState,
- final String vpnName) {
+ final String vpnName) throws ExecutionException, InterruptedException {
final String interfaceName = vpnInterface.getName();
Optional<VpnInterfaceOpDataEntry> optOpVpnInterface = vpnUtil.getVpnInterfaceOpDataEntry(interfaceName,
vpnName);
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
private void withdrawAdjacenciesForVpnFromBgp(final InstanceIdentifier<VpnInterfaceOpDataEntry> identifier,
- String vpnName, String interfaceName, WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTx) {
+ String vpnName, String interfaceName, TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTx) {
//Read NextHops
InstanceIdentifier<AdjacenciesOp> path = identifier.augmentation(AdjacenciesOp.class);
String rd = vpnUtil.getVpnRd(interfaceName);
@SuppressWarnings("checkstyle:IllegalCatch")
protected void processVpnInterfaceAdjacencies(BigInteger dpnId, final int lportTag, String vpnName,
String primaryRd, String interfaceName, final long vpnId,
- WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn,
- final WriteTransaction writeInvTxn,
- Interface interfaceState) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn,
+ TypedReadWriteTransaction<Configuration> writeInvTxn,
+ Interface interfaceState)
+ throws ExecutionException, InterruptedException {
InstanceIdentifier<VpnInterface> identifier = VpnUtil.getVpnInterfaceIdentifier(interfaceName);
// Read NextHops
Optional<VpnInterface> vpnInteface = Optional.absent();
? VpnUtil.getPrefixToInterface(dpnId, interfaceName, prefix, intfnetworkUuid ,networkType,
segmentationId, prefixCue) :
VpnUtil.getPrefixToInterface(dpnId, interfaceName, prefix, prefixCue);
- writeOperTxn.merge(
- LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getPrefixToInterfaceIdentifier(
+ writeOperTxn.merge(VpnUtil.getPrefixToInterfaceIdentifier(
vpnUtil.getVpnId(vpnName), prefix), prefixes, true);
final Uuid subnetId = nextHop.getSubnetId();
}
private void addVpnInterfaceToOperational(String vpnName, String interfaceName, BigInteger dpnId, AdjacenciesOp aug,
- long lportTag, String gwMac, WriteTransaction writeOperTxn) {
+ long lportTag, String gwMac,
+ TypedWriteTransaction<Operational> writeOperTxn) {
VpnInterfaceOpDataEntry opInterface =
VpnUtil.getVpnInterfaceOpDataEntry(interfaceName, vpnName, aug, dpnId, lportTag, gwMac);
InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId = VpnUtil
.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
- writeOperTxn.put(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface,
- WriteTransaction.CREATE_MISSING_PARENTS);
+ writeOperTxn.put(interfaceId, opInterface, CREATE_MISSING_PARENTS);
LOG.info("addVpnInterfaceToOperational: Added VPN Interface {} on dpn {} vpn {} to operational datastore",
interfaceName, dpnId, vpnName);
}
@SuppressWarnings("checkstyle:IllegalCatch")
public void updateVpnInterfaceOnTepAdd(VpnInterfaceOpDataEntry vpnInterface,
StateTunnelList stateTunnelList,
- WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn) {
String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
vpnInterface.getVpnInstanceName(), vpnId, rd, vpnInterface.getName());
// Update the VRF entry with nextHop
fibManager.updateRoutePathForFibEntry(primaryRd, prefix, srcTepIp,
- label, true, writeConfigTxn);
+ label, true, TransactionAdapter.toWriteTransaction(writeConfigTxn));
//Get the list of VPN's importing this route(prefix) .
// Then update the VRF entry with nhList
String vpnRd = vpn.getVrfId();
if (vpnRd != null) {
fibManager.updateRoutePathForFibEntry(vpnRd, prefix,
- srcTepIp, label, true, writeConfigTxn);
+ srcTepIp, label, true, TransactionAdapter.toWriteTransaction(writeConfigTxn));
LOG.info("updateVpnInterfaceOnTepAdd: Exported route with rd {} prefix {} nhList {} label {}"
+ " interface {} dpn {} from vpn {} to VPN {} vpnRd {}", rd, prefix, nhList, label,
vpnInterface.getName(), srcDpnId, vpnName,
.addAugmentation(AdjacenciesOp.class, aug).build();
InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getName(), vpnName);
- writeOperTxn.put(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface,
- WriteTransaction.CREATE_MISSING_PARENTS);
+ writeOperTxn.put(interfaceId, opInterface, CREATE_MISSING_PARENTS);
LOG.info("updateVpnInterfaceOnTepAdd: interface {} updated successully on tep add on dpn {} vpn {}",
vpnInterface.getName(), srcDpnId, vpnName);
@SuppressWarnings("checkstyle:IllegalCatch")
public void updateVpnInterfaceOnTepDelete(VpnInterfaceOpDataEntry vpnInterface,
StateTunnelList stateTunnelList,
- WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn) {
AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : new ArrayList<>();
vpnId, rd, vpnInterface.getName());
// Update the VRF entry with removed nextHop
fibManager.updateRoutePathForFibEntry(primaryRd, prefix, srcTepIp,
- label, false, writeConfigTxn);
+ label, false, TransactionAdapter.toWriteTransaction(writeConfigTxn));
//Get the list of VPN's importing this route(prefix) .
// Then update the VRF entry with nhList
String vpnRd = vpn.getVrfId();
if (vpnRd != null) {
fibManager.updateRoutePathForFibEntry(vpnRd, prefix,
- srcTepIp, label, false, writeConfigTxn);
+ srcTepIp, label, false, TransactionAdapter.toWriteTransaction(writeConfigTxn));
LOG.info("updateVpnInterfaceOnTepDelete: Exported route with rd {} prefix {} nhList {}"
+ " label {} interface {} dpn {} from vpn {} to VPN {} vpnRd {}", rd, prefix,
nhList, label, vpnInterface.getName(), srcDpnId,
.addAugmentation(AdjacenciesOp.class, aug).build();
InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterface.getName(), vpnName);
- writeOperTxn.put(LogicalDatastoreType.OPERATIONAL, interfaceId, opInterface,
- WriteTransaction.CREATE_MISSING_PARENTS);
+ writeOperTxn.put(interfaceId, opInterface, CREATE_MISSING_PARENTS);
LOG.info("updateVpnInterfaceOnTepDelete: interface {} updated successully on tep delete on dpn {} vpn {}",
vpnInterface.getName(), srcDpnId, vpnName);
}
for (VpnInstanceOpDataEntry vpn : vpnsToExportRoute) {
List<VrfEntry> vrfEntries = vpnUtil.getAllVrfEntries(vpn.getVrfId());
if (vrfEntries != null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
- for (VrfEntry vrfEntry : vrfEntries) {
- try {
- if (!FibHelper.isControllerManagedNonInterVpnLinkRoute(
+ ListenableFutures.addErrorLogging(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
+ for (VrfEntry vrfEntry : vrfEntries) {
+ try {
+ if (!FibHelper.isControllerManagedNonInterVpnLinkRoute(
RouteOrigin.value(vrfEntry.getOrigin()))) {
- LOG.info("handleVpnsExportingRoutes: vrfEntry with rd {} prefix {}"
- + " is not a controller managed non intervpn link route. Ignoring.",
+ LOG.info("handleVpnsExportingRoutes: vrfEntry with rd {} prefix {}"
+ + " is not a controller managed non intervpn link route. Ignoring.",
vpn.getVrfId(), vrfEntry.getDestPrefix());
- continue;
- }
- String prefix = vrfEntry.getDestPrefix();
- String gwMac = vrfEntry.getGatewayMacAddress();
- vrfEntry.getRoutePaths().forEach(routePath -> {
- String nh = routePath.getNexthopAddress();
- int label = routePath.getLabel().intValue();
- if (FibHelper.isControllerManagedVpnInterfaceRoute(RouteOrigin.value(
+ continue;
+ }
+ String prefix = vrfEntry.getDestPrefix();
+ String gwMac = vrfEntry.getGatewayMacAddress();
+ vrfEntry.getRoutePaths().forEach(routePath -> {
+ String nh = routePath.getNexthopAddress();
+ int label = routePath.getLabel().intValue();
+ if (FibHelper.isControllerManagedVpnInterfaceRoute(RouteOrigin.value(
vrfEntry.getOrigin()))) {
- LOG.info("handleVpnsExportingRoutesImporting: Importing fib entry rd {} prefix {}"
- + " nexthop {} label {} to vpn {} vpnRd {}",
+ LOG.info(
+ "handleVpnsExportingRoutesImporting: Importing fib entry rd {} prefix {}"
+ + " nexthop {} label {} to vpn {} vpnRd {}",
vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
- fibManager.addOrUpdateFibEntry(vpnRd, null /*macAddress*/, prefix,
+ fibManager.addOrUpdateFibEntry(vpnRd, null /*macAddress*/, prefix,
Collections.singletonList(nh), VrfEntry.EncapType.Mplsgre, label,
- 0 /*l3vni*/, gwMac, vpn.getVrfId(), RouteOrigin.SELF_IMPORTED,
+ 0 /*l3vni*/, gwMac, vpn.getVrfId(), RouteOrigin.SELF_IMPORTED,
confTx);
- } else {
- LOG.info("handleVpnsExportingRoutes: Importing subnet route fib entry rd {} "
- + "prefix {} nexthop {} label {} to vpn {} vpnRd {}",
+ } else {
+ LOG.info("handleVpnsExportingRoutes: Importing subnet route fib entry rd {} "
+ + "prefix {} nexthop {} label {} to vpn {} vpnRd {}",
vpn.getVrfId(), prefix, nh, label, vpnName, vpnRd);
- SubnetRoute route = vrfEntry.augmentation(SubnetRoute.class);
- importSubnetRouteForNewVpn(vpnRd, prefix, nh, label, route, vpn.getVrfId(),
+ SubnetRoute route = vrfEntry.augmentation(SubnetRoute.class);
+ importSubnetRouteForNewVpn(vpnRd, prefix, nh, label, route, vpn.getVrfId(),
confTx);
- }
- });
- } catch (RuntimeException e) {
- LOG.error("getNextHopAddressList: Exception occurred while importing route with rd {}"
- + " prefix {} routePaths {} to vpn {} vpnRd {}", vpn.getVrfId(),
+ }
+ });
+ } catch (RuntimeException e) {
+ LOG.error("getNextHopAddressList: Exception occurred while importing route with rd {}"
+ + " prefix {} routePaths {} to vpn {} vpnRd {}", vpn.getVrfId(),
vrfEntry.getDestPrefix(), vrfEntry.getRoutePaths(), vpnName, vpnRd);
+ }
}
- }
- }), LOG, "Error handing VPN exporting routes");
+ }), LOG, "Error handing VPN exporting routes");
} else {
LOG.info("getNextHopAddressList: No vrf entries to import from vpn {} with rd {} to vpn {} with rd {}",
vpn.getVpnInstanceName(), vpn.getVrfId(), vpnName, vpnRd);
final String interfaceName) {
if (Boolean.TRUE.equals(vpnInterface.isRouterInterface())) {
jobCoordinator.enqueueJob("VPNINTERFACE-" + vpnInterface.getName(), () -> {
- ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
- deleteFibEntryForRouterInterface(vpnInterface, confTx, vpnName);
- LOG.info("remove: Router interface {} for vpn {}", interfaceName, vpnName);
- });
+ ListenableFuture<Void> future =
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
+ deleteFibEntryForRouterInterface(vpnInterface, confTx, vpnName);
+ LOG.info("remove: Router interface {} for vpn {}", interfaceName, vpnName);
+ });
ListenableFutures.addErrorLogging(future, LOG, "Error removing call for interface {} on VPN {}",
vpnInterface.getName(), vpnName);
return Collections.singletonList(future);
}, DJC_MAX_RETRIES);
} else {
- removeVpnInterfaceFromVpn(identifier, vpnInterface, vpnName, interfaceName);
+ Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker, interfaceName);
+ removeVpnInterfaceFromVpn(identifier, vpnInterface, vpnName, interfaceName, interfaceState);
}
}
@SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
private void removeVpnInterfaceFromVpn(final InstanceIdentifier<VpnInterface> identifier,
- final VpnInterface vpnInterface, final String vpnName,
- final String interfaceName) {
+ final VpnInterface vpnInterface, final String vpnName,
+ final String interfaceName, final Interface interfaceState) {
LOG.info("remove: VPN Interface remove event - intfName {} vpn {} dpn {}" ,vpnInterface.getName(),
vpnName, vpnInterface.getDpnId());
removeInterfaceFromUnprocessedList(identifier, vpnInterface);
jobCoordinator.enqueueJob("VPNINTERFACE-" + interfaceName,
() -> {
List<ListenableFuture<Void>> futures = new ArrayList<>(3);
- ListenableFuture<Void> configFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- writeOperTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeInvTxn -> {
- LOG.info("remove: - intfName {} onto vpnName {} running config-driven",
- interfaceName, vpnName);
- BigInteger dpId = BigInteger.ZERO;
- int ifIndex = 0;
- String gwMacAddress = null;
- InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
- VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
- Optional<VpnInterfaceOpDataEntry> optVpnInterface = Optional.absent();
- try {
- optVpnInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker,
- LogicalDatastoreType.OPERATIONAL, interfaceId);
- } catch (ReadFailedException e) {
- LOG.error("remove: Failed to read data store for interface {} vpn {}", interfaceName,
- vpnName);
- return;
- }
- Interface interfaceState = InterfaceUtils.getInterfaceStateFromOperDS(dataBroker,
- interfaceName);
- if (interfaceState != null) {
+ ListenableFuture<Void> configFuture = txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ writeConfigTxn -> futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL,
+ writeOperTxn -> futures.add(
+ txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, writeInvTxn -> {
+ LOG.info("remove: - intfName {} onto vpnName {} running config-driven",
+ interfaceName, vpnName);
+ BigInteger dpId = BigInteger.ZERO;
+ int ifIndex = 0;
+ String gwMacAddress = null;
+ InstanceIdentifier<VpnInterfaceOpDataEntry> interfaceId =
+ VpnUtil.getVpnInterfaceOpDataEntryIdentifier(interfaceName, vpnName);
+ Optional<VpnInterfaceOpDataEntry> optVpnInterface = Optional.absent();
try {
- dpId = InterfaceUtils.getDpIdFromInterface(interfaceState);
- } catch (NumberFormatException | IllegalStateException e) {
- LOG.error("remove: Unable to retrieve dpnId from interface operational"
- + " data store for interface {} on dpn {} for vpn {} Fetching"
- + " from vpn interface op data store. ", interfaceName,
- vpnInterface.getDpnId(), vpnName, e);
- dpId = BigInteger.ZERO;
+ optVpnInterface = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+ LogicalDatastoreType.OPERATIONAL, interfaceId);
+ } catch (ReadFailedException e) {
+ LOG.error("remove: Failed to read data store for interface {} vpn {}",
+ interfaceName, vpnName);
+ return;
}
- ifIndex = interfaceState.getIfIndex();
- gwMacAddress = interfaceState.getPhysAddress().getValue();
- } else {
- LOG.info("remove: Interface state not available for {}. Trying to fetch data"
- + " from vpn interface op.", interfaceName);
- if (optVpnInterface.isPresent()) {
- VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
- dpId = vpnOpInterface.getDpnId();
- ifIndex = vpnOpInterface.getLportTag().intValue();
- gwMacAddress = vpnOpInterface.getGatewayMacAddress();
+ if (interfaceState != null) {
+ try {
+ dpId = InterfaceUtils.getDpIdFromInterface(interfaceState);
+ } catch (NumberFormatException | IllegalStateException e) {
+ LOG.error("remove: Unable to retrieve dpnId from interface operational"
+ + " data store for interface {} on dpn {} for vpn {} Fetching"
+ + " from vpn interface op data store. ", interfaceName,
+ vpnInterface.getDpnId(), vpnName, e);
+ dpId = BigInteger.ZERO;
+ }
+ ifIndex = interfaceState.getIfIndex();
+ gwMacAddress = interfaceState.getPhysAddress().getValue();
} else {
- LOG.error("remove: Handling removal of VPN interface {} for vpn {} skipped"
- + " as interfaceState and vpn interface op is not"
- + " available", interfaceName, vpnName);
- return;
+ LOG.info("remove: Interface state not available for {}. Trying to fetch data"
+ + " from vpn interface op.", interfaceName);
+ if (optVpnInterface.isPresent()) {
+ VpnInterfaceOpDataEntry vpnOpInterface = optVpnInterface.get();
+ dpId = vpnOpInterface.getDpnId();
+ ifIndex = vpnOpInterface.getLportTag().intValue();
+ gwMacAddress = vpnOpInterface.getGatewayMacAddress();
+ } else {
+ LOG.error("remove: Handling removal of VPN interface {} for vpn {} skipped"
+ + " as interfaceState and vpn interface op is not"
+ + " available", interfaceName, vpnName);
+ return;
+ }
}
- }
- processVpnInterfaceDown(dpId, interfaceName, ifIndex, gwMacAddress,
- optVpnInterface.isPresent() ? optVpnInterface.get() : null, false,
- writeConfigTxn, writeOperTxn, writeInvTxn);
- LOG.info(
- "remove: Removal of vpn interface {} on dpn {} for vpn {} processed "
- + "successfully",
- interfaceName, vpnInterface.getDpnId(), vpnName);
- })))));
+ processVpnInterfaceDown(dpId, interfaceName, ifIndex, gwMacAddress,
+ optVpnInterface.isPresent() ? optVpnInterface.get() : null, false,
+ writeConfigTxn, writeOperTxn, writeInvTxn);
+ LOG.info(
+ "remove: Removal of vpn interface {} on dpn {} for vpn {} processed "
+ + "successfully",
+ interfaceName, vpnInterface.getDpnId(), vpnName);
+ })))));
futures.add(configFuture);
Futures.addCallback(configFuture, new PostVpnInterfaceWorker(interfaceName, false, "Config"));
return futures;
String gwMac,
VpnInterfaceOpDataEntry vpnOpInterface,
boolean isInterfaceStateDown,
- WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTxn,
- WriteTransaction writeInvTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn,
+ TypedReadWriteTransaction<Configuration> writeInvTxn)
+ throws ExecutionException, InterruptedException {
if (vpnOpInterface == null) {
LOG.error("processVpnInterfaceDown: Unable to process delete/down for interface {} on dpn {}"
+ " as it is not available in operational data store", interfaceName, dpId);
private void removeAdjacenciesFromVpn(final BigInteger dpnId, final int lportTag, final String interfaceName,
final String vpnName, final long vpnId, String gwMac,
- WriteTransaction writeConfigTxn, final WriteTransaction writeOperTxn,
- final WriteTransaction writeInvTxn) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTxn,
+ TypedReadWriteTransaction<Configuration> writeInvTxn)
+ throws ExecutionException, InterruptedException {
//Read NextHops
try {
InstanceIdentifier<VpnInterfaceOpDataEntry> identifier = VpnUtil
// this vpn interface has no more adjacency left, so clean up the vpn interface from Operational DS
LOG.info("removeAdjacenciesFromVpn: Vpn Interface {} on vpn {} dpn {} has no adjacencies."
+ " Removing it.", interfaceName, vpnName, dpnId);
- writeOperTxn.delete(LogicalDatastoreType.OPERATIONAL, identifier);
+ writeOperTxn.delete(identifier);
}
} catch (ReadFailedException e) {
LOG.error("removeAdjacenciesFromVpn: Failed to read data store for interface {} dpn {} vpn {}",
}
}
- private Consumer<String> removeAdjacencyFromInternalVpn(Adjacency nextHop, String vpnName, String interfaceName,
- BigInteger dpnId, WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTx) {
+ private Consumer<String> removeAdjacencyFromInternalVpn(Adjacency nextHop, String vpnName,
+ String interfaceName, BigInteger dpnId,
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTx) {
return (nh) -> {
String primaryRd = vpnUtil.getVpnRd(vpnName);
String prefix = nextHop.getIpAddress();
private void removeAdjacencyFromBgpvpn(Adjacency nextHop, List<String> nhList, String vpnName, String primaryRd,
BigInteger dpnId, String rd, String interfaceName,
- WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
+ TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTx) {
List<VpnInstanceOpDataEntry> vpnsToImportRoute =
vpnUtil.getVpnsImportingMyRoute(vpnName);
nhList.forEach((nh) -> {
private void removeGwMacAndArpResponderFlows(Adjacency nextHop, long vpnId, BigInteger dpnId,
int lportTag, String gwMac, String interfaceName,
- WriteTransaction writeInvTxn) {
+ TypedReadWriteTransaction<Configuration> writeInvTxn)
+ throws ExecutionException, InterruptedException {
final Uuid subnetId = nextHop.getSubnetId();
if (nextHop.getSubnetGatewayMacAddress() == null) {
// A valid mac-address was not available for this subnet-gateway-ip
String primaryRd = vpnUtil.getPrimaryRd(newVpnName);
if (!vpnUtil.isVpnPendingDelete(primaryRd)) {
// TODO Deal with sequencing — the config tx must only submitted if the oper tx goes in
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(confTx -> {
- futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(operTx -> {
+ futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> {
+ futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operTx -> {
InstanceIdentifier<VpnInterfaceOpDataEntry> vpnInterfaceOpIdentifier =
VpnUtil.getVpnInterfaceOpDataEntryIdentifier(vpnInterfaceName, newVpnName);
LOG.info("VPN Interface update event - intfName {} onto vpnName {} running config-driven",
}
} else {
delAdjFromVpnInterface(vpnInterfaceOpIdentifier, adj, dpnId,
- operTx, confTx);
+ operTx, confTx);
}
}
LOG.info("update: Adjacency {} with nextHop {} label {} subnet {} removed from"
}
public synchronized void importSubnetRouteForNewVpn(String rd, String prefix, String nextHop, int label,
- SubnetRoute route, String parentVpnRd, WriteTransaction writeConfigTxn) {
+ SubnetRoute route, String parentVpnRd, TypedWriteTransaction<Configuration> writeConfigTxn) {
RouteOrigin origin = RouteOrigin.SELF_IMPORTED;
VrfEntry vrfEntry = FibHelper.getVrfEntryBuilder(prefix, label, nextHop, origin, parentVpnRd)
InstanceIdentifier<VrfTables> vrfTableId = idBuilder.build();
VrfTables vrfTableNew = new VrfTablesBuilder().setRouteDistinguisher(rd).setVrfEntry(vrfEntryList).build();
if (writeConfigTxn != null) {
- writeConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew, true);
+ writeConfigTxn.merge(vrfTableId, vrfTableNew, CREATE_MISSING_PARENTS);
} else {
vpnUtil.syncUpdate(LogicalDatastoreType.CONFIGURATION, vrfTableId, vrfTableNew);
}
}
protected void addNewAdjToVpnInterface(InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, String primaryRd,
- Adjacency adj, BigInteger dpnId, WriteTransaction writeOperTxn,
- WriteTransaction writeConfigTxn) {
+ Adjacency adj, BigInteger dpnId,
+ TypedWriteTransaction<Operational> writeOperTxn,
+ TypedWriteTransaction<Configuration> writeConfigTxn)
+ throws ExecutionException, InterruptedException {
String interfaceName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getName();
String configVpnName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getVpnInstanceName();
try {
String parentVpnRd = getParentVpnRdForExternalSubnet(adj);
writeOperTxn.merge(
- LogicalDatastoreType.OPERATIONAL,
VpnUtil.getPrefixToInterfaceIdentifier(vpnUtil.getVpnId(adj.getSubnetId().getValue()),
prefix), pnfPrefix, true);
aug, dpnId, currVpnIntf.getLportTag(),
currVpnIntf.getGatewayMacAddress());
- writeOperTxn.merge(LogicalDatastoreType.OPERATIONAL, identifier, newVpnIntf, true);
+ writeOperTxn.merge(identifier, newVpnIntf, CREATE_MISSING_PARENTS);
}
} catch (ReadFailedException e) {
LOG.error("addNewAdjToVpnInterface: Failed to read data store for interface {} dpn {} vpn {} rd {} ip "
}
protected void delAdjFromVpnInterface(InstanceIdentifier<VpnInterfaceOpDataEntry> identifier, Adjacency adj,
- BigInteger dpnId, WriteTransaction writeOperTxn, WriteTransaction writeConfigTxn) {
+ BigInteger dpnId, TypedWriteTransaction<Operational> writeOperTxn,
+ TypedWriteTransaction<Configuration> writeConfigTxn) {
String interfaceName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getName();
String vpnName = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class).getVpnInstanceName();
try {
}
private void deleteExtraRouteFromCurrentAndImportingVpns(String vpnName, String destination, String nextHop,
- String rd, String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
+ String rd, String intfName, TypedWriteTransaction<Configuration> writeConfigTxn,
+ TypedWriteTransaction<Operational> writeOperTx) {
vpnManager.delExtraRoute(vpnName, destination, nextHop, rd, vpnName, intfName, writeConfigTxn, writeOperTx);
List<VpnInstanceOpDataEntry> vpnsToImportRoute = vpnUtil.getVpnsImportingMyRoute(vpnName);
for (VpnInstanceOpDataEntry vpn : vpnsToImportRoute) {
}
protected void createFibEntryForRouterInterface(String primaryRd, VpnInterface vpnInterface, String interfaceName,
- WriteTransaction writeConfigTxn, String vpnName) {
+ TypedWriteTransaction<Configuration> writeConfigTxn, String vpnName) {
if (vpnInterface == null) {
return;
}
}
protected void deleteFibEntryForRouterInterface(VpnInterface vpnInterface,
- WriteTransaction writeConfigTxn, String vpnName) {
+ TypedWriteTransaction<Configuration> writeConfigTxn, String vpnName) {
Adjacencies adjs = vpnInterface.augmentation(Adjacencies.class);
String rd = vpnUtil.getVpnRd(vpnName);
if (adjs != null) {
// if the oper tx goes in
if (vpnUtil.isAdjacencyEligibleToVpn(adjacency, vpnName)) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(operTx ->
- futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- confTx -> addNewAdjToVpnInterface(existingVpnInterfaceId,
- primaryRd, adjacency, vpnInterfaceOptional.get()
- .getDpnId(), confTx, operTx)))));
+ futures.add(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx ->
+ futures.add(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ confTx -> addNewAdjToVpnInterface(existingVpnInterfaceId,
+ primaryRd, adjacency, vpnInterfaceOptional.get()
+ .getDpnId(), operTx, confTx)))));
return futures;
} else {
return Collections.emptyList();
package org.opendaylight.netvirt.vpnmanager;
import com.google.common.base.Optional;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
+
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
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.TypedReadTransaction;
import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.infra.TypedWriteTransaction;
@Override
public void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
Long l3vni, RouteOrigin origin, String intfName, Adjacency operationalAdj, VrfEntry.EncapType encapType,
- TypedWriteTransaction<Configuration> confTx) {
- addExtraRoute(vpnName, destination, nextHop, rd, routerID, l3vni, origin, intfName, operationalAdj, encapType,
- TransactionAdapter.toWriteTransaction(confTx));
- }
-
- @Override
- public void addExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- Long l3vni, RouteOrigin origin, String intfName, Adjacency operationalAdj,
- VrfEntry.EncapType encapType, WriteTransaction writeConfigTxn) {
- if (writeConfigTxn == null) {
- String finalNextHop = nextHop;
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- addExtraRoute(vpnName, destination, finalNextHop, rd, routerID, l3vni, origin, intfName, operationalAdj,
- encapType, tx)),
- LOG, "Error adding extra route");
- return;
- }
-
+ @Nonnull TypedWriteTransaction<Configuration> confTx) {
//add extra route to vpn mapping; advertise with nexthop as tunnel ip
vpnUtil.syncUpdate(LogicalDatastoreType.OPERATIONAL,
VpnExtraRouteHelper.getVpnToExtrarouteVrfIdIdentifier(vpnName, rd != null ? rd : routerID,
L3vpnInput input = new L3vpnInput().setNextHop(operationalAdj).setNextHopIp(nextHop).setL3vni(l3vni)
.setPrimaryRd(primaryRd).setVpnName(vpnName).setDpnId(dpnId)
.setEncapType(encapType).setRd(rd).setRouteOrigin(origin);
- L3vpnRegistry.getRegisteredPopulator(encapType).populateFib(input, writeConfigTxn);
+ L3vpnRegistry.getRegisteredPopulator(encapType).populateFib(input, confTx);
}
}
}
@Override
public void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, TypedWriteTransaction<Configuration> confTx, TypedWriteTransaction<Operational> operTx) {
- delExtraRoute(vpnName, destination, nextHop, rd, routerID, intfName,
- TransactionAdapter.toWriteTransaction(confTx), TransactionAdapter.toWriteTransaction(operTx));
- }
-
- @Override
- public void delExtraRoute(String vpnName, String destination, String nextHop, String rd, String routerID,
- String intfName, WriteTransaction writeConfigTxn, WriteTransaction writeOperTx) {
- if (writeConfigTxn == null) {
- 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;
- }
+ String intfName, @Nonnull TypedWriteTransaction<Configuration> confTx,
+ @Nonnull TypedWriteTransaction<Operational> operTx) {
BigInteger dpnId = null;
String tunnelIp = nextHop;
if (intfName != null && !intfName.isEmpty()) {
}
if (rd != null) {
String primaryRd = vpnUtil.getVpnRd(vpnName);
- removePrefixFromBGP(vpnName, primaryRd, rd, intfName, destination, nextHop, tunnelIp, dpnId,
- writeConfigTxn, writeOperTx);
+ removePrefixFromBGP(vpnName, primaryRd, rd, intfName, destination,
+ nextHop, tunnelIp, dpnId, confTx, operTx);
LOG.info("delExtraRoute: Removed extra route {} from interface {} for rd {}", destination, intfName, rd);
} else {
// add FIB route directly
- fibManager.removeOrUpdateFibEntry(routerID, destination, tunnelIp, writeConfigTxn);
+ fibManager.removeOrUpdateFibEntry(routerID, destination, tunnelIp, confTx);
LOG.info("delExtraRoute: Removed extra route {} from interface {} for rd {}", destination, intfName,
routerID);
}
}
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
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 vpnName, String primaryRd, String extraRouteRd, String vpnInterfaceName,
- String prefix, String nextHop, String nextHopTunnelIp, BigInteger dpnId, WriteTransaction writeConfigTxn,
- WriteTransaction writeOperTx) {
try {
String vpnNamePrefixKey = VpnUtil.getVpnNamePrefixKey(vpnName, prefix);
synchronized (vpnNamePrefixKey.intern()) {
if (vpnUtil.removeOrUpdateDSForExtraRoute(vpnName, primaryRd, extraRouteRd, vpnInterfaceName, prefix,
- nextHop, nextHopTunnelIp, writeOperTx)) {
+ nextHop, nextHopTunnelIp, operTx)) {
return;
}
- fibManager.removeOrUpdateFibEntry(primaryRd, prefix, nextHopTunnelIp, writeConfigTxn);
+ fibManager.removeOrUpdateFibEntry(primaryRd, prefix, nextHopTunnelIp, confTx);
if (VpnUtil.isEligibleForBgp(extraRouteRd, vpnName, dpnId, null /*networkName*/)) {
// TODO: Might be needed to include nextHop here
bgpManager.withdrawPrefix(extraRouteRd, prefix);
(vpnId, dpId, subnetVpnId) -> addGwMac(srcMacAddress, confTx, vpnId, dpId, subnetVpnId));
}
- @Override
- public void addSubnetMacIntoVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
- BigInteger dpnId, WriteTransaction tx) throws ExecutionException, InterruptedException {
- setupSubnetMacInVpnInstance(vpnName, subnetVpnName, srcMacAddress, dpnId,
- (vpnId, dpId, subnetVpnId) -> addGwMac(srcMacAddress, tx, vpnId, dpId, subnetVpnId));
- }
-
@Override
public void removeSubnetMacFromVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
BigInteger dpnId, TypedReadWriteTransaction<Configuration> confTx)
(vpnId, dpId, subnetVpnId) -> removeGwMac(srcMacAddress, confTx, vpnId, dpId, subnetVpnId));
}
- @Override
- public void removeSubnetMacFromVpnInstance(String vpnName, String subnetVpnName, String srcMacAddress,
- BigInteger dpnId, WriteTransaction tx) throws ExecutionException, InterruptedException {
- setupSubnetMacInVpnInstance(vpnName, subnetVpnName, srcMacAddress, dpnId,
- (vpnId, dpId, subnetVpnId) -> removeGwMac(srcMacAddress, tx, vpnId, dpId, subnetVpnId));
- }
-
@FunctionalInterface
private interface VpnInstanceSubnetMacSetupMethod {
void process(long vpnId, BigInteger dpId, long subnetVpnId) throws InterruptedException, ExecutionException;
}
}
- private void addGwMac(String srcMacAddress, WriteTransaction tx, long vpnId, BigInteger dpId, long subnetVpnId) {
- FlowEntity flowEntity = vpnUtil.buildL3vpnGatewayFlow(dpId, srcMacAddress, vpnId, subnetVpnId);
- mdsalManager.addFlowToTx(flowEntity, tx);
- }
-
private void addGwMac(String srcMacAddress, TypedWriteTransaction<Configuration> tx, long vpnId, BigInteger dpId,
long subnetVpnId) {
FlowEntity flowEntity = vpnUtil.buildL3vpnGatewayFlow(dpId, srcMacAddress, vpnId, subnetVpnId);
mdsalManager.addFlow(tx, flowEntity);
}
- private void removeGwMac(String srcMacAddress, WriteTransaction tx, long vpnId, BigInteger dpId, long subnetVpnId) {
- FlowEntity flowEntity = vpnUtil.buildL3vpnGatewayFlow(dpId, srcMacAddress, vpnId, subnetVpnId);
- mdsalManager.removeFlowToTx(flowEntity, tx);
- }
-
+ // TODO skitt Fix the exception handling here
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ @SuppressFBWarnings("REC_CATCH_EXCEPTION")
private void removeGwMac(String srcMacAddress, TypedReadWriteTransaction<Configuration> tx, long vpnId,
BigInteger dpId, long subnetVpnId) throws ExecutionException, InterruptedException {
mdsalManager.removeFlow(tx, dpId,
vpnId -> addSubnetMacIntoVpnInstance(vpnId, subnetVpnName, routerGwMac, dpnId, confTx), "Installing");
}
- @Override
- public void addRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
- String subnetVpnName, WriteTransaction writeTx) throws ExecutionException, InterruptedException {
- setupRouterGwMacFlow(routerName, routerGwMac, dpnId, extNetworkId, writeTx,
- (vpnId, tx) -> addSubnetMacIntoVpnInstance(vpnId, subnetVpnName, routerGwMac, dpnId, tx), "Installing");
- }
-
@Override
public void removeRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
String subnetVpnName, TypedReadWriteTransaction<Configuration> confTx)
vpnId -> removeSubnetMacFromVpnInstance(vpnId, subnetVpnName, routerGwMac, dpnId, confTx), "Removing");
}
- @Override
- public void removeRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
- String subnetVpnName, WriteTransaction writeTx) throws ExecutionException, InterruptedException {
- setupRouterGwMacFlow(routerName, routerGwMac, dpnId, extNetworkId, writeTx,
- (vpnId, tx) -> removeSubnetMacFromVpnInstance(vpnId, subnetVpnName, routerGwMac, dpnId, tx), "Removing");
- }
-
- @FunctionalInterface
- private interface RouterGwMacFlowSetupMethod {
- void process(String vpnId, WriteTransaction tx) throws InterruptedException, ExecutionException;
- }
-
- private void setupRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
- WriteTransaction writeTx, RouterGwMacFlowSetupMethod consumer, String operation)
- throws ExecutionException, InterruptedException {
- if (routerGwMac == null) {
- LOG.warn("Failed to handle router GW flow in GW-MAC table. MAC address is missing for router-id {}",
- routerName);
- return;
- }
-
- if (dpnId == null || BigInteger.ZERO.equals(dpnId)) {
- LOG.info("setupRouterGwMacFlow: DPN id is missing for router-id {}",
- routerName);
- return;
- }
-
- Uuid vpnId = vpnUtil.getExternalNetworkVpnId(extNetworkId);
- if (vpnId == null) {
- LOG.warn("Network {} is not associated with VPN", extNetworkId.getValue());
- return;
- }
-
- LOG.info("{} router GW MAC flow for router-id {} on switch {}", operation, routerName, dpnId);
- if (writeTx == null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- tx -> consumer.process(vpnId.getValue(), tx)), LOG, "Commit transaction");
- } else {
- consumer.process(vpnId.getValue(), writeTx);
- }
- }
-
private void setupRouterGwMacFlow(String routerName, String routerGwMac, BigInteger dpnId, Uuid extNetworkId,
InterruptibleCheckedConsumer<String, ExecutionException> consumer, String operation)
throws ExecutionException, InterruptedException {
consumer.accept(vpnId.getValue());
}
- @Override
- public void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress,
- BigInteger dpnId, Uuid extNetworkId, WriteTransaction writeTx) {
- addArpResponderFlowsToExternalNetworkIps(id, fixedIps, macAddress, dpnId, extNetworkId);
- }
-
@Override
public void addArpResponderFlowsToExternalNetworkIps(String id, Collection<String> fixedIps, String macAddress,
BigInteger dpnId, Uuid extNetworkId) {
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutionException;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
+import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
+import org.opendaylight.genius.infra.TypedReadWriteTransaction;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
private void processNodeAdd(BigInteger dpId) {
jobCoordinator.enqueueJob("VPNNODE-" + dpId.toString(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> {
LOG.debug("Received notification to install TableMiss entries for dpn {} ", dpId);
makeTableMissFlow(tx, dpId, NwConstants.ADD_FLOW);
makeL3IntfTblMissFlow(tx, dpId, NwConstants.ADD_FLOW);
})), 3);
}
- private void makeTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
+ private void makeTableMissFlow(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId, int addOrRemove)
+ throws ExecutionException, InterruptedException {
final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
// Instruction to goto L3 InterfaceTable
List<InstructionInfo> instructions =
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install Table Miss Entry");
- mdsalManager.addFlowToTx(flowEntityLfib, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntityLfib);
} else {
- mdsalManager.removeFlowToTx(flowEntityLfib, writeFlowTx);
+ mdsalManager.removeFlow(confTx, flowEntityLfib);
}
}
- private void makeL3IntfTblMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
+ private void makeL3IntfTblMissFlow(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+ int addOrRemove) throws ExecutionException, InterruptedException {
List<InstructionInfo> instructions = new ArrayList<>();
List<MatchInfo> matches = new ArrayList<>();
final BigInteger cookieTableMiss = new BigInteger("1030000", 16);
matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("Invoking MDSAL to install L3 interface Table Miss Entries");
- mdsalManager.addFlowToTx(flowEntityL3Intf, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntityL3Intf);
} else {
- mdsalManager.removeFlowToTx(flowEntityL3Intf, writeFlowTx);
+ mdsalManager.removeFlow(confTx, flowEntityL3Intf);
}
}
- private void makeSubnetRouteTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
+ private void makeSubnetRouteTableMissFlow(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+ int addOrRemove) throws ExecutionException, InterruptedException {
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
NwConstants.COOKIE_SUBNET_ROUTE_TABLE_MISS, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
- mdsalManager.addFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntity);
} else {
- mdsalManager.removeFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.removeFlow(confTx, flowEntity);
}
}
- private void makeIpv6SubnetRouteTableMissFlow(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
+ private void makeIpv6SubnetRouteTableMissFlow(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+ int addOrRemove) throws ExecutionException, InterruptedException {
List<ActionInfo> actionsInfos = new ArrayList<>();
List<InstructionInfo> instructions = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
NwConstants.COOKIE_SUBNET_ROUTE_TABLE_MISS, matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
LOG.debug("makeIpv6SubnetRouteTableMissFlow: Install Ipv6 Subnet Route Table Miss entry");
- mdsalManager.addFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntity);
} else {
LOG.debug("makeIpv6SubnetRouteTableMissFlow: Remove Ipv6 Subnet Route Table Miss entry");
- mdsalManager.removeFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.removeFlow(confTx, flowEntity);
}
}
- private void programTableMissForVpnVniDemuxTable(WriteTransaction writeFlowTx, BigInteger dpnId, int addOrRemove) {
+ private void programTableMissForVpnVniDemuxTable(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+ int addOrRemove) throws ExecutionException, InterruptedException {
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionNxResubmit(NwConstants
.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
new BigInteger("1080000", 16), matches, instructions);
if (addOrRemove == NwConstants.ADD_FLOW) {
- mdsalManager.addFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntity);
} else {
- mdsalManager.removeFlowToTx(flowEntity, writeFlowTx);
+ mdsalManager.removeFlow(confTx, flowEntity);
}
}
- private void createTableMissForVpnGwFlow(WriteTransaction writeFlowTx, BigInteger dpId) {
+ private void createTableMissForVpnGwFlow(TypedWriteTransaction<Configuration> confTx, BigInteger dpId) {
List<MatchInfo> matches = new ArrayList<>();
List<ActionInfo> actionsInfos =
Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
NwConstants.TABLE_MISS_PRIORITY, "L3 Gw Mac Table Miss", 0, 0, new BigInteger("1080000", 16), matches,
instructions);
LOG.trace("Invoking MDSAL to install L3 Gw Mac Table Miss Entry");
- mdsalManager.addFlowToTx(flowEntityMissforGw, writeFlowTx);
+ mdsalManager.addFlow(confTx, flowEntityMissforGw);
}
- private void createL3GwMacArpFlows(WriteTransaction writeFlowTx, BigInteger dpId) {
+ private void createL3GwMacArpFlows(TypedWriteTransaction<Configuration> confTx, BigInteger dpId) {
FlowEntity arpReqGwMacTbl = ArpResponderUtil.createArpDefaultFlow(dpId, NwConstants.L3_GW_MAC_TABLE,
NwConstants.ARP_REQUEST, () -> Arrays.asList(MatchEthernetType.ARP, MatchArpOp.REQUEST),
() -> Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE)));
LOG.trace("Invoking MDSAL to install Arp Rquest Match Flow for table {}", NwConstants.L3_GW_MAC_TABLE);
- mdsalManager.addFlowToTx(arpReqGwMacTbl, writeFlowTx);
+ mdsalManager.addFlow(confTx, arpReqGwMacTbl);
FlowEntity arpRepGwMacTbl = ArpResponderUtil.createArpDefaultFlow(dpId, NwConstants.L3_GW_MAC_TABLE,
NwConstants.ARP_REPLY, () -> Arrays.asList(MatchEthernetType.ARP, MatchArpOp.REPLY),
() -> Collections.singletonList(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE)));
LOG.trace("Invoking MDSAL to install Arp Reply Match Flow for Table {} ", NwConstants.L3_GW_MAC_TABLE);
- mdsalManager.addFlowToTx(arpRepGwMacTbl, writeFlowTx);
+ mdsalManager.addFlow(confTx, arpRepGwMacTbl);
}
private String getTableMissFlowRef(BigInteger dpnId, short tableId, int tableMiss) {
*/
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
+import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache;
import org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite;
import org.opendaylight.netvirt.vpnmanager.intervpnlink.InterVpnLinkUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.vpn.rpc.rev160201.AddStaticRouteInput;
@Singleton
public class VpnRpcServiceImpl implements VpnRpcService {
private static final Logger LOG = LoggerFactory.getLogger(VpnRpcServiceImpl.class);
- private final DataBroker dataBroker;
- private final IdManagerService idManager;
+ private final ManagedNewTransactionRunner txRunner;
private final IFibManager fibManager;
private final IBgpManager bgpManager;
private final IVpnManager vpnManager;
private final InterVpnLinkUtil interVpnLinkUtil;
@Inject
- public VpnRpcServiceImpl(final DataBroker dataBroker, final IdManagerService idManager,
+ public VpnRpcServiceImpl(final DataBroker dataBroker,
final IFibManager fibManager, IBgpManager bgpManager, final IVpnManager vpnManager,
final InterVpnLinkCache interVpnLinkCache, VpnUtil vpnUtil, InterVpnLinkUtil interVpnLinkUtil) {
- this.dataBroker = dataBroker;
- this.idManager = idManager;
+ this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.fibManager = fibManager;
this.bgpManager = bgpManager;
this.vpnManager = vpnManager;
return result;
}
} else {
- vpnManager.addExtraRoute(vpnInstanceName, destination, nexthop, vpnRd, null /* routerId */,
- vpnOpEntry.getL3vni(), RouteOrigin.STATIC, null /* intfName */,
- null /*Adjacency*/, encapType, (WriteTransaction) null);
+ try {
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ confTx -> vpnManager.addExtraRoute(vpnInstanceName, destination, nexthop, vpnRd,
+ null /* routerId */, vpnOpEntry.getL3vni(), RouteOrigin.STATIC, null /* intfName */,
+ null /*Adjacency*/, encapType, confTx)).get();
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Error adding static route {}", input, e);
+ result.set(RpcResultBuilder.<AddStaticRouteOutput>failed().withError(ErrorType.APPLICATION,
+ "Error adding static route " + input, e).build());
+ return result;
+ }
}
AddStaticRouteOutput labelOutput = new AddStaticRouteOutputBuilder().setLabel(label).build();
bgpManager.withdrawPrefix(vpnRd, destination);
} else {
vpnManager.delExtraRoute(vpnInstanceName, destination,
- nexthop, vpnRd, null /* routerId */, null /* intfName */, (WriteTransaction) null,
- (WriteTransaction) null);
+ nexthop, vpnRd, null /* routerId */, null /* intfName */, null,
+ null);
}
result.set(RpcResultBuilder.success(new RemoveStaticRouteOutputBuilder().build()).build());
return result;
+
}
private String formatAndLog(Consumer<String> logger, String template, Object arg1, Object arg2) {
package org.opendaylight.netvirt.vpnmanager;
import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
-import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.vpnmanager.api.VpnHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces;
private final IInterfaceManager interfaceManager;
private final IFibManager fibManager;
private final JobCoordinator jobCoordinator;
- private final ManagedNewTransactionRunner txRunner;
private final VpnUtil vpnUtil;
@Inject
this.interfaceManager = interfaceManager;
this.fibManager = fibManager;
this.jobCoordinator = jobCoordinator;
- this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
this.vpnUtil = vpnUtil;
}
String primaryRd = vpnUtil.getPrimaryRd(vpnName);
if (elanInstance != null && !elanInstance.isExternal() && VpnUtil.isVlan(elanInstance)) {
jobCoordinator.enqueueJob(elanInstance.getElanInstanceName(), () -> {
- ListenableFuture<Void> future = txRunner.callWithNewWriteOnlyTransactionAndSubmit(writeConfigTxn -> {
- List<String> addedInterfaces = getUpdatedInterfaceList(update.getInterfaces(),
- original.getInterfaces());
- for (String addedInterface: addedInterfaces) {
- if (interfaceManager.isExternalInterface(addedInterface)) {
- InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(primaryRd,
- dpnId);
- Optional<VpnToDpnList> dpnInVpn = SingleTransactionDataBroker.syncReadOptional(dataBroker,
- LogicalDatastoreType.OPERATIONAL, id);
- if (!dpnInVpn.isPresent() || (dpnInVpn.get().getVpnInterfaces() != null
- && dpnInVpn.get().getVpnInterfaces().size() != 1)) {
- return;
- }
- if (!vpnUtil.shouldPopulateFibForVlan(vpnName, elanInstanceName, dpnId)) {
- return;
- }
- long vpnId = vpnUtil.getVpnId(vpnName);
- fibManager.populateFibOnNewDpn(dpnId, vpnId, primaryRd, null);
- break;
+ List<String> addedInterfaces = getUpdatedInterfaceList(update.getInterfaces(),
+ original.getInterfaces());
+ for (String addedInterface : addedInterfaces) {
+ if (interfaceManager.isExternalInterface(addedInterface)) {
+ InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(primaryRd, dpnId);
+ Optional<VpnToDpnList> dpnInVpn = SingleTransactionDataBroker.syncReadOptional(dataBroker,
+ LogicalDatastoreType.OPERATIONAL, id);
+ if (!dpnInVpn.isPresent() || (dpnInVpn.get().getVpnInterfaces() != null
+ && dpnInVpn.get().getVpnInterfaces().size() != 1)) {
+ return Collections.emptyList();
}
- }
- List<String> deletedInterfaces = getUpdatedInterfaceList(original.getInterfaces(),
- update.getInterfaces());
- if (!deletedInterfaces.isEmpty()) {
- String routerPortUuid = vpnUtil.getRouterPordIdFromElanInstance(elanInstanceName);
- if (update.getInterfaces().size() == 2 && update.getInterfaces().contains(routerPortUuid)) {
- vpnUtil.removeRouterPortFromElanForVlanInDpn(vpnName, dpnId);
+ if (!vpnUtil.shouldPopulateFibForVlan(vpnName, elanInstanceName, dpnId)) {
+ return Collections.emptyList();
}
+ long vpnId = vpnUtil.getVpnId(vpnName);
+ fibManager.populateFibOnNewDpn(dpnId, vpnId, primaryRd, null);
+ break;
+ }
+ }
+ List<String> deletedInterfaces = getUpdatedInterfaceList(original.getInterfaces(),
+ update.getInterfaces());
+ if (!deletedInterfaces.isEmpty()) {
+ String routerPortUuid = vpnUtil.getRouterPordIdFromElanInstance(elanInstanceName);
+ if (update.getInterfaces().size() == 2 && update.getInterfaces().contains(routerPortUuid)) {
+ vpnUtil.removeRouterPortFromElanForVlanInDpn(vpnName, dpnId);
}
- });
- ListenableFutures.addErrorLogging(future, LOG, "Failed to process DpnInterfaces update event for"
- + "dpn {} elan {} vpn {}", dpnId, elanInstanceName, vpnName);
- return Collections.singletonList(future);
+ }
+ return Collections.emptyList();
});
}
}
package org.opendaylight.netvirt.vpnmanager;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import com.google.common.base.Optional;
import com.google.common.collect.Iterators;
import com.google.common.net.InetAddresses;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.infra.TypedReadTransaction;
+import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.FlowEntity;
public boolean removeOrUpdateDSForExtraRoute(String vpnName, String primaryRd, String extraRouteRd,
String vpnInterfaceName, String prefix, String nextHop,
- String nextHopTunnelIp, WriteTransaction operTx) {
+ String nextHopTunnelIp, TypedWriteTransaction<Operational> operTx) {
LOG.info("removeOrUpdateDSForExtraRoute: VPN WITHDRAW: Removing Fib Entry rd {} prefix {} nexthop {}",
extraRouteRd, prefix, nextHop);
boolean areNextHopsClearedForRd = false;
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));
+ operTx.delete(VpnUtil.getVpnInterfaceOpDataEntryAdjacencyIdentifier(vpnInterfaceName, vpnName, prefix));
LOG.info("VPN WITHDRAW: removeOrUpdateDSForExtraRoute: Removed Fib Entry rd {} prefix {} nexthop {}",
extraRouteRd, prefix, nextHopTunnelIp);
areNextHopsClearedForRd = true;
new ElanTagNameKey(elanTag)).build();
}
- static void removePrefixToInterfaceForVpnId(long vpnId,
- @Nonnull TypedWriteTransaction<Operational> operTx) {
+ static void removePrefixToInterfaceForVpnId(long vpnId, @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<Operational> operTx) {
+ static void removeVpnExtraRouteForVpn(String vpnName, @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<Operational> operTx) {
+ static void removeVpnOpInstance(String vpnName, @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up VPNInstanceOpDataEntry
operTx.delete(getVpnInstanceOpDataIdentifier(vpnName));
}
- static void removeVpnInstanceToVpnId(String vpnName,
- @Nonnull TypedWriteTransaction<Configuration> confTx) {
+ static void removeVpnInstanceToVpnId(String vpnName, @Nonnull TypedWriteTransaction<Configuration> confTx) {
confTx.delete(VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnName));
}
- static void removeVpnIdToVpnInstance(long vpnId,
- @Nonnull TypedWriteTransaction<Configuration> confTx) {
+ static void removeVpnIdToVpnInstance(long vpnId, @Nonnull TypedWriteTransaction<Configuration> confTx) {
confTx.delete(getVpnIdToVpnInstanceIdentifier(vpnId));
}
- static void removeL3nexthopForVpnId(long vpnId,
- @Nonnull TypedWriteTransaction<Operational> operTx) {
+ static void removeL3nexthopForVpnId(long vpnId, @Nonnull TypedWriteTransaction<Operational> operTx) {
// Clean up L3NextHop Operational DS
operTx.delete(InstanceIdentifier.builder(L3nexthop.class).child(
VpnNexthops.class, new VpnNexthopsKey(vpnId)).build());
return routerData.isPresent() ? routerData.get() : null;
}
+ @Nullable
+ Routers getExternalRouter(TypedReadTransaction<Configuration> tx, String routerId)
+ throws ExecutionException, InterruptedException {
+ InstanceIdentifier<Routers> id = InstanceIdentifier.builder(ExtRouters.class).child(Routers.class,
+ new RoutersKey(routerId)).build();
+ return tx.read(id).get().orNull();
+ }
+
static InstanceIdentifier<Subnetmaps> buildSubnetMapsWildCardPath() {
return InstanceIdentifier.create(Subnetmaps.class);
}
return gatewayMac;
}
- void setupGwMacIfExternalVpn(BigInteger dpnId, String interfaceName, long vpnId, WriteTransaction writeInvTxn,
- int addOrRemove, String gwMac) {
+ void setupGwMacIfExternalVpn(BigInteger dpnId, String interfaceName, long vpnId,
+ TypedReadWriteTransaction<Configuration> writeInvTxn, int addOrRemove, String gwMac)
+ throws ExecutionException, InterruptedException {
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance
.VpnIds> vpnIdsInstanceIdentifier = getVpnIdToVpnInstanceIdentifier(vpnId);
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance
- .VpnIds> vpnIdsOptional = read(LogicalDatastoreType.CONFIGURATION, vpnIdsInstanceIdentifier);
+ .VpnIds> vpnIdsOptional = writeInvTxn.read(vpnIdsInstanceIdentifier).get();
if (vpnIdsOptional.isPresent() && vpnIdsOptional.get().isExternalVpn()) {
if (gwMac == null) {
LOG.error("setupGwMacIfExternalVpn: Failed to get gwMacAddress for interface {} on dpn {} vpn {}",
}
FlowEntity flowEntity = buildL3vpnGatewayFlow(dpnId, gwMac, vpnId, VpnConstants.INVALID_ID);
if (addOrRemove == NwConstants.ADD_FLOW) {
- mdsalManager.addFlowToTx(flowEntity, writeInvTxn);
+ mdsalManager.addFlow(writeInvTxn, flowEntity);
} else if (addOrRemove == NwConstants.DEL_FLOW) {
- mdsalManager.removeFlowToTx(flowEntity, writeInvTxn);
+ mdsalManager.removeFlow(writeInvTxn, flowEntity);
}
}
}
ListenableFuture<Void> unsetScheduledToRemoveForVpnInterface(String interfaceName) {
VpnInterfaceBuilder builder = new VpnInterfaceBuilder().withKey(new VpnInterfaceKey(interfaceName));
- return txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore.OPERATIONAL, tx -> tx.merge(
+ return txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> tx.merge(
VpnUtil.getVpnInterfaceIdentifier(interfaceName), builder.build(),
WriteTransaction.CREATE_MISSING_PARENTS));
}
*/
package org.opendaylight.netvirt.vpnmanager.intervpnlink;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.math.BigInteger;
.child(VrfTables.class, new VrfTablesKey(dstVpnRd))
.child(VrfEntry.class, new VrfEntryKey(newVrfEntry.getDestPrefix()))
.build();
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.put(LogicalDatastoreType.CONFIGURATION, newVrfEntryIid, newVrfEntry)),
- LOG, "Error adding VRF entry {}", newVrfEntry);
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.put(newVrfEntryIid, newVrfEntry)), LOG, "Error adding VRF entry {}", newVrfEntry);
// Finally, route is advertised it to the DC-GW. But while in the FibEntries the nexthop is the other
// endpoint's IP, in the DC-GW the nexthop for those prefixes are the IPs of those DPNs where the target
*/
package org.opendaylight.netvirt.vpnmanager.intervpnlink;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
// Removing the InterVpnLinkState
InstanceIdentifier<InterVpnLinkState> interVpnLinkStateIid =
InterVpnLinkUtil.getInterVpnLinkStateIid(del.getName());
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.delete(LogicalDatastoreType.CONFIGURATION, interVpnLinkStateIid)), LOG,
- "Error deleting inter-VPN link state {}", interVpnLinkStateIid);
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.delete(interVpnLinkStateIid)), LOG, "Error deleting inter-VPN link state {}", interVpnLinkStateIid);
}
// We're catching Exception here to continue deleting as much as possible
new InterVpnLinkStateBuilder(vpnLinkState).setState(InterVpnLinkState.State.Error)
.setErrorDescription(errorMsg)
.build();
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.put(LogicalDatastoreType.CONFIGURATION, vpnLinkStateIid, vpnLinkErrorState,
- WriteTransaction.CREATE_MISSING_PARENTS)),
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.put(vpnLinkStateIid, vpnLinkErrorState, CREATE_MISSING_PARENTS)),
LOG, "Error storing the VPN link error state for {}, {}", vpnLinkStateIid, vpnLinkErrorState);
// Sending out an error Notification
*/
package org.opendaylight.netvirt.vpnmanager.intervpnlink;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigInteger;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
new InterVpnLinkStateBuilder(interVpnLinkState).setState(InterVpnLinkState.State.Active)
.setFirstEndpointState(firstEndPointState).setSecondEndpointState(secondEndPointState)
.build();
- return txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.merge(LogicalDatastoreType.CONFIGURATION,
- InterVpnLinkUtil.getInterVpnLinkStateIid(interVpnLinkState.getInterVpnLinkName()),
- newInterVpnLinkState, WriteTransaction.CREATE_MISSING_PARENTS));
+ return txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.merge(InterVpnLinkUtil.getInterVpnLinkStateIid(interVpnLinkState.getInterVpnLinkName()),
+ newInterVpnLinkState, CREATE_MISSING_PARENTS));
}
private void installLPortDispatcherTable(InterVpnLinkState interVpnLinkState, List<BigInteger> firstDpnList,
*/
package org.opendaylight.netvirt.vpnmanager.intervpnlink.tasks;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.netvirt.vpnmanager.intervpnlink.InterVpnLinkUtil;
interVpnLinkToPersist.getSecondEndpoint().getVpnUuid(),
interVpnLinkToPersist.getSecondEndpoint().getIpAddress());
- return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.merge(LogicalDatastoreType.CONFIGURATION,
- InterVpnLinkUtil.getInterVpnLinkPath(interVpnLinkToPersist.getName()),
- interVpnLinkToPersist, WriteTransaction.CREATE_MISSING_PARENTS)));
+ return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.merge(InterVpnLinkUtil.getInterVpnLinkPath(interVpnLinkToPersist.getName()),
+ interVpnLinkToPersist, CREATE_MISSING_PARENTS)));
}
}
*/
package org.opendaylight.netvirt.vpnmanager.intervpnlink.tasks;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.util.concurrent.ListenableFuture;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.links.InterVpnLink;
@Override
public List<ListenableFuture<Void>> call() {
LOG.debug("Removing InterVpnLink {} from storage", interVpnLinkName);
- return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx ->
- tx.delete(LogicalDatastoreType.CONFIGURATION, this.interVpnLinkIid)));
+ return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx ->
+ tx.delete(this.interVpnLinkIid)));
}
}
import javax.inject.Inject;
import javax.inject.Singleton;
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.TypedWriteTransaction;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
}
@Override
- public void populateFib(L3vpnInput input, WriteTransaction writeConfigTxn) {
+ public void populateFib(L3vpnInput input, TypedWriteTransaction<Configuration> writeConfigTxn) {
if (input.getRouteOrigin() == RouteOrigin.CONNECTED) {
LOG.info("populateFib : Found SubnetRoute for subnet {} rd {}", input.getSubnetIp(), input.getPrimaryRd());
addSubnetRouteFibEntry(input);
import javax.inject.Inject;
import javax.inject.Singleton;
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.TypedWriteTransaction;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.fibmanager.api.IFibManager;
import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
}
@Override
- public void populateFib(L3vpnInput input, WriteTransaction writeConfigTxn) {
+ public void populateFib(L3vpnInput input, TypedWriteTransaction<Configuration> writeConfigTxn) {
if (input.getRouteOrigin() == RouteOrigin.CONNECTED) {
LOG.info("populateFib : Found SubnetRoute for subnet {} rd {}", input.getSubnetIp(), input.getPrimaryRd());
addSubnetRouteFibEntry(input);
*/
package org.opendaylight.netvirt.vpnmanager.populator.impl;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
import static org.opendaylight.infrautils.utils.concurrent.ListenableFutures.addErrorLogging;
import com.google.common.base.Optional;
import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.fibmanager.api.FibHelper;
}
@Override
- public void populateFib(L3vpnInput input, WriteTransaction writeCfgTxn) {}
+ public void populateFib(L3vpnInput input, TypedWriteTransaction<Configuration> writeCfgTxn) {}
public void addSubnetRouteFibEntry(L3vpnInput input) {
String rd = input.getRd();
Preconditions.checkNotNull(nextHopIpList, "addToLabelMapper: nextHopIp cannot be null or empty!");
}
synchronized (label.toString().intern()) {
- addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
LOG.info("addToLabelMapper: label {} dpn {} prefix {} nexthoplist {} vpnid {} vpnIntfcName {} rd {}"
+ " elanTag {}", label, dpnId, prefix, nextHopIpList, vpnId, vpnInterfaceName, rd, elanTag);
if (dpnId != null) {
LabelRouteInfo lri = lriBuilder.build();
InstanceIdentifier<LabelRouteInfo> lriIid = InstanceIdentifier.builder(LabelRouteMap.class)
.child(LabelRouteInfo.class, new LabelRouteInfoKey(label)).build();
- tx.merge(LogicalDatastoreType.OPERATIONAL, lriIid, lri, true);
+ tx.merge(lriIid, lri, CREATE_MISSING_PARENTS);
LOG.info("addToLabelMapper: Added label route info to label {} prefix {} nextHopList {} vpnId {}"
+ " interface {} rd {} elantag {}", label, prefix, nextHopIpList, vpnId, vpnInterfaceName,
rd, elanTag);
@SuppressWarnings("checkstyle:IllegalCatch")
protected void addPrefixToBGP(String rd, String primaryRd, String macAddress, String prefix, String nextHopIp,
VrfEntry.EncapType encapType, long label, long l3vni, String gatewayMac,
- RouteOrigin origin, WriteTransaction writeConfigTxn) {
+ RouteOrigin origin, TypedWriteTransaction<Configuration> writeConfigTxn) {
try {
List<String> nextHopList = Collections.singletonList(nextHopIp);
LOG.info("ADD: addPrefixToBGP: Adding Fib entry rd {} prefix {} nextHop {} label {} gwMac {}", rd, prefix,
*/
package org.opendaylight.netvirt.vpnmanager.populator.intfc;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.genius.infra.Datastore.Configuration;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.netvirt.vpnmanager.populator.input.L3vpnInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency;
public interface VpnPopulator {
- void populateFib(L3vpnInput input, WriteTransaction writeCfgTxn);
+ void populateFib(L3vpnInput input, TypedWriteTransaction<Configuration> writeCfgTxn);
Adjacency createOperationalAdjacency(L3vpnInput input);
}