Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
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.net.topology; |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.event.Event; |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.Link; |
| 22 | import org.onosproject.net.Path; |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 23 | import org.onosproject.net.DisjointPath; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 24 | import org.onosproject.net.provider.ProviderId; |
| 25 | import org.onosproject.store.Store; |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 26 | |
| 27 | import java.util.List; |
| 28 | import java.util.Set; |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 29 | import java.util.Map; |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 30 | |
| 31 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 32 | * Manages inventory of topology snapshots; not intended for direct use. |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 33 | */ |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 34 | public interface TopologyStore extends Store<TopologyEvent, TopologyStoreDelegate> { |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
| 37 | * Returns the current topology snapshot. |
| 38 | * |
| 39 | * @return current topology descriptor |
| 40 | */ |
| 41 | Topology currentTopology(); |
| 42 | |
| 43 | /** |
| 44 | * Indicates whether the topology is the latest. |
| 45 | * |
| 46 | * @param topology topology descriptor |
| 47 | * @return true if topology is the most recent one |
| 48 | */ |
| 49 | boolean isLatest(Topology topology); |
| 50 | |
| 51 | /** |
| 52 | * Returns the immutable graph view of the current topology. |
| 53 | * |
| 54 | * @param topology topology descriptor |
| 55 | * @return graph view |
| 56 | */ |
| 57 | TopologyGraph getGraph(Topology topology); |
| 58 | |
| 59 | /** |
| 60 | * Returns the set of topology SCC clusters. |
| 61 | * |
| 62 | * @param topology topology descriptor |
| 63 | * @return set of clusters |
| 64 | */ |
| 65 | Set<TopologyCluster> getClusters(Topology topology); |
| 66 | |
| 67 | /** |
| 68 | * Returns the cluster of the specified topology. |
| 69 | * |
| 70 | * @param topology topology descriptor |
| 71 | * @param clusterId cluster identity |
| 72 | * @return topology cluster |
| 73 | */ |
| 74 | TopologyCluster getCluster(Topology topology, ClusterId clusterId); |
| 75 | |
| 76 | /** |
| 77 | * Returns the cluster of the specified topology. |
| 78 | * |
| 79 | * @param topology topology descriptor |
| 80 | * @param cluster topology cluster |
| 81 | * @return set of cluster links |
| 82 | */ |
| 83 | Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster); |
| 84 | |
| 85 | /** |
| 86 | * Returns the cluster of the specified topology. |
| 87 | * |
| 88 | * @param topology topology descriptor |
| 89 | * @param cluster topology cluster |
| 90 | * @return set of cluster links |
| 91 | */ |
| 92 | Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster); |
| 93 | |
| 94 | /** |
| 95 | * Returns the set of pre-computed shortest paths between src and dest. |
| 96 | * |
| 97 | * @param topology topology descriptor |
| 98 | * @param src source device |
| 99 | * @param dst destination device |
| 100 | * @return set of shortest paths |
| 101 | */ |
| 102 | Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst); |
| 103 | |
| 104 | /** |
| 105 | * Computes and returns the set of shortest paths between src and dest. |
| 106 | * |
| 107 | * @param topology topology descriptor |
| 108 | * @param src source device |
| 109 | * @param dst destination device |
| 110 | * @param weight link weight function |
| 111 | * @return set of shortest paths |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 112 | * |
| 113 | * @deprecated in Junco (1.9.0), use version with LinkWeigher instead |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 114 | */ |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 115 | @Deprecated |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 116 | Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, |
| 117 | LinkWeight weight); |
| 118 | |
| 119 | /** |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 120 | * Computes and returns the set of shortest paths between src and dest. |
| 121 | * |
| 122 | * @param topology topology descriptor |
| 123 | * @param src source device |
| 124 | * @param dst destination device |
| 125 | * @param weigher link weight function |
| 126 | * @return set of shortest paths |
| 127 | */ |
| 128 | Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, |
| 129 | LinkWeigher weigher); |
| 130 | |
| 131 | /** |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 132 | * Computes and returns the set of disjoint shortest path pairs |
| 133 | * between src and dst. |
| 134 | * |
| 135 | * @param topology topology descriptor |
| 136 | * @param src source device |
| 137 | * @param dst destination device |
| 138 | * @param weight link weight function |
| 139 | * @return set of shortest paths |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 140 | * |
| 141 | * @deprecated in Junco (1.9.0), use version with LinkWeigher instead |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 142 | */ |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 143 | @Deprecated |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 144 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, |
| 145 | LinkWeight weight); |
| 146 | |
| 147 | /** |
| 148 | * Computes and returns the set of disjoint shortest path pairs |
| 149 | * between src and dst. |
| 150 | * |
| 151 | * @param topology topology descriptor |
| 152 | * @param src source device |
| 153 | * @param dst destination device |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 154 | * @param weigher link weight function |
| 155 | * @return set of shortest paths |
| 156 | */ |
| 157 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, |
| 158 | LinkWeigher weigher); |
| 159 | |
| 160 | /** |
| 161 | * Computes and returns the set of disjoint shortest path pairs |
| 162 | * between src and dst. |
| 163 | * |
| 164 | * @param topology topology descriptor |
| 165 | * @param src source device |
| 166 | * @param dst destination device |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 167 | * @return set of shortest paths |
| 168 | */ |
| 169 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst); |
| 170 | |
| 171 | /** |
| 172 | * Computes and returns the set of SRLG disjoint shortest path pairs between source |
| 173 | * and dst, given a mapping of edges to SRLG risk groups. |
| 174 | * |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 175 | * @param topology topology descriptor |
| 176 | * @param src source device |
| 177 | * @param dst destination device |
| 178 | * @param weight link weight function |
| 179 | * @param riskProfile map of edges to objects. Edges that map to the same object will |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 180 | * be treated as if they were in the same risk group. |
| 181 | * @return set of shortest paths |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 182 | * |
| 183 | * @deprecated in Junco (1.9.0), use version with LinkWeigher instead |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 184 | */ |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 185 | @Deprecated |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 186 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, |
| 187 | LinkWeight weight, Map<Link, Object> riskProfile); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 188 | |
| 189 | /** |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 190 | * Computes and returns the set of SRLG disjoint shortest path pairs between source |
| 191 | * and dst, given a mapping of edges to SRLG risk groups. |
| 192 | * |
| 193 | * @param topology topology descriptor |
| 194 | * @param src source device |
| 195 | * @param dst destination device |
| 196 | * @param weigher link weight function |
| 197 | * @param riskProfile map of edges to objects. Edges that map to the same object will |
| 198 | * be treated as if they were in the same risk group. |
| 199 | * @return set of shortest paths |
| 200 | */ |
| 201 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, |
| 202 | LinkWeigher weigher, Map<Link, Object> riskProfile); |
| 203 | |
| 204 | /** |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 205 | * Returns the set of pre-computed SRLG shortest paths between src and dest. |
| 206 | * |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 207 | * @param topology topology descriptor |
| 208 | * @param src source device |
| 209 | * @param dst destination device |
| 210 | * @param riskProfile map of edges to objects. Edges that map to the same object will |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 211 | * be treated as if they were in the same risk group. |
| 212 | * @return set of shortest paths |
| 213 | */ |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 214 | Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst, |
| 215 | Map<Link, Object> riskProfile); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 216 | |
| 217 | |
| 218 | /** |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 219 | * Indicates whether the given connect point is part of the network fabric. |
| 220 | * |
| 221 | * @param topology topology descriptor |
| 222 | * @param connectPoint connection point |
| 223 | * @return true if infrastructure; false otherwise |
| 224 | */ |
| 225 | boolean isInfrastructure(Topology topology, ConnectPoint connectPoint); |
| 226 | |
| 227 | /** |
| 228 | * Indicates whether broadcast is allowed for traffic received on the |
| 229 | * given connection point. |
| 230 | * |
| 231 | * @param topology topology descriptor |
| 232 | * @param connectPoint connection point |
| 233 | * @return true if broadcast allowed; false otherwise |
| 234 | */ |
| 235 | boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint); |
| 236 | |
| 237 | /** |
| 238 | * Generates a new topology snapshot from the specified description. |
| 239 | * |
| 240 | * @param providerId provider identification |
| 241 | * @param graphDescription topology graph description |
| 242 | * @param reasons list of events that triggered the update |
| 243 | * @return topology update event or null if the description is old |
| 244 | */ |
| 245 | TopologyEvent updateTopology(ProviderId providerId, |
| 246 | GraphDescription graphDescription, |
| 247 | List<Event> reasons); |
| 248 | } |