Search in sources :

Example 11 with Dscp

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();
    });
}
Also used : QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Example 12 with Dscp

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);
            }
        }
    })));
}
Also used : BandwidthLimitRulesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.BandwidthLimitRulesBuilder) QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Example 13 with Dscp

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());
    }
}
Also used : Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 14 with Dscp

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);
        }
    }
}
Also used : Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 15 with Dscp

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();
}
Also used : IpDscpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ip.dscp._case.IpDscpBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) IpDscpCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCaseBuilder)

Aggregations

Test (org.junit.Test)26 Dscp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp)17 ArrayList (java.util.ArrayList)16 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)11 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)9 BigInteger (java.math.BigInteger)8 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match)8 IpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch)7 QosPolicy (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)7 ByteBuf (io.netty.buffer.ByteBuf)6 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)6 EthernetMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch)6 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)6 Dscp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.Dscp)6 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)5 TcpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch)5 UdpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch)5 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)5 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)5 IpDscpCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCaseBuilder)5