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 | |
| 3 | import java.util.Collection; |
| 4 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 5 | // TOOD Everything returned by these interfaces must be either Unmodifiable view, |
| 6 | // immutable object, or a copy of the original "SB" In-memory Topology. |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 7 | /** |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 8 | * Interface of Switch object in Network Graph topology. |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 9 | */ |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 10 | public interface Switch { |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 11 | |
| 12 | /** |
| 13 | * Gets the data path ID (dpid) of this switch. |
| 14 | * |
| 15 | * @return data path ID (dpid) |
| 16 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 17 | public Long getDpid(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 18 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 19 | /** |
| 20 | * Gets all the ports on this switch. |
| 21 | * |
| 22 | * @return Collection of {@link Port} on this switch. |
| 23 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 24 | public Collection<Port> getPorts(); |
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 a port on switch by port number. |
| 28 | * |
| 29 | * @param number port number |
| 30 | * @return {@link Port} with {@code number} on this switch, or {@code null} |
| 31 | * if this switch did not have a port for specified port number |
| 32 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 33 | public Port getPort(Long number); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 34 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 35 | // Graph traversal API |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 36 | |
| 37 | // XXX What is the Definition of neighbor? Link exist in both direction or |
| 38 | // one-way is sufficient to be a neighbor, etc. |
| 39 | /** |
| 40 | * Gets all the neighbor switches. |
| 41 | * |
| 42 | * @return neighbor switches |
| 43 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 44 | public Iterable<Switch> getNeighbors(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 45 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 46 | /** |
| 47 | * Gets all the outgoing links. |
| 48 | * |
| 49 | * @return outgoing {@link Link}s from this switch. |
| 50 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 51 | public Iterable<Link> getOutgoingLinks(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 52 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 53 | /** |
| 54 | * Gets all the incoming links. |
| 55 | * |
| 56 | * @return outgoing {@link Link}s from this switch. |
| 57 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 58 | public Iterable<Link> getIncomingLinks(); |
Yuta HIGUCHI | 181d34d | 2014-02-05 15:05:46 -0800 | [diff] [blame] | 59 | |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 60 | /** |
| 61 | * Gets outgoing link to specified neighbor switch specified by dpid. |
| 62 | * |
| 63 | * @param dpid data path ID of neighbor switch. |
| 64 | * @return {@link Link} to neighbor switch {@code dpid} or {@code null} if |
| 65 | * link does not exist. |
| 66 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 67 | public Link getLinkToNeighbor(Long dpid); |
| 68 | |
| 69 | // XXX Iterable or Collection? |
Yuta HIGUCHI | ce4a06b | 2014-04-25 19:37:57 -0700 | [diff] [blame^] | 70 | /** |
| 71 | * Gets all the devices attached to this switch. |
| 72 | * |
| 73 | * @return {@link Device}s attached to this switch |
| 74 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 75 | public Collection<Device> getDevices(); |
Jonathan Hart | 062a2e8 | 2014-02-03 09:41:57 -0800 | [diff] [blame] | 76 | } |