blob: 907beb21a52cdefd61c0c9f31fd2dd003517ad07 [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2014-present Open Networking Laboratory
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.net.topology;
tom10262dd2014-09-19 10:51:19 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.event.Event;
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.Link;
22import org.onosproject.net.Path;
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070023import org.onosproject.net.DisjointPath;
Brian O'Connorabafb502014-12-02 22:26:20 -080024import org.onosproject.net.provider.ProviderId;
25import org.onosproject.store.Store;
tom10262dd2014-09-19 10:51:19 -070026
27import java.util.List;
28import java.util.Set;
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070029import java.util.Map;
tom10262dd2014-09-19 10:51:19 -070030
31/**
tome4729872014-09-23 00:37:37 -070032 * Manages inventory of topology snapshots; not intended for direct use.
tom10262dd2014-09-19 10:51:19 -070033 */
tomc78acee2014-09-24 15:16:55 -070034public interface TopologyStore extends Store<TopologyEvent, TopologyStoreDelegate> {
tom10262dd2014-09-19 10:51:19 -070035
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 Komarov2398d962016-09-26 15:11:23 +0300112 *
113 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
tom10262dd2014-09-19 10:51:19 -0700114 */
Andrey Komarov2398d962016-09-26 15:11:23 +0300115 @Deprecated
tom10262dd2014-09-19 10:51:19 -0700116 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
117 LinkWeight weight);
118
119 /**
Andrey Komarov2398d962016-09-26 15:11:23 +0300120 * 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 Cheerla2ec191f2015-07-09 12:34:54 -0700132 * 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 Komarov2398d962016-09-26 15:11:23 +0300140 *
141 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700142 */
Andrey Komarov2398d962016-09-26 15:11:23 +0300143 @Deprecated
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700144 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 Komarov2398d962016-09-26 15:11:23 +0300154 * @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 Cheerla2ec191f2015-07-09 12:34:54 -0700167 * @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 Komarov2398d962016-09-26 15:11:23 +0300175 * @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 Cheerla2ec191f2015-07-09 12:34:54 -0700180 * be treated as if they were in the same risk group.
181 * @return set of shortest paths
Andrey Komarov2398d962016-09-26 15:11:23 +0300182 *
183 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700184 */
Andrey Komarov2398d962016-09-26 15:11:23 +0300185 @Deprecated
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700186 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
187 LinkWeight weight, Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700188
189 /**
Andrey Komarov2398d962016-09-26 15:11:23 +0300190 * 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 Cheerla2ec191f2015-07-09 12:34:54 -0700205 * Returns the set of pre-computed SRLG shortest paths between src and dest.
206 *
Andrey Komarov2398d962016-09-26 15:11:23 +0300207 * @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 Cheerla2ec191f2015-07-09 12:34:54 -0700211 * be treated as if they were in the same risk group.
212 * @return set of shortest paths
213 */
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700214 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
215 Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700216
217
218 /**
tom10262dd2014-09-19 10:51:19 -0700219 * 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}