summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-05-13 11:24:15 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-05-23 09:23:53 +0000
commit3eecfd9e241c50c9e498391e706a4be1240f2cd1 (patch)
tree798bb1a88e60f6b7fd15dbcd9eebf91015b6d21c
parent1cafe726b137109c96e03b80335b6a70bf7f63e2 (diff)
HONEYCOMB-61: Make InmemoryDataTree module type configurable
Change-Id: Ie73eac8960a76ebcc578d3b44c50492f29908e24 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModule.java (renamed from v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java)28
-rw-r--r--v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModuleFactory.java (renamed from v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java)6
-rw-r--r--v3po/data-impl/src/main/yang/data-impl.yang19
-rw-r--r--v3po/impl/src/main/config/default-config.xml5
4 files changed, 34 insertions, 24 deletions
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModule.java
index 9ae8a01f5..54c830ec0 100644
--- a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModule.java
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModule.java
@@ -1,26 +1,21 @@
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-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.api.schema.tree.*;
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;
-public class InMemoryConfigDataTreeModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryConfigDataTreeModule {
+public class InMemoryDataTreeModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryDataTreeModule {
- private static final Logger LOG = LoggerFactory.getLogger(InMemoryConfigDataTreeModule.class);
+ private static final Logger LOG = LoggerFactory.getLogger(InMemoryDataTreeModule.class);
- public InMemoryConfigDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ public InMemoryDataTreeModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public InMemoryConfigDataTreeModule(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.InMemoryConfigDataTreeModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public InMemoryDataTreeModule(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.InMemoryDataTreeModule oldModule, java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
@@ -32,14 +27,17 @@ public class InMemoryConfigDataTreeModule extends org.opendaylight.yang.gen.v1.u
@Override
public java.lang.AutoCloseable createInstance() {
LOG.debug("InMemoryConfigDataTreeModule.createInstance()");
- return new CloseableConfigDataTree(getSchemaServiceDependency().getGlobalContext());
+ return new CloseableConfigDataTree(getSchemaServiceDependency().getGlobalContext(), getType());
}
- private static class CloseableConfigDataTree implements AutoCloseable, DataTree {
- private final DataTree dataTree;
+ private static class CloseableConfigDataTree implements AutoCloseable,
+ org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree {
+ private final org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree dataTree;
- public CloseableConfigDataTree(final SchemaContext schemaContext) {
- this.dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ public CloseableConfigDataTree(final SchemaContext schemaContext, final DatatreeType type) {
+ this.dataTree = InMemoryDataTreeFactory.getInstance().create(
+ type == DatatreeType.Config ? TreeType.CONFIGURATION : TreeType.OPERATIONAL
+ );
dataTree.setSchemaContext(schemaContext);
}
diff --git a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModuleFactory.java
index 504e007c0..34a543949 100644
--- a/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryConfigDataTreeModuleFactory.java
+++ b/v3po/data-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/data/impl/rev160411/InMemoryDataTreeModuleFactory.java
@@ -1,13 +1,13 @@
/*
* Generated file
*
-* Generated from: yang module name: data-impl yang module local name: inmemory-config-data-tree
+* Generated from: yang module name: data-impl yang module local name: inmemory-data-tree
* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Apr 12 07:26:54 CEST 2016
+* Generated at: Fri May 13 11:10:56 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 InMemoryConfigDataTreeModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryConfigDataTreeModuleFactory {
+public class InMemoryDataTreeModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.data.impl.rev160411.AbstractInMemoryDataTreeModuleFactory {
}
diff --git a/v3po/data-impl/src/main/yang/data-impl.yang b/v3po/data-impl/src/main/yang/data-impl.yang
index fa6c6f06d..da1c02316 100644
--- a/v3po/data-impl/src/main/yang/data-impl.yang
+++ b/v3po/data-impl/src/main/yang/data-impl.yang
@@ -23,15 +23,22 @@ module data-impl {
config:java-class org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
}
- identity inmemory-config-data-tree {
+ identity inmemory-data-tree {
base config:module-type;
config:provided-service data-tree;
- config:java-name-prefix InMemoryConfigDataTree;
+ config:java-name-prefix InMemoryDataTree;
+ }
+
+ typedef datatree-type {
+ type enumeration {
+ enum config;
+ enum oper;
+ }
}
augment "/config:modules/config:module/config:configuration" {
- case inmemory-config-data-tree {
- when "/config:modules/config:module/config:type = 'inmemory-config-data-tree'";
+ case inmemory-data-tree {
+ when "/config:modules/config:module/config:type = 'inmemory-data-tree'";
container schema-service {
uses config:service-ref {
@@ -41,6 +48,10 @@ module data-impl {
}
}
}
+
+ leaf type {
+ type datatree-type;
+ }
}
}
diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml
index ca09d6e0b..61fe1c68d 100644
--- a/v3po/impl/src/main/config/default-config.xml
+++ b/v3po/impl/src/main/config/default-config.xml
@@ -39,12 +39,13 @@
<!-- In-memory data tree for HC config data tree -->
<module>
- <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:inmemory-config-data-tree</type>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:inmemory-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>
+ <type xmlns="urn:honeycomb:params:xml:ns:yang:data:impl">config</type>
</module>
<!-- DataTree adapter with persistence for config DT -->
@@ -338,7 +339,7 @@
<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>/modules/module[type='inmemory-data-tree'][name='inmemory-config-data-tree']
</provider>
</instance>
<instance>