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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations