blob: 3469a55a7dc2bf0cef31b84fab3f220711db01d1 [file] [log] [blame]
tomedf06bb2014-08-27 16:22:15 -07001package org.onlab.onos.net.topology;
2
tom568581d2014-09-08 20:13:36 -07003import org.onlab.onos.net.ConnectPoint;
4import org.onlab.onos.net.DeviceId;
tom13cb4852014-09-11 12:44:17 -07005import org.onlab.onos.net.Link;
tom568581d2014-09-08 20:13:36 -07006import org.onlab.onos.net.Path;
tomedf06bb2014-08-27 16:22:15 -07007
tom568581d2014-09-08 20:13:36 -07008import java.util.Set;
9
tomedf06bb2014-08-27 16:22:15 -070010/**
11 * Service for providing network topology information.
12 */
13public interface TopologyService {
14
15 /**
16 * Returns the current topology descriptor.
17 *
18 * @return current topology
19 */
20 Topology currentTopology();
21
tom568581d2014-09-08 20:13:36 -070022 /**
tomdc361b62014-09-09 20:36:52 -070023 * Indicates whether the specified topology is the latest or not.
tome52ce702014-09-11 00:12:54 -070024 *
tomdc361b62014-09-09 20:36:52 -070025 * @param topology topology descriptor
26 * @return true if the topology is the most recent; false otherwise
27 */
28 boolean isLatest(Topology topology);
29
30 /**
tom13cb4852014-09-11 12:44:17 -070031 * Returns the graph view of the specified topology.
32 *
33 * @param topology topology descriptor
34 * @return topology graph view
35 */
36 TopologyGraph getGraph(Topology topology);
37
38 /**
tom568581d2014-09-08 20:13:36 -070039 * Returns the set of clusters in the specified topology.
40 *
41 * @param topology topology descriptor
42 * @return set of topology clusters
43 */
44 Set<TopologyCluster> getClusters(Topology topology);
45
46 /**
tom13cb4852014-09-11 12:44:17 -070047 * Returns the cluster with the specified ID.
tom568581d2014-09-08 20:13:36 -070048 *
tom13cb4852014-09-11 12:44:17 -070049 * @param topology topology descriptor
50 * @param clusterId cluster identifier
51 * @return topology cluster
tom568581d2014-09-08 20:13:36 -070052 */
tom13cb4852014-09-11 12:44:17 -070053 TopologyCluster getCluster(Topology topology, ClusterId clusterId);
54
55 /**
56 * Returns the set of devices that belong to the specified cluster.
57 *
58 * @param topology topology descriptor
59 * @param cluster topology cluster
60 * @return set of cluster devices
61 */
62 Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster);
63
64 /**
65 * Returns the set of links that form the specified cluster.
66 *
67 * @param topology topology descriptor
68 * @param cluster topology cluster
69 * @return set of cluster links
70 */
71 Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster);
tom568581d2014-09-08 20:13:36 -070072
73 /**
tomcfde0622014-09-09 11:02:42 -070074 * Returns the set of all shortest paths, precomputed in terms of hop-count,
75 * between the specified source and destination devices.
tom568581d2014-09-08 20:13:36 -070076 *
77 * @param topology topology descriptor
78 * @param src source device
79 * @param dst destination device
80 * @return set of all shortest paths between the two devices
81 */
82 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst);
83
84 /**
85 * Returns the set of all shortest paths, computed using the supplied
86 * edge-weight entity, between the specified source and destination devices.
87 *
88 * @param topology topology descriptor
89 * @param src source device
90 * @param dst destination device
91 * @return set of all shortest paths between the two devices
92 */
93 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
94 LinkWeight weight);
95
96 /**
97 * Indicates whether the specified connection point is part of the network
98 * infrastructure or part of network edge.
99 *
100 * @param topology topology descriptor
101 * @param connectPoint connection point
102 * @return true of connection point is in infrastructure; false if edge
103 */
104 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
105
106
107 /**
tomcfde0622014-09-09 11:02:42 -0700108 * Indicates whether the specified connection point belong to the
109 * broadcast tree.
tom568581d2014-09-08 20:13:36 -0700110 *
111 * @param topology topology descriptor
112 * @param connectPoint connection point
113 * @return true if broadcast is permissible
114 */
115 boolean isInBroadcastTree(Topology topology, ConnectPoint connectPoint);
tomedf06bb2014-08-27 16:22:15 -0700116
117 /**
118 * Adds the specified topology listener.
119 *
120 * @param listener topology listener
121 */
122 void addListener(TopologyListener listener);
123
124 /**
125 * Removes the specified topology listener.
126 *
127 * @param listener topology listener
128 */
129 void removeListener(TopologyListener listener);
130
131}