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 | |
| 12 | //TODO Everything returned by these interfaces must be either Unmodifiable view, |
| 13 | //immutable object, or a copy of the original "SB" In-memory Topology. |
| 14 | |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 15 | /** |
Jonathan Hart | e37e4e2 | 2014-05-13 19:12:02 -0700 | [diff] [blame] | 16 | * Interface of Port object in the topology. |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 17 | */ |
Pavlin Radoslavov | 1cbfcae | 2014-05-23 17:28:08 -0700 | [diff] [blame] | 18 | @JsonSerialize(using = PortSerializer.class) |
Yuta HIGUCHI | 692e68e | 2014-07-09 18:08:02 -0700 | [diff] [blame] | 19 | public interface Port extends ITopologyElement, StringAttributes { |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Gets the data path ID (dpid) of the switch, which this port is on. |
| 23 | * |
| 24 | * @return data path ID (dpid) |
| 25 | */ |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 26 | public Dpid getDpid(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 27 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Gets the port number of this port. |
| 30 | * |
| 31 | * @return port number |
| 32 | */ |
Yuta HIGUCHI | 8f3dfa3 | 2014-06-25 00:14:25 -0700 | [diff] [blame] | 33 | public PortNumber getNumber(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 34 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 35 | /** |
Yuta HIGUCHI | cd14dda | 2014-07-24 09:57:22 -0700 | [diff] [blame] | 36 | * Gets the port number of this port. |
| 37 | * |
| 38 | * @return port number |
| 39 | */ |
| 40 | public PortNumber getPortNumber(); |
| 41 | |
| 42 | /** |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 43 | * Gets a {@link SwitchPort} that represents this Port's dpid and port |
| 44 | * number. |
| 45 | * |
| 46 | * @return a SwitchPort representing the Port |
| 47 | */ |
Yuta HIGUCHI | cd14dda | 2014-07-24 09:57:22 -0700 | [diff] [blame] | 48 | public SwitchPort getSwitchPort(); |
Jonathan Hart | 25bd53e | 2014-04-30 23:44:09 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 51 | * Gets the hardware address of this port. |
| 52 | * <p/> |
| 53 | * TODO Not implemented yet. |
| 54 | * TODO Should return value type be Long? |
| 55 | * |
| 56 | * @return hardware address |
| 57 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 58 | public Long getHardwareAddress(); |
Yuta HIGUCHI | 4bfdd53 | 2014-02-07 13:47:36 -0800 | [diff] [blame] | 59 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 60 | /** |
| 61 | * Description of this port. |
| 62 | * <p/> |
| 63 | * TODO Not implemented yet. |
| 64 | * |
| 65 | * @return description of this port |
| 66 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 67 | public String getDescription(); |
| 68 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 69 | /** |
| 70 | * Gets the parent switch. |
| 71 | * |
| 72 | * @return {@link Switch} instance |
| 73 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 74 | public Switch getSwitch(); |
| 75 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 76 | /** |
| 77 | * Gets the outgoing link from this port. |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 78 | * <p/> |
| 79 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 80 | * returns it if found, else return whichever link is found first. |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 81 | * |
| 82 | * @return {@link Link} if there exist a outgoing link from this, |
| 83 | * {@code null} otherwise. |
| 84 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 85 | public Link getOutgoingLink(); |
| 86 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 87 | /** |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 88 | * Gets the outgoing link from this port. |
| 89 | * |
| 90 | * @param type type of the link |
| 91 | * @return {@link Link} if there exist a outgoing link from this, |
| 92 | * {@code null} otherwise. |
| 93 | */ |
| 94 | public Link getOutgoingLink(String type); |
| 95 | |
| 96 | /** |
| 97 | * Gets all the outgoing links from this port. |
| 98 | * |
| 99 | * @return Collection of {@link Link}s |
| 100 | */ |
| 101 | public Collection<Link> getOutgoingLinks(); |
| 102 | |
| 103 | /** |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 104 | * Gets the incoming link to this port. |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 105 | * <p/> |
| 106 | * FIXME As a temporary workaround, it will look for type "packet" and |
| 107 | * returns it if found, else return whichever link is found first. |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 108 | * |
| 109 | * @return {@link Link} if there exist a incoming link to this, {@code null} |
| 110 | * otherwise. |
| 111 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 112 | public Link getIncomingLink(); |
| 113 | |
Yuta HIGUCHI | 8313f0b | 2014-07-09 16:36:03 -0700 | [diff] [blame] | 114 | /** |
| 115 | * Gets the incoming link to this port. |
| 116 | * |
| 117 | * @param type type of the link |
| 118 | * @return {@link Link} if there exist a incoming link to this, {@code null} |
| 119 | * otherwise. |
| 120 | */ |
| 121 | public Link getIncomingLink(String type); |
| 122 | |
| 123 | /** |
| 124 | * Gets all the incoming links to this port. |
| 125 | * |
| 126 | * @return Collection of {@link Link}s |
| 127 | */ |
| 128 | public Collection<Link> getIncomingLinks(); |
| 129 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 130 | /** |
| 131 | * Gets all the devices attached to this port. |
| 132 | * |
Yuta HIGUCHI | bfc77f0 | 2014-07-14 22:50:25 -0700 | [diff] [blame] | 133 | * @return {@link Host}s attached to this port |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame] | 134 | */ |
Yuta HIGUCHI | 8b389a7 | 2014-07-18 13:50:00 -0700 | [diff] [blame] | 135 | public Collection<Host> getHosts(); |
Praseed Balakrishnan | fa21be1 | 2014-07-15 14:42:26 -0700 | [diff] [blame] | 136 | |
| 137 | |
| 138 | /** |
| 139 | * Returns the port type of this port. |
| 140 | * |
| 141 | * @return {@link PortType} |
| 142 | */ |
| 143 | public PortType getPortType(); |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 144 | } |