+ Preconditions.checkArgument(store == LogicalDatastoreType.CONFIGURATION,
+ "Can edit only configuration data, not %s", store);
+ }
+
+ protected abstract void editConfig(YangInstanceIdentifier path, Optional<NormalizedNode<?, ?>> data,
+ DataContainerChild<?, ?> editStructure,
+ Optional<ModifyAction> defaultOperation, String operation);
+
+ protected ListenableFuture<RpcResult<Void>> resultsToTxStatus() {
+ final SettableFuture<RpcResult<Void>> transformed = SettableFuture.create();
+
+ Futures.addCallback(Futures.allAsList(resultsFutures), new FutureCallback<List<DOMRpcResult>>() {
+ @Override
+ public void onSuccess(@Nonnull final List<DOMRpcResult> domRpcResults) {
+ domRpcResults.forEach(domRpcResult -> {
+ if (!domRpcResult.getErrors().isEmpty() && !transformed.isDone()) {
+ final NetconfDocumentedException exception =
+ new NetconfDocumentedException(id + ":RPC during tx failed",
+ DocumentedException.ErrorType.APPLICATION,
+ DocumentedException.ErrorTag.OPERATION_FAILED,
+ DocumentedException.ErrorSeverity.ERROR);
+ transformed.setException(exception);
+ }
+ });
+
+ if (!transformed.isDone()) {
+ transformed.set(RpcResultBuilder.<Void>success().build());
+ }
+ }
+
+ @Override
+ public void onFailure(final Throwable throwable) {
+ final NetconfDocumentedException exception =
+ new NetconfDocumentedException(
+ id + ":RPC during tx returned an exception",
+ new Exception(throwable),
+ DocumentedException.ErrorType.APPLICATION,
+ DocumentedException.ErrorTag.OPERATION_FAILED,
+ DocumentedException.ErrorSeverity.ERROR);
+ transformed.setException(exception);
+ }
+ }, MoreExecutors.directExecutor());
+
+ return transformed;