blob: 58c24ad646dc7e4276f5d9fcafd75b1beaa0bfc1 [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.
17 * @return the switch if found, otherwise, null.
18 */
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.
33 * @return the switch port if found, otherwise, null.
34 */
35 public Port getPort(Long dpid, Long number);
36
37 /**
38 * Get all links in the network.
39 *
40 * TODO: Not clear if this method is needed. Remove if not used.
41 *
42 * @return all links in the network.
43 */
44 public Iterable<Link> getLinks();
45
46 /**
47 * Get all outgoing links for a switch.
48 *
49 * TODO: Not clear if this method is needed. Remove if not used.
50 * E.g, getSwitch(dpid).getOutgoingLinks() is equivalent.
51 *
52 * @param dpid the switch DPID.
53 * @return all outgoing links for a switch.
54 */
55 public Iterable<Link> getOutgoingLinksFromSwitch(Long dpid);
56
57 /**
58 * Get all incoming links for a switch.
59 *
60 * TODO: Not clear if this method is needed. Remove if not used.
61 * E.g, getSwitch(dpid).getIncomingLinks() is equivalent.
62 *
63 * @param dpid the switch DPID.
64 * @return all incoming links for a switch.
65 */
66 public Iterable<Link> getIncomingLinksFromSwitch(Long dpid);
67
68 /**
69 * 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
87 * {@link releaseLock()}. This method will block until a read lock is
88 * available.
89 */
90 public void acquireLock();
91
92 /**
93 * Release the read lock on the topology.
94 */
95 public void releaseLock();
Jonathan Hart062a2e82014-02-03 09:41:57 -080096}