blob: 5f635df4cc0bd7109350e99dc58b855590ec7a5d [file] [log] [blame]
Jonathan Hart472062d2014-04-03 10:56:48 -07001package net.onrc.onos.core.topology;
Jonathan Hart062a2e82014-02-03 09:41:57 -08002
3import java.util.Collection;
4
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -07005// 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 HIGUCHI181d34d2014-02-05 15:05:46 -08007/**
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -07008 * Interface of Switch object in Network Graph topology.
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -08009 */
Jonathan Hart062a2e82014-02-03 09:41:57 -080010public interface Switch {
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070011
12 /**
13 * Gets the data path ID (dpid) of this switch.
14 *
15 * @return data path ID (dpid)
16 */
Ray Milkey269ffb92014-04-03 14:43:30 -070017 public Long getDpid();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080018
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070019 /**
20 * Gets all the ports on this switch.
21 *
22 * @return Collection of {@link Port} on this switch.
23 */
Ray Milkey269ffb92014-04-03 14:43:30 -070024 public Collection<Port> getPorts();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080025
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070026 /**
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 Milkey269ffb92014-04-03 14:43:30 -070033 public Port getPort(Long number);
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080034
Ray Milkey269ffb92014-04-03 14:43:30 -070035 // Graph traversal API
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070036
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 Milkey269ffb92014-04-03 14:43:30 -070044 public Iterable<Switch> getNeighbors();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080045
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070046 /**
47 * Gets all the outgoing links.
48 *
49 * @return outgoing {@link Link}s from this switch.
50 */
Ray Milkey269ffb92014-04-03 14:43:30 -070051 public Iterable<Link> getOutgoingLinks();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080052
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070053 /**
54 * Gets all the incoming links.
55 *
56 * @return outgoing {@link Link}s from this switch.
57 */
Ray Milkey269ffb92014-04-03 14:43:30 -070058 public Iterable<Link> getIncomingLinks();
Yuta HIGUCHI181d34d2014-02-05 15:05:46 -080059
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070060 /**
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 Milkey269ffb92014-04-03 14:43:30 -070067 public Link getLinkToNeighbor(Long dpid);
68
69 // XXX Iterable or Collection?
Yuta HIGUCHIce4a06b2014-04-25 19:37:57 -070070 /**
71 * Gets all the devices attached to this switch.
72 *
73 * @return {@link Device}s attached to this switch
74 */
Ray Milkey269ffb92014-04-03 14:43:30 -070075 public Collection<Device> getDevices();
Jonathan Hart062a2e82014-02-03 09:41:57 -080076}