summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
Diffstat (limited to 'v3po')
-rw-r--r--v3po/artifacts/pom.xml5
-rw-r--r--v3po/config/Readme.adoc10
-rw-r--r--v3po/config/pom.xml31
-rw-r--r--v3po/config/src/main/java/io/fd/honeycomb/v3po/config/ReaderRegistry.java116
-rw-r--r--v3po/config/src/main/java/io/fd/honeycomb/v3po/config/WriterRegistry.java104
-rw-r--r--v3po/features/pom.xml20
-rw-r--r--v3po/features/src/main/features/features.xml6
-rw-r--r--v3po/impl/pom.xml5
-rw-r--r--v3po/impl/src/main/config/default-config.xml42
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java30
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java6
-rw-r--r--v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java7
-rw-r--r--v3po/impl/src/main/yang/v3po-impl.yang29
-rw-r--r--v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java2
-rw-r--r--v3po/pom.xml2
-rw-r--r--v3po/translate-api/pom.xml2
-rw-r--r--v3po/translate-api/src/main/yang/translate-api.yang37
-rw-r--r--v3po/translate-utils/pom.xml4
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java80
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java13
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java82
-rw-r--r--v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java13
-rw-r--r--v3po/translate-utils/src/main/yang/translate-utils.yang61
-rw-r--r--v3po/v3po2vpp/pom.xml21
-rw-r--r--v3po/v3po2vpp/src/main/config/default-config.xml84
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java96
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModuleFactory.java13
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java104
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModuleFactory.java13
-rw-r--r--v3po/v3po2vpp/src/main/yang/v3po2vpp.yang60
-rw-r--r--v3po/vpp-japi-cfg/pom.xml39
-rw-r--r--v3po/vpp-japi-cfg/src/main/config/default-config.xml46
-rw-r--r--v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModule.java37
-rw-r--r--v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModuleFactory.java13
-rw-r--r--v3po/vpp-japi-cfg/src/main/yang/vpp-japi-cfg.yang38
35 files changed, 961 insertions, 310 deletions
diff --git a/v3po/artifacts/pom.xml b/v3po/artifacts/pom.xml
index 9240da571..909ca45ab 100644
--- a/v3po/artifacts/pom.xml
+++ b/v3po/artifacts/pom.xml
@@ -71,6 +71,11 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>vpp-japi-cfg</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>v3po2vpp</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/v3po/config/Readme.adoc b/v3po/config/Readme.adoc
deleted file mode 100644
index 35151195e..000000000
--- a/v3po/config/Readme.adoc
+++ /dev/null
@@ -1,10 +0,0 @@
-= Honeycomb. Translation layer configuration
-
-Defines ReaderRegistry and WriterRegistry for VPP.
-Data layer delegates actual reads and writes to these registers.
-Registries define root readers and writers for supported YANG models.
-
-
-
-
-
diff --git a/v3po/config/pom.xml b/v3po/config/pom.xml
deleted file mode 100644
index 910fc7daa..000000000
--- a/v3po/config/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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>api-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>config</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <dependencies>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.fd.honeycomb.v3po</groupId>
- <artifactId>v3po2vpp</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
-</project> \ No newline at end of file
diff --git a/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/ReaderRegistry.java b/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/ReaderRegistry.java
deleted file mode 100644
index 7ab2dd430..000000000
--- a/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/ReaderRegistry.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.
- */
-
-package io.fd.honeycomb.v3po.config;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Multimap;
-import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader;
-import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader;
-import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader;
-import io.fd.honeycomb.v3po.translate.util.read.DelegatingReaderRegistry;
-import io.fd.honeycomb.v3po.translate.util.read.ReflexiveChildReaderCustomizer;
-import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
-import io.fd.honeycomb.v3po.translate.util.RWUtils;
-import io.fd.honeycomb.v3po.translate.read.ChildReader;
-import io.fd.honeycomb.v3po.translate.read.ReadContext;
-import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
-import io.fd.honeycomb.v3po.translate.read.Reader;
-import io.fd.honeycomb.v3po.translate.v3po.vppstate.BridgeDomainCustomizer;
-import io.fd.honeycomb.v3po.translate.v3po.vppstate.VersionCustomizer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.vppjapi.vppApi;
-
-// TODO use some DI framework instead of singleton
-public class ReaderRegistry implements io.fd.honeycomb.v3po.translate.read.ReaderRegistry {
-
- private static ReaderRegistry instance;
-
- private final DelegatingReaderRegistry reader;
-
- private ReaderRegistry(@Nonnull final vppApi vppApi) {
- final CompositeRootReader<VppState, VppStateBuilder> vppStateReader = initVppStateReader(vppApi);
- // TODO add more root readers
- reader = new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader));
- }
-
- private static CompositeRootReader<VppState, VppStateBuilder> initVppStateReader(@Nonnull final vppApi vppApi) {
-
- final ChildReader<Version> versionReader = new CompositeChildReader<>(
- Version.class, new VersionCustomizer(vppApi));
-
- final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder>
- bridgeDomainReader = new CompositeListReader<>(
- BridgeDomain.class,
- new BridgeDomainCustomizer(vppApi));
-
- final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>(
- BridgeDomains.class,
- RWUtils.singletonChildReaderList(bridgeDomainReader),
- new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class));
-
- final List<ChildReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>();
- childVppReaders.add(versionReader);
- childVppReaders.add(bridgeDomainsReader);
-
- return new CompositeRootReader<>(
- VppState.class,
- childVppReaders,
- RWUtils.<VppState>emptyAugReaderList(),
- new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class));
- }
-
- public static synchronized ReaderRegistry getInstance(@Nonnull final vppApi vppApi) {
- if (instance == null) {
- instance = new ReaderRegistry(vppApi);
- }
- return instance;
- }
-
- @Nonnull
- @Override
- public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll(
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- return reader.readAll(ctx);
- }
-
- @Nonnull
- @Override
- public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
- @Nonnull final ReadContext ctx) throws ReadFailedException {
- return reader.read(id, ctx);
- }
-
- @Nonnull
- @Override
- public InstanceIdentifier<DataObject> getManagedDataObjectType() {
- return reader.getManagedDataObjectType();
- }
-}
diff --git a/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/WriterRegistry.java b/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/WriterRegistry.java
deleted file mode 100644
index 2d579c449..000000000
--- a/v3po/config/src/main/java/io/fd/honeycomb/v3po/config/WriterRegistry.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-package io.fd.honeycomb.v3po.config;
-
-import io.fd.honeycomb.v3po.translate.TranslationException;
-import io.fd.honeycomb.v3po.translate.util.RWUtils;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeRootWriter;
-import io.fd.honeycomb.v3po.translate.util.write.DelegatingWriterRegistry;
-import io.fd.honeycomb.v3po.translate.util.write.NoopWriterCustomizer;
-import io.fd.honeycomb.v3po.translate.util.write.ReflexiveChildWriterCustomizer;
-import io.fd.honeycomb.v3po.translate.v3po.vpp.BridgeDomainCustomizer;
-import io.fd.honeycomb.v3po.translate.write.ChildWriter;
-import io.fd.honeycomb.v3po.translate.write.Writer;
-import io.fd.honeycomb.v3po.translate.write.WriteContext;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.openvpp.vppjapi.vppApi;
-
-// TODO use some DI framework instead of singleton
-public class WriterRegistry implements io.fd.honeycomb.v3po.translate.write.WriterRegistry {
-
- private static WriterRegistry instance;
-
- private final DelegatingWriterRegistry writer;
-
- private WriterRegistry(@Nonnull final vppApi vppApi) {
- final CompositeRootWriter<Vpp> vppWriter = initVppStateWriter(vppApi);
- writer = new DelegatingWriterRegistry(Collections.<Writer<? extends DataObject>>singletonList(vppWriter));
- }
-
- private static CompositeRootWriter<Vpp> initVppStateWriter(@Nonnull final vppApi vppApi) {
- final CompositeListWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListWriter<>(
- BridgeDomain.class,
- new BridgeDomainCustomizer(vppApi));
-
- final ChildWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildWriter<>(
- BridgeDomains.class,
- RWUtils.singletonChildWriterList(bridgeDomainWriter),
- new ReflexiveChildWriterCustomizer<BridgeDomains>());
-
- final List<ChildWriter<? extends ChildOf<Vpp>>> childWriters = new ArrayList<>();
- childWriters.add(bridgeDomainsWriter);
-
- return new CompositeRootWriter<>(
- Vpp.class,
- childWriters,
- new NoopWriterCustomizer<Vpp>());
- }
-
- public static synchronized WriterRegistry getInstance(@Nonnull final vppApi vppApi) {
- if (instance == null) {
- instance = new WriterRegistry(vppApi);
- }
- return instance;
- }
-
- @Nonnull
- @Override
- public InstanceIdentifier<DataObject> getManagedDataObjectType() {
- return writer.getManagedDataObjectType();
- }
-
- @Override
- public void update(@Nonnull final InstanceIdentifier<? extends DataObject> id,
- @Nullable final DataObject dataBefore,
- @Nullable final DataObject data, @Nonnull final WriteContext ctx) throws TranslationException {
- writer.update(id, dataBefore, data, ctx);
- }
-
- @Override
- public void update(@Nonnull final Map<InstanceIdentifier<?>, DataObject> dataBefore,
- @Nonnull final Map<InstanceIdentifier<?>, DataObject> dataAfter,
- @Nonnull final WriteContext ctx)
- throws TranslationException {
- writer.update(dataBefore, dataAfter, ctx);
- }
-}
diff --git a/v3po/features/pom.xml b/v3po/features/pom.xml
index ce4132552..0ff43204b 100644
--- a/v3po/features/pom.xml
+++ b/v3po/features/pom.xml
@@ -135,21 +135,28 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>config</artifactId>
+ <artifactId>data-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>data-api</artifactId>
+ <artifactId>data-impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>data-impl</artifactId>
+ <artifactId>vpp-japi-cfg</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>vpp-japi-cfg</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>translate-api</artifactId>
<version>${project.version}</version>
</dependency>
@@ -179,6 +186,13 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>v3po2vpp</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </dependency>
+ <dependency>
<groupId>io.fd.vpp</groupId>
<artifactId>vppjapi</artifactId>
<version>1.0.0-SNAPSHOT</version>
diff --git a/v3po/features/src/main/features/features.xml b/v3po/features/src/main/features/features.xml
index e6a8a64f3..a10e9fe68 100644
--- a/v3po/features/src/main/features/features.xml
+++ b/v3po/features/src/main/features/features.xml
@@ -39,14 +39,16 @@
<bundle>mvn:io.fd.honeycomb.v3po/translate-spi/${project.version}</bundle>
<bundle>mvn:io.fd.honeycomb.v3po/translate-utils/${project.version}</bundle>
<bundle>mvn:io.fd.honeycomb.v3po/vpp-translate-utils/${project.version}</bundle>
- <bundle>mvn:io.fd.honeycomb.v3po/config/${project.version}</bundle>
<bundle>mvn:io.fd.honeycomb.v3po/data-api/${project.version}</bundle>
<bundle>mvn:io.fd.honeycomb.v3po/data-impl/${project.version}</bundle>
<bundle>mvn:io.fd.honeycomb.v3po/translate-impl/${project.version}</bundle>
- <bundle>mvn:io.fd.honeycomb.v3po/v3po2vpp/${project.version}</bundle>
<bundle>wrap:mvn:io.fd.vpp/vppjapi/1.0.0-SNAPSHOT</bundle>
+ <bundle>mvn:io.fd.honeycomb.v3po/vpp-japi-cfg/${project.version}</bundle>
+ <bundle>mvn:io.fd.honeycomb.v3po/v3po2vpp/${project.version}</bundle>
+ <configfile finalname="${configfile.directory}/vpp-japi.xml">mvn:io.fd.honeycomb.v3po/vpp-japi-cfg/${project.version}/xml/config</configfile>
<configfile finalname="${configfile.directory}/v3po.xml">mvn:io.fd.honeycomb.v3po/v3po-impl/${project.version}/xml/config</configfile>
<configfile finalname="${configfile.directory}/v3po-netconf.xml">mvn:io.fd.honeycomb.v3po/v3po-impl/${project.version}/xml/netconf</configfile>
+ <configfile finalname="${configfile.directory}/v3po2vpp.xml">mvn:io.fd.honeycomb.v3po/v3po2vpp/${project.version}/xml/config</configfile>
</feature>
<feature name='odl-v3po-rest' version='${project.version}' description='OpenDaylight :: v3po :: REST'>
diff --git a/v3po/impl/pom.xml b/v3po/impl/pom.xml
index be824ca79..ffa16aed2 100644
--- a/v3po/impl/pom.xml
+++ b/v3po/impl/pom.xml
@@ -46,11 +46,6 @@
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>config</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>data-impl</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/v3po/impl/src/main/config/default-config.xml b/v3po/impl/src/main/config/default-config.xml
index 261cd3d6f..f4b75efc7 100644
--- a/v3po/impl/src/main/config/default-config.xml
+++ b/v3po/impl/src/main/config/default-config.xml
@@ -15,15 +15,26 @@
limitations under the License.
-->
<snapshot>
- <!--TODO update required caps-->
<required-capabilities>
<capability>urn:opendaylight:params:xml:ns:yang:v3po:impl?module=v3po-impl&amp;revision=2014-12-10</capability>
+ <capability>urn:honeycomb:params:xml:ns:yang:translate:utils?module=translate-utils&amp;revision=2016-04-06</capability>
+ <capability>urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg?module=vpp-japi-cfg&amp;revision=2016-04-06</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;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>
+
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:v3po:impl">prefix:v3po</type>
<name>v3po-default</name>
@@ -35,18 +46,43 @@
<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>
+ <vpp-japi>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg">prefix:vpp-japi</type>
+ <name>vpp-japi</name>
+ </vpp-japi>
+ <reader-registry>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-registry</type>
+ <name>read-registry</name>
+ </reader-registry>
+ <writer-registry>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer-registry</type>
+ <name>write-registry</name>
+ </writer-registry>
</module>
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<service>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader-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: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>
+ <provider>/modules/module[type='v3po'][name='v3po-default']</provider>
</instance>
</service>
</services>
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
index a97909190..973d34585 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
@@ -20,9 +20,8 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import io.fd.honeycomb.v3po.config.ReaderRegistry;
-import io.fd.honeycomb.v3po.config.WriterRegistry;
-import java.io.IOException;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -72,11 +71,18 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
private VppIetfInterfaceListener vppInterfaceListener;
private VppBridgeDomainListener vppBridgeDomainListener;
private vppApi api;
+ private ReaderRegistry readerRegistry;
+ private WriterRegistry writerRegistry;
private DataBroker db;
VppPollOperDataImpl vppPollOperData;
private VppDataBrokerInitializationProvider vppDataBrokerInitializationProvider;
- public V3poProvider(@Nonnull final Broker domBroker) {
+ public V3poProvider(@Nonnull final Broker domBroker, final vppApi vppJapiDependency,
+ final ReaderRegistry readerRegistry,
+ final WriterRegistry writerRegistry) {
+ api = vppJapiDependency;
+ this.readerRegistry = readerRegistry;
+ this.writerRegistry = writerRegistry;
this.domBroker = Preconditions.checkNotNull(domBroker, "domBroker should not be null");
}
@@ -98,6 +104,7 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
transaction = db.newWriteOnlyTransaction();
// FIXME this is minimal and we need to sync the entire configuration
+ // FIXME remove from here and make this specific for interface customizers
syncInterfaces(transaction, api);
future = transaction.submit();
@@ -177,15 +184,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
public void onSessionInitiated(final ProviderContext session) {
LOG.info("VPP-INFO: V3poProvider Session Initiated");
- try {
- api = new vppApi("v3poODL");
- } catch (IOException e) {
- LOG.error("VPP-ERROR: VPP api client connection failed", e);
- return;
- }
-
- LOG.info("VPP-INFO: VPP api client connection established");
-
db = session.getSALService(DataBroker.class);
initializeVppConfig();
initVppOperational();
@@ -195,9 +193,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
vppPollOperData);
startOperationalUpdateTimer();
- final ReaderRegistry readerRegistry = ReaderRegistry.getInstance(api);
- final WriterRegistry writerRegistry = WriterRegistry.getInstance(api);
-
// TODO make configurable:
vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry);
// TODO pull the registration into Module
@@ -210,9 +205,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
if (v3poService != null) {
v3poService.close();
}
- if (api != null) {
- api.close();
- }
if (vppDataBrokerInitializationProvider != null) {
vppDataBrokerInitializationProvider.close();
}
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
index 0939fe239..58195ba3f 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
@@ -23,13 +23,13 @@ import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import io.fd.honeycomb.v3po.config.WriterRegistry;
import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.data.ReadableDataTree;
import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
import io.fd.honeycomb.v3po.data.impl.OperationalDataTree;
import io.fd.honeycomb.v3po.data.impl.DataBroker;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collection;
import java.util.Collections;
import javassist.ClassPool;
@@ -136,7 +136,8 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
createMountPointPlaceholder();
- initialVppConfigSynchronization(broker);
+ // TODO initial sync has to go out of here
+// initialVppConfigSynchronization(broker);
}
@Override
@@ -272,6 +273,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
final WriteTransaction rwTx = bindingBroker.newWriteOnlyTransaction();
// does not fail if data is not present:
rwTx.delete(LogicalDatastoreType.CONFIGURATION, mountPointPath);
+ rwTx.delete(LogicalDatastoreType.OPERATIONAL, mountPointPath);
try {
rwTx.submit().checkedGet();
} catch (TransactionCommitFailedException e) {
diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
index 390545563..3b77418ad 100644
--- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
+++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
@@ -17,6 +17,8 @@
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210;
import io.fd.honeycomb.v3po.impl.V3poProvider;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collection;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -54,9 +56,12 @@ public class V3poModule extends
@Override
public java.lang.AutoCloseable createInstance() {
+ final ReaderRegistry readerRegistry = getReaderRegistryDependency();
+ final WriterRegistry writerRegistry = getWriterRegistryDependency();
+
final Broker domBroker = getDomBrokerDependency();
domBroker.registerProvider(new InitializationProvider());
- final V3poProvider provider = new V3poProvider(domBroker);
+ final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), readerRegistry, writerRegistry);
getBrokerDependency().registerProvider(provider);
return provider;
}
diff --git a/v3po/impl/src/main/yang/v3po-impl.yang b/v3po/impl/src/main/yang/v3po-impl.yang
index 12f9d6f13..32696125b 100644
--- a/v3po/impl/src/main/yang/v3po-impl.yang
+++ b/v3po/impl/src/main/yang/v3po-impl.yang
@@ -6,6 +6,8 @@ module 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 vpp-japi-cfg { prefix vjc; revision-date 2016-04-06; }
+ import translate-api { prefix tapi; revision-date 2016-04-06; }
description
"Service definition for v3po project";
@@ -41,6 +43,33 @@ module v3po-impl {
}
}
}
+
+ container vpp-japi {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity vjc:vpp-japi;
+ }
+ }
+ }
+
+ container reader-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity tapi:honeycomb-reader-registry;
+ }
+ }
+ }
+
+ container writer-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity tapi:honeycomb-writer-registry;
+ }
+ }
+ }
}
}
diff --git a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
index 770ca7068..d8628f2bf 100644
--- a/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
+++ b/v3po/impl/src/test/java/io/fd/honeycomb/v3po/impl/data/VppDataBrokerInitializationProviderTest.java
@@ -26,9 +26,9 @@ import static org.mockito.Mockito.verify;
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.util.concurrent.CheckedFuture;
-import io.fd.honeycomb.v3po.config.WriterRegistry;
import io.fd.honeycomb.v3po.impl.VppDataBrokerInitializationProvider;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
diff --git a/v3po/pom.xml b/v3po/pom.xml
index 7ec5d708a..050cf5b5a 100644
--- a/v3po/pom.xml
+++ b/v3po/pom.xml
@@ -33,7 +33,6 @@
</prerequisites>
<modules>
<module>api</module>
- <module>config</module>
<module>data-api</module>
<module>data-impl</module>
<module>translate-spi</module>
@@ -41,6 +40,7 @@
<module>translate-impl</module>
<module>translate-utils</module>
<module>vpp-translate-utils</module>
+ <module>vpp-japi-cfg</module>
<module>v3po2vpp</module>
<module>impl</module>
<module>karaf</module>
diff --git a/v3po/translate-api/pom.xml b/v3po/translate-api/pom.xml
index 42501e752..4323e7f37 100644
--- a/v3po/translate-api/pom.xml
+++ b/v3po/translate-api/pom.xml
@@ -17,7 +17,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../common/api-parent</relativePath>
</parent>
diff --git a/v3po/translate-api/src/main/yang/translate-api.yang b/v3po/translate-api/src/main/yang/translate-api.yang
new file mode 100644
index 000000000..28d969378
--- /dev/null
+++ b/v3po/translate-api/src/main/yang/translate-api.yang
@@ -0,0 +1,37 @@
+module translate-api {
+ yang-version 1;
+ namespace "urn:honeycomb:params:xml:ns:yang:translate:api";
+ prefix "tapi";
+
+ import config { prefix config; revision-date 2013-04-05; }
+
+ description
+ "This module contains the base YANG definitions for
+ readers/writers plugged into a honeycomb";
+
+ revision "2016-04-06" {
+ description
+ "Initial revision.";
+ }
+
+ identity honeycomb-reader {
+ base "config:service-type";
+ config:java-class io.fd.honeycomb.v3po.translate.read.Reader;
+ }
+
+ identity honeycomb-reader-registry {
+ base "config:service-type";
+ config:java-class io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+ }
+
+ identity honeycomb-writer {
+ base "config:service-type";
+ config:java-class io.fd.honeycomb.v3po.translate.write.Writer;
+ }
+
+ identity honeycomb-writer-registry {
+ base "config:service-type";
+ config:java-class io.fd.honeycomb.v3po.translate.write.WriterRegistry;
+ }
+
+} \ No newline at end of file
diff --git a/v3po/translate-utils/pom.xml b/v3po/translate-utils/pom.xml
index d547cb483..346757cc2 100644
--- a/v3po/translate-utils/pom.xml
+++ b/v3po/translate-utils/pom.xml
@@ -17,9 +17,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
+ <relativePath>../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java
new file mode 100644
index 000000000..0eb5062d5
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModule.java
@@ -0,0 +1,80 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+
+import com.google.common.base.Function;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Multimap;
+import io.fd.honeycomb.v3po.translate.read.ReadContext;
+import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
+import io.fd.honeycomb.v3po.translate.read.Reader;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.util.read.DelegatingReaderRegistry;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class DelegatingReaderRegistryModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingReaderRegistryModule {
+ public DelegatingReaderRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DelegatingReaderRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.DelegatingReaderRegistryModule 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 List<Reader<? extends DataObject>> rootReadersDependency = Lists.transform(getRootReadersDependency(),
+ new Function<Reader, Reader<? extends DataObject>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Reader<? extends DataObject> apply(final Reader input) {
+ return input;
+ }
+ });
+ return new CloseableReaderRegistry(new DelegatingReaderRegistry(rootReadersDependency));
+ }
+
+ // TODO move to translate-utils
+ private static final class CloseableReaderRegistry implements ReaderRegistry, AutoCloseable {
+ private final DelegatingReaderRegistry delegatingReaderRegistry;
+
+ CloseableReaderRegistry(
+ final DelegatingReaderRegistry delegatingReaderRegistry) {
+ this.delegatingReaderRegistry = delegatingReaderRegistry;
+ }
+
+ @Override
+ @Nonnull
+ public Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> readAll(
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return delegatingReaderRegistry.readAll(ctx);
+ }
+
+ @Nonnull
+ @Override
+ public Optional<? extends DataObject> read(
+ @Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return delegatingReaderRegistry.read(id, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<DataObject> getManagedDataObjectType() {
+ return delegatingReaderRegistry.getManagedDataObjectType();
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOOP
+ }
+ }
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java
new file mode 100644
index 000000000..214ab0f90
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingReaderRegistryModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: translate-utils yang module local name: delegating-reader-registry
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 12:32:43 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+public class DelegatingReaderRegistryModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingReaderRegistryModuleFactory {
+
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java
new file mode 100644
index 000000000..a629a294f
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModule.java
@@ -0,0 +1,82 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import io.fd.honeycomb.v3po.translate.TranslationException;
+import io.fd.honeycomb.v3po.translate.util.write.DelegatingWriterRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriteContext;
+import io.fd.honeycomb.v3po.translate.write.Writer;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class DelegatingWriterRegistryModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingWriterRegistryModule {
+ public DelegatingWriterRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DelegatingWriterRegistryModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.DelegatingWriterRegistryModule 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 List<Writer<? extends DataObject>> rootReadersDependency = Lists.transform(getRootWritersDependency(),
+ new Function<Writer, Writer<? extends DataObject>>() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Writer<? extends DataObject> apply(final Writer input) {
+ return input;
+ }
+ });
+ return new CloseableWriterRegistry(new DelegatingWriterRegistry(rootReadersDependency));
+ }
+
+ // TODO move to translate-utils
+ private static final class CloseableWriterRegistry implements WriterRegistry, AutoCloseable {
+ private final DelegatingWriterRegistry delegatingWriterRegistry;
+
+ CloseableWriterRegistry(
+ final DelegatingWriterRegistry delegatingWriterRegistry) {
+ this.delegatingWriterRegistry = delegatingWriterRegistry;
+ }
+
+ @Override
+ public void update(
+ @Nonnull final Map<InstanceIdentifier<?>, DataObject> nodesBefore,
+ @Nonnull final Map<InstanceIdentifier<?>, DataObject> nodesAfter,
+ @Nonnull final WriteContext ctx) throws TranslationException {
+ delegatingWriterRegistry.update(nodesBefore, nodesAfter, ctx);
+ }
+
+ @Override
+ public void update(
+ @Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nullable final DataObject dataBefore, @Nullable final DataObject dataAfter,
+ @Nonnull final WriteContext ctx) throws TranslationException {
+ delegatingWriterRegistry.update(id, dataBefore, dataAfter, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<DataObject> getManagedDataObjectType() {
+ return delegatingWriterRegistry.getManagedDataObjectType();
+ }
+
+ @Override
+ public void close() throws Exception {
+ // NOOP
+ }
+ }
+
+}
diff --git a/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java
new file mode 100644
index 000000000..ab3b820d3
--- /dev/null
+++ b/v3po/translate-utils/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/translate/utils/rev160406/DelegatingWriterRegistryModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: translate-utils yang module local name: delegating-writer-registry
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 16:32:08 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406;
+public class DelegatingWriterRegistryModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.translate.utils.rev160406.AbstractDelegatingWriterRegistryModuleFactory {
+
+}
diff --git a/v3po/translate-utils/src/main/yang/translate-utils.yang b/v3po/translate-utils/src/main/yang/translate-utils.yang
new file mode 100644
index 000000000..093e1725b
--- /dev/null
+++ b/v3po/translate-utils/src/main/yang/translate-utils.yang
@@ -0,0 +1,61 @@
+module translate-utils {
+ yang-version 1;
+ namespace "urn:honeycomb:params:xml:ns:yang:translate:utils";
+ prefix "tutils";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import translate-api { prefix tapi; revision-date 2016-04-06; }
+
+ description
+ "This module contains translation layer utilities";
+
+ revision "2016-04-06" {
+ description
+ "Initial revision.";
+ }
+
+ identity delegating-reader-registry {
+ base config:module-type;
+ config:provided-service tapi:honeycomb-reader-registry;
+ config:java-name-prefix DelegatingReaderRegistry;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case delegating-reader-registry {
+ when "/config:modules/config:module/config:type = 'delegating-reader-registry'";
+
+ list root-readers {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity tapi:honeycomb-reader;
+ }
+ }
+ }
+
+ }
+ }
+
+ identity delegating-writer-registry {
+ base config:module-type;
+ config:provided-service tapi:honeycomb-writer-registry;
+ config:java-name-prefix DelegatingWriterRegistry;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case delegating-writer-registry {
+ when "/config:modules/config:module/config:type = 'delegating-writer-registry'";
+
+ list root-writers {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity tapi:honeycomb-writer;
+ }
+ }
+ }
+
+ }
+ }
+
+} \ No newline at end of file
diff --git a/v3po/v3po2vpp/pom.xml b/v3po/v3po2vpp/pom.xml
index e14730594..6b57ca201 100644
--- a/v3po/v3po2vpp/pom.xml
+++ b/v3po/v3po2vpp/pom.xml
@@ -17,9 +17,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.fd.honeycomb.common</groupId>
- <artifactId>api-parent</artifactId>
+ <artifactId>impl-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
- <relativePath>../../common/api-parent</relativePath>
+ <relativePath>../../common/impl-parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -50,6 +50,16 @@
<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>vpp-japi-cfg</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>io.fd.vpp</groupId>
<artifactId>vppjapi</artifactId>
<version>1.0.0-SNAPSHOT</version>
@@ -57,12 +67,6 @@
<!-- Testing Dependencies -->
<dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>translate-impl</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -93,5 +97,4 @@
</dependency>
</dependencies>
-
</project>
diff --git a/v3po/v3po2vpp/src/main/config/default-config.xml b/v3po/v3po2vpp/src/main/config/default-config.xml
new file mode 100644
index 000000000..d76b0d6d3
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/config/default-config.xml
@@ -0,0 +1,84 @@
+<?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:honeycomb:params:xml:ns:yang:vpp:japi:cfg?module=vpp-japi-cfg&amp;revision=2016-04-06</capability>
+ <capability>urn:honeycomb:params:xml:ns:yang:v3po2vpp?module=v3po2vpp&amp;revision=2016-04-06</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:v3po2vpp">prefix:vpp-state-honeycomb-reader</type>
+ <name>vpp-state-honeycomb-reader</name>
+ <vpp-japi>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg">prefix:vpp-japi</type>
+ <name>vpp-japi</name>
+ </vpp-japi>
+ </module>
+
+ <module>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:v3po2vpp">prefix:vpp-honeycomb-writer</type>
+ <name>vpp-honeycomb-writer</name>
+ <vpp-japi-writer>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg">prefix:vpp-japi</type>
+ <name>vpp-japi</name>
+ </vpp-japi-writer>
+ </module>
+
+ <module>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-reader-registry</type>
+ <name>read-registry</name>
+ <root-readers>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type>
+ <name>vpp-state-honeycomb-reader</name>
+ </root-readers>
+ </module>
+ <module>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:utils">prefix:delegating-writer-registry</type>
+ <name>write-registry</name>
+ <root-writers>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer</type>
+ <name>vpp-honeycomb-writer</name>
+ </root-writers>
+ </module>
+ </modules>
+ <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <service>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-reader</type>
+ <instance>
+ <name>vpp-state-honeycomb-reader</name>
+ <provider>/modules/module[type='vpp-state-honeycomb-reader'][name='vpp-state-honeycomb-reader']
+ </provider>
+ </instance>
+ </service>
+ <service>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:translate:api">prefix:honeycomb-writer</type>
+ <instance>
+ <name>vpp-honeycomb-writer</name>
+ <provider>/modules/module[type='vpp-honeycomb-writer'][name='vpp-honeycomb-writer']
+ </provider>
+ </instance>
+ </service>
+ </services>
+ </data>
+ </configuration>
+</snapshot>
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
new file mode 100644
index 000000000..5694bc139
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
@@ -0,0 +1,96 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+
+import io.fd.honeycomb.v3po.translate.TranslationException;
+import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter;
+import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter;
+import io.fd.honeycomb.v3po.translate.impl.write.CompositeRootWriter;
+import io.fd.honeycomb.v3po.translate.util.RWUtils;
+import io.fd.honeycomb.v3po.translate.util.write.NoopWriterCustomizer;
+import io.fd.honeycomb.v3po.translate.util.write.ReflexiveChildWriterCustomizer;
+import io.fd.honeycomb.v3po.translate.v3po.vpp.BridgeDomainCustomizer;
+import io.fd.honeycomb.v3po.translate.write.ChildWriter;
+import io.fd.honeycomb.v3po.translate.write.WriteContext;
+import io.fd.honeycomb.v3po.translate.write.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class VppHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModule {
+ public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public VppHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppHoneycombWriterModule 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 CompositeListWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListWriter<>(
+ BridgeDomain.class,
+ new BridgeDomainCustomizer(getVppJapiWriterDependency()));
+
+ final ChildWriter<BridgeDomains> bridgeDomainsReader = new CompositeChildWriter<>(
+ BridgeDomains.class,
+ RWUtils.singletonChildWriterList(bridgeDomainWriter),
+ new ReflexiveChildWriterCustomizer<BridgeDomains>());
+
+ final List<ChildWriter<? extends ChildOf<Vpp>>> childWriters = new ArrayList<>();
+ childWriters.add(bridgeDomainsReader);
+
+ return new CloseableWriter(new CompositeRootWriter<>(
+ Vpp.class,
+ childWriters,
+ new NoopWriterCustomizer<Vpp>()));
+ }
+
+ // TODO move to translate-utils
+ private static final class CloseableWriter implements Writer<Vpp>, AutoCloseable {
+
+ private CompositeRootWriter<Vpp> vppCompositeRootWriter;
+
+ public CloseableWriter(
+ final CompositeRootWriter<Vpp> vppCompositeRootWriter) {
+ this.vppCompositeRootWriter = vppCompositeRootWriter;
+ }
+
+ @Override
+ public void update(
+ @Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nullable final DataObject dataBefore,
+ @Nullable final DataObject dataAfter,
+ @Nonnull final WriteContext ctx) throws TranslationException {
+ vppCompositeRootWriter.update(id, dataBefore, dataAfter, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<Vpp> getManagedDataObjectType() {
+ return vppCompositeRootWriter.getManagedDataObjectType();
+ }
+
+ @Override
+ public String toString() {
+ return vppCompositeRootWriter.toString();
+ }
+
+ @Override
+ public void close() throws Exception {
+
+ }
+ }
+
+}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModuleFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModuleFactory.java
new file mode 100644
index 000000000..c350286b8
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: v3po2vpp yang module local name: vpp-honeycomb-writer
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 11:40:09 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+public class VppHoneycombWriterModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModuleFactory {
+
+}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java
new file mode 100644
index 000000000..8da7dad1c
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java
@@ -0,0 +1,104 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader;
+import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader;
+import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader;
+import io.fd.honeycomb.v3po.translate.read.ChildReader;
+import io.fd.honeycomb.v3po.translate.read.ReadContext;
+import io.fd.honeycomb.v3po.translate.read.ReadFailedException;
+import io.fd.honeycomb.v3po.translate.read.Reader;
+import io.fd.honeycomb.v3po.translate.util.RWUtils;
+import io.fd.honeycomb.v3po.translate.util.read.ReflexiveChildReaderCustomizer;
+import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
+import io.fd.honeycomb.v3po.translate.v3po.vppstate.BridgeDomainCustomizer;
+import io.fd.honeycomb.v3po.translate.v3po.vppstate.VersionCustomizer;
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainKey;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.openvpp.vppjapi.vppApi;
+
+public class VppStateHoneycombReaderModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppStateHoneycombReaderModule {
+ public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public VppStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppStateHoneycombReaderModule 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 vppApi vppApi = getVppJapiDependency();
+
+ final ChildReader<Version> versionReader = new CompositeChildReader<>(Version.class, new VersionCustomizer(vppApi));
+
+ final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader =
+ new CompositeListReader<>(BridgeDomain.class, new BridgeDomainCustomizer(vppApi));
+
+ final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>(
+ BridgeDomains.class,
+ RWUtils.singletonChildReaderList(bridgeDomainReader),
+ new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class));
+
+ final List<ChildReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>();
+ childVppReaders.add(versionReader);
+ childVppReaders.add(bridgeDomainsReader);
+
+ return new CloseableReader(new CompositeRootReader<>(
+ VppState.class,
+ childVppReaders,
+ RWUtils.<VppState>emptyAugReaderList(),
+ new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class)));
+ }
+
+ // TODO move to utils
+ private static final class CloseableReader implements Reader<VppState>, AutoCloseable {
+
+ private CompositeRootReader<VppState, VppStateBuilder> vppStateVppStateBuilderCompositeRootReader;
+
+ public CloseableReader(
+ final CompositeRootReader<VppState, VppStateBuilder> vppStateVppStateBuilderCompositeRootReader) {
+ this.vppStateVppStateBuilderCompositeRootReader = vppStateVppStateBuilderCompositeRootReader;
+ }
+
+ @Nonnull
+ @Override
+ public Optional<? extends DataObject> read(@Nonnull final InstanceIdentifier<? extends DataObject> id,
+ @Nonnull final ReadContext ctx) throws ReadFailedException {
+ return vppStateVppStateBuilderCompositeRootReader.read(id, ctx);
+ }
+
+ @Nonnull
+ @Override
+ public InstanceIdentifier<VppState> getManagedDataObjectType() {
+ return vppStateVppStateBuilderCompositeRootReader.getManagedDataObjectType();
+ }
+
+ @Override
+ public String toString() {
+ return vppStateVppStateBuilderCompositeRootReader.toString();
+ }
+
+ @Override
+ public void close() throws Exception {
+ //NOOP
+ }
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModuleFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModuleFactory.java
new file mode 100644
index 000000000..e9e1c948b
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: v3po2vpp yang module local name: vpp-state-honeycomb-reader
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 11:40:09 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+public class VppStateHoneycombReaderModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppStateHoneycombReaderModuleFactory {
+
+}
diff --git a/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang b/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang
new file mode 100644
index 000000000..a52a05fec
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang
@@ -0,0 +1,60 @@
+module v3po2vpp {
+ yang-version 1;
+ namespace "urn:honeycomb:params:xml:ns:yang:v3po2vpp";
+ prefix "v3po2vpp";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import translate-api { prefix tapi; revision-date 2016-04-06; }
+ import vpp-japi-cfg { prefix vjc; revision-date 2016-04-06; }
+
+ description
+ "This module contains reads and writers for v3po yang model";
+
+ revision "2016-04-06" {
+ description
+ "Initial revision.";
+ }
+
+ identity vpp-state-honeycomb-reader {
+ base config:module-type;
+ config:provided-service tapi:honeycomb-reader;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case vpp-state-honeycomb-reader {
+ when "/config:modules/config:module/config:type = 'vpp-state-honeycomb-reader'";
+
+ container vpp-japi {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity vjc:vpp-japi;
+ }
+ }
+ }
+
+ }
+ }
+
+ identity vpp-honeycomb-writer {
+ base config:module-type;
+ config:provided-service tapi:honeycomb-writer;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case vpp-honeycomb-writer {
+ when "/config:modules/config:module/config:type = 'vpp-honeycomb-writer'";
+
+ container vpp-japi-writer {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity vjc:vpp-japi;
+ }
+ }
+ }
+
+ }
+ }
+
+} \ No newline at end of file
diff --git a/v3po/vpp-japi-cfg/pom.xml b/v3po/vpp-japi-cfg/pom.xml
new file mode 100644
index 000000000..3e3424acc
--- /dev/null
+++ b/v3po/vpp-japi-cfg/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.v3po</groupId>
+ <artifactId>vpp-japi-cfg</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.fd.vpp</groupId>
+ <artifactId>vppjapi</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/v3po/vpp-japi-cfg/src/main/config/default-config.xml b/v3po/vpp-japi-cfg/src/main/config/default-config.xml
new file mode 100644
index 000000000..7ba72f42f
--- /dev/null
+++ b/v3po/vpp-japi-cfg/src/main/config/default-config.xml
@@ -0,0 +1,46 @@
+<?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:honeycomb:params:xml:ns:yang:vpp:japi:cfg?module=vpp-japi-cfg&amp;revision=2016-04-06</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:vpp:japi:cfg">prefix:vpp-japi-impl</type>
+ <name>vpp-japi</name>
+ </module>
+ </modules>
+
+ <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <service>
+ <type xmlns:prefix="urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg">prefix:vpp-japi</type>
+ <instance>
+ <name>vpp-japi</name>
+ <provider>/modules/module[type='vpp-japi-impl'][name='vpp-japi']
+ </provider>
+ </instance>
+ </service>
+ </services>
+ </data>
+ </configuration>
+</snapshot>
diff --git a/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModule.java b/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModule.java
new file mode 100644
index 000000000..3f092e936
--- /dev/null
+++ b/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModule.java
@@ -0,0 +1,37 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.japi.cfg.rev160406;
+
+import java.io.IOException;
+import org.openvpp.vppjapi.vppApi;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VppJapiImplModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.japi.cfg.rev160406.AbstractVppJapiImplModule {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VppJapiImplModule.class);
+
+ public VppJapiImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public VppJapiImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.japi.cfg.rev160406.VppJapiImplModule 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() {
+ try {
+ final vppApi vppApi = new vppApi(getName());
+ LOG.info("VPP-INFO: VPP api client connection established");
+ return vppApi;
+ } catch (IOException e) {
+ LOG.error("VPP-ERROR: VPP api client connection failed", e);
+ throw new IllegalStateException("Unable to open vpp API", e);
+ }
+ }
+
+}
diff --git a/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModuleFactory.java b/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModuleFactory.java
new file mode 100644
index 000000000..6b3724c6d
--- /dev/null
+++ b/v3po/vpp-japi-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/japi/cfg/rev160406/VppJapiImplModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: vpp-japi-cfg yang module local name: vpp-japi-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Apr 06 11:06:28 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.japi.cfg.rev160406;
+public class VppJapiImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.japi.cfg.rev160406.AbstractVppJapiImplModuleFactory {
+
+}
diff --git a/v3po/vpp-japi-cfg/src/main/yang/vpp-japi-cfg.yang b/v3po/vpp-japi-cfg/src/main/yang/vpp-japi-cfg.yang
new file mode 100644
index 000000000..f723f5282
--- /dev/null
+++ b/v3po/vpp-japi-cfg/src/main/yang/vpp-japi-cfg.yang
@@ -0,0 +1,38 @@
+module vpp-japi-cfg {
+ yang-version 1;
+ namespace "urn:honeycomb:params:xml:ns:yang:vpp:japi:cfg";
+ prefix "vjc";
+
+ import config { prefix config; revision-date 2013-04-05; }
+
+ description
+ "This module contains the base YANG definitions for
+ readers/writers plugged into a honeycomb";
+
+ revision "2016-04-06" {
+ description
+ "Initial revision.";
+ }
+
+ identity vpp-japi {
+ base "config:service-type";
+ config:java-class org.openvpp.vppjapi.vppApi;
+ }
+
+ identity vpp-japi-impl {
+ base config:module-type;
+ config:provided-service vpp-japi;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case vpp-japi-impl {
+ when "/config:modules/config:module/config:type = 'vpp-japi-impl'";
+
+ leaf name {
+ type string;
+ default "v3poODL";
+ }
+ }
+ }
+
+} \ No newline at end of file