12341d757332659ee99e7c61af6bae691462c965
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / ConnectionConfigurationFactory.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.openflowplugin.openflow.md.core;
10
11 import java.net.InetAddress;
12
13 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionConfiguration;
14
15 /**
16  * @author mirehak
17  */
18 public abstract class ConnectionConfigurationFactory {
19
20     /** OF default listening port */
21     private static final int DEFAULT_OF_PORT = 6653;
22     /** OF legacy default listening port */
23     private static final int LEGACY_OF_PORT = 6633;
24
25     /**
26      * @return default connection configuration
27      */
28     public static ConnectionConfiguration getDefault() {
29         return new ConnectionConfiguration() {
30
31             @Override
32             public InetAddress getAddress() {
33                 // all interfaces
34                 return null;
35             }
36
37             @Override
38             public int getPort() {
39                 return DEFAULT_OF_PORT;
40             }
41
42             @Override
43             public FEATURE_SUPPORT getTlsSupport() {
44                 return FEATURE_SUPPORT.NOT_SUPPORTED;
45             }
46
47             @Override
48             public Object getTransferProtocol() {
49                 // TODO:: TCP/UDP ...
50                 return null;
51             }
52
53             @Override
54             public long getSwitchIdleTimeout() {
55                 return 15000;
56             }
57
58             @Override
59             public Object getSslContext() {
60                 return null;
61             }
62         };
63     }
64     
65     /**
66      * @return default connection configuration
67      */
68     public static ConnectionConfiguration getLegacy() {
69         return new ConnectionConfiguration() {
70
71             @Override
72             public InetAddress getAddress() {
73                 // all interfaces
74                 return null;
75             }
76
77             @Override
78             public int getPort() {
79                 return LEGACY_OF_PORT;
80             }
81
82             @Override
83             public FEATURE_SUPPORT getTlsSupport() {
84                 return FEATURE_SUPPORT.NOT_SUPPORTED;
85             }
86
87             @Override
88             public Object getTransferProtocol() {
89                 // TODO:: TCP/UDP ...
90                 return null;
91             }
92
93             @Override
94             public long getSwitchIdleTimeout() {
95                 return 15000;
96             }
97
98             @Override
99             public Object getSslContext() {
100                 return null;
101             }
102         };
103     }
104
105 }