blob: a5f9a204afcb862c5a6ef6780ef8a9844071d908 [file] [log] [blame]
Jonathan Hart472062d2014-04-03 10:56:48 -07001package net.onrc.onos.core.topology;
Jonathan Hart062a2e82014-02-03 09:41:57 -08002
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -07003import net.onrc.onos.core.topology.serializers.PortSerializer;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07004import net.onrc.onos.core.util.SwitchPort;
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -07005import org.codehaus.jackson.map.annotate.JsonSerialize;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07006
7//TODO Everything returned by these interfaces must be either Unmodifiable view,
8//immutable object, or a copy of the original "SB" In-memory Topology.
9
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080010/**
Jonathan Harte37e4e22014-05-13 19:12:02 -070011 * Interface of Port object in the topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080012 */
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070013@JsonSerialize(using = PortSerializer.class)
Jonathan Hart062a2e82014-02-03 09:41:57 -080014public interface Port {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070015
16 /**
17 * Gets the data path ID (dpid) of the switch, which this port is on.
18 *
19 * @return data path ID (dpid)
20 */
Ray Milkey269ffb92014-04-03 14:43:30 -070021 public Long getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080022
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070023 /**
24 * Gets the port number of this port.
25 *
26 * @return port number
27 */
Ray Milkey269ffb92014-04-03 14:43:30 -070028 public Long getNumber();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080029
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070030 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070031 * Gets a {@link SwitchPort} that represents this Port's dpid and port
32 * number.
33 *
34 * @return a SwitchPort representing the Port
35 */
36 public SwitchPort asSwitchPort();
37
38 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070039 * Gets the hardware address of this port.
40 * <p/>
41 * TODO Not implemented yet.
42 * TODO Should return value type be Long?
43 *
44 * @return hardware address
45 */
Ray Milkey269ffb92014-04-03 14:43:30 -070046 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080047
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070048 /**
49 * Description of this port.
50 * <p/>
51 * TODO Not implemented yet.
52 *
53 * @return description of this port
54 */
Ray Milkey269ffb92014-04-03 14:43:30 -070055 public String getDescription();
56
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070057 /**
58 * Gets the parent switch.
59 *
60 * @return {@link Switch} instance
61 */
Ray Milkey269ffb92014-04-03 14:43:30 -070062 public Switch getSwitch();
63
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070064 /**
65 * Gets the outgoing link from this port.
66 *
67 * @return {@link Link} if there exist a outgoing link from this,
68 * {@code null} otherwise.
69 */
Ray Milkey269ffb92014-04-03 14:43:30 -070070 public Link getOutgoingLink();
71
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070072 /**
73 * Gets the incoming link to this port.
74 *
75 * @return {@link Link} if there exist a incoming link to this, {@code null}
76 * otherwise.
77 */
Ray Milkey269ffb92014-04-03 14:43:30 -070078 public Link getIncomingLink();
79
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070080 // XXX Iterable or Collection?
81 /**
82 * Gets all the devices attached to this port.
83 *
84 * @return {@link Device}s attached to this port
85 */
Ray Milkey269ffb92014-04-03 14:43:30 -070086 public Iterable<Device> getDevices();
Jonathan Hart062a2e82014-02-03 09:41:57 -080087}