blob: 11f4405e7feba84cf7e61efc64cb8a3770ac65a8 [file] [log] [blame]
Jonathan Hart062a2e82014-02-03 09:41:57 -08001package net.onrc.onos.ofcontroller.networkgraph;
2
3import java.net.InetAddress;
4
5import net.floodlightcontroller.util.MACAddress;
6
7/**
8 * The northbound interface to the topology network graph. This interface
9 * is presented to the rest of ONOS. It is currently read-only, as we want
10 * only the discovery modules to be allowed to modify the topology.
Jonathan Hart062a2e82014-02-03 09:41:57 -080011 */
12public interface NetworkGraph {
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080013 /**
14 * Get the switch for a given switch DPID.
15 *
16 * @param dpid the switch dpid.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080017 * @return the switch if found, otherwise null.
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080018 */
19 public Switch getSwitch(Long dpid);
Yuta HIGUCHIc6174df2014-02-10 20:44:38 -080020
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080021 /**
22 * Get all switches in the network.
23 *
24 * @return all switches in the network.
25 */
26 public Iterable<Switch> getSwitches();
Yuta HIGUCHIc6174df2014-02-10 20:44:38 -080027
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080028 /**
29 * Get the port on a switch.
30 *
31 * @param dpid the switch DPID.
32 * @param number the switch port number.
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080033 * @return the switch port if found, otherwise null.
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080034 */
35 public Port getPort(Long dpid, Long number);
36
37 /**
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080038 * Get the outgoing link for a switch and a port.
39 *
40 * @param dpid the switch DPID.
41 * @param number the switch port number.
42 * @return the outgoing link if found, otherwise null.
43 */
44 public Link getLink(Long dpid, Long number);
45
46 /**
47 * Get the outgoing link from a switch and a port to another switch and
48 * a port.
49 *
50 * @param srcDpid the source switch DPID.
51 * @param srcNumber the source switch port number.
52 * @param dstDpid the destination switch DPID.
53 * @param dstNumber the destination switch port number.
54 * @return the outgoing link if found, otherwise null.
55 */
56 public Link getLink(Long srcDpid, Long srcNumber, Long dstDpid,
57 Long dstNumber);
58
59 /**
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080060 * Get all links in the network.
61 *
62 * TODO: Not clear if this method is needed. Remove if not used.
63 *
64 * @return all links in the network.
65 */
66 public Iterable<Link> getLinks();
67
68 /**
Pavlin Radoslavov06df22a2014-02-18 19:16:27 -080069 * Get the network devices for a given IP address.
70 *
71 * @param ipAddress the IP address to use.
72 * @return the network devices for the IP address.
73 */
74 public Iterable<Device> getDevicesByIp(InetAddress ipAddress);
75
76 /**
77 * Get the network device for a given MAC address.
78 *
79 * @param address the MAC address to use.
80 * @return the network device for the MAC address if found, otherwise null.
81 */
82 public Device getDeviceByMac(MACAddress address);
Jonathan Hart26f291b2014-02-18 16:57:24 -080083
84 /**
85 * Acquire a read lock on the entire topology. The topology will not
86 * change while readers have the lock. Must be released using
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080087 * {@link releaseReadLock()}. This method will block until a read lock is
Jonathan Hart26f291b2014-02-18 16:57:24 -080088 * available.
89 */
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080090 public void acquireReadLock();
Jonathan Hart26f291b2014-02-18 16:57:24 -080091
Pavlin Radoslavov7c8f69a2014-02-19 19:01:45 -080092 /**
93 * Release the read lock on the topology.
94 */
Pavlin Radoslavov8ffb8bf2014-02-20 15:34:26 -080095 public void releaseReadLock();
Jonathan Hart062a2e82014-02-03 09:41:57 -080096}