Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Open Networking Laboratory |
| 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 | |
Pavlin Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 19 | |
| 20 | /** |
| 21 | * Represents a controller instance as a member in a cluster. |
| 22 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 23 | public interface ControllerNode { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 24 | |
| 25 | /** Represents the operational state of the instance. */ |
Sho SHIMIZU | e2952e4 | 2015-09-11 17:11:21 -0700 | [diff] [blame] | 26 | enum State { |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Signifies that the instance is active and operating normally. |
| 29 | */ |
| 30 | ACTIVE, |
| 31 | |
| 32 | /** |
| 33 | * Signifies that the instance is inactive, which means either down or |
| 34 | * up, but not operational. |
| 35 | */ |
| 36 | INACTIVE |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Returns the instance identifier. |
| 41 | * |
| 42 | * @return instance identifier |
| 43 | */ |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 44 | NodeId id(); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Returns the IP address of the controller instance. |
| 48 | * |
| 49 | * @return IP address |
| 50 | */ |
Pavlin Radoslavov | 444b519 | 2014-10-28 10:45:19 -0700 | [diff] [blame] | 51 | IpAddress ip(); |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 52 | |
tom | ee49c37 | 2014-09-26 15:14:50 -0700 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Returns the TCP port on which the node listens for connections. |
| 56 | * |
| 57 | * @return TCP port |
| 58 | */ |
| 59 | int tcpPort(); |
| 60 | |
tom | 73d6d1e | 2014-09-17 20:08:01 -0700 | [diff] [blame] | 61 | } |