blob: 4269eac7003a88944e458db9388c0246466e8cc5 [file] [log] [blame]
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -07001package net.onrc.onos.ofcontroller.topology;
2
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -07003import net.floodlightcontroller.core.module.IFloodlightService;
4import net.onrc.onos.ofcontroller.util.DataPath;
5import net.onrc.onos.ofcontroller.util.SwitchPort;
6
7/**
8 * Interface for providing Topology Network Service to other modules.
9 */
10public interface ITopologyNetService extends IFloodlightService {
11 /**
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070012 * Fetch the Switch and Ports info from the Titan Graph
13 * and return it for fast access during the shortest path
14 * computation.
15 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070016 * After fetching the state, method @ref getTopologyShortestPath()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070017 * can be used for fast shortest path computation.
18 *
19 * Note: There is certain cost to fetch the state, hence it should
20 * be used only when there is a large number of shortest path
21 * computations that need to be done on the same topology.
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070022 * Typically, a single call to @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070023 * should be followed by a large number of calls to
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070024 * method @ref getTopologyShortestPath().
25 * After the last @ref getTopologyShortestPath() call,
26 * method @ref dropTopology() should be used to release
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070027 * the internal state that is not needed anymore:
28 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070029 * Topology topology = topologyManager.newDatabaseTopology();
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070030 * for (int i = 0; i < 10000; i++) {
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070031 * dataPath = topologyManager.getTopologyShortestPath(topology, ...);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070032 * ...
33 * }
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070034 * topologyManager.dropTopology(shortestPathTopo);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070035 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070036 * @return the allocated topology handler.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070037 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070038 Topology newDatabaseTopology();
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070039
40 /**
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070041 * Release the topology that was populated by
42 * method @ref newDatabaseTopology().
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070043 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070044 * See the documentation for method @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070045 * for additional information and usage.
46 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070047 * @param topology the topology to release.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070048 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070049 void dropTopology(Topology topology);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070050
51 /**
52 * Get the shortest path from a source to a destination by
53 * using the pre-populated local topology state prepared
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070054 * by method @ref newDatabaseTopology().
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070055 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070056 * See the documentation for method @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070057 * for additional information and usage.
58 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070059 * @param topology the topology handler to use.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070060 * @param src the source in the shortest path computation.
61 * @param dest the destination in the shortest path computation.
62 * @return the data path with the computed shortest path if
63 * found, otherwise null.
64 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070065 DataPath getTopologyShortestPath(Topology topology,
66 SwitchPort src, SwitchPort dest);
67
68 /**
69 * Get the shortest path from a source to a destination by using
70 * the underlying database.
71 *
72 * @param src the source in the shortest path computation.
73 * @param dest the destination in the shortest path computation.
74 * @return the data path with the computed shortest path if
75 * found, otherwise null.
76 */
77 DataPath getDatabaseShortestPath(SwitchPort src, SwitchPort dest);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070078
79 /**
80 * Test whether a route exists from a source to a destination.
81 *
82 * @param src the source node for the test.
83 * @param dest the destination node for the test.
84 * @return true if a route exists, otherwise false.
85 */
86 Boolean routeExists(SwitchPort src, SwitchPort dest);
87}