use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class QosPolicyChangeListener method add.
protected void add(InstanceIdentifier<BandwidthLimitRules> identifier, BandwidthLimitRules input) {
LOG.trace("Adding BandwidthlimitRules : key: {}, value={}", identifier, input);
Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosNeutronUtils.handleNeutronNetworkQosUpdate(network, qosUuid);
qosAlertManager.addToQosAlertCache(network);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
qosAlertManager.addToQosAlertCache(port);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
qosNeutronUtils.setPortBandwidthLimits(port, input, wrtConfigTxn);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class QosPolicyChangeListener method update.
private void update(Uuid qosUuid, DscpmarkingRules update) {
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosNeutronUtils.handleNeutronNetworkQosUpdate(network, qosUuid);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
qosNeutronUtils.setPortDscpMarking(port, update);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class QosPolicyChangeListener method remove.
private void remove(InstanceIdentifier<DscpmarkingRules> identifier, DscpmarkingRules input) {
LOG.trace("Removing DscpMarkingRules : key: {}, value={}", identifier, 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(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
qosNeutronUtils.unsetPortDscpMark(port);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class QosPolicyChangeListener method remove.
private void remove(InstanceIdentifier<BandwidthLimitRules> identifier, BandwidthLimitRules input) {
LOG.trace("Removing BandwidthLimitRules : key: {}, value={}", identifier, input);
Uuid qosUuid = identifier.firstKeyOf(QosPolicy.class).getUuid();
BandwidthLimitRulesBuilder bwLimitBuilder = new BandwidthLimitRulesBuilder();
BandwidthLimitRules zeroBwLimitRule = bwLimitBuilder.setMaxBurstKbps(BigInteger.ZERO).setMaxKbps(BigInteger.ZERO).build();
for (Network network : qosNeutronUtils.getQosNetworks(qosUuid)) {
qosAlertManager.removeFromQosAlertCache(network);
qosNeutronUtils.handleNeutronNetworkQosBwRuleRemove(network, zeroBwLimitRule);
}
for (Port port : qosNeutronUtils.getQosPorts(qosUuid)) {
qosAlertManager.removeFromQosAlertCache(port);
jobCoordinator.enqueueJob("QosPort-" + port.getUuid().getValue(), () -> {
WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
List<ListenableFuture<Void>> futures = new ArrayList<>();
qosNeutronUtils.setPortBandwidthLimits(port, zeroBwLimitRule, wrtConfigTxn);
futures.add(wrtConfigTxn.submit());
return futures;
});
}
}
use of org.opendaylight.controller.md.sal.binding.api.WriteTransaction in project netvirt by opendaylight.
the class PolicyRouteFlowProgrammer method programPolicyClassifierFlows.
public void programPolicyClassifierFlows(String policyClassifierName, List<BigInteger> localDpIds, List<BigInteger> remoteDpIds, int addOrRemove) {
long policyClassifierId = policyIdManager.getPolicyClassifierId(policyClassifierName);
if (policyClassifierId == PolicyServiceConstants.INVALID_ID) {
LOG.error("Failed to get policy classifier id for classifier {}", policyClassifierName);
return;
}
coordinator.enqueueJob(policyClassifierName, () -> {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
remoteDpIds.forEach(remoteDpId -> {
long groupId = policyIdManager.getPolicyClassifierGroupId(policyClassifierName, remoteDpId);
if (groupId != PolicyServiceConstants.INVALID_ID) {
List<InstructionInfo> instructions = policyFlowUtil.getPolicyRouteInstructions(groupId);
localDpIds.forEach(localDpId -> {
if (!remoteDpId.equals(localDpId)) {
programPolicyClassifierFlow(policyClassifierName, policyClassifierId, instructions, localDpId, remoteDpId, tx, addOrRemove);
}
});
} else {
LOG.error("Failed to get group id for policy classifier {} DPN {}", policyClassifierName, remoteDpId);
}
});
return Collections.singletonList(tx.submit());
});
}
Aggregations