import org.opendaylight.controller.remote.rpc.messages.ExecuteAction;
import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
-import org.opendaylight.mdsal.dom.api.DOMActionResult;
import org.opendaylight.mdsal.dom.api.DOMActionService;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMRpcResult;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
/**
@Override
protected void handleReceive(final Object message) {
- if (message instanceof ExecuteRpc) {
+ if (message instanceof ExecuteRpc executeRpc) {
LOG.debug("Handling ExecuteOps Message");
- execute((ExecuteRpc) message);
- } else if (message instanceof ExecuteAction) {
- execute((ExecuteAction) message);
+ execute(executeRpc);
+ } else if (message instanceof ExecuteAction executeAction) {
+ execute(executeAction);
} else {
unknownMessage(message);
}
@Override
Object response(final QName type, final DOMRpcResult result) {
- final Collection<? extends RpcError> errors = result.getErrors();
- return errors.isEmpty() ? new RpcResponse(result.getResult())
+ final Collection<? extends RpcError> errors = result.errors();
+ return errors.isEmpty() ? new RpcResponse(result.value())
// This is legacy (wrong) behavior, which ignores the fact that errors may be just warnings,
// discarding any output
: new Failure(new RpcErrorsException(String.format("Execution of rpc %s failed", type),
final ActorRef sender = getSender();
- final ListenableFuture<? extends DOMActionResult> future;
+ final ListenableFuture<? extends DOMRpcResult> future;
try {
future = actionService.invokeAction(msg.getType(), msg.getPath(), msg.getInput());
} catch (final RuntimeException e) {
return;
}
- Futures.addCallback(future, new AbstractCallback<Absolute, DOMActionResult>(getSender(), msg.getType()) {
+ Futures.addCallback(future, new AbstractCallback<Absolute, DOMRpcResult>(getSender(), msg.getType()) {
@Override
Object nullResponse(final Absolute type) {
throw new IllegalStateException("Null invocation result of action " + type);
}
@Override
- Object response(final Absolute type, final DOMActionResult result) {
- final Collection<? extends RpcError> errors = result.getErrors();
- return errors.isEmpty() ? new ActionResponse(result.getOutput(), result.getErrors())
+ Object response(final Absolute type, final DOMRpcResult result) {
+ final var errors = result.errors();
+ return errors.isEmpty() ? new ActionResponse(result.value(), errors)
// This is legacy (wrong) behavior, which ignores the fact that errors may be just warnings,
// discarding any output
: new Failure(new RpcErrorsException(String.format("Execution of action %s failed", type),