tom | 0efbb1d | 2014-09-09 11:54:28 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.trivial.impl; |
| 2 | |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 3 | import org.onlab.graph.Graph; |
| 4 | import org.onlab.onos.event.Event; |
| 5 | import org.onlab.onos.net.ConnectPoint; |
| 6 | import org.onlab.onos.net.DeviceId; |
| 7 | import org.onlab.onos.net.Path; |
| 8 | import org.onlab.onos.net.topology.LinkWeight; |
| 9 | import org.onlab.onos.net.topology.TopoEdge; |
| 10 | import org.onlab.onos.net.topology.TopoVertex; |
| 11 | import org.onlab.onos.net.topology.Topology; |
| 12 | import org.onlab.onos.net.topology.TopologyCluster; |
| 13 | import org.onlab.onos.net.topology.TopologyDescription; |
| 14 | import org.onlab.onos.net.topology.TopologyEvent; |
| 15 | |
| 16 | import java.util.List; |
| 17 | import java.util.Set; |
| 18 | |
tom | 0efbb1d | 2014-09-09 11:54:28 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Manages inventory of topology snapshots using trivial in-memory |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 21 | * structures implementation. |
tom | 0efbb1d | 2014-09-09 11:54:28 -0700 | [diff] [blame] | 22 | */ |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 23 | class SimpleTopologyStore { |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 24 | |
| 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. |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 38 | * |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 39 | * @param topology topology descriptor |
| 40 | * @return true if topology is the most recent one |
| 41 | */ |
| 42 | boolean isLatest(Topology topology) { |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 43 | // Topology is current only if it is the same as our current topology |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 44 | 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 | */ |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 122 | TopologyEvent updateTopology(TopologyDescription topoDescription, |
| 123 | List<Event> reasons) { |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 124 | return null; |
| 125 | } |
| 126 | |
tom | 0efbb1d | 2014-09-09 11:54:28 -0700 | [diff] [blame] | 127 | } |