MRI version bumpup for Aluminium
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / ha / commands / RemoteMcastCmd.java
index d9b79297f7b8223aba95585bc6937396c28ff2bb..3b53aca5fc8e8881e590d71fc652f6d8e24987a5 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.netvirt.elan.l2gw.ha.commands;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.netvirt.elan.l2gw.ha.HwvtepHAUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
@@ -31,9 +33,10 @@ public class RemoteMcastCmd extends
     }
 
     @Override
+    @Nullable
     public List<RemoteMcastMacs> getData(HwvtepGlobalAugmentation augmentation) {
-        if (augmentation != null) {
-            return augmentation.getRemoteMcastMacs();
+        if (augmentation != null && augmentation.getRemoteMcastMacs() != null) {
+            return new ArrayList<RemoteMcastMacs>(augmentation.getRemoteMcastMacs().values());
         }
         return null;
     }
@@ -45,7 +48,7 @@ public class RemoteMcastCmd extends
 
     @Override
     public InstanceIdentifier<RemoteMcastMacs> generateId(InstanceIdentifier<Node> id, RemoteMcastMacs node) {
-        HwvtepLogicalSwitchRef lsRef = HwvtepHAUtil.convertLogicalSwitchRef(node.getKey().getLogicalSwitchRef(), id);
+        HwvtepLogicalSwitchRef lsRef = HwvtepHAUtil.convertLogicalSwitchRef(node.key().getLogicalSwitchRef(), id);
         RemoteMcastMacsKey key = new RemoteMcastMacsKey(lsRef, node.getMacEntryKey());
 
         return id.augmentation(HwvtepGlobalAugmentation.class).child(RemoteMcastMacs.class, key);
@@ -55,7 +58,7 @@ public class RemoteMcastCmd extends
     public RemoteMcastMacs transform(InstanceIdentifier<Node> nodePath, RemoteMcastMacs src) {
         RemoteMcastMacsBuilder ucmlBuilder = new RemoteMcastMacsBuilder(src);
         List<LocatorSet> locatorSet = new ArrayList<>();
-        for (LocatorSet locator : src.getLocatorSet()) {
+        for (LocatorSet locator : src.nonnullLocatorSet()) {
             locatorSet.add(new LocatorSetBuilder().setLocatorRef(HwvtepHAUtil.buildLocatorRef(nodePath,
                     HwvtepHAUtil.getTepIpVal(locator.getLocatorRef()))).build());
         }
@@ -65,14 +68,14 @@ public class RemoteMcastCmd extends
 
         RemoteMcastMacsKey key = new RemoteMcastMacsKey(ucmlBuilder.getLogicalSwitchRef(),
                  ucmlBuilder.getMacEntryKey());
-        ucmlBuilder.setKey(key);
+        ucmlBuilder.withKey(key);
 
         return ucmlBuilder.build();
     }
 
     @Override
     public Identifier getKey(RemoteMcastMacs data) {
-        return data.getKey();
+        return data.key();
     }
 
     @Override
@@ -87,7 +90,7 @@ public class RemoteMcastCmd extends
                 .getHwvtepNodeName();
         InstanceIdentifier<?> origMacRefIdentifier = orig.getLogicalSwitchRef().getValue();
         HwvtepNodeName origMacNodeName = origMacRefIdentifier.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
-        if (updated.getMacEntryKey().equals(orig.getMacEntryKey())
+        if (Objects.equals(updated.getMacEntryKey(), orig.getMacEntryKey())
                 && updatedMacNodeName.equals(origMacNodeName)) {
             List<LocatorSet> updatedLocatorSet = updated.getLocatorSet();
             List<LocatorSet> origLocatorSet = orig.getLocatorSet();