blob: 1c4e2d761c3eb07825fa072ac385e09f6c6ad09e [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;
tom73d6d1e2014-09-17 20:08:01 -070017
18import java.util.Set;
19
Madan Jampani7d2fab22015-03-18 17:21:57 -070020import org.joda.time.DateTime;
Jordan Haltermanf70bf462017-07-29 13:12:00 -070021import org.onosproject.core.Version;
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070022import org.onosproject.event.ListenerService;
Madan Jampani7d2fab22015-03-18 17:21:57 -070023
tom73d6d1e2014-09-17 20:08:01 -070024/**
tome4729872014-09-23 00:37:37 -070025 * Service for obtaining information about the individual nodes within
tom73d6d1e2014-09-17 20:08:01 -070026 * the controller cluster.
27 */
Thomas Vachuska42e8cce2015-07-29 19:25:18 -070028public interface ClusterService
29 extends ListenerService<ClusterEvent, ClusterEventListener> {
tom73d6d1e2014-09-17 20:08:01 -070030
31 /**
tome4729872014-09-23 00:37:37 -070032 * Returns the local controller node.
33 *
34 * @return local controller node
35 */
36 ControllerNode getLocalNode();
37
38 /**
tom73d6d1e2014-09-17 20:08:01 -070039 * Returns the set of current cluster members.
40 *
41 * @return set of cluster members
42 */
tome4729872014-09-23 00:37:37 -070043 Set<ControllerNode> getNodes();
tom73d6d1e2014-09-17 20:08:01 -070044
45 /**
tome4729872014-09-23 00:37:37 -070046 * Returns the specified controller node.
tom73d6d1e2014-09-17 20:08:01 -070047 *
tome4729872014-09-23 00:37:37 -070048 * @param nodeId controller node identifier
49 * @return controller node
50 */
51 ControllerNode getNode(NodeId nodeId);
52
53 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080054 * Returns the availability state of the specified controller node. Note
55 * that this does not imply that all the core and application components
56 * have been fully activated; only that the node has joined the cluster.
tome4729872014-09-23 00:37:37 -070057 *
58 * @param nodeId controller node identifier
tom73d6d1e2014-09-17 20:08:01 -070059 * @return availability state
60 */
tome4729872014-09-23 00:37:37 -070061 ControllerNode.State getState(NodeId nodeId);
tom73d6d1e2014-09-17 20:08:01 -070062
tomfc9a4ff2014-09-22 18:22:47 -070063 /**
Jordan Haltermanf70bf462017-07-29 13:12:00 -070064 * Returns the version of the given controller node.
65 *
66 * @param nodeId controller node identifier
67 * @return controller version
68 */
69 Version getVersion(NodeId nodeId);
70
71 /**
Madan Jampani7d2fab22015-03-18 17:21:57 -070072 * Returns the system time when the availability state was last updated.
73 *
74 * @param nodeId controller node identifier
75 * @return system time when the availability state was last updated.
76 */
77 DateTime getLastUpdated(NodeId nodeId);
78
tom73d6d1e2014-09-17 20:08:01 -070079}