X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=renderers%2Fofoverlay%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgroupbasedpolicy%2Frenderer%2Fofoverlay%2Fflow%2FPolicyEnforcer.java;fp=renderers%2Fofoverlay%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fgroupbasedpolicy%2Frenderer%2Fofoverlay%2Fflow%2FPolicyEnforcer.java;h=a6608b68de3cbbde820cd04f1d0b59a3feceb634;hb=5cf357d93d0ecab7b5746e2f4e234472b6e5ce6a;hp=90e2ad52d63a57196c2ef8b8d84a3f10c622e7da;hpb=2f546bd9cba2b1e8ca3a157297ad28f42722d8e2;p=groupbasedpolicy.git diff --git a/renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PolicyEnforcer.java b/renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PolicyEnforcer.java index 90e2ad52d..a6608b68d 100755 --- a/renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PolicyEnforcer.java +++ b/renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/flow/PolicyEnforcer.java @@ -26,8 +26,8 @@ import java.util.Set; import javax.annotation.concurrent.Immutable; +import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.OfWriter; import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.OfContext; -import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.PolicyManager.FlowMap; import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.FlowUtils.RegMatch; import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.flow.OrdinalFactory.EndpointFwdCtxOrdinals; import org.opendaylight.groupbasedpolicy.renderer.ofoverlay.sf.Action; @@ -109,13 +109,13 @@ public class PolicyEnforcer extends FlowTable { } @Override - public void sync(NodeId nodeId, PolicyInfo policyInfo, FlowMap flowMap) throws Exception { + public void sync(NodeId nodeId, PolicyInfo policyInfo, OfWriter ofWriter) throws Exception { - flowMap.writeFlow(nodeId, TABLE_ID, dropFlow(Integer.valueOf(1), null, TABLE_ID)); + ofWriter.writeFlow(nodeId, TABLE_ID, dropFlow(Integer.valueOf(1), null, TABLE_ID)); NodeConnectorId tunPort = ctx.getSwitchManager().getTunnelPort(nodeId, TunnelTypeVxlan.class); if (tunPort != null) { - flowMap.writeFlow(nodeId, TABLE_ID, allowFromTunnel(tunPort)); + ofWriter.writeFlow(nodeId, TABLE_ID, allowFromTunnel(tunPort)); } HashSet visitedPairs = new HashSet<>(); @@ -173,7 +173,7 @@ public class PolicyEnforcer extends FlowTable { srcEp.getKey(), dstEp.getKey()); visitedPairs.add(policyPair); } - syncPolicy(flowMap, netElements, activeRulesByConstraints.getValue(), policyPair); + syncPolicy(ofWriter, netElements, activeRulesByConstraints.getValue(), policyPair); } // Reverse @@ -197,7 +197,7 @@ public class PolicyEnforcer extends FlowTable { visitedReversePairs.add(policyPair); } - syncPolicy(flowMap, netElements, activeRulesByConstraints.getValue(), policyPair); + syncPolicy(ofWriter, netElements, activeRulesByConstraints.getValue(), policyPair); } } } @@ -231,8 +231,8 @@ public class PolicyEnforcer extends FlowTable { int depgId = dstEpFwdCxtOrds.getEpgId(); int sepgId = srcEpFwdCxtOrds.getEpgId(); - flowMap.writeFlow(nodeId, TABLE_ID, allowSameEpg(sepgId, depgId)); - flowMap.writeFlow(nodeId, TABLE_ID, allowSameEpg(depgId, sepgId)); + ofWriter.writeFlow(nodeId, TABLE_ID, allowSameEpg(sepgId, depgId)); + ofWriter.writeFlow(nodeId, TABLE_ID, allowSameEpg(depgId, sepgId)); } } } @@ -241,7 +241,7 @@ public class PolicyEnforcer extends FlowTable { // Write ARP flows per flood domain. for (Integer fdId : fdIds) { - flowMap.writeFlow(nodeId, TABLE_ID, createArpFlow(fdId)); + ofWriter.writeFlow(nodeId, TABLE_ID, createArpFlow(fdId)); } } @@ -293,14 +293,14 @@ public class PolicyEnforcer extends FlowTable { } - private void syncPolicy(FlowMap flowMap, NetworkElements netElements, List rgs, PolicyPair policyPair) { + private void syncPolicy(OfWriter ofWriter, NetworkElements netElements, List rgs, PolicyPair policyPair) { int priority = 65000; for (RuleGroup rg : rgs) { TenantId tenantId = rg.getContractTenant().getId(); IndexedTenant tenant = ctx.getPolicyResolver().getTenant(tenantId); for (Rule r : rg.getRules()) { - syncDirection(flowMap, netElements, tenant, policyPair, r, Direction.In, priority); - syncDirection(flowMap, netElements, tenant, policyPair, r, Direction.Out, priority); + syncDirection(ofWriter, netElements, tenant, policyPair, r, Direction.In, priority); + syncDirection(ofWriter, netElements, tenant, policyPair, r, Direction.Out, priority); priority -= 1; } @@ -327,7 +327,7 @@ public class PolicyEnforcer extends FlowTable { } - private void syncDirection(FlowMap flowMap, NetworkElements netElements, IndexedTenant contractTenant, + private void syncDirection(OfWriter ofWriter, NetworkElements netElements, IndexedTenant contractTenant, PolicyPair policyPair, Rule rule, Direction direction, int priority) { @@ -449,7 +449,8 @@ public class PolicyEnforcer extends FlowTable { * Convert the GBP Action to one or more OpenFlow Actions */ if (!(actionRefList.indexOf(actionRule) == (actionRefList.size() - 1) && action.equals(SubjectFeatures.getAction(AllowAction.DEFINITION.getId())))) { - actionBuilderList = action.updateAction(actionBuilderList, params, actionRule.getOrder(), netElements, policyPair, flowMap, ctx, direction); + actionBuilderList = action.updateAction(actionBuilderList, params, actionRule.getOrder(), netElements, policyPair, + ofWriter, ctx, direction); } } @@ -474,7 +475,7 @@ public class PolicyEnforcer extends FlowTable { } else { flow.setInstructions(instructions(applyActionIns(actionBuilderList), getGotoExternalInstruction())); } - flowMap.writeFlow(netElements.getLocalNodeId(), TABLE_ID, flow.build()); + ofWriter.writeFlow(netElements.getLocalNodeId(), TABLE_ID, flow.build()); } }