use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.route.monitoring.message.Update in project netvirt by opendaylight.
the class QosNeutronUtils method handleQosInterfaceAdd.
public void handleQosInterfaceAdd(Port port, Uuid qosUuid) {
LOG.debug("Handling Port add and QoS associated: port: {} qos: {}", port.getUuid().getValue(), qosUuid.getValue());
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
// handle DSCP Mark Rules update
if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null && !qosPolicy.getDscpmarkingRules().isEmpty()) {
setPortDscpMarking(port, qosPolicy.getDscpmarkingRules().get(0));
}
return emptyList();
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.route.monitoring.message.Update in project netvirt by opendaylight.
the class QosNeutronUtils method handleNeutronPortQosUpdate.
public void handleNeutronPortQosUpdate(Port port, Uuid qosUuidNew, Uuid qosUuidOld) {
LOG.debug("Handling Port QoS update: port: {} qosservice: {}", port.getUuid().getValue(), qosUuidNew.getValue());
QosPolicy qosPolicyNew = qosPolicyMap.get(qosUuidNew);
QosPolicy qosPolicyOld = qosPolicyMap.get(qosUuidOld);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
// handle Bandwidth Limit Rules update
if (qosPolicyNew != null && qosPolicyNew.getBandwidthLimitRules() != null && !qosPolicyNew.getBandwidthLimitRules().isEmpty()) {
setPortBandwidthLimits(port, qosPolicyNew.getBandwidthLimitRules().get(0), tx);
} else {
if (qosPolicyOld != null && qosPolicyOld.getBandwidthLimitRules() != null && !qosPolicyOld.getBandwidthLimitRules().isEmpty()) {
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
setPortBandwidthLimits(port, bwLimitBuilder.setMaxBurstKbps(Uint64.ZERO).setMaxKbps(Uint64.ZERO).build(), tx);
}
}
// handle DSCP Mark Rules update
if (qosPolicyNew != null && qosPolicyNew.getDscpmarkingRules() != null && !qosPolicyNew.getDscpmarkingRules().isEmpty()) {
setPortDscpMarking(port, qosPolicyNew.getDscpmarkingRules().get(0));
} else {
if (qosPolicyOld != null && qosPolicyOld.getDscpmarkingRules() != null && !qosPolicyOld.getDscpmarkingRules().isEmpty()) {
unsetPortDscpMark(port);
}
}
})));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.route.monitoring.message.Update in project netvirt by opendaylight.
the class QosTerminationPointListener method update.
@Override
public void update(InstanceIdentifier<OvsdbTerminationPointAugmentation> instanceIdentifier, OvsdbTerminationPointAugmentation original, OvsdbTerminationPointAugmentation update) {
String ifaceId = getIfaceId(update);
if (ifaceId != null) {
if (isBandwidthRuleCleared(original, update)) {
qosAlertManager.removeInterfaceIdFromQosAlertCache(ifaceId);
} else if (isBandwidthRuleApplied(original, update)) {
qosAlertManager.addInterfaceIdInQoSAlertCache(ifaceId);
}
}
if (!qosEosHandler.isQosClusterOwner()) {
return;
}
if (ifaceId != null && isBandwidthRuleCleared(original, update)) {
LOG.debug("update tp augment: iface-id: {}, name: {}, old bw rate, burst = {}, {}, " + "updated bw rate, burst = {}, {}", ifaceId, update.getName(), original.getIngressPolicingRate(), original.getIngressPolicingBurst(), update.getIngressPolicingRate(), update.getIngressPolicingBurst());
Port port = qosNeutronUtils.getNeutronPort(ifaceId);
if (port != null) {
setPortBandwidthRule(instanceIdentifier, update, port);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.route.monitoring.message.Update in project netvirt by opendaylight.
the class QosTerminationPointListener method setPortBandwidthRule.
private void setPortBandwidthRule(InstanceIdentifier<OvsdbTerminationPointAugmentation> identifier, OvsdbTerminationPointAugmentation update, Port port) {
QosPolicy qosPolicy = qosNeutronUtils.getQosPolicy(port);
if (qosPolicy == null || qosPolicy.getBandwidthLimitRules() == null || qosPolicy.getBandwidthLimitRules().isEmpty()) {
return;
}
LOG.debug("setting bandwidth rule for port: {}, {}, qos policy: {}", port.getUuid(), update.getName(), qosPolicy.getName());
jobCoordinator.enqueueJob("QosPort-" + port.getUuid(), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
BandwidthLimitRules bwRule = qosPolicy.getBandwidthLimitRules().get(0);
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
tpAugmentationBuilder.setName(update.getName());
tpAugmentationBuilder.setIngressPolicingRate(bwRule.getMaxKbps().longValue());
tpAugmentationBuilder.setIngressPolicingBurst(bwRule.getMaxBurstKbps().longValue());
tx.mergeParentStructureMerge(InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, identifier.firstKeyOf(Node.class)).child(TerminationPoint.class, identifier.firstKeyOf(TerminationPoint.class)).augmentation(OvsdbTerminationPointAugmentation.class), tpAugmentationBuilder.build());
})));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.route.monitoring.message.Update in project netvirt by opendaylight.
the class QosPolicyChangeListener method reapplyPolicy.
/* private void remove(InstanceIdentifier<BandwidthLimitRules> identifier, BandwidthLimitRules input) {
LOG.debug("Removing BandwidthLimitRules : key: {}, value={}",
identifier.firstKeyOf(QosPolicy.class).getUuid().getValue(), input);
Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
BandwidthLimitRules zeroBwLimitRule =
bwLimitBuilder.setMaxBurstKbps(Uint64.ZERO).setMaxKbps(Uint64.ZERO).build();
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosNeutronUtils.handleNeutronNetworkQosBwRuleRemove(network, zeroBwLimitRule);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(
txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
tx -> qosNeutronUtils.setPortBandwidthLimits(port, zeroBwLimitRule, tx))));
}
}*/
/* private void remove(InstanceIdentifier<DscpmarkingRules> identifier,DscpmarkingRules input) {
LOG.debug("Removing DscpMarkingRules : key: {}, value={}",
identifier.firstKeyOf(QosPolicy.class).getUuid().getValue(), input);
Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosNeutronUtils.handleNeutronNetworkQosDscpRuleRemove(network);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
qosNeutronUtils.unsetPortDscpMark(port);
return Collections.emptyList();
});
}
}*/
public void reapplyPolicy(String entityid) {
Uuid policyUuid = Uuid.getDefaultInstance(entityid);
if (qosNeutronUtils.getQosPolicyMap().get(policyUuid) == null) {
LOG.debug("Policy with Uuid: {} does not exist", entityid);
return;
}
@NonNull List<BandwidthLimitRules> nonnullBandwidthLimitRules = new ArrayList<BandwidthLimitRules>(qosNeutronUtils.getQosPolicyMap().get(policyUuid).nonnullBandwidthLimitRules().values());
if (!nonnullBandwidthLimitRules.isEmpty()) {
BandwidthLimitRules bandwidthLimitRules = nonnullBandwidthLimitRules.get(0);
update(policyUuid, bandwidthLimitRules);
}
@NonNull List<DscpmarkingRules> nonnullDscpmarkingRules = new ArrayList<DscpmarkingRules>(qosNeutronUtils.getQosPolicyMap().get(policyUuid).nonnullDscpmarkingRules().values());
if (!nonnullDscpmarkingRules.isEmpty()) {
DscpmarkingRules dscpmarkingRules = nonnullDscpmarkingRules.get(0);
update(policyUuid, dscpmarkingRules);
}
}
Aggregations