diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-07-27 11:05:51 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-07-29 16:32:07 +0200 |
commit | 0578156b721fa01c8c645b8f9625ecebdb6449e4 (patch) | |
tree | 49d36f24e5d984a8c9f151b1440de88619f8b7de /infra/impl | |
parent | 007d4542388ca89be409ce1a4a4c7a36ddcb538f (diff) |
HONEYCOMB-130: Separate v3po plugin from HC infra
Creating folders:
- common/
- infra/
- v3po/
- vpp-common/
Change-Id: I2c39e1b17e39e7c0f0628f44aa5fe08563fa06e4
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/impl')
20 files changed, 2068 insertions, 0 deletions
diff --git a/infra/impl/pom.xml b/infra/impl/pom.xml new file mode 100644 index 000000000..4a316ceaf --- /dev/null +++ b/infra/impl/pom.xml @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- vi: set et smarttab sw=4 tabstop=4: --> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" 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> + <groupId>io.fd.honeycomb.common</groupId> + <artifactId>impl-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../common/impl-parent</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>io.fd.honeycomb</groupId> + <artifactId>honeycomb-impl</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>bundle</packaging> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>notification-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>translate-impl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>data-impl</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>cfg-init</artifactId> + <version>${project.version}</version> + </dependency> + <!-- TODO used by NetconfMonitoringReaderModule, get it out of here--> + <dependency> + <groupId>org.opendaylight.netconf</groupId> + <artifactId>ietf-netconf-monitoring</artifactId> + <version>1.0.2-Beryllium-SR2</version> + </dependency> + <dependency> + <groupId>org.opendaylight.netconf</groupId> + <artifactId>ietf-netconf-monitoring-extension</artifactId> + <version>1.0.2-Beryllium-SR2</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-topology</artifactId> + </dependency> + + <!-- Testing Dependencies --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-all</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${config.file}</file> + <type>xml</type> + <classifier>config</classifier> + </artifact> + <artifact> + <file>src/main/config/netconf-north-config.xml</file> + <type>xml</type> + <classifier>netconf</classifier> + </artifact> + <artifact> + <file>src/main/config/initializer-config.xml</file> + <type>xml</type> + <classifier>init</classifier> + </artifact> + <artifact> + <file>src/main/config/context-datatree-config.xml</file> + <type>xml</type> + <classifier>context</classifier> + </artifact> + <artifact> + <file>src/main/config/restconf-north-config.xml</file> + <type>xml</type> + <classifier>restconf</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/infra/impl/src/main/config/context-datatree-config.xml b/infra/impl/src/main/config/context-datatree-config.xml new file mode 100644 index 000000000..313f0ebe6 --- /dev/null +++ b/infra/impl/src/main/config/context-datatree-config.xml @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (c) 2016 Cisco and/or its affiliates. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at: + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<!-- vi: set et smarttab sw=4 tabstop=4: --> + +<snapshot> + <required-capabilities> + <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&revision=2014-12-10</capability> + <capability>urn:honeycomb:params:xml:ns:yang:translate:utils?module=translate-utils&revision=2016-04-06</capability> + <capability>urn:honeycomb:params:xml:ns:yang:vpp:data:init?module=vpp-cfg-init&revision=2016-04-07</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:api?module=data-api&revision=2016-04-11</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:impl?module=data-impl&revision=2016-04-11</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability> + </required-capabilities> + <configuration> + + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + + <!-- TODO provide information stored in context data-tree to users as part of operational data --> + <!-- In-memory data tree for context(special data required for YANG <-> VPP mapping) data --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:inmemory-data-tree</type> + <name>inmemory-context-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">oper</type> + </module> + + <!-- DataTree adapter with persistence for context DT --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:persisting-data-tree-adapter</type> + <name>inmemory-persisted-context-data-tree</name> + <delegate> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> + <name>inmemory-context-data-tree</name> + </delegate> + <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> + <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> + + <!-- Mapping context on top of BA context broker. Utilized by eg notification producers --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:realtime-mapping-context</type> + <name>realtime-mapping-context</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> + </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> + <instance> + <name>inmemory-context-data-tree</name> + <provider>/modules/module[type='inmemory-data-tree'][name='inmemory-context-data-tree'] + </provider> + </instance> + <instance> + <name>inmemory-persisted-context-data-tree</name> + <provider>/modules/module[type='persisting-data-tree-adapter'][name='inmemory-persisted-context-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>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> + + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-mapping-context</type> + <instance> + <name>realtime-mapping-context</name> + <provider>/modules/module[type='realtime-mapping-context'][name='realtime-mapping-context']</provider> + </instance> + </service> + </services> + </data> + </configuration> +</snapshot> diff --git a/infra/impl/src/main/config/default-config.xml b/infra/impl/src/main/config/default-config.xml new file mode 100644 index 000000000..c817a5db3 --- /dev/null +++ b/infra/impl/src/main/config/default-config.xml @@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- vi: set et smarttab sw=4 tabstop=4: --> +<!-- + Copyright (c) 2015 Cisco and/or its affiliates. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at: + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<snapshot> + <required-capabilities> + <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&revision=2014-12-10</capability> + <capability>urn:honeycomb:params:xml:ns:yang:translate:utils?module=translate-utils&revision=2016-04-06</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:api?module=data-api&revision=2016-04-11</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:impl?module=data-impl&revision=2016-04-11</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability> + </required-capabilities> + <configuration> + + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type> + <name>read-registry</name> + </module> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-writer-registry</type> + <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: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 --> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:impl">prefix:persisting-data-tree-adapter</type> + <name>inmemory-persisted-config-data-tree</name> + <delegate> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> + <name>inmemory-config-data-tree</name> + </delegate> + <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> + <persist-file-path>etc/opendaylight/honeycomb/config.json</persist-file-path> + </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> + <!-- Without persistence --> + <!--<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>--> + <!-- With persistence --> + <data-tree> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> + <name>inmemory-persisted-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-builder> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry-builder</type> + <name>write-registry-builder</name> + </writer-registry-builder> + <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> + + <!-- 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> + <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> + <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> + <reader-registry-builder> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type> + <name>read-registry</name> + </reader-registry-builder> + <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--> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:honeycomb-dom-data-broker</type> + <name>honeycomb-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> + </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 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> + <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-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> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:v3po</type> + <name>v3po-default</name> + <dom-broker> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">prefix:dom-broker-osgi-registry</type> + <name>dom-broker</name> + </dom-broker> + <honeycomb-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> + </honeycomb-dom-data-broker> + <honeycomb-dom-notification-service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:notification:api">prefix:dom-notification-service</type> + <name>honeycomb-dom-notification-service</name> + </honeycomb-dom-notification-service> + </module> + </modules> + + <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + + <service> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-async-data-broker</type> + <instance> + <name>honeycomb-dom-data-broker</name> + <provider>/modules/module[type='honeycomb-dom-data-broker'][name='honeycomb-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>honeycomb-binding-data-broker</name> + <provider>/modules/module[type='binding-forwarded-data-broker'][name='honeycomb-binding-data-broker']</provider> + </instance> + </service> + + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type> + <instance> + <name>read-registry</name> + <provider>/modules/module[type='delegating-reader-registry'][name='read-registry']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type> + <instance> + <name>write-registry</name> + <provider>/modules/module[type='delegating-writer-registry'][name='write-registry']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry-builder</type> + <instance> + <name>write-registry-builder</name> + <provider>/modules/module[type='delegating-writer-registry'][name='write-registry']</provider> + </instance> + </service> + + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">prefix:data-tree</type> + <instance> + <name>inmemory-config-data-tree</name> + <provider>/modules/module[type='inmemory-data-tree'][name='inmemory-config-data-tree'] + </provider> + </instance> + <instance> + <name>inmemory-persisted-config-data-tree</name> + <provider>/modules/module[type='persisting-data-tree-adapter'][name='inmemory-persisted-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> + <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:data:api">prefix:honeycomb-readable-data-tree</type> + <instance> + <name>operational-data-tree</name> + <provider>/modules/module[type='honeycomb-operational-data-tree'][name='operational-data-tree'] + </provider> + </instance> + </service> + <service> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom"> + dom:dom-broker-osgi-registry + </type> + <instance> + <name>vpp-dom-broker</name> + <provider>/modules/module[type='v3po'][name='v3po-default']</provider> + </instance> + </service> + + </services> + </data> + </configuration> +</snapshot> diff --git a/infra/impl/src/main/config/initializer-config.xml b/infra/impl/src/main/config/initializer-config.xml new file mode 100644 index 000000000..f46069340 --- /dev/null +++ b/infra/impl/src/main/config/initializer-config.xml @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (c) 2016 Cisco and/or its affiliates. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at: + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<!-- vi: set et smarttab sw=4 tabstop=4: --> + +<snapshot> + <required-capabilities> + <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&revision=2014-12-10</capability> + <capability>urn:honeycomb:params:xml:ns:yang:translate:utils?module=translate-utils&revision=2016-04-06</capability> + <capability>urn:honeycomb:params:xml:ns:yang:vpp:data:init?module=vpp-cfg-init&revision=2016-04-07</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:api?module=data-api&revision=2016-04-11</capability> + <capability>urn:honeycomb:params:xml:ns:yang:data:impl?module=data-impl&revision=2016-04-11</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability> + </required-capabilities> + <configuration> + + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <!-- 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-builder</type> + <name>noop-writer-registry-builder</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> + <!-- Without persistence --> + <data-tree> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:data:api">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-builder> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry-builder</type> + <name>noop-writer-registry-builder</name> + </writer-registry-builder> + <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> + <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>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> + + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:persisted-file-initializer</type> + <name>persisted-context-initializer</name> + <dom-data-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-data-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> + <persist-file-path>etc/opendaylight/honeycomb/context.json</persist-file-path> + <restoration-type>merge</restoration-type> + <datastore-type>oper</datastore-type> + </module> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:persisted-file-initializer</type> + <name>persisted-config-initializer</name> + <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> + <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> + <persist-file-path>etc/opendaylight/honeycomb/config.json</persist-file-path> + <restoration-type>merge</restoration-type> + <datastore-type>config</datastore-type> + </module> + + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:cfg-initializer-registry</type> + <name>initializer-registry</name> + <persisted-context-initializer> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:cfg-initializer</type> + <name>persisted-context-initializer</name> + </persisted-context-initializer> + <persisted-config-initializer> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:data:init">prefix:cfg-initializer</type> + <name>persisted-config-initializer</name> + </persisted-config-initializer> + </module> + <!-- END: Config initialization --> + </modules> + + <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <!-- Config initialization --> + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry-builder</type> + <instance> + <name>noop-writer-registry-builder</name> + <provider>/modules/module[type='noop-writer-registry-builder'][name='noop-writer-registry-builder']</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:cfg-initializer</type> + <instance> + <name>persisted-context-initializer</name> + <provider>/modules/module[type='persisted-file-initializer'][name='persisted-context-initializer'] + </provider> + </instance> + <instance> + <name>persisted-config-initializer</name> + <provider>/modules/module[type='persisted-file-initializer'][name='persisted-config-initializer'] + </provider> + </instance> + </service> + </services> + </data> + </configuration> +</snapshot> diff --git a/infra/impl/src/main/config/netconf-north-config.xml b/infra/impl/src/main/config/netconf-north-config.xml new file mode 100644 index 000000000..35bd5ff04 --- /dev/null +++ b/infra/impl/src/main/config/netconf-north-config.xml @@ -0,0 +1,496 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (c) 2016 Cisco and/or its affiliates. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at: + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> + +<!-- vi: set et smarttab sw=4 tabstop=4: --> + +<snapshot> + <configuration> + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + + <!-- In memory DS dedicated to NETCONF monitoring, notifications etc. --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-config-datastore-provider</type> + <name>netconf-config-store-service</name> + <inmemory-config-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider"> + <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> + </inmemory-config-datastore-provider> + </module> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider">prefix:inmemory-operational-datastore-provider</type> + <name>netconf-operational-store-service</name> + <inmemory-operational-datastore-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider"> + <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> + </inmemory-operational-datastore-provider> + </module> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:impl">prefix:dom-inmemory-data-broker</type> + <name>netconf-inmemory-data-broker</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> + + <config-data-store> + <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type> + <name>netconf-config-store-service</name> + </config-data-store> + + <operational-data-store> + <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type> + <name>netconf-operational-store-service</name> + </operational-data-store> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">prefix:binding-forwarded-data-broker</type> + <name>netconf-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>netconf-inmemory-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> + <module> + <!--binding-broker-osgi-registry--> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:binding-broker-netconf</type> + <name>binding-broker-netconf</name> + <netconf-binding-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>netconf-binding-data-broker</name> + </netconf-binding-broker> + </module> + <!-- END:In memory DS dedicated to NETCONF monitoring, notifications etc. --> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper"> + prefix:netconf-mdsal-mapper + </type> + <name>netconf-vpp-mapper</name> + <root-schema-service> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service + </type> + <name>yang-schema-service</name> + </root-schema-service> + <root-schema-source-provider> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom"> + dom:yang-text-source-provider + </type> + <name>yang-text-source-provider</name> + </root-schema-source-provider> + <dom-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper"> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom"> + dom:dom-broker-osgi-registry + </type> + <name>vpp-dom-broker</name> + </dom-broker> + <mapper-aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-mapper-registry + </type> + <name>vpp-mapper-aggregator-registry</name> + </mapper-aggregator> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + prefix:netconf-server-dispatcher-impl + </type> + <name>netconf-vpp-server-dispatcher</name> + <mappers xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + dom:netconf-northbound-mapper + </type> + <name>vpp-mapper-aggregator</name> + </mappers> + <server-monitor + xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-monitoring + </type> + <name>vpp-server-monitor</name> + </server-monitor> + <boss-thread-group + xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty"> + prefix:netty-threadgroup + </type> + <name>global-boss-group</name> + </boss-thread-group> + <worker-thread-group + xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty"> + prefix:netty-threadgroup + </type> + <name>global-worker-group</name> + </worker-thread-group> + <timer xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty">prefix:netty-timer + </type> + <name>global-timer</name> + </timer> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring"> + prefix:netconf-mdsal-monitoring-mapper + </type> + <name>netconf-vpp-monitoring-mapper</name> + <server-monitoring xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-monitoring + </type> + <name>vpp-server-monitor</name> + </server-monitoring> + <binding-aware-broker + xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding"> + prefix:binding-broker-osgi-registry + </type> + <name>binding-broker-netconf</name> + </binding-aware-broker> + <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-mapper-registry + </type> + <name>vpp-mapper-aggregator-registry</name> + </aggregator> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + prefix:netconf-mapper-aggregator + </type> + <name>vpp-mapper-aggregator</name> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + prefix:netconf-server-monitoring-impl + </type> + <name>vpp-server-monitor</name> + <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl"> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + dom:netconf-northbound-mapper + </type> + <name>vpp-mapper-aggregator</name> + </aggregator> + </module> + + <!-- Change the port of global netconf north from 2830 to 2831, so that honeycomb netconf northbound can use 2830--> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">prefix:netconf-northbound-ssh</type> + <name>netconf-mdsal-ssh-server</name> + <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">2831</port> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + prefix:netconf-northbound-ssh + </type> + <name>netconf-vpp-ssh-server</name> + + <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh">2830</port> + <event-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty"> + prefix:netty-event-executor + </type> + <name>global-event-executor</name> + </event-executor> + <worker-thread-group xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netty"> + prefix:netty-threadgroup + </type> + <name>global-worker-group</name> + </worker-thread-group> + <processing-executor xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:threadpool"> + prefix:threadpool + </type> + <name>global-netconf-ssh-scheduled-executor</name> + </processing-executor> + <dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-dispatcher + </type> + <name>netconf-vpp-server-dispatcher</name> + </dispatcher> + <auth-provider xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:auth"> + prefix:netconf-auth-provider + </type> + <name>default-auth-provider</name> + </auth-provider> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification:impl"> + prefix:netconf-notification-manager + </type> + <name>vpp-netconf-notification-manager</name> + </module> + + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification"> + prefix:netconf-mdsal-notification-mapper + </type> + <name>netconf-vpp-notification-mapper</name> + <!--This is used to listen to netconf-state/capabilities changes to send out notifications--> + <data-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification"> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding"> + binding:binding-async-data-broker + </type> + <name>netconf-binding-data-broker</name> + </data-broker> + <!--This writes stream list into DS--> + <binding-aware-broker + xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding"> + prefix:binding-broker-osgi-registry + </type> + <name>binding-broker-netconf</name> + </binding-aware-broker> + <aggregator xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-mapper-registry + </type> + <name>vpp-mapper-aggregator-registry</name> + </aggregator> + <notification-registry + xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"> + prefix:netconf-notification-registry + </type> + <name>vpp-netconf-notification-manager</name> + </notification-registry> + <notification-collector> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"> + prefix:netconf-notification-collector + </type> + <name>vpp-netconf-notification-manager</name> + </notification-collector> + </module> + + + <!--TCP endpoint for MD-SAL netconf server --> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp"> + prefix:netconf-northbound-tcp + </type> + <name>netconf-vpp-tcp-server</name> + <dispatcher xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp"> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-dispatcher + </type> + <name>netconf-vpp-server-dispatcher</name> + </dispatcher> + <port xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp">7777</port> + </module> + + <!-- Special reader for Netconf monitoring. The problem is that we store netconf monitoring in a dedicated DS. + However netconf is wired to our reader registry, so we need to delegate the reads of netconf-monitoring + through our readers to the dedicated DS--> + <module> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:netconf-monitoring-reader</type> + <name>netconf-monitoring-reader</name> + <netconf-monitoring-binding-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>netconf-binding-data-broker</name> + </netconf-monitoring-binding-broker> + </module> + <module> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type> + <name>read-registry</name> + <reader-factory> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-factory</type> + <name>netconf-monitoring-reader</name> + </reader-factory> + </module> + <!-- END: Special reader for Netconf monitoring. --> + + </modules> + + <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <service> + <type xmlns:config-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store">config-dom-store-spi:config-dom-datastore</type> + <instance> + <name>netconf-config-store-service</name> + <provider>/modules/module[type='inmemory-config-datastore-provider'][name='netconf-config-store-service']</provider> + </instance> + </service> + <service> + <type xmlns:operational-dom-store-spi="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store">operational-dom-store-spi:operational-dom-datastore</type> + <instance> + <name>netconf-operational-store-service</name> + <provider>/modules/module[type='inmemory-operational-datastore-provider'][name='netconf-operational-store-service']</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>netconf-inmemory-data-broker</name> + <provider>/modules/module[type='dom-inmemory-data-broker'][name='netconf-inmemory-data-broker']</provider> + </instance> + </service> + + <service> + <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-factory</type> + <instance> + <name>netconf-monitoring-reader</name> + <provider>/modules/module[type='netconf-monitoring-reader'][name='netconf-monitoring-reader']</provider> + </instance> + </service> + + <!-- In memory DS dedicated to NETCONF monitoring, notifications etc. --> + + <service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <instance> + <name>netconf-binding-data-broker</name> + <provider>/modules/module[type='binding-forwarded-data-broker'][name='netconf-binding-data-broker']</provider> + </instance> + </service> + <service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type> + <instance> + <name>binding-broker-netconf</name> + <provider>/modules/module[type='binding-broker-netconf'][name='binding-broker-netconf']</provider> + </instance> + </service> + <!-- END:In memory DS dedicated to NETCONF monitoring, notifications etc. --> + + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-monitoring + </type> + <instance> + <name>vpp-server-monitor</name> + <provider>/modules/module[type='netconf-server-monitoring-impl'][name='vpp-server-monitor'] + </provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-northbound-mapper + </type> + <instance> + <name>netconf-vpp-mapper</name> + <provider>/modules/module[type='netconf-mdsal-mapper'][name='netconf-vpp-mapper']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-northbound-mapper + </type> + <instance> + <name>vpp-mapper-aggregator</name> + <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-mapper-registry + </type> + <instance> + <name>vpp-mapper-aggregator-registry</name> + <provider>/modules/module[type='netconf-mapper-aggregator'][name='vpp-mapper-aggregator']</provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound"> + prefix:netconf-server-dispatcher + </type> + <instance> + <name>netconf-vpp-server-dispatcher</name> + <provider> + /modules/module[type='netconf-server-dispatcher-impl'][name='netconf-vpp-server-dispatcher'] + </provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:north:mapper"> + prefix:netconf-northbound-mapper + </type> + <instance> + <name>netconf-vpp-notification-mapper</name> + <provider> + /modules/module[type='netconf-mdsal-notification-mapper'][name='netconf-vpp-notification-mapper'] + </provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"> + prefix:netconf-notification-collector + </type> + <instance> + <name>vpp-netconf-notification-manager</name> + <provider> + /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager'] + </provider> + </instance> + </service> + <service> + <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:notification"> + prefix:netconf-notification-registry + </type> + <instance> + <name>vpp-netconf-notification-manager</name> + <provider> + /modules/module[type='netconf-notification-manager'][name='vpp-netconf-notification-manager'] + </provider> + </instance> + </service> + </services> + + </data> + </configuration> + <required-capabilities> + <capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&revision=2014-12-10</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:mapper?module=netconf-mdsal-mapper&revision=2015-01-14</capability> + <capability> + urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:monitoring?module=netconf-mdsal-monitoring&revision=2015-02-18 + </capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:ssh?module=netconf-northbound-ssh&revision=2015-01-14</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp?module=netconf-northbound-tcp&revision=2015-04-23</capability> + <capability> + urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&revision=2015-01-12 + </capability> + <capability> + urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&revision=2013-12-01 + </capability> + <capability> + urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&revision=2015-08-03 + </capability> + </required-capabilities> +</snapshot> diff --git a/infra/impl/src/main/config/restconf-north-config.xml b/infra/impl/src/main/config/restconf-north-config.xml new file mode 100644 index 000000000..ff2cdac18 --- /dev/null +++ b/infra/impl/src/main/config/restconf-north-config.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (c) 2016 Cisco and/or its affiliates. + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at: + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<snapshot> + <configuration> + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <module> + <type xmlns:rest="urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector">rest:rest-connector-impl</type> + <name>rest-connector-default-impl</name> + <!-- Reconfiguring the default restconf northbound instance, to wire it just to honeycomb broker facade --> + <dom-broker> + <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:dom-broker-osgi-registry</type> + <name>vpp-dom-broker</name> + </dom-broker> + </module> + </modules> + </data> + </configuration> + <required-capabilities> + <capability>urn:opendaylight:params:xml:ns:yang:controller:sal:restconf:service?module=sal-restconf-service&revision=2015-07-08</capability> + <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:rest:connector?module=opendaylight-rest-connector&revision=2014-07-24</capability> + </required-capabilities> +</snapshot> diff --git a/infra/impl/src/main/java/io/fd/honeycomb/v3po/impl/NorthboundFacadeHoneycombDOMBroker.java b/infra/impl/src/main/java/io/fd/honeycomb/v3po/impl/NorthboundFacadeHoneycombDOMBroker.java new file mode 100644 index 000000000..c2d70c38c --- /dev/null +++ b/infra/impl/src/main/java/io/fd/honeycomb/v3po/impl/NorthboundFacadeHoneycombDOMBroker.java @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.fd.honeycomb.v3po.impl; + +import com.google.common.base.Optional; +import com.google.common.collect.Maps; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import javax.annotation.concurrent.NotThreadSafe; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; +import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; +import org.opendaylight.controller.md.sal.dom.api.DOMNotificationPublishService; +import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcException; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; +import org.opendaylight.controller.sal.core.api.Broker; +import org.opendaylight.controller.sal.core.api.BrokerService; +import org.opendaylight.controller.sal.core.api.Consumer; +import org.opendaylight.controller.sal.core.api.Provider; +import org.opendaylight.controller.sal.core.api.model.SchemaService; +import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.model.api.SchemaPath; +import org.osgi.framework.BundleContext; + +/** + * Implementation of dom broker to facade VPP pipeline for northbound APIs + */ +public class NorthboundFacadeHoneycombDOMBroker implements AutoCloseable, Broker { + + private static final BrokerService EMPTY_DOM_RPC_SERVICE = new EmptyDomRpcService(); + private static final BrokerService EMPTY_DOM_MOUNT_SERVICE = new EmptyDomMountService(); + + private Map<Class<? extends BrokerService>, BrokerService> services; + + public NorthboundFacadeHoneycombDOMBroker(@Nonnull final DOMDataBroker domDataBrokerDependency, + @Nonnull final SchemaService schemaBiService, + @Nonnull final DOMNotificationService domNotificatioNService) { + services = Maps.newHashMap(); + services.put(DOMDataBroker.class, domDataBrokerDependency); + // All services below are required to be present by Restconf northbound + services.put(SchemaService.class, schemaBiService); + services.put(DOMRpcService.class, EMPTY_DOM_RPC_SERVICE); + services.put(DOMMountPointService.class, EMPTY_DOM_MOUNT_SERVICE); + services.put(DOMNotificationService.class, domNotificatioNService); + // TODO do both notification service types have to be registered ? + services.put(DOMNotificationPublishService.class, domNotificatioNService); + } + + @Override + public void close() throws Exception { + // NOOP + } + + @Override + public ConsumerSession registerConsumer(final Consumer consumer) { + final SimpleConsumerSession session = new SimpleConsumerSession(services); + consumer.onSessionInitiated(session); + return session; + } + + @Deprecated + @Override + public ConsumerSession registerConsumer(final Consumer consumer, final BundleContext bundleContext) { + throw new UnsupportedOperationException(); + } + + @Override + public ProviderSession registerProvider(final Provider provider) { + final SimpleProviderSession session = new SimpleProviderSession(services); + provider.onSessionInitiated(session); + return session; + } + + @Override + public ProviderSession registerProvider(final Provider provider, final BundleContext bundleContext) { + throw new UnsupportedOperationException(); + } + + @NotThreadSafe + private static class SimpleConsumerSession implements ConsumerSession { + private boolean closed; + private final Map<Class<? extends BrokerService>, BrokerService> services; + + private SimpleConsumerSession(final Map<Class<? extends BrokerService>, BrokerService> services) { + this.services = services; + } + + @Override + public boolean isClosed() { + return closed; + } + + @Override + public <T extends BrokerService> T getService(final Class<T> aClass) { + return (T)services.get(aClass); + } + + @Override + public void close() { + closed = true; + } + } + + @NotThreadSafe + private static class SimpleProviderSession implements ProviderSession { + private boolean closed; + private final Map<Class<? extends BrokerService>, BrokerService> services; + + private SimpleProviderSession(final Map<Class<? extends BrokerService>, BrokerService> services) { + this.services = services; + } + + @Override + public boolean isClosed() { + return closed; + } + + @Override + public <T extends BrokerService> T getService(final Class<T> aClass) { + return (T)services.get(aClass); + } + + @Override + public void close() { + closed = true; + } + } + + private static class EmptyDomRpcService implements DOMRpcService { + @Nonnull + @Override + public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final SchemaPath schemaPath, + @Nullable final NormalizedNode<?, ?> normalizedNode) { + return Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture( + new DOMRpcImplementationNotAvailableException("RPCs not supported")); + } + + @Nonnull + @Override + public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull final T t) { + return new ListenerRegistration<T>() { + @Override + public void close() { + // Noop + } + + @Override + public T getInstance() { + return t; + } + }; + } + } + + private static class EmptyDomMountService implements DOMMountPointService { + @Override + public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier yangInstanceIdentifier) { + return Optional.absent(); + } + + @Override + public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier yangInstanceIdentifier) { + throw new UnsupportedOperationException("No mountpoint support"); + } + + @Override + public ListenerRegistration<MountProvisionListener> registerProvisionListener( + final MountProvisionListener mountProvisionListener) { + return new ListenerRegistration<MountProvisionListener>() { + @Override + public void close() { + // Noop + } + + @Override + public MountProvisionListener getInstance() { + return mountProvisionListener; + } + }; + } + } +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModule.java b/infra/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/infra/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/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/ContextDataBrokerModuleFactory.java b/infra/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/infra/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/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java new file mode 100644 index 000000000..8aa3d64d9 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModule.java @@ -0,0 +1,34 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.data.impl.DataBroker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataBrokerModule extends + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractDataBrokerModule { + + private static final Logger LOG = LoggerFactory.getLogger(DataBrokerModule.class); + + public DataBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public DataBrokerModule(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.DataBrokerModule 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() { + LOG.debug("DataBrokerModule.createInstance()"); + return DataBroker.create(getConfigDataTreeDependency(), getOperationalDataTreeDependency()); + } +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java new file mode 100644 index 000000000..cc30beacf --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/DataBrokerModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: honeycomb-dom-data-broker +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Mon Apr 11 07:53:38 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 DataBrokerModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractDataBrokerModuleFactory { + +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModule.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModule.java new file mode 100644 index 000000000..48d227d01 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModule.java @@ -0,0 +1,117 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer; +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; +import org.opendaylight.controller.sal.binding.api.BindingAwareService; +import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.RpcService; +import org.osgi.framework.BundleContext; + +public class NetconfBindingBrokerModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfBindingBrokerModule { + public NetconfBindingBrokerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public NetconfBindingBrokerModule(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.NetconfBindingBrokerModule 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 FakeBindingAwareBroker(getNetconfBindingBrokerDependency()); + } + + private static class FakeBindingAwareBroker implements BindingAwareBroker, AutoCloseable { + + private DataBroker netconfBindingBrokerDependency; + + public FakeBindingAwareBroker(final DataBroker netconfBindingBrokerDependency) { + + this.netconfBindingBrokerDependency = netconfBindingBrokerDependency; + } + + @Deprecated + @Override + public ConsumerContext registerConsumer(final BindingAwareConsumer bindingAwareConsumer, + final BundleContext bundleContext) { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public ConsumerContext registerConsumer(final BindingAwareConsumer bindingAwareConsumer) { + final ConsumerContext consumerContext = new ConsumerContext() { + @Override + public <T extends BindingAwareService> T getSALService(final Class<T> aClass) { + return aClass.equals(DataBroker.class) + ? (T) netconfBindingBrokerDependency + : null; + } + + @Override + public <T extends RpcService> T getRpcService(final Class<T> aClass) { + return null; + } + }; + bindingAwareConsumer.onSessionInitialized(consumerContext); + return consumerContext; + } + + @Override + public ProviderContext registerProvider(final BindingAwareProvider bindingAwareProvider, + final BundleContext bundleContext) { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public ProviderContext registerProvider(final BindingAwareProvider bindingAwareProvider) { + final ProviderContext context = new ProviderContext() { + @Override + public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener( + final L l) { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public <T extends RpcService> T getRpcService(final Class<T> aClass) { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> aClass, final T t) + throws IllegalStateException { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation( + final Class<T> aClass, final T t) throws IllegalStateException { + throw new UnsupportedOperationException("Unsupported"); + } + + @Override + public <T extends BindingAwareService> T getSALService(final Class<T> aClass) { + return aClass.equals(DataBroker.class) + ? (T) netconfBindingBrokerDependency + : null; } + }; + bindingAwareProvider.onSessionInitiated(context); + return context; + } + + @Override + public void close() throws Exception { + netconfBindingBrokerDependency = null; + } + } +} + diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModuleFactory.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModuleFactory.java new file mode 100644 index 000000000..b64b0b1e1 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfBindingBrokerModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: binding-broker-netconf +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Wed Mar 23 10:45:48 CET 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 NetconfBindingBrokerModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfBindingBrokerModuleFactory { + +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java new file mode 100644 index 000000000..8502fcbd2 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModule.java @@ -0,0 +1,46 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.translate.read.registry.ModifiableReaderRegistryBuilder; +import io.fd.honeycomb.v3po.translate.util.read.BindingBrokerReader; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfState; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfStateBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +public class NetconfMonitoringReaderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfMonitoringReaderModule { + public NetconfMonitoringReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public NetconfMonitoringReaderModule(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.NetconfMonitoringReaderModule 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 ReaderFactory(getNetconfMonitoringBindingBrokerDependency()); + } + + + private static final class ReaderFactory implements AutoCloseable, io.fd.honeycomb.v3po.translate.read.ReaderFactory { + + private final DataBroker netconfMonitoringBindingBrokerDependency; + + public ReaderFactory(final DataBroker netconfMonitoringBindingBrokerDependency) { + this.netconfMonitoringBindingBrokerDependency = netconfMonitoringBindingBrokerDependency; + } + + @Override + public void init(final ModifiableReaderRegistryBuilder registry) { + registry.add(new BindingBrokerReader<>(InstanceIdentifier.create(NetconfState.class), + netconfMonitoringBindingBrokerDependency, + LogicalDatastoreType.OPERATIONAL, NetconfStateBuilder.class)); + } + } +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java new file mode 100644 index 000000000..b8b7bec63 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/NetconfMonitoringReaderModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: v3po-impl yang module local name: netconf-monitoring-reader +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Tue Apr 12 13:03:40 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 NetconfMonitoringReaderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractNetconfMonitoringReaderModuleFactory { + +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java new file mode 100644 index 000000000..caa792da4 --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import io.fd.honeycomb.v3po.impl.NorthboundFacadeHoneycombDOMBroker; +import org.opendaylight.controller.sal.core.api.AbstractProvider; +import org.opendaylight.controller.sal.core.api.Broker; +import org.opendaylight.controller.sal.core.api.model.SchemaService; + +public class V3poModule extends + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractV3poModule { + + public V3poModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public V3poModule(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.V3poModule 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 Broker.ProviderSession providerSession = + getDomBrokerDependency().registerProvider(new AbstractProvider() { + @Override + public void onSessionInitiated(final Broker.ProviderSession providerSession) { + // NOOP + } + }); + final SchemaService schemaBiService = providerSession.getService(SchemaService.class); + + return new NorthboundFacadeHoneycombDOMBroker(getHoneycombDomDataBrokerDependency(), schemaBiService, + getHoneycombDomNotificationServiceDependency()); + } + +} diff --git a/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactory.java b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactory.java new file mode 100644 index 000000000..5c942861d --- /dev/null +++ b/infra/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactory.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* +* Generated file +* +* Generated from: yang module name: v3po yang module local name: v3po +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Fri Jan 02 13:49:24 CST 2015 +* +* 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 V3poModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210.AbstractV3poModuleFactory { + +} diff --git a/infra/impl/src/main/yang/v3po-impl.yang b/infra/impl/src/main/yang/v3po-impl.yang new file mode 100644 index 000000000..fa9670678 --- /dev/null +++ b/infra/impl/src/main/yang/v3po-impl.yang @@ -0,0 +1,155 @@ +module v3po-impl { + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:v3po:impl"; + prefix "v3po-impl"; + + 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;} + import translate-api { prefix tapi; revision-date 2016-04-06; } + import data-api { prefix dapi; revision-date 2016-04-11; } + import notification-api { prefix hc-notif-a; revision-date 2016-06-01; } + + description + "Service definition for v3po project"; + + revision "2014-12-10" { + description + "Initial revision"; + } + + identity v3po { + base config:module-type; + config:provided-service dom:dom-broker-osgi-registry; + config:java-name-prefix V3po; + } + + augment "/config:modules/config:module/config:configuration" { + case v3po { + when "/config:modules/config:module/config:type = 'v3po'"; + container dom-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dom:dom-broker-osgi-registry; + } + } + } + + container honeycomb-dom-data-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dom:dom-async-data-broker; + } + } + } + + container honeycomb-dom-notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity hc-notif-a:dom-notification-service; + } + } + } + + } + } + + identity binding-broker-netconf { + base config:module-type; + config:provided-service md-sal-binding:binding-broker-osgi-registry; + config:java-name-prefix NetconfBindingBroker; + } + + augment "/config:modules/config:module/config:configuration" { + case binding-broker-netconf { + when "/config:modules/config:module/config:type = 'binding-broker-netconf'"; + + container netconf-binding-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-async-data-broker; + } + } + } + + } + } + + identity honeycomb-dom-data-broker { + base config:module-type; + config:provided-service dom:dom-async-data-broker; + config:java-name-prefix DataBroker; + } + + augment "/config:modules/config:module/config:configuration" { + case honeycomb-dom-data-broker { + when "/config:modules/config:module/config:type = 'honeycomb-dom-data-broker'"; + + container config-data-tree { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dapi:honeycomb-modifiable-data-tree; + } + } + } + + container operational-data-tree { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity dapi:honeycomb-readable-data-tree; + } + } + } + + } + } + + 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-factory; + } + + augment "/config:modules/config:module/config:configuration" { + case netconf-monitoring-reader { + when "/config:modules/config:module/config:type = 'netconf-monitoring-reader'"; + + container netconf-monitoring-binding-broker { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity md-sal-binding:binding-async-data-broker; + } + } + } + + } + } +} diff --git a/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactoryTest.java b/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactoryTest.java new file mode 100644 index 000000000..5b9a67458 --- /dev/null +++ b/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleFactoryTest.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import org.junit.Test; + +public class V3poModuleFactoryTest { + @Test + public void testFactoryConstructor() { + // ensure no exceptions on construction + new V3poModuleFactory(); + } +} diff --git a/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java b/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java new file mode 100644 index 000000000..3d8e79641 --- /dev/null +++ b/infra/impl/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModuleTest.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2015 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import javax.management.ObjectName; +import org.junit.Test; +import org.opendaylight.controller.config.api.DependencyResolver; +import org.opendaylight.controller.config.api.JmxAttribute; +import org.opendaylight.controller.config.api.ModuleIdentifier; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.core.api.Broker; +import org.opendaylight.controller.sal.core.api.Provider; +import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; + +public class V3poModuleTest { + @Test + public void testCustomValidation() { + V3poModule module = new V3poModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class)); + + // ensure no exceptions on validation + // currently this method is empty + module.customValidation(); + } + + @Test + public void testCreateInstance() throws Exception { + // configure mocks + DependencyResolver dependencyResolver = mock(DependencyResolver.class); + BindingAwareBroker broker = mock(BindingAwareBroker.class); + when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))) + .thenReturn(broker); + final org.opendaylight.controller.sal.core.api.Broker domBroker = mock(org.opendaylight.controller.sal.core.api.Broker.class); + when(dependencyResolver.resolveInstance(eq(org.opendaylight.controller.sal.core.api.Broker.class), any(ObjectName.class), any(JmxAttribute.class))) + .thenReturn(domBroker); + doReturn(mock(Broker.ProviderSession.class)).when(domBroker).registerProvider(any(Provider.class)); + when(dependencyResolver.resolveInstance(eq(BindingNormalizedNodeSerializer.class), any(ObjectName.class), any(JmxAttribute.class))) + .thenReturn(mock(BindingNormalizedNodeSerializer.class)); + when(dependencyResolver.resolveInstance(eq(DOMDataBroker.class), any(ObjectName.class), any(JmxAttribute.class))) + .thenReturn(mock(DOMDataBroker.class)); + + // create instance of module with injected mocks + V3poModule module = new V3poModule(mock(ModuleIdentifier.class), dependencyResolver); + + // getInstance calls resolveInstance to get the broker dependency and then calls createInstance + AutoCloseable closeable = module.getInstance(); + + // ensure no exceptions on close + closeable.close(); + } +} |