blob: 4df3f21c4495d5843e334160f0cfddc8cef4ffc0 [file] [log] [blame]
Thomas Vachuska96d55b12015-05-11 08:52:03 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuska96d55b12015-05-11 08:52:03 -07003 *
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 */
Thomas Vachuska4998caa2015-08-26 13:28:38 -070016package org.onosproject.store.config.impl;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070017
Thomas Vachuska0a400ea2015-09-04 11:25:03 -070018import com.fasterxml.jackson.databind.JsonNode;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070019import com.fasterxml.jackson.databind.ObjectMapper;
Jonathan Hart111b42b2015-07-14 13:28:05 -070020import com.fasterxml.jackson.databind.node.ArrayNode;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070021import com.fasterxml.jackson.databind.node.BooleanNode;
22import com.fasterxml.jackson.databind.node.DoubleNode;
Ayaka Koshibe1a002512015-09-03 13:09:23 -070023import com.fasterxml.jackson.databind.node.IntNode;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070024import com.fasterxml.jackson.databind.node.JsonNodeFactory;
25import com.fasterxml.jackson.databind.node.LongNode;
HIGUCHI Yutad9fe3a32015-11-24 18:52:25 -080026import com.fasterxml.jackson.databind.node.NullNode;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070027import com.fasterxml.jackson.databind.node.ObjectNode;
28import com.fasterxml.jackson.databind.node.ShortNode;
29import com.fasterxml.jackson.databind.node.TextNode;
30import com.google.common.collect.ImmutableSet;
31import com.google.common.collect.Maps;
32import org.apache.felix.scr.annotations.Activate;
33import org.apache.felix.scr.annotations.Component;
34import org.apache.felix.scr.annotations.Deactivate;
35import org.apache.felix.scr.annotations.Reference;
36import org.apache.felix.scr.annotations.ReferenceCardinality;
37import org.apache.felix.scr.annotations.Service;
38import org.onlab.util.KryoNamespace;
Thomas Vachuska5f2cbe62015-07-30 15:10:34 -070039import org.onlab.util.Tools;
Ray Milkeya4122362015-08-18 15:19:08 -070040import org.onosproject.net.config.Config;
41import org.onosproject.net.config.ConfigApplyDelegate;
42import org.onosproject.net.config.ConfigFactory;
43import org.onosproject.net.config.NetworkConfigEvent;
44import org.onosproject.net.config.NetworkConfigStore;
45import org.onosproject.net.config.NetworkConfigStoreDelegate;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070046import org.onosproject.store.AbstractStore;
47import org.onosproject.store.serializers.KryoNamespaces;
48import org.onosproject.store.service.ConsistentMap;
Thomas Vachuska5f2cbe62015-07-30 15:10:34 -070049import org.onosproject.store.service.ConsistentMapException;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070050import org.onosproject.store.service.MapEvent;
51import org.onosproject.store.service.MapEventListener;
52import org.onosproject.store.service.Serializer;
53import org.onosproject.store.service.StorageService;
54import org.onosproject.store.service.Versioned;
55import org.slf4j.Logger;
56import org.slf4j.LoggerFactory;
57
58import java.util.LinkedHashMap;
59import java.util.Map;
60import java.util.Objects;
61import java.util.Set;
62
Thomas Vachuskace0bbb32015-11-18 16:56:10 -080063import static com.google.common.base.Preconditions.checkArgument;
Jonathan Hartb11c4d02016-03-23 09:05:44 -070064import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_ADDED;
65import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REGISTERED;
66import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_REMOVED;
67import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UNREGISTERED;
68import static org.onosproject.net.config.NetworkConfigEvent.Type.CONFIG_UPDATED;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070069
70/**
71 * Implementation of a distributed network configuration store.
72 */
73@Component(immediate = true)
74@Service
75public class DistributedNetworkConfigStore
76 extends AbstractStore<NetworkConfigEvent, NetworkConfigStoreDelegate>
77 implements NetworkConfigStore {
78
79 private final Logger log = LoggerFactory.getLogger(getClass());
80
Thomas Vachuskace0bbb32015-11-18 16:56:10 -080081 private static final int MAX_BACKOFF = 10;
82 private static final String INVALID_CONFIG_JSON =
83 "JSON node does not contain valid configuration";
Jonathan Hartb11c4d02016-03-23 09:05:44 -070084 private static final String INVALID_JSON_LIST =
85 "JSON node is not a list for list type config";
86 private static final String INVALID_JSON_OBJECT =
87 "JSON node is not an object for object type config";
Thomas Vachuskace0bbb32015-11-18 16:56:10 -080088
Thomas Vachuska96d55b12015-05-11 08:52:03 -070089 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
90 protected StorageService storageService;
91
Thomas Vachuska0a400ea2015-09-04 11:25:03 -070092 private ConsistentMap<ConfigKey, JsonNode> configs;
Thomas Vachuska96d55b12015-05-11 08:52:03 -070093
94 private final Map<String, ConfigFactory> factoriesByConfig = Maps.newConcurrentMap();
95 private final ObjectMapper mapper = new ObjectMapper();
96 private final ConfigApplyDelegate applyDelegate = new InternalApplyDelegate();
Thomas Vachuska0a400ea2015-09-04 11:25:03 -070097 private final MapEventListener<ConfigKey, JsonNode> listener = new InternalMapListener();
Thomas Vachuska96d55b12015-05-11 08:52:03 -070098
99 @Activate
100 public void activate() {
101 KryoNamespace.Builder kryoBuilder = new KryoNamespace.Builder()
102 .register(KryoNamespaces.API)
Jonathan Hart111b42b2015-07-14 13:28:05 -0700103 .register(ConfigKey.class, ObjectNode.class, ArrayNode.class,
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700104 JsonNodeFactory.class, LinkedHashMap.class,
105 TextNode.class, BooleanNode.class,
HIGUCHI Yutad9fe3a32015-11-24 18:52:25 -0800106 LongNode.class, DoubleNode.class, ShortNode.class, IntNode.class,
107 NullNode.class);
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700108
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700109 configs = storageService.<ConfigKey, JsonNode>consistentMapBuilder()
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700110 .withSerializer(Serializer.using(kryoBuilder.build()))
111 .withName("onos-network-configs")
Madan Jampani3d6a2f62015-08-12 07:19:07 -0700112 .withRelaxedReadConsistency()
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700113 .build();
114 configs.addListener(listener);
115 log.info("Started");
116 }
117
118 @Deactivate
119 public void deactivate() {
120 configs.removeListener(listener);
121 log.info("Stopped");
122 }
123
124 @Override
125 public void addConfigFactory(ConfigFactory configFactory) {
126 factoriesByConfig.put(configFactory.configClass().getName(), configFactory);
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800127 processPendingConfigs(configFactory);
Thomas Vachuskae6360222015-07-21 10:10:36 -0700128 notifyDelegate(new NetworkConfigEvent(CONFIG_REGISTERED, configFactory.configKey(),
129 configFactory.configClass()));
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700130 }
131
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800132 // Sweep through any pending configurations, validate them and then prune them.
133 private void processPendingConfigs(ConfigFactory configFactory) {
Thomas Vachuska096bcc82016-03-07 21:30:29 -0800134 ImmutableSet.copyOf(configs.keySet()).forEach(k -> {
135 if (Objects.equals(k.configKey, configFactory.configKey()) &&
136 isAssignableFrom(configFactory, k)) {
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800137 validateConfig(k, configFactory, configs.get(k).value());
Thomas Vachuska096bcc82016-03-07 21:30:29 -0800138 configs.remove(k); // Prune whether valid or not
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800139 }
140 });
Thomas Vachuska096bcc82016-03-07 21:30:29 -0800141 }
142
143 @SuppressWarnings("unchecked")
144 private boolean isAssignableFrom(ConfigFactory configFactory, ConfigKey k) {
145 return configFactory.subjectFactory().subjectClass().isAssignableFrom(k.subject.getClass());
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800146 }
147
148 @SuppressWarnings("unchecked")
149 private void validateConfig(ConfigKey key, ConfigFactory configFactory, JsonNode json) {
HIGUCHI Yutaca2208d2016-02-18 15:03:08 -0800150 Object subject;
151 if (key.subject instanceof String) {
152 subject = configFactory.subjectFactory().createSubject((String) key.subject);
153 } else {
154 subject = key.subject;
155 }
156 Config config = createConfig(subject, configFactory.configClass(), json);
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800157 try {
158 checkArgument(config.isValid(), INVALID_CONFIG_JSON);
HIGUCHI Yutaca2208d2016-02-18 15:03:08 -0800159 configs.putAndGet(key(subject, configFactory.configClass()), json);
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800160 } catch (Exception e) {
161 log.warn("Failed to validate pending {} configuration for {}: {}",
HIGUCHI Yutaca2208d2016-02-18 15:03:08 -0800162 key.configKey, key.subject, json);
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800163 }
164 }
165
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700166 @Override
167 public void removeConfigFactory(ConfigFactory configFactory) {
168 factoriesByConfig.remove(configFactory.configClass().getName());
Thomas Vachuskae6360222015-07-21 10:10:36 -0700169 notifyDelegate(new NetworkConfigEvent(CONFIG_UNREGISTERED, configFactory.configKey(),
170 configFactory.configClass()));
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700171 }
172
173 @Override
174 @SuppressWarnings("unchecked")
175 public <S, C extends Config<S>> ConfigFactory<S, C> getConfigFactory(Class<C> configClass) {
HIGUCHI Yutaca2208d2016-02-18 15:03:08 -0800176 return factoriesByConfig.get(configClass.getName());
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700177 }
178
179 @Override
180 @SuppressWarnings("unchecked")
181 public <S> Set<S> getSubjects(Class<S> subjectClass) {
182 ImmutableSet.Builder<S> builder = ImmutableSet.builder();
183 configs.keySet().forEach(k -> {
184 if (subjectClass.isInstance(k.subject)) {
185 builder.add((S) k.subject);
186 }
187 });
188 return builder.build();
189 }
190
191 @Override
192 @SuppressWarnings("unchecked")
193 public <S, C extends Config<S>> Set<S> getSubjects(Class<S> subjectClass, Class<C> configClass) {
194 ImmutableSet.Builder<S> builder = ImmutableSet.builder();
195 String cName = configClass.getName();
196 configs.keySet().forEach(k -> {
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800197 if (subjectClass.isInstance(k.subject) && Objects.equals(cName, k.configClass)) {
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700198 builder.add((S) k.subject);
199 }
200 });
201 return builder.build();
202 }
203
204 @Override
205 @SuppressWarnings("unchecked")
206 public <S> Set<Class<? extends Config<S>>> getConfigClasses(S subject) {
207 ImmutableSet.Builder<Class<? extends Config<S>>> builder = ImmutableSet.builder();
208 configs.keySet().forEach(k -> {
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800209 if (Objects.equals(subject, k.subject) && k.configClass != null && delegate != null) {
Jonathan Hart80fe4422016-05-24 18:47:37 -0700210 ConfigFactory<S, ? extends Config<S>> configFactory = factoriesByConfig.get(k.configClass);
211 if (configFactory == null) {
212 log.error("Found config but no config factory: subject={}, configClass={}",
213 subject, k.configClass);
214 }
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700215 builder.add(factoriesByConfig.get(k.configClass).configClass());
216 }
217 });
218 return builder.build();
219 }
220
221 @Override
222 public <S, T extends Config<S>> T getConfig(S subject, Class<T> configClass) {
Madan Jampania29c6772015-08-17 13:17:07 -0700223 // TODO: need to identify and address the root cause for timeouts.
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700224 Versioned<JsonNode> json = Tools.retryable(configs::get, ConsistentMapException.class, 1, MAX_BACKOFF)
225 .apply(key(subject, configClass));
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700226 return json != null ? createConfig(subject, configClass, json.value()) : null;
227 }
228
229
230 @Override
231 public <S, C extends Config<S>> C createConfig(S subject, Class<C> configClass) {
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700232 ConfigFactory<S, C> factory = getConfigFactory(configClass);
233 Versioned<JsonNode> json = configs.computeIfAbsent(key(subject, configClass),
234 k -> factory.isList() ?
235 mapper.createArrayNode() :
236 mapper.createObjectNode());
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700237 return createConfig(subject, configClass, json.value());
238 }
239
240 @Override
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700241 public <S, C extends Config<S>> C applyConfig(S subject, Class<C> configClass, JsonNode json) {
Thomas Vachuskace0bbb32015-11-18 16:56:10 -0800242 // Create the configuration and validate it.
243 C config = createConfig(subject, configClass, json);
244 checkArgument(config.isValid(), INVALID_CONFIG_JSON);
245
246 // Insert the validated configuration and get it back.
247 Versioned<JsonNode> versioned = configs.putAndGet(key(subject, configClass), json);
248
249 // Re-create the config if for some reason what we attempted to put
250 // was supplanted by someone else already.
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800251 return versioned.value() == json ? config : createConfig(subject, configClass, versioned.value());
252 }
253
254 @Override
255 public <S> void queueConfig(S subject, String configKey, JsonNode json) {
256 configs.put(key(subject, configKey), json);
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700257 }
258
259 @Override
260 public <S, C extends Config<S>> void clearConfig(S subject, Class<C> configClass) {
261 configs.remove(key(subject, configClass));
262 }
263
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800264 @Override
265 public <S> void clearQueuedConfig(S subject, String configKey) {
266 configs.remove(key(subject, configKey));
267 }
268
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700269 /**
270 * Produces a config from the specified subject, config class and raw JSON.
271 *
272 * @param subject config subject
273 * @param configClass config class
274 * @param json raw JSON data
275 * @return config object or null of no factory found or if the specified
276 * JSON is null
277 */
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700278 private <S, C extends Config<S>> C createConfig(S subject, Class<C> configClass,
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700279 JsonNode json) {
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700280 return createConfig(subject, configClass, json, false);
281 }
282
283 /**
284 * Produces a config from the specified subject, config class and raw JSON.
285 *
286 * The config can optionally be detached, which means it does not contain a
287 * reference to an apply delegate. This means a detached config can not be
288 * applied. This should be used only for passing the config object in the
289 * NetworkConfigEvent.
290 *
291 * @param subject config subject
292 * @param configClass config class
293 * @param json raw JSON data
294 * @param detached whether the config should be detached, that is, should
295 * be created without setting an apply delegate.
296 * @return config object or null of no factory found or if the specified
297 * JSON is null
298 */
299 @SuppressWarnings("unchecked")
300 private <S, C extends Config<S>> C createConfig(S subject, Class<C> configClass,
301 JsonNode json, boolean detached) {
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700302 if (json != null) {
303 ConfigFactory<S, C> factory = factoriesByConfig.get(configClass.getName());
304 if (factory != null) {
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700305 validateJsonType(json, factory);
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700306 C config = factory.createConfig();
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700307 config.init(subject, factory.configKey(), json, mapper,
308 detached ? null : applyDelegate);
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700309 return config;
310 }
311 }
312 return null;
313 }
314
Charles Chan023a8982016-02-04 11:00:41 -0800315 /**
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700316 * Validates that the type of the JSON node is appropriate for the type of
317 * configuration. A list type configuration must be created with an
318 * ArrayNode, and an object type configuration must be created with an
319 * ObjectNode.
Charles Chan023a8982016-02-04 11:00:41 -0800320 *
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700321 * @param json JSON node to check
322 * @param factory config factory of configuration
323 * @param <S> subject
324 * @param <C> configuration
325 * @return true if the JSON node type is appropriate for the configuration
Charles Chan023a8982016-02-04 11:00:41 -0800326 */
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700327 private <S, C extends Config<S>> boolean validateJsonType(JsonNode json,
328 ConfigFactory<S, C> factory) {
329 if (factory.isList() && !(json instanceof ArrayNode)) {
330 throw new IllegalArgumentException(INVALID_JSON_LIST);
Charles Chan023a8982016-02-04 11:00:41 -0800331 }
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700332 if (!factory.isList() && !(json instanceof ObjectNode)) {
333 throw new IllegalArgumentException(INVALID_JSON_OBJECT);
334 }
335
336 return true;
Charles Chan023a8982016-02-04 11:00:41 -0800337 }
338
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700339
340 // Auxiliary delegate to receive notifications about changes applied to
341 // the network configuration - by the apps.
342 private class InternalApplyDelegate implements ConfigApplyDelegate {
343 @Override
344 public void onApply(Config config) {
345 configs.put(key(config.subject(), config.getClass()), config.node());
346 }
347 }
348
349 // Produces a key for uniquely tracking a subject config.
350 private static ConfigKey key(Object subject, Class<?> configClass) {
351 return new ConfigKey(subject, configClass);
352 }
353
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800354 // Produces a key for uniquely tracking a subject config.
355 private static ConfigKey key(Object subject, String configKey) {
356 return new ConfigKey(subject, configKey);
357 }
358
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700359 // Auxiliary key to track subject configurations.
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800360 // Keys with non-null configKey are pending configurations.
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700361 private static final class ConfigKey {
362 final Object subject;
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800363 final String configKey;
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700364 final String configClass;
365
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800366 // Create a key for pending configuration class
367 private ConfigKey(Object subject, String configKey) {
368 this.subject = subject;
369 this.configKey = configKey;
370 this.configClass = null;
371 }
372
373 // Create a key for registered class configuration
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700374 private ConfigKey(Object subject, Class<?> configClass) {
375 this.subject = subject;
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800376 this.configKey = null;
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700377 this.configClass = configClass.getName();
378 }
379
380 @Override
381 public int hashCode() {
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800382 return Objects.hash(subject, configKey, configClass);
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700383 }
384
385 @Override
386 public boolean equals(Object obj) {
387 if (this == obj) {
388 return true;
389 }
390 if (obj instanceof ConfigKey) {
391 final ConfigKey other = (ConfigKey) obj;
392 return Objects.equals(this.subject, other.subject)
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800393 && Objects.equals(this.configKey, other.configKey)
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700394 && Objects.equals(this.configClass, other.configClass);
395 }
396 return false;
397 }
398 }
399
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700400 private class InternalMapListener implements MapEventListener<ConfigKey, JsonNode> {
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700401 @Override
Thomas Vachuska0a400ea2015-09-04 11:25:03 -0700402 public void event(MapEvent<ConfigKey, JsonNode> event) {
Thomas Vachuska6f350ed2016-01-08 09:53:03 -0800403 // Do not delegate pending configs.
404 if (event.key().configClass == null) {
405 return;
406 }
407
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700408 ConfigFactory factory = factoriesByConfig.get(event.key().configClass);
409 if (factory != null) {
Charles Chan023a8982016-02-04 11:00:41 -0800410 Object subject = event.key().subject;
411 Class configClass = factory.configClass();
412 Versioned<JsonNode> newValue = event.newValue();
413 Versioned<JsonNode> oldValue = event.oldValue();
414
415 Config config = (newValue != null) ?
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700416 createConfig(subject, configClass, newValue.value(), true) :
417 null;
Charles Chan023a8982016-02-04 11:00:41 -0800418 Config prevConfig = (oldValue != null) ?
Jonathan Hartb11c4d02016-03-23 09:05:44 -0700419 createConfig(subject, configClass, oldValue.value(), true) :
420 null;
Charles Chan023a8982016-02-04 11:00:41 -0800421
422 NetworkConfigEvent.Type type;
423 switch (event.type()) {
424 case INSERT:
425 type = CONFIG_ADDED;
426 break;
427 case UPDATE:
428 type = CONFIG_UPDATED;
429 break;
430 case REMOVE:
431 default:
432 type = CONFIG_REMOVED;
433 break;
434 }
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700435 notifyDelegate(new NetworkConfigEvent(type, event.key().subject,
Charles Chan023a8982016-02-04 11:00:41 -0800436 config, prevConfig, factory.configClass()));
Thomas Vachuska96d55b12015-05-11 08:52:03 -0700437 }
438 }
439 }
440}