From ca361fd5bfe881014d0791fd9c3b13b66a2d13b2 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Wed, 4 May 2016 10:17:39 +0200 Subject: HONEYCOMB-10: Porting v3po2vpp to the new Java API Change-Id: Ic7166b0f578442165595aa44a587ebbc5db0e75c Signed-off-by: Marek Gradzki Signed-off-by: Maros Marsalek --- v3po/vpp-jvpp-cfg/pom.xml | 39 ++++++++++++++++++ .../src/main/config/default-config.xml | 46 ++++++++++++++++++++++ .../vpp/jvpp/cfg/rev160406/VppJvppImplModule.java | 45 +++++++++++++++++++++ .../cfg/rev160406/VppJvppImplModuleFactory.java | 13 ++++++ v3po/vpp-jvpp-cfg/src/main/yang/vpp-jvpp-cfg.yang | 38 ++++++++++++++++++ 5 files changed, 181 insertions(+) create mode 100644 v3po/vpp-jvpp-cfg/pom.xml create mode 100644 v3po/vpp-jvpp-cfg/src/main/config/default-config.xml create mode 100644 v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModule.java create mode 100644 v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModuleFactory.java create mode 100644 v3po/vpp-jvpp-cfg/src/main/yang/vpp-jvpp-cfg.yang (limited to 'v3po/vpp-jvpp-cfg') diff --git a/v3po/vpp-jvpp-cfg/pom.xml b/v3po/vpp-jvpp-cfg/pom.xml new file mode 100644 index 000000000..9a864c882 --- /dev/null +++ b/v3po/vpp-jvpp-cfg/pom.xml @@ -0,0 +1,39 @@ + + + + + io.fd.honeycomb.common + impl-parent + 1.0.0-SNAPSHOT + ../../common/impl-parent + + + 4.0.0 + io.fd.honeycomb.v3po + vpp-jvpp-cfg + 1.0.0-SNAPSHOT + bundle + + + + io.fd.vpp + jvpp + 1.0.0-SNAPSHOT + + + + diff --git a/v3po/vpp-jvpp-cfg/src/main/config/default-config.xml b/v3po/vpp-jvpp-cfg/src/main/config/default-config.xml new file mode 100644 index 000000000..cbb614e69 --- /dev/null +++ b/v3po/vpp-jvpp-cfg/src/main/config/default-config.xml @@ -0,0 +1,46 @@ + + + + + + + + urn:honeycomb:params:xml:ns:yang:vpp:jvpp:cfg?module=vpp-jvpp-cfg&revision=2016-04-06 + + + + + + + prefix:vpp-jvpp-impl + vpp-jvpp + + + + + + prefix:vpp-jvpp + + vpp-jvpp + /modules/module[type='vpp-jvpp-impl'][name='vpp-jvpp'] + + + + + + + diff --git a/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModule.java b/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModule.java new file mode 100644 index 000000000..4c70f0bb7 --- /dev/null +++ b/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModule.java @@ -0,0 +1,45 @@ +package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import org.openvpp.jvpp.JVppImpl; +import org.openvpp.jvpp.VppJNIConnection; +import org.openvpp.jvpp.dto.JVppReply; +import org.openvpp.jvpp.future.FutureJVppFacade; +import org.openvpp.jvpp.future.FutureJVppFacadeCallback; + +public class VppJvppImplModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406.AbstractVppJvppImplModule { + public VppJvppImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public VppJvppImplModule(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.jvpp.cfg.rev160406.VppJvppImplModule 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 Map>> map = new HashMap<>(); + final JVppImpl jVpp = + new JVppImpl(VppJNIConnection.create(getName(), new FutureJVppFacadeCallback(map))); + return new FutureJVppFacade(jVpp, map) { + @Override + public void close() throws Exception { + super.close(); + jVpp.close(); + } + }; + } catch (IOException e) { + throw new IllegalStateException("Unable to open VPP management connection", e); + } + } + +} diff --git a/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModuleFactory.java b/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModuleFactory.java new file mode 100644 index 000000000..71151092d --- /dev/null +++ b/v3po/vpp-jvpp-cfg/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/vpp/jvpp/cfg/rev160406/VppJvppImplModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: vpp-jvpp-cfg yang module local name: vpp-jvpp-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Fri Apr 29 11:20:56 CEST 2016 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406; +public class VppJvppImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406.AbstractVppJvppImplModuleFactory { + +} diff --git a/v3po/vpp-jvpp-cfg/src/main/yang/vpp-jvpp-cfg.yang b/v3po/vpp-jvpp-cfg/src/main/yang/vpp-jvpp-cfg.yang new file mode 100644 index 000000000..b91fcba09 --- /dev/null +++ b/v3po/vpp-jvpp-cfg/src/main/yang/vpp-jvpp-cfg.yang @@ -0,0 +1,38 @@ +module vpp-jvpp-cfg { + yang-version 1; + namespace "urn:honeycomb:params:xml:ns:yang:vpp:jvpp:cfg"; + prefix "vjvppc"; + + 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-jvpp { + base "config:service-type"; + config:java-class org.openvpp.jvpp.future.FutureJVpp; + } + + identity vpp-jvpp-impl { + base config:module-type; + config:provided-service vpp-jvpp; + } + + augment "/config:modules/config:module/config:configuration" { + case vpp-jvpp-impl { + when "/config:modules/config:module/config:type = 'vpp-jvpp-impl'"; + + leaf name { + type string; + default "v3poODL"; + } + } + } + +} \ No newline at end of file -- cgit 1.2.3-korg