protected void onUnsuccess(final DOMRpcResult result) { LOG.warn("{}: " + type + " invoked unsuccessfully: {}", id, result.getErrors()); }
static boolean isSuccess(final DOMRpcResult result) { return result.getErrors().isEmpty(); }
private void checkReadSuccess(final DOMRpcResult result, final YangInstanceIdentifier path) { try { Preconditions.checkArgument(AbstractWriteTx.isSuccess(result), "%s: Unable to read data: %s, errors: %s", id, path, result.getErrors()); } catch (final IllegalArgumentException e) { LOG.warn("{}: Unable to read data: {}, errors: {}", id, path, result.getErrors()); throw e; } }
@Override public void onSuccess(final DOMRpcResult result) { if(AbstractWriteTx.isSuccess(result)) { LOG.trace("{}: Reading data successful", id); } else { LOG.warn("{}: Reading data unsuccessful: {}", id, result.getErrors()); } }
@Override public Collection<? extends RpcError> getErrors() { return delegate().getErrors(); }
@Override public Collection<RpcError> getErrors() { return delegate().getErrors(); }
@Override public void onSuccess(final DOMRpcResult result) { if(result.getErrors().isEmpty()) { LOG.trace("{}: " + type + " invoked successfully", id); } else { onUnsuccess(result); } }
@Override public YangTextSchemaSource apply(final DOMRpcResult input) { if (input.getErrors().isEmpty()) { final Optional<String> schemaString = getSchemaFromRpc(id, input.getResult()); Preconditions.checkState(schemaString.isPresent(), "%s: Unexpected response to get-schema, schema not present in message for: %s", id, sourceIdentifier); logger.debug("{}: YANG Schema successfully retrieved for {}:{}", id, moduleName, revision); return new NetconfYangTextSchemaSource(id, sourceIdentifier, schemaString); } logger.warn("{}: YANG schema was not successfully retrieved for {}. Errors: {}", id, sourceIdentifier, input.getErrors()); throw new IllegalStateException(String.format( "%s: YANG schema was not successfully retrieved for %s. Errors: %s", id, sourceIdentifier, input.getErrors())); }
@Override protected void onUnsuccess(final DOMRpcResult result) { LOG.error("{}: Write failed, transaction {}, discarding changes, unlocking: {}", id, getIdentifier(), result.getErrors()); cleanup(); }
protected void invokeBlocking(final String msg, final Function<NetconfBaseOps, ListenableFuture<DOMRpcResult>> op) throws NetconfDocumentedException { try { final DOMRpcResult compositeNodeRpcResult = op.apply(netOps).get(); if(isSuccess(compositeNodeRpcResult) == false) { throw new NetconfDocumentedException(id + ": " + msg + " failed: " + compositeNodeRpcResult.getErrors(), NetconfDocumentedException.ErrorType.application, NetconfDocumentedException.ErrorTag.operation_failed, NetconfDocumentedException.ErrorSeverity.warning); } } catch (final InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (final ExecutionException e) { throw new NetconfDocumentedException(id + ": " + msg + " failed: " + e.getMessage(), e, NetconfDocumentedException.ErrorType.application, NetconfDocumentedException.ErrorTag.operation_failed, NetconfDocumentedException.ErrorSeverity.warning); } }
@Override protected DOMRpcResult transform(org.opendaylight.controller.md.sal.dom.api.DOMRpcResult fromResult) { return new DefaultDOMRpcResult(fromResult.getResult(), fromResult.getErrors()); } }
if (retValue.getErrors() == null || retValue.getErrors().isEmpty()) { return retValue; LOG.debug("RpcError message", retValue.getErrors()); throw new RestconfDocumentedException("RpcError message", null, retValue.getErrors()); } catch (final InterruptedException e) { final String errMsg = "The operation was interrupted while executing and did not complete.";
@Override public void onSuccess(final DOMRpcResult result) { if (result.getErrors() != null && (!result.getErrors().isEmpty())) { final String message = String.format("Execution of RPC %s failed", msg.getRpc()); Collection<RpcError> errors = result.getErrors(); if (errors == null || errors.size() == 0) { errors = Arrays.asList(RpcResultBuilder.newError(ErrorType.RPC, null, message)); } sender.tell(new akka.actor.Status.Failure(new RpcErrorsException(message, errors)), self); } else { final Node serializedResultNode; if (result.getResult() == null) { serializedResultNode = null; } else { serializedResultNode = NormalizedNodeSerializer.serialize(result.getResult()); } LOG.debug("Sending response for execute rpc : {}", msg.getRpc()); sender.tell(new RpcResponse(serializedResultNode), self); } }
@Override public RpcResult<TransactionStatus> apply(final DOMRpcResult input) { if (isSuccess(input)) { return RpcResultBuilder.success(TransactionStatus.COMMITED).build(); } else { final RpcResultBuilder<TransactionStatus> failed = RpcResultBuilder.failed(); for (final RpcError rpcError : input.getErrors()) { failed.withError(rpcError.getErrorType(), rpcError.getTag(), rpcError.getMessage(), rpcError.getApplicationTag(), rpcError.getInfo(), rpcError.getCause()); } return failed.build(); } } };