blob: adc6145823e4b1930808cb185dd4210d19e3bf2c [file] [log] [blame]
tom10262dd2014-09-19 10:51:19 -07001package org.onlab.onos.net.topology;
2
3import org.onlab.onos.event.Event;
4import org.onlab.onos.net.ConnectPoint;
5import org.onlab.onos.net.DeviceId;
6import org.onlab.onos.net.Link;
7import org.onlab.onos.net.Path;
8import org.onlab.onos.net.provider.ProviderId;
9
10import java.util.List;
11import java.util.Set;
12
13/**
tome4729872014-09-23 00:37:37 -070014 * Manages inventory of topology snapshots; not intended for direct use.
tom10262dd2014-09-19 10:51:19 -070015 */
16public interface TopologyStore {
17
18 /**
19 * Returns the current topology snapshot.
20 *
21 * @return current topology descriptor
22 */
23 Topology currentTopology();
24
25 /**
26 * Indicates whether the topology is the latest.
27 *
28 * @param topology topology descriptor
29 * @return true if topology is the most recent one
30 */
31 boolean isLatest(Topology topology);
32
33 /**
34 * Returns the immutable graph view of the current topology.
35 *
36 * @param topology topology descriptor
37 * @return graph view
38 */
39 TopologyGraph getGraph(Topology topology);
40
41 /**
42 * Returns the set of topology SCC clusters.
43 *
44 * @param topology topology descriptor
45 * @return set of clusters
46 */
47 Set<TopologyCluster> getClusters(Topology topology);
48
49 /**
50 * Returns the cluster of the specified topology.
51 *
52 * @param topology topology descriptor
53 * @param clusterId cluster identity
54 * @return topology cluster
55 */
56 TopologyCluster getCluster(Topology topology, ClusterId clusterId);
57
58 /**
59 * Returns the cluster of the specified topology.
60 *
61 * @param topology topology descriptor
62 * @param cluster topology cluster
63 * @return set of cluster links
64 */
65 Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster);
66
67 /**
68 * Returns the cluster of the specified topology.
69 *
70 * @param topology topology descriptor
71 * @param cluster topology cluster
72 * @return set of cluster links
73 */
74 Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster);
75
76 /**
77 * Returns the set of pre-computed shortest paths between src and dest.
78 *
79 * @param topology topology descriptor
80 * @param src source device
81 * @param dst destination device
82 * @return set of shortest paths
83 */
84 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst);
85
86 /**
87 * Computes and returns the set of shortest paths between src and dest.
88 *
89 * @param topology topology descriptor
90 * @param src source device
91 * @param dst destination device
92 * @param weight link weight function
93 * @return set of shortest paths
94 */
95 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
96 LinkWeight weight);
97
98 /**
99 * Indicates whether the given connect point is part of the network fabric.
100 *
101 * @param topology topology descriptor
102 * @param connectPoint connection point
103 * @return true if infrastructure; false otherwise
104 */
105 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
106
107 /**
108 * Indicates whether broadcast is allowed for traffic received on the
109 * given connection point.
110 *
111 * @param topology topology descriptor
112 * @param connectPoint connection point
113 * @return true if broadcast allowed; false otherwise
114 */
115 boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint);
116
117 /**
118 * Generates a new topology snapshot from the specified description.
119 *
120 * @param providerId provider identification
121 * @param graphDescription topology graph description
122 * @param reasons list of events that triggered the update
123 * @return topology update event or null if the description is old
124 */
125 TopologyEvent updateTopology(ProviderId providerId,
126 GraphDescription graphDescription,
127 List<Event> reasons);
128}