Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Foundation |
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 | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 17 | |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 18 | import org.onosproject.net.DisjointPath; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 19 | import org.onosproject.net.ElementId; |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 20 | import org.onosproject.net.Link; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 21 | import org.onosproject.net.Path; |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 22 | |
Yuta HIGUCHI | a684b6e | 2017-05-18 22:29:22 -0700 | [diff] [blame] | 23 | import static org.onosproject.net.topology.HopCountLinkWeigher.DEFAULT_HOP_COUNT_WEIGHER; |
| 24 | |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 25 | import java.util.Map; |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 26 | import java.util.Set; |
Yuta HIGUCHI | a684b6e | 2017-05-18 22:29:22 -0700 | [diff] [blame] | 27 | import java.util.stream.Stream; |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 28 | |
| 29 | /** |
| 30 | * Service for obtaining pre-computed paths or for requesting computation of |
| 31 | * paths using the current topology snapshot. |
| 32 | */ |
| 33 | public interface PathService { |
| 34 | |
| 35 | /** |
Thomas Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 36 | * 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. |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 39 | * |
tom | cbefa23 | 2014-09-16 14:17:20 -0700 | [diff] [blame] | 40 | * @param src source element |
| 41 | * @param dst destination element |
| 42 | * @return set of all shortest paths between the two elements |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 43 | */ |
tom | cbefa23 | 2014-09-16 14:17:20 -0700 | [diff] [blame] | 44 | Set<Path> getPaths(ElementId src, ElementId dst); |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Thomas Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 47 | * 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. |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 50 | * |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 51 | * @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 HIGUCHI | a684b6e | 2017-05-18 22:29:22 -0700 | [diff] [blame] | 59 | * 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 Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 86 | * 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 Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 89 | * |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 90 | * @param src source device |
| 91 | * @param dst destination device |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 92 | * @return set of all shortest paths between the two devices |
| 93 | */ |
| 94 | Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst); |
| 95 | |
| 96 | /** |
Thomas Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 97 | * 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 Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 100 | * |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 101 | * @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 Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 111 | * 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 Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 114 | * |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 115 | * @param src source device |
| 116 | * @param dst destination device |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 117 | * @param riskProfile map of edges to risk profiles |
| 118 | * @return set of all shortest paths between the two devices |
| 119 | */ |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 120 | Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, |
| 121 | Map<Link, Object> riskProfile); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
Thomas Vachuska | 41fe1ec | 2015-12-03 23:17:02 -0800 | [diff] [blame] | 124 | * 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 Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 128 | * |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 129 | * @param src source device |
| 130 | * @param dst destination device |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 131 | * @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 | |
tom | 4774c8f | 2014-09-16 11:17:08 -0700 | [diff] [blame] | 139 | } |