blob: 983e616e09a80a9f2bfecc9cfccbb0fa6cd22224 [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 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.topology;
tom10262dd2014-09-19 10:51:19 -070017
Brian O'Connorabafb502014-12-02 22:26:20 -080018import org.onosproject.event.Event;
19import org.onosproject.net.ConnectPoint;
20import org.onosproject.net.DeviceId;
21import org.onosproject.net.Link;
22import org.onosproject.net.Path;
23import org.onosproject.net.provider.ProviderId;
24import org.onosproject.store.Store;
tom10262dd2014-09-19 10:51:19 -070025
26import java.util.List;
27import java.util.Set;
28
29/**
tome4729872014-09-23 00:37:37 -070030 * Manages inventory of topology snapshots; not intended for direct use.
tom10262dd2014-09-19 10:51:19 -070031 */
tomc78acee2014-09-24 15:16:55 -070032public interface TopologyStore extends Store<TopologyEvent, TopologyStoreDelegate> {
tom10262dd2014-09-19 10:51:19 -070033
34 /**
35 * Returns the current topology snapshot.
36 *
37 * @return current topology descriptor
38 */
39 Topology currentTopology();
40
41 /**
42 * Indicates whether the topology is the latest.
43 *
44 * @param topology topology descriptor
45 * @return true if topology is the most recent one
46 */
47 boolean isLatest(Topology topology);
48
49 /**
50 * Returns the immutable graph view of the current topology.
51 *
52 * @param topology topology descriptor
53 * @return graph view
54 */
55 TopologyGraph getGraph(Topology topology);
56
57 /**
58 * Returns the set of topology SCC clusters.
59 *
60 * @param topology topology descriptor
61 * @return set of clusters
62 */
63 Set<TopologyCluster> getClusters(Topology topology);
64
65 /**
66 * Returns the cluster of the specified topology.
67 *
68 * @param topology topology descriptor
69 * @param clusterId cluster identity
70 * @return topology cluster
71 */
72 TopologyCluster getCluster(Topology topology, ClusterId clusterId);
73
74 /**
75 * Returns the cluster of the specified topology.
76 *
77 * @param topology topology descriptor
78 * @param cluster topology cluster
79 * @return set of cluster links
80 */
81 Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster);
82
83 /**
84 * Returns the cluster of the specified topology.
85 *
86 * @param topology topology descriptor
87 * @param cluster topology cluster
88 * @return set of cluster links
89 */
90 Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster);
91
92 /**
93 * Returns the set of pre-computed shortest paths between src and dest.
94 *
95 * @param topology topology descriptor
96 * @param src source device
97 * @param dst destination device
98 * @return set of shortest paths
99 */
100 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst);
101
102 /**
103 * Computes and returns the set of shortest paths between src and dest.
104 *
105 * @param topology topology descriptor
106 * @param src source device
107 * @param dst destination device
108 * @param weight link weight function
109 * @return set of shortest paths
110 */
111 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
112 LinkWeight weight);
113
114 /**
115 * Indicates whether the given connect point is part of the network fabric.
116 *
117 * @param topology topology descriptor
118 * @param connectPoint connection point
119 * @return true if infrastructure; false otherwise
120 */
121 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint);
122
123 /**
124 * Indicates whether broadcast is allowed for traffic received on the
125 * given connection point.
126 *
127 * @param topology topology descriptor
128 * @param connectPoint connection point
129 * @return true if broadcast allowed; false otherwise
130 */
131 boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint);
132
133 /**
134 * Generates a new topology snapshot from the specified description.
135 *
136 * @param providerId provider identification
137 * @param graphDescription topology graph description
138 * @param reasons list of events that triggered the update
139 * @return topology update event or null if the description is old
140 */
141 TopologyEvent updateTopology(ProviderId providerId,
142 GraphDescription graphDescription,
143 List<Event> reasons);
144}