Check for null OVsdbNodeAugmentation 48/18348/2
authorSam Hague <shague@redhat.com>
Wed, 15 Apr 2015 13:38:35 +0000 (09:38 -0400)
committerSam Hague <shague@redhat.com>
Wed, 15 Apr 2015 16:58:47 +0000 (16:58 +0000)
While testing I found cases where the OvsdbNodeAugmentation was not found. Added this warning log to be clear about the issue.

Change-Id: I4f29581b9bcbdc6c8c33484bdb4166bbfe898f9f
Signed-off-by: Sam Hague <shague@redhat.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/transactions/md/OvsdbNodeRemoveCommand.java

index 918d1caf0106fada87ba4afc4cc3b11a57c862bc..793ddda74677abe353b2daab0cd1bdf744fbb78f 100644 (file)
@@ -33,10 +33,12 @@ public class OvsdbNodeRemoveCommand extends AbstractTransactionCommand {
             if (ovsdbNodeOptional.isPresent()) {
                 Node ovsdbNode = ovsdbNodeOptional.get();
                 OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
-                if (ovsdbNodeAugmentation.getManagedNodeEntry() != null) {
+                if (ovsdbNodeAugmentation != null && ovsdbNodeAugmentation.getManagedNodeEntry() != null) {
                     for (ManagedNodeEntry managedNode : ovsdbNodeAugmentation.getManagedNodeEntry()) {
                         transaction.delete(LogicalDatastoreType.OPERATIONAL, managedNode.getBridgeRef().getValue());
                     }
+                } else {
+                    LOG.warn("{} had no OvsdbNodeAugmentation", ovsdbNode);
                 }
                 transaction.delete(LogicalDatastoreType.OPERATIONAL,
                         SouthboundMapper.createInstanceIdentifier(getConnectionInfo()));