2 * Copyright (c) 2014 Cisco Systems, Inc. and others. 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.
9 package org.opendaylight.controller.sal.connect.netconf.util;
11 import com.google.common.util.concurrent.FutureCallback;
12 import org.opendaylight.controller.sal.connect.netconf.sal.tx.WriteRunningTx;
13 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
14 import org.opendaylight.yangtools.yang.common.RpcResult;
15 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * Simple Netconf rpc logging callback
22 public class NetconfRpcFutureCallback implements FutureCallback<RpcResult<CompositeNode>> {
23 private static final Logger LOG = LoggerFactory.getLogger(WriteRunningTx.class);
25 private final String type;
26 private final RemoteDeviceId id;
28 public NetconfRpcFutureCallback(final String prefix, final RemoteDeviceId id) {
34 public void onSuccess(final RpcResult<CompositeNode> result) {
35 if(result.isSuccessful()) {
36 LOG.trace("{}: " + type + " invoked successfully", id);
42 protected void onUnsuccess(final RpcResult<CompositeNode> result) {
43 LOG.warn("{}: " + type + " invoked unsuccessfully: {}", id, result.getErrors());
47 public void onFailure(final Throwable t) {
48 LOG.warn("{}: " + type + " failed.", id, t);