NETVIRT-221: Fixed rules are not added when no SG is associated with the 02/71102/6
authorkiranvasudeva <kirankumar.v@altencalsoftlabs.com>
Thu, 19 Apr 2018 09:03:10 +0000 (14:33 +0530)
committerSam Hague <shague@redhat.com>
Thu, 26 Apr 2018 13:12:35 +0000 (13:12 +0000)
port.

    1. When we add a port with SG disabled and no SG associated, the
    port does not have InterfaceAcl Augmentation. this is causing
    NullPointerException when port is updated with SG enable. So handled
    the NPE, fixed the issue and update flow will add the required fixed
    rules.

Change-Id: I0199f7eabad7f1b6caec8ce53412d86e50f63f51
Signed-off-by: kiranvasudeva <kirankumar.v@altencalsoftlabs.com>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/listeners/AclInterfaceListener.java

index 826eb51335e6762afd45d3c780b1dfa79f07ce73..e8675b68aaebab7ae2a3b4fa2ec9e2a273419d8a 100644 (file)
@@ -122,8 +122,11 @@ public class AclInterfaceListener extends AsyncDataTreeChangeListenerBase<Interf
         }
         if (aclInPortAfter != null && aclInPortAfter.isPortSecurityEnabled()
                 || aclInPortBefore != null && aclInPortBefore.isPortSecurityEnabled()) {
-            boolean isSgChanged =
-                    isSecurityGroupsChanged(aclInPortBefore.getSecurityGroups(), aclInPortAfter.getSecurityGroups());
+            List<Uuid> sgsBefore = null;
+            if (aclInPortBefore != null) {
+                sgsBefore = aclInPortBefore.getSecurityGroups();
+            }
+            boolean isSgChanged = isSecurityGroupsChanged(sgsBefore, aclInPortAfter.getSecurityGroups());
             AclInterface aclInterfaceAfter =
                     addOrUpdateAclInterfaceCache(interfaceId, aclInPortAfter, isSgChanged, interfaceState);