blob: 73f0149ab0f2fe596cb4755a125bf36cf185d027 [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 *
Andrey Komarov2398d962016-09-26 15:11:23 +030051 * @param src source element
52 * @param dst destination element
53 * @param weigher edge-weight entity
54 * @return set of all shortest paths between the two element
55 */
56 Set<Path> getPaths(ElementId src, ElementId dst, LinkWeigher weigher);
57
58 /**
Yuta HIGUCHIa684b6e2017-05-18 22:29:22 -070059 * Returns the k-shortest paths between source and
60 * destination devices.
61 *
62 * @param src source device
63 * @param dst destination device
64 * @return stream of k-shortest paths
65 */
66 default Stream<Path> getKShortestPaths(ElementId src, ElementId dst) {
67 return getKShortestPaths(src, dst, DEFAULT_HOP_COUNT_WEIGHER);
68 }
69
70 /**
71 * Returns the k-shortest paths between source and
72 * destination devices.
73 *
74 * @param src source device
75 * @param dst destination device
76 * @param weigher edge-weight entity
77 * @return stream of k-shortest paths
78 */
79 default Stream<Path> getKShortestPaths(ElementId src, ElementId dst,
80 LinkWeigher weigher) {
81 return getPaths(src, dst, weigher).stream();
82 }
83
84
85 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -080086 * Returns the set of all disjoint shortest path pairs between the
87 * specified source and destination elements. The path is computed using
88 * the default edge-weight function, which by default is hop-count.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070089 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -070090 * @param src source device
91 * @param dst destination device
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -070092 * @return set of all shortest paths between the two devices
93 */
94 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst);
95
96 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -080097 * Returns the set of all disjoint shortest path pairs between the
98 * specified source and destination elements. The path is computed using
99 * the supplied edge-weight function.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700100 *
Andrey Komarov2398d962016-09-26 15:11:23 +0300101 * @param src source device
102 * @param dst destination device
103 * @param weigher edge-weight entity
104 * @return set of all shortest paths between the two devices
105 */
106 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
107 LinkWeigher weigher);
108
109 /**
110 * Returns the set of all disjoint shortest path pairs between the
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800111 * specified source and destination elements and taking into consideration
112 * the provided risk profile. The path is computed using the default
113 * edge-weight function, which by default is hop-count.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700114 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700115 * @param src source device
116 * @param dst destination device
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700117 * @param riskProfile map of edges to risk profiles
118 * @return set of all shortest paths between the two devices
119 */
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700120 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
121 Map<Link, Object> riskProfile);
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700122
123 /**
Thomas Vachuska41fe1ec2015-12-03 23:17:02 -0800124 * Returns the set of all disjoint shortest path pairs between the
125 * specified source and destination elements and taking into consideration
126 * the provided risk profile. The path is computed using the supplied
127 * edge-weight function.
Nikhil Cheerla2ec191f2015-07-09 12:34:54 -0700128 *
Thomas Vachuska48e64e42015-09-22 15:32:55 -0700129 * @param src source device
130 * @param dst destination device
Andrey Komarov2398d962016-09-26 15:11:23 +0300131 * @param weigher edge-weight entity
132 * @param riskProfile map of edges to risk profiles
133 * @return set of all shortest paths between the two devices
134 */
135 Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst,
136 LinkWeigher weigher,
137 Map<Link, Object> riskProfile);
138
tom4774c8f2014-09-16 11:17:08 -0700139}