use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronPortQosAdd.
public void handleNeutronPortQosAdd(Port port, Uuid qosUuid) {
LOG.trace("Handling Port add and QoS associated: port: {} qos: {}", port.getUuid(), qosUuid);
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
// handle Bandwidth Limit Rules update
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
setPortBandwidthLimits(port, qosPolicy.getBandwidthLimitRules().get(0), wrtConfigTxn);
}
// handle DSCP Mark Rules update
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
setPortDscpMarking(port, qosPolicy.getDscpmarkingRules().get(0));
}
futures.add(wrtConfigTxn.submit());
return futures;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronNetworkQosRemove.
public void handleNeutronNetworkQosRemove(Network network, Uuid qosUuid) {
LOG.trace("Handling Network QoS removal: net: {} qosservice: {}", network.getUuid(), qosUuid);
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
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<>();
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
setPortBandwidthLimits(port, bwLimitBuilder.setMaxBurstKbps(BigInteger.ZERO).setMaxKbps(BigInteger.ZERO).build(), null);
}
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
unsetPortDscpMark(port);
}
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.
the class QosNeutronUtils method getQosPolicy.
@Nullable
public QosPolicy getQosPolicy(Port port) {
Uuid qosUuid = null;
QosPolicy qosPolicy = null;
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 = qosPolicyMap.get(qosUuid);
}
return qosPolicy;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.
the class QosNeutronUtils method hasBandwidthLimitRule.
public boolean hasBandwidthLimitRule(Network network) {
boolean bwLimitRule = false;
LOG.trace("checking bandwidth limit rule for network: {}", network.getUuid());
if (network.getAugmentation(QosNetworkExtension.class) != null) {
Uuid 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 network: {} return value {}", network.getUuid(), bwLimitRule);
return bwLimitRule;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronPortQosRemove.
public void handleNeutronPortQosRemove(Port port, Uuid qosUuid) {
LOG.trace("Handling Port QoS removal: port: {} qosservice: {}", port.getUuid(), qosUuid);
// check for network qosservice to apply
Network network = neutronVpnManager.getNeutronNetwork(port.getNetworkId());
if (network != null && network.getAugmentation(QosNetworkExtension.class) != null) {
Uuid networkQosUuid = network.getAugmentation(QosNetworkExtension.class).getQosPolicyId();
if (networkQosUuid != null) {
handleNeutronPortQosUpdate(port, networkQosUuid, qosUuid);
}
} else {
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
// handle Bandwidth Limit Rules removal
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
setPortBandwidthLimits(port, bwLimitBuilder.setMaxBurstKbps(BigInteger.ZERO).setMaxKbps(BigInteger.ZERO).build(), wrtConfigTxn);
}
// handle DSCP MArk Rules removal
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
unsetPortDscpMark(port);
}
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
Aggregations