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