Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
Operating System: Linux
Platform: PC
-
1280
Description
I'm trying to write to the operational store from an RPC method. The problem is that even though there's only one write happening anywhere and no deletes, nonetheless I always get back:
org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException: errors: [error-type: application, error-tag: operation-failed, error-message: The operation encountered an unexpected error while executing.error-info: org.opendaylight.yangtools.yang.data.api.schema.tree.ConflictingModificationAppliedException: Node was deleted by other transaction.
A slightly simplified version of the code is below. This was working with the old API.
Function<RpcResult<TransactionStatus>, RpcResult<Void>> futureTrans =
new Function<RpcResult<TransactionStatus>,RpcResult<Void>>() {
@Override
public RpcResult<Void> apply(RpcResult<TransactionStatus> input)
};
public Future<RpcResult<Void>>
registerEndpoint(RegisterEndpointInput input) {
WriteTransaction t = dataProvider.newWriteOnlyTransaction();
Endpoint ep = buildEndpoint(input)
.setTimestamp(timestamp)
.build();
EndpointKey key =
new EndpointKey(ep.getL2Context(), ep.getMacAddress());
InstanceIdentifier<Endpoint> iid =
InstanceIdentifier.builder(Endpoints.class)
.child(Endpoint.class, key)
.build();
t.put(LogicalDatastoreType.OPERATIONAL, iid, ep);
ListenableFuture<RpcResult<TransactionStatus>> r = t.commit();
return Futures.transform(r, futureTrans, executor);
}