blob: 1b9766d9984cb94dc8695a278bdb39d6f09a1bed [file] [log] [blame]
tom8bf2e6b2014-09-10 20:53:54 -07001package org.onlab.onos.net.trivial.topology.impl;
tom0efbb1d2014-09-09 11:54:28 -07002
tomdc361b62014-09-09 20:36:52 -07003import org.onlab.graph.Graph;
4import org.onlab.onos.event.Event;
5import org.onlab.onos.net.ConnectPoint;
6import org.onlab.onos.net.DeviceId;
7import org.onlab.onos.net.Path;
8import org.onlab.onos.net.topology.LinkWeight;
9import org.onlab.onos.net.topology.TopoEdge;
10import org.onlab.onos.net.topology.TopoVertex;
11import org.onlab.onos.net.topology.Topology;
12import org.onlab.onos.net.topology.TopologyCluster;
13import org.onlab.onos.net.topology.TopologyDescription;
14import org.onlab.onos.net.topology.TopologyEvent;
15
16import java.util.List;
17import java.util.Set;
18
tom0efbb1d2014-09-09 11:54:28 -070019/**
20 * Manages inventory of topology snapshots using trivial in-memory
tomcbff9392014-09-10 00:45:23 -070021 * structures implementation.
tom0efbb1d2014-09-09 11:54:28 -070022 */
tomcbff9392014-09-10 00:45:23 -070023class SimpleTopologyStore {
tomdc361b62014-09-09 20:36:52 -070024
25 private volatile DefaultTopology current;
26
27 /**
28 * Returns the current topology snapshot.
29 *
30 * @return current topology descriptor
31 */
32 Topology currentTopology() {
33 return current;
34 }
35
36 /**
37 * Indicates whether the topology is the latest.
tomcbff9392014-09-10 00:45:23 -070038 *
tomdc361b62014-09-09 20:36:52 -070039 * @param topology topology descriptor
40 * @return true if topology is the most recent one
41 */
42 boolean isLatest(Topology topology) {
tomcbff9392014-09-10 00:45:23 -070043 // Topology is current only if it is the same as our current topology
tomdc361b62014-09-09 20:36:52 -070044 return topology == current;
45 }
46
47 /**
48 * Returns the set of topology SCC clusters.
49 *
50 * @param topology topology descriptor
51 * @return set of clusters
52 */
53 Set<TopologyCluster> getClusters(Topology topology) {
54 return null;
55 }
56
57 /**
58 * Returns the immutable graph view of the current topology.
59 *
60 * @param topology topology descriptor
61 * @return graph view
62 */
63 Graph<TopoVertex, TopoEdge> getGraph(Topology topology) {
64 return null;
65 }
66
67 /**
68 * Returns the set of pre-computed shortest paths between src and dest.
69 *
70 * @param topology topology descriptor
71 * @param src source device
72 * @param dst destination device
73 * @return set of shortest paths
74 */
75 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) {
76 return null;
77 }
78
79 /**
80 * Computes and returns the set of shortest paths between src and dest.
81 *
82 * @param topology topology descriptor
83 * @param src source device
84 * @param dst destination device
85 * @param weight link weight function
86 * @return set of shortest paths
87 */
88 Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst,
89 LinkWeight weight) {
90 return null;
91 }
92
93 /**
94 * Indicates whether the given connect point is part of the network fabric.
95 *
96 * @param topology topology descriptor
97 * @param connectPoint connection point
98 * @return true if infrastructure; false otherwise
99 */
100 boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) {
101 return false;
102 }
103
104 /**
105 * Indicates whether the given connect point is part of the broadcast tree.
106 *
107 * @param topology topology descriptor
108 * @param connectPoint connection point
109 * @return true if in broadcast tree; false otherwise
110 */
111 boolean isInBroadcastTree(Topology topology, ConnectPoint connectPoint) {
112 return false;
113 }
114
115 /**
116 * Generates a new topology snapshot from the specified description.
117 *
118 * @param topoDescription topology description
119 * @param reasons list of events that triggered the update
120 * @return topology update event or null if the description is old
121 */
tomcbff9392014-09-10 00:45:23 -0700122 TopologyEvent updateTopology(TopologyDescription topoDescription,
123 List<Event> reasons) {
tomdc361b62014-09-09 20:36:52 -0700124 return null;
125 }
126
tom0efbb1d2014-09-09 11:54:28 -0700127}