blob: df12a5351134b89fb870cccbff7a79fa7c35426c [file] [log] [blame]
Thomas Vachuska48448082016-02-19 22:14:54 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Thomas Vachuska48448082016-02-19 22:14:54 -08003 *
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 */
16
17package org.onosproject.net.region;
18
19import org.onosproject.cluster.NodeId;
Simon Hunt53612212016-12-04 17:19:52 -080020import org.onosproject.net.Annotated;
Thomas Vachuska48448082016-02-19 22:14:54 -080021
22import java.util.List;
23import java.util.Set;
24
25/**
26 * Representation of a group of devices located in a common physical or
27 * logical region. Optionally, devices in the region can share the same
28 * cluster nodes mastership affinities.
29 */
Simon Hunt53612212016-12-04 17:19:52 -080030public interface Region extends Annotated {
Thomas Vachuska48448082016-02-19 22:14:54 -080031
32 /**
33 * Coarse representation of the type of the region.
34 */
35 enum Type {
36 /**
37 * Region represents an entire continent.
38 */
39 CONTINENT,
40
41 /**
42 * Region represents an entire country.
43 */
44 COUNTRY,
45
46 /**
47 * Region represents a metropolitan area.
48 */
49 METRO,
50
51 /**
52 * Region represents a campus.
53 */
54 CAMPUS,
55
56 /**
57 * Region represents a building.
58 */
59 BUILDING,
60
61 /**
Simon Hunt53612212016-12-04 17:19:52 -080062 * Region represents a data center.
63 */
64 DATA_CENTER,
65
66 /**
Thomas Vachuska48448082016-02-19 22:14:54 -080067 * Region represents a building floor.
68 */
69 FLOOR,
70
71 /**
72 * Region represents a room.
73 */
74 ROOM,
75
76 /**
77 * Region represents a rack.
78 */
79 RACK,
80
81 /**
82 * Region represents a logical grouping.
83 */
84 LOGICAL_GROUP
85 }
86
87 /**
88 * Returns the unique identifier of the region.
89 *
90 * @return region identifier
91 */
92 RegionId id();
93
94 /**
95 * Returns the friendly region name that can be used for display purposes.
96 *
97 * @return friendly name of the region
98 */
99 String name();
100
101 /**
102 * Returns the region type.
103 *
104 * @return region type
105 */
106 Type type();
107
108 /**
109 * Returns the list of master node sets. The sets of cluster node identifiers
110 * should be listed in the order of preferred mastership. Nodes specified
111 * in each sets should be considered with equally priority and devices in
112 * the region can be balanced between them based on other criteria, e.g. load.
113 *
114 * @return list of preferred master node sets
115 */
116 List<Set<NodeId>> masters();
117
118}