Update broadcast rules for subnet addtion/deletion 85/79985/6
authorShashidhar Raja <shashidharr@altencalsoftlabs.com>
Tue, 29 Jan 2019 07:48:55 +0000 (13:18 +0530)
committerSam Hague <shague@redhat.com>
Wed, 30 Jan 2019 22:34:08 +0000 (22:34 +0000)
Change-Id: I2e2deb51683ca95446677ff9490ab1f605b400cb
Signed-off-by: Shashidhar Raja <shashidharr@altencalsoftlabs.com>
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/AbstractAclServiceImpl.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/EgressAclServiceImpl.java
aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/IngressAclServiceImpl.java

index a9136cf02d09c98435321be1f94d0e142e743d4a..b92f27b1ca5aad1589695044de64b535a10e1930 100644 (file)
@@ -232,9 +232,11 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
 
         if (deletedSubnets != null && !deletedSubnets.isEmpty()) {
             programIcmpv6RARule(deleteFlowEntries, portAfter, deletedSubnets, NwConstants.DEL_FLOW);
+            programSubnetBroadcastRules(deleteFlowEntries, portAfter, deletedSubnets, NwConstants.DEL_FLOW);
         }
         if (addedSubnets != null && !addedSubnets.isEmpty()) {
             programIcmpv6RARule(addFlowEntries, portAfter, addedSubnets, NwConstants.ADD_FLOW);
+            programSubnetBroadcastRules(addFlowEntries, portAfter, addedSubnets, NwConstants.ADD_FLOW);
         }
     }
 
@@ -561,6 +563,17 @@ public abstract class AbstractAclServiceImpl implements AclServiceListener {
      */
     protected abstract void programBroadcastRules(List<FlowEntity> flowEntries, AclInterface port, int addOrRemove);
 
+    /**
+     * Programs broadcast rules.
+     *
+     * @param flowEntries the flow entries
+     * @param port the Acl Interface port
+     * @param subnetInfoList the port subnet info list
+     * @param addOrRemove whether to delete or add flow
+     */
+    protected abstract void programSubnetBroadcastRules(List<FlowEntity> flowEntries, AclInterface port,
+            List<SubnetInfo> subnetInfoList, int addOrRemove);
+
     protected abstract void programIcmpv6RARule(List<FlowEntity> flowEntries, AclInterface port,
             List<SubnetInfo> subnets, int addOrRemove);
 
index 4487c8b278e17540722758d4586e48cd21640bb2..cf582de0bdc729ee25da8fa1fe1b63800ec474f5 100644 (file)
@@ -335,6 +335,19 @@ public class EgressAclServiceImpl extends AbstractAclServiceImpl {
                 AclServiceUtils.excludeMulticastAAPs(port.getAllowedAddressPairs()), addOrRemove);
     }
 
+    /**
+     * Programs broadcast rules.
+     *
+     * @param flowEntries the flow entries
+     * @param port the Acl Interface port
+     * @param subnetInfoList the port subnet info list
+     * @param addOrRemove whether to delete or add flow
+     */
+    protected void programSubnetBroadcastRules(List<FlowEntity> flowEntries, AclInterface port,
+            List<SubnetInfo> subnetInfoList, int addOrRemove) {
+        // No action required on egress.
+    }
+
     /**
      * Programs Non-IP broadcast rules.
      *
index 9934ecab5c365e2934c107b95419dde36bde96e0..669f8c422ba98e334381e64dd9dba61c3fc27f4e 100644 (file)
@@ -143,7 +143,7 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
             programIcmpv6RARule(flowEntries, port, port.getSubnetInfo(), addOrRemove);
 
             programArpRule(flowEntries, dpid, lportTag, addOrRemove);
-            programIpv4BroadcastRule(flowEntries, port, addOrRemove);
+            programIpv4BroadcastRule(flowEntries, port, port.getSubnetInfo(), addOrRemove);
         }
     }
 
@@ -334,7 +334,20 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
      */
     @Override
     protected void programBroadcastRules(List<FlowEntity> flowEntries, AclInterface port, int addOrRemove) {
-        programIpv4BroadcastRule(flowEntries, port, addOrRemove);
+        programIpv4BroadcastRule(flowEntries, port, port.getSubnetInfo(), addOrRemove);
+    }
+
+    /**
+     * Programs broadcast rules.
+     *
+     * @param flowEntries the flow entries
+     * @param port the Acl Interface port
+     * @param subnetInfoList the port subnet info list
+     * @param addOrRemove whether to delete or add flow
+     */
+    protected void programSubnetBroadcastRules(List<FlowEntity> flowEntries, AclInterface port,
+            List<SubnetInfo> subnetInfoList, int addOrRemove) {
+        programIpv4BroadcastRule(flowEntries, port, subnetInfoList, addOrRemove);
     }
 
     /**
@@ -342,13 +355,14 @@ public class IngressAclServiceImpl extends AbstractAclServiceImpl {
      *
      * @param flowEntries the flow entries
      * @param port the Acl Interface port
+     * @param subnetInfoList Port subnet list
      * @param addOrRemove whether to delete or add flow
      */
-    private void programIpv4BroadcastRule(List<FlowEntity> flowEntries, AclInterface port, int addOrRemove) {
+    private void programIpv4BroadcastRule(List<FlowEntity> flowEntries, AclInterface port,
+            List<SubnetInfo> subnetInfoList, int addOrRemove) {
         BigInteger dpId = port.getDpId();
         int lportTag = port.getLPortTag();
         MatchInfoBase lportMatchInfo = AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode);
-        List<SubnetInfo> subnetInfoList = port.getSubnetInfo();
         if (subnetInfoList != null) {
             List<String> broadcastAddresses = AclServiceUtils.getIpBroadcastAddresses(subnetInfoList);
             for (String broadcastAddress : broadcastAddresses) {