blob: 954515b0603d555303fb25f4aea6a592ab4b67aa [file] [log] [blame]
HIGUCHI Yuta20514902013-06-12 11:24:16 -07001package net.onrc.onos.ofcontroller.core;
Pankaj Berded1259e82013-01-23 14:10:00 -08002
3import java.util.List;
Pavlin Radoslavov9556b142013-05-20 21:49:04 +00004import java.util.Map;
Pankaj Berded1259e82013-01-23 14:10:00 -08005
Pavlin Radoslavovd7d8b792013-02-22 10:24:38 -08006import net.floodlightcontroller.core.module.IFloodlightService;
Pankaj Berded1259e82013-01-23 14:10:00 -08007import net.floodlightcontroller.routing.Link;
8import net.floodlightcontroller.topology.NodePortTuple;
HIGUCHI Yuta20514902013-06-12 11:24:16 -07009import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IDeviceObject;
10import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IPortObject;
11import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -070012import net.onrc.onos.ofcontroller.util.DataPath;
13import net.onrc.onos.ofcontroller.util.SwitchPort;
Pankaj Berded1259e82013-01-23 14:10:00 -080014
15public interface INetMapTopologyService extends INetMapService {
16
17 public interface ITopoSwitchService {
Pankaj Berde2497e542013-02-19 18:51:24 -080018 Iterable<ISwitchObject> getActiveSwitches();
19 Iterable<ISwitchObject> getAllSwitches();
20 Iterable<ISwitchObject> getInactiveSwitches();
21 Iterable<IPortObject> getPortsOnSwitch(String dpid);
22 IPortObject getPortOnSwitch(String dpid, short port_num);
Pankaj Berde15193092013-03-21 17:30:14 -070023 void close();
Pankaj Berde2497e542013-02-19 18:51:24 -080024
Pankaj Berded1259e82013-01-23 14:10:00 -080025 }
26
27 public interface ITopoLinkService {
Pankaj Berde2497e542013-02-19 18:51:24 -080028 List<Link> getActiveLinks();
29 List<Link> getLinksOnSwitch(String dpid);
Pankaj Berde15193092013-03-21 17:30:14 -070030 void close();
Pankaj Berded1259e82013-01-23 14:10:00 -080031 }
32 public interface ITopoDeviceService {
Pankaj Berde2497e542013-02-19 18:51:24 -080033 Iterable<IDeviceObject> getActiveDevices();
34 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid);
35 Iterable<IDeviceObject> getDevicesOnSwitch(String dpid, short port_num);
Pankaj Berded1259e82013-01-23 14:10:00 -080036 }
37
Pavlin Radoslavovd7d8b792013-02-22 10:24:38 -080038 public interface ITopoRouteService extends IFloodlightService {
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070039 /**
40 * Get the shortest path from a source to a destination.
41 *
42 * @param src the source in the shortest path computation.
43 * @param dest the destination in the shortest path computation.
44 * @return the data path with the computed shortest path if
45 * found, otherwise null.
46 */
Pavlin Radoslavovf83aa442013-02-26 14:09:01 -080047 DataPath getShortestPath(SwitchPort src, SwitchPort dest);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070048
49 /**
50 * Fetch the Switch and Ports info from the Titan Graph
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000051 * and return it for fast access during the shortest path
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070052 * computation.
53 *
54 * After fetching the state, method @ref getTopoShortestPath()
55 * can be used for fast shortest path computation.
56 *
57 * Note: There is certain cost to fetch the state, hence it should
58 * be used only when there is a large number of shortest path
59 * computations that need to be done on the same topology.
60 * Typically, a single call to @ref prepareShortestPathTopo()
61 * should be followed by a large number of calls to
62 * method @ref getTopoShortestPath().
63 * After the last @ref getTopoShortestPath() call,
64 * method @ref dropShortestPathTopo() should be used to release
65 * the internal state that is not needed anymore:
66 *
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000067 * Map<Long, ?> shortestPathTopo;
68 * shortestPathTopo = prepareShortestPathTopo();
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070069 * for (int i = 0; i < 10000; i++) {
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000070 * dataPath = getTopoShortestPath(shortestPathTopo, ...);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070071 * ...
72 * }
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000073 * dropShortestPathTopo(shortestPathTopo);
74 *
75 * @return the Shortest Path info handler stored in a map.
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070076 */
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000077 Map<Long, ?> prepareShortestPathTopo();
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070078
79 /**
80 * Release the state that was populated by
81 * method @ref prepareShortestPathTopo().
82 *
83 * See the documentation for method @ref prepareShortestPathTopo()
84 * for additional information and usage.
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000085 *
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070086 * @param shortestPathTopo the Shortest Path info handler to release.
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070087 */
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000088 void dropShortestPathTopo(Map<Long, ?> shortestPathTopo);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -070089
90 /**
91 * Get the shortest path from a source to a destination by
92 * using the pre-populated local topology state prepared
93 * by method @ref prepareShortestPathTopo().
94 *
95 * See the documentation for method @ref prepareShortestPathTopo()
96 * for additional information and usage.
97 *
HIGUCHI Yutaeb567aa2013-10-08 19:27:35 -070098 * @param shortestPathTopo the Shortest Path info handler
Pavlin Radoslavov9556b142013-05-20 21:49:04 +000099 * to use.
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -0700100 * @param src the source in the shortest path computation.
101 * @param dest the destination in the shortest path computation.
102 * @return the data path with the computed shortest path if
103 * found, otherwise null.
104 */
Pavlin Radoslavov9556b142013-05-20 21:49:04 +0000105 DataPath getTopoShortestPath(Map<Long, ?> shortestPathTopo,
106 SwitchPort src, SwitchPort dest);
Pavlin Radoslavova5f167b2013-03-21 11:39:27 -0700107
108 /**
109 * Test whether a route exists from a source to a destination.
110 *
111 * @param src the source node for the test.
112 * @param dest the destination node for the test.
113 * @return true if a route exists, otherwise false.
114 */
Pavlin Radoslavovf83aa442013-02-26 14:09:01 -0800115 Boolean routeExists(SwitchPort src, SwitchPort dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800116 }
117
118 public interface ITopoFlowService {
Pankaj Berde2497e542013-02-19 18:51:24 -0800119 Boolean flowExists(NodePortTuple src, NodePortTuple dest);
120 List<NodePortTuple> getShortestFlowPath(NodePortTuple src, NodePortTuple dest);
Pankaj Berded1259e82013-01-23 14:10:00 -0800121
122 }
123}