blob: 958536647970457d519c645c1ee14c8a1fde8c3b [file] [log] [blame]
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -07001package net.onrc.onos.ofcontroller.topology;
2
3import java.util.Map;
4
5import net.floodlightcontroller.core.module.IFloodlightService;
6import net.onrc.onos.ofcontroller.util.DataPath;
7import net.onrc.onos.ofcontroller.util.SwitchPort;
8
9/**
10 * Interface for providing Topology Network Service to other modules.
11 */
12public interface ITopologyNetService extends IFloodlightService {
13 /**
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070014 * Fetch the Switch and Ports info from the Titan Graph
15 * and return it for fast access during the shortest path
16 * computation.
17 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070018 * After fetching the state, method @ref getTopologyShortestPath()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070019 * can be used for fast shortest path computation.
20 *
21 * Note: There is certain cost to fetch the state, hence it should
22 * be used only when there is a large number of shortest path
23 * computations that need to be done on the same topology.
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070024 * Typically, a single call to @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070025 * should be followed by a large number of calls to
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070026 * method @ref getTopologyShortestPath().
27 * After the last @ref getTopologyShortestPath() call,
28 * method @ref dropTopology() should be used to release
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070029 * the internal state that is not needed anymore:
30 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070031 * Topology topology = topologyManager.newDatabaseTopology();
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070032 * for (int i = 0; i < 10000; i++) {
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070033 * dataPath = topologyManager.getTopologyShortestPath(topology, ...);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070034 * ...
35 * }
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070036 * topologyManager.dropTopology(shortestPathTopo);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070037 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070038 * @return the allocated topology handler.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070039 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070040 Topology newDatabaseTopology();
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070041
42 /**
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070043 * Release the topology that was populated by
44 * method @ref newDatabaseTopology().
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070045 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070046 * See the documentation for method @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070047 * for additional information and usage.
48 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070049 * @param topology the topology to release.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070050 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070051 void dropTopology(Topology topology);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070052
53 /**
54 * Get the shortest path from a source to a destination by
55 * using the pre-populated local topology state prepared
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070056 * by method @ref newDatabaseTopology().
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070057 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070058 * See the documentation for method @ref newDatabaseTopology()
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070059 * for additional information and usage.
60 *
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070061 * @param topology the topology handler to use.
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070062 * @param src the source in the shortest path computation.
63 * @param dest the destination in the shortest path computation.
64 * @return the data path with the computed shortest path if
65 * found, otherwise null.
66 */
Pavlin Radoslavov15954d42013-10-19 15:29:04 -070067 DataPath getTopologyShortestPath(Topology topology,
68 SwitchPort src, SwitchPort dest);
69
70 /**
71 * Get the shortest path from a source to a destination by using
72 * the underlying database.
73 *
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 getDatabaseShortestPath(SwitchPort src, SwitchPort dest);
Pavlin Radoslavov1278ac72013-10-16 04:43:49 -070080
81 /**
82 * Test whether a route exists from a source to a destination.
83 *
84 * @param src the source node for the test.
85 * @param dest the destination node for the test.
86 * @return true if a route exists, otherwise false.
87 */
88 Boolean routeExists(SwitchPort src, SwitchPort dest);
89}