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.OPERATIONAL;
+
import com.google.common.base.Optional;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import org.eclipse.jdt.annotation.Nullable;
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.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
}
}
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
private void createOrUpdateVpnToDpnListForInterfaceName(Uint32 vpnId, String primaryRd, Uint64 dpnId,
String intfName, String vpnName) {
AtomicBoolean newDpnOnVpn = new AtomicBoolean(false);
final ReentrantLock lock = JvmGlobalLocks.getLockForString(vpnName);
lock.lock();
try {
- ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(primaryRd, dpnId);
VpnInterfaces vpnInterface = new VpnInterfacesBuilder().setInterfaceName(intfName).build();
- Optional<VpnToDpnList> dpnInVpn = tx.read(LogicalDatastoreType.OPERATIONAL, id).checkedGet();
+ Optional<VpnToDpnList> dpnInVpn = tx.read(id).get();
if (dpnInVpn.isPresent()) {
VpnToDpnList vpnToDpnList = dpnInVpn.get();
List<VpnInterfaces> vpnInterfaces = new ArrayList<>(vpnToDpnList.nonnullVpnInterfaces());
VpnToDpnListBuilder vpnToDpnListBuilder = new VpnToDpnListBuilder(vpnToDpnList);
vpnToDpnListBuilder.setDpnState(VpnToDpnList.DpnState.Active).setVpnInterfaces(vpnInterfaces);
- tx.put(LogicalDatastoreType.OPERATIONAL, id, vpnToDpnListBuilder.build(),
- WriteTransaction.CREATE_MISSING_PARENTS);
+ tx.put(id, vpnToDpnListBuilder.build(), CREATE_MISSING_PARENTS);
/*
* If earlier state was inactive, it is considered new DPN coming back to the
* same VPN
VpnToDpnListBuilder vpnToDpnListBuilder = new VpnToDpnListBuilder().setDpnId(dpnId);
vpnToDpnListBuilder.setDpnState(VpnToDpnList.DpnState.Active).setVpnInterfaces(vpnInterfaces);
- tx.put(LogicalDatastoreType.OPERATIONAL, id, vpnToDpnListBuilder.build(),
- WriteTransaction.CREATE_MISSING_PARENTS);
+ tx.put(id, vpnToDpnListBuilder.build(), CREATE_MISSING_PARENTS);
newDpnOnVpn.set(true);
LOG.debug("createOrUpdateVpnToDpnList: Creating vpn footprint for vpn {} vpnId {} interface {}"
+ " on dpn {}", vpnName, vpnId, intfName, dpnId);
}
}
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
private void createOrUpdateVpnToDpnListForIPAddress(Uint32 vpnId, String primaryRd, Uint64 dpnId,
ImmutablePair<IpAddresses.IpAddressSource, String> ipAddressSourceValuePair, String vpnName) {
AtomicBoolean newDpnOnVpn = new AtomicBoolean(false);
final ReentrantLock lock = JvmGlobalLocks.getLockForString(vpnName);
lock.lock();
try {
- ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(primaryRd, dpnId);
IpAddressesBuilder ipAddressesBldr = new IpAddressesBuilder()
.setIpAddressSource(ipAddressSourceValuePair.getKey());
ipAddressesBldr.withKey(new IpAddressesKey(ipAddressSourceValuePair.getValue()));
ipAddressesBldr.setIpAddress(ipAddressSourceValuePair.getValue());
- Optional<VpnToDpnList> dpnInVpn = tx.read(LogicalDatastoreType.OPERATIONAL, id).checkedGet();
+ Optional<VpnToDpnList> dpnInVpn = tx.read(id).get();
if (dpnInVpn.isPresent()) {
VpnToDpnList vpnToDpnList = dpnInVpn.get();
List<IpAddresses> ipAddresses = new ArrayList<>(vpnToDpnList.nonnullIpAddresses());
VpnToDpnListBuilder vpnToDpnListBuilder = new VpnToDpnListBuilder(vpnToDpnList);
vpnToDpnListBuilder.setDpnState(VpnToDpnList.DpnState.Active).setIpAddresses(ipAddresses);
- tx.put(LogicalDatastoreType.OPERATIONAL, id, vpnToDpnListBuilder.build(), true);
+ tx.put(id, vpnToDpnListBuilder.build(), CREATE_MISSING_PARENTS);
/*
* If earlier state was inactive, it is considered new DPN coming back to the
* same VPN
ipAddresses.add(ipAddressesBldr.build());
VpnToDpnListBuilder vpnToDpnListBuilder = new VpnToDpnListBuilder().setDpnId(dpnId);
vpnToDpnListBuilder.setDpnState(VpnToDpnList.DpnState.Active).setIpAddresses(ipAddresses);
- tx.put(LogicalDatastoreType.OPERATIONAL, id, vpnToDpnListBuilder.build(), true);
+ tx.put(id, vpnToDpnListBuilder.build(), CREATE_MISSING_PARENTS);
newDpnOnVpn.set(true);
}
}
}
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
private void removeOrUpdateVpnToDpnListForInterfaceName(Uint32 vpnId, String rd, Uint64 dpnId, String intfName,
String vpnName) {
AtomicBoolean lastDpnOnVpn = new AtomicBoolean(false);
lock.lock();
try {
try {
- ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(rd, dpnId);
- Optional<VpnToDpnList> dpnInVpnOpt = tx.read(LogicalDatastoreType.OPERATIONAL, id)
- .checkedGet();
+ Optional<VpnToDpnList> dpnInVpnOpt = tx.read(id).get();
if (!dpnInVpnOpt.isPresent()) {
LOG.error("removeOrUpdateVpnToDpnList: Could not find DpnToVpn map for VPN=[name={}"
+ " rd={} id={}] and dpnId={}", vpnName, rd, id, dpnId);
}
LOG.debug("removeOrUpdateVpnToDpnList: Removing vpn footprint for vpn {} vpnId {} "
+ "interface {}, on dpn {}", vpnName, vpnName, intfName, dpnId);
- tx.put(LogicalDatastoreType.OPERATIONAL, id, dpnInVpnBuilder.build(),
- WriteTransaction.CREATE_MISSING_PARENTS);
+ tx.put(id, dpnInVpnBuilder.build(), CREATE_MISSING_PARENTS);
} else {
- tx.delete(LogicalDatastoreType.OPERATIONAL,
- id.child(VpnInterfaces.class, new VpnInterfacesKey(intfName)));
+ tx.delete(id.child(VpnInterfaces.class, new VpnInterfacesKey(intfName)));
LOG.debug("removeOrUpdateVpnToDpnList: Updating vpn footprint for vpn {} vpnId {} "
+ "interface {}, on dpn {}", vpnName, vpnName, intfName, dpnId);
}
}
}
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
private void removeOrUpdateVpnToDpnListForIpAddress(Uint32 vpnId, String rd, Uint64 dpnId,
ImmutablePair<IpAddresses.IpAddressSource, String> ipAddressSourceValuePair, String vpnName) {
AtomicBoolean lastDpnOnVpn = new AtomicBoolean(false);
final ReentrantLock lock = JvmGlobalLocks.getLockForString(vpnName);
lock.lock();
try {
- ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ ListenableFuture<Void> future = txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier<VpnToDpnList> id = VpnHelper.getVpnToDpnListIdentifier(rd, dpnId);
- Optional<VpnToDpnList> dpnInVpnOpt = tx.read(LogicalDatastoreType.OPERATIONAL, id)
- .checkedGet();
+ Optional<VpnToDpnList> dpnInVpnOpt = tx.read(id).get();
if (!dpnInVpnOpt.isPresent()) {
LOG.error("removeOrUpdateVpnToDpnList: Could not find DpnToVpn map for VPN=[name={} "
+ "rd={} id={}] and dpnId={}", vpnName, rd, id, dpnId);
LOG.warn("ip addresses are empty but vpn interfaces are present for the vpn {} in "
+ "dpn {}", vpnName, dpnId);
}
- tx.put(LogicalDatastoreType.OPERATIONAL, id, dpnInVpnBuilder.build(), true);
+ tx.put(id, dpnInVpnBuilder.build(), CREATE_MISSING_PARENTS);
} else {
- tx.delete(LogicalDatastoreType.OPERATIONAL, id.child(IpAddresses.class,
- new IpAddressesKey(ipAddressSourceValuePair.getValue())));
+ tx.delete(id.child(IpAddresses.class, new IpAddressesKey(ipAddressSourceValuePair.getValue())));
}
}
*/
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 java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
+import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
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.TypedReadTransaction;
+import org.opendaylight.genius.infra.TypedReadWriteTransaction;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.VpnInterfaceOpData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.adjacency.list.Adjacency;
@Override
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
protected void remove(final InstanceIdentifier<VpnInterfaceOpDataEntry> identifier,
final VpnInterfaceOpDataEntry del) {
final VpnInterfaceOpDataEntryKey key = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class);
final String interfaceName = key.getName();
jobCoordinator.enqueueJob("VPNINTERFACE-" + interfaceName,
- () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
- postProcessVpnInterfaceRemoval(identifier, del, tx);
+ () -> Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
+ postProcessVpnInterfaceRemoval(identifier, del, tx, null);
LOG.info("remove: Removed vpn operational data for interface {} on dpn {} vpn {}", del.getName(),
del.getDpnId(), del.getVpnInstanceName());
})));
}
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
private void postProcessVpnInterfaceRemoval(InstanceIdentifier<VpnInterfaceOpDataEntry> identifier,
- VpnInterfaceOpDataEntry del, ReadWriteTransaction readWriteTxn) {
- if (readWriteTxn == null) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(tx ->
- postProcessVpnInterfaceRemoval(identifier, del, tx)), LOG,
- "Error post-processing VPN interface removal");
+ VpnInterfaceOpDataEntry del, @Nullable TypedReadWriteTransaction<Operational> operTx,
+ @Nullable TypedReadTransaction<Configuration> confTx) throws InterruptedException {
+ if (confTx == null) {
+ txRunner.callWithNewReadOnlyTransactionAndClose(CONFIGURATION,
+ tx -> postProcessVpnInterfaceRemoval(identifier, del, operTx, tx));
+ return;
+ }
+ if (operTx == null) {
+ LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL,
+ tx -> postProcessVpnInterfaceRemoval(identifier, del, tx, confTx)), LOG,
+ "Error post-processing VPN interface removal");
return;
}
final VpnInterfaceOpDataEntryKey key = identifier.firstKeyOf(VpnInterfaceOpDataEntry.class);
LOG.info("postProcessVpnInterfaceRemoval: interface name {} vpnName {} dpn {}", interfaceName, vpnName,
del.getDpnId());
//decrement the vpn interface count in Vpn Instance Op Data
- Optional<VpnInstance> vpnInstance = readWriteTxn.read(LogicalDatastoreType.CONFIGURATION,
- VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnName)).checkedGet();
+ Optional<VpnInstance> vpnInstance =
+ confTx.read(VpnOperDsUtils.getVpnInstanceToVpnIdIdentifier(vpnName)).get();
if (vpnInstance.isPresent()) {
String rd = vpnInstance.get().getVrfId();
List<Prefixes> prefixToInterface = new ArrayList<>();
for (Adjacency adjacency : adjs.getAdjacency()) {
List<Prefixes> prefixToInterfaceLocal = new ArrayList<>();
- Optional<Prefixes> prefix = SingleTransactionDataBroker.syncReadOptional(dataBroker,
- LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getPrefixToInterfaceIdentifier(vpnInstOp.getVpnId(),
- VpnUtil.getIpPrefix(adjacency.getIpAddress())));
+ Optional<Prefixes> prefix = operTx.read(
+ VpnUtil.getPrefixToInterfaceIdentifier(vpnInstOp.getVpnId(),
+ VpnUtil.getIpPrefix(adjacency.getIpAddress()))).get();
if (prefix.isPresent()) {
prefixToInterfaceLocal.add(prefix.get());
}
if (prefixToInterfaceLocal.isEmpty() && adjacency.getNextHopIpList() != null) {
for (String nh : adjacency.getNextHopIpList()) {
- prefix = SingleTransactionDataBroker.syncReadOptional(dataBroker,
- LogicalDatastoreType.OPERATIONAL, VpnUtil.getPrefixToInterfaceIdentifier(
- vpnInstOp.getVpnId(), VpnUtil.getIpPrefix(nh)));
+ prefix = operTx.read(VpnUtil.getPrefixToInterfaceIdentifier(vpnInstOp.getVpnId(),
+ VpnUtil.getIpPrefix(nh))).get();
if (prefix.isPresent()) {
prefixToInterfaceLocal.add(prefix.get());
}
*/
for (Prefixes pref : prefixToInterface) {
if (VpnUtil.isMatchedPrefixToInterface(pref, del)) {
- readWriteTxn.delete(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getPrefixToInterfaceIdentifier(vpnInstOp.getVpnId(),
- pref.getIpAddress()));
+ operTx.delete(
+ VpnUtil.getPrefixToInterfaceIdentifier(vpnInstOp.getVpnId(), pref.getIpAddress()));
}
}
}
del.getDpnId());
}
notifyTaskIfRequired(interfaceName);
- } catch (ReadFailedException e) {
+ } catch (InterruptedException | ExecutionException e) {
LOG.error("postProcessVpnInterfaceRemoval: Failed to read data store for interface {} vpn {}",
interfaceName, vpnName);
}
*/
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.OPERATIONAL;
+
import com.google.common.base.Optional;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
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.mdsalutil.instructions.InstructionWriteMetadata;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.genius.utils.JvmGlobalLocks;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
import org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer;
import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
import org.opendaylight.netvirt.elan.arp.responder.ArpResponderInput;
}
@Override
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
public void updateRouteTargetsToSubnetAssociation(Set<VpnTarget> routeTargets, String cidr, String vpnName) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
for (VpnTarget rt : routeTargets) {
String rtValue = rt.getVrfRTValue();
switch (rt.getVrfRTType()) {
}
@Override
- // Allow deprecated TransactionRunner calls for now
- @SuppressWarnings("ForbidCertainMethod")
public void removeRouteTargetsToSubnetAssociation(Set<VpnTarget> routeTargets, String cidr, String vpnName) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
+ LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
for (VpnTarget rt : routeTargets) {
String rtValue = rt.getVrfRTValue();
switch (rt.getVrfRTType()) {
}
private void addSubnetAssociationOperationToTx(String rt, RouteTarget.RtType rtType, String cidr,
- String vpnName, ReadWriteTransaction tx,
+ String vpnName, TypedReadWriteTransaction<Operational> tx,
boolean isAssociationRemoved)
throws InterruptedException, ExecutionException {
if (isAssociationRemoved) {
//Remove RT-Subnet-Vpn Association
- Optional<AssociatedSubnet> associatedSubnet = tx.read(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getAssociatedSubnetIdentifier(rt, rtType, cidr)).get();
+ Optional<AssociatedSubnet> associatedSubnet =
+ tx.read(VpnUtil.getAssociatedSubnetIdentifier(rt, rtType, cidr)).get();
boolean deleteParent = false;
if (associatedSubnet.isPresent()) {
List<AssociatedVpn> associatedVpns = new ArrayList<>(associatedSubnet.get().nonnullAssociatedVpn());
}
}
if (deleteParent) {
- deleteParentForSubnetToVpnAssocication(rt, rtType, cidr, tx);
+ deleteParentForSubnetToVpnAssociation(rt, rtType, cidr, tx);
} else {
//Some other VPNs are also part of this rtVal, rtType and subnetCidr combination.
//Delete only this AssociatedVpn Object
- tx.delete(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName));
+ tx.delete(VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName));
LOG.debug("addSubnetAssocOperationToTx: Removed vpn {} from association rt {} rtType {} cidr {}",
vpnName, rt, rtType, cidr);
}
} else {
//Add RT-Subnet-Vpn Association
- tx.put(LogicalDatastoreType.OPERATIONAL,
- VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName),
- VpnUtil.buildAssociatedSubnetAndVpn(vpnName), true);
+ tx.put(VpnUtil.getAssociatedSubnetAndVpnIdentifier(rt, rtType, cidr, vpnName),
+ VpnUtil.buildAssociatedSubnetAndVpn(vpnName), CREATE_MISSING_PARENTS);
}
}
- private void deleteParentForSubnetToVpnAssocication(String rt, RouteTarget.RtType rtType,
- String cidr, ReadWriteTransaction tx)
+ private void deleteParentForSubnetToVpnAssociation(String rt, RouteTarget.RtType rtType,
+ String cidr, TypedReadWriteTransaction<Operational> tx)
throws InterruptedException, ExecutionException {
//Check if you need to delete rtVal+rtType or just the subnetCidr
InstanceIdentifier<RouteTarget> rtIdentifier = InstanceIdentifier
.builder(SubnetsAssociatedToRouteTargets.class).child(RouteTarget.class,
new RouteTargetKey(rt, rtType)).build();
- Optional<RouteTarget> rtToSubnetsAssociation = tx.read(LogicalDatastoreType.OPERATIONAL,
- rtIdentifier).get();
+ Optional<RouteTarget> rtToSubnetsAssociation = tx.read(rtIdentifier).get();
if (rtToSubnetsAssociation.isPresent()) {
List<AssociatedSubnet> associatedSubnets = new ArrayList<>(rtToSubnetsAssociation.get()
.nonnullAssociatedSubnet());
if (associatedSubnets.isEmpty()) {
//The entire rt to subnet association is empty
//Delete the RouteTarget object
- tx.delete(LogicalDatastoreType.OPERATIONAL, rtIdentifier);
- LOG.debug("deleteParentForSubnetToVpnAssocication: Removed rt {} rtType {} from association,",
+ tx.delete(rtIdentifier);
+ LOG.debug("deleteParentForSubnetToVpnAssociation: Removed rt {} rtType {} from association,",
rt, rtType);
} else {
//Some other VPNs are also part of this rtVal, rtType combination
//Delete only this AssociatedSubnet
- tx.delete(LogicalDatastoreType.OPERATIONAL, VpnUtil.getAssociatedSubnetIdentifier(rt, rtType,
- cidr));
- LOG.debug("deleteParentForSubnetToVpnAssocication: Removed cidr {} from association rt {}"
+ tx.delete(VpnUtil.getAssociatedSubnetIdentifier(rt, rtType, cidr));
+ LOG.debug("deleteParentForSubnetToVpnAssociation: Removed cidr {} from association rt {}"
+ " rtType {}", cidr, rt, rtType);
}
}
@Override
public boolean checkForOverlappingSubnets(Uuid network, List<Subnetmap> subnetmapList, Uuid vpn,
Set<VpnTarget> routeTargets, List<String> failedNwList) {
- for (int i = 0; i < subnetmapList.size(); i++) {
+ for (Subnetmap subnetmap : subnetmapList) {
//Check if any other subnet that is already part of a different vpn with same rt, has overlapping CIDR
- if (checkExistingSubnetWithSameRoutTargets(routeTargets, vpn, subnetmapList.get(i), failedNwList)) {
+ if (checkExistingSubnetWithSameRoutTargets(routeTargets, vpn, subnetmap, failedNwList)) {
return true;
}
}