blob: 61ab526ad6244234888c2a8185f498c074e4d556 [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
112 */
113 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
114 LinkWeight weight);
115
116 /**
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700117 * Computes and returns the set of disjoint shortest path pairs
118 * between src and dst.
119 *
120 * @param topology topology descriptor
121 * @param src source device
122 * @param dst destination device
123 * @param weight link weight function
124 * @return set of shortest paths
125 */
126 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
127 LinkWeight weight);
128
129 /**
130 * Computes and returns the set of disjoint shortest path pairs
131 * between src and dst.
132 *
133 * @param topology topology descriptor
134 * @param src source device
135 * @param dst destination device
136 * @return set of shortest paths
137 */
138 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst);
139
140 /**
141 * Computes and returns the set of SRLG disjoint shortest path pairs between source
142 * and dst, given a mapping of edges to SRLG risk groups.
143 *
144 * @param topology topology descriptor
145 * @param src source device
146 * @param dst destination device
147 * @param weight link weight function
148 * @param riskProfile map of edges to objects. Edges that map to the same object will
149 * be treated as if they were in the same risk group.
150 * @return set of shortest paths
151 */
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700152 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
153 LinkWeight weight, Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700154
155 /**
156 * Returns the set of pre-computed SRLG shortest paths between src and dest.
157 *
158 * @param topology topology descriptor
159 * @param src source device
160 * @param dst destination device
161 * @param riskProfile map of edges to objects. Edges that map to the same object will
162 * be treated as if they were in the same risk group.
163 * @return set of shortest paths
164 */
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700165 Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, DeviceId dst,
166 Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700167
168
169 /**
tom10262dd2014-09-19 10:51:19 -0700170 * Indicates whether the given connect point is part of the network fabric.
171 *
172 * @param topology topology descriptor
173 * @param connectPoint connection point
174 * @return true if infrastructure; false otherwise
175 */
176 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
177
178 /**
179 * Indicates whether broadcast is allowed for traffic received on the
180 * given connection point.
181 *
182 * @param topology topology descriptor
183 * @param connectPoint connection point
184 * @return true if broadcast allowed; false otherwise
185 */
186 boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint);
187
188 /**
189 * Generates a new topology snapshot from the specified description.
190 *
191 * @param providerId provider identification
192 * @param graphDescription topology graph description
193 * @param reasons list of events that triggered the update
194 * @return topology update event or null if the description is old
195 */
196 TopologyEvent updateTopology(ProviderId providerId,
197 GraphDescription graphDescription,
198 List<Event> reasons);
199}