Fixed NPE in md-sal secutiry groups to neutron security group conversion. 94/29394/1
authorAnil Vishnoi <vishnoianil@gmail.com>
Wed, 4 Nov 2015 18:17:46 +0000 (23:47 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 6 Nov 2015 20:14:48 +0000 (01:44 +0530)
Change-Id: Ie2e119fdc24168f2ab4df26332244586c644912f
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/crud/impl/NeutronPortInterface.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/translator/iaware/impl/NeutronPortChangeListener.java

index 08d0d4d502f48b889e5457858e7dbffb58eccc66..08f0c415b97f15f594215c64fbbbfa680bf48081 100644 (file)
@@ -195,7 +195,10 @@ public class NeutronPortInterface extends AbstractNeutronInterface<Port, Neutron
             NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this);
             INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface();
             for (Uuid sgUuid : port.getSecurityGroups()) {
-                allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
+                NeutronSecurityGroup secGroup = sgIf.getNeutronSecurityGroup(sgUuid.getValue());
+                if (secGroup != null) {
+                    allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
+                }
             }
             List<NeutronSecurityGroup> groups = new ArrayList<>();
             groups.addAll(allGroups);
index 001cfedfad8560e82e50a7fb4d6b9a4220ed96f7..6f7bab994ce3256e36538665d2fc6f3efb7b3c53 100644 (file)
@@ -171,7 +171,10 @@ public class NeutronPortChangeListener implements DataChangeListener, AutoClosea
             NeutronCRUDInterfaces interfaces = new NeutronCRUDInterfaces().fetchINeutronSecurityGroupCRUD(this);
             INeutronSecurityGroupCRUD sgIf = interfaces.getSecurityGroupInterface();
             for (Uuid sgUuid : port.getSecurityGroups()) {
-                allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
+                NeutronSecurityGroup secGroup = sgIf.getNeutronSecurityGroup(sgUuid.getValue());
+                if (secGroup != null) {
+                    allGroups.add(sgIf.getNeutronSecurityGroup(sgUuid.getValue()));
+                }
             }
             List<NeutronSecurityGroup> groups = new ArrayList<>();
             groups.addAll(allGroups);