Merge "In case of an error event, cleanup the config too"
[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.connection.ConnectionLocality;
18 import org.opendaylight.controller.sal.core.Node;
19 import org.opendaylight.controller.sal.utils.Status;
20
21 /**
22  * Connection Manager provides south-bound connectivity services.
23  * The APIs are currently focused towards Active-Active Clustering support
24  * wherein the node can connect to any of the Active Controller in the Cluster.
25  * This component can also host the necessary logic for south-bound connectivity
26  * when partial cluster is identified during Partition scenarios.
27  *
28  * This (and its corresponding implementation) component can also be enhanced further
29  * for more fancy algorithms/criteria for connection acceptance.
30  */
31
32 public interface IConnectionManager {
33     /**
34      * This method returns Connectivity Algorithm (Scheme) that is currently 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 connected to the given controller.
42      *
43      * @param controller InetAddress of the Controller that is currently connected to a set of Nodes.
44      *
45      * @return Set<Node> Set of Nodes connected to a controller.
46      */
47     public Set<Node> getNodes(InetAddress controller);
48
49     /**
50      * Method that will retrieve and return a Set of Nodes that is currently connected to
51      * the controller on which this method is executed.
52      *
53      * @return Set<Node> Set of Nodes connected to this controller.
54      */
55     public Set<Node> getLocalNodes();
56
57     /**
58      * @deprecated Use getLocalityStatus(Node node) instead.
59      *
60      * Method to test if a node is local to a controller.
61      *
62      * @param node The node for which the locality is being tested
63      * @return true if node is local to this controller.<br>
64      *         false if either node is not connected to this controller or
65      *         not connected to any other controllers in the cluster.
66      */
67     public boolean isLocal(Node node);
68
69     /**
70      * getLocalityStatus provides the tri-state connectivity status as opposed to the
71      * binary status returned by isLocal.
72      * ConnectionLocality enum that is returned by this method also includes the case of
73      * a Node not connected to any of the controllers in the cluster.
74      * @param node The node for which the locality is being verified
75      * @return ConnectionLocality
76      */
77     public ConnectionLocality getLocalityStatus(Node node);
78
79     /**
80      * Disconnect a Node from the controller.
81      *
82      * @return Status of the disconnect Operation.
83      */
84     public Status disconnect(Node node);
85
86     /**
87      * Connect to a node
88      *
89      * @param connectionIdentifier identifier with which the application would refer to a given connection.
90      * @param params Connection Params in Map format. This is entirely handled by the south-bound
91      * plugins and is an opaque value for SAL or Connection Manager. Typical values keyed inside
92      * this params are Management IP-Address, Username, Password, Security Keys, etc...
93      *
94      *  @return Node Node connected to.
95      */
96     public Node connect (String connectionIdentifier, Map<ConnectionConstants, String> params);
97
98     /**
99      * Connect to a node
100      *
101      * @param type Type of the node representing NodeIDType.
102      * @param connectionIdentifier identifier with which the application would refer to a given connection.
103      * @param params Connection Params in Map format. This is entirely handled by the south-bound
104      * plugins and is an opaque value for SAL or Connection Manager. Typical values keyed inside
105      * this params are Management IP-Address, Username, Password, Security Keys, etc...
106      *
107      *  @return Status of the Connect Operation.
108      */
109     public Node connect(String type, String connectionIdentifier, Map<ConnectionConstants, String> params);
110 }