Merge "BUG-2329 Add test for anyxmls inside rpc resonse for netcfon-connector"
[controller.git] / opendaylight / connectionmanager / api / src / main / java / org / opendaylight / controller / connectionmanager / IConnectionManager.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.connectionmanager;
10
11 import java.net.InetAddress;
12 import java.util.Map;
13 import java.util.Set;
14
15 import org.opendaylight.controller.sal.connection.ConnectionConstants;
16 import org.opendaylight.controller.sal.connection.ConnectionLocality;
17 import org.opendaylight.controller.sal.core.Node;
18 import org.opendaylight.controller.sal.utils.Status;
19
20 /**
21  * Connection Manager provides south-bound connectivity services. The APIs are
22  * currently focused towards Active-Active Clustering support wherein the node
23  * can connect to any of the Active Controller in the Cluster. This component
24  * can also host the necessary logic for south-bound connectivity when partial
25  * cluster is identified during Partition scenarios.
26  *
27  * This (and its corresponding implementation) component can also be enhanced
28  * further for more fancy algorithms/criteria for connection acceptance.
29  */
30
31 public interface IConnectionManager {
32     /**
33      * This method returns Connectivity Algorithm (Scheme) that is currently
34      * being used.
35      *
36      * @return ConnectionMgmtScheme Enum that represents the active scheme.
37      */
38     public ConnectionMgmtScheme getActiveScheme();
39
40     /**
41      * Method that will retrieve and return a Set of Nodes that is currently
42      * connected to the given controller.
43      *
44      * @param controller
45      *            InetAddress of the Controller that is currently connected to a
46      *            set of Nodes.
47      *
48      * @return Set<Node> Set of Nodes connected to a controller.
49      */
50     public Set<Node> getNodes(InetAddress controller);
51
52     /**
53      * Method that will retrieve and return a Set of Nodes that is currently
54      * connected to the controller on which this method is executed.
55      *
56      * @return Set<Node> Set of Nodes connected to this controller.
57      */
58     public Set<Node> getLocalNodes();
59
60     /**
61      * @deprecated Use getLocalityStatus(Node node) instead.
62      *
63      *             Method to test if a node is local to a controller.
64      *
65      * @param node
66      *            The node for which the locality is being tested
67      * @return true if node is local to this controller.<br>
68      *         false if either node is not connected to this controller or not
69      *         connected to any other controllers in the cluster.
70      */
71     public boolean isLocal(Node node);
72
73     /**
74      * getLocalityStatus provides the tri-state connectivity status as opposed
75      * to the binary status returned by isLocal. ConnectionLocality enum that is
76      * returned by this method also includes the case of a Node not connected to
77      * any of the controllers in the cluster.
78      *
79      * @param node
80      *            The node for which the locality is being verified
81      * @return ConnectionLocality
82      */
83     public ConnectionLocality getLocalityStatus(Node node);
84
85     /**
86      * Disconnect a Node from the controller.
87      *
88      * @return Status of the disconnect Operation.
89      */
90     public Status disconnect(Node node);
91
92     /**
93      * Connect to a node
94      *
95      * @param connectionIdentifier
96      *            identifier with which the application would refer to a given
97      *            connection.
98      * @param params
99      *            Connection Params in Map format. This is entirely handled by
100      *            the south-bound plugins and is an opaque value for SAL or
101      *            Connection Manager. Typical values keyed inside this params
102      *            are Management IP-Address, Username, Password, Security Keys,
103      *            etc...
104      *
105      * @return Node Node connected to.
106      */
107     public Node connect(String connectionIdentifier,
108             Map<ConnectionConstants, String> params);
109
110     /**
111      * Connect to a node
112      *
113      * @param type
114      *            Type of the node representing NodeIDType.
115      * @param connectionIdentifier
116      *            identifier with which the application would refer to a given
117      *            connection.
118      * @param params
119      *            Connection Params in Map format. This is entirely handled by
120      *            the south-bound plugins and is an opaque value for SAL or
121      *            Connection Manager. Typical values keyed inside this params
122      *            are Management IP-Address, Username, Password, Security Keys,
123      *            etc...
124      *
125      * @return Status of the Connect Operation.
126      */
127     public Node connect(String type, String connectionIdentifier,
128             Map<ConnectionConstants, String> params);
129
130     /**
131      * Retrieve list of cluster-members to which Node is connected to
132      *
133      * @param node
134      *            Node for which cluster-members to be retrieved
135      *
136      * @return Set<InetAddress> List of cluster-member addresses to which the
137      *         node is connected
138      */
139     public Set<InetAddress> getControllers(Node node);
140 }