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 | a7f1cdd | 2014-06-09 15:05:20 -0700 | [diff] [blame] | 3 | import net.onrc.onos.core.topology.web.serializers.PortSerializer; |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 4 | import net.onrc.onos.core.util.Dpid; |
| 5 | import net.onrc.onos.core.util.PortNumber; |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 6 | import net.onrc.onos.core.util.SwitchPort; |
Yuta HIGUCHI | a7f1cdd | 2014-06-09 15:05:20 -0700 | [diff] [blame] | 7 | |
Pavlin Radoslavov | 1cbfcae | 2014-05-23 17:28:08 -0700 | [diff] [blame] | 8 | import org.codehaus.jackson.map.annotate.JsonSerialize; |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 9 | |
| 10 | //TODO Everything returned by these interfaces must be either Unmodifiable view, |
| 11 | //immutable object, or a copy of the original "SB" In-memory Topology. |
| 12 | |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 13 | /** |
Jonathan Hart | e37e4e2 | 2014-05-13 19:12:02 -0700 | [diff] [blame] | 14 | * Interface of Port object in the topology. |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 15 | */ |
Pavlin Radoslavov | 1cbfcae | 2014-05-23 17:28:08 -0700 | [diff] [blame] | 16 | @JsonSerialize(using = PortSerializer.class) |
Yuta HIGUCHI | db1b830 | 2014-06-26 10:50:39 -0700 | [diff] [blame] | 17 | public interface Port extends StringAttributes { |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * Gets the data path ID (dpid) of the switch, which this port is on. |
| 21 | * |
| 22 | * @return data path ID (dpid) |
| 23 | */ |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 24 | public Dpid getDpid(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 25 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Gets the port number of this port. |
| 28 | * |
| 29 | * @return port number |
| 30 | */ |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 31 | public PortNumber getNumber(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 32 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 33 | /** |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 34 | * Gets a {@link SwitchPort} that represents this Port's dpid and port |
| 35 | * number. |
| 36 | * |
| 37 | * @return a SwitchPort representing the Port |
| 38 | */ |
| 39 | public SwitchPort asSwitchPort(); |
| 40 | |
| 41 | /** |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 42 | * Gets the hardware address of this port. |
| 43 | * <p/> |
| 44 | * TODO Not implemented yet. |
| 45 | * TODO Should return value type be Long? |
| 46 | * |
| 47 | * @return hardware address |
| 48 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 49 | public Long getHardwareAddress(); |
Yuta HIGUCHI | 4bfdd53 | 2014-02-07 13:47:36 -0800 | [diff] [blame] | 50 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 51 | /** |
| 52 | * Description of this port. |
| 53 | * <p/> |
| 54 | * TODO Not implemented yet. |
| 55 | * |
| 56 | * @return description of this port |
| 57 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 58 | public String getDescription(); |
| 59 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Gets the parent switch. |
| 62 | * |
| 63 | * @return {@link Switch} instance |
| 64 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 65 | public Switch getSwitch(); |
| 66 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 67 | /** |
| 68 | * Gets the outgoing link from this port. |
| 69 | * |
| 70 | * @return {@link Link} if there exist a outgoing link from this, |
| 71 | * {@code null} otherwise. |
| 72 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 73 | public Link getOutgoingLink(); |
| 74 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 75 | /** |
| 76 | * Gets the incoming link to this port. |
| 77 | * |
| 78 | * @return {@link Link} if there exist a incoming link to this, {@code null} |
| 79 | * otherwise. |
| 80 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 81 | public Link getIncomingLink(); |
| 82 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 83 | // XXX Iterable or Collection? |
| 84 | /** |
| 85 | * Gets all the devices attached to this port. |
| 86 | * |
| 87 | * @return {@link Device}s attached to this port |
| 88 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 89 | public Iterable<Device> getDevices(); |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 90 | } |