blob: 0f7ab961dbf77f27e8c29ea00fb3a94fcc56593e [file] [log] [blame]
Yuta HIGUCHI7c28ebb2014-08-19 00:29:30 -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/**
11 * ImmutableTopology.
12 */
13public interface ImmutableTopology {
14
15 /**
16 * Gets the switch for a given switch DPID.
17 *
18 * @param dpid the switch dpid.
19 * @return the switch if found, otherwise null.
20 */
21 public Switch getSwitch(Dpid dpid);
22
23 /**
24 * Gets all switches in the network.
25 *
26 * @return all switches in the network.
27 */
28 public Iterable<Switch> getSwitches();
29
30 /**
31 * Gets the port on a switch.
32 *
33 * @param dpid the switch DPID.
34 * @param portNumber the switch port number.
35 * @return the switch port if found, otherwise null.
36 */
37 public Port getPort(Dpid dpid, PortNumber portNumber);
38
39 /**
40 * Gets the port on a switch.
41 *
42 * @param port port identifier
43 * @return the switch port if found, otherwise null.
44 */
45 public Port getPort(SwitchPort port);
46
47 /**
48 * Gets all ports on a switch specified.
49 *
50 * @param dpid Switch dpid
51 * @return ports.
52 */
53 public Collection<Port> getPorts(Dpid dpid);
54
55 /**
56 * Gets the outgoing link from a switch port.
57 * <p/>
58 * FIXME As a temporary workaround, it will look for type "packet" and
59 * returns it if found, else return whichever link is found first.
60 *
61 * @param dpid the switch DPID.
62 * @param portNumber the switch port number.
63 * @return the outgoing link if found, otherwise null.
64 */
65 public Link getOutgoingLink(Dpid dpid, PortNumber portNumber);
66
67 /**
68 * Gets the outgoing link from a switch port.
69 *
70 * @param dpid the switch DPID.
71 * @param portNumber the switch port number.
72 * @param type type of the link
73 * @return the outgoing link if found, otherwise null.
74 */
75 public Link getOutgoingLink(Dpid dpid, PortNumber portNumber, String type);
76
77 /**
78 * Gets the outgoing link from a switch port.
79 * <p/>
80 * FIXME As a temporary workaround, it will look for type "packet" and
81 * returns it if found, else return whichever link is found first.
82 *
83 * @param port port identifier
84 * @return the outgoing link if found, otherwise null.
85 */
86 public Link getOutgoingLink(SwitchPort port);
87
88 /**
89 * Gets the outgoing link from a switch port.
90 *
91 * @param port port identifier
92 * @param type type of the link
93 * @return the outgoing link if found, otherwise null.
94 */
95 public Link getOutgoingLink(SwitchPort port, String type);
96
97 /**
98 * Gets all the outgoing link from a switch port.
99 *
100 * @param port port identifier
101 * @return outgoing links
102 */
103 public Collection<Link> getOutgoingLinks(SwitchPort port);
104
105 /**
106 * Gets the incoming link to a switch port.
107 * <p/>
108 * FIXME As a temporary workaround, it will look for type "packet" and
109 * returns it if found, else return whichever link is found first.
110 *
111 * @param dpid the switch DPID.
112 * @param portNumber the switch port number.
113 * @return the incoming link if found, otherwise null.
114 */
115 public Link getIncomingLink(Dpid dpid, PortNumber portNumber);
116
117 /**
118 * Gets the incoming link to a switch port.
119 * <p/>
120 * FIXME As a temporary workaround, it will look for type "packet" and
121 * returns it if found, else return whichever link is found first.
122 *
123 * @param dpid the switch DPID.
124 * @param portNumber the switch port number.
125 * @param type type of the link
126 * @return the incoming link if found, otherwise null.
127 */
128 public Link getIncomingLink(Dpid dpid, PortNumber portNumber, String type);
129
130 /**
131 * Gets the incoming link to a switch port.
132 * <p/>
133 * FIXME As a temporary workaround, it will look for type "packet" and
134 * returns it if found, else return whichever link is found first.
135 *
136 * @param port port identifier
137 * @return the incoming link if found, otherwise null.
138 */
139 public Link getIncomingLink(SwitchPort port);
140
141 /**
142 * Gets the incoming link to a switch port.
143 *
144 * @param port port identifier
145 * @param type type of the link
146 * @return the incoming link if found, otherwise null.
147 */
148 public Link getIncomingLink(SwitchPort port, String type);
149
150 /**
151 * Gets all the incoming link from a switch port.
152 *
153 * @param port port identifier
154 * @return incoming links
155 */
156 public Collection<Link> getIncomingLinks(SwitchPort port);
157
158 /**
159 * Gets the outgoing link from a switch and a port to another switch and
160 * a port.
161 *
162 * @param srcDpid the source switch DPID.
163 * @param srcPortNumber the source switch port number.
164 * @param dstDpid the destination switch DPID.
165 * @param dstPortNumber the destination switch port number.
166 * @return the outgoing link if found, otherwise null.
167 */
168 public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
169 Dpid dstDpid, PortNumber dstPortNumber);
170
171 /**
172 * Gets the outgoing link from a switch and a port to another switch and
173 * a port.
174 *
175 * @param srcDpid the source switch DPID.
176 * @param srcPortNumber the source switch port number.
177 * @param dstDpid the destination switch DPID.
178 * @param dstPortNumber the destination switch port number.
179 * @param type type of the link
180 * @return the outgoing link if found, otherwise null.
181 */
182 public Link getLink(Dpid srcDpid, PortNumber srcPortNumber,
183 Dpid dstDpid, PortNumber dstPortNumber,
184 String type);
185
186 /**
187 * Gets all links in the network.
188 * <p/>
189 *
190 * @return all links in the network.
191 */
192 public Iterable<Link> getLinks();
193
194 /**
195 * Gets the network device for a given MAC address.
196 *
197 * @param address the MAC address to use.
198 * @return the network device for the MAC address if found, otherwise null.
199 */
200 public Host getHostByMac(MACAddress address);
201
202 /**
203 * Gets all devices in the network.
204 *
205 * @return all devices in the network
206 */
207 public Iterable<Host> getHosts();
208
209 /**
210 * Gets all devices on specified port.
211 *
212 * @param port port which the device is attached
213 * @return all devices attached to the port.
214 */
215 public Collection<Host> getHosts(SwitchPort port);
216}