blob: 6cfc974fe499b649bb3b084a80cb62e4f0b58c37 [file] [log] [blame]
Pankaj Berded1259e82013-01-23 14:10:00 -08001package net.floodlightcontroller.core;
2
3import java.util.List;
4
Pavlin Radoslavovd7d8b792013-02-22 10:24:38 -08005import net.floodlightcontroller.core.module.IFloodlightService;
Pankaj Berde2497e542013-02-19 18:51:24 -08006import net.floodlightcontroller.core.INetMapTopologyObjects.IDeviceObject;
7import net.floodlightcontroller.core.INetMapTopologyObjects.IPortObject;
Pankaj Berde1e2f7312013-02-15 08:25:31 -08008import net.floodlightcontroller.core.INetMapTopologyObjects.ISwitchObject;
Pankaj Berded1259e82013-01-23 14:10:00 -08009import net.floodlightcontroller.routing.Link;
10import net.floodlightcontroller.topology.NodePortTuple;
Pavlin Radoslavovf83aa442013-02-26 14:09:01 -080011import net.floodlightcontroller.util.DataPath;
12import net.floodlightcontroller.util.SwitchPort;
Pankaj Berded1259e82013-01-23 14:10:00 -080013
14public interface INetMapTopologyService extends INetMapService {
15
16 public interface ITopoSwitchService {
Pankaj Berde2497e542013-02-19 18:51:24 -080017 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 Berded1259e82013-01-23 14:10:00 -080023 }
24
25 public interface ITopoLinkService {
Pankaj Berde2497e542013-02-19 18:51:24 -080026 List<Link> getActiveLinks();
27 List<Link> getLinksOnSwitch(String dpid);
Pankaj Berded1259e82013-01-23 14:10:00 -080028 }
29 public interface ITopoDeviceService {
Pankaj Berde2497e542013-02-19 18:51:24 -080030 Iterable<IDeviceObject> getActiveDevices();
31 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
32 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
Pankaj Berded1259e82013-01-23 14:10:00 -080033 }
34
Pavlin Radoslavovd7d8b792013-02-22 10:24:38 -080035 public interface ITopoRouteService extends IFloodlightService {
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070036 /**
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 Radoslavovf83aa442013-02-26 14:09:01 -080044 DataPath getShortestPath(SwitchPort src, SwitchPort dest);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070045
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 Radoslavovf83aa442013-02-26 14:09:01 -0800104 Boolean routeExists(SwitchPort src, SwitchPort dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800105 }
106
107 public interface ITopoFlowService {
Pankaj Berde2497e542013-02-19 18:51:24 -0800108 Boolean flowExists(NodePortTuple src, NodePortTuple dest);
109 List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800110
111 }
112}