blob: 50feb99b32a9be2a5bb33ed1eeb0b16d69251c80 [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 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070036 * Gets a {@link SwitchPort} that represents this Port's dpid and port
37 * number.
38 *
39 * @return a SwitchPort representing the Port
40 */
41 public SwitchPort asSwitchPort();
42
43 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070044 * Gets the hardware address of this port.
45 * <p/>
46 * TODO Not implemented yet.
47 * TODO Should return value type be Long?
48 *
49 * @return hardware address
50 */
Ray Milkey269ffb92014-04-03 14:43:30 -070051 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080052
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070053 /**
54 * Description of this port.
55 * <p/>
56 * TODO Not implemented yet.
57 *
58 * @return description of this port
59 */
Ray Milkey269ffb92014-04-03 14:43:30 -070060 public String getDescription();
61
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070062 /**
63 * Gets the parent switch.
64 *
65 * @return {@link Switch} instance
66 */
Ray Milkey269ffb92014-04-03 14:43:30 -070067 public Switch getSwitch();
68
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070069 /**
70 * Gets the outgoing link from this port.
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070071 * <p/>
72 * FIXME As a temporary workaround, it will look for type "packet" and
73 * returns it if found, else return whichever link is found first.
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070074 *
75 * @return {@link Link} if there exist a outgoing link from this,
76 * {@code null} otherwise.
77 */
Ray Milkey269ffb92014-04-03 14:43:30 -070078 public Link getOutgoingLink();
79
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070080 /**
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070081 * Gets the outgoing link from this port.
82 *
83 * @param type type of the link
84 * @return {@link Link} if there exist a outgoing link from this,
85 * {@code null} otherwise.
86 */
87 public Link getOutgoingLink(String type);
88
89 /**
90 * Gets all the outgoing links from this port.
91 *
92 * @return Collection of {@link Link}s
93 */
94 public Collection<Link> getOutgoingLinks();
95
96 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070097 * Gets the incoming link to this port.
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070098 * <p/>
99 * FIXME As a temporary workaround, it will look for type "packet" and
100 * returns it if found, else return whichever link is found first.
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700101 *
102 * @return {@link Link} if there exist a incoming link to this, {@code null}
103 * otherwise.
104 */
Ray Milkey269ffb92014-04-03 14:43:30 -0700105 public Link getIncomingLink();
106
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -0700107 /**
108 * Gets the incoming link to this port.
109 *
110 * @param type type of the link
111 * @return {@link Link} if there exist a incoming link to this, {@code null}
112 * otherwise.
113 */
114 public Link getIncomingLink(String type);
115
116 /**
117 * Gets all the incoming links to this port.
118 *
119 * @return Collection of {@link Link}s
120 */
121 public Collection<Link> getIncomingLinks();
122
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700123 /**
124 * Gets all the devices attached to this port.
125 *
Yuta HIGUCHIbfc77f02014-07-14 22:50:25 -0700126 * @return {@link Host}s attached to this port
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700127 */
Yuta HIGUCHI8b389a72014-07-18 13:50:00 -0700128 public Collection<Host> getHosts();
Jonathan Hart062a2e82014-02-03 09:41:57 -0800129}