blob: 0ca5cce7cc808d33ba4aa065b952995bcd93a963 [file] [log] [blame]
Jonathan Hart472062d2014-04-03 10:56:48 -07001package net.onrc.onos.core.topology;
Jonathan Hart062a2e82014-02-03 09:41:57 -08002
Yuta HIGUCHIa7f1cdd2014-06-09 15:05:20 -07003import net.onrc.onos.core.topology.web.serializers.PortSerializer;
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -07004import net.onrc.onos.core.util.Dpid;
5import net.onrc.onos.core.util.PortNumber;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07006import net.onrc.onos.core.util.SwitchPort;
Yuta HIGUCHIa7f1cdd2014-06-09 15:05:20 -07007
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -07008import org.codehaus.jackson.map.annotate.JsonSerialize;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07009
10//TODO Everything returned by these interfaces must be either Unmodifiable view,
11//immutable object, or a copy of the original "SB" In-memory Topology.
12
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080013/**
Jonathan Harte37e4e22014-05-13 19:12:02 -070014 * Interface of Port object in the topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080015 */
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070016@JsonSerialize(using = PortSerializer.class)
Yuta HIGUCHI692e68e2014-07-09 18:08:02 -070017public interface Port extends ITopologyElement, StringAttributes {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070018
19 /**
20 * Gets the data path ID (dpid) of the switch, which this port is on.
21 *
22 * @return data path ID (dpid)
23 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070024 public Dpid getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080025
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070026 /**
27 * Gets the port number of this port.
28 *
29 * @return port number
30 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070031 public PortNumber getNumber();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080032
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070033 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070034 * Gets a {@link SwitchPort} that represents this Port's dpid and port
35 * number.
36 *
37 * @return a SwitchPort representing the Port
38 */
39 public SwitchPort asSwitchPort();
40
41 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070042 * Gets the hardware address of this port.
43 * <p/>
44 * TODO Not implemented yet.
45 * TODO Should return value type be Long?
46 *
47 * @return hardware address
48 */
Ray Milkey269ffb92014-04-03 14:43:30 -070049 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080050
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070051 /**
52 * Description of this port.
53 * <p/>
54 * TODO Not implemented yet.
55 *
56 * @return description of this port
57 */
Ray Milkey269ffb92014-04-03 14:43:30 -070058 public String getDescription();
59
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070060 /**
61 * Gets the parent switch.
62 *
63 * @return {@link Switch} instance
64 */
Ray Milkey269ffb92014-04-03 14:43:30 -070065 public Switch getSwitch();
66
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070067 /**
68 * Gets the outgoing link from this port.
69 *
70 * @return {@link Link} if there exist a outgoing link from this,
71 * {@code null} otherwise.
72 */
Ray Milkey269ffb92014-04-03 14:43:30 -070073 public Link getOutgoingLink();
74
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070075 /**
76 * Gets the incoming link to this port.
77 *
78 * @return {@link Link} if there exist a incoming link to this, {@code null}
79 * otherwise.
80 */
Ray Milkey269ffb92014-04-03 14:43:30 -070081 public Link getIncomingLink();
82
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070083 // XXX Iterable or Collection?
84 /**
85 * Gets all the devices attached to this port.
86 *
87 * @return {@link Device}s attached to this port
88 */
Ray Milkey269ffb92014-04-03 14:43:30 -070089 public Iterable<Device> getDevices();
Jonathan Hart062a2e82014-02-03 09:41:57 -080090}