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.md.sal.dom.api.DOMRpcResult;
13 import org.opendaylight.controller.sal.connect.netconf.sal.tx.WriteRunningTx;
14 import org.opendaylight.controller.sal.connect.util.RemoteDeviceId;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Simple Netconf rpc logging callback
21 public class NetconfRpcFutureCallback implements FutureCallback<DOMRpcResult> {
22 private static final Logger LOG = LoggerFactory.getLogger(WriteRunningTx.class);
24 private final String type;
25 private final RemoteDeviceId id;
27 public NetconfRpcFutureCallback(final String prefix, final RemoteDeviceId id) {
33 public void onSuccess(final DOMRpcResult result) {
34 if(result.getErrors().isEmpty()) {
35 LOG.trace("{}: " + type + " invoked successfully", id);
41 protected void onUnsuccess(final DOMRpcResult result) {
42 LOG.warn("{}: " + type + " invoked unsuccessfully: {}", id, result.getErrors());
46 public void onFailure(final Throwable t) {
47 LOG.warn("{}: " + type + " failed.", id, t);