Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 3 | * |
| 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'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.cluster; |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 17 | |
| 18 | import java.util.Set; |
| 19 | |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 20 | import org.joda.time.DateTime; |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 21 | import org.onosproject.core.Version; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 22 | import org.onosproject.event.ListenerService; |
Madan Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 23 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 24 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 25 | * Service for obtaining information about the individual nodes within |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 26 | * the controller cluster. |
| 27 | */ |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 28 | public interface ClusterService |
| 29 | extends ListenerService<ClusterEvent, ClusterEventListener> { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 32 | * Returns the local controller node. |
| 33 | * |
| 34 | * @return local controller node |
| 35 | */ |
| 36 | ControllerNode getLocalNode(); |
| 37 | |
| 38 | /** |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 39 | * Returns the set of current cluster members. |
| 40 | * |
| 41 | * @return set of cluster members |
| 42 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 43 | Set<ControllerNode> getNodes(); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 46 | * Returns the specified controller node. |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 47 | * |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 48 | * @param nodeId controller node identifier |
| 49 | * @return controller node |
| 50 | */ |
| 51 | ControllerNode getNode(NodeId nodeId); |
| 52 | |
| 53 | /** |
Thomas Vachuska | 7a8de84 | 2016-03-07 20:56:35 -0800 | [diff] [blame] | 54 | * 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. |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 57 | * |
| 58 | * @param nodeId controller node identifier |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 59 | * @return availability state |
| 60 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 61 | ControllerNode.State getState(NodeId nodeId); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 62 | |
tom | fc9a4ff | 2014-09-22 18:22:47 -0700 | [diff] [blame] | 63 | /** |
Jordan Halterman | f70bf46 | 2017-07-29 13:12:00 -0700 | [diff] [blame] | 64 | * 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 Jampani | 7d2fab2 | 2015-03-18 17:21:57 -0700 | [diff] [blame] | 72 | * 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 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 79 | } |