Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 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'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.topology; |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 18 | import org.onosproject.event.Event; |
| 19 | import org.onosproject.net.ConnectPoint; |
| 20 | import org.onosproject.net.DeviceId; |
| 21 | import org.onosproject.net.Link; |
| 22 | import org.onosproject.net.Path; |
| 23 | import org.onosproject.net.provider.ProviderId; |
| 24 | import org.onosproject.store.Store; |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 25 | |
| 26 | import java.util.List; |
| 27 | import java.util.Set; |
| 28 | |
| 29 | /** |
tom | e472987 | 2014-09-23 00:37:37 -0700 | [diff] [blame] | 30 | * Manages inventory of topology snapshots; not intended for direct use. |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 31 | */ |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 32 | public interface TopologyStore extends Store<TopologyEvent, TopologyStoreDelegate> { |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 33 | |
| 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 | } |