blob: 2e428c7e9f6d7e2e46701a2118d318d44f6f50fe [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 HIGUCHI8313f0b2014-07-09 16:36:03 -07003import java.util.Collection;
4
Yuta HIGUCHIa7f1cdd2014-06-09 15:05:20 -07005import net.onrc.onos.core.topology.web.serializers.PortSerializer;
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -07006import net.onrc.onos.core.util.Dpid;
7import net.onrc.onos.core.util.PortNumber;
Jonathan Hart25bd53e2014-04-30 23:44:09 -07008import net.onrc.onos.core.util.SwitchPort;
Yuta HIGUCHIa7f1cdd2014-06-09 15:05:20 -07009
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070010import org.codehaus.jackson.map.annotate.JsonSerialize;
Jonathan Hart25bd53e2014-04-30 23:44:09 -070011
12//TODO Everything returned by these interfaces must be either Unmodifiable view,
13//immutable object, or a copy of the original "SB" In-memory Topology.
14
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080015/**
Jonathan Harte37e4e22014-05-13 19:12:02 -070016 * Interface of Port object in the topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080017 */
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070018@JsonSerialize(using = PortSerializer.class)
Yuta HIGUCHI692e68e2014-07-09 18:08:02 -070019public interface Port extends ITopologyElement, StringAttributes {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070020
21 /**
22 * Gets the data path ID (dpid) of the switch, which this port is on.
23 *
24 * @return data path ID (dpid)
25 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070026 public Dpid getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080027
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070028 /**
29 * Gets the port number of this port.
30 *
31 * @return port number
32 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070033 public PortNumber getNumber();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080034
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070035 /**
Yuta HIGUCHIcd14dda2014-07-24 09:57:22 -070036 * Gets the port number of this port.
37 *
38 * @return port number
39 */
40 public PortNumber getPortNumber();
41
42 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070043 * Gets a {@link SwitchPort} that represents this Port's dpid and port
44 * number.
45 *
46 * @return a SwitchPort representing the Port
47 */
Yuta HIGUCHIcd14dda2014-07-24 09:57:22 -070048 public SwitchPort getSwitchPort();
Jonathan Hart25bd53e2014-04-30 23:44:09 -070049
50 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070051 * Gets the hardware address of this port.
52 * <p/>
53 * TODO Not implemented yet.
54 * TODO Should return value type be Long?
55 *
56 * @return hardware address
57 */
Ray Milkey269ffb92014-04-03 14:43:30 -070058 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080059
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070060 /**
61 * Description of this port.
62 * <p/>
63 * TODO Not implemented yet.
64 *
65 * @return description of this port
66 */
Ray Milkey269ffb92014-04-03 14:43:30 -070067 public String getDescription();
68
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070069 /**
70 * Gets the parent switch.
71 *
72 * @return {@link Switch} instance
73 */
Ray Milkey269ffb92014-04-03 14:43:30 -070074 public Switch getSwitch();
75
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070076 /**
77 * Gets the outgoing link from this port.
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070078 * <p/>
79 * FIXME As a temporary workaround, it will look for type "packet" and
80 * returns it if found, else return whichever link is found first.
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070081 *
82 * @return {@link Link} if there exist a outgoing link from this,
83 * {@code null} otherwise.
84 */
Ray Milkey269ffb92014-04-03 14:43:30 -070085 public Link getOutgoingLink();
86
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070087 /**
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070088 * Gets the outgoing link from this port.
89 *
90 * @param type type of the link
91 * @return {@link Link} if there exist a outgoing link from this,
92 * {@code null} otherwise.
93 */
94 public Link getOutgoingLink(String type);
95
96 /**
97 * Gets all the outgoing links from this port.
98 *
99 * @return Collection of {@link Link}s
100 */
101 public Collection<Link> getOutgoingLinks();
102
103 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700104 * Gets the incoming link to this port.
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -0700105 * <p/>
106 * FIXME As a temporary workaround, it will look for type "packet" and
107 * returns it if found, else return whichever link is found first.
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700108 *
109 * @return {@link Link} if there exist a incoming link to this, {@code null}
110 * otherwise.
111 */
Ray Milkey269ffb92014-04-03 14:43:30 -0700112 public Link getIncomingLink();
113
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -0700114 /**
115 * Gets the incoming link to this port.
116 *
117 * @param type type of the link
118 * @return {@link Link} if there exist a incoming link to this, {@code null}
119 * otherwise.
120 */
121 public Link getIncomingLink(String type);
122
123 /**
124 * Gets all the incoming links to this port.
125 *
126 * @return Collection of {@link Link}s
127 */
128 public Collection<Link> getIncomingLinks();
129
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700130 /**
131 * Gets all the devices attached to this port.
132 *
Yuta HIGUCHIbfc77f02014-07-14 22:50:25 -0700133 * @return {@link Host}s attached to this port
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700134 */
Yuta HIGUCHI8b389a72014-07-18 13:50:00 -0700135 public Collection<Host> getHosts();
Jonathan Hart062a2e82014-02-03 09:41:57 -0800136}