blob: d4507847b7a6ae00b6ee9fded27ccf8f29492163 [file] [log] [blame]
Jonathan Hart472062d2014-04-03 10:56:48 -07001package net.onrc.onos.core.topology;
Jonathan Hart062a2e82014-02-03 09:41:57 -08002
Jonathan Hart062a2e82014-02-03 09:41:57 -08003import net.floodlightcontroller.util.MACAddress;
4
5/**
6 * The northbound interface to the topology network graph. This interface
7 * is presented to the rest of ONOS. It is currently read-only, as we want
8 * only the discovery modules to be allowed to modify the topology.
Jonathan Hart062a2e82014-02-03 09:41:57 -08009 */
10public interface NetworkGraph {
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080011 /**
12 * Get the switch for a given switch DPID.
13 *
14 * @param dpid the switch dpid.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080015 * @return the switch if found, otherwise null.
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080016 */
17 public Switch getSwitch(Long dpid);
Yuta HIGUCHIc6174df2014-02-10 20:44:38 -080018
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080019 /**
20 * Get all switches in the network.
21 *
22 * @return all switches in the network.
23 */
24 public Iterable<Switch> getSwitches();
Yuta HIGUCHIc6174df2014-02-10 20:44:38 -080025
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080026 /**
27 * Get the port on a switch.
28 *
Ray Milkey269ffb92014-04-03 14:43:30 -070029 * @param dpid the switch DPID.
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080030 * @param number the switch port number.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080031 * @return the switch port if found, otherwise null.
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080032 */
33 public Port getPort(Long dpid, Long number);
34
35 /**
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080036 * Get the outgoing link for a switch and a port.
37 *
Ray Milkey269ffb92014-04-03 14:43:30 -070038 * @param dpid the switch DPID.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080039 * @param number the switch port number.
40 * @return the outgoing link if found, otherwise null.
41 */
42 public Link getLink(Long dpid, Long number);
43
44 /**
45 * Get the outgoing link from a switch and a port to another switch and
46 * a port.
47 *
Ray Milkey269ffb92014-04-03 14:43:30 -070048 * @param srcDpid the source switch DPID.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080049 * @param srcNumber the source switch port number.
Ray Milkey269ffb92014-04-03 14:43:30 -070050 * @param dstDpid the destination switch DPID.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080051 * @param dstNumber the destination switch port number.
52 * @return the outgoing link if found, otherwise null.
53 */
54 public Link getLink(Long srcDpid, Long srcNumber, Long dstDpid,
Ray Milkey269ffb92014-04-03 14:43:30 -070055 Long dstNumber);
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080056
57 /**
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080058 * Get all links in the network.
Ray Milkey269ffb92014-04-03 14:43:30 -070059 * <p/>
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080060 * TODO: Not clear if this method is needed. Remove if not used.
61 *
62 * @return all links in the network.
63 */
64 public Iterable<Link> getLinks();
65
66 /**
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080067 * Get the network device for a given MAC address.
68 *
69 * @param address the MAC address to use.
70 * @return the network device for the MAC address if found, otherwise null.
71 */
72 public Device getDeviceByMac(MACAddress address);
Ray Milkey269ffb92014-04-03 14:43:30 -070073
Jonathan Hart26f291b2014-02-18 16:57:24 -080074 /**
Ray Milkey269ffb92014-04-03 14:43:30 -070075 * Acquire a read lock on the entire topology. The topology will not
76 * change while readers have the lock. Must be released using
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080077 * {@link releaseReadLock()}. This method will block until a read lock is
Jonathan Hart26f291b2014-02-18 16:57:24 -080078 * available.
79 */
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080080 public void acquireReadLock();
Ray Milkey269ffb92014-04-03 14:43:30 -070081
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080082 /**
83 * Release the read lock on the topology.
84 */
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080085 public void releaseReadLock();
TeruU65bc5ff2014-04-23 22:22:32 -070086
87 public Iterable<Device> getDevices();
Jonathan Hart062a2e82014-02-03 09:41:57 -080088}