Bulk merge of l2gw changes
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / jobs / DeleteL2GwDeviceMacsFromElanJob.java
index c6a5f3e7da0b4ceb1cbaca0b018d42f740bb85e3..a7f72a2fa8a61165b57c1b0a926b35a1921a8a4c 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentMap;
 import java.util.stream.Collectors;
 import org.opendaylight.genius.utils.batching.ResourceBatchingManager;
 import org.opendaylight.genius.utils.batching.ResourceBatchingManager.ShardResource;
@@ -89,10 +90,13 @@ public class DeleteL2GwDeviceMacsFromElanJob implements Callable<List<? extends
                 this.l2GwDevice.getHwvtepNodeId(), this.elanName);
         final String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(this.elanName);
         List<MacAddress> macs = new ArrayList<>();
-        macAddresses.forEach((mac) -> macs.add(new MacAddress(mac.getValue().toLowerCase(Locale.ENGLISH))));
+        macAddresses.forEach((mac) -> macs.add(new MacAddress(mac.getValue().toLowerCase(Locale.getDefault()))));
+
 
         List<ListenableFuture<Void>> futures = new ArrayList<>();
-        for (L2GatewayDevice otherDevice : ElanL2GwCacheUtils.getInvolvedL2GwDevices(this.elanName)) {
+        ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils
+                .getInvolvedL2GwDevices(this.elanName);
+        for (L2GatewayDevice otherDevice : elanL2GwDevices.values()) {
             if (!otherDevice.getHwvtepNodeId().equals(this.l2GwDevice.getHwvtepNodeId())
                     && !ElanL2GatewayUtils.areMLAGDevices(this.l2GwDevice, otherDevice)) {
                 final String hwvtepId = otherDevice.getHwvtepNodeId();
@@ -112,7 +116,7 @@ public class DeleteL2GwDeviceMacsFromElanJob implements Callable<List<? extends
      */
     public static List<ListenableFuture<Void>> deleteRemoteUcastMacs(final NodeId nodeId,
                                              String logicalSwitchName, final List<MacAddress> lstMac) {
-        if (lstMac != null) {
+        if (lstMac != null && !lstMac.isEmpty()) {
             return lstMac.stream()
                 .map(mac -> HwvtepSouthboundUtils.createRemoteUcastMacsInstanceIdentifier(
                         nodeId, logicalSwitchName, mac))