Bug 4913 - populate openflow rules for security group on port creation
authorIsaku Yamahata <isaku.yamahata@intel.com>
Sat, 9 Jan 2016 01:45:53 +0000 (17:45 -0800)
committerIsaku Yamahata <isaku.yamahata@intel.com>
Sat, 9 Jan 2016 05:49:38 +0000 (21:49 -0800)
When port is created, original port is null.
In that case, flow should be populated instead of ignoring the events.

Change-Id: I1f90868bbb4bcb3e7d40474133bcaafe2fc1983a
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/NeutronL3Adapter.java

index 6869d10c6237bce85d80c3560b0013e419fcf47c..d4a29578f771e10d5c64f2b4008c132b8141c5bf 100644 (file)
@@ -892,10 +892,6 @@ public class NeutronL3Adapter extends AbstractHandler implements GatewayMacResol
          */
         try {
             NeutronPort originalPort = neutronPort.getOriginalPort();
-            if (null == originalPort) {
-                LOG.debug("processSecurityGroupUpdate: originalport is empty");
-                return;
-            }
             List<NeutronSecurityGroup> addedGroup = getsecurityGroupChanged(neutronPort,
                                                                             neutronPort.getOriginalPort());
             List<NeutronSecurityGroup> deletedGroup = getsecurityGroupChanged(neutronPort.getOriginalPort(),
@@ -915,7 +911,13 @@ public class NeutronL3Adapter extends AbstractHandler implements GatewayMacResol
 
     private List<NeutronSecurityGroup> getsecurityGroupChanged(NeutronPort port1, NeutronPort port2) {
         LOG.trace("getsecurityGroupChanged:" + "Port1:" + port1 + "Port2" + port2);
+        if (port1 == null) {
+            return null;
+        }
         List<NeutronSecurityGroup> list1 = new ArrayList<>(port1.getSecurityGroups());
+        if (port2 == null) {
+            return list1;
+        }
         List<NeutronSecurityGroup> list2 = new ArrayList<>(port2.getSecurityGroups());
         for (Iterator<NeutronSecurityGroup> iterator = list1.iterator(); iterator.hasNext();) {
             NeutronSecurityGroup securityGroup1 = iterator.next();