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