blob: 5d8bbdf699ac66e909313971ca5889b8a15d56d1 [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
Yuta HIGUCHI5c947272014-11-03 21:39:21 -0800106 * @param weight edge-weight entity
tom568581d2014-09-08 20:13:36 -0700107 * @return set of all shortest paths between the two devices
108 */
109 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
110 LinkWeight weight);
111
112 /**
113 * Indicates whether the specified connection point is part of the network
114 * infrastructure or part of network edge.
115 *
116 * @param topology topology descriptor
117 * @param connectPoint connection point
118 * @return true of connection point is in infrastructure; false if edge
119 */
120 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
121
122
123 /**
tom4d0dd3a2014-09-14 23:12:28 -0700124 * Indicates whether broadcast is allowed for traffic received on the
125 * specified connection point.
tom568581d2014-09-08 20:13:36 -0700126 *
127 * @param topology topology descriptor
128 * @param connectPoint connection point
129 * @return true if broadcast is permissible
130 */
tom4d0dd3a2014-09-14 23:12:28 -0700131 boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint);
tomedf06bb2014-08-27 16:22:15 -0700132
133 /**
134 * Adds the specified topology listener.
135 *
136 * @param listener topology listener
137 */
138 void addListener(TopologyListener listener);
139
140 /**
141 * Removes the specified topology listener.
142 *
143 * @param listener topology listener
144 */
145 void removeListener(TopologyListener listener);
146
147}