<failOnError>true</failOnError>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ </plugin>
</plugins>
</build>
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
import org.opendaylight.netvirt.elan.utils.ElanConstants;
import org.opendaylight.netvirt.elan.utils.ElanUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
private static final Logger LOG = LoggerFactory.getLogger(EvpnMacVrfUtils.class);
private final DataBroker dataBroker;
- private final ElanInstanceManager elanInstanceManager;
private final IdManagerService idManager;
private final ElanEvpnFlowUtils elanEvpnFlowUtils;
private final IMdsalApiManager mdsalManager;
private final EvpnUtils evpnUtils;
private final JobCoordinator jobCoordinator;
+ private final ElanUtils elanUtils;
@Inject
- public EvpnMacVrfUtils(final DataBroker dataBroker, final ElanInstanceManager elanInstanceManager,
- final IdManagerService idManager, final ElanEvpnFlowUtils elanEvpnFlowUtils,
- final IMdsalApiManager mdsalManager, final EvpnUtils evpnUtils,
- final JobCoordinator jobCoordinator) {
+ public EvpnMacVrfUtils(final DataBroker dataBroker, final IdManagerService idManager,
+ final ElanEvpnFlowUtils elanEvpnFlowUtils, final IMdsalApiManager mdsalManager, final EvpnUtils evpnUtils,
+ final JobCoordinator jobCoordinator, final ElanUtils elanUtils) {
this.dataBroker = dataBroker;
- this.elanInstanceManager = elanInstanceManager;
this.idManager = idManager;
this.elanEvpnFlowUtils = elanEvpnFlowUtils;
this.mdsalManager = mdsalManager;
this.evpnUtils = evpnUtils;
this.jobCoordinator = jobCoordinator;
+ this.elanUtils = elanUtils;
}
public Long getElanTagByMacvrfiid(InstanceIdentifier<MacVrfEntry> macVrfEntryIid) {
return;
}
- List<DpnInterfaces> dpnInterfaceLists = elanInstanceManager.getElanDPNByName(elanName);
+ List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
if (checkEvpnAttachedToNet(elanName)) {
//TODO(Riyaz) : Check if accessing first nexthop address is right solution
String nexthopIP = macVrfEntry.getRoutePaths().get(0).getNexthopAddress();
LOG.error("Error : elanName is null for iid {}", instanceIdentifier);
return;
}
- List<DpnInterfaces> dpnInterfaceLists = elanInstanceManager.getElanDPNByName(elanName);
+ List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
//if (checkEvpnAttachedToNet(elanName)) {
//TODO(Riyaz) : Check if accessing first nexthop address is right
}
String elanName = elanInstance.getElanInstanceName();
- List<DpnInterfaces> dpnInterfaceLists = elanInstanceManager.getElanDPNByName(elanName);
+ List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanName);
if (checkEvpnAttachedToNet(elanName)) {
String nexthopIP = getRoutePathNexthopIp(macVrfEntry);
LOG.error("Error : elanInstance is null for iid {}", instanceIdentifier);
return;
}
- List<DpnInterfaces> dpnInterfaceLists =
- elanInstanceManager.getElanDPNByName(elanInstance.getElanInstanceName());
+ List<DpnInterfaces> dpnInterfaceLists = elanUtils.getElanDPNByName(elanInstance.getElanInstanceName());
//if (checkEvpnAttachedToNet(elanName)) {
String nexthopIP = getRoutePathNexthopIp(macVrfEntry);
this.jobCoordinator = jobCoordinator;
}
- public void init() {
- }
-
- public void close() {
- }
-
public boolean isWithdrawEvpnRT2Routes(ElanInstance original, ElanInstance update) {
return isNetDetach.test(getEvpnNameFromElan(original), getEvpnNameFromElan(update));
}
import java.util.Optional;
import java.util.Random;
import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
/**
* This class provides functions for creating bridges via OVSDB, specifically the br-int bridge.
*/
+@Singleton
public class ElanBridgeManager implements IElanBridgeManager {
private static final Logger LOG = LoggerFactory.getLogger(ElanBridgeManager.class);
private final MdsalUtils mdsalUtils;
private final IInterfaceManager interfaceManager;
- final SouthboundUtils southboundUtils;
+ private final SouthboundUtils southboundUtils;
private final Random random;
private final Long maxBackoff;
private final Long inactivityProbe;
* @param interfaceManager InterfaceManager
*/
@Inject
- public ElanBridgeManager(DataBroker dataBroker, ElanConfig elanConfig, IInterfaceManager interfaceManager) {
+ public ElanBridgeManager(DataBroker dataBroker, ElanConfig elanConfig, IInterfaceManager interfaceManager,
+ SouthboundUtils southboundUtils, MdsalUtils mdsalUtils) {
//TODO: ClusterAware!!!??
- this.mdsalUtils = new MdsalUtils(dataBroker);
+ this.mdsalUtils = mdsalUtils;
this.interfaceManager = interfaceManager;
- this.southboundUtils = new SouthboundUtils(mdsalUtils);
+ this.southboundUtils = southboundUtils;
this.random = new Random(System.currentTimeMillis());
this.maxBackoff = elanConfig.getControllerMaxBackoff();
this.inactivityProbe = elanConfig.getControllerInactivityProbe();
package org.opendaylight.netvirt.elan.internal;
import java.util.Collections;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanDpnInterfaceClusteredListener
extends AsyncClusteredDataTreeChangeListenerBase<DpnInterfaces, ElanDpnInterfaceClusteredListener> {
private final ElanClusterUtils elanClusterUtils;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanDpnInterfaceClusteredListener(DataBroker broker, EntityOwnershipUtils entityOwnershipUtils,
- ElanUtils elanUtils, ElanL2GatewayUtils elanL2GatewayUtils,
- ElanClusterUtils elanClusterUtils, JobCoordinator jobCoordinator) {
+ ElanL2GatewayUtils elanL2GatewayUtils,
+ ElanClusterUtils elanClusterUtils, JobCoordinator jobCoordinator,
+ ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
this.broker = broker;
this.entityOwnershipUtils = entityOwnershipUtils;
this.elanL2GatewayUtils = elanL2GatewayUtils;
- this.elanL2GatewayMulticastUtils = elanUtils.getElanL2GatewayMulticastUtils();
+ this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.elanClusterUtils = elanClusterUtils;
this.jobCoordinator = jobCoordinator;
}
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, this.broker);
}
import java.math.BigInteger;
import java.util.Collections;
import java.util.List;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanDpnInterfacesListener
extends AsyncDataTreeChangeListenerBase<DpnInterfaces, ElanDpnInterfacesListener> {
this.jobCoordinator = jobCoordinator;
}
+ @PostConstruct
public void start() {
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
package org.opendaylight.netvirt.elan.internal;
import java.math.BigInteger;
-
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanDpnToTransportZoneListener
extends AsyncDataTreeChangeListenerBase<DpnInterfaces, ElanDpnToTransportZoneListener> {
private final DataBroker dbx;
private final Boolean useTransportZone;
+ @Inject
public ElanDpnToTransportZoneListener(final DataBroker dbx, final IInterfaceManager interfaceManager,
final ElanConfig elanConfig, final TransportZoneNotificationUtil tznu) {
useTransportZone = elanConfig.isAutoConfigTransportZones();
this.dbx = dbx;
}
+ @PostConstruct
public void start() {
LOG.info("{} start", getClass().getSimpleName());
protected ElanDpnToTransportZoneListener getDataTreeChangeListener() {
return ElanDpnToTransportZoneListener.this;
}
-}
\ No newline at end of file
+}
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.SettableFuture;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.utils.ElanConstants;
import org.opendaylight.netvirt.elan.utils.ElanUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanExtnTepListener extends AsyncDataTreeChangeListenerBase<ExternalTeps, ElanExtnTepListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanExtnTepListener.class);
private final DataBroker broker;
- private final ElanInterfaceManager elanInterfaceManager;
+ private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
private final JobCoordinator jobCoordinator;
- public ElanExtnTepListener(DataBroker dataBroker, ElanInterfaceManager elanInterfaceManager,
+ @Inject
+ public ElanExtnTepListener(DataBroker dataBroker, ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
JobCoordinator jobCoordinator) {
super(ExternalTeps.class, ElanExtnTepListener.class);
this.broker = dataBroker;
- this.elanInterfaceManager = elanInterfaceManager;
+ this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.jobCoordinator = jobCoordinator;
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.CONFIGURATION, broker);
}
- @Override
- public void close() {
- super.close();
- }
-
@Override
protected InstanceIdentifier<ExternalTeps> getWildCardPath() {
return InstanceIdentifier.create(ElanInstances.class).child(ElanInstance.class).child(ExternalTeps.class);
SettableFuture<Void> ft = SettableFuture.create();
try {
//TODO make the following method return ft
- elanInterfaceManager.updateRemoteBroadcastGroupForAllElanDpns(elanInfo);
+ elanL2GatewayMulticastUtils.updateRemoteBroadcastGroupForAllElanDpns(elanInfo);
ft.set(null);
} catch (Exception e) {
//since the above method does a sync write , if it fails there was no retry
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface;
return MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, elanIdentifierId).orNull();
}
- @Nonnull
- public List<DpnInterfaces> getElanDPNByName(String elanInstanceName) {
- return getElanDPNByName(broker, elanInstanceName);
- }
-
- @Nonnull
- public static List<DpnInterfaces> getElanDPNByName(DataBroker dataBroker, String elanInstanceName) {
- InstanceIdentifier<ElanDpnInterfacesList> elanIdentifier = getElanDpnOperationDataPath(elanInstanceName);
- return MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, elanIdentifier).toJavaUtil().map(
- ElanDpnInterfacesList::getDpnInterfaces).orElse(Collections.emptyList());
- }
-
private static InstanceIdentifier<ElanDpnInterfacesList> getElanDpnOperationDataPath(String elanInstanceName) {
return InstanceIdentifier.builder(ElanDpnInterfaces.class)
.child(ElanDpnInterfacesList.class, new ElanDpnInterfacesListKey(elanInstanceName)).build();
registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
}
- @Override
- public void close() {
- LOG.info("ElanInterfaceConfigListener Closed");
- super.close();
- }
-
@Override
protected InstanceIdentifier<Interface> getWildCardPath() {
return InstanceIdentifier.create(Interfaces.class).child(Interface.class);
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan;
* @see org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface
*/
@Singleton
-@SuppressWarnings("deprecation")
public class ElanInterfaceManager extends AsyncDataTreeChangeListenerBase<ElanInterface, ElanInterfaceManager> {
+ private static final Logger LOG = LoggerFactory.getLogger(ElanInterfaceManager.class);
+ private static final long WAIT_TIME_FOR_SYNC_INSTALL = Long.getLong("wait.time.sync.install", 300L);
+ private static final boolean SH_FLAG_SET = true;
+ private static final boolean SH_FLAG_UNSET = false;
private final DataBroker broker;
private final IMdsalApiManager mdsalManager;
private final ElanItmUtils elanItmUtils;
private final ElanEtreeUtils elanEtreeUtils;
private final ElanL2GatewayUtils elanL2GatewayUtils;
- private ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
- private ElanUtils elanUtils;
+ private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
+ private final ElanUtils elanUtils;
private final JobCoordinator jobCoordinator;
- private static final long WAIT_TIME_FOR_SYNC_INSTALL = Long.getLong("wait.time.sync.install", 300L);
- private static final boolean SH_FLAG_SET = true;
- private static final boolean SH_FLAG_UNSET = false;
-
private final Map<String, ConcurrentLinkedQueue<ElanInterface>>
unProcessedElanInterfaces = new ConcurrentHashMap<>();
- private static final Logger LOG = LoggerFactory.getLogger(ElanInterfaceManager.class);
-
@Inject
public ElanInterfaceManager(final DataBroker dataBroker, final IdManagerService managerService,
final IMdsalApiManager mdsalApiManager, IInterfaceManager interfaceManager,
final ElanForwardingEntriesHandler elanForwardingEntriesHandler,
final INeutronVpnManager neutronVpnManager, final ElanItmUtils elanItmUtils,
final ElanEtreeUtils elanEtreeUtils, final ElanL2GatewayUtils elanL2GatewayUtils,
- final JobCoordinator jobCoordinator) {
+ final ElanUtils elanUtils, final JobCoordinator jobCoordinator,
+ final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
super(ElanInterface.class, ElanInterfaceManager.class);
this.broker = dataBroker;
this.idManager = managerService;
this.elanItmUtils = elanItmUtils;
this.elanEtreeUtils = elanEtreeUtils;
this.elanL2GatewayUtils = elanL2GatewayUtils;
- this.jobCoordinator = jobCoordinator;
- }
-
- /**
- * This method is used instead of "regular" standard constructor dependency injection in, only,
- * ElanServiceProvider's constructor to wire things together. It was done like this because of the unholy
- * triumvirate of unhealthy love triangle between (at least) ElanUtils, ElanInterfaceManager and
- * ElanL2GatewayMulticastUtils. The proper solution to be able to get rid of this would be to split up some of these
- * relatively big classes into smaller classes, and then inject more fine grained among them.
- */
- public void setElanUtils(ElanUtils elanUtils) {
this.elanUtils = elanUtils;
- this.elanL2GatewayMulticastUtils = elanUtils.getElanL2GatewayMulticastUtils();
- this.elanForwardingEntriesHandler.setElanUtils(elanUtils);
+ this.jobCoordinator = jobCoordinator;
+ this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
}
@Override
} catch (InterruptedException e1) {
LOG.warn("Error while waiting for local BC group for ELAN {} to install", elanInfo);
}
- setupElanBroadcastGroups(elanInfo, dpnInterfaces, dpId);
+ elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, dpnInterfaces, dpId);
try {
Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
} catch (InterruptedException e1) {
private List<Bucket> getRemoteBCGroupBucketInfos(ElanInstance elanInfo, int bucketKeyStart,
InterfaceInfo interfaceInfo, long elanTag) {
- return getRemoteBCGroupBuckets(elanInfo, null, interfaceInfo.getDpId(), bucketKeyStart, elanTag);
- }
-
- @Nonnull
- public List<Bucket> getRemoteBCGroupBuckets(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId,
- int bucketId, long elanTag) {
- List<Bucket> listBucketInfo = new ArrayList<>();
- ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
-
- if (isVxlan(elanInfo)) {
- listBucketInfo.addAll(getRemoteBCGroupTunnelBuckets(elanDpns, dpnId, bucketId,
- elanUtils.isOpenstackVniSemanticsEnforced() ? elanInfo.getSegmentationId() : elanTag));
- }
- listBucketInfo.addAll(getRemoteBCGroupExternalPortBuckets(elanDpns, dpnInterfaces, dpnId,
- getNextAvailableBucketId(listBucketInfo.size())));
- listBucketInfo.addAll(getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnId,
- getNextAvailableBucketId(listBucketInfo.size())));
- listBucketInfo.addAll(getRemoteBCGroupBucketsOfElanExternalTeps(elanInfo, dpnId,
- getNextAvailableBucketId(listBucketInfo.size())));
- return listBucketInfo;
- }
-
- private int getNextAvailableBucketId(int bucketSize) {
- return bucketSize + 1;
- }
-
- @SuppressWarnings("checkstyle:IllegalCatch")
- private List<Bucket> getRemoteBCGroupTunnelBuckets(ElanDpnInterfacesList elanDpns, BigInteger dpnId, int bucketId,
- long elanTagOrVni) {
- List<Bucket> listBucketInfo = new ArrayList<>();
- if (elanDpns != null) {
- for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
- if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpnId)
- && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
- try {
- List<Action> listActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnId,
- dpnInterface.getDpId(), elanTagOrVni);
- if (listActionInfo.isEmpty()) {
- continue;
- }
- listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
- MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
- bucketId++;
- } catch (Exception ex) {
- LOG.error("Logical Group Interface not found between source Dpn - {}, destination Dpn - {} ",
- dpnId, dpnInterface.getDpId(), ex);
- }
- }
- }
- }
- return listBucketInfo;
- }
-
- private List<Bucket> getRemoteBCGroupExternalPortBuckets(ElanDpnInterfacesList elanDpns,
- DpnInterfaces dpnInterfaces, BigInteger dpnId, int bucketId) {
- DpnInterfaces currDpnInterfaces = dpnInterfaces != null ? dpnInterfaces : getDpnInterfaces(elanDpns, dpnId);
- if (currDpnInterfaces == null || !elanUtils.isDpnPresent(currDpnInterfaces.getDpId())
- || currDpnInterfaces.getInterfaces() == null || currDpnInterfaces.getInterfaces().isEmpty()) {
- return Collections.emptyList();
- }
- List<Bucket> listBucketInfo = new ArrayList<>();
- for (String interfaceName : currDpnInterfaces.getInterfaces()) {
- if (interfaceManager.isExternalInterface(interfaceName)) {
- List<Action> listActionInfo = elanItmUtils.getExternalPortItmEgressAction(interfaceName);
- if (!listActionInfo.isEmpty()) {
- listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
- MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
- bucketId++;
- }
- }
- }
- return listBucketInfo;
- }
-
- private DpnInterfaces getDpnInterfaces(ElanDpnInterfacesList elanDpns, BigInteger dpnId) {
- if (elanDpns != null) {
- for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
- if (dpnInterface.getDpId().equals(dpnId)) {
- return dpnInterface;
- }
- }
- }
- return null;
+ return elanL2GatewayMulticastUtils.getRemoteBCGroupBuckets(elanInfo, null, interfaceInfo.getDpId(),
+ bucketKeyStart, elanTag);
}
private void setElanAndEtreeBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId) {
}
}
}
- List<Bucket> elanL2GwDevicesBuckets = getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpId,
- bucketId);
+ List<Bucket> elanL2GwDevicesBuckets = elanL2GatewayMulticastUtils
+ .getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpId, bucketId);
remoteListBucketInfo.addAll(elanL2GwDevicesBuckets);
if (remoteListBucketInfo.isEmpty()) {
return Collections.emptyList();
}
- public void setupElanBroadcastGroups(ElanInstance elanInfo, BigInteger dpnId) {
- setupElanBroadcastGroups(elanInfo, null, dpnId);
- }
-
- public void setupElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
- setupStandardElanBroadcastGroups(elanInfo, dpnInterfaces, dpnId);
- setupLeavesEtreeBroadcastGroups(elanInfo, dpnInterfaces, dpnId);
- }
-
- public void setupStandardElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
- List<Bucket> listBucket = new ArrayList<>();
- int bucketId = 0;
- int actionKey = 0;
- Long elanTag = elanInfo.getElanTag();
- List<Action> listAction = new ArrayList<>();
- listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
- listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT,
- MDSALUtil.WATCH_GROUP));
- bucketId++;
- List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, elanTag);
- listBucket.addAll(listBucketInfoRemote);
- long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
- Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll,
- MDSALUtil.buildBucketLists(listBucket));
- LOG.trace("Installing the remote BroadCast Group:{}", group);
- mdsalManager.syncInstallGroup(dpnId, group);
- }
-
- public void setupLeavesEtreeBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
- EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
- if (etreeInstance != null) {
- long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
- List<Bucket> listBucket = new ArrayList<>();
- int bucketId = 0;
- int actionKey = 0;
- List<Action> listAction = new ArrayList<>();
- listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag)).buildAction(++actionKey));
- listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT,
- MDSALUtil.WATCH_GROUP));
- bucketId++;
- List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId,
- etreeLeafTag);
- listBucket.addAll(listBucketInfoRemote);
- long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
- Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll,
- MDSALUtil.buildBucketLists(listBucket));
- LOG.trace("Installing the remote BroadCast Group:{}", group);
- mdsalManager.syncInstallGroup(dpnId, group);
- }
- }
-
private void createDropBucket(List<Bucket> listBucket) {
List<Action> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionDrop().buildAction());
// update Remote BC Group
LOG.trace("procesing elan remote bc group for tunnel event {}", elanInfo);
try {
- setupElanBroadcastGroups(elanInfo, srcDpId);
+ elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, srcDpId);
} catch (RuntimeException e) {
LOG.error("Error while adding remote bc group for {} on dpId {} ", elanName, srcDpId);
}
}
LOG.debug("Elan instance:{} is present in Dpn:{} ", elanName, dpId);
- setupElanBroadcastGroups(elanInfo, dpId);
+ elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, dpId);
// install L2gwDevices local macs in dpn.
elanL2GatewayUtils.installL2gwDeviceMacsInDpn(dpId, externalNodeId, elanInfo, intrf.getName());
// Install dpn macs on external device
return mkMatches;
}
- public void updateRemoteBroadcastGroupForAllElanDpns(ElanInstance elanInfo) {
- List<DpnInterfaces> dpns = elanUtils.getInvolvedDpnsInElan(elanInfo.getElanInstanceName());
- for (DpnInterfaces dpn : dpns) {
- setupElanBroadcastGroups(elanInfo, dpn.getDpId());
- }
- }
-
- public List<Bucket> getRemoteBCGroupBucketsOfElanL2GwDevices(ElanInstance elanInfo, BigInteger dpnId,
- int bucketId) {
- List<Bucket> listBucketInfo = new ArrayList<>();
- ConcurrentMap<String, L2GatewayDevice> map = ElanL2GwCacheUtils
- .getInvolvedL2GwDevices(elanInfo.getElanInstanceName());
- for (L2GatewayDevice device : map.values()) {
- String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId),
- device.getHwvtepNodeId());
- if (interfaceName == null) {
- continue;
- }
- List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
- ElanUtils.getVxlanSegmentationId(elanInfo));
- listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
- MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
- bucketId++;
- }
- return listBucketInfo;
- }
-
- public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId,
- int bucketId) {
- List<Bucket> listBucketInfo = new ArrayList<>();
- List<ExternalTeps> teps = elanInfo.getExternalTeps();
- if (teps == null || teps.isEmpty()) {
- return listBucketInfo;
- }
- for (ExternalTeps tep : teps) {
- String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId),
- tep.getTepIp().toString());
- if (interfaceName == null) {
- LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
- continue;
- }
- List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
- elanInfo.getSegmentationId());
- listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
- MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
- bucketId++;
- }
- return listBucketInfo;
- }
-
@Override
protected ElanInterfaceManager getDataTreeChangeListener() {
return this;
public void handleExternalInterfaceEvent(ElanInstance elanInstance, DpnInterfaces dpnInterfaces,
BigInteger dpId) {
LOG.debug("setting up remote BC group for elan {}", elanInstance.getPhysicalNetworkName());
- setupStandardElanBroadcastGroups(elanInstance, dpnInterfaces, dpId);
+ elanL2GatewayMulticastUtils.setupStandardElanBroadcastGroups(elanInstance, dpnInterfaces, dpId);
try {
Thread.sleep(WAIT_TIME_FOR_SYNC_INSTALL);
} catch (InterruptedException e) {
package org.opendaylight.netvirt.elan.internal;
import java.math.BigInteger;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanInterfaceStateChangeListener
extends AsyncDataTreeChangeListenerBase<Interface, ElanInterfaceStateChangeListener> {
private final ElanInterfaceManager elanInterfaceManager;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanInterfaceStateChangeListener(final DataBroker db, final ElanInterfaceManager ifManager,
final JobCoordinator jobCoordinator) {
super(Interface.class, ElanInterfaceStateChangeListener.class);
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, broker);
}
elanInterfaceManager.add(elanInterfaceId, elanInterface);
}
- @Override
- public void close() {
-
- }
-
@Override
protected InstanceIdentifier<Interface> getWildCardPath() {
return InstanceIdentifier.create(InterfacesState.class).child(Interface.class);
*/
package org.opendaylight.netvirt.elan.internal;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanInterfaceStateClusteredListener extends
AsyncClusteredDataTreeChangeListenerBase<Interface, ElanInterfaceStateClusteredListener> {
* Why do we have ElanInterfaceStateChangeListener and ElanInterfaceStateClusteredListener
* both within same module? Refactor this code into single listener.
*/
+ @Inject
public ElanInterfaceStateClusteredListener(DataBroker broker, ElanInterfaceManager elanInterfaceManager,
ElanUtils elanUtils, ElanClusterUtils elanClusterUtils) {
this.broker = broker;
this.elanClusterUtils = elanClusterUtils;
}
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, broker);
}
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
+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.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanLearntVpnVipToPortListener extends
AsyncDataTreeChangeListenerBase<LearntVpnVipToPort, ElanLearntVpnVipToPortListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanLearntVpnVipToPortListener.class);
private final ElanUtils elanUtils;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanLearntVpnVipToPortListener(DataBroker broker, IInterfaceManager interfaceManager, ElanUtils elanUtils,
JobCoordinator jobCoordinator) {
super(LearntVpnVipToPort.class, ElanLearntVpnVipToPortListener.class);
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, broker);
}
- @Override
- public void close() {
- super.close();
- LOG.debug("ElanLearntVpnPortIpToPort Listener Closed");
- }
-
@Override
protected InstanceIdentifier<LearntVpnVipToPort> getWildCardPath() {
return InstanceIdentifier.create(LearntVpnVipToPortData.class).child(LearntVpnVipToPort.class);
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+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.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanNodeListener extends AsyncDataTreeChangeListenerBase<Node, ElanNodeListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanNodeListener.class);
private final boolean puntLldpToController;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanNodeListener(DataBroker dataBroker, IMdsalApiManager mdsalManager, ElanConfig elanConfig,
IdManagerService idManagerService, JobCoordinator jobCoordinator) {
this.broker = dataBroker;
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, broker);
}
}
private void setupExternalL2vniTableMissFlow(BigInteger dpnId) {
- List<MatchInfo> matches = new ArrayList<MatchInfo>();
+ List<MatchInfo> matches = new ArrayList<>();
List<ActionInfo> actionsInfos = Collections.singletonList(new ActionNxResubmit(NwConstants
.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
*/
package org.opendaylight.netvirt.elan.internal;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
/**
* Listen for new OVSDB nodes and then make sure they have the necessary bridges configured.
*/
+@Singleton
public class ElanOvsdbNodeListener extends AsyncDataTreeChangeListenerBase<Node, ElanOvsdbNodeListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanOvsdbNodeListener.class);
private final DataBroker dataBroker;
* @param bridgeMgr bridge manager
* @param elanProvider elan provider
*/
+ @Inject
public ElanOvsdbNodeListener(final DataBroker dataBroker, ElanConfig elanConfig,
final ElanBridgeManager bridgeMgr,
final IElanService elanProvider, final TransportZoneNotificationUtil tzUtil) {
}
@Override
+ @PostConstruct
public void init() {
LOG.info("{} init", getClass().getSimpleName());
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
import com.google.common.base.Optional;
import java.math.BigInteger;
import java.util.Collections;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.liblldp.NetUtils;
import org.opendaylight.controller.liblldp.PacketException;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SuppressWarnings("deprecation")
+@Singleton
public class ElanPacketInHandler implements PacketProcessingListener {
private static final Logger LOG = LoggerFactory.getLogger(ElanPacketInHandler.class);
private final EvpnUtils evpnUtils;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanPacketInHandler(DataBroker dataBroker, final IInterfaceManager interfaceManager, ElanUtils elanUtils,
EvpnUtils evpnUtils, ElanL2GatewayUtils elanL2GatewayUtils, JobCoordinator jobCoordinator) {
broker = dataBroker;
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.netvirt.elanmanager.api.IElanService;
import org.opendaylight.netvirt.elanmanager.exceptions.MacNotFoundException;
+import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
private final DataBroker broker;
private final ElanStatusMonitor elanStatusMonitor;
private final ElanUtils elanUtils;
-
- private boolean generateIntBridgeMac = true;
+ private final SouthboundUtils southboundUtils;
private boolean isL2BeforeL3;
private final EntityOwnershipCandidateRegistration candidateRegistration;
DataBroker dataBroker,
ElanInterfaceManager elanInterfaceManager,
ElanStatusMonitor elanStatusMonitor, ElanUtils elanUtils,
- EntityOwnershipService entityOwnershipService) {
+ EntityOwnershipService entityOwnershipService,
+ SouthboundUtils southboundUtils) {
this.idManager = idManager;
this.interfaceManager = interfaceManager;
this.elanInstanceManager = elanInstanceManager;
this.broker = dataBroker;
this.elanStatusMonitor = elanStatusMonitor;
this.elanUtils = elanUtils;
- elanInterfaceManager.setElanUtils(elanUtils);
+ this.southboundUtils = southboundUtils;
candidateRegistration = registerCandidate(entityOwnershipService);
}
@Override
@SuppressWarnings("checkstyle:IllegalCatch")
protected void start() throws Exception {
- LOG.info("Starting ElnaServiceProvider");
+ LOG.info("Starting ElanServiceProvider");
elanStatusMonitor.reportStatus("STARTING");
setIsL2BeforeL3();
try {
if (candidateRegistration != null) {
candidateRegistration.close();
}
+
+ LOG.info("ElanServiceProvider stopped");
}
@Override
return elanInterfaces;
}
- public boolean getGenerateIntBridgeMac() {
- return generateIntBridgeMac;
- }
-
- public void setGenerateIntBridgeMac(boolean generateIntBridgeMac) {
- this.generateIntBridgeMac = generateIntBridgeMac;
- }
-
@Override
public void createExternalElanNetworks(Node node) {
handleExternalElanNetworks(node, true, (elanInstance, interfaceName) -> {
return;
}
- List<Node> nodes = bridgeMgr.southboundUtils.getOvsdbNodes();
+ List<Node> nodes = southboundUtils.getOvsdbNodes();
if (nodes == null || nodes.isEmpty()) {
LOG.trace("No OVS nodes found while creating external network for ELAN {}",
elanInstance.getElanInstanceName());
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+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.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SuppressWarnings("deprecation")
+@Singleton
public class ElanSmacFlowEventListener implements SalFlowListener {
private static final Logger LOG = LoggerFactory.getLogger(ElanSmacFlowEventListener.class);
private final ElanUtils elanUtils;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanSmacFlowEventListener(DataBroker broker, IInterfaceManager interfaceManager, ElanUtils elanUtils,
JobCoordinator jobCoordinator) {
this.broker = broker;
import java.math.BigInteger;
import java.util.Collections;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanTunnelInterfaceStateListener extends AsyncDataTreeChangeListenerBase<StateTunnelList,
ElanTunnelInterfaceStateListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanTunnelInterfaceStateListener.class);
private final ElanUtils elanUtils;
private final JobCoordinator jobCoordinator;
+ @Inject
public ElanTunnelInterfaceStateListener(final DataBroker dataBroker,
final ElanInterfaceManager elanInterfaceManager, final ElanUtils elanUtils,
final JobCoordinator jobCoordinator) {
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
package org.opendaylight.netvirt.elan.internal;
import java.util.stream.Collectors;
-
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class VpnDpnToTransportZoneListener
extends AsyncDataTreeChangeListenerBase<VpnToDpnList, VpnDpnToTransportZoneListener> {
private static final Logger LOG = LoggerFactory.getLogger(VpnDpnToTransportZoneListener.class);
- private TransportZoneNotificationUtil transportZoneNotificationUtil;
- private DataBroker dbx;
- private Boolean useTransportZone;
+ private final TransportZoneNotificationUtil transportZoneNotificationUtil;
+ private final DataBroker dbx;
+ private final Boolean useTransportZone;
+ @Inject
public VpnDpnToTransportZoneListener(final DataBroker dbx, final IInterfaceManager interfaceManager,
final ElanConfig elanConfig, final TransportZoneNotificationUtil tznu) {
useTransportZone = elanConfig.isAutoConfigTransportZones();
this.dbx = dbx;
}
+ @PostConstruct
public void start() {
LOG.info("{} start", getClass().getSimpleName());
import com.google.common.base.Optional;
import java.util.concurrent.ExecutionException;
+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.common.api.data.ReadFailedException;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+@Singleton
public class HAEventHandler implements IHAEventHandler {
private final NodeConnectedHandler nodeConnectedHandler;
private final ConfigNodeUpdatedHandler configNodeUpdatedHandler = new ConfigNodeUpdatedHandler();
private final OpNodeUpdatedHandler opNodeUpdatedHandler = new OpNodeUpdatedHandler();
+ @Inject
public HAEventHandler(DataBroker db) {
nodeConnectedHandler = new NodeConnectedHandler(db);
}
- public void close() {
- }
-
@Override
public void handleChildNodeConnected(Node connectedNode,
InstanceIdentifier<Node> connectedNodePath,
import java.util.Set;
import java.util.concurrent.ExecutionException;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+@Singleton
public class HAConfigNodeListener extends HwvtepNodeBaseListener {
private final IHAEventHandler haEventHandler;
+ @Inject
public HAConfigNodeListener(DataBroker db, HAEventHandler haEventHandler) throws Exception {
super(LogicalDatastoreType.CONFIGURATION, db);
this.haEventHandler = haEventHandler;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+@Singleton
public class HAListeners implements AutoCloseable {
private static final InstanceIdentifier<TerminationPoint> PHYSICAL_PORT_IID =
InstanceIdentifier.create(NetworkTopology.class)
private final DataBroker broker;
private final List<HwvtepNodeDataListener<?>> listeners = new ArrayList<>();
+ @Inject
public HAListeners(DataBroker broker) {
this.broker = broker;
registerListener(LocalMcastMacs.class, new LocalMcastCmd());
ResourceBatchingManager.ShardResource.OPERATIONAL_TOPOLOGY));
}
- public void init() {
- }
-
@Override
+ @PreDestroy
public void close() throws Exception {
for (HwvtepNodeDataListener listener : listeners) {
listener.close();
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
import java.util.stream.Collectors;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class HAOpClusteredListener extends HwvtepNodeBaseListener implements ClusteredDataTreeChangeListener<Node> {
private static final Logger LOG = LoggerFactory.getLogger(HAOpClusteredListener.class);
private final Set<InstanceIdentifier<Node>> connectedNodes = ConcurrentHashMap.newKeySet();
private final Map<InstanceIdentifier<Node>, Set<Consumer<Optional<Node>>>> waitingJobs = new ConcurrentHashMap<>();
+ @Inject
public HAOpClusteredListener(DataBroker db) throws Exception {
super(LogicalDatastoreType.OPERATIONAL, db);
LOG.info("Registering HAOpClusteredListener");
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nonnull;
+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.common.api.data.ReadFailedException;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+@Singleton
public class HAOpNodeListener extends HwvtepNodeBaseListener {
private final IHAEventHandler haEventHandler;
private final Map<String, Boolean> availableGlobalNodes = new HashMap<>();
private final Map<String, Boolean> availablePsNodes = new HashMap<>();
+ @Inject
public HAOpNodeListener(DataBroker db, HAEventHandler haEventHandler) throws Exception {
super(OPERATIONAL, db);
this.haEventHandler = haEventHandler;
import java.util.Collection;
import java.util.concurrent.ExecutionException;
+import javax.annotation.PreDestroy;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
}
@Override
- public void close() throws Exception {
+ @PreDestroy
+ public void close() {
if (registration != null) {
registration.close();
}
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
+import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
private final DataBroker broker;
private final ElanL2GatewayUtils elanL2GatewayUtils;
private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
+ private final ElanInstanceManager elanInstanceManager;
private final L2GatewayDevice l2GatewayDevice;
private final ElanInstance elanInstance;
private final Devices l2Device;
private final boolean createLogicalSwitch;
public AssociateHwvtepToElanJob(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils,
- ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
- L2GatewayDevice l2GatewayDevice, ElanInstance elanInstance, Devices l2Device,
- Integer defaultVlan, boolean createLogicalSwitch) {
+ ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, ElanInstanceManager elanInstanceManager,
+ L2GatewayDevice l2GatewayDevice, ElanInstance elanInstance, Devices l2Device, Integer defaultVlan,
+ boolean createLogicalSwitch) {
this.broker = broker;
this.elanL2GatewayUtils = elanL2GatewayUtils;
this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
+ this.elanInstanceManager = elanInstanceManager;
this.l2GatewayDevice = l2GatewayDevice;
this.elanInstance = elanInstance;
this.l2Device = l2Device;
LogicalSwitchAddedJob logicalSwitchAddedJob =
new LogicalSwitchAddedJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils,
- logicalSwitchName, l2Device,
- l2GatewayDevice, defaultVlan);
+ logicalSwitchName, l2Device, l2GatewayDevice, defaultVlan,
+ () -> elanInstanceManager.getElanInstanceByName(logicalSwitchName));
return logicalSwitchAddedJob.call();
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
+import java.util.function.Supplier;
import javax.annotation.Nullable;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.slf4j.Logger;
public class DisAssociateHwvtepFromElanJob implements Callable<List<ListenableFuture<Void>>> {
private static final Logger LOG = LoggerFactory.getLogger(DisAssociateHwvtepFromElanJob.class);
- private final DataBroker broker;
private final ElanL2GatewayUtils elanL2GatewayUtils;
private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
private final L2GatewayDevice l2GatewayDevice;
private final Integer defaultVlan;
private final boolean isLastL2GwConnDeleted;
private final NodeId hwvtepNodeId;
+ private final Supplier<ElanInstance> elanInstanceSupplier;
- public DisAssociateHwvtepFromElanJob(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils,
+ public DisAssociateHwvtepFromElanJob(ElanL2GatewayUtils elanL2GatewayUtils,
ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
@Nullable L2GatewayDevice l2GatewayDevice, String elanName,
- Devices l2Device, Integer defaultVlan, String nodeId,
- boolean isLastL2GwConnDeleted) {
- this.broker = broker;
+ Supplier<ElanInstance> elanInstanceSupplier, Devices l2Device,
+ Integer defaultVlan, String nodeId, boolean isLastL2GwConnDeleted) {
this.elanL2GatewayUtils = elanL2GatewayUtils;
this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.l2GatewayDevice = l2GatewayDevice;
this.elanName = elanName;
+ this.elanInstanceSupplier = elanInstanceSupplier;
this.l2Device = l2Device;
this.defaultVlan = defaultVlan;
this.isLastL2GwConnDeleted = isLastL2GwConnDeleted;
LOG.info("delete mcast mac for {} {}", elanName, strHwvtepNodeId);
futures.addAll(elanL2GatewayMulticastUtils.handleMcastForElanL2GwDeviceDelete(this.elanName,
- l2GatewayDevice));
+ elanInstanceSupplier.get(), l2GatewayDevice));
LOG.info("delete local ucast macs {} {}", elanName, strHwvtepNodeId);
futures.addAll(elanL2GatewayUtils.deleteL2GwDeviceUcastLocalMacsFromElan(l2GatewayDevice, elanName));
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
+import java.util.function.Supplier;
import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
import org.slf4j.Logger;
* The Class LogicalSwitchAddedWorker.
*/
public class LogicalSwitchAddedJob implements Callable<List<ListenableFuture<Void>>> {
+ private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchAddedJob.class);
+
/** The logical switch name. */
private final String logicalSwitchName;
/** The default vlan id. */
private final Integer defaultVlanId;
- private static final Logger LOG = LoggerFactory.getLogger(LogicalSwitchAddedJob.class);
-
private final ElanL2GatewayUtils elanL2GatewayUtils;
private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
+ private final Supplier<ElanInstance> elanInstanceSupplier;
public LogicalSwitchAddedJob(ElanL2GatewayUtils elanL2GatewayUtils,
ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, String logicalSwitchName,
- Devices physicalDevice, L2GatewayDevice l2GatewayDevice,
- Integer defaultVlanId) {
+ Devices physicalDevice, L2GatewayDevice l2GatewayDevice, Integer defaultVlanId,
+ Supplier<ElanInstance> elanInstanceSupplier) {
this.elanL2GatewayUtils = elanL2GatewayUtils;
this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.logicalSwitchName = logicalSwitchName;
this.physicalDevice = physicalDevice;
this.elanL2GwDevice = l2GatewayDevice;
this.defaultVlanId = defaultVlanId;
+ this.elanInstanceSupplier = elanInstanceSupplier;
LOG.debug("created logical switch added job for {} {}", logicalSwitchName, elanL2GwDevice.getHwvtepNodeId());
}
futures.add(elanL2GatewayUtils.updateVlanBindingsInL2GatewayDevice(
new NodeId(elanL2GwDevice.getHwvtepNodeId()), logicalSwitchName, physicalDevice, defaultVlanId));
LOG.info("creating mast mac entries for {} {}", logicalSwitchName, elanL2GwDevice.getHwvtepNodeId());
- futures.add(elanL2GatewayMulticastUtils.handleMcastForElanL2GwDeviceAdd(logicalSwitchName, elanL2GwDevice));
+ futures.add(elanL2GatewayMulticastUtils.handleMcastForElanL2GwDeviceAdd(logicalSwitchName,
+ elanInstanceSupplier.get(), elanL2GwDevice));
futures.add(elanL2GatewayUtils.installElanMacsInL2GatewayDevice(
logicalSwitchName, elanL2GwDevice));
return futures;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.annotation.PreDestroy;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
protected abstract InstanceIdentifier<Node> getParentWildCardPath();
@Override
+ @PreDestroy
public void close() throws Exception {
if (registration != null) {
registration.close();
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
-import org.opendaylight.netvirt.elan.internal.ElanInterfaceManager;
+import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
import org.opendaylight.netvirt.elan.utils.ElanUtils;
import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanGroupListener extends AsyncClusteredDataTreeChangeListenerBase<Group, ElanGroupListener> {
private static final Logger LOG = LoggerFactory.getLogger(ElanGroupListener.class);
- private final ElanInterfaceManager elanInterfaceManager;
private final DataBroker broker;
- private final ElanInstanceManager elanInstanceManager;
private final ElanClusterUtils elanClusterUtils;
+ private final ElanUtils elanUtils;
+ private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
- public ElanGroupListener(ElanInterfaceManager elanInterfaceManager, final DataBroker db,
- ElanClusterUtils elanClusterUtils, ElanInstanceManager elanInstanceManager) {
+ @Inject
+ public ElanGroupListener(DataBroker db, ElanClusterUtils elanClusterUtils, ElanUtils elanUtils,
+ ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
super(Group.class, ElanGroupListener.class);
- this.elanInterfaceManager = elanInterfaceManager;
broker = db;
this.elanClusterUtils = elanClusterUtils;
- this.elanInstanceManager = elanInstanceManager;
+ this.elanUtils = elanUtils;
+ this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
registerListener(LogicalDatastoreType.CONFIGURATION, broker);
LOG.trace("ElanGroupListener registered");
}
return;
}
boolean updateGroup = false;
- List<DpnInterfaces> dpns = elanInstanceManager.getElanDPNByName(elanInstance.getElanInstanceName());
+ List<DpnInterfaces> dpns = elanUtils.getElanDPNByName(elanInstance.getElanInstanceName());
if (dpns.size() > 0) {
expectedElanFootprint += dpns.size();
} else {
}
}
if (updateGroup) {
- List<Bucket> bucketList = elanInterfaceManager.getRemoteBCGroupBuckets(elanInstance, null, dpnId, 0,
+ List<Bucket> bucketList = elanL2GatewayMulticastUtils.getRemoteBCGroupBuckets(elanInstance, null, dpnId, 0,
elanInstance.getElanTag());
expectedElanFootprint--;//remove local bcgroup bucket
if (bucketList.size() != expectedElanFootprint) {
LOG.trace("no of buckets mismatched {} {}", elanInstance.getElanInstanceName(),
update.getKey().getGroupId());
elanClusterUtils.runOnlyInOwnerNode(elanInstance.getElanInstanceName(), "updating broadcast group", () -> {
- elanInterfaceManager.setupElanBroadcastGroups(elanInstance, dpnId);
+ elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInstance, dpnId);
return null;
});
} else {
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+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.common.api.data.LogicalDatastoreType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanInstanceListener extends AsyncClusteredDataTreeChangeListenerBase<ElanInstance,
ElanInstanceListener> {
private final ElanClusterUtils elanClusterUtils;
private static final Map<String, List<Runnable>> WAITING_JOB_LIST = new ConcurrentHashMap<>();
+ @Inject
public ElanInstanceListener(final DataBroker db, final ElanClusterUtils elanClusterUtils) {
super(ElanInstance.class, ElanInstanceListener.class);
broker = db;
this.elanClusterUtils = elanClusterUtils;
- registerListener(LogicalDatastoreType.CONFIGURATION, db);
}
+ @PostConstruct
public void init() {
- }
-
- @Override
- public void close() {
+ registerListener(LogicalDatastoreType.CONFIGURATION, broker);
}
@Override
import org.opendaylight.genius.datastoreutils.hwvtep.HwvtepClusteredDataTreeChangeListener;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
+import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
import org.opendaylight.netvirt.elan.l2gw.jobs.LogicalSwitchAddedJob;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
// Id of L2 Gateway connection responsible for this logical switch creation
private final Uuid l2GwConnId;
+ private final ElanInstanceManager elanInstanceManager;
private final ElanL2GatewayUtils elanL2GatewayUtils;
private final ElanClusterUtils elanClusterUtils;
private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
/**
* Instantiates a new hardware vtep logical switch listener.
*/
- public HwvtepLogicalSwitchListener(ElanL2GatewayUtils elanL2GatewayUtils, ElanClusterUtils elanClusterUtils,
- ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, L2GatewayConnectionUtils l2GatewayConnectionUtils,
- L2GatewayDevice l2GatewayDevice, String logicalSwitchName, Devices physicalDevice, Integer defaultVlanId,
- Uuid l2GwConnId) {
+ public HwvtepLogicalSwitchListener(ElanInstanceManager elanInstanceManager, ElanL2GatewayUtils elanL2GatewayUtils,
+ ElanClusterUtils elanClusterUtils, ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils,
+ L2GatewayConnectionUtils l2GatewayConnectionUtils, L2GatewayDevice l2GatewayDevice,
+ String logicalSwitchName, Devices physicalDevice, Integer defaultVlanId, Uuid l2GwConnId) {
super(LogicalSwitches.class, HwvtepLogicalSwitchListener.class);
+ this.elanInstanceManager = elanInstanceManager;
this.elanL2GatewayUtils = elanL2GatewayUtils;
this.elanClusterUtils = elanClusterUtils;
this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
L2GatewayDevice elanDevice = l2GatewayConnectionUtils.addL2DeviceToElanL2GwCache(
logicalSwitchNew.getHwvtepNodeName().getValue(), l2GatewayDevice, l2GwConnId, physicalDevice);
- LogicalSwitchAddedJob logicalSwitchAddedWorker = new LogicalSwitchAddedJob(elanL2GatewayUtils,
- elanL2GatewayMulticastUtils, logicalSwitchName, physicalDevice, elanDevice,
- defaultVlanId);
+ LogicalSwitchAddedJob logicalSwitchAddedWorker = new LogicalSwitchAddedJob(
+ elanL2GatewayUtils, elanL2GatewayMulticastUtils, logicalSwitchName, physicalDevice, elanDevice,
+ defaultVlanId, () -> elanInstanceManager.getElanInstanceByName(logicalSwitchName));
elanClusterUtils.runOnlyInOwnerNode(logicalSwitchAddedWorker.getJobKey(),
"create vlan mappings and mcast configurations", logicalSwitchAddedWorker);
} catch (RuntimeException e) {
import java.util.concurrent.ExecutionException;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
/**
* Listener to handle physical switch updates.
*/
+@Singleton
public class HwvtepPhysicalSwitchListener
extends HwvtepAbstractDataTreeChangeListener<PhysicalSwitchAugmentation, HwvtepPhysicalSwitchListener>
implements ClusteredDataTreeChangeListener<PhysicalSwitchAugmentation> {
/**
* Instantiates a new hwvtep physical switch listener.
*/
+ @Inject
public HwvtepPhysicalSwitchListener(final DataBroker dataBroker, ItmRpcService itmRpcService,
ElanClusterUtils elanClusterUtils, L2gwServiceProvider l2gwServiceProvider,
HAOpClusteredListener haListener) {
}
@Override
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.OPERATIONAL, dataBroker);
}
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.Nonnull;
+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.common.api.data.LogicalDatastoreType;
/**
* Listener for physical locator presence in operational datastore.
*/
+@Singleton
public class HwvtepTerminationPointListener
extends HwvtepClusteredDataTreeChangeListener<TerminationPoint, HwvtepTerminationPointListener> {
private final ElanL2GatewayUtils elanL2GatewayUtils;
private final ElanClusterUtils elanClusterUtils;
+ @Inject
public HwvtepTerminationPointListener(DataBroker broker, ElanL2GatewayUtils elanL2GatewayUtils,
ElanClusterUtils elanClusterUtils) {
super(TerminationPoint.class, HwvtepTerminationPointListener.class);
*/
package org.opendaylight.netvirt.elan.l2gw.listeners;
+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.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.datastoreutils.AsyncClusteredDataTreeChangeListenerBase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class L2GatewayConnectionListener extends AsyncClusteredDataTreeChangeListenerBase<L2gatewayConnection,
L2GatewayConnectionListener> {
private static final Logger LOG = LoggerFactory.getLogger(L2GatewayConnectionListener.class);
private final DataBroker broker;
private final L2GatewayConnectionUtils l2GatewayConnectionUtils;
+ @Inject
public L2GatewayConnectionListener(final DataBroker db, L2GatewayConnectionUtils l2GatewayConnectionUtils) {
super(L2gatewayConnection.class, L2GatewayConnectionListener.class);
this.broker = db;
this.l2GatewayConnectionUtils = l2GatewayConnectionUtils;
}
+ @PostConstruct
public void init() {
registerListener(LogicalDatastoreType.CONFIGURATION, broker);
}
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+@Singleton
public class LocalUcastMacListener extends ChildListener<Node, LocalUcastMacs, String>
implements ClusteredDataTreeChangeListener<Node> {
};
private final ElanL2GatewayUtils elanL2GatewayUtils;
- private final Map<InstanceIdentifier<Node>, List<InstanceIdentifier<LocalUcastMacs>>> staleCandidateMacsByNodeId
- = new ConcurrentHashMap<>();
private final HAOpClusteredListener haOpClusteredListener;
private final JobCoordinator jobCoordinator;
+ @Inject
public LocalUcastMacListener(final DataBroker dataBroker,
final HAOpClusteredListener haOpClusteredListener,
final ElanL2GatewayUtils elanL2GatewayUtils,
}
@Override
+ @PostConstruct
public void init() throws Exception {
ResourceBatchingManager.getInstance().registerDefaultBatchHandlers(this.dataBroker);
super.init();
}
public void added(final InstanceIdentifier<LocalUcastMacs> identifier, final LocalUcastMacs macAdded) {
- InstanceIdentifier<Node> nodeIid = identifier.firstIdentifierOf(Node.class);
- if (staleCandidateMacsByNodeId.get(nodeIid) != null) {
- LOG.trace("Clearing from candidate stale mac {}", identifier);
- staleCandidateMacsByNodeId.get(nodeIid).remove(identifier);
- }
ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY,
identifier, macAdded);
*/
package org.opendaylight.netvirt.elan.l2gw.utils;
+import static org.opendaylight.netvirt.elan.utils.ElanUtils.isVxlan;
+
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ConcurrentMap;
+import javax.annotation.Nonnull;
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.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
+import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
+import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
-import org.opendaylight.netvirt.elan.internal.ElanInterfaceManager;
import org.opendaylight.netvirt.elan.l2gw.jobs.HwvtepDeviceMcastMacUpdateJob;
import org.opendaylight.netvirt.elan.utils.ElanConstants;
import org.opendaylight.netvirt.elan.utils.ElanItmUtils;
+import org.opendaylight.netvirt.elan.utils.ElanUtils;
import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.DesignatedSwitchesForExternalTunnels;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp.rev160428.designated.switches._for.external.tunnels.DesignatedSwitchForTunnelKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
/** The broker. */
private final DataBroker broker;
- /** The elan instance manager. */
- private final ElanInstanceManager elanInstanceManager;
-
- /** The elan interface manager. */
- private final ElanInterfaceManager elanInterfaceManager;
-
private final ElanItmUtils elanItmUtils;
private final JobCoordinator jobCoordinator;
+ private final ElanUtils elanUtils;
+ private final IMdsalApiManager mdsalManager;
+ private final IInterfaceManager interfaceManager;
@Inject
- public ElanL2GatewayMulticastUtils(DataBroker broker, ElanInstanceManager elanInstanceManager,
- ElanInterfaceManager elanInterfaceManager, ElanItmUtils elanItmUtils, JobCoordinator jobCoordinator) {
+ public ElanL2GatewayMulticastUtils(DataBroker broker, ElanItmUtils elanItmUtils, JobCoordinator jobCoordinator,
+ ElanUtils elanUtils, IMdsalApiManager mdsalManager, IInterfaceManager interfaceManager) {
this.broker = broker;
- this.elanInstanceManager = elanInstanceManager;
- this.elanInterfaceManager = elanInterfaceManager;
this.elanItmUtils = elanItmUtils;
this.jobCoordinator = jobCoordinator;
+ this.elanUtils = elanUtils;
+ this.mdsalManager = mdsalManager;
+ this.interfaceManager = interfaceManager;
}
/**
* the device
* @return the listenable future
*/
- public ListenableFuture<Void> handleMcastForElanL2GwDeviceAdd(String elanName, L2GatewayDevice device) {
- return updateMcastMacsForAllElanDevices(elanName, device, true/* updateThisDevice */);
+ public ListenableFuture<Void> handleMcastForElanL2GwDeviceAdd(String elanName, ElanInstance elanInstance,
+ L2GatewayDevice device) {
+ return updateMcastMacsForAllElanDevices(elanName, elanInstance, device, true/* updateThisDevice */);
}
/**
L2GatewayDevice device) {
ConcurrentMap<String, L2GatewayDevice> elanL2gwDevices = ElanL2GwCacheUtils
.getInvolvedL2GwDevices(elanName);
- List<DpnInterfaces> dpns = elanInstanceManager.getElanDPNByName(elanName);
+ List<DpnInterfaces> dpns = elanUtils.getElanDPNByName(elanName);
List<IpAddress> dpnsTepIps = getAllTepIpsOfDpns(device, dpns);
List<IpAddress> l2GwDevicesTepIps = getAllTepIpsOfL2GwDevices(elanL2gwDevices);
preapareRemoteMcastMacEntry(transaction, elanName, device, dpnsTepIps, l2GwDevicesTepIps);
*
* @param elanName
* the elan name
+ * @param elanInstance
+ * the ElanInstance
* @param device
* the device
* @param updateThisDevice
* the update this device
* @return the listenable future
*/
- public ListenableFuture<Void> updateMcastMacsForAllElanDevices(String elanName, L2GatewayDevice device,
- boolean updateThisDevice) {
+ private ListenableFuture<Void> updateMcastMacsForAllElanDevices(String elanName, ElanInstance elanInstance,
+ L2GatewayDevice device, boolean updateThisDevice) {
SettableFuture<Void> ft = SettableFuture.create();
ft.set(null);
- ElanInstance elanInstance = elanInstanceManager.getElanInstanceByName(elanName);
- elanInterfaceManager.updateRemoteBroadcastGroupForAllElanDpns(elanInstance);
+ updateRemoteBroadcastGroupForAllElanDpns(elanInstance);
- List<DpnInterfaces> dpns = elanInstanceManager.getElanDPNByName(elanName);
+ List<DpnInterfaces> dpns = elanUtils.getElanDPNByName(elanName);
ConcurrentMap<String, L2GatewayDevice> devices = ElanL2GwCacheUtils
.getInvolvedL2GwDevices(elanName);
}
+ public void updateRemoteBroadcastGroupForAllElanDpns(ElanInstance elanInfo) {
+ List<DpnInterfaces> dpns = elanUtils.getInvolvedDpnsInElan(elanInfo.getElanInstanceName());
+ for (DpnInterfaces dpn : dpns) {
+ setupElanBroadcastGroups(elanInfo, dpn.getDpId());
+ }
+ }
+
+ public void setupElanBroadcastGroups(ElanInstance elanInfo, BigInteger dpnId) {
+ setupElanBroadcastGroups(elanInfo, null, dpnId);
+ }
+
+ public void setupElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
+ setupStandardElanBroadcastGroups(elanInfo, dpnInterfaces, dpnId);
+ setupLeavesEtreeBroadcastGroups(elanInfo, dpnInterfaces, dpnId);
+ }
+
+ public void setupStandardElanBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
+ List<Bucket> listBucket = new ArrayList<>();
+ int bucketId = 0;
+ int actionKey = 0;
+ Long elanTag = elanInfo.getElanTag();
+ List<Action> listAction = new ArrayList<>();
+ listAction.add(new ActionGroup(ElanUtils.getElanLocalBCGId(elanTag)).buildAction(++actionKey));
+ listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT,
+ MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, elanTag);
+ listBucket.addAll(listBucketInfoRemote);
+ long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
+ Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll,
+ MDSALUtil.buildBucketLists(listBucket));
+ LOG.trace("Installing the remote BroadCast Group:{}", group);
+ mdsalManager.syncInstallGroup(dpnId, group);
+ }
+
+ public void setupLeavesEtreeBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
+ EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
+ if (etreeInstance != null) {
+ long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
+ List<Bucket> listBucket = new ArrayList<>();
+ int bucketId = 0;
+ int actionKey = 0;
+ List<Action> listAction = new ArrayList<>();
+ listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag)).buildAction(++actionKey));
+ listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT,
+ MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId,
+ etreeLeafTag);
+ listBucket.addAll(listBucketInfoRemote);
+ long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
+ Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll,
+ MDSALUtil.buildBucketLists(listBucket));
+ LOG.trace("Installing the remote BroadCast Group:{}", group);
+ mdsalManager.syncInstallGroup(dpnId, group);
+ }
+ }
+
+ private DpnInterfaces getDpnInterfaces(ElanDpnInterfacesList elanDpns, BigInteger dpnId) {
+ if (elanDpns != null) {
+ for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
+ if (dpnInterface.getDpId().equals(dpnId)) {
+ return dpnInterface;
+ }
+ }
+ }
+ return null;
+ }
+
+ private List<Bucket> getRemoteBCGroupExternalPortBuckets(ElanDpnInterfacesList elanDpns,
+ DpnInterfaces dpnInterfaces, BigInteger dpnId, int bucketId) {
+ DpnInterfaces currDpnInterfaces = dpnInterfaces != null ? dpnInterfaces : getDpnInterfaces(elanDpns, dpnId);
+ if (currDpnInterfaces == null || !elanUtils.isDpnPresent(currDpnInterfaces.getDpId())
+ || currDpnInterfaces.getInterfaces() == null || currDpnInterfaces.getInterfaces().isEmpty()) {
+ return Collections.emptyList();
+ }
+ List<Bucket> listBucketInfo = new ArrayList<>();
+ for (String interfaceName : currDpnInterfaces.getInterfaces()) {
+ if (interfaceManager.isExternalInterface(interfaceName)) {
+ List<Action> listActionInfo = elanItmUtils.getExternalPortItmEgressAction(interfaceName);
+ if (!listActionInfo.isEmpty()) {
+ listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
+ MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ }
+ }
+ }
+ return listBucketInfo;
+ }
+
+ @Nonnull
+ public List<Bucket> getRemoteBCGroupBuckets(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId,
+ int bucketId, long elanTag) {
+ List<Bucket> listBucketInfo = new ArrayList<>();
+ ElanDpnInterfacesList elanDpns = elanUtils.getElanDpnInterfacesList(elanInfo.getElanInstanceName());
+
+ if (isVxlan(elanInfo)) {
+ listBucketInfo.addAll(getRemoteBCGroupTunnelBuckets(elanDpns, dpnId, bucketId,
+ elanUtils.isOpenstackVniSemanticsEnforced() ? elanInfo.getSegmentationId() : elanTag));
+ }
+ listBucketInfo.addAll(getRemoteBCGroupExternalPortBuckets(elanDpns, dpnInterfaces, dpnId,
+ getNextAvailableBucketId(listBucketInfo.size())));
+ listBucketInfo.addAll(getRemoteBCGroupBucketsOfElanL2GwDevices(elanInfo, dpnId,
+ getNextAvailableBucketId(listBucketInfo.size())));
+ listBucketInfo.addAll(getRemoteBCGroupBucketsOfElanExternalTeps(elanInfo, dpnId,
+ getNextAvailableBucketId(listBucketInfo.size())));
+ return listBucketInfo;
+ }
+
+ public List<Bucket> getRemoteBCGroupBucketsOfElanL2GwDevices(ElanInstance elanInfo, BigInteger dpnId,
+ int bucketId) {
+ List<Bucket> listBucketInfo = new ArrayList<>();
+ ConcurrentMap<String, L2GatewayDevice> map = ElanL2GwCacheUtils
+ .getInvolvedL2GwDevices(elanInfo.getElanInstanceName());
+ for (L2GatewayDevice device : map.values()) {
+ String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId),
+ device.getHwvtepNodeId());
+ if (interfaceName == null) {
+ continue;
+ }
+ List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
+ ElanUtils.getVxlanSegmentationId(elanInfo));
+ listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
+ MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ }
+ return listBucketInfo;
+ }
+
+ public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId,
+ int bucketId) {
+ List<Bucket> listBucketInfo = new ArrayList<>();
+ List<ExternalTeps> teps = elanInfo.getExternalTeps();
+ if (teps == null || teps.isEmpty()) {
+ return listBucketInfo;
+ }
+ for (ExternalTeps tep : teps) {
+ String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId),
+ tep.getTepIp().toString());
+ if (interfaceName == null) {
+ LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
+ continue;
+ }
+ List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
+ elanInfo.getSegmentationId());
+ listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
+ MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ }
+ return listBucketInfo;
+ }
+
+ private int getNextAvailableBucketId(int bucketSize) {
+ return bucketSize + 1;
+ }
+
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ private List<Bucket> getRemoteBCGroupTunnelBuckets(ElanDpnInterfacesList elanDpns, BigInteger dpnId, int bucketId,
+ long elanTagOrVni) {
+ List<Bucket> listBucketInfo = new ArrayList<>();
+ if (elanDpns != null) {
+ for (DpnInterfaces dpnInterface : elanDpns.getDpnInterfaces()) {
+ if (elanUtils.isDpnPresent(dpnInterface.getDpId()) && !Objects.equals(dpnInterface.getDpId(), dpnId)
+ && dpnInterface.getInterfaces() != null && !dpnInterface.getInterfaces().isEmpty()) {
+ try {
+ List<Action> listActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(dpnId,
+ dpnInterface.getDpId(), elanTagOrVni);
+ if (listActionInfo.isEmpty()) {
+ continue;
+ }
+ listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
+ MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
+ bucketId++;
+ } catch (Exception ex) {
+ LOG.error("Logical Group Interface not found between source Dpn - {}, destination Dpn - {} ",
+ dpnId, dpnInterface.getDpId(), ex);
+ }
+ }
+ }
+ }
+ return listBucketInfo;
+ }
+
/**
* Update remote mcast mac.
*
*
* @param elanName
* the elan instance name
+ * @param elanInstance
+ * the ElanInstance
* @param l2GatewayDevice
* the l2 gateway device
* @return the listenable future
*/
public List<ListenableFuture<Void>> handleMcastForElanL2GwDeviceDelete(String elanName,
- L2GatewayDevice l2GatewayDevice) {
+ ElanInstance elanInstance, L2GatewayDevice l2GatewayDevice) {
ListenableFuture<Void> updateMcastMacsFuture = updateMcastMacsForAllElanDevices(
- elanName, l2GatewayDevice, false/* updateThisDevice */);
+ elanName, elanInstance, l2GatewayDevice, false/* updateThisDevice */);
ListenableFuture<Void> deleteRemoteMcastMacFuture = deleteRemoteMcastMac(
new NodeId(l2GatewayDevice.getHwvtepNodeId()), elanName);
return Arrays.asList(updateMcastMacsFuture, deleteRemoteMcastMacFuture);
import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
import org.opendaylight.netvirt.elan.ElanException;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
import org.opendaylight.netvirt.elan.l2gw.jobs.DeleteL2GwDeviceMacsFromElanJob;
import org.opendaylight.netvirt.elan.l2gw.jobs.DeleteLogicalSwitchJob;
import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
private final ElanClusterUtils elanClusterUtils;
private final OdlInterfaceRpcService interfaceManagerRpcService;
private final JobCoordinator jobCoordinator;
+ private final ElanUtils elanUtils;
private final Timer logicalSwitchDeleteJobTimer = new Timer();
private final ConcurrentMap<Pair<NodeId, String>, TimerTask> logicalSwitchDeletedTasks = new ConcurrentHashMap<>();
@Inject
public ElanL2GatewayUtils(DataBroker broker, ElanDmacUtils elanDmacUtils, ElanItmUtils elanItmUtils,
ElanClusterUtils elanClusterUtils, OdlInterfaceRpcService interfaceManagerRpcService,
- JobCoordinator jobCoordinator) {
+ JobCoordinator jobCoordinator, ElanUtils elanUtils) {
this.broker = broker;
this.elanDmacUtils = elanDmacUtils;
this.elanItmUtils = elanItmUtils;
this.elanClusterUtils = elanClusterUtils;
this.interfaceManagerRpcService = interfaceManagerRpcService;
this.jobCoordinator = jobCoordinator;
+ this.elanUtils = elanUtils;
}
@PreDestroy
public List<DpnInterfaces> getElanDpns(String elanName) {
Set<DpnInterfaces> dpnInterfaces = ElanUtils.getElanInvolvedDPNsFromCache(elanName);
if (dpnInterfaces == null) {
- return ElanInstanceManager.getElanDPNByName(broker, elanName);
+ return elanUtils.getElanDPNByName(elanName);
}
return new ArrayList<>(dpnInterfaces);
}
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.annotation.Nonnull;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.mdsalutil.MDSALUtil;
import org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLocalUcastMacListener;
import org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLogicalSwitchListener;
import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
-import org.opendaylight.netvirt.elan.utils.ElanUtils;
import org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
import org.opendaylight.netvirt.neutronvpn.api.l2gw.utils.L2GatewayCacheUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class L2GatewayConnectionUtils implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(L2GatewayConnectionUtils.class);
private final JobCoordinator jobCoordinator;
private final List<AutoCloseable> closeables = new CopyOnWriteArrayList<>();
+ @Inject
public L2GatewayConnectionUtils(DataBroker dataBroker, ElanInstanceManager elanInstanceManager,
- ElanClusterUtils elanClusterUtils, ElanUtils elanUtils, ElanL2GatewayUtils elanL2GatewayUtils,
- JobCoordinator jobCoordinator) {
+ ElanClusterUtils elanClusterUtils, ElanL2GatewayUtils elanL2GatewayUtils,
+ JobCoordinator jobCoordinator, ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils) {
this.broker = dataBroker;
this.elanInstanceManager = elanInstanceManager;
this.elanL2GatewayUtils = elanL2GatewayUtils;
this.elanClusterUtils = elanClusterUtils;
- this.elanL2GatewayMulticastUtils = elanUtils.getElanL2GatewayMulticastUtils();
+ this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.jobCoordinator = jobCoordinator;
}
@Override
+ @PreDestroy
@SuppressWarnings("checkstyle:IllegalCatch")
public void close() {
closeables.forEach(c -> {
}
DisAssociateHwvtepFromElanJob disAssociateHwvtepToElanJob =
- new DisAssociateHwvtepFromElanJob(broker, elanL2GatewayUtils, elanL2GatewayMulticastUtils,
- elanL2GwDevice, elanName,
+ new DisAssociateHwvtepFromElanJob(elanL2GatewayUtils, elanL2GatewayMulticastUtils,
+ elanL2GwDevice, elanName, () -> elanInstanceManager.getElanInstanceByName(elanName),
l2Device, defaultVlan, hwvtepNodeId, isLastL2GwConnDeleted);
elanClusterUtils.runOnlyInOwnerNode(disAssociateHwvtepToElanJob.getJobKey(), "remove l2gw connection job",
disAssociateHwvtepToElanJob);
hwvtepNodeId, elanName);
if (logicalSwitch == null) {
HwvtepLogicalSwitchListener hwVTEPLogicalSwitchListener = new HwvtepLogicalSwitchListener(
- elanL2GatewayUtils, elanClusterUtils, elanL2GatewayMulticastUtils, this,
- l2GatewayDevice, elanName, l2Device, defaultVlan, l2GwConnId);
+ elanInstanceManager, elanL2GatewayUtils, elanClusterUtils, elanL2GatewayMulticastUtils,
+ this, l2GatewayDevice, elanName, l2Device, defaultVlan, l2GwConnId);
hwVTEPLogicalSwitchListener.registerListener(LogicalDatastoreType.OPERATIONAL, broker);
closeables.add(hwVTEPLogicalSwitchListener);
createLogicalSwitch = true;
createLogicalSwitch = false;
}
AssociateHwvtepToElanJob associateHwvtepToElanJob = new AssociateHwvtepToElanJob(broker,
- elanL2GatewayUtils, elanL2GatewayMulticastUtils, l2GatewayDevice, elanInstance,
- l2Device, defaultVlan, createLogicalSwitch);
+ elanL2GatewayUtils, elanL2GatewayMulticastUtils, elanInstanceManager, l2GatewayDevice,
+ elanInstance, l2Device, defaultVlan, createLogicalSwitch);
elanClusterUtils.runOnlyInOwnerNode(associateHwvtepToElanJob.getJobKey(),
"create logical switch in hwvtep topo", associateHwvtepToElanJob);
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
public class L2GatewayUtils {
private static final Logger LOG = LoggerFactory.getLogger(L2GatewayUtils.class);
- private final DataBroker dataBroker;
-
- private final ItmRpcService itmRpcService;
-
- private final L2GatewayConnectionUtils l2GatewayConnectionUtils;
-
- public L2GatewayUtils(DataBroker dataBroker, ItmRpcService itmRpcService,
- L2GatewayConnectionUtils l2GatewayConnectionUtils) {
- this.dataBroker = dataBroker;
- this.itmRpcService = itmRpcService;
- this.l2GatewayConnectionUtils = l2GatewayConnectionUtils;
- }
-
- public void init() {
- }
-
- public void close() {
- }
-
public static void deleteItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName,
IpAddress tunnelIp) {
DeleteL2GwDeviceInputBuilder builder = new DeleteL2GwDeviceInputBuilder();
import java.util.Collections;
import java.util.List;
import java.util.Set;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.infrautils.inject.AbstractLifecycle;
import org.opendaylight.netvirt.elan.utils.ElanClusterUtils;
/**
* Created by eaksahu on 3/15/2017.
*/
+@Singleton
public class L2gwServiceProvider extends AbstractLifecycle implements IL2gwService {
private static final Logger LOG = LoggerFactory.getLogger(L2gwServiceProvider.class);
private final L2GatewayConnectionUtils l2GatewayConnectionUtils;
private final ElanClusterUtils elanClusterUtils;
+ @Inject
public L2gwServiceProvider(final DataBroker dataBroker, final ElanClusterUtils elanClusterUtils,
ItmRpcService itmRpcService, L2GatewayConnectionUtils l2GatewayConnectionUtils) {
this.dataBroker = dataBroker;
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.Future;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanStatisticsImpl implements ElanStatisticsService {
private static final Logger LOG = LoggerFactory.getLogger(ElanStatisticsImpl.class);
private final DataBroker dataBroker;
private final IInterfaceManager interfaceManager;
+ @Inject
public ElanStatisticsImpl(DataBroker dataBroker, IInterfaceManager interfaceManager) {
this.dataBroker = dataBroker;
this.interfaceManager = interfaceManager;
package org.opendaylight.netvirt.elan.statusanddiag;
import java.lang.management.ManagementFactory;
-
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Singleton;
import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class ElanStatusMonitorJMX implements ElanStatusMonitor, ElanStatusMonitorMBean {
private String serviceStatus;
private static final Logger LOG = LoggerFactory.getLogger(ElanStatusMonitorJMX.class);
private static final MBeanServer MBS = ManagementFactory.getPlatformMBeanServer();
+ @PostConstruct
public void init() throws Exception {
registerMbean();
}
LOG.info("ElanStatusMonitor MXBean successfully registered {}", JMX_ELAN_OBJ_NAME);
}
+ @PreDestroy
public void close() {
try {
ObjectName objName = new ObjectName(JMX_ELAN_OBJ_NAME);
package org.opendaylight.netvirt.elan.utils;
import java.util.Collection;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class CacheElanInstanceListener implements ClusteredDataTreeChangeListener<ElanInstance> {
private static final Logger LOG = LoggerFactory.getLogger(CacheElanInstanceListener.class);
private ListenerRegistration<CacheElanInstanceListener> registration;
+ @Inject
public CacheElanInstanceListener(DataBroker dataBroker) {
this.broker = dataBroker;
}
+ @PostConstruct
public void init() {
registerListener();
}
return InstanceIdentifier.create(ElanInstances.class).child(ElanInstance.class);
}
+ @PreDestroy
public void close() throws Exception {
if (registration != null) {
registration.close();
package org.opendaylight.netvirt.elan.utils;
import java.util.Collection;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class CacheElanInterfaceListener implements ClusteredDataTreeChangeListener<ElanInterface> {
private ListenerRegistration<CacheElanInterfaceListener> registration;
private static final Logger LOG = LoggerFactory.getLogger(CacheElanInterfaceListener.class);
private final DataBroker broker;
+ @Inject
public CacheElanInterfaceListener(DataBroker dataBroker) {
this.broker = dataBroker;
}
+ @PostConstruct
public void init() {
registerListener();
}
return InstanceIdentifier.create(ElanInterfaces.class).child(ElanInterface.class);
}
+ @PreDestroy
public void close() throws Exception {
if (registration != null) {
registration.close();
private static final Logger LOG = LoggerFactory.getLogger(ElanForwardingEntriesHandler.class);
private final DataBroker broker;
- private ElanUtils elanUtils;
+ private final ElanUtils elanUtils;
@Inject
- public ElanForwardingEntriesHandler(DataBroker dataBroker) {
+ public ElanForwardingEntriesHandler(DataBroker dataBroker, ElanUtils elanUtils) {
this.broker = dataBroker;
- }
-
- public void setElanUtils(ElanUtils elanUtils) {
this.elanUtils = elanUtils;
}
import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
import org.opendaylight.netvirt.elan.ElanException;
import org.opendaylight.netvirt.elan.arp.responder.ArpResponderUtil;
-import org.opendaylight.netvirt.elan.internal.ElanInstanceManager;
-import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
private final DataBroker broker;
private final IMdsalApiManager mdsalManager;
- private final ElanInstanceManager elanInstanceManager;
private final OdlInterfaceRpcService interfaceManagerRpcService;
private final ItmRpcService itmRpcService;
- private final ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils;
private final IInterfaceManager interfaceManager;
private final ElanConfig elanConfig;
private final ElanItmUtils elanItmUtils;
};
@Inject
- public ElanUtils(DataBroker dataBroker, IMdsalApiManager mdsalManager, ElanInstanceManager elanInstanceManager,
- OdlInterfaceRpcService interfaceManagerRpcService, ItmRpcService itmRpcService,
- ElanConfig elanConfig,
- IInterfaceManager interfaceManager,
- ElanL2GatewayMulticastUtils elanL2GatewayMulticastUtils, ElanEtreeUtils elanEtreeUtils,
- ElanItmUtils elanItmUtils) {
+ public ElanUtils(DataBroker dataBroker, IMdsalApiManager mdsalManager,
+ OdlInterfaceRpcService interfaceManagerRpcService, ItmRpcService itmRpcService, ElanConfig elanConfig,
+ IInterfaceManager interfaceManager, ElanEtreeUtils elanEtreeUtils, ElanItmUtils elanItmUtils) {
this.broker = dataBroker;
this.mdsalManager = mdsalManager;
- this.elanInstanceManager = elanInstanceManager;
this.interfaceManagerRpcService = interfaceManagerRpcService;
this.itmRpcService = itmRpcService;
this.interfaceManager = interfaceManager;
this.elanConfig = elanConfig;
-
- this.elanL2GatewayMulticastUtils = elanL2GatewayMulticastUtils;
this.elanEtreeUtils = elanEtreeUtils;
this.elanItmUtils = elanItmUtils;
}
- public ElanL2GatewayMulticastUtils getElanL2GatewayMulticastUtils() {
- return elanL2GatewayMulticastUtils;
- }
-
public final Boolean isOpenstackVniSemanticsEnforced() {
return elanConfig.isOpenstackVniSemanticsEnforced() != null
? elanConfig.isOpenstackVniSemanticsEnforced() : false;
@Nonnull
public List<DpnInterfaces> getInvolvedDpnsInElan(String elanName) {
- return elanInstanceManager.getElanDPNByName(elanName);
+ return getElanDPNByName(elanName);
+ }
+
+ @Nonnull
+ public List<DpnInterfaces> getElanDPNByName(String elanInstanceName) {
+ InstanceIdentifier<ElanDpnInterfacesList> elanIdentifier = getElanDpnOperationDataPath(elanInstanceName);
+ return MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, elanIdentifier).toJavaUtil().map(
+ ElanDpnInterfacesList::getDpnInterfaces).orElse(Collections.emptyList());
}
private void setupLocalDmacFlow(long elanTag, BigInteger dpId, String ifName, String macAddress,
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
+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.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Singleton
public class TransportZoneNotificationUtil {
private static final Logger LOG = LoggerFactory.getLogger(TransportZoneNotificationUtil.class);
private static final String TUNNEL_PORT = "tunnel_port";
private final ElanConfig elanConfig;
private final ElanBridgeManager elanBridgeManager;
+ @Inject
public TransportZoneNotificationUtil(final DataBroker dbx, final IInterfaceManager interfaceManager,
final IElanService elanService, final ElanConfig elanConfig, final ElanBridgeManager elanBridgeManager) {
this.dataBroker = dbx;
interface="org.opendaylight.controller.md.sal.binding.api.NotificationService" />
<reference id="entityOwnershipService"
interface="org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService" />
- <reference id="mdsalUtils"
+ <reference id="iMdsalApiManager"
interface="org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager" />
- <reference id="interfaceManager"
+ <reference id="iInterfaceManager"
interface="org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager" />
- <reference id="vpnManager"
+ <reference id="iVpnManager"
interface="org.opendaylight.netvirt.vpnmanager.api.IVpnManager" availability="optional"/>
- <reference id="bgpManager"
+ <reference id="iBgpManager"
interface="org.opendaylight.netvirt.bgpmanager.api.IBgpManager" availability="optional"/>
- <reference id="neutronvpnManagerImpl"
+ <reference id="iNeutronVpnManager"
interface="org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager" availability="optional"/>
<reference id="diagStatusService"
interface="org.opendaylight.infrautils.diagstatus.DiagStatusService" />
<argument ref="entityOwnershipService" />
</bean>
- <bean id="elanBridgeManager"
- class="org.opendaylight.netvirt.elan.internal.ElanBridgeManager">
+ <bean id="mdsalUtils" class="org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils">
<argument ref="dataBroker" />
- <argument ref="elanConfig" />
- <argument ref="interfaceManager" />
</bean>
- <bean id="elanForwardingEntriesHandler"
- class="org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="elanInterfaceManager"
- class="org.opendaylight.netvirt.elan.internal.ElanInterfaceManager"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="idManagerService" />
+ <bean id="southboundUtils" class="org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils">
<argument ref="mdsalUtils" />
- <argument ref="interfaceManager" />
- <argument ref="elanForwardingEntriesHandler" />
- <argument ref="neutronvpnManagerImpl"/>
- <argument ref="elanItmUtils" />
- <argument ref="elanEtreeUtils" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="jobCoordinator" />
</bean>
- <bean id="elanInstanceManager"
- class="org.opendaylight.netvirt.elan.internal.ElanInstanceManager"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="idManagerService" />
- <argument ref="elanInterfaceManager" />
- <argument ref="interfaceManager" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanNodeListener"
- class="org.opendaylight.netvirt.elan.internal.ElanNodeListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="mdsalUtils" />
- <argument ref="elanConfig" />
- <argument ref="idManagerService" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanPacketInHandler"
- class="org.opendaylight.netvirt.elan.internal.ElanPacketInHandler">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="evpnUtils" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="jobCoordinator" />
- </bean>
<odl:notification-listener ref="elanPacketInHandler" />
- <bean id="elanSmacFlowEventListener"
- class="org.opendaylight.netvirt.elan.internal.ElanSmacFlowEventListener">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="jobCoordinator" />
- </bean>
<odl:notification-listener ref="elanSmacFlowEventListener" />
- <bean id="elanExtnTepListener"
- class="org.opendaylight.netvirt.elan.internal.ElanExtnTepListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanItmUtils" class="org.opendaylight.netvirt.elan.utils.ElanItmUtils">
- <argument ref="dataBroker" />
- <argument ref="itmRpcService" />
- <argument ref="odlInterfaceRpcService" />
- </bean>
-
- <bean id="elanDmacUtils" class="org.opendaylight.netvirt.elan.utils.ElanDmacUtils">
- <argument ref="dataBroker" />
- <argument ref="elanItmUtils" />
- <argument ref="elanEtreeUtils" />
- </bean>
-
- <bean id="elanEtreeUtils" class="org.opendaylight.netvirt.elan.utils.ElanEtreeUtils">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="elanL2GatewayMulticastUtils" class="org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils">
- <argument ref="dataBroker" />
- <argument ref="elanInstanceManager" />
- <argument ref="elanInterfaceManager" />
- <argument ref="elanItmUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanUtils" class="org.opendaylight.netvirt.elan.utils.ElanUtils">
- <argument ref="dataBroker" />
- <argument ref="mdsalUtils" />
- <argument ref="elanInstanceManager" />
- <argument ref="odlInterfaceRpcService" />
- <argument ref="itmRpcService" />
- <argument ref="interfaceManager" />
- <argument ref="elanConfig" />
- <argument ref="elanL2GatewayMulticastUtils" />
- <argument ref="elanEtreeUtils" />
- <argument ref="elanItmUtils" />
- </bean>
-
- <bean id="elanStatisticsImpl"
- class="org.opendaylight.netvirt.elan.statisitcs.ElanStatisticsImpl">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- </bean>
<odl:rpc-implementation ref="elanStatisticsImpl" />
- <bean id="elanInterfaceStateChangeListener"
- class="org.opendaylight.netvirt.elan.internal.ElanInterfaceStateChangeListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanInterfaceConfigListener"
- class="org.opendaylight.netvirt.elan.internal.ElanInterfaceConfigListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanTunnelInterfaceStateListener"
- class="org.opendaylight.netvirt.elan.internal.ElanTunnelInterfaceStateListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanInterfaceStateClusterListener"
- class="org.opendaylight.netvirt.elan.internal.ElanInterfaceStateClusteredListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="elanClusterUtils" />
- </bean>
-
- <bean id="elanDpnInterfaceClusteredListener"
- class="org.opendaylight.netvirt.elan.internal.ElanDpnInterfaceClusteredListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="entityOwnershipUtils" />
- <argument ref="elanUtils" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="elanClusterUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanVpnPortIpToPortListener"
- class="org.opendaylight.netvirt.elan.internal.ElanLearntVpnVipToPortListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanService"
- class="org.opendaylight.netvirt.elan.internal.ElanServiceProvider"
- init-method="init">
- <argument ref="idManagerService" />
- <argument ref="interfaceManager" />
- <argument ref="elanInstanceManager" />
- <argument ref="elanBridgeManager" />
- <argument ref="dataBroker" />
- <argument ref="elanInterfaceManager" />
- <argument ref="elanStatusMonitor" />
- <argument ref="elanUtils" />
- <argument ref="entityOwnershipService" />
- </bean>
- <service ref="elanService" odl:type="default"
+ <service ref="elanServiceProvider" odl:type="default"
interface="org.opendaylight.netvirt.elanmanager.api.IElanService" />
+
<service ref="elanBridgeManager" odl:type="default"
interface="org.opendaylight.netvirt.elanmanager.api.IElanBridgeManager" />
- <bean id="cacheElanInterfaceListener"
- class="org.opendaylight.netvirt.elan.utils.CacheElanInterfaceListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="cacheElanInstanceListener"
- class="org.opendaylight.netvirt.elan.utils.CacheElanInstanceListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- </bean>
-
<!--<bean id="hwvtepLocalUcastMacListener"
class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepLocalUcastMacListener"
init-method="init" destroy-method="close">
<argument ref="elanL2GatewayUtils" />
</bean>-->
- <bean id="elanStatusMonitor"
- class="org.opendaylight.netvirt.elan.statusanddiag.ElanStatusMonitorJMX"
- init-method="init" destroy-method="close" />
-
- <bean id="l2GatewayConnectionListener"
- class="org.opendaylight.netvirt.elan.l2gw.listeners.L2GatewayConnectionListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="l2GatewayConnectionUtils" />
- </bean>
-
- <bean id="l2GatewayConnectionUtils" class="org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayConnectionUtils"
- destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanInstanceManager" />
- <argument ref="elanClusterUtils" />
- <argument ref="elanUtils" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanL2GatewayUtils" class="org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils"
- destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanDmacUtils" />
- <argument ref="elanItmUtils" />
- <argument ref="elanClusterUtils" />
- <argument ref="odlInterfaceRpcService" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="hwvtepPhysicalSwitchListener"
- class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepPhysicalSwitchListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="itmRpcService" />
- <argument ref="elanClusterUtils" />
- <argument ref="l2gwService" />
- <argument ref="haOpClusteredListener" />
- </bean>
-
- <bean id="hwvtepTerminationPointListener"
- class="org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepTerminationPointListener"
- destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="elanClusterUtils" />
- </bean>
-
- <bean id="haEventHandler"
- class="org.opendaylight.netvirt.elan.l2gw.ha.handlers.HAEventHandler">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="hAListeners"
- class="org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAListeners">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="haConfigNodeListener"
- class="org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAConfigNodeListener">
- <argument ref="dataBroker" />
- <argument ref="haEventHandler" />
- </bean>
-
- <bean id="haOpClusteredListener"
- class="org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAOpClusteredListener">
- <argument ref="dataBroker" />
- </bean>
-
- <bean id="haOpNodeListener"
- class="org.opendaylight.netvirt.elan.l2gw.ha.listeners.HAOpNodeListener">
- <argument ref="dataBroker" />
- <argument ref="haEventHandler" />
- </bean>
-
- <bean id="ElanOvsdbNodeListener"
- class="org.opendaylight.netvirt.elan.internal.ElanOvsdbNodeListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanConfig" />
- <argument ref="elanBridgeManager" />
- <argument ref="elanService" />
- <argument ref = "transportZoneNotificationUtil"/>
- </bean>
-
- <bean id="elanGroupListener"
- class="org.opendaylight.netvirt.elan.l2gw.listeners.ElanGroupListener">
- <argument ref="elanInterfaceManager" />
- <argument ref="dataBroker" />
- <argument ref="elanClusterUtils" />
- <argument ref="elanInstanceManager" />
- </bean>
-
- <bean id="transportZoneNotificationUtil"
- class="org.opendaylight.netvirt.elan.utils.TransportZoneNotificationUtil">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanService" />
- <argument ref="elanConfig" />
- <argument ref="elanBridgeManager" />
- </bean>
-
- <bean id="ElanDpnToTransportZoneListener"
- class="org.opendaylight.netvirt.elan.internal.ElanDpnToTransportZoneListener"
- init-method="start" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanConfig" />
- <argument ref="transportZoneNotificationUtil" />
- </bean>
-
- <bean id="VpnDpnToTransportZoneListener"
- class="org.opendaylight.netvirt.elan.internal.VpnDpnToTransportZoneListener"
- init-method="start" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanConfig" />
- <argument ref="transportZoneNotificationUtil" />
- </bean>
- <bean id="l2gwService"
- class="org.opendaylight.netvirt.elan.l2gw.utils.L2gwServiceProvider"
- init-method="init">
- <argument ref="dataBroker" />
- <argument ref="elanClusterUtils" />
- <argument ref="itmRpcService" />
- <argument ref="l2GatewayConnectionUtils" />
- </bean>
- <service ref="l2gwService" odl:type="default"
+ <service ref="l2gwServiceProvider" odl:type="default"
interface="org.opendaylight.netvirt.elanmanager.api.IL2gwService" />
- <bean id="elanInstanceListener"
- class="org.opendaylight.netvirt.elan.l2gw.listeners.ElanInstanceListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="elanClusterUtils" />
- </bean>
-
- <bean id="evpnUtils" class="org.opendaylight.netvirt.elan.evpn.utils.EvpnUtils"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanUtils" />
- <argument ref="itmRpcService" />
- <argument ref="vpnManager" />
- <argument ref="bgpManager" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanClusterUtils" class="org.opendaylight.netvirt.elan.utils.ElanClusterUtils">
- <argument ref="entityOwnershipUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="evpnMacVrfUtils"
- class="org.opendaylight.netvirt.elan.evpn.utils.EvpnMacVrfUtils">
- <argument ref="dataBroker" />
- <argument ref="elanInstanceManager" />
- <argument ref="idManagerService" />
- <argument ref="elanEvpnFlowUtils" />
- <argument ref="mdsalUtils" />
- <argument ref="evpnUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="elanEvpnFlowUtils"
- class="org.opendaylight.netvirt.elan.evpn.utils.ElanEvpnFlowUtils">
- <argument ref="mdsalUtils" />
- <argument ref="elanItmUtils" />
- <argument ref="elanEtreeUtils" />
- </bean>
-
- <bean id="macVrfEntryListener" class="org.opendaylight.netvirt.elan.evpn.listeners.MacVrfEntryListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="evpnMacVrfUtils" />
- </bean>
-
- <bean id="elanMacEntryListener" class="org.opendaylight.netvirt.elan.evpn.listeners.ElanMacEntryListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="evpnUtils" />
- </bean>
-
- <bean id="evpnElanInstanceListener" class="org.opendaylight.netvirt.elan.evpn.listeners.EvpnElanInstanceListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="evpnUtils" />
- <argument ref="evpnMacVrfUtils" />
- <argument ref="mdsalUtils" />
- </bean>
-
-
- <bean id="elanDpnInterfacesListener" class="org.opendaylight.netvirt.elan.internal.ElanDpnInterfacesListener"
- init-method="start" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="interfaceManager" />
- <argument ref="elanService" />
- <argument ref="jobCoordinator" />
- </bean>
-
- <bean id="l2gatewayUtils"
- class="org.opendaylight.netvirt.elan.l2gw.utils.L2GatewayUtils"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="itmRpcService" />
- <argument ref="l2GatewayConnectionUtils" />
- </bean>
-
- <bean id="localUcastMacListener" class="org.opendaylight.netvirt.elan.l2gw.listeners.LocalUcastMacListener"
- init-method="init" destroy-method="close">
- <argument ref="dataBroker" />
- <argument ref="haOpClusteredListener" />
- <argument ref="elanL2GatewayUtils" />
- <argument ref="jobCoordinator" />
- </bean>
-
</blueprint>
import org.opendaylight.netvirt.neutronvpn.NeutronvpnManagerImpl;
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
+import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
+import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService;
bind(IBgpManager.class).toInstance(ibgpManager);
bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {});
bind(IElanService.class).to(ElanServiceProvider.class);
+
+ MdsalUtils mdsalUtils = new MdsalUtils(dataBroker);
+ bind(MdsalUtils.class).toInstance(mdsalUtils);
+ bind(SouthboundUtils.class).toInstance(new SouthboundUtils(mdsalUtils));
}
}