blob: 48932dbf33971cba32dcf8fef2c2a490acb41739 [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
tom73d6d1e2014-09-17 20:08:01 -070018/**
19 * Represents a controller instance as a member in a cluster.
20 */
Jordan Halterman00e92da2018-05-22 23:05:52 -070021public interface ControllerNode extends Node {
tom73d6d1e2014-09-17 20:08:01 -070022
23 /** Represents the operational state of the instance. */
Sho SHIMIZUe2952e42015-09-11 17:11:21 -070024 enum State {
tom73d6d1e2014-09-17 20:08:01 -070025 /**
Thomas Vachuska7a8de842016-03-07 20:56:35 -080026 * Signifies that the instance is active and that all components are
27 * operating normally.
28 */
29 READY,
30
31 /**
tom73d6d1e2014-09-17 20:08:01 -070032 * Signifies that the instance is active and operating normally.
33 */
34 ACTIVE,
35
36 /**
37 * Signifies that the instance is inactive, which means either down or
38 * up, but not operational.
39 */
Thomas Vachuska7a8de842016-03-07 20:56:35 -080040 INACTIVE;
41
42 /**
43 * Indicates whether the state represents node which is active or ready.
44 *
45 * @return true if active or ready
46 */
47 public boolean isActive() {
48 return this == ACTIVE || this == READY;
49 }
50
51 /**
52 * Indicates whether the state represents a node which is ready.
53 *
54 * @return true if active and ready
55 */
56 public boolean isReady() {
57 return this == READY;
58 }
tom73d6d1e2014-09-17 20:08:01 -070059 }
60
tom73d6d1e2014-09-17 20:08:01 -070061}