use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method handleQosInterfaceAdd.
public void handleQosInterfaceAdd(Port port, Uuid qosUuid) {
LOG.debug("Handling Port add and QoS associated: port: {} qos: {}", port.getUuid().getValue(), qosUuid.getValue());
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
// handle DSCP Mark Rules update
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
setPortDscpMarking(port, qosPolicy.getDscpmarkingRules().get(0));
}
return emptyList();
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronPortQosUpdate.
public void handleNeutronPortQosUpdate(Port port, Uuid qosUuidNew, Uuid qosUuidOld) {
LOG.debug("Handling Port QoS update: port: {} qosservice: {}", port.getUuid().getValue(), qosUuidNew.getValue());
QosPolicy qosPolicyNew = qosPolicyMap.get(qosUuidNew);
QosPolicy qosPolicyOld = qosPolicyMap.get(qosUuidOld);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
// handle Bandwidth Limit Rules update
if (qosPolicyNew != null && qosPolicyNew.getBandwidthLimitRules() != null && !qosPolicyNew.getBandwidthLimitRules().isEmpty()) {
setPortBandwidthLimits(port, qosPolicyNew.getBandwidthLimitRules().get(0), tx);
} else {
if (qosPolicyOld != null && qosPolicyOld.getBandwidthLimitRules() != null && !qosPolicyOld.getBandwidthLimitRules().isEmpty()) {
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
setPortBandwidthLimits(port, bwLimitBuilder.setMaxBurstKbps(Uint64.ZERO).setMaxKbps(Uint64.ZERO).build(), tx);
}
}
// handle DSCP Mark Rules update
if (qosPolicyNew != null && qosPolicyNew.getDscpmarkingRules() != null && !qosPolicyNew.getDscpmarkingRules().isEmpty()) {
setPortDscpMarking(port, qosPolicyNew.getDscpmarkingRules().get(0));
} else {
if (qosPolicyOld != null && qosPolicyOld.getDscpmarkingRules() != null && !qosPolicyOld.getDscpmarkingRules().isEmpty()) {
unsetPortDscpMark(port);
}
}
})));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method unsetPortDscpMark.
public void unsetPortDscpMark(Port port) {
Uint64 dpnId = getDpnForInterface(port.getUuid().getValue());
String ifName = port.getUuid().getValue();
if (dpnId.equals(Uint64.ZERO)) {
LOG.debug("DPN ID for port {} not found. Cannot unset dscp value", port.getUuid().getValue());
return;
}
if (!qosEosHandler.isQosClusterOwner()) {
qosServiceConfiguredPorts.remove(port.getUuid());
LOG.debug("Not Qos Cluster Owner. Ignoring unsetting DSCP marking");
return;
} else {
LOG.trace("Removing dscp marking rule from Port {}", port.getUuid().getValue());
Interface intf = getInterfaceStateFromOperDS(ifName);
// unbind service from interface
unbindservice(ifName);
// 1. OF
int ipVersions = getIpVersions(port);
if (hasIpv4Addr(ipVersions)) {
removeFlow(dpnId, ifName, NwConstants.ETHTYPE_IPV4, intf);
}
if (hasIpv6Addr(ipVersions)) {
removeFlow(dpnId, ifName, NwConstants.ETHTYPE_IPV6, intf);
}
qosServiceConfiguredPorts.remove(port.getUuid());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project netvirt by opendaylight.
the class QosNeutronUtils method setPortDscpMarking.
public void setPortDscpMarking(Port port, DscpmarkingRules dscpMark) {
Uint64 dpnId = getDpnForInterface(port.getUuid().getValue());
String ifName = port.getUuid().getValue();
if (dpnId.equals(Uint64.ZERO)) {
LOG.info("DPN ID for interface {} not found. Cannot set dscp value {} on port {}", port.getUuid().getValue(), dscpMark, port.getUuid().getValue());
return;
}
if (!qosEosHandler.isQosClusterOwner()) {
qosServiceConfiguredPorts.add(port.getUuid());
LOG.trace("Not Qos Cluster Owner. Ignoring setting DSCP marking");
return;
} else {
Interface ifState = getInterfaceStateFromOperDS(ifName);
Short dscpValue = dscpMark.getDscpMark().toJava();
int ipVersions = getIpVersions(port);
// 1. OF rules
if (hasIpv4Addr(ipVersions)) {
LOG.trace("setting ipv4 flow for port: {}, dscp: {}", ifName, dscpValue);
addFlow(dpnId, dscpValue, ifName, NwConstants.ETHTYPE_IPV4, ifState);
}
if (hasIpv6Addr(ipVersions)) {
LOG.trace("setting ipv6 flow for port: {}, dscp: {}", ifName, dscpValue);
addFlow(dpnId, dscpValue, ifName, NwConstants.ETHTYPE_IPV6, ifState);
}
if (qosServiceConfiguredPorts.add(port.getUuid())) {
// bind qos service to interface
bindservice(ifName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp in project openflowplugin by opendaylight.
the class MatchConvertorUtil method toOfIpDscp.
/**
* To of ip dscp match entry.
*
* @param ipDscp the ip dscp
* @return the match entry
*/
public static MatchEntry toOfIpDscp(final Dscp ipDscp) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(IpDscp.class);
IpDscpCaseBuilder ipDscpCaseBuilder = new IpDscpCaseBuilder();
IpDscpBuilder ipDscpBuilder = new IpDscpBuilder();
ipDscpBuilder.setDscp(ipDscp);
ipDscpCaseBuilder.setIpDscp(ipDscpBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipDscpCaseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations