Merge "Netconf-cli compilable and included in project"
[controller.git] / opendaylight / netconf / netconf-ssh / src / main / java / org / opendaylight / controller / netconf / ssh / SshProxyServerConfiguration.java
1 /*
2  * Copyright (c) 2014 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.ssh;
10
11 import com.google.common.base.Preconditions;
12 import io.netty.channel.local.LocalAddress;
13 import java.net.InetSocketAddress;
14 import org.apache.sshd.common.KeyPairProvider;
15 import org.apache.sshd.server.PasswordAuthenticator;
16
17 public final class SshProxyServerConfiguration {
18     private final InetSocketAddress bindingAddress;
19     private final LocalAddress localAddress;
20     private final PasswordAuthenticator authenticator;
21     private final KeyPairProvider keyPairProvider;
22     private final int idleTimeout;
23
24     SshProxyServerConfiguration(final InetSocketAddress bindingAddress, final LocalAddress localAddress, final PasswordAuthenticator authenticator, final KeyPairProvider keyPairProvider, final int idleTimeout) {
25         this.bindingAddress = Preconditions.checkNotNull(bindingAddress);
26         this.localAddress = Preconditions.checkNotNull(localAddress);
27         this.authenticator = Preconditions.checkNotNull(authenticator);
28         this.keyPairProvider = Preconditions.checkNotNull(keyPairProvider);
29         // Idle timeout cannot be disabled in the sshd by using =< 0 value
30         Preconditions.checkArgument(idleTimeout > 0, "Idle timeout has to be > 0");
31         this.idleTimeout = idleTimeout;
32     }
33
34     public InetSocketAddress getBindingAddress() {
35         return bindingAddress;
36     }
37
38     public LocalAddress getLocalAddress() {
39         return localAddress;
40     }
41
42     public PasswordAuthenticator getAuthenticator() {
43         return authenticator;
44     }
45
46     public KeyPairProvider getKeyPairProvider() {
47         return keyPairProvider;
48     }
49
50     public int getIdleTimeout() {
51         return idleTimeout;
52     }
53
54
55 }