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 static org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging;
import static org.opendaylight.netvirt.elan.utils.ElanUtils.isVxlanNetworkOrVxlanSegment;
import com.google.common.base.Optional;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.locks.ReentrantLock;
-import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.genius.utils.JvmGlobalLocks;
import org.opendaylight.genius.utils.ServiceIndex;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
+import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
import org.opendaylight.netvirt.elan.cache.ElanInstanceCache;
import org.opendaylight.netvirt.elan.cache.ElanInterfaceCache;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
return;
}
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, flowTx -> {
- @Nullable List<String> elanInterfaces = elanState.getElanInterfaces();
+ List<String> elanInterfaces = elanState.getElanInterfaces();
if (elanInterfaces == null || elanInterfaces.isEmpty()) {
holder.isLastElanInterface = true;
}
tx.delete(ElanUtils.getElanInstanceOperationalDataPath(elanName));
tx.delete(ElanUtils.getElanMacTableOperationalDataPath(elanName));
tx.delete(ElanUtils.getElanInfoEntriesOperationalDataPath(elanInfo.getElanTag()));
+ tx.delete(ElanUtils.getElanDpnOperationDataPath(elanName));
} else {
Elan updateElanState = new ElanBuilder().setElanInterfaces(elanInterfaces).setName(elanName)
.withKey(new ElanKey(elanName)).build();
private void deleteAllRemoteMacsInADpn(String elanName, BigInteger dpId, long elanTag) {
List<DpnInterfaces> dpnInterfaces = elanUtils.getInvolvedDpnsInElan(elanName);
- ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
+ addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
for (DpnInterfaces dpnInterface : dpnInterfaces) {
BigInteger currentDpId = dpnInterface.getDpId();
if (!currentDpId.equals(dpId) && dpnInterface.getInterfaces() != null) {
for (StaticMacEntries staticMacEntry : updatedEntries) {
InstanceIdentifier<MacEntry> macEntryIdentifier = getMacEntryOperationalDataPath(elanName,
staticMacEntry.getMacAddress());
- ListenableFutures.addErrorLogging(ElanUtils.waitForTransactionToComplete(
+ addErrorLogging(ElanUtils.waitForTransactionToComplete(
txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, tx -> {
Optional<MacEntry> existingMacEntry = tx.read(macEntryIdentifier).get();
if (existingMacEntry.isPresent()) {
@Override
protected void add(InstanceIdentifier<ElanInterface> identifier, ElanInterface elanInterfaceAdded) {
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx -> {
+ addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, operTx -> {
String elanInstanceName = elanInterfaceAdded.getElanInstanceName();
String interfaceName = elanInterfaceAdded.getName();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
holder.dpnInterfaces =
createElanInterfacesList(elanInstanceName, interfaceName, holder.dpId, operTx);
} else {
- @Nullable List<String> existingInterfaces = existingElanDpnInterfaces.get().getInterfaces();
+ List<String> existingInterfaces = existingElanDpnInterfaces.get().getInterfaces();
List<String> elanInterfaces =
existingInterfaces != null ? new ArrayList<>(existingInterfaces) : new ArrayList<>();
elanInterfaces.add(interfaceName);
elanL2GatewayUtils.installElanL2gwDevicesLocalMacsInDpn(holder.dpId, elanInstance,
interfaceName);
} else {
- @Nullable List<String> existingInterfaces = existingElanDpnInterfaces.get().getInterfaces();
+ List<String> existingInterfaces = existingElanDpnInterfaces.get().getInterfaces();
List<String> elanInterfaces =
existingInterfaces != null ? new ArrayList<>(existingInterfaces) : new ArrayList<>();
elanInterfaces.add(interfaceName);
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, confTx -> {
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, operTx -> {
installEntriesForElanInterface(elanInstance, elanInterface, interfaceInfo,
- isFirstInterfaceInDpn, confTx, operTx);
+ isFirstInterfaceInDpn, confTx);
List<StaticMacEntries> staticMacEntriesList = elanInterface.getStaticMacEntries();
List<PhysAddress> staticMacAddresses = Lists.newArrayList();
}
private void installEntriesForElanInterface(ElanInstance elanInstance, ElanInterface elanInterface,
- InterfaceInfo interfaceInfo, boolean isFirstInterfaceInDpn, TypedWriteTransaction<Configuration> confTx,
- TypedWriteTransaction<Operational> operTx) {
+ InterfaceInfo interfaceInfo, boolean isFirstInterfaceInDpn, TypedWriteTransaction<Configuration> confTx) {
if (!isOperational(interfaceInfo)) {
return;
}
LOG.debug("Elan instance:{} is present in Dpn:{} ", elanName, dpId);
final BigInteger finalDpId = dpId;
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
confTx -> elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, finalDpId, confTx)), LOG,
"Error setting up ELAN BGs");
// install L2gwDevices local macs in dpn.
public void handleExternalInterfaceEvent(ElanInstance elanInstance, DpnInterfaces dpnInterfaces,
BigInteger dpId) {
LOG.debug("setting up remote BC group for elan {}", elanInstance.getPhysicalNetworkName());
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
confTx -> elanL2GatewayMulticastUtils.setupStandardElanBroadcastGroups(elanInstance, dpnInterfaces, dpId,
confTx)), LOG, "Error setting up remote BC group for ELAN {}", elanInstance.getPhysicalNetworkName());
try {