diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-05-18 09:36:32 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-05-24 08:33:15 +0000 |
commit | d421438681e97ef7213a5cb925c49755cd9fb4b6 (patch) | |
tree | eec68eb4a7f5ca200270506a775ac7bc3b31e627 | |
parent | 3f3dfefae447342188804d2f628689e34350945e (diff) |
HONEYCOMB-61: Provide context data in OPERATIONAL reads
+ Uncomment disabled reader for netconf monitoring
Change-Id: I8de1507d1999ff7fc64aa87dc9a1c0d2af454b0d
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
5 files changed, 101 insertions, 10 deletions
diff --git a/v3po/impl/src/main/config/context-datatree-config.xml b/v3po/impl/src/main/config/context-datatree-config.xml index 13da9ec65..a77813daf 100644 --- a/v3po/impl/src/main/config/context-datatree-config.xml +++ b/v3po/impl/src/main/config/context-datatree-config.xml @@ -89,11 +89,37 @@ </binding-mapping-service> </binding-forwarded-data-broker> </module> - </modules> + <!-- Special reader for Context data. Providing context data to outside users over NETCONF/RESTCONF --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:context-reader</type> + <name>context-reader</name> + <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> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type> + <name>read-registry</name> + <root-readers> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type> + <name>context-reader</name> + </root-readers> + </module> + <!-- END: Special reader for Context --> + + </modules> <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type> + <instance> + <name>context-reader</name> + <provider>/modules/module[type='context-reader'][name='context-reader']</provider> + </instance> + </service> + <service> <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> <instance> <name>inmemory-context-data-tree</name> diff --git a/v3po/impl/src/main/config/netconf-north-config.xml b/v3po/impl/src/main/config/netconf-north-config.xml index f7f0629d4..b41aafeda 100644 --- a/v3po/impl/src/main/config/netconf-north-config.xml +++ b/v3po/impl/src/main/config/netconf-north-config.xml @@ -291,15 +291,14 @@ <name>netconf-binding-data-broker</name> </netconf-monitoring-binding-broker> </module> - <!--FIXME disable the reader until this patch is merged and released by ODL: TODO link --> - <!--<module>--> - <!--<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type>--> - <!--<name>read-registry</name>--> - <!--<root-readers>--> - <!--<type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type>--> - <!--<name>netconf-monitoring-reader</name>--> - <!--</root-readers>--> - <!--</module>--> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type> + <name>read-registry</name> + <root-readers> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type> + <name>netconf-monitoring-reader</name> + </root-readers> + </module> <!-- END: Special reader for Netconf monitoring. --> </modules> diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModule.java new file mode 100644 index 000000000..df22a2bea --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModule.java @@ -0,0 +1,31 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.translate.util.read.BindingBrokerReader; +import io.fd.honeycomb.v3po.translate.util.read.CloseableReader; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.Contexts; + +/** +* A reader to provide mapping context related data +*/ +public class ContextReaderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractContextReaderModule { + public ContextReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public ContextReaderModule(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.ContextReaderModule 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 new CloseableReader<>(new BindingBrokerReader<>(Contexts.class, getContextBindingBrokerDependency(), + LogicalDatastoreType.OPERATIONAL)); + } + +} diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModuleFactory.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModuleFactory.java new file mode 100644 index 000000000..5889b8722 --- /dev/null +++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextReaderModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: context-reader +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Wed May 18 09:06:45 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 ContextReaderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractContextReaderModuleFactory { + +} diff --git a/v3po/impl/src/main/yang/v3po-impl.yang b/v3po/impl/src/main/yang/v3po-impl.yang index 3f7af6185..3ab69f4e9 100644 --- a/v3po/impl/src/main/yang/v3po-impl.yang +++ b/v3po/impl/src/main/yang/v3po-impl.yang @@ -143,4 +143,26 @@ module v3po-impl { } } + + identity context-reader { + base config:module-type; + config:provided-service tapi:honeycomb-reader; + description "A reader to provide mapping context related data"; + } + + augment "/config:modules/config:module/config:configuration" { + case context-reader { + when "/config:modules/config:module/config:type = 'context-reader'"; + + container context-binding-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-async-data-broker; + } + } + } + + } + } } |