blob: ecf217eda5bb1ad40950bbb14f99e66843b220d5 [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);
Pankaj Berde15193092013-03-21 17:30:14 -070022 void close();
Pankaj Berde2497e542013-02-19 18:51:24 -080023
Pankaj Berded1259e82013-01-23 14:10:00 -080024 }
25
26 public interface ITopoLinkService {
Pankaj Berde2497e542013-02-19 18:51:24 -080027 List<Link> getActiveLinks();
28 List<Link> getLinksOnSwitch(String dpid);
Pankaj Berde15193092013-03-21 17:30:14 -070029 void close();
Pankaj Berded1259e82013-01-23 14:10:00 -080030 }
31 public interface ITopoDeviceService {
Pankaj Berde2497e542013-02-19 18:51:24 -080032 Iterable<IDeviceObject> getActiveDevices();
33 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
34 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
Pankaj Berded1259e82013-01-23 14:10:00 -080035 }
36
Pavlin Radoslavovd7d8b792013-02-22 10:24:38 -080037 public interface ITopoRouteService extends IFloodlightService {
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070038 /**
39 * Get the shortest path from a source to a destination.
40 *
41 * @param src the source in the shortest path computation.
42 * @param dest the destination in the shortest path computation.
43 * @return the data path with the computed shortest path if
44 * found, otherwise null.
45 */
Pavlin Radoslavovf83aa442013-02-26 14:09:01 -080046 DataPath getShortestPath(SwitchPort src, SwitchPort dest);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070047
48 /**
49 * Fetch the Switch and Ports info from the Titan Graph
50 * and store it locally for fast access during the shortest path
51 * computation.
52 *
53 * After fetching the state, method @ref getTopoShortestPath()
54 * can be used for fast shortest path computation.
55 *
56 * Note: There is certain cost to fetch the state, hence it should
57 * be used only when there is a large number of shortest path
58 * computations that need to be done on the same topology.
59 * Typically, a single call to @ref prepareShortestPathTopo()
60 * should be followed by a large number of calls to
61 * method @ref getTopoShortestPath().
62 * After the last @ref getTopoShortestPath() call,
63 * method @ref dropShortestPathTopo() should be used to release
64 * the internal state that is not needed anymore:
65 *
66 * prepareShortestPathTopo();
67 * for (int i = 0; i < 10000; i++) {
68 * dataPath = getTopoShortestPath(...);
69 * ...
70 * }
71 * dropShortestPathTopo();
72 */
73 void prepareShortestPathTopo();
74
75 /**
76 * Release the state that was populated by
77 * method @ref prepareShortestPathTopo().
78 *
79 * See the documentation for method @ref prepareShortestPathTopo()
80 * for additional information and usage.
81 */
82 void dropShortestPathTopo();
83
84 /**
85 * Get the shortest path from a source to a destination by
86 * using the pre-populated local topology state prepared
87 * by method @ref prepareShortestPathTopo().
88 *
89 * See the documentation for method @ref prepareShortestPathTopo()
90 * for additional information and usage.
91 *
92 * @param src the source in the shortest path computation.
93 * @param dest the destination in the shortest path computation.
94 * @return the data path with the computed shortest path if
95 * found, otherwise null.
96 */
97 DataPath getTopoShortestPath(SwitchPort src, SwitchPort dest);
98
99 /**
100 * Test whether a route exists from a source to a destination.
101 *
102 * @param src the source node for the test.
103 * @param dest the destination node for the test.
104 * @return true if a route exists, otherwise false.
105 */
Pavlin Radoslavovf83aa442013-02-26 14:09:01 -0800106 Boolean routeExists(SwitchPort src, SwitchPort dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800107 }
108
109 public interface ITopoFlowService {
Pankaj Berde2497e542013-02-19 18:51:24 -0800110 Boolean flowExists(NodePortTuple src, NodePortTuple dest);
111 List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800112
113 }
114}