package org.opendaylight.groupbasedpolicy.renderer.vpp.iface;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.SetMultimap;
+import com.google.common.eventbus.Subscribe;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
+
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.opendaylight.groupbasedpolicy.renderer.vpp.config.ConfigUtil;
import org.opendaylight.groupbasedpolicy.renderer.vpp.event.NodeOperEvent;
import org.opendaylight.groupbasedpolicy.renderer.vpp.event.VppEndpointConfEvent;
-import org.opendaylight.groupbasedpolicy.renderer.vpp.lisp.flat.overlay.FlatOverlayManager;
import org.opendaylight.groupbasedpolicy.renderer.vpp.policy.acl.AccessListWrapper;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.GbpNetconfTransaction;
import org.opendaylight.groupbasedpolicy.renderer.vpp.util.General.Operations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.SetMultimap;
-import com.google.common.eventbus.Subscribe;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
-
public class InterfaceManager implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(InterfaceManager.class);
private final MountedDataBrokerProvider mountDataProvider;
private final VppEndpointLocationProvider vppEndpointLocationProvider;
private final SetMultimap<NodeId, String> excludedFromPolicy = HashMultimap.create();
- private final FlatOverlayManager flatOverlayManager;
- public InterfaceManager(@Nonnull MountedDataBrokerProvider mountDataProvider, @Nonnull DataBroker dataProvider,
- FlatOverlayManager flatOverlayManager) {
+ public InterfaceManager(@Nonnull MountedDataBrokerProvider mountDataProvider, @Nonnull DataBroker dataProvider) {
this.mountDataProvider = Preconditions.checkNotNull(mountDataProvider);
this.vppEndpointLocationProvider = new VppEndpointLocationProvider(dataProvider);
- this.flatOverlayManager = flatOverlayManager;
}
@Subscribe
potentialIfaceCommand = createLoopbackWithoutBdCommand(vppEndpoint, Operations.PUT);
}
else {
- LOG.trace("L3 flat enabled: Creating of Loopback BVI disabled in InterfaceManager. LISP in VPP renderer will take care of this.");
+ LOG.trace("L3 flat enabled: LISP in VPP renderer will take care of creating loopback.");
}
}
if (!potentialIfaceCommand.isPresent()) {
potentialIfaceCommand = createLoopbackWithoutBdCommand(vppEndpoint, Operations.DELETE);
}
else {
- LOG.trace("L3 flat enabled: Deleting of Loopback BVI disabled in InterfaceManager. LISP in VPP renderer will take care of this.");
+ LOG.trace("L3 flat enabled: LISP in VPP renderer will take care of delete for loopback.");
}
}
LOG.warn(message);
return Futures.immediateFailedFuture(new VppRendererProcessingException(message));
}
- DataBroker vppDataBroker = potentialVppDataProvider.get();
- if (ConfigUtil.getInstance().isL3FlatEnabled()) {
- flatOverlayManager.handleInterfaceDeleteForFlatOverlay(vppDataBroker, vppEndpoint);
- }
return deleteIfaceOnVpp(ifaceWithoutBdCommand, vppNodeIid, vppEndpoint);
}
* @return {@link ListenableFuture}
*/
public synchronized ListenableFuture<Void> addBridgeDomainToInterface(@Nonnull String bridgeDomainName,
- @Nonnull AddressEndpointWithLocation addrEpWithLoc,
- @Nonnull List<AccessListWrapper> aclWrappers,
- boolean enableBvi) {
+ @Nonnull AddressEndpointWithLocation addrEpWithLoc, @Nonnull List<AccessListWrapper> aclWrappers,
+ boolean enableBvi) {
ExternalLocationCase epLoc = resolveAndValidateLocation(addrEpWithLoc);
InstanceIdentifier<Node> vppNodeIid = (InstanceIdentifier<Node>) epLoc.getExternalNodeMountPoint();
String interfacePath = epLoc.getExternalNodeConnector();
.setExternalNodeConnector(interfacePath)
.build(), addrEpWithLoc.getKey());
} else {
- final String message = "Adding bridge domain " + bridgeDomainName + " to interface " + interfacePath + " failed";
+ final String message =
+ "Adding bridge domain " + bridgeDomainName + " to interface " + interfacePath + " failed";
LOG.warn(message);
return Futures.immediateFailedFuture(new VppRendererProcessingException(message));
}
return false;
}
- public ListenableFuture<Void> configureInterface(InstanceIdentifier<Node> vppIid, InterfaceKey ifaceKey, @Nullable String bridgeDomainName,
- @Nullable Boolean enableBvi) {
+ public ListenableFuture<Void> configureInterface(InstanceIdentifier<Node> vppIid, InterfaceKey ifaceKey,
+ @Nullable String bridgeDomainName, @Nullable Boolean enableBvi) {
L2Builder l2Builder = readL2ForInterface(vppIid, ifaceKey);
L2 l2 = l2Builder.setInterconnection(new BridgeBasedBuilder()
.setBridgeDomain(bridgeDomainName)
final boolean transactionState = GbpNetconfTransaction.netconfSyncedWrite(vppIid,
VppIidFactory.getL2ForInterfaceIid(ifaceKey), l2, GbpNetconfTransaction.RETRY_COUNT);
if (transactionState) {
- LOG.debug("Adding bridge domain {} to interface {}", bridgeDomainName, VppIidFactory.getInterfaceIID(ifaceKey));
+ LOG.debug("Adding bridge domain {} to interface {}", bridgeDomainName,
+ VppIidFactory.getInterfaceIID(ifaceKey));
return Futures.immediateFuture(null);
} else {
final String message = "Failed to add bridge domain " + bridgeDomainName + " to interface "
}
}
- public ListenableFuture<Void> removeInterfaceFromBridgeDomain(InstanceIdentifier<Node> vppIid, InterfaceKey ifaceKey) {
+ public ListenableFuture<Void> removeInterfaceFromBridgeDomain(InstanceIdentifier<Node> vppIid,
+ InterfaceKey ifaceKey) {
L2Builder l2Builder = readL2ForInterface(vppIid, ifaceKey);
if (l2Builder.getInterconnection() == null || !(l2Builder.getInterconnection() instanceof BridgeBased)) {
LOG.warn("Interface already not in bridge domain {} ", ifaceKey);
private L2Builder readL2ForInterface(InstanceIdentifier<Node> vppIid, InterfaceKey ifaceKey) {
InstanceIdentifier<L2> l2Iid = VppIidFactory.getL2ForInterfaceIid(ifaceKey);
- final ReadOnlyTransaction rwTxRead = VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey().newReadOnlyTransaction();
+ final ReadOnlyTransaction rwTxRead = VbdNetconfTransaction.NODE_DATA_BROKER_MAP.get(vppIid).getKey()
+ .newReadOnlyTransaction();
Optional<L2> optL2 = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, l2Iid, rwTxRead);
rwTxRead.close();
return (optL2.isPresent()) ? new L2Builder(optL2.get()) : new L2Builder();