import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundConstants;
import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
+import org.opendaylight.netvirt.elan.ElanException;
import org.opendaylight.netvirt.elan.l2gw.jobs.DeleteL2GwDeviceMacsFromElanJob;
import org.opendaylight.netvirt.elan.l2gw.jobs.DeleteLogicalSwitchJob;
import org.opendaylight.netvirt.elan.l2gw.listeners.HwvtepTerminationPointListener;
private final DataStoreJobCoordinator dataStoreJobCoordinator = DataStoreJobCoordinator.getInstance();
private static Timer LogicalSwitchDeleteJobTimer = new Timer();
- private static final int LOGICAL_SWITCH_DELETE_DELAY = 120000;
+ private static final int LOGICAL_SWITCH_DELETE_DELAY = 20000;
private final ConcurrentMap<Pair<NodeId, String>, TimerTask> logicalSwitchDeletedTasks = new ConcurrentHashMap<>();
public ElanL2GatewayUtils(DataBroker broker, ItmRpcService itmRpcService, ElanUtils elanUtils,
* the elan
* @param interfaceName
* the interface name
+ * @throws ElanException in case of issues creating the flow objects
*/
public void installL2gwDeviceMacsInDpn(BigInteger dpnId, NodeId l2gwDeviceNodeId, ElanInstance elan,
- String interfaceName) {
+ String interfaceName) throws ElanException {
L2GatewayDevice l2gwDevice = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elan.getElanInstanceName(),
l2gwDeviceNodeId.getValue());
if (l2gwDevice == null) {
* the elan
* @param interfaceName
* the interface name
+ * @throws ElanException in case of issues creating the flow objects
*/
public void installDmacFlowsOnDpn(BigInteger dpnId, L2GatewayDevice l2gwDevice, ElanInstance elan,
- String interfaceName) {
+ String interfaceName) throws ElanException {
String elanName = elan.getElanInstanceName();
List<LocalUcastMacs> l2gwDeviceLocalMacs = l2gwDevice.getUcastLocalMacs();
* the elan
* @param interfaceName
* the interface name
+ * @throws ElanException in case of issues creating the flow objects
*/
- public void installElanL2gwDevicesLocalMacsInDpn(BigInteger dpnId, ElanInstance elan, String interfaceName) {
+ public void installElanL2gwDevicesLocalMacsInDpn(BigInteger dpnId, ElanInstance elan, String interfaceName)
+ throws ElanException {
ConcurrentMap<String, L2GatewayDevice> elanL2GwDevicesFromCache = ElanL2GwCacheUtils
.getInvolvedL2GwDevices(elan.getElanInstanceName());
if (elanL2GwDevicesFromCache != null) {
* @return true, if successful
*/
private static boolean doesLocalUcastMacExistsInCache(L2GatewayDevice elanL2GwDevice, String macAddress) {
- java.util.Optional<LocalUcastMacs> macExistsInCache = elanL2GwDevice.getUcastLocalMacs().stream()
- .filter(mac -> mac.getMacEntryKey().getValue().equalsIgnoreCase(macAddress)).findFirst();
- return macExistsInCache.isPresent();
+ return elanL2GwDevice.getUcastLocalMacs().stream()
+ .anyMatch(mac -> mac.getMacEntryKey().getValue().equalsIgnoreCase(macAddress));
}
/**
});
if (LOG.isDebugEnabled()) {
- List<String> elanMacs = lstElanMacs.stream().map(mac -> mac.getValue()).collect(Collectors.toList());
+ List<String> elanMacs = lstElanMacs.stream().map(MacAddress::getValue).collect(Collectors.toList());
LOG.debug("Deleting elan [{}] macs from node [{}]. Deleted macs = {}", elanName, hwvtepNodeId, elanMacs);
}
return future;
WriteTransaction transaction = broker.newWriteOnlyTransaction();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712
- .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice
- .getInterfaces()) {
+ .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice.getInterfaces()) {
NodeId physicalSwitchNodeId = HwvtepSouthboundUtils.createManagedNodeId(nodeId,
hwVtepDevice.getDeviceName());
TerminationPoint portTerminationPoint = HwvtepUtils.getPhysicalPortTerminationPoint(broker,
WriteTransaction transaction = broker.newWriteOnlyTransaction();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712
- .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice.getInterfaces()) {
+ .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice.getInterfaces()) {
String phyPortName = deviceInterface.getInterfaceName();
if (deviceInterface.getSegmentationIds() != null && !deviceInterface.getSegmentationIds().isEmpty()) {
for (Integer vlanId : deviceInterface.getSegmentationIds()) {
public static Interface getInterfaceFromConfigDS(InterfaceKey interfaceKey, DataBroker dataBroker) {
InstanceIdentifier<Interface> interfaceId = getInterfaceIdentifier(interfaceKey);
- Optional<Interface> interfaceOptional = IfmUtil.read(LogicalDatastoreType.CONFIGURATION, interfaceId,
- dataBroker);
- if (!interfaceOptional.isPresent()) {
- return null;
- }
-
- return interfaceOptional.get();
+ return IfmUtil.read(LogicalDatastoreType.CONFIGURATION, interfaceId, dataBroker).orNull();
}
/**