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);
}
}
}
});
}
}
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);
}
}
Aggregations