Search in sources :

Example 6 with MatchEthernetType

use of org.opendaylight.genius.mdsalutil.matches.MatchEthernetType 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);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) BigInteger(java.math.BigInteger) ActionSetFieldDscp(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldDscp) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Aggregations

ArrayList (java.util.ArrayList)6 MatchEthernetType (org.opendaylight.genius.mdsalutil.matches.MatchEthernetType)6 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)4 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)4 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)4 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)4 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)3 BigInteger (java.math.BigInteger)2 BucketInfo (org.opendaylight.genius.mdsalutil.BucketInfo)2 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)2 GroupEntity (org.opendaylight.genius.mdsalutil.GroupEntity)2 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)2 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)2 ActionSetFieldTunnelId (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId)2 MatchIpv4Destination (org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination)2 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)2 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)2 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)1 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)1 ActionSetFieldDscp (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldDscp)1