blob: 4063095252f59d70e651065bebbff3173c9ad771 [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
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080012/**
Jonathan Harte37e4e22014-05-13 19:12:02 -070013 * Interface of Port object in the topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080014 */
Pavlin Radoslavov1cbfcae2014-05-23 17:28:08 -070015@JsonSerialize(using = PortSerializer.class)
Yuta HIGUCHI692e68e2014-07-09 18:08:02 -070016public interface Port extends ITopologyElement, StringAttributes {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070017
18 /**
19 * Gets the data path ID (dpid) of the switch, which this port is on.
20 *
21 * @return data path ID (dpid)
22 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070023 public Dpid getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080024
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070025 /**
26 * Gets the port number of this port.
27 *
28 * @return port number
29 */
Yuta HIGUCHI8f3dfa32014-06-25 00:14:25 -070030 public PortNumber getNumber();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080031
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070032 /**
Yuta HIGUCHIcd14dda2014-07-24 09:57:22 -070033 * Gets the port number of this port.
34 *
35 * @return port number
36 */
37 public PortNumber getPortNumber();
38
39 /**
Jonathan Hart25bd53e2014-04-30 23:44:09 -070040 * Gets a {@link SwitchPort} that represents this Port's dpid and port
41 * number.
42 *
43 * @return a SwitchPort representing the Port
44 */
Yuta HIGUCHIcd14dda2014-07-24 09:57:22 -070045 public SwitchPort getSwitchPort();
Jonathan Hart25bd53e2014-04-30 23:44:09 -070046
47 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070048 * Gets the hardware address of this port.
49 * <p/>
50 * TODO Not implemented yet.
51 * TODO Should return value type be Long?
52 *
53 * @return hardware address
54 */
Ray Milkey269ffb92014-04-03 14:43:30 -070055 public Long getHardwareAddress();
Yuta HIGUCHI4bfdd532014-02-07 13:47:36 -080056
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070057 /**
58 * Description of this port.
59 * <p/>
60 * TODO Not implemented yet.
61 *
62 * @return description of this port
63 */
Ray Milkey269ffb92014-04-03 14:43:30 -070064 public String getDescription();
65
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070066 /**
67 * Gets the parent switch.
68 *
69 * @return {@link Switch} instance
70 */
Ray Milkey269ffb92014-04-03 14:43:30 -070071 public Switch getSwitch();
72
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070073 /**
74 * Gets the outgoing link from this port.
75 *
76 * @return {@link Link} if there exist a outgoing link from this,
77 * {@code null} otherwise.
78 */
Ray Milkey269ffb92014-04-03 14:43:30 -070079 public Link getOutgoingLink();
80
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070081 /**
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -070082 * Gets the outgoing link from this port.
83 *
84 * @param type type of the link
85 * @return {@link Link} if there exist a outgoing link from this,
86 * {@code null} otherwise.
87 */
88 public Link getOutgoingLink(String type);
89
90 /**
91 * Gets all the outgoing links from this port.
92 *
93 * @return Collection of {@link Link}s
94 */
95 public Collection<Link> getOutgoingLinks();
96
97 /**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070098 * Gets the incoming link to this port.
99 *
100 * @return {@link Link} if there exist a incoming link to this, {@code null}
101 * otherwise.
102 */
Ray Milkey269ffb92014-04-03 14:43:30 -0700103 public Link getIncomingLink();
104
Yuta HIGUCHI8313f0b2014-07-09 16:36:03 -0700105 /**
106 * Gets the incoming link to this port.
107 *
108 * @param type type of the link
109 * @return {@link Link} if there exist a incoming link to this, {@code null}
110 * otherwise.
111 */
112 public Link getIncomingLink(String type);
113
114 /**
115 * Gets all the incoming links to this port.
116 *
117 * @return Collection of {@link Link}s
118 */
119 public Collection<Link> getIncomingLinks();
120
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700121 /**
122 * Gets all the devices attached to this port.
123 *
Yuta HIGUCHIbfc77f02014-07-14 22:50:25 -0700124 * @return {@link Host}s attached to this port
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -0700125 */
Yuta HIGUCHI8b389a72014-07-18 13:50:00 -0700126 public Collection<Host> getHosts();
Praseed Balakrishnanfa21be12014-07-15 14:42:26 -0700127
128
129 /**
130 * Returns the port type of this port.
131 *
132 * @return {@link PortType}
133 */
134 public PortType getPortType();
Jonathan Hart062a2e82014-02-03 09:41:57 -0800135}