X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FSSHNetconfClientLiveTest.java;fp=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FSSHNetconfClientLiveTest.java;h=7f1d289c5be88fbec6c30b444fd282617efec158;hp=0000000000000000000000000000000000000000;hb=07389b7beb8d85acd7739ccb1b27c5a1cf1a0ce7;hpb=d5249b67ad169d56e78c03df88cce9f1da5ef353 diff --git a/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java new file mode 100644 index 0000000000..7f1d289c5b --- /dev/null +++ b/opendaylight/netconf/netconf-client/src/test/java/org/opendaylight/controller/netconf/client/SSHNetconfClientLiveTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2013 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.client; + +import io.netty.channel.nio.NioEventLoopGroup; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.opendaylight.controller.netconf.api.NetconfMessage; +import org.opendaylight.controller.netconf.util.NetconfUtil; +import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword; + +import java.net.InetSocketAddress; + +@Ignore +public class SSHNetconfClientLiveTest { + + NioEventLoopGroup nettyThreadgroup; + NetconfSshClientDispatcher netconfClientDispatcher; + + @Before + public void setUp() { + nettyThreadgroup = new NioEventLoopGroup(); + netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword( + System.getProperty("username"), System.getProperty("password")), + nettyThreadgroup, nettyThreadgroup); + } + + @Test + public void test() throws Exception { + InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830); + int connectionAttempts = 10, attemptMsTimeout = 1000; + + NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts, + attemptMsTimeout, netconfClientDispatcher); + + netconfClient.getCapabilities(); + + NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml")); + NetconfMessage response = netconfClient.sendMessage(netconfMessage); + NetconfUtil.checkIsMessageOk(response); + } +}