X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2FAbstractForwardedDataBroker.java;h=e632e6336aaf959808a28f9ecc209432c504b4eb;hb=46751de4454b9a6f5cf73db39f90f0189ceae986;hp=15e4a466cf688d67154d8a504cca0c5383d7feea;hpb=17d82f582a6bc13c78be3b19954ff8c021180e93;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java index 15e4a466cf..e632e6336a 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/AbstractForwardedDataBroker.java @@ -41,7 +41,6 @@ import org.opendaylight.yangtools.yang.data.impl.codec.BindingIndependentMapping import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.api.SchemaContextListener; -import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,14 +57,14 @@ public abstract class AbstractForwardedDataBroker implements Delegator schemaListenerRegistration; + private final ListenerRegistration schemaListenerRegistration; protected AbstractForwardedDataBroker(final DOMDataBroker domDataBroker, final BindingIndependentMappingService mappingService,final SchemaService schemaService) { this.domDataBroker = domDataBroker; this.mappingService = mappingService; this.codec = new BindingToNormalizedNodeCodec(mappingService); - this.schemaListenerRegistration = schemaService.registerSchemaServiceListener(this); + this.schemaListenerRegistration = schemaService.registerSchemaContextListener(this); } protected BindingToNormalizedNodeCodec getCodec() { @@ -98,6 +97,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator, DataObject> toBinding( + InstanceIdentifier path, final Map> normalized) { Map, DataObject> newMap = new HashMap<>(); @@ -108,6 +108,11 @@ public abstract class AbstractForwardedDataBroker implements Delegator, DataObject> binding = potential.get(); newMap.put(binding.getKey(), binding.getValue()); + } else if (entry.getKey().getLastPathArgument() instanceof YangInstanceIdentifier.AugmentationIdentifier) { + DataObject bindingDataObject = getCodec().toBinding(path, entry.getValue()); + if (bindingDataObject != null) { + newMap.put(path, bindingDataObject); + } } } catch (DeserializationException e) { LOG.warn("Failed to transform {}, omitting it", entry, e); @@ -149,7 +154,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator> toBinding( + protected Set> toBinding(InstanceIdentifier path, final Set normalized) { Set> hashSet = new HashSet<>(); for (YangInstanceIdentifier normalizedPath : normalized) { @@ -158,6 +163,8 @@ public abstract class AbstractForwardedDataBroker implements Delegator binding = potential.get(); hashSet.add(binding); + } else if (normalizedPath.getLastPathArgument() instanceof YangInstanceIdentifier.AugmentationIdentifier) { + hashSet.add(path); } } catch (DeserializationException e) { LOG.warn("Failed to transform {}, omitting it", normalizedPath, e); @@ -220,7 +227,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator, DataObject> getCreatedData() { if (createdCache == null) { - createdCache = Collections.unmodifiableMap(toBinding(domEvent.getCreatedData())); + createdCache = Collections.unmodifiableMap(toBinding(path, domEvent.getCreatedData())); } return createdCache; } @@ -228,7 +235,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator, DataObject> getUpdatedData() { if (updatedCache == null) { - updatedCache = Collections.unmodifiableMap(toBinding(domEvent.getUpdatedData())); + updatedCache = Collections.unmodifiableMap(toBinding(path, domEvent.getUpdatedData())); } return updatedCache; @@ -237,7 +244,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator> getRemovedPaths() { if (removedCache == null) { - removedCache = Collections.unmodifiableSet(toBinding(domEvent.getRemovedPaths())); + removedCache = Collections.unmodifiableSet(toBinding(path, domEvent.getRemovedPaths())); } return removedCache; } @@ -245,7 +252,7 @@ public abstract class AbstractForwardedDataBroker implements Delegator, DataObject> getOriginalData() { if (originalCache == null) { - originalCache = Collections.unmodifiableMap(toBinding(domEvent.getOriginalData())); + originalCache = Collections.unmodifiableMap(toBinding(path, domEvent.getOriginalData())); } return originalCache;