Search in sources :

Example 1 with QosNetworkExtension

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

the class QosNeutronNetworkChangeListener method add.

@Override
protected void add(InstanceIdentifier<Network> instanceIdentifier, Network network) {
    QosNetworkExtension networkQos = network.getAugmentation(QosNetworkExtension.class);
    if (networkQos != null) {
        qosNeutronUtils.addToQosNetworksCache(networkQos.getQosPolicyId(), network);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(network, networkQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(network)) {
            qosAlertManager.addToQosAlertCache(network);
        }
    }
}
Also used : QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)

Example 2 with QosNetworkExtension

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

the class QosNeutronNetworkChangeListener method update.

@Override
protected void update(InstanceIdentifier<Network> instanceIdentifier, Network original, Network update) {
    QosNetworkExtension updateQos = update.getAugmentation(QosNetworkExtension.class);
    QosNetworkExtension originalQos = original.getAugmentation(QosNetworkExtension.class);
    if (originalQos == null && updateQos != null) {
        // qosservice policy add
        qosNeutronUtils.addToQosNetworksCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(update, updateQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.addToQosAlertCache(update);
        }
    } else if (originalQos != null && updateQos != null && !originalQos.getQosPolicyId().equals(updateQos.getQosPolicyId())) {
        // qosservice policy update
        qosNeutronUtils.removeFromQosNetworksCache(originalQos.getQosPolicyId(), original);
        qosNeutronUtils.addToQosNetworksCache(updateQos.getQosPolicyId(), update);
        qosNeutronUtils.handleNeutronNetworkQosUpdate(update, updateQos.getQosPolicyId());
        if (qosNeutronUtils.hasBandwidthLimitRule(original) && !qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.removeFromQosAlertCache(original);
        } else if (!qosNeutronUtils.hasBandwidthLimitRule(original) && qosNeutronUtils.hasBandwidthLimitRule(update)) {
            qosAlertManager.addToQosAlertCache(update);
        }
    } else if (originalQos != null && updateQos == null) {
        // qosservice policy delete
        if (qosNeutronUtils.hasBandwidthLimitRule(original)) {
            qosAlertManager.removeFromQosAlertCache(original);
        }
        qosNeutronUtils.handleNeutronNetworkQosRemove(original, originalQos.getQosPolicyId());
        qosNeutronUtils.removeFromQosNetworksCache(originalQos.getQosPolicyId(), original);
    }
}
Also used : QosNetworkExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)

Aggregations

QosNetworkExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.ext.rev160613.QosNetworkExtension)2