Barrier turn on/off-add switcher value to Config-Subsystem
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / core / connection / ConnectionConfigurationImpl.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. 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.openflowjava.protocol.impl.core.connection;
10
11 import java.net.InetAddress;
12 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
13 import org.opendaylight.openflowjava.protocol.api.connection.ThreadConfiguration;
14 import org.opendaylight.openflowjava.protocol.api.connection.TlsConfiguration;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;
16
17 /**
18  * @author michal.polkorab
19  *
20  */
21 public class ConnectionConfigurationImpl implements ConnectionConfiguration {
22
23     private final InetAddress address;
24     private final int port;
25     private Object transferProtocol;
26     private final TlsConfiguration tlsConfig;
27     private final long switchIdleTimeout;
28     private ThreadConfiguration threadConfig;
29     private final boolean useBarrier;
30
31     /**
32      * Creates {@link ConnectionConfigurationImpl}
33      *
34      * @param address
35      * @param port
36      * @param tlsConfig
37      * @param switchIdleTimeout
38      * @param useBarrier
39      */
40     public ConnectionConfigurationImpl(final InetAddress address, final int port, final TlsConfiguration tlsConfig,
41             final long switchIdleTimeout, final boolean useBarrier) {
42         this.address = address;
43         this.port = port;
44         this.tlsConfig = tlsConfig;
45         this.switchIdleTimeout = switchIdleTimeout;
46         this.useBarrier = useBarrier;
47     }
48
49     @Override
50     public InetAddress getAddress() {
51         return address;
52     }
53
54     @Override
55     public int getPort() {
56         return port;
57     }
58
59     @Override
60     public Object getTransferProtocol() {
61         return transferProtocol;
62     }
63
64     /**
65      * Used for testing - sets transport protocol
66      * @param protocol
67      */
68     public void setTransferProtocol(final TransportProtocol protocol) {
69         this.transferProtocol = protocol;
70     }
71
72     @Override
73     public long getSwitchIdleTimeout() {
74         return switchIdleTimeout;
75     }
76
77     @Override
78     public Object getSslContext() {
79         // TODO Auto-generated method stub
80         return null;
81     }
82
83     @Override
84     public TlsConfiguration getTlsConfiguration() {
85         return tlsConfig;
86     }
87
88     @Override
89     public ThreadConfiguration getThreadConfiguration() {
90         return threadConfig;
91     }
92
93     /**
94      * @param threadConfig thread model configuration (configures threads used)
95      */
96     public void setThreadConfiguration(final ThreadConfiguration threadConfig) {
97         this.threadConfig = threadConfig;
98     }
99
100     @Override
101     public boolean useBarrier() {
102         return useBarrier;
103     }
104 }