Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.core; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
Pavlin Radoslavov | d7d8b79 | 2013-02-22 10:24:38 -0800 | [diff] [blame] | 5 | import net.floodlightcontroller.core.module.IFloodlightService; |
Pankaj Berde | 2497e54 | 2013-02-19 18:51:24 -0800 | [diff] [blame] | 6 | import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject; |
| 7 | import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject; |
Pankaj Berde | 1e2f731 | 2013-02-15 08:25:31 -0800 | [diff] [blame] | 8 | import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject; |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 9 | import net.floodlightcontroller.routing.Link; |
| 10 | import net.floodlightcontroller.topology.NodePortTuple; |
Pavlin Radoslavov | f83aa44 | 2013-02-26 14:09:01 -0800 | [diff] [blame] | 11 | import net.floodlightcontroller.util.DataPath; |
| 12 | import net.floodlightcontroller.util.SwitchPort; |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 13 | |
| 14 | public interface INetMapTopologyService extends INetMapService { |
| 15 | |
| 16 | public interface ITopoSwitchService { |
Pankaj Berde | 2497e54 | 2013-02-19 18:51:24 -0800 | [diff] [blame] | 17 | Iterable<ISwitchObject> getActiveSwitches(); |
| 18 | Iterable<ISwitchObject> getAllSwitches(); |
| 19 | Iterable<ISwitchObject> getInactiveSwitches(); |
| 20 | Iterable<IPortObject> getPortsOnSwitch(String dpid); |
| 21 | IPortObject getPortOnSwitch(String dpid, short port_num); |
| 22 | |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | public interface ITopoLinkService { |
Pankaj Berde | 2497e54 | 2013-02-19 18:51:24 -0800 | [diff] [blame] | 26 | List<Link> getActiveLinks(); |
| 27 | List<Link> getLinksOnSwitch(String dpid); |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 28 | } |
| 29 | public interface ITopoDeviceService { |
Pankaj Berde | 2497e54 | 2013-02-19 18:51:24 -0800 | [diff] [blame] | 30 | Iterable<IDeviceObject> getActiveDevices(); |
| 31 | Iterable<IDeviceObject> getDevicesOnSwitch(String dpid); |
| 32 | Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num); |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 33 | } |
| 34 | |
Pavlin Radoslavov | d7d8b79 | 2013-02-22 10:24:38 -0800 | [diff] [blame] | 35 | public interface ITopoRouteService extends IFloodlightService { |
Pavlin Radoslavov | a5f167b | 2013-03-21 11:39:27 -0700 | [diff] [blame] | 36 | /** |
| 37 | * Get the shortest path from a source to a destination. |
| 38 | * |
| 39 | * @param src the source in the shortest path computation. |
| 40 | * @param dest the destination in the shortest path computation. |
| 41 | * @return the data path with the computed shortest path if |
| 42 | * found, otherwise null. |
| 43 | */ |
Pavlin Radoslavov | f83aa44 | 2013-02-26 14:09:01 -0800 | [diff] [blame] | 44 | DataPath getShortestPath(SwitchPort src, SwitchPort dest); |
Pavlin Radoslavov | a5f167b | 2013-03-21 11:39:27 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * Fetch the Switch and Ports info from the Titan Graph |
| 48 | * and store it locally for fast access during the shortest path |
| 49 | * computation. |
| 50 | * |
| 51 | * After fetching the state, method @ref getTopoShortestPath() |
| 52 | * can be used for fast shortest path computation. |
| 53 | * |
| 54 | * Note: There is certain cost to fetch the state, hence it should |
| 55 | * be used only when there is a large number of shortest path |
| 56 | * computations that need to be done on the same topology. |
| 57 | * Typically, a single call to @ref prepareShortestPathTopo() |
| 58 | * should be followed by a large number of calls to |
| 59 | * method @ref getTopoShortestPath(). |
| 60 | * After the last @ref getTopoShortestPath() call, |
| 61 | * method @ref dropShortestPathTopo() should be used to release |
| 62 | * the internal state that is not needed anymore: |
| 63 | * |
| 64 | * prepareShortestPathTopo(); |
| 65 | * for (int i = 0; i < 10000; i++) { |
| 66 | * dataPath = getTopoShortestPath(...); |
| 67 | * ... |
| 68 | * } |
| 69 | * dropShortestPathTopo(); |
| 70 | */ |
| 71 | void prepareShortestPathTopo(); |
| 72 | |
| 73 | /** |
| 74 | * Release the state that was populated by |
| 75 | * method @ref prepareShortestPathTopo(). |
| 76 | * |
| 77 | * See the documentation for method @ref prepareShortestPathTopo() |
| 78 | * for additional information and usage. |
| 79 | */ |
| 80 | void dropShortestPathTopo(); |
| 81 | |
| 82 | /** |
| 83 | * Get the shortest path from a source to a destination by |
| 84 | * using the pre-populated local topology state prepared |
| 85 | * by method @ref prepareShortestPathTopo(). |
| 86 | * |
| 87 | * See the documentation for method @ref prepareShortestPathTopo() |
| 88 | * for additional information and usage. |
| 89 | * |
| 90 | * @param src the source in the shortest path computation. |
| 91 | * @param dest the destination in the shortest path computation. |
| 92 | * @return the data path with the computed shortest path if |
| 93 | * found, otherwise null. |
| 94 | */ |
| 95 | DataPath getTopoShortestPath(SwitchPort src, SwitchPort dest); |
| 96 | |
| 97 | /** |
| 98 | * Test whether a route exists from a source to a destination. |
| 99 | * |
| 100 | * @param src the source node for the test. |
| 101 | * @param dest the destination node for the test. |
| 102 | * @return true if a route exists, otherwise false. |
| 103 | */ |
Pavlin Radoslavov | f83aa44 | 2013-02-26 14:09:01 -0800 | [diff] [blame] | 104 | Boolean routeExists(SwitchPort src, SwitchPort dest); |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | public interface ITopoFlowService { |
Pankaj Berde | 2497e54 | 2013-02-19 18:51:24 -0800 | [diff] [blame] | 108 | Boolean flowExists(NodePortTuple src, NodePortTuple dest); |
| 109 | List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest); |
Pankaj Berde | d1259e8 | 2013-01-23 14:10:00 -0800 | [diff] [blame] | 110 | |
| 111 | } |
| 112 | } |