Thomas Vachuska | 4844808 | 2016-02-19 22:14:54 -0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Foundation |
Thomas Vachuska | 4844808 | 2016-02-19 22:14:54 -0800 | [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 | */ |
| 16 | |
| 17 | package org.onosproject.net.region; |
| 18 | |
| 19 | import org.onosproject.cluster.NodeId; |
Simon Hunt | 5361221 | 2016-12-04 17:19:52 -0800 | [diff] [blame] | 20 | import org.onosproject.net.Annotated; |
Thomas Vachuska | 4844808 | 2016-02-19 22:14:54 -0800 | [diff] [blame] | 21 | |
| 22 | import java.util.List; |
| 23 | import 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 Hunt | 5361221 | 2016-12-04 17:19:52 -0800 | [diff] [blame] | 30 | public interface Region extends Annotated { |
Thomas Vachuska | 4844808 | 2016-02-19 22:14:54 -0800 | [diff] [blame] | 31 | |
| 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 Hunt | 5361221 | 2016-12-04 17:19:52 -0800 | [diff] [blame] | 62 | * Region represents a data center. |
| 63 | */ |
| 64 | DATA_CENTER, |
| 65 | |
| 66 | /** |
Thomas Vachuska | 4844808 | 2016-02-19 22:14:54 -0800 | [diff] [blame] | 67 | * 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 | } |