Adding Tri-states to the connection manager locality check.
[controller.git] / opendaylight / connectionmanager / api / src / main / java / org / opendaylight / controller / connectionmanager / IConnectionManager.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.connectionmanager;
11
12 import java.net.InetAddress;
13 import java.util.Map;
14 import java.util.Set;
15
16 import org.opendaylight.controller.sal.connection.ConnectionConstants;
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.
22  * The APIs are currently focused towards Active-Active Clustering support
23  * wherein the node can connect to any of the Active Controller in the Cluster.
24  * This component can also host the necessary logic for south-bound connectivity
25  * when partial cluster is identified during Partition scenarios.
26  *
27  * This (and its corresponding implementation) component can also be enhanced further
28  * 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 being used.
34      *
35      * @return ConnectionMgmtScheme Enum that represents the active scheme.
36      */
37     public ConnectionMgmtScheme getActiveScheme();
38
39     /**
40      * Method that will retrieve and return a Set of Nodes that is currently connected to the given controller.
41      *
42      * @param controller InetAddress of the Controller that is currently connected to a set of Nodes.
43      *
44      * @return Set<Node> Set of Nodes connected to a controller.
45      */
46     public Set<Node> getNodes(InetAddress controller);
47
48     /**
49      * Method that will retrieve and return a Set of Nodes that is currently connected to
50      * the controller on which this method is executed.
51      *
52      * @return Set<Node> Set of Nodes connected to this controller.
53      */
54     public Set<Node> getLocalNodes();
55
56     /**
57      * @deprecated Use getLocalityStatus(Node node) instead.
58      *
59      * Method to test if a node is local to a controller.
60      *
61      * @param node The node for which the locality is being tested
62      * @return true if node is local to this controller.<br>
63      *         false if either node is not connected to this controller or
64      *         not connected to any other controllers in the cluster.
65      */
66     public boolean isLocal(Node node);
67
68     /**
69      * getLocalityStatus provides the tri-state connectivity status as opposed to the
70      * binary status returned by isLocal.
71      * ConnectionLocality enum that is returned by this method also includes the case of
72      * a Node not connected to any of the controllers in the cluster.
73      * @param node The node for which the locality is being verified
74      * @return ConnectionLocality
75      */
76     public ConnectionLocality getLocalityStatus(Node node);
77
78     /**
79      * Disconnect a Node from the controller.
80      *
81      * @return Status of the disconnect Operation.
82      */
83     public Status disconnect(Node node);
84
85     /**
86      * Connect to a node
87      *
88      * @param connectionIdentifier identifier with which the application would refer to a given connection.
89      * @param params Connection Params in Map format. This is entirely handled by the south-bound
90      * plugins and is an opaque value for SAL or Connection Manager. Typical values keyed inside
91      * this params are Management IP-Address, Username, Password, Security Keys, etc...
92      *
93      *  @return Node Node connected to.
94      */
95     public Node connect (String connectionIdentifier, Map<ConnectionConstants, String> params);
96
97     /**
98      * Connect to a node
99      *
100      * @param type Type of the node representing NodeIDType.
101      * @param connectionIdentifier identifier with which the application would refer to a given connection.
102      * @param params Connection Params in Map format. This is entirely handled by the south-bound
103      * plugins and is an opaque value for SAL or Connection Manager. Typical values keyed inside
104      * this params are Management IP-Address, Username, Password, Security Keys, etc...
105      *
106      *  @return Status of the Connect Operation.
107      */
108     public Node connect(String type, String connectionIdentifier, Map<ConnectionConstants, String> params);
109 }