blob: 6adf1f4f1c3153caa89c99c8eacbd1499a2ea897 [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;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07004import net.onrc.onos.core.util.SwitchPort;
Yuta HIGUCHIa7f1cdd2014-06-09 15:05:20 -07005
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -07006import org.codehaus.jackson.map.annotate.JsonSerialize;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07007
8//TODO Everything returned by these interfaces must be either Unmodifiable view,
9//immutable object, or a copy of the original "SB" In-memory Topology.
10
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080011/**
Jonathan Harte37e4e22014-05-13 19:12:02 -070012 * Interface of Port object in the topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080013 */
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070014@JsonSerialize(using = PortSerializer.class)
Jonathan Hart062a2e82014-02-03 09:41:57 -080015public interface Port {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070016
17 /**
18 * Gets the data path ID (dpid) of the switch, which this port is on.
19 *
20 * @return data path ID (dpid)
21 */
Ray Milkey269ffb92014-04-03 14:43:30 -070022 public Long getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080023
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070024 /**
25 * Gets the port number of this port.
26 *
27 * @return port number
28 */
Ray Milkey269ffb92014-04-03 14:43:30 -070029 public Long getNumber();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080030
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070031 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070032 * Gets a {@link SwitchPort} that represents this Port's dpid and port
33 * number.
34 *
35 * @return a SwitchPort representing the Port
36 */
37 public SwitchPort asSwitchPort();
38
39 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070040 * Gets the hardware address of this port.
41 * <p/>
42 * TODO Not implemented yet.
43 * TODO Should return value type be Long?
44 *
45 * @return hardware address
46 */
Ray Milkey269ffb92014-04-03 14:43:30 -070047 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080048
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070049 /**
50 * Description of this port.
51 * <p/>
52 * TODO Not implemented yet.
53 *
54 * @return description of this port
55 */
Ray Milkey269ffb92014-04-03 14:43:30 -070056 public String getDescription();
57
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070058 /**
59 * Gets the parent switch.
60 *
61 * @return {@link Switch} instance
62 */
Ray Milkey269ffb92014-04-03 14:43:30 -070063 public Switch getSwitch();
64
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070065 /**
66 * Gets the outgoing link from this port.
67 *
68 * @return {@link Link} if there exist a outgoing link from this,
69 * {@code null} otherwise.
70 */
Ray Milkey269ffb92014-04-03 14:43:30 -070071 public Link getOutgoingLink();
72
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070073 /**
74 * Gets the incoming link to this port.
75 *
76 * @return {@link Link} if there exist a incoming link to this, {@code null}
77 * otherwise.
78 */
Ray Milkey269ffb92014-04-03 14:43:30 -070079 public Link getIncomingLink();
80
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070081 // XXX Iterable or Collection?
82 /**
83 * Gets all the devices attached to this port.
84 *
85 * @return {@link Device}s attached to this port
86 */
Ray Milkey269ffb92014-04-03 14:43:30 -070087 public Iterable<Device> getDevices();
Jonathan Hart062a2e82014-02-03 09:41:57 -080088}