diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-04-11 21:23:57 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-04-12 11:05:25 +0200 |
commit | 6bad7a88fa8b0be4f371897447f78abe7c52f805 (patch) | |
tree | 2eedfc7c1fcc3d255e3f03011845e46a2ce0832f /v3po/impl/src/main | |
parent | f93415dd8b3719b380b4295ab364420b9bf3d927 (diff) |
HONEYCOMB-34: Config tree initialization using binding data broker
Change-Id: I070aca2cc35dd10ea5bde19c8cbf4cad1c50f468
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/impl/src/main')
6 files changed, 142 insertions, 110 deletions
diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml index 328d00204..518a6fa58 100644 --- a/v3po/impl/src/main/config/default-config.xml +++ b/v3po/impl/src/main/config/default-config.xml @@ -37,13 +37,25 @@ <name>write-registry</name> </module> + <!-- In-memory data tree for HC config data tree --> <module> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-config-data-tree</type> - <name>config-data-tree</name> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:inmemory-config-data-tree</type> + <name>inmemory-config-data-tree</name> <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> + </module> + + + <!-- HC config data tree --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-config-data-tree</type> + <name>config-data-tree</name> + <data-tree> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:data-tree</type> + <name>inmemory-config-data-tree</name> + </data-tree> <serializer> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-dom-mapping-service</type> <name>runtime-mapping-singleton</name> @@ -54,6 +66,7 @@ </writer-registry> </module> + <!-- HC operational data tree --> <module> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-operational-data-tree</type> <name>operational-data-tree</name> @@ -71,6 +84,7 @@ </reader-registry> </module> + <!-- DOM data broker which provides transaction functionality for HC using BI format--> <module> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:honeycomb-dom-data-broker</type> <name>honeycomb-dom-data-broker</name> @@ -84,6 +98,7 @@ </operational-data-tree> </module> + <!-- Binding data broker which provides transaction functionality for HC using BA format --> <module> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type> <name>honeycomb-binding-data-broker</name> @@ -119,45 +134,81 @@ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg">prefix:vpp-japi</type> <name>vpp-japi</name> </vpp-japi> - <reader-registry> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type> - <name>read-registry</name> - </reader-registry> - <writer-registry> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> - <name>write-registry</name> - </writer-registry> <serializer> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-dom-mapping-service</type> <name>runtime-mapping-singleton</name> </serializer> + <dom-data-broker> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-async-data-broker</type> + <name>honeycomb-dom-data-broker</name> + </dom-data-broker> + </module> + + <!-- Config initialization --> + <!-- Empty registry which does not pass data to VPP --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:noop-writer-registry</type> + <name>noop-writer-registry</name> + </module> + <!-- Config data tree which does not pass data to translation layer (uses noop-write-registry) --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-config-data-tree</type> + <name>cfg-init-config-data-tree</name> + <data-tree> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:data-tree</type> + <name>inmemory-config-data-tree</name> + </data-tree> + <serializer> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-dom-mapping-service</type> + <name>runtime-mapping-singleton</name> + </serializer> + <writer-registry> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> + <name>noop-writer-registry</name> + </writer-registry> + </module> + <!-- DOM data broker for config initialization --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:honeycomb-dom-data-broker</type> + <name>cfg-init-dom-data-broker</name> <config-data-tree> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-modifiable-data-tree</type> - <name>config-data-tree</name> + <name>cfg-init-config-data-tree</name> </config-data-tree> <operational-data-tree> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-readable-data-tree</type> <name>operational-data-tree</name> </operational-data-tree> </module> - + <!-- Binding data broker for config initialization --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type> + <name>cfg-init-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>cfg-init-dom-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> + <!-- Config initializer --> <module> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:vpp-cfg-initializer-impl</type> <name>vpp-cfg-initializer</name> - <reader-registry> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type> - <name>read-registry</name> - </reader-registry> - <config-data-tree> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-modifiable-data-tree</type> - <name>config-data-tree</name> - </config-data-tree> - <serializer> - <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> - </serializer> - </module> - + <binding-data-broker> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-async-data-broker</type> + <name>cfg-init-binding-data-broker</name> + </binding-data-broker> + </module>noop-writer-registry + <!-- END: Config initialization --> </modules> <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> @@ -192,6 +243,16 @@ <provider>/modules/module[type='delegating-writer-registry'][name='write-registry']</provider> </instance> </service> + + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:data-tree</type> + <instance> + <name>inmemory-config-data-tree</name> + <provider>/modules/module[type='inmemory-config-data-tree'][name='inmemory-config-data-tree'] + </provider> + </instance> + </service> + <service> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-modifiable-data-tree</type> <instance> @@ -209,14 +270,6 @@ </instance> </service> <service> - <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:vpp-cfg-initializer</type> - <instance> - <name>vpp-cfg-initializer</name> - <provider>/modules/module[type='vpp-cfg-initializer-impl'][name='vpp-cfg-initializer'] - </provider> - </instance> - </service> - <service> <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom"> dom:dom-broker-osgi-registry </type> @@ -226,6 +279,46 @@ </instance> </service> + <!-- Config initialization --> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> + <instance> + <name>noop-writer-registry</name> + <provider>/modules/module[type='noop-writer-registry'][name='noop-writer-registry']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-modifiable-data-tree</type> + <instance> + <name>cfg-init-config-data-tree</name> + <provider>/modules/module[type='honeycomb-config-data-tree'][name='cfg-init-config-data-tree'] + </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>cfg-init-dom-data-broker</name> + <provider>/modules/module[type='honeycomb-dom-data-broker'][name='cfg-init-dom-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>cfg-init-binding-data-broker</name> + <provider>/modules/module[type='binding-forwarded-data-broker'][name='cfg-init-binding-data-broker']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:vpp-cfg-initializer</type> + <instance> + <name>vpp-cfg-initializer</name> + <provider>/modules/module[type='vpp-cfg-initializer-impl'][name='vpp-cfg-initializer'] + </provider> + </instance> + </service> + <!-- END: Config initialization --> + </services> </data> </configuration> diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java index 36eeb8598..8ed83d53a 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java @@ -20,10 +20,6 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; -import io.fd.honeycomb.v3po.data.ModifiableDataTree; -import io.fd.honeycomb.v3po.data.ReadableDataTree; -import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; -import io.fd.honeycomb.v3po.translate.write.WriterRegistry; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -71,31 +67,22 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker private static final Logger LOG = LoggerFactory.getLogger(V3poProvider.class); private final Broker domBroker; private final BindingNormalizedNodeSerializer serializer; + private final DOMDataBroker domDataBroker; private RpcRegistration<V3poService> v3poService; private VppIetfInterfaceListener vppInterfaceListener; private VppBridgeDomainListener vppBridgeDomainListener; private vppApi api; - private ReaderRegistry readerRegistry; - private WriterRegistry writerRegistry; private DataBroker db; VppPollOperDataImpl vppPollOperData; private VppDataBrokerInitializationProvider vppDataBrokerInitializationProvider; - private final ModifiableDataTree configDataTree; - private final ReadableDataTree operationalDataTree; public V3poProvider(@Nonnull final Broker domBroker, final vppApi vppJapi, - @Nonnull final ReaderRegistry readerRegistry, - @Nonnull final WriterRegistry writerRegistry, @Nonnull final BindingNormalizedNodeSerializer serializer, - @Nonnull final ModifiableDataTree configDataTree, - @Nonnull final ReadableDataTree operationalDataTree) { + @Nonnull final DOMDataBroker domDataBroker) { api = vppJapi; - this.readerRegistry = Preconditions.checkNotNull(readerRegistry, "readerRegistry should not be null"); - this.writerRegistry = Preconditions.checkNotNull(writerRegistry, "writerRegistry should not be null"); this.domBroker = Preconditions.checkNotNull(domBroker, "domBroker should not be null"); this.serializer = Preconditions.checkNotNull(serializer, "serializer should not be null"); - this.configDataTree = Preconditions.checkNotNull(configDataTree, "configDataTree should not be null"); - this.operationalDataTree = Preconditions.checkNotNull(operationalDataTree, "operationalDataTree should not be null"); + this.domDataBroker = Preconditions.checkNotNull(domDataBroker, "domDataBroker should not be null"); } private void initializeVppConfig() { @@ -206,7 +193,7 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker startOperationalUpdateTimer(); // TODO make configurable: - vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry, serializer, configDataTree, operationalDataTree); + vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, serializer, domDataBroker); // TODO pull the registration into Module domBroker.registerProvider(vppDataBrokerInitializationProvider); } diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java index bbb004b73..c1d22f9da 100644 --- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java +++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java @@ -20,11 +20,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.base.Optional; import com.google.common.base.Preconditions; -import io.fd.honeycomb.v3po.data.ModifiableDataTree; -import io.fd.honeycomb.v3po.data.ReadableDataTree; -import io.fd.honeycomb.v3po.data.impl.DataBroker; -import io.fd.honeycomb.v3po.translate.read.ReaderRegistry; -import io.fd.honeycomb.v3po.translate.write.WriterRegistry; import java.util.Collection; import java.util.Collections; import javax.annotation.Nonnull; @@ -67,28 +62,18 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto private final TopologyId VPP_TOPOLOGY_ID = TopologyId.getDefaultInstance("vpp-topology"); private final NodeId VPP_TOPOLOGY_NODE_ID = NodeId.getDefaultInstance("vpp"); private final org.opendaylight.controller.md.sal.binding.api.DataBroker bindingBroker; - private final ReaderRegistry readerRegistry; private final InstanceIdentifier<Node> mountPointPath; - private final WriterRegistry writerRegistry; private final BindingNormalizedNodeSerializer serializer; private ObjectRegistration<DOMMountPoint> mountPointRegistration; - private DOMDataBroker broker; - private final ModifiableDataTree configDataTree; - private final ReadableDataTree operationalDataTree; + private final DOMDataBroker domDataBroker; public VppDataBrokerInitializationProvider( @Nonnull final org.opendaylight.controller.md.sal.binding.api.DataBroker bindingBroker, - @Nonnull final ReaderRegistry readerRegistry, - @Nonnull final WriterRegistry writerRegistry, @Nonnull final BindingNormalizedNodeSerializer serializer, - @Nonnull final ModifiableDataTree configDataTree, - @Nonnull final ReadableDataTree operationalDataTree) { + @Nonnull final DOMDataBroker domDataBroker) { this.bindingBroker = checkNotNull(bindingBroker, "bindingBroker should not be null"); - this.readerRegistry = checkNotNull(readerRegistry, "readerRegistry should not be null"); - this.writerRegistry = checkNotNull(writerRegistry, "writerRegistry should not be null"); this.serializer = checkNotNull(serializer, "serializer should not be null"); - this.configDataTree = checkNotNull(configDataTree, "configDataTree should not be null"); - this.operationalDataTree = checkNotNull(operationalDataTree, "configDataTree should not be null"); + this.domDataBroker = checkNotNull(domDataBroker, "domDataBroker should not be null"); this.mountPointPath = getMountPointPath(); } @@ -115,8 +100,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto final DOMMountPointService.DOMMountPointBuilder mountPointBuilder = mountPointService.createMountPoint(path); mountPointBuilder.addInitialSchemaContext(globalContext); - broker = new DataBroker(operationalDataTree, configDataTree); - mountPointBuilder.addService(DOMDataBroker.class, broker); + mountPointBuilder.addService(DOMDataBroker.class, domDataBroker); mountPointRegistration = mountPointBuilder.register(); final DOMMountPoint mountPoint = mountPointRegistration.getInstance(); @@ -164,7 +148,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto } public Optional<DOMDataBroker> getBroker() { - return Optional.fromNullable(broker); + return Optional.fromNullable(domDataBroker); } @Override @@ -173,10 +157,6 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto mountPointRegistration.close(); } - if (broker != null) { - broker = null; - } - // remove MD-SAL placeholder data for VPP mount point: final WriteTransaction rwTx = bindingBroker.newWriteOnlyTransaction(); // does not fail if data is not present: 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 76f014456..24e34c0a9 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 @@ -41,7 +41,7 @@ public class DataBrokerModule extends @Override public java.lang.AutoCloseable createInstance() { - LOG.info("DataBrokerModule.createInstance()"); + LOG.debug("DataBrokerModule.createInstance()"); return new CloseableDataBroker( new DataBroker(getOperationalDataTreeDependency(), getConfigDataTreeDependency())); } @@ -56,7 +56,7 @@ public class DataBrokerModule extends @Override public void close() throws Exception { - LOG.info("CloseableDataBroker.close()"); + LOG.debug("CloseableDataBroker.close()"); // NOP } diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java index 959780496..697213b3c 100644 --- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java @@ -57,9 +57,8 @@ public class V3poModule extends final Broker domBroker = getDomBrokerDependency(); domBroker.registerProvider(new InitializationProvider()); - final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getReaderRegistryDependency(), - getWriterRegistryDependency(), getSerializerDependency(), - getConfigDataTreeDependency(), getOperationalDataTreeDependency()); + final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getSerializerDependency(), + getDomDataBrokerDependency()); getBrokerDependency().registerProvider(provider); return provider; } diff --git a/v3po/impl/src/main/yang/v3po-impl.yang b/v3po/impl/src/main/yang/v3po-impl.yang index c0240cde3..d6fd25199 100644 --- a/v3po/impl/src/main/yang/v3po-impl.yang +++ b/v3po/impl/src/main/yang/v3po-impl.yang @@ -54,24 +54,6 @@ module v3po-impl { } } - container reader-registry { - uses config:service-ref { - refine type { - mandatory true; - config:required-identity tapi:honeycomb-reader-registry; - } - } - } - - container writer-registry { - uses config:service-ref { - refine type { - mandatory true; - config:required-identity tapi:honeycomb-writer-registry; - } - } - } - container serializer { uses config:service-ref { refine type { @@ -81,20 +63,11 @@ module v3po-impl { } } - container config-data-tree { - uses config:service-ref { - refine type { - mandatory true; - config:required-identity dapi:honeycomb-modifiable-data-tree; - } - } - } - - container operational-data-tree { + container dom-data-broker { uses config:service-ref { refine type { mandatory true; - config:required-identity dapi:honeycomb-readable-data-tree; + config:required-identity dom:dom-async-data-broker; } } } |