diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:31 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-04-12 10:13:31 +0200 |
commit | 695eead109ef26d26277675210275a423a5dad50 (patch) | |
tree | 80c8567917026154a3b6f199bc0544267adf3bbe /v3po/vpp-japi-cfg/src | |
parent | 5f82161cddaf35acbb6197139deaf604cdc4aca0 (diff) |
HONEYCOMB-9: Add configuration and wiring for readers and writers
Remove config module
Wrap vpp-japi in a config module
Change-Id: Iee1e0c653309bd3c1019323ce689dacf3ed995cd
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/vpp-japi-cfg/src')
4 files changed, 134 insertions, 0 deletions
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&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 |