Search in sources :

Example 1 with DscpmarkingRules

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules in project netvirt by opendaylight.

the class QosNeutronUtils method setPortDscpMarking.

public void setPortDscpMarking(Port port, DscpmarkingRules dscpMark) {
    if (!qosEosHandler.isQosClusterOwner()) {
        LOG.trace("Not Qos Cluster Owner. Ignoring setting DSCP marking");
        return;
    }
    LOG.trace("Setting DSCP value {} on Port {}", port, dscpMark);
    BigInteger dpnId = getDpnForInterface(port.getUuid().getValue());
    String ifName = port.getUuid().getValue();
    IpAddress ipAddress = port.getFixedIps().get(0).getIpAddress();
    Short dscpValue = dscpMark.getDscpMark();
    if (dpnId.equals(BigInteger.ZERO)) {
        LOG.info("DPN ID for interface {} not found", port.getUuid().getValue());
        return;
    }
    // 1. OF rules
    addFlow(dpnId, dscpValue, ifName, ipAddress, getInterfaceStateFromOperDS(ifName));
    if (qosServiceConfiguredPorts.add(port.getUuid())) {
        // bind qos service to interface
        bindservice(ifName);
    }
}
Also used : BigInteger(java.math.BigInteger) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)

Example 2 with DscpmarkingRules

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules in project netvirt by opendaylight.

the class QosPolicyChangeListener method add.

private void add(InstanceIdentifier<DscpmarkingRules> identifier, DscpmarkingRules input) {
    LOG.trace("Adding DscpMarkingRules : key: {}, value={}", identifier, input);
    Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
    for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
        qosNeutronUtils.handleNeutronNetworkQosUpdate(network, qosUuid);
    }
    for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
        jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
            WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
            List<ListenableFuture<Void>> futures = new ArrayList<>();
            qosNeutronUtils.setPortDscpMarking(port, input);
            futures.add(wrtConfigTxn.submit());
            return futures;
        });
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Example 3 with DscpmarkingRules

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules in project netvirt by opendaylight.

the class QosPolicyChangeListener method update.

private void update(InstanceIdentifier<DscpmarkingRules> identifier, DscpmarkingRules original, DscpmarkingRules update) {
    LOG.trace("Updating DscpMarkingRules : key: {}, original value={}, update value={}", identifier, original, update);
    Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
    update(qosUuid, update);
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) QosPolicy(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)

Example 4 with DscpmarkingRules

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules in project netvirt by opendaylight.

the class QosPolicyChangeListener method reapplyPolicy.

public void reapplyPolicy(String entityid) {
    Uuid policyUuid = Uuid.getDefaultInstance(entityid);
    if (!qosNeutronUtils.getQosPolicyMap().get(policyUuid).getBandwidthLimitRules().isEmpty()) {
        BandwidthLimitRules bandwidthLimitRules = qosNeutronUtils.getQosPolicyMap().get(policyUuid).getBandwidthLimitRules().get(0);
        update(policyUuid, bandwidthLimitRules);
    }
    if (!qosNeutronUtils.getQosPolicyMap().get(policyUuid).getDscpmarkingRules().isEmpty()) {
        DscpmarkingRules dscpmarkingRules = qosNeutronUtils.getQosPolicyMap().get(policyUuid).getDscpmarkingRules().get(0);
        update(policyUuid, dscpmarkingRules);
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) DscpmarkingRules(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules) BandwidthLimitRules(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.BandwidthLimitRules)

Example 5 with DscpmarkingRules

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules in project netvirt by opendaylight.

the class QosPolicyChangeListener method update.

private void update(Uuid qosUuid, DscpmarkingRules update) {
    for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
        qosNeutronUtils.handleNeutronNetworkQosUpdate(network, qosUuid);
    }
    for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
        jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
            WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
            List<ListenableFuture<Void>> futures = new ArrayList<>();
            qosNeutronUtils.setPortDscpMarking(port, update);
            futures.add(wrtConfigTxn.submit());
            return futures;
        });
    }
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Aggregations

Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)4 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)3 ArrayList (java.util.ArrayList)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)3 Port (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port)3 QosPolicy (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy)3 BigInteger (java.math.BigInteger)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 BandwidthLimitRules (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.BandwidthLimitRules)1 DscpmarkingRules (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.qos.policy.DscpmarkingRules)1