blob: 31a718b438f5527c8a195fbcef15fe5a0a39d91d [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
tomedf06bb2014-08-27 16:22:15 -070016package org.onlab.onos.net.topology;
17
tom568581d2014-09-08 20:13:36 -070018import org.onlab.onos.net.ConnectPoint;
19import org.onlab.onos.net.DeviceId;
tom13cb4852014-09-11 12:44:17 -070020import org.onlab.onos.net.Link;
tom568581d2014-09-08 20:13:36 -070021import org.onlab.onos.net.Path;
tomedf06bb2014-08-27 16:22:15 -070022
tom568581d2014-09-08 20:13:36 -070023import java.util.Set;
24
tomedf06bb2014-08-27 16:22:15 -070025/**
26 * Service for providing network topology information.
27 */
28public interface TopologyService {
29
30 /**
31 * Returns the current topology descriptor.
32 *
33 * @return current topology
34 */
35 Topology currentTopology();
36
tom568581d2014-09-08 20:13:36 -070037 /**
tomdc361b62014-09-09 20:36:52 -070038 * Indicates whether the specified topology is the latest or not.
tome52ce702014-09-11 00:12:54 -070039 *
tomdc361b62014-09-09 20:36:52 -070040 * @param topology topology descriptor
41 * @return true if the topology is the most recent; false otherwise
42 */
43 boolean isLatest(Topology topology);
44
45 /**
tom13cb4852014-09-11 12:44:17 -070046 * Returns the graph view of the specified topology.
47 *
48 * @param topology topology descriptor
49 * @return topology graph view
50 */
51 TopologyGraph getGraph(Topology topology);
52
53 /**
tom568581d2014-09-08 20:13:36 -070054 * Returns the set of clusters in the specified topology.
55 *
56 * @param topology topology descriptor
57 * @return set of topology clusters
58 */
59 Set<TopologyCluster> getClusters(Topology topology);
60
61 /**
tom13cb4852014-09-11 12:44:17 -070062 * Returns the cluster with the specified ID.
tom568581d2014-09-08 20:13:36 -070063 *
tom13cb4852014-09-11 12:44:17 -070064 * @param topology topology descriptor
65 * @param clusterId cluster identifier
66 * @return topology cluster
tom568581d2014-09-08 20:13:36 -070067 */
tom13cb4852014-09-11 12:44:17 -070068 TopologyCluster getCluster(Topology topology, ClusterId clusterId);
69
70 /**
71 * Returns the set of devices that belong to the specified cluster.
72 *
73 * @param topology topology descriptor
74 * @param cluster topology cluster
75 * @return set of cluster devices
76 */
77 Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster);
78
79 /**
80 * Returns the set of links that form the specified cluster.
81 *
82 * @param topology topology descriptor
83 * @param cluster topology cluster
84 * @return set of cluster links
85 */
86 Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster);
tom568581d2014-09-08 20:13:36 -070087
88 /**
tomcfde0622014-09-09 11:02:42 -070089 * Returns the set of all shortest paths, precomputed in terms of hop-count,
90 * between the specified source and destination devices.
tom568581d2014-09-08 20:13:36 -070091 *
92 * @param topology topology descriptor
93 * @param src source device
94 * @param dst destination device
95 * @return set of all shortest paths between the two devices
96 */
97 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst);
98
99 /**
100 * Returns the set of all shortest paths, computed using the supplied
101 * edge-weight entity, between the specified source and destination devices.
102 *
103 * @param topology topology descriptor
104 * @param src source device
105 * @param dst destination device
106 * @return set of all shortest paths between the two devices
107 */
108 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
109 LinkWeight weight);
110
111 /**
112 * Indicates whether the specified connection point is part of the network
113 * infrastructure or part of network edge.
114 *
115 * @param topology topology descriptor
116 * @param connectPoint connection point
117 * @return true of connection point is in infrastructure; false if edge
118 */
119 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
120
121
122 /**
tom4d0dd3a2014-09-14 23:12:28 -0700123 * Indicates whether broadcast is allowed for traffic received on the
124 * specified connection point.
tom568581d2014-09-08 20:13:36 -0700125 *
126 * @param topology topology descriptor
127 * @param connectPoint connection point
128 * @return true if broadcast is permissible
129 */
tom4d0dd3a2014-09-14 23:12:28 -0700130 boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint);
tomedf06bb2014-08-27 16:22:15 -0700131
132 /**
133 * Adds the specified topology listener.
134 *
135 * @param listener topology listener
136 */
137 void addListener(TopologyListener listener);
138
139 /**
140 * Removes the specified topology listener.
141 *
142 * @param listener topology listener
143 */
144 void removeListener(TopologyListener listener);
145
146}