blob: ae2de8ba94932a767c621a01ebe41b6be4ba999d [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2014-present Open Networking Foundation
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;
tom4774c8f2014-09-16 11:17:08 -070017
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070018import org.onosproject.net.DisjointPath;
Brian O'Connorabafb502014-12-02 22:26:20 -080019import org.onosproject.net.ElementId;
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070020import org.onosproject.net.Link;
Brian O'Connorabafb502014-12-02 22:26:20 -080021import org.onosproject.net.Path;
tom4774c8f2014-09-16 11:17:08 -070022
Yuta HIGUCHIa684b6e2017-05-18 22:29:22 -070023import static org.onosproject.net.topology.HopCountLinkWeigher.DEFAULT_HOP_COUNT_WEIGHER;
24
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070025import java.util.Map;
tom4774c8f2014-09-16 11:17:08 -070026import java.util.Set;
Yuta HIGUCHIa684b6e2017-05-18 22:29:22 -070027import java.util.stream.Stream;
tom4774c8f2014-09-16 11:17:08 -070028
29/**
30 * Service for obtaining pre-computed paths or for requesting computation of
31 * paths using the current topology snapshot.
32 */
33public interface PathService {
34
35 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -080036 * Returns the set of all shortest paths between the specified source and
37 * destination elements. The path is computed using the default edge-weight
38 * function, which by default is hop-count.
tom4774c8f2014-09-16 11:17:08 -070039 *
tomcbefa232014-09-16 14:17:20 -070040 * @param src source element
41 * @param dst destination element
42 * @return set of all shortest paths between the two elements
tom4774c8f2014-09-16 11:17:08 -070043 */
tomcbefa232014-09-16 14:17:20 -070044 Set<Path> getPaths(ElementId src, ElementId dst);
tom4774c8f2014-09-16 11:17:08 -070045
46 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -080047 * Returns the set of all shortest paths between the specified source and
48 * destination network elements. The path is computed using the supplied
49 * edge-weight function.
tom4774c8f2014-09-16 11:17:08 -070050 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -070051 * @param src source element
52 * @param dst destination element
Yuta HIGUCHI5c947272014-11-03 21:39:21 -080053 * @param weight edge-weight entity
tomcbefa232014-09-16 14:17:20 -070054 * @return set of all shortest paths between the two element
Andrey Komarov2398d962016-09-26 15:11:23 +030055 *
56 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
tom4774c8f2014-09-16 11:17:08 -070057 */
Andrey Komarov2398d962016-09-26 15:11:23 +030058 @Deprecated
tomcbefa232014-09-16 14:17:20 -070059 Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight);
tom4774c8f2014-09-16 11:17:08 -070060
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070061 /**
Andrey Komarov2398d962016-09-26 15:11:23 +030062 * Returns the set of all shortest paths between the specified source and
63 * destination network elements. The path is computed using the supplied
64 * edge-weight function.
65 *
66 * @param src source element
67 * @param dst destination element
68 * @param weigher edge-weight entity
69 * @return set of all shortest paths between the two element
70 */
71 Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher);
72
73 /**
Yuta HIGUCHIa684b6e2017-05-18 22:29:22 -070074 * Returns the k-shortest paths between source and
75 * destination devices.
76 *
77 * @param src source device
78 * @param dst destination device
79 * @return stream of k-shortest paths
80 */
81 default Stream<Path> getKShortestPaths(ElementId src, ElementId dst) {
82 return getKShortestPaths(src, dst, DEFAULT_HOP_COUNT_WEIGHER);
83 }
84
85 /**
86 * Returns the k-shortest paths between source and
87 * destination devices.
88 *
89 * @param src source device
90 * @param dst destination device
91 * @param weigher edge-weight entity
92 * @return stream of k-shortest paths
93 */
94 default Stream<Path> getKShortestPaths(ElementId src, ElementId dst,
95 LinkWeigher weigher) {
96 return getPaths(src, dst, weigher).stream();
97 }
98
99
100 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800101 * Returns the set of all disjoint shortest path pairs between the
102 * specified source and destination elements. The path is computed using
103 * the default edge-weight function, which by default is hop-count.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700104 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700105 * @param src source device
106 * @param dst destination device
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700107 * @return set of all shortest paths between the two devices
108 */
109 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst);
110
111 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800112 * Returns the set of all disjoint shortest path pairs between the
113 * specified source and destination elements. The path is computed using
114 * the supplied edge-weight function.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700115 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700116 * @param src source device
117 * @param dst destination device
118 * @param weight edge-weight entity
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700119 * @return set of all shortest paths between the two devices
Andrey Komarov2398d962016-09-26 15:11:23 +0300120 *
121 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700122 */
Andrey Komarov2398d962016-09-26 15:11:23 +0300123 @Deprecated
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700124 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
125 LinkWeight weight);
126
127 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800128 * Returns the set of all disjoint shortest path pairs between the
Andrey Komarov2398d962016-09-26 15:11:23 +0300129 * specified source and destination elements. The path is computed using
130 * the supplied edge-weight function.
131 *
132 * @param src source device
133 * @param dst destination device
134 * @param weigher edge-weight entity
135 * @return set of all shortest paths between the two devices
136 */
137 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
138 LinkWeigher weigher);
139
140 /**
141 * Returns the set of all disjoint shortest path pairs between the
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800142 * specified source and destination elements and taking into consideration
143 * the provided risk profile. The path is computed using the default
144 * edge-weight function, which by default is hop-count.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700145 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700146 * @param src source device
147 * @param dst destination device
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700148 * @param riskProfile map of edges to risk profiles
149 * @return set of all shortest paths between the two devices
150 */
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700151 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
152 Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700153
154 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800155 * Returns the set of all disjoint shortest path pairs between the
156 * specified source and destination elements and taking into consideration
157 * the provided risk profile. The path is computed using the supplied
158 * edge-weight function.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700159 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700160 * @param src source device
161 * @param dst destination device
162 * @param weight edge-weight entity
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700163 * @param riskProfile map of edges to risk profiles
164 * @return set of all shortest paths between the two devices
Andrey Komarov2398d962016-09-26 15:11:23 +0300165 *
166 * @deprecated in Junco (1.9.0), use version with LinkWeigher instead
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700167 */
Andrey Komarov2398d962016-09-26 15:11:23 +0300168 @Deprecated
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700169 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800170 LinkWeight weight,
171 Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700172
Andrey Komarov2398d962016-09-26 15:11:23 +0300173 /**
174 * Returns the set of all disjoint shortest path pairs between the
175 * specified source and destination elements and taking into consideration
176 * the provided risk profile. The path is computed using the supplied
177 * edge-weight function.
178 *
179 * @param src source device
180 * @param dst destination device
181 * @param weigher edge-weight entity
182 * @param riskProfile map of edges to risk profiles
183 * @return set of all shortest paths between the two devices
184 */
185 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
186 LinkWeigher weigher,
187 Map<Link, Object> riskProfile);
188
tom4774c8f2014-09-16 11:17:08 -0700189}