Jonathan Hart | 472062d | 2014-04-03 10:56:48 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.topology; |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 2 | |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 3 | import java.util.Collection; |
| 4 | |
Yuta HIGUCHI | a7f1cdd | 2014-06-09 15:05:20 -0700 | [diff] [blame] | 5 | import net.onrc.onos.core.topology.web.serializers.PortSerializer; |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 6 | import net.onrc.onos.core.util.Dpid; |
| 7 | import net.onrc.onos.core.util.PortNumber; |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 8 | import net.onrc.onos.core.util.SwitchPort; |
Yuta HIGUCHI | a7f1cdd | 2014-06-09 15:05:20 -0700 | [diff] [blame] | 9 | |
Pavlin Radoslavov | 1cbfcae | 2014-05-23 17:28:08 -0700 | [diff] [blame] | 10 | import org.codehaus.jackson.map.annotate.JsonSerialize; |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 11 | |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 12 | /** |
Jonathan Hart | e37e4e2 | 2014-05-13 19:12:02 -0700 | [diff] [blame] | 13 | * Interface of Port object in the topology. |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 14 | */ |
Pavlin Radoslavov | 1cbfcae | 2014-05-23 17:28:08 -0700 | [diff] [blame] | 15 | @JsonSerialize(using = PortSerializer.class) |
Yuta HIGUCHI | 692e68e | 2014-07-09 18:08:02 -0700 | [diff] [blame] | 16 | public interface Port extends ITopologyElement, StringAttributes { |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 17 | |
| 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 HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 23 | public Dpid getDpid(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 24 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 25 | /** |
| 26 | * Gets the port number of this port. |
| 27 | * |
| 28 | * @return port number |
| 29 | */ |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 30 | public PortNumber getNumber(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 31 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 32 | /** |
Yuta HIGUCHI | cd14dda | 2014-07-24 09:57:22 -0700 | [diff] [blame] | 33 | * Gets the port number of this port. |
| 34 | * |
| 35 | * @return port number |
| 36 | */ |
| 37 | public PortNumber getPortNumber(); |
| 38 | |
| 39 | /** |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 40 | * Gets a {@link SwitchPort} that represents this Port's dpid and port |
| 41 | * number. |
| 42 | * |
| 43 | * @return a SwitchPort representing the Port |
| 44 | */ |
Yuta HIGUCHI | cd14dda | 2014-07-24 09:57:22 -0700 | [diff] [blame] | 45 | public SwitchPort getSwitchPort(); |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 48 | * 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 Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 55 | public Long getHardwareAddress(); |
Yuta HIGUCHI | 4bfdd53 | 2014-02-07 13:47:36 -0800 | [diff] [blame] | 56 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 57 | /** |
| 58 | * Description of this port. |
| 59 | * <p/> |
| 60 | * TODO Not implemented yet. |
| 61 | * |
| 62 | * @return description of this port |
| 63 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 64 | public String getDescription(); |
| 65 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 66 | /** |
| 67 | * Gets the parent switch. |
| 68 | * |
| 69 | * @return {@link Switch} instance |
| 70 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 71 | public Switch getSwitch(); |
| 72 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 73 | /** |
| 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 Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 79 | public Link getOutgoingLink(); |
| 80 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 81 | /** |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 82 | * 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 HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 98 | * 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 Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 103 | public Link getIncomingLink(); |
| 104 | |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 105 | /** |
| 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 HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 121 | /** |
| 122 | * Gets all the devices attached to this port. |
| 123 | * |
Yuta HIGUCHI | bfc77f0 | 2014-07-14 22:50:25 -0700 | [diff] [blame] | 124 | * @return {@link Host}s attached to this port |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 125 | */ |
Yuta HIGUCHI | 8b389a7 | 2014-07-18 13:50:00 -0700 | [diff] [blame] | 126 | public Collection<Host> getHosts(); |
Praseed Balakrishnan | fa21be1 | 2014-07-15 14:42:26 -0700 | [diff] [blame] | 127 | |
| 128 | |
| 129 | /** |
| 130 | * Returns the port type of this port. |
| 131 | * |
| 132 | * @return {@link PortType} |
| 133 | */ |
| 134 | public PortType getPortType(); |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 135 | } |