Pavlin Radoslavov | 1278ac7 | 2013-10-16 04:43:49 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.topology; |
| 2 | |
| 3 | import java.util.Map; |
| 4 | |
| 5 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 6 | import net.onrc.onos.ofcontroller.util.DataPath; |
| 7 | import net.onrc.onos.ofcontroller.util.SwitchPort; |
| 8 | |
| 9 | /** |
| 10 | * Interface for providing Topology Network Service to other modules. |
| 11 | */ |
| 12 | public interface ITopologyNetService extends IFloodlightService { |
| 13 | /** |
| 14 | * Get the shortest path from a source to a destination. |
| 15 | * |
| 16 | * @param src the source in the shortest path computation. |
| 17 | * @param dest the destination in the shortest path computation. |
| 18 | * @return the data path with the computed shortest path if |
| 19 | * found, otherwise null. |
| 20 | */ |
| 21 | DataPath getShortestPath(SwitchPort src, SwitchPort dest); |
| 22 | |
| 23 | /** |
| 24 | * Fetch the Switch and Ports info from the Titan Graph |
| 25 | * and return it for fast access during the shortest path |
| 26 | * computation. |
| 27 | * |
| 28 | * After fetching the state, method @ref getTopoShortestPath() |
| 29 | * can be used for fast shortest path computation. |
| 30 | * |
| 31 | * Note: There is certain cost to fetch the state, hence it should |
| 32 | * be used only when there is a large number of shortest path |
| 33 | * computations that need to be done on the same topology. |
| 34 | * Typically, a single call to @ref prepareShortestPathTopo() |
| 35 | * should be followed by a large number of calls to |
| 36 | * method @ref getTopoShortestPath(). |
| 37 | * After the last @ref getTopoShortestPath() call, |
| 38 | * method @ref dropShortestPathTopo() should be used to release |
| 39 | * the internal state that is not needed anymore: |
| 40 | * |
| 41 | * Map<Long, ?> shortestPathTopo; |
| 42 | * shortestPathTopo = prepareShortestPathTopo(); |
| 43 | * for (int i = 0; i < 10000; i++) { |
| 44 | * dataPath = getTopoShortestPath(shortestPathTopo, ...); |
| 45 | * ... |
| 46 | * } |
| 47 | * dropShortestPathTopo(shortestPathTopo); |
| 48 | * |
| 49 | * @return the Shortest Path info handler stored in a map. |
| 50 | */ |
| 51 | Map<Long, ?> prepareShortestPathTopo(); |
| 52 | |
| 53 | /** |
| 54 | * Release the state that was populated by |
| 55 | * method @ref prepareShortestPathTopo(). |
| 56 | * |
| 57 | * See the documentation for method @ref prepareShortestPathTopo() |
| 58 | * for additional information and usage. |
| 59 | * |
| 60 | * @param shortestPathTopo the Shortest Path info handler to release. |
| 61 | */ |
| 62 | void dropShortestPathTopo(Map<Long, ?> shortestPathTopo); |
| 63 | |
| 64 | /** |
| 65 | * Get the shortest path from a source to a destination by |
| 66 | * using the pre-populated local topology state prepared |
| 67 | * by method @ref prepareShortestPathTopo(). |
| 68 | * |
| 69 | * See the documentation for method @ref prepareShortestPathTopo() |
| 70 | * for additional information and usage. |
| 71 | * |
| 72 | * @param shortestPathTopo the Shortest Path info handler |
| 73 | * to use. |
| 74 | * @param src the source in the shortest path computation. |
| 75 | * @param dest the destination in the shortest path computation. |
| 76 | * @return the data path with the computed shortest path if |
| 77 | * found, otherwise null. |
| 78 | */ |
| 79 | DataPath getTopoShortestPath(Map<Long, ?> shortestPathTopo, |
| 80 | SwitchPort src, SwitchPort dest); |
| 81 | |
| 82 | /** |
| 83 | * Test whether a route exists from a source to a destination. |
| 84 | * |
| 85 | * @param src the source node for the test. |
| 86 | * @param dest the destination node for the test. |
| 87 | * @return true if a route exists, otherwise false. |
| 88 | */ |
| 89 | Boolean routeExists(SwitchPort src, SwitchPort dest); |
| 90 | } |