Search in sources :

Example 1 with ActionSetFieldDscp

use of org.opendaylight.genius.mdsalutil.actions.ActionSetFieldDscp 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

BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)1 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)1 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)1 ActionSetFieldDscp (org.opendaylight.genius.mdsalutil.actions.ActionSetFieldDscp)1 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)1 MatchEthernetType (org.opendaylight.genius.mdsalutil.matches.MatchEthernetType)1 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)1