Search in sources :

Example 1 with QosPortExtension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension in project netvirt by opendaylight.

the class QosInterfaceStateChangeListener method remove.

@Override
protected void remove(InstanceIdentifier<Interface> identifier, Interface intrf) {
    if (L2vlan.class.equals(intrf.getType())) {
        final String interfaceName = intrf.getName();
        // Guava Optional asSet().forEach() emulates Java 8 Optional ifPresent()
        getNeutronPortForRemove(intrf).asSet().forEach(port -> {
            LOG.trace("Qos Service : Received interface {} PORT DOWN event ", interfaceName);
            String lowerLayerIf = intrf.getLowerLayerIf().get(0);
            LOG.trace("lowerLayerIf {}", lowerLayerIf);
            qosAlertManager.removeFromQosAlertCache(new NodeConnectorId(lowerLayerIf));
            QosPortExtension removeQos = port.getAugmentation(QosPortExtension.class);
            if (removeQos != null) {
                qosNeutronUtils.handleNeutronPortRemove(port, removeQos.getQosPolicyId(), intrf);
                qosNeutronUtils.removeFromQosPortsCache(removeQos.getQosPolicyId(), port);
            } else {
                Network network = neutronVpnManager.getNeutronNetwork(port.getNetworkId());
                if (network != null && network.getAugmentation(QosNetworkExtension.class) != null) {
                    Uuid networkQosUuid = network.getAugmentation(QosNetworkExtension.class).getQosPolicyId();
                    if (networkQosUuid != null) {
                        qosNeutronUtils.handleNeutronPortRemove(port, networkQosUuid, intrf);
                    }
                }
            }
        });
    }
}
Also used : Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Network(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network) QosPortExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension)

Example 2 with QosPortExtension

use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension in project netvirt by opendaylight.

the class QosNeutronPortChangeListener method update.

@Override
protected void update(InstanceIdentifier<Port> instanceIdentifier, Port original, Port update) {
    // check for QoS updates
    QosPortExtension updateQos = update.getAugmentation(QosPortExtension.class);
    QosPortExtension originalQos = original.getAugmentation(QosPortExtension.class);
    if (originalQos == null && updateQos != null) {
        // qosservice policy add
        qosNeutronUtils.addToQosPortsCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronPortQosAdd(update, updateQos.getQosPolicyId());
    } else if (originalQos != null && updateQos != null && !originalQos.getQosPolicyId().equals(updateQos.getQosPolicyId())) {
        // qosservice policy update
        qosNeutronUtils.removeFromQosPortsCache(originalQos.getQosPolicyId(), original);
        qosNeutronUtils.addToQosPortsCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronPortQosUpdate(update, updateQos.getQosPolicyId(), originalQos.getQosPolicyId());
    } else if (originalQos != null && updateQos == null) {
        // qosservice policy delete
        qosNeutronUtils.handleNeutronPortQosRemove(original, originalQos.getQosPolicyId());
        qosNeutronUtils.removeFromQosPortsCache(originalQos.getQosPolicyId(), original);
    }
    if (qosNeutronUtils.hasBandwidthLimitRule(original) && !qosNeutronUtils.hasBandwidthLimitRule(update)) {
        qosAlertManager.removeFromQosAlertCache(original);
    } else if (!qosNeutronUtils.hasBandwidthLimitRule(original) && qosNeutronUtils.hasBandwidthLimitRule(update)) {
        qosAlertManager.addToQosAlertCache(update);
    }
}
Also used : QosPortExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension)

Aggregations

QosPortExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosPortExtension)2 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 Network (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network)1 QosNetworkExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)1