blob: a181c4f3e0c48253403b2f5a4c1ab3b6304073a9 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.cluster;
tome4729872014-09-23 00:37:37 -070017
Madan Jampani7d2fab22015-03-18 17:21:57 -070018import org.joda.time.DateTime;
19import org.onlab.packet.IpAddress;
Jordan Haltermanf70bf462017-07-29 13:12:00 -070020import org.onosproject.core.Version;
Madan Jampani7d2fab22015-03-18 17:21:57 -070021import org.onosproject.store.Store;
22
Thomas Vachuskade563cf2015-04-01 00:28:50 -070023import java.util.Set;
24
tome4729872014-09-23 00:37:37 -070025/**
26 * Manages inventory of controller cluster nodes; not intended for direct use.
27 */
tom0755a362014-09-24 11:54:43 -070028public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> {
tome4729872014-09-23 00:37:37 -070029
30 /**
tomb41d1ac2014-09-24 01:51:24 -070031 * Returns the local controller node.
tome4729872014-09-23 00:37:37 -070032 *
33 * @return local controller instance
34 */
35 ControllerNode getLocalNode();
36
37 /**
38 * Returns the set of current cluster members.
39 *
40 * @return set of cluster members
41 */
42 Set<ControllerNode> getNodes();
43
44 /**
tomb41d1ac2014-09-24 01:51:24 -070045 * Returns the specified controller node.
tome4729872014-09-23 00:37:37 -070046 *
47 * @param nodeId controller instance identifier
48 * @return controller instance
49 */
50 ControllerNode getNode(NodeId nodeId);
51
52 /**
tomb41d1ac2014-09-24 01:51:24 -070053 * Returns the availability state of the specified controller node.
tome4729872014-09-23 00:37:37 -070054 *
55 * @param nodeId controller instance identifier
56 * @return availability state
57 */
58 ControllerNode.State getState(NodeId nodeId);
59
tomb41d1ac2014-09-24 01:51:24 -070060 /**
Jordan Haltermanf70bf462017-07-29 13:12:00 -070061 * Returns the version of the specified controller node.
62 *
63 * @param nodeId controller instance identifier
64 * @return controller version
65 */
66 Version getVersion(NodeId nodeId);
67
68 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080069 * Marks the current node as fully started.
70 *
71 * @param started true indicates all components have been started
72 */
73 void markFullyStarted(boolean started);
74
75 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070076 * Returns the system when the availability state was last updated.
77 *
78 * @param nodeId controller node identifier
79 * @return system time when the availability state was last updated.
80 */
81 DateTime getLastUpdated(NodeId nodeId);
82
83 /**
tomee49c372014-09-26 15:14:50 -070084 * Adds a new controller node to the cluster.
85 *
86 * @param nodeId controller node identifier
87 * @param ip node IP listen address
88 * @param tcpPort tcp listen port
89 * @return newly added node
90 */
Pavlin Radoslavov444b5192014-10-28 10:45:19 -070091 ControllerNode addNode(NodeId nodeId, IpAddress ip, int tcpPort);
tomee49c372014-09-26 15:14:50 -070092
93 /**
tomb41d1ac2014-09-24 01:51:24 -070094 * Removes the specified node from the inventory of cluster nodes.
95 *
96 * @param nodeId controller instance identifier
97 */
98 void removeNode(NodeId nodeId);
99
tome4729872014-09-23 00:37:37 -0700100}