package org.opendaylight.netvirt.qosservice;
+import static org.opendaylight.controller.md.sal.binding.api.WriteTransaction.CREATE_MISSING_PARENTS;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import java.math.BigInteger;
import java.util.List;
import java.util.Map.Entry;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
import org.opendaylight.genius.interfacemanager.globals.IfmConstants;
.setQosAlertPollInterval(alertPollInterval)
.build();
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
- tx -> tx.put(LogicalDatastoreType.CONFIGURATION, path, qosAlertConfig,
- WriteTransaction.CREATE_MISSING_PARENTS)), LOG, "Error writing to the config data store");
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
+ tx -> tx.put(path, qosAlertConfig,
+ CREATE_MISSING_PARENTS)), LOG, "Error writing to the config data store");
}
private void pollDirectStatisticsForAllNodes() {
*/
package org.opendaylight.netvirt.qosservice;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+
import com.google.common.base.Optional;
import java.math.BigInteger;
import java.util.ArrayList;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.genius.infra.Datastore;
import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
import org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl;
+import org.opendaylight.genius.infra.TypedWriteTransaction;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.InstructionInfo;
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
// handle Bandwidth Limit Rules update
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null
&& !qosPolicy.getBandwidthLimitRules().isEmpty()) {
QosPolicy qosPolicyOld = qosPolicyMap.get(qosUuidOld);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
// handle Bandwidth Limit Rules update
if (qosPolicyNew != null && qosPolicyNew.getBandwidthLimitRules() != null
&& !qosPolicyNew.getBandwidthLimitRules().isEmpty()) {
QosPolicy qosPolicy = qosPolicyMap.get(qosUuid);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
// handle Bandwidth Limit Rules removal
if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null
&& !qosPolicy.getBandwidthLimitRules().isEmpty()) {
if (port != null && (port.augmentation(QosPortExtension.class) == null
|| port.augmentation(QosPortExtension.class).getQosPolicyId() == null)) {
jobCoordinator.enqueueJob("QosPort-" + portId.getValue(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
- if (qosPolicy.getBandwidthLimitRules() != null
- && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
- setPortBandwidthLimits(port, qosPolicy.getBandwidthLimitRules().get(0), tx);
- }
- if (qosPolicy.getDscpmarkingRules() != null
- && !qosPolicy.getDscpmarkingRules().isEmpty()) {
- setPortDscpMarking(port, qosPolicy.getDscpmarkingRules().get(0));
- }
- })));
+ () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ CONFIGURATION, tx -> {
+ if (qosPolicy.getBandwidthLimitRules() != null
+ && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
+ setPortBandwidthLimits(port, qosPolicy.getBandwidthLimitRules().get(0), tx);
+ }
+ if (qosPolicy.getDscpmarkingRules() != null
+ && !qosPolicy.getDscpmarkingRules().isEmpty()) {
+ setPortDscpMarking(port, qosPolicy.getDscpmarkingRules().get(0));
+ }
+ })));
}
}
}
if (port != null && (port.augmentation(QosPortExtension.class) == null
|| port.augmentation(QosPortExtension.class).getQosPolicyId() == null)) {
jobCoordinator.enqueueJob("QosPort-" + portId.getValue(),
- () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
- if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null
- && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
- BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
- setPortBandwidthLimits(port, bwLimitBuilder
- .setMaxBurstKbps(BigInteger.ZERO)
- .setMaxKbps(BigInteger.ZERO).build(), tx);
- }
- if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null
- && !qosPolicy.getDscpmarkingRules().isEmpty()) {
- unsetPortDscpMark(port);
- }
- })));
+ () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ CONFIGURATION, tx -> {
+ if (qosPolicy != null && qosPolicy.getBandwidthLimitRules() != null
+ && !qosPolicy.getBandwidthLimitRules().isEmpty()) {
+ BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
+ setPortBandwidthLimits(port, bwLimitBuilder
+ .setMaxBurstKbps(BigInteger.ZERO)
+ .setMaxKbps(BigInteger.ZERO).build(), tx);
+ }
+ if (qosPolicy != null && qosPolicy.getDscpmarkingRules() != null
+ && !qosPolicy.getDscpmarkingRules().isEmpty()) {
+ unsetPortDscpMark(port);
+ }
+ })));
}
}
}
if (port != null && (port.augmentation(QosPortExtension.class) == null
|| port.augmentation(QosPortExtension.class).getQosPolicyId() == null)) {
jobCoordinator.enqueueJob("QosPort-" + portId.getValue(), () -> Collections.singletonList(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
tx -> setPortBandwidthLimits(port, zeroBwLimitRule, tx))));
}
}
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
- public void setPortBandwidthLimits(Port port, BandwidthLimitRules bwLimit, WriteTransaction writeConfigTxn) {
+ public void setPortBandwidthLimits(Port port, BandwidthLimitRules bwLimit,
+ TypedWriteTransaction<Datastore.Configuration> writeConfigTxn) {
if (!qosEosHandler.isQosClusterOwner()) {
LOG.debug("Not Qos Cluster Owner. Ignoring setting bandwidth limits");
return;
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
try {
if (writeConfigTxn != null) {
- writeConfigTxn.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier
+ writeConfigTxn.merge(InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID))
.child(Node.class, bridgeNode.get().key())
*/
package org.opendaylight.netvirt.qosservice;
+import static org.opendaylight.genius.infra.Datastore.CONFIGURATION;
+import static org.opendaylight.genius.infra.Datastore.OPERATIONAL;
+
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
tx -> qosNeutronUtils.setPortBandwidthLimits(port, input, tx))));
}
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
tx -> qosNeutronUtils.setPortBandwidthLimits(port, zeroBwLimitRule, tx))));
}
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> Collections.singletonList(
- txRunner.callWithNewWriteOnlyTransactionAndSubmit(
+ txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION,
tx -> qosNeutronUtils.setPortBandwidthLimits(port, update, tx))));
}
}
qrtBuilder.setRuleTypes(value);
- ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
+ ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
InstanceIdentifier instanceIdentifier = InstanceIdentifier.create(Neutron.class).child(QosRuleTypes.class);
- tx.merge(LogicalDatastoreType.OPERATIONAL, instanceIdentifier, qrtBuilder.build());
+ tx.merge(instanceIdentifier, qrtBuilder.build());
}), LOG, "Error setting up supported QoS rule types");
}