blob: cef6a1696df1098c9eebaf12e1056215fe964bfd [file] [log] [blame]
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -07001package net.onrc.onos.core.topology;
2
3import java.util.Collection;
4
5import net.floodlightcontroller.util.MACAddress;
6import net.onrc.onos.core.util.Dpid;
7import net.onrc.onos.core.util.PortNumber;
8import net.onrc.onos.core.util.SwitchPort;
9
10// TODO move to appropriate package. under api??
11/**
12 * BaseTopology interface common to both {@link ImmutableTopology} and {@link MutableTopology}.
13 */
Yuta HIGUCHIab9dc7b2014-08-26 22:53:13 -070014public interface BaseTopology extends BaseMastership {
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -070015
16 /**
17 * Gets the switch for a given switch DPID.
18 *
19 * @param dpid the switch dpid.
20 * @return the switch if found, otherwise null.
21 */
22 public Switch getSwitch(Dpid dpid);
23
24 /**
25 * Gets all switches in the network.
26 *
27 * @return all switches in the network.
28 */
29 public Iterable<Switch> getSwitches();
30
31 /**
32 * Gets the port on a switch.
33 *
34 * @param dpid the switch DPID.
35 * @param portNumber the switch port number.
36 * @return the switch port if found, otherwise null.
37 */
38 public Port getPort(Dpid dpid, PortNumber portNumber);
39
40 /**
41 * Gets the port on a switch.
42 *
43 * @param port port identifier
44 * @return the switch port if found, otherwise null.
45 */
46 public Port getPort(SwitchPort port);
47
48 /**
49 * Gets all ports on a switch specified.
50 *
51 * @param dpid Switch dpid
52 * @return ports.
53 */
54 public Collection<Port> getPorts(Dpid dpid);
55
56 /**
57 * Gets the outgoing link from a switch port.
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -070058 *
59 * @param dpid the switch DPID.
60 * @param portNumber the switch port number.
61 * @return the outgoing link if found, otherwise null.
62 */
63 public Link getOutgoingLink(Dpid dpid, PortNumber portNumber);
64
65 /**
66 * Gets the outgoing link from a switch port.
67 *
68 * @param dpid the switch DPID.
69 * @param portNumber the switch port number.
70 * @param type type of the link
71 * @return the outgoing link if found, otherwise null.
72 */
73 public Link getOutgoingLink(Dpid dpid, PortNumber portNumber, String type);
74
75 /**
76 * Gets the outgoing link from a switch port.
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -070077 *
78 * @param port port identifier
79 * @return the outgoing link if found, otherwise null.
80 */
81 public Link getOutgoingLink(SwitchPort port);
82
83 /**
84 * Gets the outgoing link from a switch port.
85 *
86 * @param port port identifier
87 * @param type type of the link
88 * @return the outgoing link if found, otherwise null.
89 */
90 public Link getOutgoingLink(SwitchPort port, String type);
91
92 /**
93 * Gets all the outgoing link from a switch port.
94 *
95 * @param port port identifier
96 * @return outgoing links
97 */
98 public Collection<Link> getOutgoingLinks(SwitchPort port);
99
100 /**
101 * Gets the incoming link to a switch port.
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -0700102 *
103 * @param dpid the switch DPID.
104 * @param portNumber the switch port number.
105 * @return the incoming link if found, otherwise null.
106 */
107 public Link getIncomingLink(Dpid dpid, PortNumber portNumber);
108
109 /**
110 * Gets the incoming link to a switch port.
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -0700111 *
112 * @param dpid the switch DPID.
113 * @param portNumber the switch port number.
114 * @param type type of the link
115 * @return the incoming link if found, otherwise null.
116 */
117 public Link getIncomingLink(Dpid dpid, PortNumber portNumber, String type);
118
119 /**
120 * Gets the incoming link to a switch port.
Yuta HIGUCHId92b10c2014-08-25 09:30:28 -0700121 *
122 * @param port port identifier
123 * @return the incoming link if found, otherwise null.
124 */
125 public Link getIncomingLink(SwitchPort port);
126
127 /**
128 * Gets the incoming link to a switch port.
129 *
130 * @param port port identifier
131 * @param type type of the link
132 * @return the incoming link if found, otherwise null.
133 */
134 public Link getIncomingLink(SwitchPort port, String type);
135
136 /**
137 * Gets all the incoming link from a switch port.
138 *
139 * @param port port identifier
140 * @return incoming links
141 */
142 public Collection<Link> getIncomingLinks(SwitchPort port);
143
144 /**
145 * Gets the outgoing link from a switch and a port to another switch and
146 * a port.
147 *
148 * @param srcDpid the source switch DPID.
149 * @param srcPortNumber the source switch port number.
150 * @param dstDpid the destination switch DPID.
151 * @param dstPortNumber the destination switch port number.
152 * @return the outgoing link if found, otherwise null.
153 */
154 public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
155 Dpid dstDpid, PortNumber dstPortNumber);
156
157 /**
158 * Gets the outgoing link from a switch and a port to another switch and
159 * a port.
160 *
161 * @param srcDpid the source switch DPID.
162 * @param srcPortNumber the source switch port number.
163 * @param dstDpid the destination switch DPID.
164 * @param dstPortNumber the destination switch port number.
165 * @param type type of the link
166 * @return the outgoing link if found, otherwise null.
167 */
168 public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
169 Dpid dstDpid, PortNumber dstPortNumber,
170 String type);
171
172 /**
173 * Gets all links in the network.
174 * <p/>
175 *
176 * @return all links in the network.
177 */
178 public Iterable<Link> getLinks();
179
180 /**
181 * Gets the network device for a given MAC address.
182 *
183 * @param address the MAC address to use.
184 * @return the network device for the MAC address if found, otherwise null.
185 */
186 public Host getHostByMac(MACAddress address);
187
188 /**
189 * Gets all devices in the network.
190 *
191 * @return all devices in the network
192 */
193 public Iterable<Host> getHosts();
194
195 /**
196 * Gets all devices on specified port.
197 *
198 * @param port port which the device is attached
199 * @return all devices attached to the port.
200 */
201 public Collection<Host> getHosts(SwitchPort port);
202}