PortSecurity changes for looping off EP instead of EPG. 06/21506/1
authorKeith Burns (alagalah) <alagalah@gmail.com>
Sun, 31 May 2015 14:50:10 +0000 (07:50 -0700)
committerKeith Burns (alagalah) <alagalah@gmail.com>
Sun, 31 May 2015 14:50:10 +0000 (07:50 -0700)
Also adds support for external port.

Change-Id: Iafc3a961ef3ba9f60434ef8b2b65ce45b085fd1d
Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PortSecurity.java

index d152076036a11f85765322776cabd896151dc6d5..604d17b3c7d5a0fc06885a5074b4fc5f3fb54b29 100644 (file)
@@ -75,23 +75,20 @@ public class PortSecurity extends FlowTable {
         flowMap.writeFlow(nodeId, TABLE_ID, dropFlow(Integer.valueOf(111), FlowUtils.IPv4));
         flowMap.writeFlow(nodeId, TABLE_ID, dropFlow(Integer.valueOf(112), FlowUtils.IPv6));
 
-        for (EgKey sepg : ctx.getEndpointManager().getGroupsForNode(nodeId)) {
-            for (Endpoint ep : ctx.getEndpointManager().getEndpointsForNode(nodeId, sepg)) {
-                OfOverlayContext ofc = ep.getAugmentation(OfOverlayContext.class);
-
-                if (ofc != null && ofc.getNodeConnectorId() != null &&
-                        (ofc.getLocationType() == null ||
-                        LocationType.Internal.equals(ofc.getLocationType()))) {
-                    // Allow layer 3 traffic (ARP and IP) with the correct
-                    // source IP, MAC, and source port
-                    l3flow(flowMap, nodeId, ep, ofc, 120, false);
-                    l3flow(flowMap, nodeId, ep, ofc, 121, true);
-                    flowMap.writeFlow(nodeId, TABLE_ID, l3DhcpDoraFlow(ep, ofc, 115));
-
-                    // Allow layer 2 traffic with the correct source MAC and
-                    // source port (note lower priority than drop IP rules)
-                    flowMap.writeFlow(nodeId, TABLE_ID, l2flow(ep, ofc, 100));
-                }
+        for (Endpoint ep : ctx.getEndpointManager().getEndpointsForNode(nodeId)) {
+            OfOverlayContext ofc = ep.getAugmentation(OfOverlayContext.class);
+
+            if (ofc != null && ofc.getNodeConnectorId() != null
+                    && (ofc.getLocationType() == null || LocationType.Internal.equals(ofc.getLocationType()))) {
+                // Allow layer 3 traffic (ARP and IP) with the correct
+                // source IP, MAC, and source port
+                l3flow(flowMap, nodeId, ep, ofc, 120, false);
+                l3flow(flowMap, nodeId, ep, ofc, 121, true);
+                flowMap.writeFlow(nodeId, TABLE_ID, l3DhcpDoraFlow(ep, ofc, 115));
+
+                // Allow layer 2 traffic with the correct source MAC and
+                // source port (note lower priority than drop IP rules)
+                flowMap.writeFlow(nodeId, TABLE_ID, l2flow(ep, ofc, 100));
             }
         }
     }