Create Physical Port By Listening on DS changes
[ovsdb.git] / hwvtepsouthbound / hwvtepsouthbound-impl / src / main / java / org / opendaylight / ovsdb / hwvtepsouthbound / transact / LogicalSwitchUpdateCommand.java
index e8498c7f7ea876f40b9452b149c21527e44dd10a..2ae002d6ce472a3b4997ab7fe2e3835b0ebe3b3a 100644 (file)
@@ -118,7 +118,10 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand {
                 final DataObjectModification<Node> mod = change.getRootNode();
                 Node created = TransactUtils.getCreated(mod);
                 if (created != null) {
-                    List<LogicalSwitches> lswitchListUpdated = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    List<LogicalSwitches> lswitchListUpdated = null;
+                    if (created.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
+                        lswitchListUpdated = created.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    }
                     if (lswitchListUpdated != null) {
                         result.put(key, lswitchListUpdated);
                     }
@@ -139,8 +142,14 @@ public class LogicalSwitchUpdateCommand extends AbstractTransactCommand {
                 Node updated = TransactUtils.getUpdated(mod);
                 Node before = mod.getDataBefore();
                 if (updated != null && before != null) {
-                    List<LogicalSwitches> lswitchListUpdated = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
-                    List<LogicalSwitches> lswitchListBefore = before.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    List<LogicalSwitches> lswitchListUpdated = null;
+                    List<LogicalSwitches> lswitchListBefore = null;
+                    if (updated.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
+                        lswitchListUpdated = updated.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    }
+                    if (before.getAugmentation(HwvtepGlobalAugmentation.class) != null) {
+                        lswitchListBefore = before.getAugmentation(HwvtepGlobalAugmentation.class).getLogicalSwitches();
+                    }
                     if (lswitchListUpdated != null) {
                         if (lswitchListBefore != null) {
                             lswitchListUpdated.removeAll(lswitchListBefore);