Search in sources :

Example 1 with ActionNxCtClear

use of org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear in project netvirt by opendaylight.

the class AclNodeDefaultFlowsTxBuilder method programConntrackUntrackedRule.

private void programConntrackUntrackedRule(Integer priority, String flowId, int conntrackState, int conntrackMask, short tableId, short gotoTableId) {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(new NxMatchCtState(conntrackState, conntrackMask));
    matches.add(AclServiceUtils.buildAclConntrackClassifierTypeMatch(AclConntrackClassifierType.CONNTRACK_SUPPORTED));
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionNxCtClear());
    actionsInfos.add(new ActionNxResubmit(gotoTableId));
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfos));
    flowId = "Fixed_Conntrk_Trk_" + dpId.toString() + "_" + flowId + gotoTableId;
    addFlowToTx(tableId, flowId, priority, matches, instructions);
}
Also used : ActionNxCtClear(org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) NxMatchCtState(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 2 with ActionNxCtClear

use of org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear in project netvirt by opendaylight.

the class ConntrackBasedSnatService method addNaptPfibFlow.

protected void addNaptPfibFlow(TypedReadWriteTransaction<Configuration> confTx, Routers routers, Uint64 dpnId, Uint32 routerId, Uint32 extSubnetId) {
    Uint32 extNetId = NatUtil.getVpnId(confTx, routers.getNetworkId().getValue());
    LOG.info("installNaptPfibFlow : dpId {}, extNetId {}", dpnId, extNetId);
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    matches.add(new NxMatchCtState(SNAT_CT_STATE, SNAT_CT_STATE_MASK));
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId.longValue()), MetaDataUtil.METADATA_MASK_VRFID));
    List<ActionInfo> listActionInfo = new ArrayList<>();
    if (extSubnetId == NatConstants.INVALID_ID) {
        LOG.error("installNaptPfibFlow : external subnet id is invalid.");
        return;
    }
    ActionNxLoadMetadata actionLoadMeta = new ActionNxLoadMetadata(MetaDataUtil.getVpnIdMetadata(extSubnetId.longValue()), LOAD_START, LOAD_END);
    listActionInfo.add(actionLoadMeta);
    listActionInfo.add(new ActionNxLoadInPort(Uint64.valueOf(BigInteger.ZERO)));
    listActionInfo.add(new ActionNxCtClear());
    listActionInfo.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
    ArrayList<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(listActionInfo));
    String flowRef = getFlowRef(dpnId, NwConstants.NAPT_PFIB_TABLE, routerId);
    flowRef = flowRef + "OUTBOUND";
    NatUtil.addFlow(confTx, mdsalManager, dpnId, NwConstants.NAPT_PFIB_TABLE, flowRef, NatConstants.SNAT_TRK_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) NxMatchCtState(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState) ActionNxCtClear(org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear) ActionNxLoadMetadata(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata) ActionNxLoadInPort(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) Uint32(org.opendaylight.yangtools.yang.common.Uint32) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 3 with ActionNxCtClear

use of org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear in project netvirt by opendaylight.

the class AbstractAclServiceImpl method programAclCommitRuleForConntrack.

/**
 * Program acl commit rule for conntrack.
 *
 * @param flowEntries the flow entries
 * @param dpId the dp id
 * @param lportTag the lport tag
 * @param portId the port id
 * @param matchEtherType the match ether type
 * @param addOrRemove the add or remove
 */
