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