tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.topology; |
| 2 | |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 3 | import org.onlab.onos.net.ConnectPoint; |
| 4 | import org.onlab.onos.net.DeviceId; |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 5 | import org.onlab.onos.net.Link; |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 6 | import org.onlab.onos.net.Path; |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 7 | |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 8 | import java.util.Set; |
| 9 | |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 10 | /** |
| 11 | * Service for providing network topology information. |
| 12 | */ |
| 13 | public interface TopologyService { |
| 14 | |
| 15 | /** |
| 16 | * Returns the current topology descriptor. |
| 17 | * |
| 18 | * @return current topology |
| 19 | */ |
| 20 | Topology currentTopology(); |
| 21 | |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 22 | /** |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 23 | * Indicates whether the specified topology is the latest or not. |
tom | e52ce70 | 2014-09-11 00:12:54 -0700 | [diff] [blame] | 24 | * |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 25 | * @param topology topology descriptor |
| 26 | * @return true if the topology is the most recent; false otherwise |
| 27 | */ |
| 28 | boolean isLatest(Topology topology); |
| 29 | |
| 30 | /** |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 31 | * 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 | /** |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 39 | * 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 | /** |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 47 | * Returns the cluster with the specified ID. |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 48 | * |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 49 | * @param topology topology descriptor |
| 50 | * @param clusterId cluster identifier |
| 51 | * @return topology cluster |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 52 | */ |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 53 | 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); |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 72 | |
| 73 | /** |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 74 | * Returns the set of all shortest paths, precomputed in terms of hop-count, |
| 75 | * between the specified source and destination devices. |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 76 | * |
| 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 | /** |
tom | 4d0dd3a | 2014-09-14 23:12:28 -0700 | [diff] [blame] | 108 | * Indicates whether broadcast is allowed for traffic received on the |
| 109 | * specified connection point. |
tom | 568581d | 2014-09-08 20:13:36 -0700 | [diff] [blame] | 110 | * |
| 111 | * @param topology topology descriptor |
| 112 | * @param connectPoint connection point |
| 113 | * @return true if broadcast is permissible |
| 114 | */ |
tom | 4d0dd3a | 2014-09-14 23:12:28 -0700 | [diff] [blame] | 115 | boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint); |
tom | edf06bb | 2014-08-27 16:22:15 -0700 | [diff] [blame] | 116 | |
| 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 | } |