diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-05-17 09:10:39 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-05-23 09:24:12 +0000 |
commit | d54ea758da8dcf71d52727c4f01f87090c50bf2e (patch) | |
tree | bf86e49ad4899b50c97654ae144d4b2e8902d1b8 /v3po/impl | |
parent | 9e59a344c5a5b81fb7b7292184e849ad0fc9507c (diff) |
HONEYCOMB-61: Add BA broker for context data tree
With broker, context data can be accessed in a transactional
manner, same as config data
+ Renamed data-api concepts to not include DataTree
+ Renamed context related concepts to better distinguish between them
+ Now passing full ReadContext to read customizers
+ Naming context is backed by context data broker
Change-Id: I0b2876dd74a31a9ced7d9b5145672868e12f8b82
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/impl')
6 files changed, 123 insertions, 71 deletions
diff --git a/v3po/impl/src/main/config/context-datatree-config.xml b/v3po/impl/src/main/config/context-datatree-config.xml index c9f9902f3..13da9ec65 100644 --- a/v3po/impl/src/main/config/context-datatree-config.xml +++ b/v3po/impl/src/main/config/context-datatree-config.xml @@ -58,7 +58,40 @@ </schema-service> <persist-file-path>etc/opendaylight/honeycomb/context.json</persist-file-path> </module> + + <!-- DOM Data Broker for context data --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:honeycomb-context-dom-data-broker</type> + <name>honeycomb-context-data-broker</name> + <!-- With persistence --> + <context-data-tree> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> + <name>inmemory-persisted-context-data-tree</name> + </context-data-tree> + </module> + + <!-- BA Data Broker for context data --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type> + <name>honeycomb-context-binding-data-broker</name> + <binding-forwarded-data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl"> + <dom-async-broker> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type> + <name>honeycomb-context-data-broker</name> + </dom-async-broker> + <schema-service> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type> + <name>yang-schema-service</name> + </schema-service> + <binding-mapping-service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-dom-mapping-service</type> + <name>runtime-mapping-singleton</name> + </binding-mapping-service> + </binding-forwarded-data-broker> + </module> </modules> + + <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> <service> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> @@ -73,6 +106,22 @@ </provider> </instance> </service> + + <service> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type> + <instance> + <name>honeycomb-context-data-broker</name> + <provider>/modules/module[type='honeycomb-context-dom-data-broker'][name='honeycomb-context-data-broker']</provider> + </instance> + </service> + + <service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <instance> + <name>honeycomb-context-binding-data-broker</name> + <provider>/modules/module[type='binding-forwarded-data-broker'][name='honeycomb-context-binding-data-broker']</provider> + </instance> + </service> </services> </data> </configuration> diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml index 89e1f7ce2..7106c78ce 100644 --- a/v3po/impl/src/main/config/default-config.xml +++ b/v3po/impl/src/main/config/default-config.xml @@ -88,6 +88,10 @@ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> <name>write-registry</name> </writer-registry> + <context-binding-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>honeycomb-context-binding-data-broker</name> + </context-binding-broker> </module> <!-- FIXME workaround for: https://git.opendaylight.org/gerrit/#/c/37499/ Move to netconf-north-config--> @@ -152,6 +156,10 @@ <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type> <name>netconf-inmemory-data-broker</name> </netconf-monitoring-dom-data-broker> + <context-binding-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>honeycomb-context-binding-data-broker</name> + </context-binding-broker> </module> <!-- DOM data broker which provides transaction functionality for HC using BI format--> @@ -233,6 +241,10 @@ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> <name>noop-writer-registry</name> </writer-registry> + <context-binding-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>honeycomb-context-binding-data-broker</name> + </context-binding-broker> </module> <!-- DOM data broker for config initialization --> <module> diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModule.java new file mode 100644 index 000000000..1d1fa5323 --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModule.java @@ -0,0 +1,26 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.data.impl.DataBroker; +import io.fd.honeycomb.v3po.data.impl.ModifiableDataTreeManager; + +public class ContextDataBrokerModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractContextDataBrokerModule { + + public ContextDataBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public ContextDataBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.ContextDataBrokerModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + return DataBroker.create(new ModifiableDataTreeManager(getContextDataTreeDependency())); + } + +} diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModuleFactory.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModuleFactory.java new file mode 100644 index 000000000..360f5f472 --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: honeycomb-context-dom-data-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon May 16 15:27:12 CEST 2016 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; +public class ContextDataBrokerModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractContextDataBrokerModuleFactory { + +} diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java index 24e34c0a9..8aa3d64d9 100644 --- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java @@ -1,19 +1,6 @@ package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; import io.fd.honeycomb.v3po.data.impl.DataBroker; -import java.util.Map; -import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension; -import org.opendaylight.controller.md.sal.dom.api.DOMDataChangeListener; -import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,63 +29,6 @@ public class DataBrokerModule extends @Override public java.lang.AutoCloseable createInstance() { LOG.debug("DataBrokerModule.createInstance()"); - return new CloseableDataBroker( - new DataBroker(getOperationalDataTreeDependency(), getConfigDataTreeDependency())); - } - - private static final class CloseableDataBroker implements AutoCloseable, DOMDataBroker { - - private final DataBroker delegate; - - CloseableDataBroker(final DataBroker delegate) { - this.delegate = delegate; - } - - @Override - public void close() throws Exception { - LOG.debug("CloseableDataBroker.close()"); - // NOP - } - - @Override - public DOMDataReadOnlyTransaction newReadOnlyTransaction() { - LOG.trace("CloseableDataBroker.newReadOnlyTransaction()"); - return delegate.newReadOnlyTransaction(); - } - - @Override - public DOMDataReadWriteTransaction newReadWriteTransaction() { - LOG.trace("CloseableDataBroker.newReadWriteTransaction()"); - return delegate.newReadWriteTransaction(); - } - - @Override - public DOMDataWriteTransaction newWriteOnlyTransaction() { - LOG.trace("CloseableDataBroker.newWriteOnlyTransaction()"); - return delegate.newWriteOnlyTransaction(); - } - - @Override - public ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store, - final YangInstanceIdentifier path, - final DOMDataChangeListener listener, - final DataChangeScope triggeringScope) { - LOG.trace("CloseableDataBroker.createTransactionChain store={}, path={}, listener={}, triggeringScope={}", - store, path, listener, triggeringScope); - return delegate.registerDataChangeListener(store, path, listener, triggeringScope); - } - - @Override - public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) { - LOG.trace("CloseableDataBroker.createTransactionChain listener={}", listener); - return delegate.createTransactionChain(listener); - } - - @Nonnull - @Override - public Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() { - LOG.trace("CloseableDataBroker.getSupportedExtensions()"); - return delegate.getSupportedExtensions(); - } + return DataBroker.create(getConfigDataTreeDependency(), getOperationalDataTreeDependency()); } } diff --git a/v3po/impl/src/main/yang/v3po-impl.yang b/v3po/impl/src/main/yang/v3po-impl.yang index 30b70f342..3f7af6185 100644 --- a/v3po/impl/src/main/yang/v3po-impl.yang +++ b/v3po/impl/src/main/yang/v3po-impl.yang @@ -101,6 +101,28 @@ module v3po-impl { } } + identity honeycomb-context-dom-data-broker { + base config:module-type; + config:provided-service dom:dom-async-data-broker; + config:java-name-prefix ContextDataBroker; + description "DomBroker on top of context data-tree"; + } + + augment "/config:modules/config:module/config:configuration" { + case honeycomb-context-dom-data-broker { + when "/config:modules/config:module/config:type = 'honeycomb-context-dom-data-broker'"; + + container context-data-tree { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dapi:data-tree; + } + } + } + } + } + identity netconf-monitoring-reader { base config:module-type; config:provided-service tapi:honeycomb-reader; |