use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class AbstractAclServiceImpl method programAclForExistingTrafficTable.
private void programAclForExistingTrafficTable(AclInterface port, Ace ace, int addOrRemove, String flowName, List<MatchInfoBase> matches, Integer priority) {
AceIp acl = (AceIp) ace.getMatches().getAceType();
final String newFlowName = flowName + this.directionString + "_" + port.getDpId() + "_" + port.getLPortTag() + "_" + ((acl.getAceIpVersion() instanceof AceIpv4) ? "_IPv4" : "_IPv6") + "_FlowAfterRuleDeleted";
final List<MatchInfoBase> newMatches = matches.stream().filter(obj -> !(obj instanceof NxMatchCtState || obj instanceof MatchMetadata)).collect(Collectors.toList());
newMatches.add(AclServiceUtils.buildLPortTagMatch(port.getLPortTag(), serviceMode));
newMatches.add(new NxMatchCtState(AclConstants.TRACKED_RPL_CT_STATE, AclConstants.TRACKED_RPL_CT_STATE_MASK));
List<InstructionInfo> instructions = AclServiceUtils.createCtMarkInstructionForNewState(getAclFilterCumDispatcherTable(), port.getElanId());
// Reversing the flow add/delete operation for this table.
int operation = (addOrRemove == NwConstants.ADD_FLOW) ? NwConstants.DEL_FLOW : NwConstants.ADD_FLOW;
syncFlow(port.getDpId(), getAclForExistingTrafficTable(), newFlowName, priority, "ACL", 0, AclServiceUtils.getHardTimoutForApplyStatefulChangeOnExistingTraffic(ace, aclServiceUtils), AclConstants.COOKIE_ACL_BASE, newMatches, instructions, operation);
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class IPV6InternetDefaultRouteProgrammer method buildIPv6FallbacktoExternalVpn.
private FlowEntity buildIPv6FallbacktoExternalVpn(BigInteger dpId, long bgpVpnId, long routerId) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV6);
// add match for vrfid
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(bgpVpnId), MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionGotoTable(NwConstants.EXTERNAL_TUNNEL_TABLE));
String defaultIPv6 = "0:0:0:0:0:0:0:0";
String flowRef = getIPv6FlowRefL3(dpId, NwConstants.L3_FIB_TABLE, defaultIPv6, routerId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef, NwConstants.TABLE_MISS_PRIORITY, flowRef, /* "L3 ipv6 internet default route",*/
0, 0, NwConstants.COOKIE_VM_FIB_TABLE, matches, instructions);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class QosNeutronUtils method addFlow.
private void addFlow(BigInteger dpnId, Short dscpValue, String ifName, IpAddress ipAddress, Interface ifState) {
if (ifState == null) {
LOG.trace("Could not find the ifState for interface {}", ifName);
return;
}
Integer ifIndex = ifState.getIfIndex();
List<MatchInfo> matches = new ArrayList<>();
if (ipAddress.getIpv4Address() != null) {
matches.add(new MatchEthernetType(NwConstants.ETHTYPE_IPV4));
} else {
matches.add(new MatchEthernetType(NwConstants.ETHTYPE_IPV6));
}
matches.add(new MatchMetadata(MetaDataUtil.getLportTagMetaData(ifIndex), MetaDataUtil.METADATA_MASK_LPORT_TAG));
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionSetFieldDscp(dscpValue));
actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.QOS_DSCP_TABLE, getQosFlowId(NwConstants.QOS_DSCP_TABLE, dpnId, ifIndex), QosConstants.QOS_DEFAULT_FLOW_PRIORITY, "QoSConfigFlow", 0, 0, NwConstants.COOKIE_QOS_TABLE, matches, instructions);
mdsalUtils.installFlow(flowEntity);
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class PolicyServiceFlowUtil method getPolicyRouteMatches.
public List<MatchInfoBase> getPolicyRouteMatches(long policyClassifierId, int lportTag) {
List<MatchInfoBase> matches = new ArrayList<>();
matches.add(new NxMatchRegister(NxmNxReg6.class, lportTag, MetaDataUtil.getLportTagMaskForReg6()));
matches.add(new MatchMetadata(MetaDataUtil.getPolicyClassifierMetaData(policyClassifierId), MetaDataUtil.METADATA_MASK_POLICY_CLASSIFER_ID));
return matches;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project genius by opendaylight.
the class InterfaceServiceUtil method getLPortDispatcherMatches.
public static List<MatchInfo> getLPortDispatcherMatches(short serviceIndex, int interfaceTag) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(MetaDataUtil.getMetaDataForLPortDispatcher(interfaceTag, serviceIndex), MetaDataUtil.getMetaDataMaskForLPortDispatcher()));
return mkMatches;
}
Aggregations