use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project bgpcep by opendaylight.
the class BmpMonitoringStationImpl method createEmptyMonitor.
private synchronized void createEmptyMonitor() {
final DOMDataWriteTransaction wTx = this.domDataBroker.newWriteOnlyTransaction();
wTx.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().node(BmpMonitor.QNAME).node(Monitor.QNAME).nodeWithKey(Monitor.QNAME, MONITOR_ID_QNAME, this.monitorId.getValue()).build(), ImmutableNodes.mapEntryBuilder(Monitor.QNAME, MONITOR_ID_QNAME, this.monitorId.getValue()).addChild(ImmutableNodes.leafNode(MONITOR_ID_QNAME, this.monitorId.getValue())).addChild(ImmutableNodes.mapNodeBuilder(Router.QNAME).build()).build());
try {
wTx.submit().checkedGet();
} catch (final TransactionCommitFailedException e) {
LOG.error("Failed to initiate BMP Monitor {}.", this.monitorId.getValue(), e);
}
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowPluginBulkGroupTransactionProvider method deleteGroup.
private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(group.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(group1.getGroupId()));
modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowpluginMeterTestCommandProvider method _removeMeter.
public void _removeMeter(final CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
ci.println("test node added");
createTestNode();
} else {
ci.println("User node added" + nref);
createUserNode(nref);
}
createTestMeter();
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(testMeter.getMeterId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class OpenflowpluginMeterTestCommandProvider method writeMeter.
private void writeMeter(final CommandInterpreter ci, Meter meter, Meter meter1) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Meter> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter.getMeterId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, meter, true);
InstanceIdentifier<Meter> path2 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Meter.class, new MeterKey(meter1.getMeterId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path2, meter1, true);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void notUsed) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException in project openflowplugin by opendaylight.
the class FlowNodeReconciliationImpl method deleteDSStaleMeters.
private void deleteDSStaleMeters(List<InstanceIdentifier<StaleMeter>> metersForBulkDelete) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (InstanceIdentifier<StaleMeter> staleMeterIId : metersForBulkDelete) {
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, staleMeterIId);
}
CheckedFuture<Void, TransactionCommitFailedException> submitFuture = writeTransaction.submit();
handleStaleEntityDeletionResultFuture(submitFuture);
}
Aggregations