protected void programAclCommitRuleForConntrack(List<FlowEntity> flowEntries, Uint64 dpId, int lportTag, String portId, MatchEthernetType matchEtherType, int addOrRemove) {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(matchEtherType);
    matches.addAll(AclServiceUtils.buildMatchesForLPortTagAndConntrackClassifierType(lportTag, AclConntrackClassifierType.CONNTRACK_SUPPORTED, serviceMode));
    List<ActionInfo> actionsInfos = new ArrayList<>();
    if (addOrRemove == NwConstants.ADD_FLOW) {
        Long elanId = getElanIdFromAclInterface(portId);
        if (elanId == null) {
            LOG.error("ElanId not found for portId={}; Context: dpId={}, lportTag={}, addOrRemove={}", portId, dpId, lportTag, addOrRemove);
            return;
        }
        List<NxCtAction> ctActionsList = Lists.newArrayList(new ActionNxConntrack.NxCtMark(AclConstants.CT_MARK_EST_STATE));
        actionsInfos.add(new ActionNxConntrack(2, 1, 0, elanId.intValue(), (short) 255, ctActionsList));
        actionsInfos.add(new ActionNxCtClear());
    }
    List<InstructionInfo> instructions = getDispatcherTableResubmitInstructions(actionsInfos);
    String flowName = directionString + "_Acl_Commit_Conntrack_" + dpId.toString() + "_" + lportTag + "_" + matchEtherType;
    // Flow for conntrack traffic to commit and resubmit to dispatcher
    addFlowEntryToList(flowEntries, dpId, getAclCommitterTable(), flowName, AclConstants.ACL_DEFAULT_PRIORITY, 0, 0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
}
Also used : ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionNxConntrack(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack) ActionNxCtClear(org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) NxCtAction(org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 4 with ActionNxCtClear

use of org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear in project netvirt by opendaylight.

the class AclNodeDefaultFlowsTxBuilder method programConntrackForwardRule.

/**
 * Adds the rule to forward the known packets.
 *
 * @param priority the priority of the flow
 * @param flowId the flowId
 * @param conntrackState the conntrack state of the packets thats should be
 *        send
 * @param conntrackMask the conntrack mask
 * @param dispatcherTableId the dispatcher table id
 * @param tableId the table id
 */
private void programConntrackForwardRule(Integer priority, String flowId, int conntrackState, int conntrackMask, short dispatcherTableId, short tableId, boolean shouldMatchMark) {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(new NxMatchCtState(conntrackState, conntrackMask));
    if (shouldMatchMark) {
        matches.add(new NxMatchCtMark(AclConstants.CT_MARK_EST_STATE, AclConstants.CT_MARK_EST_STATE_MASK));
    }
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionNxCtClear());
    actionsInfos.add(new ActionNxResubmit(dispatcherTableId));
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfos));
    flowId = "Fixed_Conntrk_Trk_" + dpId.toString() + "_" + flowId + dispatcherTableId;
    addFlowToTx(tableId, flowId, priority, matches, instructions);
}
Also used : NxMatchCtMark(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtMark) ActionNxCtClear(org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) NxMatchCtState(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Example 5 with ActionNxCtClear

use of org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear in project netvirt by opendaylight.

the class AclNodeDefaultFlowsTxBuilder method addEgressCtClearRule.

private void addEgressCtClearRule() {
    List<MatchInfoBase> matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV4);
    List<InstructionInfo> instructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionNxCtClear());
    instructions.add(new InstructionApplyActions(actionsInfos));
    instructions.add(new InstructionGotoTable(NwConstants.EGRESS_ACL_ANTI_SPOOFING_TABLE));
    String flowName = "Egress_Fixed_Ct_Clear_Table_Ipv4_" + this.dpId.toString();
    addFlowToTx(NwConstants.EGRESS_ACL_DUMMY_TABLE, flowName, AclConstants.ACL_DEFAULT_PRIORITY, matches, instructions);
    matches = new ArrayList<>();
    matches.add(MatchEthernetType.IPV6);
    flowName = "Egress_Fixed_Ct_Clear_Table_Ipv6_" + this.dpId.toString();
    addFlowToTx(NwConstants.EGRESS_ACL_DUMMY_TABLE, flowName, AclConstants.ACL_DEFAULT_PRIORITY, matches, instructions);
}
Also used : ActionNxCtClear(org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase)

Aggregations

ArrayList (java.util.ArrayList)5 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)5 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)5 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)5 ActionNxCtClear (org.opendaylight.genius.mdsalutil.actions.ActionNxCtClear)5 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)3 NxMatchCtState (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtState)3 ActionNxConntrack (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack)1 NxCtAction (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction)1 ActionNxLoadInPort (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort)1 ActionNxLoadMetadata (org.opendaylight.genius.mdsalutil.actions.ActionNxLoadMetadata)1 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)1 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)1 NxMatchCtMark (org.opendaylight.genius.mdsalutil.nxmatches.NxMatchCtMark)1 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)1