X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Ftools%2Fnetconf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fcli%2FNetconfDeviceConnectionHandler.java;fp=opendaylight%2Fnetconf%2Ftools%2Fnetconf-cli%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fcli%2FNetconfDeviceConnectionHandler.java;h=0000000000000000000000000000000000000000;hp=aa9f4e8811ce7cd7d6aa889efef2a0e3947159e3;hb=9ba2b4eca79bcc0e78099b133296801c8d45a6c4;hpb=b2e81149739c87f0ecc2ce7f06448d7a5d3162b8 diff --git a/opendaylight/netconf/tools/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java b/opendaylight/netconf/tools/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java deleted file mode 100644 index aa9f4e8811..0000000000 --- a/opendaylight/netconf/tools/netconf-cli/src/main/java/org/opendaylight/controller/netconf/cli/NetconfDeviceConnectionHandler.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.netconf.cli; - -import com.google.common.base.Optional; -import jline.console.completer.Completer; -import jline.console.completer.NullCompleter; -import org.opendaylight.controller.md.sal.dom.api.DOMNotification; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; -import org.opendaylight.controller.netconf.cli.commands.CommandDispatcher; -import org.opendaylight.controller.netconf.cli.io.ConsoleContext; -import org.opendaylight.controller.netconf.cli.io.ConsoleIO; -import org.opendaylight.controller.sal.connect.api.RemoteDeviceHandler; -import org.opendaylight.controller.sal.connect.netconf.listener.NetconfSessionPreferences; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; - -/** - * Implementation of RemoteDeviceHandler. Integrates cli with - * sal-netconf-connector. - */ -public class NetconfDeviceConnectionHandler implements RemoteDeviceHandler { - - private final CommandDispatcher commandDispatcher; - private final SchemaContextRegistry schemaContextRegistry; - private final ConsoleIO console; - private final String deviceId; - - private boolean up = false; - - public NetconfDeviceConnectionHandler(final CommandDispatcher commandDispatcher, - final SchemaContextRegistry schemaContextRegistry, final ConsoleIO console, final String deviceId) { - this.commandDispatcher = commandDispatcher; - this.schemaContextRegistry = schemaContextRegistry; - this.console = console; - this.deviceId = deviceId; - } - - @Override - public synchronized void onDeviceConnected(final SchemaContext context, - final NetconfSessionPreferences preferences, final DOMRpcService rpcService) { - console.enterRootContext(new ConsoleContext() { - - @Override - public Optional getPrompt() { - return Optional.of(deviceId); - } - - @Override - public Completer getCompleter() { - return new NullCompleter(); - } - }); - - // TODO Load schemas for base netconf + inet types from remote device if - // possible - // TODO detect netconf base version - // TODO detect inet types version - commandDispatcher.addRemoteCommands(rpcService, context); - schemaContextRegistry.setRemoteSchemaContext(context); - up = true; - this.notify(); - } - - /** - * @return true if connection was fully established - */ - public synchronized boolean isUp() { - return up; - } - - @Override - public synchronized void onDeviceDisconnected() { - console.leaveRootContext(); - commandDispatcher.removeRemoteCommands(); - schemaContextRegistry.setRemoteSchemaContext(null); - up = false; - } - - @Override - public void onDeviceFailed(Throwable throwable) { - // FIXME - } - - @Override - public void onNotification(DOMNotification domNotification) { - - } - - @Override - public void close() { - // FIXME - } -}