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