Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2014-present Open Networking Laboratory |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 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.impl; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 17 | |
| 18 | import org.apache.felix.scr.annotations.Activate; |
| 19 | import org.apache.felix.scr.annotations.Component; |
| 20 | import org.apache.felix.scr.annotations.Deactivate; |
| 21 | import org.apache.felix.scr.annotations.Reference; |
| 22 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 23 | import org.apache.felix.scr.annotations.Service; |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 24 | import org.onosproject.net.DisjointPath; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 25 | import org.onosproject.net.provider.AbstractListenerProviderRegistry; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 26 | import org.onosproject.event.Event; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 27 | import org.onosproject.net.ConnectPoint; |
| 28 | import org.onosproject.net.DeviceId; |
| 29 | import org.onosproject.net.Link; |
| 30 | import org.onosproject.net.Path; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 31 | import org.onosproject.net.provider.AbstractProviderService; |
| 32 | import org.onosproject.net.topology.ClusterId; |
| 33 | import org.onosproject.net.topology.GraphDescription; |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 34 | import org.onosproject.net.topology.LinkWeigher; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 35 | import org.onosproject.net.topology.LinkWeight; |
| 36 | import org.onosproject.net.topology.Topology; |
| 37 | import org.onosproject.net.topology.TopologyCluster; |
| 38 | import org.onosproject.net.topology.TopologyEvent; |
| 39 | import org.onosproject.net.topology.TopologyGraph; |
| 40 | import org.onosproject.net.topology.TopologyListener; |
| 41 | import org.onosproject.net.topology.TopologyProvider; |
| 42 | import org.onosproject.net.topology.TopologyProviderRegistry; |
| 43 | import org.onosproject.net.topology.TopologyProviderService; |
| 44 | import org.onosproject.net.topology.TopologyService; |
| 45 | import org.onosproject.net.topology.TopologyStore; |
| 46 | import org.onosproject.net.topology.TopologyStoreDelegate; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 47 | import org.slf4j.Logger; |
| 48 | |
| 49 | import java.util.List; |
| 50 | import java.util.Set; |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 51 | import java.util.Map; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 52 | |
| 53 | import static com.google.common.base.Preconditions.checkNotNull; |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 54 | import static org.onosproject.net.topology.AdapterLinkWeigher.adapt; |
Changhoon Yoon | 541ef71 | 2015-05-23 17:18:34 +0900 | [diff] [blame] | 55 | import static org.onosproject.security.AppGuard.checkPermission; |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 56 | import static org.slf4j.LoggerFactory.getLogger; |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 57 | import static org.onosproject.security.AppPermission.Type.*; |
| 58 | |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * Provides basic implementation of the topology SB & NB APIs. |
| 62 | */ |
| 63 | @Component(immediate = true) |
| 64 | @Service |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 65 | public class TopologyManager |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 66 | extends AbstractListenerProviderRegistry<TopologyEvent, TopologyListener, |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 67 | TopologyProvider, TopologyProviderService> |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 68 | implements TopologyService, TopologyProviderRegistry { |
| 69 | |
Simon Hunt | 11a2928 | 2016-03-31 09:16:47 -0700 | [diff] [blame] | 70 | private static final String TOPOLOGY_NULL = "Topology cannot be null"; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 71 | private static final String DEVICE_ID_NULL = "Device ID cannot be null"; |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 72 | private static final String CLUSTER_ID_NULL = "Cluster ID cannot be null"; |
| 73 | private static final String CLUSTER_NULL = "Topology cluster cannot be null"; |
Simon Hunt | 11a2928 | 2016-03-31 09:16:47 -0700 | [diff] [blame] | 74 | private static final String CONNECTION_POINT_NULL = "Connection point cannot be null"; |
| 75 | private static final String LINK_WEIGHT_NULL = "Link weight cannot be null"; |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 76 | |
| 77 | private final Logger log = getLogger(getClass()); |
| 78 | |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 79 | private TopologyStoreDelegate delegate = new InternalStoreDelegate(); |
| 80 | |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 81 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 82 | protected TopologyStore store; |
tom | 0efbb1d | 2014-09-09 11:54:28 -0700 | [diff] [blame] | 83 | |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 84 | @Activate |
| 85 | public void activate() { |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 86 | store.setDelegate(delegate); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 87 | eventDispatcher.addSink(TopologyEvent.class, listenerRegistry); |
| 88 | log.info("Started"); |
| 89 | } |
| 90 | |
| 91 | @Deactivate |
| 92 | public void deactivate() { |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 93 | store.unsetDelegate(delegate); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 94 | eventDispatcher.removeSink(TopologyEvent.class); |
| 95 | log.info("Stopped"); |
| 96 | } |
| 97 | |
| 98 | @Override |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 99 | public Topology currentTopology() { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 100 | checkPermission(TOPOLOGY_READ); |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 101 | return store.currentTopology(); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | @Override |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 105 | public boolean isLatest(Topology topology) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 106 | checkPermission(TOPOLOGY_READ); |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 107 | checkNotNull(topology, TOPOLOGY_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 108 | return store.isLatest(topology); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public Set<TopologyCluster> getClusters(Topology topology) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 113 | checkPermission(TOPOLOGY_READ); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 114 | checkNotNull(topology, TOPOLOGY_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 115 | return store.getClusters(topology); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | @Override |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 119 | public TopologyCluster getCluster(Topology topology, ClusterId clusterId) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 120 | checkPermission(TOPOLOGY_READ); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 121 | checkNotNull(topology, TOPOLOGY_NULL); |
| 122 | checkNotNull(topology, CLUSTER_ID_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 123 | return store.getCluster(topology, clusterId); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 128 | checkPermission(TOPOLOGY_READ); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 129 | checkNotNull(topology, TOPOLOGY_NULL); |
| 130 | checkNotNull(topology, CLUSTER_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 131 | return store.getClusterDevices(topology, cluster); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 136 | checkPermission(TOPOLOGY_READ); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 137 | checkNotNull(topology, TOPOLOGY_NULL); |
| 138 | checkNotNull(topology, CLUSTER_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 139 | return store.getClusterLinks(topology, cluster); |
tom | 13cb485 | 2014-09-11 12:44:17 -0700 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | @Override |
tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 143 | public TopologyGraph getGraph(Topology topology) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 144 | checkPermission(TOPOLOGY_READ); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 145 | checkNotNull(topology, TOPOLOGY_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 146 | return store.getGraph(topology); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | @Override |
| 150 | public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 151 | checkPermission(TOPOLOGY_READ); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 152 | checkNotNull(topology, TOPOLOGY_NULL); |
| 153 | checkNotNull(src, DEVICE_ID_NULL); |
| 154 | checkNotNull(dst, DEVICE_ID_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 155 | return store.getPaths(topology, src, dst); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | @Override |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 159 | public Set<Path> getPaths(Topology topology, DeviceId src, |
| 160 | DeviceId dst, LinkWeight weight) { |
| 161 | return getPaths(topology, src, dst, adapt(weight)); |
| 162 | } |
| 163 | |
| 164 | @Override |
| 165 | public Set<Path> getPaths(Topology topology, DeviceId src, |
| 166 | DeviceId dst, LinkWeigher weigher) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 167 | checkPermission(TOPOLOGY_READ); |
Changhoon Yoon | 541ef71 | 2015-05-23 17:18:34 +0900 | [diff] [blame] | 168 | |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 169 | checkNotNull(topology, TOPOLOGY_NULL); |
| 170 | checkNotNull(src, DEVICE_ID_NULL); |
| 171 | checkNotNull(dst, DEVICE_ID_NULL); |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 172 | checkNotNull(weigher, "Link weight cannot be null"); |
| 173 | return store.getPaths(topology, src, dst, weigher); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | @Override |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 177 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
| 178 | DeviceId dst) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 179 | checkPermission(TOPOLOGY_READ); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 180 | checkNotNull(topology, TOPOLOGY_NULL); |
| 181 | checkNotNull(src, DEVICE_ID_NULL); |
| 182 | checkNotNull(dst, DEVICE_ID_NULL); |
| 183 | return store.getDisjointPaths(topology, src, dst); |
| 184 | } |
| 185 | |
| 186 | @Override |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 187 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 188 | DeviceId dst, |
| 189 | LinkWeight weight) { |
| 190 | return getDisjointPaths(topology, src, dst, adapt(weight)); |
| 191 | } |
| 192 | |
| 193 | @Override |
| 194 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
| 195 | DeviceId dst, |
| 196 | LinkWeigher weigher) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 197 | checkPermission(TOPOLOGY_READ); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 198 | checkNotNull(topology, TOPOLOGY_NULL); |
| 199 | checkNotNull(src, DEVICE_ID_NULL); |
| 200 | checkNotNull(dst, DEVICE_ID_NULL); |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 201 | checkNotNull(weigher, LINK_WEIGHT_NULL); |
| 202 | return store.getDisjointPaths(topology, src, dst, weigher); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | @Override |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 206 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
| 207 | DeviceId dst, |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 208 | Map<Link, Object> riskProfile) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 209 | checkPermission(TOPOLOGY_READ); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 210 | checkNotNull(topology, TOPOLOGY_NULL); |
| 211 | checkNotNull(src, DEVICE_ID_NULL); |
| 212 | checkNotNull(dst, DEVICE_ID_NULL); |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 213 | return store.getDisjointPaths(topology, src, dst, riskProfile); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | @Override |
Thomas Vachuska | 48e64e4 | 2015-09-22 15:32:55 -0700 | [diff] [blame] | 217 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
| 218 | DeviceId dst, LinkWeight weight, |
| 219 | Map<Link, Object> riskProfile) { |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 220 | return getDisjointPaths(topology, src, dst, adapt(weight), riskProfile); |
| 221 | } |
| 222 | |
| 223 | @Override |
| 224 | public Set<DisjointPath> getDisjointPaths(Topology topology, DeviceId src, |
| 225 | DeviceId dst, |
| 226 | LinkWeigher weigher, |
| 227 | Map<Link, Object> riskProfile) { |
Heedo Kang | 4a47a30 | 2016-02-29 17:40:23 +0900 | [diff] [blame] | 228 | checkPermission(TOPOLOGY_READ); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 229 | checkNotNull(topology, TOPOLOGY_NULL); |
| 230 | checkNotNull(src, DEVICE_ID_NULL); |
| 231 | checkNotNull(dst, DEVICE_ID_NULL); |
Andrey Komarov | 2398d96 | 2016-09-26 15:11:23 +0300 | [diff] [blame] | 232 | checkNotNull(weigher, LINK_WEIGHT_NULL); |
| 233 | return store.getDisjointPaths(topology, src, dst, weigher, riskProfile); |
Nikhil Cheerla | 2ec191f | 2015-07-09 12:34:54 -0700 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | @Override |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 237 | public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 238 | checkPermission(TOPOLOGY_READ); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 239 | checkNotNull(topology, TOPOLOGY_NULL); |
| 240 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 241 | return store.isInfrastructure(topology, connectPoint); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | @Override |
tom | 4d0dd3a | 2014-09-14 23:12:28 -0700 | [diff] [blame] | 245 | public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) { |
Changhoon Yoon | b856b81 | 2015-08-10 03:47:19 +0900 | [diff] [blame] | 246 | checkPermission(TOPOLOGY_READ); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 247 | checkNotNull(topology, TOPOLOGY_NULL); |
| 248 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); |
tom | 10262dd | 2014-09-19 10:51:19 -0700 | [diff] [blame] | 249 | return store.isBroadcastPoint(topology, connectPoint); |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 250 | } |
| 251 | |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 252 | // Personalized host provider service issued to the supplied provider. |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 253 | @Override |
| 254 | protected TopologyProviderService createProviderService(TopologyProvider provider) { |
| 255 | return new InternalTopologyProviderService(provider); |
| 256 | } |
| 257 | |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 258 | private class InternalTopologyProviderService |
| 259 | extends AbstractProviderService<TopologyProvider> |
| 260 | implements TopologyProviderService { |
| 261 | |
| 262 | InternalTopologyProviderService(TopologyProvider provider) { |
| 263 | super(provider); |
| 264 | } |
| 265 | |
| 266 | @Override |
tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 267 | public void topologyChanged(GraphDescription topoDescription, |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 268 | List<Event> reasons) { |
| 269 | checkNotNull(topoDescription, "Topology description cannot be null"); |
tom | cbff939 | 2014-09-10 00:45:23 -0700 | [diff] [blame] | 270 | |
tom | e52ce70 | 2014-09-11 00:12:54 -0700 | [diff] [blame] | 271 | TopologyEvent event = store.updateTopology(provider().id(), |
| 272 | topoDescription, reasons); |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 273 | if (event != null) { |
tom | 782a7cf | 2014-09-11 23:58:38 -0700 | [diff] [blame] | 274 | log.info("Topology {} changed", event.subject()); |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 275 | post(event); |
tom | dc361b6 | 2014-09-09 20:36:52 -0700 | [diff] [blame] | 276 | } |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 277 | } |
| 278 | } |
| 279 | |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 280 | // Store delegate to re-post events emitted from the store. |
| 281 | private class InternalStoreDelegate implements TopologyStoreDelegate { |
| 282 | @Override |
| 283 | public void notify(TopologyEvent event) { |
Thomas Vachuska | 42e8cce | 2015-07-29 19:25:18 -0700 | [diff] [blame] | 284 | post(event); |
tom | c78acee | 2014-09-24 15:16:55 -0700 | [diff] [blame] | 285 | } |
| 286 | } |
tom | cfde062 | 2014-09-09 11:02:42 -0700 | [diff] [blame] | 287 | } |