use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.
the class QosAlertManager method removeFromQosAlertCache.
public void removeFromQosAlertCache(Network network) {
LOG.trace("Removing network {} from cache", network.getUuid());
List<Uuid> subnetIds = qosNeutronUtils.getSubnetIdsFromNetworkId(network.getUuid());
for (Uuid subnetId : subnetIds) {
List<Uuid> portIds = qosNeutronUtils.getPortIdsFromSubnetId(subnetId);
for (Uuid portId : portIds) {
Port port = neutronVpnManager.getNeutronPort(portId);
if (port != null && !qosNeutronUtils.portHasQosPolicy(port)) {
LOG.trace("Removing network {} port {} from cache", network.getUuid(), port.getUuid());
removeFromQosAlertCache(port);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network 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);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network 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);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.
the class QosNeutronUtils method hasBandwidthLimitRule.
public boolean hasBandwidthLimitRule(Port port) {
Uuid qosUuid = null;
boolean bwLimitRule = false;
LOG.trace("checking bandwidth limit rule for port: {}", port.getUuid());
if (port.getAugmentation(QosPortExtension.class) != null) {
qosUuid = port.getAugmentation(QosPortExtension.class).getQosPolicyId();
} else {
Network network = neutronVpnManager.getNeutronNetwork(port.getNetworkId());
if (network.getAugmentation(QosNetworkExtension.class) != null) {
qosUuid = network.getAugmentation(QosNetworkExtension.class).getQosPolicyId();
}
}
if (qosUuid != null) {
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
bwLimitRule = true;
}
}
LOG.trace("Bandwidth limit rule for port: {} return value {}", port.getUuid(), bwLimitRule);
return bwLimitRule;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronNetworkQosDscpRuleRemove.
public void handleNeutronNetworkQosDscpRuleRemove(Network network) {
LOG.trace("Handling Qos Dscp Rule Remove, net: {}", network.getUuid());
List<Uuid> subnetIds = getSubnetIdsFromNetworkId(network.getUuid());
for (Uuid subnetId : subnetIds) {
List<Uuid> portIds = getPortIdsFromSubnetId(subnetId);
for (Uuid portId : portIds) {
Port port = neutronVpnManager.getNeutronPort(portId);
if (port != null && (port.getAugmentation(QosPortExtension.class) == null || port.getAugmentation(QosPortExtension.class).getQosPolicyId() == null)) {
jobCoordinator.enqueueJob("QosPort-" + portId.getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
unsetPortDscpMark(port);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
}
}
Aggregations