Merge "Maven archetype for config subsystem aware bundles"
[controller.git] / opendaylight / netconf / netconf-client / src / test / java / org / opendaylight / controller / netconf / client / SSHNetconfClientLiveTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.client;
10
11 import io.netty.channel.nio.NioEventLoopGroup;
12 import org.junit.Before;
13 import org.junit.Ignore;
14 import org.junit.Test;
15 import org.opendaylight.controller.netconf.api.NetconfMessage;
16 import org.opendaylight.controller.netconf.util.NetconfUtil;
17 import org.opendaylight.controller.netconf.util.handler.ssh.authentication.LoginPassword;
18
19 import java.net.InetSocketAddress;
20
21 @Ignore
22 public class SSHNetconfClientLiveTest {
23
24     NioEventLoopGroup nettyThreadgroup;
25     NetconfSshClientDispatcher netconfClientDispatcher;
26
27     @Before
28     public void setUp() {
29         nettyThreadgroup = new NioEventLoopGroup();
30         netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword(
31                 System.getProperty("username"), System.getProperty("password")),
32                 nettyThreadgroup, nettyThreadgroup, 5000);
33     }
34
35     @Test
36     public void test() throws Exception {
37         InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830);
38         int connectionAttempts = 10, attemptMsTimeout = 1000;
39
40         NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts,
41             attemptMsTimeout, netconfClientDispatcher);
42
43         netconfClient.getCapabilities();
44
45         NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml"));
46         NetconfMessage response = netconfClient.sendMessage(netconfMessage);
47         NetconfUtil.checkIsMessageOk(response);
48     }
49 }