2 * Copyright (c) 2013 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.netconf.client;
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;
19 import java.net.InetSocketAddress;
22 public class SSHNetconfClientLiveTest {
24 NioEventLoopGroup nettyThreadgroup;
25 NetconfSshClientDispatcher netconfClientDispatcher;
29 nettyThreadgroup = new NioEventLoopGroup();
30 netconfClientDispatcher = new NetconfSshClientDispatcher(new LoginPassword(
31 System.getProperty("username"), System.getProperty("password")),
32 nettyThreadgroup, nettyThreadgroup);
36 public void test() throws Exception {
37 InetSocketAddress address = new InetSocketAddress(System.getProperty("host"), 830);
38 int connectionAttempts = 10, attemptMsTimeout = 1000;
40 NetconfClient netconfClient = new NetconfClient("client", address, connectionAttempts,
41 attemptMsTimeout, netconfClientDispatcher);
43 netconfClient.getCapabilities();
45 NetconfMessage netconfMessage = NetconfUtil.createMessage(getClass().getResourceAsStream("/get_schema.xml"));
46 NetconfMessage response = netconfClient.sendMessage(netconfMessage);
47 NetconfUtil.checkIsMessageOk(response);