2 * Copyright (c) 2019 Nordix Foundation. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.remote.rpc;
10 import akka.actor.ActorRef;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.controller.remote.rpc.messages.ExecuteAction;
13 import org.opendaylight.mdsal.dom.api.DOMActionImplementation;
14 import org.opendaylight.mdsal.dom.api.DOMActionResult;
15 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * A {@link DOMActionImplementation} which routes invocation requests to a remote invoker actor.
24 final class RemoteActionImplementation extends AbstractRemoteImplementation<ExecuteAction>
25 implements DOMActionImplementation {
26 private static final Logger LOG = LoggerFactory.getLogger(RemoteActionImplementation.class);
28 RemoteActionImplementation(final ActorRef remoteInvoker, final RemoteOpsProviderConfig config) {
29 super(remoteInvoker, config);
33 * Routes action request to a remote invoker, which will execute the action and return with result.
36 public ListenableFuture<DOMActionResult> invokeAction(final SchemaPath type, final DOMDataTreeIdentifier path,
37 final ContainerNode input) {
38 LOG.debug("invoking action {} with path {}", type, path);
39 return new RemoteDOMActionFuture(type, ask(ExecuteAction.from(type, path, input)));
43 public long invocationCost() {