use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class AclServiceUtils method createCtMarkInstructionForNewState.
/**
* This method creates and returns the ct_mark instruction when a ACL rule removed from the
* instance. This instruction will reset the ct_mark value and stops the existing traffics.
*
* @param filterTable the filterTable
* @param elanId the Elan id
* @return list of instruction
*/
public static List<InstructionInfo> createCtMarkInstructionForNewState(Short filterTable, Long elanId) {
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
List<NxCtAction> ctActionsList = new ArrayList<>();
NxCtAction nxCtMarkClearAction = new ActionNxConntrack.NxCtMark(AclConstants.CT_MARK_NEW_STATE);
ctActionsList.add(nxCtMarkClearAction);
ActionNxConntrack actionNxConntrack = new ActionNxConntrack(2, 1, 0, elanId.intValue(), (short) 255, ctActionsList);
actionsInfos.add(actionNxConntrack);
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionGotoTable(filterTable));
return instructions;
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class AclNodeDefaultFlowsTxBuilder method addEgressConntrackDummyLookup.
private void addEgressConntrackDummyLookup() {
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new NxMatchCtState(AclConstants.TRACKED_CT_STATE, AclConstants.TRACKED_CT_STATE_MASK));
int elanTag = dummyTag;
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionNxConntrack(2, 0, 0, elanTag, NwConstants.EGRESS_ACL_ANTI_SPOOFING_TABLE));
instructions.add(new InstructionApplyActions(actionsInfos));
String flowName = "Egress_Fixed_Dummy_Table_Ipv4_" + this.dpId;
addFlowToTx(NwConstants.EGRESS_ACL_DUMMY_TABLE, flowName, AclConstants.ACL_DEFAULT_PRIORITY, matches, instructions);
matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV6);
matches.add(new NxMatchCtState(AclConstants.TRACKED_CT_STATE, AclConstants.TRACKED_CT_STATE_MASK));
flowName = "Egress_Fixed_Dummy_Table_Ipv6_" + this.dpId;
addFlowToTx(NwConstants.EGRESS_ACL_DUMMY_TABLE, flowName, AclConstants.ACL_DEFAULT_PRIORITY, matches, instructions);
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class ExternalNetworkGroupInstaller method buildExtNetGroupEntity.
private GroupEntity buildExtNetGroupEntity(String macAddress, String subnetName, long groupId, String extInterface, BigInteger dpnId) {
List<ActionInfo> actionList = new ArrayList<>();
final int setFieldEthDestActionPos = 0;
List<ActionInfo> egressActionList = new ArrayList<>();
if (extInterface != null) {
egressActionList = NatUtil.getEgressActionsForInterface(interfaceManager, extInterface, null, setFieldEthDestActionPos + 1);
}
if (Strings.isNullOrEmpty(macAddress) || egressActionList.isEmpty()) {
if (Strings.isNullOrEmpty(macAddress)) {
LOG.trace("buildExtNetGroupEntity : Building ext-net group {} entry with drop action since " + "GW mac has not been resolved for subnet {} extInterface {}", groupId, subnetName, extInterface);
} else {
LOG.warn("buildExtNetGroupEntity : Building ext-net group {} entry with drop action since " + "no egress actions were found for subnet {} extInterface {}", groupId, subnetName, extInterface);
}
actionList.add(new ActionDrop());
} else {
LOG.trace("Building ext-net group {} entry for subnet {} extInterface {} macAddress {}", groupId, subnetName, extInterface, macAddress);
actionList.add(new ActionSetFieldEthernetDestination(setFieldEthDestActionPos, new MacAddress(macAddress)));
actionList.addAll(egressActionList);
}
List<BucketInfo> listBucketInfo = new ArrayList<>();
listBucketInfo.add(new BucketInfo(actionList));
return MDSALUtil.buildGroupEntity(dpnId, groupId, subnetName, GroupTypes.GroupAll, listBucketInfo);
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class ExternalRoutersListener method buildOutboundFlowEntity.
protected FlowEntity buildOutboundFlowEntity(BigInteger dpId, long routerId) {
LOG.debug("buildOutboundFlowEntity : called for dpId {} and routerId{}", dpId, routerId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
String flowRef = getFlowRefOutbound(dpId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
BigInteger cookie = getCookieOutboundFlow(routerId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, 5, flowRef, 0, 0, cookie, matches, instructions);
LOG.debug("installOutboundMissEntry : returning flowEntity {}", flowEntity);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.ActionInfo in project netvirt by opendaylight.
the class ExternalRoutersListener method makeLFibTableEntry.
private void makeLFibTableEntry(BigInteger dpId, long serviceId, short tableId, WriteTransaction writeFlowInvTx) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.MPLS_UNICAST);
matches.add(new MatchMplsLabel(serviceId));
List<Instruction> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPopMpls());
Instruction writeInstruction = new InstructionApplyActions(actionsInfos).buildInstruction(0);
instructions.add(writeInstruction);
instructions.add(new InstructionGotoTable(tableId).buildInstruction(1));
// Install the flow entry in L3_LFIB_TABLE
String flowRef = getFlowRef(dpId, NwConstants.L3_LFIB_TABLE, serviceId, "");
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_LFIB_TABLE, flowRef, 10, flowRef, 0, 0, COOKIE_VM_LFIB_TABLE, matches, instructions);
mdsalManager.addFlowToTx(dpId, flowEntity, writeFlowInvTx);
LOG.debug("makeLFibTableEntry : LFIB Entry for dpID {} : label : {} modified successfully", dpId, serviceId);
}
Aggregations