X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=elanmanager%2Fimpl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetvirt%2Felan%2Fl2gw%2Futils%2FElanL2GatewayUtils.java;h=64cb1c057bae396a57ff966d67b12cdc8d513a8c;hb=cf1ea9172b94fc17e45391b62bf4ca24ac5c5fe0;hp=9fea57d0c2dda7fe9fc4042546be589df4e5433d;hpb=84a7d0a360f0d5f9b588e269840a92158d1be7d2;p=netvirt.git diff --git a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java index 9fea57d0c2..64cb1c057b 100644 --- a/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java +++ b/elanmanager/impl/src/main/java/org/opendaylight/netvirt/elan/l2gw/utils/ElanL2GatewayUtils.java @@ -21,6 +21,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -99,6 +100,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacs; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteUcastMacsKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; @@ -181,7 +183,7 @@ public class ElanL2GatewayUtils { for (String interfaceName : lstElanInterfaceNames) { ElanInterfaceMac elanInterfaceMac = ElanUtils.getElanInterfaceMacByInterfaceName(broker, interfaceName); if (elanInterfaceMac != null && elanInterfaceMac.getMacEntry() != null) { - for (MacEntry macEntry : elanInterfaceMac.getMacEntry()) { + for (MacEntry macEntry : new ArrayList(elanInterfaceMac.getMacEntry().values())) { result.add(macEntry.getMacAddress()); } } @@ -525,7 +527,8 @@ public class ElanL2GatewayUtils { HwvtepGlobalAugmentation augmentation = configNode.get().augmentation( HwvtepGlobalAugmentation.class); if (augmentation != null && augmentation.getLocalUcastMacs() != null) { - macs.addAll(augmentation.getLocalUcastMacs().stream() + macs.addAll(new ArrayList(augmentation + .getLocalUcastMacs().values()).stream() .filter(mac -> getLogicalSwitchName(mac).equals(elanName)) .map(HwvtepMacTableGenericAttributes::getMacEntryKey) .collect(Collectors.toSet())); @@ -615,12 +618,13 @@ public class ElanL2GatewayUtils { return Collections.emptyList(); } if (hwvtepNode != null) { - List remoteUcastMacs = hwvtepNode.augmentation(HwvtepGlobalAugmentation.class) + Map keyRemoteUcastMacsMap + = hwvtepNode.augmentation(HwvtepGlobalAugmentation.class) .getRemoteUcastMacs(); - if (remoteUcastMacs != null && !remoteUcastMacs.isEmpty()) { - // Filtering remoteUcastMacs based on the logical switch and + if (keyRemoteUcastMacsMap != null && !keyRemoteUcastMacsMap.isEmpty()) { + // Filtering keyRemoteUcastMacsMap based on the logical switch and // forming a list of MacAddress - lstMacs = remoteUcastMacs.stream() + lstMacs = keyRemoteUcastMacsMap.values().stream() .filter(mac -> logicalSwitch.equals(mac.getLogicalSwitchRef().getValue() .firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue())) .map(HwvtepMacTableGenericAttributes::getMacEntryKey).collect(Collectors.toList()); @@ -734,7 +738,7 @@ public class ElanL2GatewayUtils { return lstRemoteUcastMacs; } - for (MacEntry macEntry : macTable.getMacEntry()) { + for (MacEntry macEntry : new ArrayList(macTable.getMacEntry().values())) { Uint64 dpnId = getDpidFromInterface(macEntry.getInterface()); if (dpnId == null) { LOG.error("DPN ID not found for interface {}", macEntry.getInterface()); @@ -805,7 +809,8 @@ public class ElanL2GatewayUtils { return txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> { for (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712 - .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice.getInterfaces()) { + .l2gateway.attributes.devices.Interfaces deviceInterface : new ArrayList<>(hwVtepDevice + .getInterfaces().values())) { //Removed the check for checking terminationPoint present in OP or not //for coniguring vlan bindings //As we are not any more dependent on it , plugin takes care of this @@ -871,7 +876,8 @@ public class ElanL2GatewayUtils { return txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> { for (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712 - .l2gateway.attributes.devices.Interfaces deviceInterface : hwVtepDevice.getInterfaces()) { + .l2gateway.attributes.devices.Interfaces deviceInterface : new ArrayList<>(hwVtepDevice + .getInterfaces().values())) { String phyPortName = deviceInterface.getInterfaceName(); if (deviceInterface.getSegmentationIds() != null && !deviceInterface.getSegmentationIds().isEmpty()) { for (Integer vlanId : deviceInterface.getSegmentationIds()) { @@ -990,7 +996,7 @@ public class ElanL2GatewayUtils { String psNodeId = globalNodeId + HwvtepHAUtil.PHYSICALSWITCH + psName; tzonesoptional.get().nonnullTransportZone().stream() .filter(zone -> zone.getDeviceVteps() != null) - .flatMap(zone -> zone.getDeviceVteps().stream()) + .flatMap(zone -> new ArrayList(zone.getDeviceVteps().values()).stream()) .filter(deviceVteps -> Objects.equals(getPsName(deviceVteps), psName)) //get device with same ps name .filter(deviceVteps -> !Objects.equals(psNodeId, deviceVteps.getNodeId()) || !Objects.equals(tunnelIp, deviceVteps.getIpAddress()))//node id or tunnel ip is changed @@ -1030,8 +1036,8 @@ public class ElanL2GatewayUtils { } LoggingFutures.addErrorLogging( new ManagedNewTransactionRunnerImpl(dataBroker).callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, - tx -> optionalElan.get().nonnullElanInstance().stream() - .flatMap(elan -> elan.nonnullExternalTeps().stream() + tx -> optionalElan.get().nonnullElanInstance().values().stream() + .flatMap(elan -> elan.nonnullExternalTeps().values().stream() .map(externalTep -> ElanL2GatewayMulticastUtils.buildExternalTepPath( elan.getElanInstanceName(), externalTep.getTepIp()))) .filter(externalTepIid -> Objects.equals( @@ -1137,7 +1143,7 @@ public class ElanL2GatewayUtils { if (configNode.isPresent()) { HwvtepGlobalAugmentation augmentation = configNode.get().augmentation(HwvtepGlobalAugmentation.class); if (augmentation != null && augmentation.getLocalUcastMacs() != null) { - macs.addAll(augmentation.getLocalUcastMacs().stream() + macs.addAll(augmentation.getLocalUcastMacs().values().stream() .filter(mac -> getLogicalSwitchName(mac).equals(elanName)) .map(HwvtepMacTableGenericAttributes::getMacEntryKey) .collect(Collectors.toSet()));