blob: e4cf7ecc2472ba08f4cd09eb46731281f598021e [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
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;
tom73d6d1e2014-09-17 20:08:01 -070017
Jordan Halterman28183ee2017-10-17 17:29:10 -070018import java.util.Set;
19
20import org.joda.time.DateTime;
21import org.onosproject.core.Version;
22import org.onosproject.event.ListenerService;
23
tom73d6d1e2014-09-17 20:08:01 -070024/**
Jordan Halterman980a8c12017-09-22 18:01:19 -070025 * Service for obtaining information about the individual nodes within the controller cluster.
tom73d6d1e2014-09-17 20:08:01 -070026 */
Jordan Halterman28183ee2017-10-17 17:29:10 -070027public interface ClusterService extends ListenerService<ClusterEvent, ClusterEventListener> {
28
29 /**
30 * Returns the local controller node.
31 *
32 * @return local controller node
33 */
34 ControllerNode getLocalNode();
35
36 /**
37 * Returns the set of current cluster members.
38 *
39 * @return set of cluster members
40 */
41 Set<ControllerNode> getNodes();
42
43 /**
44 * Returns the specified controller node.
45 *
46 * @param nodeId controller node identifier
47 * @return controller node
48 */
49 ControllerNode getNode(NodeId nodeId);
50
51 /**
52 * Returns the availability state of the specified controller node. Note
53 * that this does not imply that all the core and application components
54 * have been fully activated; only that the node has joined the cluster.
55 *
56 * @param nodeId controller node identifier
57 * @return availability state
58 */
59 ControllerNode.State getState(NodeId nodeId);
60
61 /**
62 * Returns the version of the given controller node.
63 *
64 * @param nodeId controller node identifier
65 * @return controller version
66 */
67 Version getVersion(NodeId nodeId);
68
69 /**
70 * Returns the system time when the availability state was last updated.
71 *
72 * @param nodeId controller node identifier
73 * @return system time when the availability state was last updated.
74 */
75 DateTime getLastUpdated(NodeId nodeId);
76
tom73d6d1e2014-09-17 20:08:01 -070077}