summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
Diffstat (limited to 'v3po')
-rw-r--r--v3po/data-api/pom.xml4
-rw-r--r--v3po/data-api/src/main/yang/data-api.yang30
-rw-r--r--v3po/data-impl/pom.xml4
-rw-r--r--v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java19
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java64
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModuleFactory.java13
-rw-r--r--v3po/data-impl/src/main/yang/data-impl.yang68
-rw-r--r--v3po/impl/src/main/config/default-config.xml47
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java8
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java28
-rw-r--r--v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java14
-rw-r--r--v3po/impl/src/main/yang/v3po-impl.yang10
-rw-r--r--v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java7
-rw-r--r--v3po/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java3
14 files changed, 207 insertions, 112 deletions
diff --git a/v3po/data-api/pom.xml b/v3po/data-api/pom.xml
index 846498c28..9ecbe80cb 100644
--- a/v3po/data-api/pom.xml
+++ b/v3po/data-api/pom.xml
@@ -18,9 +18,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
+ <relativePath>../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/v3po/data-api/src/main/yang/data-api.yang b/v3po/data-api/src/main/yang/data-api.yang
index 28d969378..0a01a4242 100644
--- a/v3po/data-api/src/main/yang/data-api.yang
+++ b/v3po/data-api/src/main/yang/data-api.yang
@@ -1,37 +1,27 @@
-module translate-api {
+module data-api {
yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:translate:api";
- prefix "tapi";
+ namespace "urn:honeycomb:params:xml:ns:yang:data:api";
+ prefix "dapi";
import config { prefix config; revision-date 2013-04-05; }
description
- "This module contains the base YANG definitions for
- readers/writers plugged into a honeycomb";
+ "This module contains the base YANG data tree definitions
+ for data store modeling";
- revision "2016-04-06" {
+ revision "2016-04-11" {
description
"Initial revision.";
}
- identity honeycomb-reader {
+ identity honeycomb-readable-data-tree {
base "config:service-type";
- config:java-class io.fd.honeycomb.v3po.translate.read.Reader;
+ config:java-class io.fd.honeycomb.v3po.data.ReadableDataTree;
}
- identity honeycomb-reader-registry {
+ identity honeycomb-modifiable-data-tree {
base "config:service-type";
- config:java-class io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
- }
-
- identity honeycomb-writer {
- base "config:service-type";
- config:java-class io.fd.honeycomb.v3po.translate.write.Writer;
- }
-
- identity honeycomb-writer-registry {
- base "config:service-type";
- config:java-class io.fd.honeycomb.v3po.translate.write.WriterRegistry;
+ config:java-class io.fd.honeycomb.v3po.data.ModifiableDataTree;
}
} \ No newline at end of file
diff --git a/v3po/data-impl/pom.xml b/v3po/data-impl/pom.xml
index 0df4f4cf9..954d25c30 100644
--- a/v3po/data-impl/pom.xml
+++ b/v3po/data-impl/pom.xml
@@ -17,10 +17,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<groupId>io.fd.honeycomb.common</groupId>
<version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
+ <relativePath>../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java
index f636e6708..59a555fda 100644
--- a/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java
+++ b/v3po/data-impl/src/main/java/io/fd/honeycomb/v3po/data/impl/ConfigDataTree.java
@@ -57,7 +57,7 @@ public final class ConfigDataTree implements ModifiableDataTree {
private final BindingNormalizedNodeSerializer serializer;
private final DataTree dataTree;
- private final WriterRegistry writer;
+ private final WriterRegistry writerRegistry;
public static final ReadableDataTree EMPTY_OPERATIONAL = new ReadableDataTree() {
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
@@ -69,16 +69,17 @@ public final class ConfigDataTree implements ModifiableDataTree {
/**
* Creates configuration data tree instance.
*
- * @param serializer service for serialization between Java Binding Data representation and NormalizedNode
- * representation.
- * @param dataTree data tree for configuration data representation
- * @param writer service for translation between Java Binding Data and data provider.
+ * @param serializer service for serialization between Java Binding Data representation and NormalizedNode
+ * representation.
+ * @param dataTree data tree for configuration data representation
+ * @param writerRegistry service for translation between Java Binding Data and data provider, capable of performing
+ * bulk updates.
*/
public ConfigDataTree(@Nonnull final BindingNormalizedNodeSerializer serializer,
- @Nonnull final DataTree dataTree, @Nonnull final WriterRegistry writer) {
+ @Nonnull final DataTree dataTree, @Nonnull final WriterRegistry writerRegistry) {
this.serializer = checkNotNull(serializer, "serializer should not be null");
this.dataTree = checkNotNull(dataTree, "dataTree should not be null");
- this.writer = checkNotNull(writer, "writer should not be null");
+ this.writerRegistry = checkNotNull(writerRegistry, "writerRegistry should not be null");
}
@Override
@@ -110,8 +111,8 @@ public final class ConfigDataTree implements ModifiableDataTree {
final DOMDataReadOnlyTransaction beforeTx = new ReadOnlyTransaction(EMPTY_OPERATIONAL, takeSnapshot());
final ConfigSnapshot modificationSnapshot = new ConfigSnapshot(modification);
final DOMDataReadOnlyTransaction afterTx = new ReadOnlyTransaction(EMPTY_OPERATIONAL, modificationSnapshot);
- try(final WriteContext ctx = new TransactionWriteContext(serializer, beforeTx, afterTx)) {
- writer.update(nodesBefore, nodesAfter, ctx);
+ try (final WriteContext ctx = new TransactionWriteContext(serializer, beforeTx, afterTx)) {
+ writerRegistry.update(nodesBefore, nodesAfter, ctx);
} catch (io.fd.honeycomb.v3po.translate.write.WriterRegistry.BulkUpdateException e) {
LOG.warn("Failed to apply all changes", e);
LOG.info("Trying to revert successful changes for current transaction");
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java
new file mode 100644
index 000000000..88e87956b
--- /dev/null
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModule.java
@@ -0,0 +1,64 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
+
+import io.fd.honeycomb.v3po.data.DataTreeSnapshot;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
+import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
+import io.fd.honeycomb.v3po.translate.TranslationException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
+import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
+
+public class ConfigDataTreeModule extends
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractConfigDataTreeModule {
+ public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public ConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
+ org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
+ org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.ConfigDataTreeModule 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() {
+ final DataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ dataTree.setSchemaContext(getSchemaServiceDependency().getGlobalContext());
+ return new CloseableConfigDataTree(new ConfigDataTree(getBindingNormalizedNodeSerializerDependency(), dataTree,
+ getWriterRegistryDependency()));
+ }
+
+ private static final class CloseableConfigDataTree implements ModifiableDataTree, AutoCloseable {
+
+ private final ConfigDataTree delegate;
+
+ CloseableConfigDataTree(final ConfigDataTree delegate) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOP
+ }
+
+ @Override
+ public void modify(final DataTreeModification modification)
+ throws DataValidationFailedException, TranslationException {
+ delegate.modify(modification);
+ }
+
+ @Override
+ public DataTreeSnapshot takeSnapshot() {
+ return delegate.takeSnapshot();
+ }
+ }
+}
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModuleFactory.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModuleFactory.java
new file mode 100644
index 000000000..19baab13a
--- /dev/null
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/ConfigDataTreeModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: data-impl yang module local name: config-data-tree
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Sun Apr 10 22:07:29 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
+public class ConfigDataTreeModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractConfigDataTreeModuleFactory {
+
+}
diff --git a/v3po/data-impl/src/main/yang/data-impl.yang b/v3po/data-impl/src/main/yang/data-impl.yang
index 093e1725b..841cdb3df 100644
--- a/v3po/data-impl/src/main/yang/data-impl.yang
+++ b/v3po/data-impl/src/main/yang/data-impl.yang
@@ -1,59 +1,59 @@
-module translate-utils {
+module data-impl {
yang-version 1;
- namespace "urn:honeycomb:params:xml:ns:yang:translate:utils";
+ namespace "urn:honeycomb:params:xml:ns:yang:data:impl";
prefix "tutils";
import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+ import opendaylight-md-sal-dom { prefix dom; revision-date 2013-10-28;}
+ import data-api { prefix dapi; revision-date 2016-04-11; }
import translate-api { prefix tapi; revision-date 2016-04-06; }
description
- "This module contains translation layer utilities";
+ "This module contains YANG module definitions
+ for honeycomd data layer";
- revision "2016-04-06" {
+ revision "2016-04-11" {
description
"Initial revision.";
}
- identity delegating-reader-registry {
+ identity honeycomb-config-data-tree {
base config:module-type;
- config:provided-service tapi:honeycomb-reader-registry;
- config:java-name-prefix DelegatingReaderRegistry;
+ config:provided-service dapi:honeycomb-modifiable-data-tree;
+ config:java-name-prefix ConfigDataTree;
}
augment "/config:modules/config:module/config:configuration" {
- case delegating-reader-registry {
- when "/config:modules/config:module/config:type = 'delegating-reader-registry'";
-
- list root-readers {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity tapi:honeycomb-reader;
- }
+ case honeycomb-config-data-tree {
+ when "/config:modules/config:module/config:type = 'honeycomb-config-data-tree'";
+
+ container schema-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dom:schema-service;
}
}
+ }
- }
- }
-
- identity delegating-writer-registry {
- base config:module-type;
- config:provided-service tapi:honeycomb-writer-registry;
- config:java-name-prefix DelegatingWriterRegistry;
- }
+ container binding-normalized-node-serializer {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-normalized-node-serializer;
+ }
+ }
+ }
- augment "/config:modules/config:module/config:configuration" {
- case delegating-writer-registry {
- when "/config:modules/config:module/config:type = 'delegating-writer-registry'";
-
- list root-writers {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity tapi:honeycomb-writer;
- }
+ container writer-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity tapi:honeycomb-writer-registry;
}
}
+ }
}
}
diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml
index 13ab70211..3d0e4f7fc 100644
--- a/v3po/impl/src/main/config/default-config.xml
+++ b/v3po/impl/src/main/config/default-config.xml
@@ -20,6 +20,7 @@
<capability>urn:honeycomb:params:xml:ns:yang:translate:utils?module=translate-utils&amp;revision=2016-04-06</capability>
<capability>urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg?module=vpp-japi-cfg&amp;revision=2016-04-06</capability>
<capability>urn:honeycomb:params:xml:ns:yang:vpp:data:init?module=vpp-cfg-init&amp;revision=2016-04-07</capability>
+ <capability>urn:honeycomb:params:xml:ns:yang:data:impl?module=data-impl&amp;revision=2016-04-11</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
</required-capabilities>
<configuration>
@@ -85,6 +86,24 @@
</module>
<module>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:honeycomb-config-data-tree</type>
+ <name>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>
+ <binding-normalized-node-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>
+ </binding-normalized-node-serializer>
+ <writer-registry>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type>
+ <name>write-registry</name>
+ </writer-registry>
+ </module>
+
+ <module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:v3po</type>
<name>v3po-default</name>
<broker>
@@ -107,17 +126,14 @@
<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type>
<name>write-registry</name>
</writer-registry>
-
-
- <!--<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-normalized-node-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>
</binding-normalized-node-serializer>
+ <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>
</module>
<module>
@@ -165,6 +181,14 @@
</instance>
</service>
<service>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:honeycomb-modifiable-data-tree</type>
+ <instance>
+ <name>config-data-tree</name>
+ <provider>/modules/module[type='honeycomb-config-data-tree'][name='config-data-tree']
+ </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>
@@ -182,15 +206,6 @@
</instance>
</service>
-
- <!--<service>-->
- <!--<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:runtime-generated-mapping</type>-->
- <!--<instance>-->
- <!--<name>runtime-generated-mappingy</name>-->
- <!--<provider>/modules/module[type='runtime-generated-mapping'][name='runtime-generated-mapping']</provider>-->
- <!--</instance>-->
- <!--</service>-->
-
</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 d07c0ffca..bd5141282 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,6 +20,7 @@ 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.translate.read.ReaderRegistry;
import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collections;
@@ -78,16 +79,19 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
private DataBroker db;
VppPollOperDataImpl vppPollOperData;
private VppDataBrokerInitializationProvider vppDataBrokerInitializationProvider;
+ private final ModifiableDataTree configDataTree;
public V3poProvider(@Nonnull final Broker domBroker, final vppApi vppJapi,
@Nonnull final ReaderRegistry readerRegistry,
@Nonnull final WriterRegistry writerRegistry,
- @Nonnull final BindingNormalizedNodeSerializer serializer) {
+ @Nonnull final BindingNormalizedNodeSerializer serializer,
+ @Nonnull final ModifiableDataTree configDataTree) {
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");
}
private void initializeVppConfig() {
@@ -198,7 +202,7 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
startOperationalUpdateTimer();
// TODO make configurable:
- vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry, serializer);
+ vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry, serializer, configDataTree);
// 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 b0ee447ba..e0e8c999e 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
@@ -25,7 +25,6 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.data.ReadableDataTree;
-import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
import io.fd.honeycomb.v3po.data.impl.DataBroker;
import io.fd.honeycomb.v3po.data.impl.OperationalDataTree;
import io.fd.honeycomb.v3po.translate.Context;
@@ -73,11 +72,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
-import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -99,16 +95,19 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
private final BindingNormalizedNodeSerializer serializer;
private ObjectRegistration<DOMMountPoint> mountPointRegistration;
private DOMDataBroker broker;
+ private ModifiableDataTree configDataTree;
public VppDataBrokerInitializationProvider(
@Nonnull final org.opendaylight.controller.md.sal.binding.api.DataBroker bindingBroker,
- final ReaderRegistry readerRegistry,
- final WriterRegistry writerRegistry,
- final BindingNormalizedNodeSerializer serializer) {
+ @Nonnull final ReaderRegistry readerRegistry,
+ @Nonnull final WriterRegistry writerRegistry,
+ @Nonnull final BindingNormalizedNodeSerializer serializer,
+ @Nonnull final ModifiableDataTree configDataTree) {
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.mountPointPath = getMountPointPath();
}
@@ -136,7 +135,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
final DOMMountPointService.DOMMountPointBuilder mountPointBuilder = mountPointService.createMountPoint(path);
mountPointBuilder.addInitialSchemaContext(globalContext);
- broker = initVppDataBroker(globalContext, serializer);
+ broker = initVppDataBroker(globalContext, serializer, configDataTree);
mountPointBuilder.addService(DOMDataBroker.class, broker);
mountPointRegistration = mountPointBuilder.register();
@@ -169,16 +168,17 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
}
private DOMDataBroker initVppDataBroker(final SchemaContext globalContext,
- final BindingNormalizedNodeSerializer serializer) {
+ final BindingNormalizedNodeSerializer serializer,
+ final ModifiableDataTree configDataTree) {
final ReadableDataTree operationalDataTree =
new OperationalDataTree(serializer, globalContext, readerRegistry); // TODO make configurable
- final DataTree dataTree =
- InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); // TODO make configurable
- dataTree.setSchemaContext(globalContext);
+// final DataTree dataTree =
+// InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION); // TODO make configurable
+// dataTree.setSchemaContext(globalContext);
- final ModifiableDataTree configDataTree =
- new ConfigDataTree(serializer, dataTree, writerRegistry); // TODO make configurable
+// final ModifiableDataTree configDataTree =
+// new ConfigDataTree(serializer, dataTree, writerRegistry); // TODO make configurable
// init operational data tree before data broker is initialized
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 406525c19..0078f16fc 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
@@ -17,8 +17,6 @@
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210;
import io.fd.honeycomb.v3po.impl.V3poProvider;
-import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
-import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collection;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -30,7 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -57,17 +54,12 @@ public class V3poModule extends
@Override
public java.lang.AutoCloseable createInstance() {
- final ReaderRegistry readerRegistry = getReaderRegistryDependency();
- final WriterRegistry writerRegistry = getWriterRegistryDependency();
-
final Broker domBroker = getDomBrokerDependency();
domBroker.registerProvider(new InitializationProvider());
- final BindingNormalizedNodeSerializer serializer =
- getBindingNormalizedNodeSerializerDependency();
-
- final V3poProvider provider =
- new V3poProvider(domBroker, getVppJapiDependency(), readerRegistry, writerRegistry, serializer);
+ final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), getReaderRegistryDependency(),
+ getWriterRegistryDependency(), getBindingNormalizedNodeSerializerDependency(),
+ getConfigDataTreeDependency());
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 589148f28..2c2e95028 100644
--- a/v3po/impl/src/main/yang/v3po-impl.yang
+++ b/v3po/impl/src/main/yang/v3po-impl.yang
@@ -8,6 +8,7 @@ module v3po-impl {
import opendaylight-md-sal-dom {prefix dom;}
import vpp-japi-cfg { prefix vjc; revision-date 2016-04-06; }
import translate-api { prefix tapi; revision-date 2016-04-06; }
+ import data-api { prefix dapi; revision-date 2016-04-11; }
description
"Service definition for v3po project";
@@ -80,6 +81,15 @@ module v3po-impl {
}
}
+ container config-data-tree {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity dapi:honeycomb-modifiable-data-tree;
+ }
+ }
+ }
+
}
}
diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
index eb2349fb2..166104d67 100644
--- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
+++ b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.util.concurrent.CheckedFuture;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.impl.VppDataBrokerInitializationProvider;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
@@ -38,6 +39,7 @@ import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.osgi.framework.Configurable;
public class VppDataBrokerInitializationProviderTest {
@@ -51,7 +53,8 @@ public class VppDataBrokerInitializationProviderTest {
private WriterRegistry writerRegistry;
@Mock
private BindingNormalizedNodeSerializer serializer;
-
+ @Mock
+ private ModifiableDataTree configDataTree;
private VppDataBrokerInitializationProvider provider;
@@ -59,7 +62,7 @@ public class VppDataBrokerInitializationProviderTest {
public void setUp() throws Exception {
initMocks(this);
doReturn(writeTx).when(bindingBroker).newWriteOnlyTransaction();
- provider = new VppDataBrokerInitializationProvider(bindingBroker, readerRegistry, writerRegistry, serializer);
+ provider = new VppDataBrokerInitializationProvider(bindingBroker, readerRegistry, writerRegistry, serializer, configDataTree);
}
@Test
diff --git a/v3po/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java b/v3po/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java
index 6eef488cc..fb8c7047b 100644
--- a/v3po/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java
+++ b/v3po/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java
@@ -21,6 +21,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.impl.V3poProvider;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
@@ -59,6 +60,8 @@ public class V3poModuleTest {
.thenReturn(mock(WriterRegistry.class));
when(dependencyResolver.resolveInstance(eq(BindingNormalizedNodeSerializer.class), any(ObjectName.class), any(JmxAttribute.class)))
.thenReturn(mock(BindingNormalizedNodeSerializer.class));
+ when(dependencyResolver.resolveInstance(eq(ModifiableDataTree.class), any(ObjectName.class), any(JmxAttribute.class)))
+ .thenReturn(mock(ModifiableDataTree.class));
// create instance of module with injected mocks
V3poModule module = new V3poModule(mock(ModuleIdentifier.class), dependencyResolver);