From 2a759ffd2f6a4cd692fcc333ac87fd8921a5c936 Mon Sep 17 00:00:00 2001 From: Marco Platania Date: Fri, 16 Mar 2018 16:31:33 -0400 Subject: Add health check to vLBMS - Add health check to VNF components for vLB manual scale out - Update POM tree Change-Id: Id348d0cb56adf052694c6e8682b499eb1ac24af1 Issue-ID: INT-433 Signed-off-by: Marco Platania --- vnfs/vLBMS/apis/asciidoc/Readme.adoc | 3 - .../asciidoc/Readme.adoc | 3 + .../health-vnf-onap-plugin-api/pom.xml | 82 +++++++ .../src/main/yang/health-vnf-onap-plugin.yang | 64 ++++++ .../asciidoc/Readme.adoc | 3 + .../health-vnf-onap-plugin-impl/pom.xml | 119 ++++++++++ .../main/java/org/onap/vnf/health/CrudService.java | 64 ++++++ .../org/onap/vnf/health/ElementCrudService.java | 111 ++++++++++ .../src/main/java/org/onap/vnf/health/Module.java | 66 ++++++ .../org/onap/vnf/health/ModuleConfiguration.java | 46 ++++ .../main/java/org/onap/vnf/health/RESTManager.java | 147 +++++++++++++ .../vnf/health/read/ElementStateCustomizer.java | 240 +++++++++++++++++++++ .../vnf/health/read/ModuleStateReaderFactory.java | 70 ++++++ .../onap/vnf/health/write/ElementCustomizer.java | 65 ++++++ .../onap/vnf/health/write/ModuleWriterFactory.java | 54 +++++ vnfs/vLBMS/apis/health-vnf-onap-plugin/pom.xml | 68 ++++++ vnfs/vLBMS/apis/pom.xml | 68 ------ .../asciidoc/Readme.adoc | 3 - .../apis/vlb-business-vnf-onap-plugin-api/pom.xml | 82 ------- .../main/yang/vlb-business-vnf-onap-plugin.yang | 66 ------ .../asciidoc/Readme.adoc | 3 - .../apis/vlb-business-vnf-onap-plugin-impl/pom.xml | 103 --------- .../main/java/org/onap/vnf/vlb/CrudService.java | 64 ------ .../java/org/onap/vnf/vlb/ElementCrudService.java | 114 ---------- .../src/main/java/org/onap/vnf/vlb/Module.java | 66 ------ .../java/org/onap/vnf/vlb/ModuleConfiguration.java | 46 ---- .../org/onap/vnf/vlb/write/DnsInstanceManager.java | 142 ------------ .../org/onap/vnf/vlb/write/ElementCustomizer.java | 73 ------- .../onap/vnf/vlb/write/ModuleWriterFactory.java | 54 ----- .../apis/vlb-business-vnf-onap-plugin/pom.xml | 67 ++++++ .../asciidoc/Readme.adoc | 3 + .../vlb-business-vnf-onap-plugin-api/pom.xml | 82 +++++++ .../main/yang/vlb-business-vnf-onap-plugin.yang | 66 ++++++ .../asciidoc/Readme.adoc | 3 + .../vlb-business-vnf-onap-plugin-impl/pom.xml | 104 +++++++++ .../main/java/org/onap/vnf/vlb/CrudService.java | 64 ++++++ .../java/org/onap/vnf/vlb/ElementCrudService.java | 114 ++++++++++ .../src/main/java/org/onap/vnf/vlb/Module.java | 66 ++++++ .../java/org/onap/vnf/vlb/ModuleConfiguration.java | 46 ++++ .../org/onap/vnf/vlb/write/DnsInstanceManager.java | 142 ++++++++++++ .../org/onap/vnf/vlb/write/ElementCustomizer.java | 73 +++++++ .../onap/vnf/vlb/write/ModuleWriterFactory.java | 54 +++++ .../vlb-vnf-onap-distribution/asciidoc/Readme.adoc | 3 - vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml | 8 +- 44 files changed, 2093 insertions(+), 891 deletions(-) delete mode 100644 vnfs/vLBMS/apis/asciidoc/Readme.adoc create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/asciidoc/Readme.adoc create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/pom.xml create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/src/main/yang/health-vnf-onap-plugin.yang create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/asciidoc/Readme.adoc create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/pom.xml create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/CrudService.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ElementCrudService.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/Module.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ModuleConfiguration.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/RESTManager.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ElementStateCustomizer.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ModuleStateReaderFactory.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ElementCustomizer.java create mode 100644 vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ModuleWriterFactory.java create mode 100755 vnfs/vLBMS/apis/health-vnf-onap-plugin/pom.xml delete mode 100755 vnfs/vLBMS/apis/pom.xml delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java delete mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/pom.xml create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/pom.xml create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/pom.xml create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java create mode 100644 vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java delete mode 100644 vnfs/vLBMS/apis/vlb-vnf-onap-distribution/asciidoc/Readme.adoc (limited to 'vnfs/vLBMS') diff --git a/vnfs/vLBMS/apis/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/asciidoc/Readme.adoc deleted file mode 100644 index 292e5fd6..00000000 --- a/vnfs/vLBMS/apis/asciidoc/Readme.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= vlb-business-vnf-onap-plugin-aggregator - -Overview of vlb-business-vnf-onap-plugin-aggregator \ No newline at end of file diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/asciidoc/Readme.adoc new file mode 100644 index 00000000..633ec6dd --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ += health-vnf-onap-plugin-api + +Overview of health-vnf-onap-plugin-api \ No newline at end of file diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/pom.xml b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/pom.xml new file mode 100644 index 00000000..d18812a1 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/pom.xml @@ -0,0 +1,82 @@ + + + + + io.fd.honeycomb.common + api-parent + 1.17.07 + + + 4.0.0 + org.onap.demo.vnf.health + health-vnf-onap-plugin-api + health-vnf-onap-plugin-api + bundle + + + + org.opendaylight.mdsal.model + iana-if-type-2014-05-08 + + + org.opendaylight.mdsal.model + ietf-yang-types-20130715 + + + org.opendaylight.mdsal.model + ietf-interfaces + + + org.opendaylight.mdsal.model + ietf-inet-types-2013-07-15 + + + org.opendaylight.mdsal.model + yang-ext + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/src/main/yang/health-vnf-onap-plugin.yang b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/src/main/yang/health-vnf-onap-plugin.yang new file mode 100644 index 00000000..621acedc --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-api/src/main/yang/health-vnf-onap-plugin.yang @@ -0,0 +1,64 @@ +module health-vnf-onap-plugin { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:health-vnf-onap-plugin"; + prefix "health-vnf-onap-plugin"; + + description + "This YANG module defines the generic configuration and + operational data for health-vnf-onap-plugin in Honeycomb"; + + revision "2016-09-18" { + description "Initial revision of health-vnf-onap-plugin model"; + } + + container health-vnf-onap-plugin { + uses health-vnf-onap-plugin-params; + description "Configuration data of health-vnf-onap-plugin in Honeycomb"; + } + + container health-vnf-onap-plugin-state { + config false; + uses health-vnf-onap-plugin-params; + description "Operational data of health-vnf-onap-plugin persisted in Honeycomb"; + } + + grouping health-vnf-onap-plugin-params { + container health-check { + leaf vnf-name { + type string; + } + + leaf state { + type string; + } + + leaf time { + type string; + } + + container faults { + leaf info { + type string; + } + + list fault { + key vnf-component; + leaf vnf-component { + type string; + } + + leaf message { + type string; + } + } + } + } + } + + // READ + // curl -u admin:admin http://localhost:8181/restconf/config/health-vnf-onap-plugin:health-vnf-onap-plugin + + // WRITE + // curl http://localhost:8181/restconf/operational/health-vnf-onap-plugin:health-vnf-onap-plugin +} \ No newline at end of file diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/asciidoc/Readme.adoc new file mode 100644 index 00000000..1a54e7f0 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ += health-vnf-onap-plugin-impl + +Overview of health-vnf-onap-plugin-impl \ No newline at end of file diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/pom.xml b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/pom.xml new file mode 100644 index 00000000..d53b137b --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/pom.xml @@ -0,0 +1,119 @@ + + + + + io.fd.honeycomb.common + impl-parent + 1.17.07 + + + 4.0.0 + org.onap.demo.vnf.health + health-vnf-onap-plugin-impl + health-vnf-onap-plugin-impl + bundle + + + 1.17.07 + UTF-8 + 1.8 + 1.8 + + + + + ${project.groupId} + health-vnf-onap-plugin-api + ${project.version} + + + + + io.fd.honeycomb + translate-api + ${honeycomb.infra.version} + + + + io.fd.honeycomb + translate-spi + ${honeycomb.infra.version} + + + + io.fd.honeycomb + cfg-init + ${honeycomb.infra.version} + + + + + com.google.inject + guice + + + net.jmob + guice.conf + + + com.google.inject.extensions + guice-multibindings + + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.4 + + + org.apache.httpcomponents + httpclient + 4.5.5 + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/CrudService.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/CrudService.java new file mode 100644 index 00000000..9c6ef56e --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/CrudService.java @@ -0,0 +1,64 @@ +/* + * 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 org.onap.vnf.health; + +import io.fd.honeycomb.translate.read.ReadFailedException; +import io.fd.honeycomb.translate.write.WriteFailedException; +import java.util.List; +import javax.annotation.Nonnull; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Example of an aggregated access interface. + *

+ * Shared by all the customizers hiding the ugly details of our data management. + * + * TODO update javadoc + */ +public interface CrudService { + + /** + * Perform write of provided data. + */ + void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) + throws WriteFailedException; + + + /** + * Perform delete of existing data. + */ + void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) + throws WriteFailedException; + + /** + * Perform update of existing data. + */ + void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T dataOld, + @Nonnull final T dataNew) + throws WriteFailedException; + + /** + * Read data identified by provided identifier. + */ + T readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException; + + /** + * Read all nodes of type {@link T}. + */ + List readAll() throws ReadFailedException; +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ElementCrudService.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ElementCrudService.java new file mode 100644 index 00000000..4854b0b9 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ElementCrudService.java @@ -0,0 +1,111 @@ +/* + * 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. + */ + + /* + * Modifications copyright (c) 2018 AT&T Intellectual Property + */ + +package org.onap.vnf.health; + +import io.fd.honeycomb.translate.read.ReadFailedException; +import io.fd.honeycomb.translate.write.WriteFailedException; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheckBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.HealthVnfOnapPluginState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Simple example of class handling Crud operations for plugin. + *

+ * No real handling, serves just as an illustration. + * + * TODO update javadoc + */ +final class ElementCrudService implements CrudService { + + private static final Logger LOG = LoggerFactory.getLogger(ElementCrudService.class); + + @Override + public void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final HealthCheck data) + throws WriteFailedException { + if (data != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Writing path[{}] / data [{}]", identifier, data); + } else { + throw new WriteFailedException.CreateFailedException(identifier, data, + new NullPointerException("Provided data are null")); + } + } + + @Override + public void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final HealthCheck data) + throws WriteFailedException { + if (data != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Removing path[{}] / data [{}]", identifier, data); + } else { + throw new WriteFailedException.DeleteFailedException(identifier, + new NullPointerException("Provided data are null")); + } + } + + @Override + public void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final HealthCheck dataOld, + @Nonnull final HealthCheck dataNew) throws WriteFailedException { + if (dataOld != null && dataNew != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Update path[{}] from [{}] to [{}]", identifier, dataOld, dataNew); + } else { + throw new WriteFailedException.DeleteFailedException(identifier, + new NullPointerException("Provided data are null")); + } + } + + @Override + public HealthCheck readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException { + + // Returns sample data + return new HealthCheckBuilder() + .setVnfName("scope represented") + .setState("sample status") + .setTime("01-01-1000:0000") + .build(); + } + + @Override + public List readAll() throws ReadFailedException { + // read all data under parent node,in this case {@link ModuleState} + return Collections.singletonList( + readSpecific(InstanceIdentifier.create(HealthVnfOnapPluginState.class).child(HealthCheck.class))); + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/Module.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/Module.java new file mode 100644 index 00000000..5c26f7f9 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/Module.java @@ -0,0 +1,66 @@ +/* + * 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 org.onap.vnf.health; + +import static org.onap.vnf.health.ModuleConfiguration.ELEMENT_SERVICE_NAME; + +import org.onap.vnf.health.read.ModuleStateReaderFactory; + +import com.google.inject.AbstractModule; +import com.google.inject.TypeLiteral; +import com.google.inject.multibindings.Multibinder; +import com.google.inject.name.Names; + +import org.onap.vnf.health.write.ModuleWriterFactory; +import io.fd.honeycomb.translate.read.ReaderFactory; +import io.fd.honeycomb.translate.write.WriterFactory; +import net.jmob.guice.conf.core.ConfigurationModule; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; + +/** + * Module class instantiating health-vnf-onap-plugin plugin components. + */ +public final class Module extends AbstractModule { + + // TODO This initiates all the plugin components, but it still needs to be registered/wired into an integration + // module producing runnable distributions. There is one such distribution in honeycomb project: + // vpp-integration/minimal-distribution + // In order to integrate this plugin with the distribution: + // 1. Add a dependency on this maven module to the the distribution's pom.xml + // 2. Add an instance of this module into the distribution in its Main class + + @Override + protected void configure() { + // requests injection of properties + install(ConfigurationModule.create()); + requestInjection(ModuleConfiguration.class); + + // creates binding for interface implementation by name + bind(new TypeLiteral>(){}) + .annotatedWith(Names.named(ELEMENT_SERVICE_NAME)) + .to(ElementCrudService.class); + + // can hold multiple binding for separate yang modules + final Multibinder readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); + readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class); + + // create writer factory binding + // can hold multiple binding for separate yang modules + final Multibinder writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class); + writerFactoryBinder.addBinding().to(ModuleWriterFactory.class); + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ModuleConfiguration.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ModuleConfiguration.java new file mode 100644 index 00000000..70f097a9 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/ModuleConfiguration.java @@ -0,0 +1,46 @@ +/* + * 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 org.onap.vnf.health; + +import net.jmob.guice.conf.core.BindConfig; +import net.jmob.guice.conf.core.InjectConfig; +import net.jmob.guice.conf.core.Syntax; + +/** + * Class containing static configuration for health-vnf-onap-plugin module,
+ * either loaded from property file health-vnf-onap-plugin.json from classpath. + *

+ * Further documentation for the configuration injection can be found at: + * https://github.com/yyvess/gconf + */ +@BindConfig(value = "health-vnf-onap-plugin", syntax = Syntax.JSON) +public final class ModuleConfiguration { + + // TODO change the sample property to real plugin configuration + // If there is no such configuration, remove this, health-vnf-onap-plugin.json resource and its wiring from Module class + + /** + * Sample property that's injected from external json configuration file. + */ + @InjectConfig("sample-prop") + public String sampleProp; + + /** + * Constant name used to identify health-vnf-onap-plugin plugin specific components during dependency injection. + */ + public static final String ELEMENT_SERVICE_NAME = "element-service"; +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/RESTManager.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/RESTManager.java new file mode 100644 index 00000000..abe7244e --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/RESTManager.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ + +package org.onap.vnf.health; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; +import org.apache.http.HttpResponse; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RESTManager { + + private static final Logger logger = LoggerFactory.getLogger(RESTManager.class); + + public class Pair { + public final A a; + public final B b; + + public Pair(A a, B b) { + this.a = a; + this.b = b; + } + } + + public Pair post(String url, String username, String password, + Map headers, String contentType, String body) { + CredentialsProvider credentials = new BasicCredentialsProvider(); + credentials.setCredentials(AuthScope.ANY, + new UsernamePasswordCredentials(username, password)); + + logger.debug("HTTP REQUEST: {} -> {} {} -> {}", url, username, + ((password != null) ? password.length() : "-"), contentType); + if (headers != null) { + logger.debug("Headers: "); + headers.forEach((name, value) -> logger.debug("{} -> {}", name, value)); + } + logger.debug(body); + + try (CloseableHttpClient client = + HttpClientBuilder + .create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setDefaultCredentialsProvider(credentials) + .build()) { + + HttpPost post = new HttpPost(url); + if (headers != null) { + for (Entry entry : headers.entrySet()) { + post.addHeader(entry.getKey(), headers.get(entry.getKey())); + } + } + post.addHeader("Content-Type", contentType); + + StringEntity input = new StringEntity(body); + input.setContentType(contentType); + post.setEntity(input); + + HttpResponse response = client.execute(post); + if (response != null) { + String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); + logger.debug("HTTP POST Response Status Code: {}", + response.getStatusLine().getStatusCode()); + logger.debug("HTTP POST Response Body:"); + logger.debug(returnBody); + + return new Pair<>(response.getStatusLine().getStatusCode(), + returnBody); + } + else { + logger.error("Response from {} is null", url); + return null; + } + } + catch (Exception e) { + logger.error("Failed to POST to {}", url, e); + return null; + } + } + + public Pair get(String url, String username, String password, + Map headers) { + + CredentialsProvider credentials = new BasicCredentialsProvider(); + credentials.setCredentials(AuthScope.ANY, + new UsernamePasswordCredentials(username, password)); + + try (CloseableHttpClient client = + HttpClientBuilder + .create() + .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .setDefaultCredentialsProvider(credentials) + .build()) { + + HttpGet get = new HttpGet(url); + if (headers != null) { + for (Entry entry : headers.entrySet()) { + get.addHeader(entry.getKey(), headers.get(entry.getKey())); + } + } + + HttpResponse response = client.execute(get); + + String returnBody = EntityUtils.toString(response.getEntity(), "UTF-8"); + + logger.debug("HTTP GET Response Status Code: {}", + response.getStatusLine().getStatusCode()); + logger.debug("HTTP GET Response Body:"); + logger.debug(returnBody); + + return new Pair<>(response.getStatusLine().getStatusCode(), returnBody); + } + catch (IOException e) { + logger.error("Failed to GET to {}", url, e); + return null; + } + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ElementStateCustomizer.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ElementStateCustomizer.java new file mode 100644 index 00000000..5486928d --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ElementStateCustomizer.java @@ -0,0 +1,240 @@ +/* + * 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. + */ + + /* + * Modifications copyright (c) 2018 AT&T Intellectual Property + */ + +package org.onap.vnf.health.read; + +import org.onap.vnf.health.CrudService; +import org.onap.vnf.health.RESTManager; +import org.onap.vnf.health.RESTManager.Pair; + +import io.fd.honeycomb.translate.read.ReadContext; +import io.fd.honeycomb.translate.read.ReadFailedException; +import io.fd.honeycomb.translate.spi.read.Initialized; +import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.annotation.Nonnull; + +import org.onap.vnf.health.CrudService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.HealthVnfOnapPluginStateBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheckBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.health.check.FaultsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.health.check.faults.Fault; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.health.check.faults.FaultBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.health.check.faults.FaultKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; +import org.opendaylight.yangtools.concepts.Builder; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Reader for {@link Element} list node from our YANG model. + */ +public final class ElementStateCustomizer implements InitializingReaderCustomizer { + + private final CrudService crudService; + private static final Logger LOG = LoggerFactory.getLogger(ElementStateCustomizer.class); + private final String SCRIPT; + private final String OUTPUT; + private final String VNFC; + private final Boolean PRIMARY; + private static SimpleDateFormat SDF; + + public ElementStateCustomizer(final CrudService crudService) throws IOException { + this.crudService = crudService; + + // initialize data format + SDF = new SimpleDateFormat("MM-dd-yyyy:HH.mm.ss"); + + // read properties from file + String path = "/opt/config/properties.conf"; + Properties prop = new Properties(); + InputStream prop_file = new FileInputStream(path); + prop.load(prop_file); + SCRIPT = prop.getProperty("script"); + OUTPUT = prop.getProperty("output"); + VNFC = prop.getProperty("vnfc"); + PRIMARY = Boolean.parseBoolean(prop.getProperty("primary")); + prop_file.close(); + } + + @Override + public void merge(@Nonnull final Builder builder, @Nonnull final HealthCheck readData) { + // merge children data to parent builder + // used by infrastructure to merge data loaded in separated customizers + ((HealthVnfOnapPluginStateBuilder) builder).setHealthCheck(readData); + } + + @Nonnull + @Override + public HealthCheckBuilder getBuilder(@Nonnull final InstanceIdentifier id) { + // return new builder for this data node + return new HealthCheckBuilder(); + } + + @Override + public void readCurrentAttributes(@Nonnull final InstanceIdentifier id, + @Nonnull final HealthCheckBuilder builder, + @Nonnull final ReadContext ctx) throws ReadFailedException { + + List ipAddr = new ArrayList(); + if(PRIMARY) { + String ret = readFromFile("/opt/config/oam_vpktgen_ip.txt"); + if(ret != null) { + ipAddr.add(ret); + } + ret = readFromFile("/opt/config/oam_vdns_ip.txt"); + if(ret != null) { + ipAddr.add(ret); + } + } + + // assess the health status of the local service (try at most three times, otherwise return an error). + String healthStatus; + String [] cmdArgs = {"/bin/bash", "-c", SCRIPT}; + int ret = -1; + int attempts = 0; + + do { + try { + Process child = Runtime.getRuntime().exec(cmdArgs); + // wait for child process to terminate + ret = child.waitFor(); + attempts++; + } + catch (IOException e) { + LOG.error("Command: [" + SCRIPT + "] returned an error."); + e.printStackTrace(); + } + catch (InterruptedException e) { + LOG.error("Child process: [" + SCRIPT + "] returned an error. Error code: " + ret); + e.printStackTrace(); + } + } while(ret != 0 && attempts < 3); + + if(ret == 0) { + healthStatus = readFromFile(OUTPUT); + if(healthStatus == null) { + healthStatus = "unhealthy"; + } + LOG.info("Assessing the health status of the local component... Return status = \"" + healthStatus + "\""); + } + else { + healthStatus = "unhealthy"; + LOG.info("Failed to assess the health status of the local component. Return status = \"unhealthy\""); + } + + // perform read of details of data specified by key of Element in id + // final HealthCheck data = crudService.readSpecific(id); + + // check the status of other VNF components, if any + if(PRIMARY) { + for(int i = 0; i < ipAddr.size(); i++) { + if(!getRemoteVnfcHealthStatus(ipAddr.get(i))) { + healthStatus = "unhealthy"; + } + } + } + + // and sets it to builder + builder.setState(healthStatus); + builder.setVnfName(VNFC); + builder.setTime(SDF.format(new Date().getTime())); + + if(healthStatus.equals("unhealthy")) { + List faultList = new ArrayList(); + // build a FaultBuilder object in case of one or more VNF components are reporting faults + FaultBuilder faultBuilder = new FaultBuilder(); + faultBuilder.setVnfComponent(VNFC); + faultBuilder.setMessage("The VNF is not running correctly"); + faultBuilder.setKey(new FaultKey(faultBuilder.getVnfComponent())); + faultList.add(faultBuilder.build()); + + // build a FaultsBuilder object that contains a list of Fault instances + FaultsBuilder faultsBuilder = new FaultsBuilder(); + faultsBuilder.setInfo("One or more VNF components are unreachable"); + faultsBuilder.setFault(faultList); + + // add the Faults object to HealthCheckBuilder + builder.setFaults(faultsBuilder.build()); + } + + // create the final HealthCheck object + builder.build(); + } + /** + * + * Initialize configuration data based on operational data. + *

+ * Very useful when a plugin is initiated but the underlying layer already contains some operation state. + * Deriving the configuration from existing operational state enables reconciliation in case when + * Honeycomb's persistence is not available to do the work for us. + */ + @Nonnull + @Override + public Initialized init(@Nonnull final InstanceIdentifier id, + @Nonnull final HealthCheck readValue, + @Nonnull final ReadContext ctx) { + return Initialized.create(id, readValue); + } + + private String readFromFile(String path) { + // auto close the file reader + try (BufferedReader br = new BufferedReader(new FileReader(path))) { + String line; + while ((line = br.readLine()) != null) { + return line; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + private boolean getRemoteVnfcHealthStatus(String ipAddr) { + // set up the REST manager + RESTManager mgr = new RESTManager(); + Map headers = new HashMap(); + headers.put("Content-Type", "application/json"); + headers.put("Accept", "application/json"); + + // execute the request + String URI = "http://" + ipAddr + ":8183/restconf/operational/health-vnf-onap-plugin:health-vnf-onap-plugin-state/health-check"; + Pair result = mgr.get(URI, "admin", "admin", headers); + + return (!result.b.contains("unhealthy")); + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ModuleStateReaderFactory.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ModuleStateReaderFactory.java new file mode 100644 index 00000000..a88a6901 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/read/ModuleStateReaderFactory.java @@ -0,0 +1,70 @@ +/* + * 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 org.onap.vnf.health.read; + +import static org.onap.vnf.health.ModuleConfiguration.ELEMENT_SERVICE_NAME; + +import java.io.IOException; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import org.onap.vnf.health.CrudService; +import io.fd.honeycomb.translate.impl.read.GenericReader; +import io.fd.honeycomb.translate.read.ReaderFactory; +import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.HealthVnfOnapPluginState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.HealthVnfOnapPluginStateBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Factory producing readers for health-vnf-onap-plugin plugin's data. + */ +public final class ModuleStateReaderFactory implements ReaderFactory { + + public static final InstanceIdentifier ROOT_STATE_CONTAINER_ID = + InstanceIdentifier.create(HealthVnfOnapPluginState.class); + + /** + * Injected crud service to be passed to customizers instantiated in this factory. + */ + @Inject + @Named(ELEMENT_SERVICE_NAME) + private CrudService crudService; + + @Override + public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) { + + // register reader that only delegate read's to its children + registry.addStructuralReader(ROOT_STATE_CONTAINER_ID, HealthVnfOnapPluginStateBuilder.class); + + // just adds reader to the structure + // use addAfter/addBefore if you want to add specific order to readers on the same level of tree + // use subtreeAdd if you want to handle multiple nodes in single customizer/subtreeAddAfter/subtreeAddBefore if you also want to add order + // be aware that instance identifier passes to subtreeAdd/subtreeAddAfter/subtreeAddBefore should define subtree, + // therefore it should be relative from handled node down - InstanceIdentifier.create(HandledNode), not parent.child(HandledNode.class) + try { + registry.add( + new GenericReader<>(ROOT_STATE_CONTAINER_ID.child(HealthCheck.class), + new ElementStateCustomizer(crudService))); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ElementCustomizer.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ElementCustomizer.java new file mode 100644 index 00000000..ec41a9a2 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ElementCustomizer.java @@ -0,0 +1,65 @@ +/* + * 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 org.onap.vnf.health.write; + +import org.onap.vnf.health.CrudService; +import io.fd.honeycomb.translate.spi.write.WriterCustomizer; +import io.fd.honeycomb.translate.write.WriteContext; +import io.fd.honeycomb.translate.write.WriteFailedException; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Writer for {@link Element} list node from our YANG model. + */ +//public final class ElementCustomizer implements ListWriterCustomizer { +public final class ElementCustomizer implements WriterCustomizer { + + private final CrudService crudService; + + public ElementCustomizer(@Nonnull final CrudService crudService) { + this.crudService = crudService; + } + + @Override + public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final HealthCheck dataAfter, + @Nonnull final WriteContext writeContext) throws WriteFailedException { + //perform write of data,or throw exception + //invoked by PUT operation,if provided data doesn't exist in Config data + crudService.writeData(id, dataAfter); + } + + @Override + public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, + @Nonnull final HealthCheck dataBefore, + @Nonnull final HealthCheck dataAfter, @Nonnull final WriteContext writeContext) + throws WriteFailedException { + //perform update of data,or throw exception + //invoked by PUT operation,if provided data does exist in Config data + crudService.updateData(id, dataBefore, dataAfter); + } + + @Override + public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, + @Nonnull final HealthCheck dataBefore, + @Nonnull final WriteContext writeContext) throws WriteFailedException { + //perform delete of data,or throw exception + //invoked by DELETE operation + crudService.deleteData(id, dataBefore); + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ModuleWriterFactory.java b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ModuleWriterFactory.java new file mode 100644 index 00000000..8dfd1cbb --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/health-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/health/write/ModuleWriterFactory.java @@ -0,0 +1,54 @@ +/* + * 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 org.onap.vnf.health.write; + +import static org.onap.vnf.health.ModuleConfiguration.ELEMENT_SERVICE_NAME; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import org.onap.vnf.health.CrudService; +import io.fd.honeycomb.translate.impl.write.GenericWriter; +import io.fd.honeycomb.translate.write.WriterFactory; +import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.HealthVnfOnapPlugin; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.health.vnf.onap.plugin.rev160918.health.vnf.onap.plugin.params.HealthCheck; + +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Factory producing writers for health-vnf-onap-plugin plugin's data. + */ +public final class ModuleWriterFactory implements WriterFactory { + + private static final InstanceIdentifier ROOT_CONTAINER_ID = InstanceIdentifier.create(HealthVnfOnapPlugin.class); + + /** + * Injected crud service to be passed to customizers instantiated in this factory. + */ + @Inject + @Named(ELEMENT_SERVICE_NAME) + private CrudService crudService; + + @Override + public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { + + //adds writer for child node + //no need to add writers for empty nodes + registry.add(new GenericWriter<>(ROOT_CONTAINER_ID.child(HealthCheck.class), new ElementCustomizer(crudService))); + } +} diff --git a/vnfs/vLBMS/apis/health-vnf-onap-plugin/pom.xml b/vnfs/vLBMS/apis/health-vnf-onap-plugin/pom.xml new file mode 100755 index 00000000..1ed7e898 --- /dev/null +++ b/vnfs/vLBMS/apis/health-vnf-onap-plugin/pom.xml @@ -0,0 +1,68 @@ + + + + + demo-aggregator + 1.2.0-SNAPSHOT + org.onap.demo.vnf + ../../../../pom.xml + + + org.onap.demo.vnf.health + health-vnf-onap-plugin-aggregator + 1.2.0-SNAPSHOT + health-vnf-onap-plugin-aggregator + pom + 4.0.0 + + + health-vnf-onap-plugin-api + health-vnf-onap-plugin-impl + ../vlb-vnf-onap-distribution + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + \ No newline at end of file diff --git a/vnfs/vLBMS/apis/pom.xml b/vnfs/vLBMS/apis/pom.xml deleted file mode 100755 index 40ed33d1..00000000 --- a/vnfs/vLBMS/apis/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - demo-aggregator - 1.2.0-SNAPSHOT - org.onap.demo.vnf - ../../../pom.xml - - - org.onap.demo.vnf.vlb - vlb-business-vnf-onap-plugin-aggregator - 1.2.0-SNAPSHOT - vlb-business-vnf-onap-plugin-aggregator - pom - 4.0.0 - - - vlb-business-vnf-onap-plugin-api - vlb-business-vnf-onap-plugin-impl - vlb-vnf-onap-distribution - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - none - - - - true - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - org.apache.maven.plugins - maven-install-plugin - - true - - - - - diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc deleted file mode 100644 index 84ed862b..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= vlb-business-vnf-onap-plugin-api - -Overview of vlb-business-vnf-onap-plugin-api \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml deleted file mode 100644 index 92de0917..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - io.fd.honeycomb.common - api-parent - 1.17.07 - - - 4.0.0 - org.onap.demo.vnf.vlb - vlb-business-vnf-onap-plugin-api - vlb-business-vnf-onap-plugin-api - bundle - - - - org.opendaylight.mdsal.model - iana-if-type-2014-05-08 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 - - - org.opendaylight.mdsal.model - ietf-interfaces - - - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - yang-ext - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - none - - - - true - - - - maven-checkstyle-plugin - - true - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang deleted file mode 100644 index 229ad7a3..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang +++ /dev/null @@ -1,66 +0,0 @@ -module vlb-business-vnf-onap-plugin { - - yang-version 1; - namespace "urn:opendaylight:params:xml:ns:yang:vlb-business-vnf-onap-plugin"; - prefix "vlb-business-vnf-onap-plugin"; - - description - "This YANG module defines the generic configuration and - operational data for vlb-business-vnf-onap-plugin in VPP"; - - revision "2016-09-18" { - description "Initial revision of vlb-business-vnf-onap-plugin model"; - } - - container vlb-business-vnf-onap-plugin { - uses vlb-business-vnf-onap-plugin-params; - description "Configuration data of vlb-business-vnf-onap-plugin in Honeycomb"; - - // READ - // curl -u admin:admin http://localhost:8181/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin - - // WRITE - // curl http://localhost:8181/restconf/operational/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin - - } - - container vlb-business-vnf-onap-plugin-state { - config false; - uses vlb-business-vnf-onap-plugin-params; - description "Operational data of vlb-business-vnf-onap-plugin persisted in VPP"; - - // READ - // curl -u admin:admin http://localhost:8181/restconf/operational/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin-state - } - -// grouping vlb-business-vnf-onap-plugin-params { -// list element { -// -// key id; -// leaf id { -// type uint32; -// } -// -// leaf description { -// type string; -// } -// } -// } - - - grouping vlb-business-vnf-onap-plugin-params { - container vdns-instances { - list vdns-instance { - - key ip-addr; - leaf ip-addr { - type string; - } - - leaf is-enabled { - type boolean; - } - } - } - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc deleted file mode 100644 index ab759c7b..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= vlb-business-vnf-onap-plugin-impl - -Overview of vlb-business-vnf-onap-plugin-impl \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml deleted file mode 100644 index c0476255..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - io.fd.honeycomb.common - impl-parent - 1.17.07 - - - 4.0.0 - org.onap.demo.vnf.vlb - vlb-business-vnf-onap-plugin-impl - vlb-business-vnf-onap-plugin-impl - bundle - - - 1.17.07 - - - - - ${project.groupId} - vlb-business-vnf-onap-plugin-api - ${project.version} - - - - - io.fd.honeycomb - translate-api - ${honeycomb.infra.version} - - - - io.fd.honeycomb - translate-spi - ${honeycomb.infra.version} - - - - io.fd.honeycomb - cfg-init - ${honeycomb.infra.version} - - - - - com.google.inject - guice - - - net.jmob - guice.conf - - - com.google.inject.extensions - guice-multibindings - - - - - - - org.codehaus.mojo - exec-maven-plugin - - - none - - - - true - - - - maven-checkstyle-plugin - - true - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java deleted file mode 100644 index 1e7be67b..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java +++ /dev/null @@ -1,64 +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 org.onap.vnf.vlb; - -import io.fd.honeycomb.translate.read.ReadFailedException; -import io.fd.honeycomb.translate.write.WriteFailedException; -import java.util.List; -import javax.annotation.Nonnull; -import org.opendaylight.yangtools.yang.binding.DataObject; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * Example of an aggregated access interface. - *

- * Shared by all the customizers hiding the ugly details of our data management. - * - * TODO update javadoc - */ -public interface CrudService { - - /** - * Perform write of provided data. - */ - void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) - throws WriteFailedException; - - - /** - * Perform delete of existing data. - */ - void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) - throws WriteFailedException; - - /** - * Perform update of existing data. - */ - void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T dataOld, - @Nonnull final T dataNew) - throws WriteFailedException; - - /** - * Read data identified by provided identifier. - */ - T readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException; - - /** - * Read all nodes of type {@link T}. - */ - List readAll() throws ReadFailedException; -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java deleted file mode 100644 index d17c6c18..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java +++ /dev/null @@ -1,114 +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 org.onap.vnf.vlb; - -import io.fd.honeycomb.translate.read.ReadFailedException; -import io.fd.honeycomb.translate.write.WriteFailedException; -import java.util.Collections; -import java.util.List; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPluginState; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Simple example of class handling Crud operations for plugin. - *

- * No real handling, serves just as an illustration. - * - * TODO update javadoc - */ -final class ElementCrudService implements CrudService { - - private static final Logger LOG = LoggerFactory.getLogger(ElementCrudService.class); - - @Override - public void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance data) - throws WriteFailedException { - if (data != null) { - - // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify - // relationships such as to which parent these data are related to - - // Performs any logic needed for persisting such data - LOG.info("Writing path[{}] / data [{}]", identifier, data); - } else { - throw new WriteFailedException.CreateFailedException(identifier, data, - new NullPointerException("Provided data are null")); - } - } - - @Override - public void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance data) - throws WriteFailedException { - if (data != null) { - - // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify - // relationships such as to which parent these data are related to - - // Performs any logic needed for persisting such data - LOG.info("Removing path[{}] / data [{}]", identifier, data); - } else { - throw new WriteFailedException.DeleteFailedException(identifier, - new NullPointerException("Provided data are null")); - } - } - - @Override - public void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance dataOld, - @Nonnull final VdnsInstance dataNew) throws WriteFailedException { - if (dataOld != null && dataNew != null) { - - // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify - // relationships such as to which parent these data are related to - - // Performs any logic needed for persisting such data - LOG.info("Update path[{}] from [{}] to [{}]", identifier, dataOld, dataNew); - } else { - throw new WriteFailedException.DeleteFailedException(identifier, - new NullPointerException("Provided data are null")); - } - } - - @Override - public VdnsInstance readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException { - - // read key specified in path identifier - final VdnsInstanceKey key = identifier.firstKeyOf(VdnsInstance.class); - - // load data by this key - // *Key class will always contain key of entity, in this case long value - - return new VdnsInstanceBuilder() - .setIpAddr(key.getIpAddr()) - .setKey(key) - .setIsEnabled(true) - .build(); - } - - @Override - public List readAll() throws ReadFailedException { - // read all data under parent node,in this case {@link ModuleState} - return Collections.singletonList( - readSpecific(InstanceIdentifier.create(VlbBusinessVnfOnapPluginState.class).child(VdnsInstances.class).child(VdnsInstance.class, new VdnsInstanceKey("")))); - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java deleted file mode 100644 index 37506d1e..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java +++ /dev/null @@ -1,66 +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 org.onap.vnf.vlb; - -import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME; - -import com.google.inject.AbstractModule; -import com.google.inject.TypeLiteral; -import com.google.inject.multibindings.Multibinder; -import com.google.inject.name.Names; -//import org.onap.vnf.vlb.read.ModuleStateReaderFactory; -import org.onap.vnf.vlb.write.ModuleWriterFactory; -import io.fd.honeycomb.data.init.DataTreeInitializer; -import io.fd.honeycomb.translate.read.ReaderFactory; -import io.fd.honeycomb.translate.write.WriterFactory; -import net.jmob.guice.conf.core.ConfigurationModule; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; - -/** - * Module class instantiating vlb-business-vnf-onap-plugin plugin components. - */ -public final class Module extends AbstractModule { - - // TODO This initiates all the plugin components, but it still needs to be registered/wired into an integration - // module producing runnable distributions. There is one such distribution in honeycomb project: - // vpp-integration/minimal-distribution - // In order to integrate this plugin with the distribution: - // 1. Add a dependency on this maven module to the the distribution's pom.xml - // 2. Add an instance of this module into the distribution in its Main class - - @Override - protected void configure() { - // requests injection of properties - install(ConfigurationModule.create()); - requestInjection(ModuleConfiguration.class); - - // creates binding for interface implementation by name - bind(new TypeLiteral>(){}) - .annotatedWith(Names.named(ELEMENT_SERVICE_NAME)) - .to(ElementCrudService.class); - - // creates reader factory binding - // can hold multiple binding for separate yang modules - //final Multibinder readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); - //readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class); - - // create writer factory binding - // can hold multiple binding for separate yang modules - final Multibinder writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class); - writerFactoryBinder.addBinding().to(ModuleWriterFactory.class); - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java deleted file mode 100644 index c2a429ab..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java +++ /dev/null @@ -1,46 +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 org.onap.vnf.vlb; - -import net.jmob.guice.conf.core.BindConfig; -import net.jmob.guice.conf.core.InjectConfig; -import net.jmob.guice.conf.core.Syntax; - -/** - * Class containing static configuration for vlb-business-vnf-onap-plugin module,
- * either loaded from property file vlb-business-vnf-onap-plugin.json from classpath. - *

- * Further documentation for the configuration injection can be found at: - * https://github.com/yyvess/gconf - */ -@BindConfig(value = "vlb-business-vnf-onap-plugin", syntax = Syntax.JSON) -public final class ModuleConfiguration { - - // TODO change the sample property to real plugin configuration - // If there is no such configuration, remove this, vlb-business-vnf-onap-plugin.json resource and its wiring from Module class - - /** - * Sample property that's injected from external json configuration file. - */ - @InjectConfig("sample-prop") - public String sampleProp; - - /** - * Constant name used to identify vlb-business-vnf-onap-plugin plugin specific components during dependency injection. - */ - public static final String ELEMENT_SERVICE_NAME = "element-service"; -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java deleted file mode 100644 index dc3e9248..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java +++ /dev/null @@ -1,142 +0,0 @@ - -/*************************************************************************//** - * - * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. - * - * 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.onap.vnf.vlb.write; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * Class that maintains a map of all the active vDNS instances. - * A vDNS instance is represented by its IP address and a flag - * that represents its status, i.e. enabled or disabled. - * - * Clients can update the vDNS map via NETCONF or RESTconf. - * Operations are translated by the Honeycomb agent into a JSON - * object that is persisted on disk (see Honeycomb distribution - * configuration for more information). The ElementCustomizer - * class then updates this map. Each operation results in a vLB - * setup change, e.g. GRE tunnels that connect the vLB to the - * vDNS instances are created or deleted, depending on the kind - * of operation that is invoked. Only vDNS instances for which - * the isEnabled flag is true are currently served by the vLB. - * - * The vLB setup and configuration is executed via shell scripts. - * - */ - -public class DnsInstanceManager { - - private static final Logger LOG = LoggerFactory.getLogger(DnsInstanceManager.class); - private Map dnsInstances = new HashMap(); - - /* - * Add a new DNS instance to the map and create a GRE tunnel - * towards that instance if isEnabled is set to true. - */ - void addDnsInstance(String ipAddr, Boolean isEnabled) { - // Call updateDnsInstance in case the DNS instance already exists. - // This is somewhat redundant because Honeycomb already runs this check. - if(dnsInstances.containsKey(ipAddr)) { - updateDnsInstance(ipAddr, isEnabled); - return; - } - - dnsInstances.put(ipAddr, isEnabled); - LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " has been added."); - - // Create a GRE tunnel towards the new DNS instance if isEnabled is true. - if(isEnabled) { - addGreTunnel(ipAddr); - } - } - - /* - * Update an existing DNS instance and create or remove a GRE - * tunnel based on the current value of the isEnabled flag. - */ - void updateDnsInstance(String ipAddr, Boolean isEnabled) { - // This is somewhat redundant because Honeycomb already runs this check. - if(dnsInstances.get(ipAddr) == isEnabled) { - LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " already exists. No update is necessary."); - return; - } - - dnsInstances.put(ipAddr, isEnabled); - LOG.debug("DNS instance " + ipAddr + " has been updated with status isEnabled=" + isEnabled + "."); - - if(isEnabled) { - addGreTunnel(ipAddr); - } - else { - deleteGreTunnel(ipAddr); - } - } - - /* - * Delete an existing DNS instance from the map and remove the - * GRE tunnel if isEnabled was set to true. - */ - void deleteDnsInstance(String ipAddr) { - // This is somewhat redundant because Honeycomb already runs this check. - if(!dnsInstances.containsKey(ipAddr)) { - LOG.debug("DNS instance " + ipAddr + " doesn't exist."); - return; - } - - // Remove a GRE tunnel towards this DNS instance if it exists. - if(dnsInstances.get(ipAddr)) { - deleteGreTunnel(ipAddr); - } - - dnsInstances.remove(ipAddr); - } - - /* - * Auxiliary function that calls a shell script to create a GRE tunnel towards a new vDNS instance. - */ - private void addGreTunnel(String ipAddr) { - String script = new String("bash /opt/add_dns.sh " + ipAddr); - try { - Runtime.getRuntime().exec(script); - LOG.debug("New GRE tunnel towards DNS instance " + ipAddr + " created."); - } catch (IOException e) { - LOG.error("add_dns.sh returned an error."); - e.printStackTrace(); - } - } - - /* - * Auxiliary function that calls a shell script to delete a GRE tunnel towards a vDNS instance. - */ - private void deleteGreTunnel(String ipAddr) { - String script = new String("bash /opt/remove_dns.sh " + ipAddr); - try { - Runtime.getRuntime().exec(script); - LOG.debug("GRE tunnel towards DNS instance " + ipAddr + " removed."); - } catch (IOException e) { - LOG.error("remove_dns.sh returned an error."); - e.printStackTrace(); - } - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java deleted file mode 100644 index d8da0b5b..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java +++ /dev/null @@ -1,73 +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 org.onap.vnf.vlb.write; - -import org.onap.vnf.vlb.CrudService; -import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; -import io.fd.honeycomb.translate.write.WriteContext; -import io.fd.honeycomb.translate.write.WriteFailedException; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Writer for {@link Element} list node from our YANG model. - */ -public final class ElementCustomizer implements ListWriterCustomizer { - - private final CrudService crudService; - private DnsInstanceManager dnsInstanceManager; - private static final Logger LOG = LoggerFactory.getLogger(ElementCustomizer.class); - - public ElementCustomizer(@Nonnull final CrudService crudService) { - this.crudService = crudService; - dnsInstanceManager = new DnsInstanceManager(); - } - - @Override - public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final VdnsInstance dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - //perform write of data,or throw exception - //invoked by PUT operation,if provided data doesn't exist in Config data - crudService.writeData(id, dataAfter); - dnsInstanceManager.addDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled()); - } - - @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, - @Nonnull final VdnsInstance dataBefore, - @Nonnull final VdnsInstance dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - //perform update of data,or throw exception - //invoked by PUT operation,if provided data does exist in Config data - crudService.updateData(id, dataBefore, dataAfter); - dnsInstanceManager.updateDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled()); - } - - @Override - public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, - @Nonnull final VdnsInstance dataBefore, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - //perform delete of data,or throw exception - //invoked by DELETE operation - crudService.deleteData(id, dataBefore); - dnsInstanceManager.deleteDnsInstance(dataBefore.getIpAddr()); - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java deleted file mode 100644 index 8be4bb10..00000000 --- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java +++ /dev/null @@ -1,54 +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 org.onap.vnf.vlb.write; - -import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME; - -import com.google.inject.Inject; -import com.google.inject.name.Named; -import org.onap.vnf.vlb.CrudService; -import io.fd.honeycomb.translate.impl.write.GenericWriter; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPlugin; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * Factory producing writers for vlb-business-vnf-onap-plugin plugin's data. - */ -public final class ModuleWriterFactory implements WriterFactory { - - private static final InstanceIdentifier ROOT_CONTAINER_ID = InstanceIdentifier.create(VlbBusinessVnfOnapPlugin.class); - - /** - * Injected crud service to be passed to customizers instantiated in this factory. - */ - @Inject - @Named(ELEMENT_SERVICE_NAME) - private CrudService crudService; - - @Override - public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - - //adds writer for child node - //no need to add writers for empty nodes - registry.add(new GenericWriter<>(ROOT_CONTAINER_ID.child(VdnsInstances.class).child(VdnsInstance.class), new ElementCustomizer(crudService))); - } -} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/pom.xml new file mode 100644 index 00000000..08223d76 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/pom.xml @@ -0,0 +1,67 @@ + + + + + demo-aggregator + 1.2.0-SNAPSHOT + org.onap.demo.vnf + ../../../../pom.xml + + + org.onap.demo.vnf.vlb + vlb-business-vnf-onap-plugin-aggregator + 1.2.0-SNAPSHOT + vlb-business-vnf-onap-plugin-aggregator + pom + 4.0.0 + + + vlb-business-vnf-onap-plugin-api + vlb-business-vnf-onap-plugin-impl + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-install-plugin + + true + + + + + \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc new file mode 100644 index 00000000..84ed862b --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ += vlb-business-vnf-onap-plugin-api + +Overview of vlb-business-vnf-onap-plugin-api \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/pom.xml new file mode 100644 index 00000000..92de0917 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/pom.xml @@ -0,0 +1,82 @@ + + + + + io.fd.honeycomb.common + api-parent + 1.17.07 + + + 4.0.0 + org.onap.demo.vnf.vlb + vlb-business-vnf-onap-plugin-api + vlb-business-vnf-onap-plugin-api + bundle + + + + org.opendaylight.mdsal.model + iana-if-type-2014-05-08 + + + org.opendaylight.mdsal.model + ietf-yang-types-20130715 + + + org.opendaylight.mdsal.model + ietf-interfaces + + + org.opendaylight.mdsal.model + ietf-inet-types-2013-07-15 + + + org.opendaylight.mdsal.model + yang-ext + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang new file mode 100644 index 00000000..229ad7a3 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang @@ -0,0 +1,66 @@ +module vlb-business-vnf-onap-plugin { + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:vlb-business-vnf-onap-plugin"; + prefix "vlb-business-vnf-onap-plugin"; + + description + "This YANG module defines the generic configuration and + operational data for vlb-business-vnf-onap-plugin in VPP"; + + revision "2016-09-18" { + description "Initial revision of vlb-business-vnf-onap-plugin model"; + } + + container vlb-business-vnf-onap-plugin { + uses vlb-business-vnf-onap-plugin-params; + description "Configuration data of vlb-business-vnf-onap-plugin in Honeycomb"; + + // READ + // curl -u admin:admin http://localhost:8181/restconf/config/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin + + // WRITE + // curl http://localhost:8181/restconf/operational/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin + + } + + container vlb-business-vnf-onap-plugin-state { + config false; + uses vlb-business-vnf-onap-plugin-params; + description "Operational data of vlb-business-vnf-onap-plugin persisted in VPP"; + + // READ + // curl -u admin:admin http://localhost:8181/restconf/operational/vlb-business-vnf-onap-plugin:vlb-business-vnf-onap-plugin-state + } + +// grouping vlb-business-vnf-onap-plugin-params { +// list element { +// +// key id; +// leaf id { +// type uint32; +// } +// +// leaf description { +// type string; +// } +// } +// } + + + grouping vlb-business-vnf-onap-plugin-params { + container vdns-instances { + list vdns-instance { + + key ip-addr; + leaf ip-addr { + type string; + } + + leaf is-enabled { + type boolean; + } + } + } + } +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc new file mode 100644 index 00000000..ab759c7b --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc @@ -0,0 +1,3 @@ += vlb-business-vnf-onap-plugin-impl + +Overview of vlb-business-vnf-onap-plugin-impl \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/pom.xml new file mode 100644 index 00000000..22239d8d --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/pom.xml @@ -0,0 +1,104 @@ + + + + + io.fd.honeycomb.common + impl-parent + 1.17.07 + + + 4.0.0 + org.onap.demo.vnf.vlb + vlb-business-vnf-onap-plugin-impl + vlb-business-vnf-onap-plugin-impl + bundle + + + 1.17.07 + + + + + ${project.groupId} + vlb-business-vnf-onap-plugin-api + ${project.version} + + + + + io.fd.honeycomb + translate-api + ${honeycomb.infra.version} + + + + io.fd.honeycomb + translate-spi + ${honeycomb.infra.version} + + + + io.fd.honeycomb + cfg-init + ${honeycomb.infra.version} + + + + + com.google.inject + guice + + + net.jmob + guice.conf + + + com.google.inject.extensions + guice-multibindings + + + + + + + org.codehaus.mojo + exec-maven-plugin + + + none + + + + true + + + + maven-checkstyle-plugin + + true + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java new file mode 100644 index 00000000..1e7be67b --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java @@ -0,0 +1,64 @@ +/* + * 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 org.onap.vnf.vlb; + +import io.fd.honeycomb.translate.read.ReadFailedException; +import io.fd.honeycomb.translate.write.WriteFailedException; +import java.util.List; +import javax.annotation.Nonnull; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Example of an aggregated access interface. + *

+ * Shared by all the customizers hiding the ugly details of our data management. + * + * TODO update javadoc + */ +public interface CrudService { + + /** + * Perform write of provided data. + */ + void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) + throws WriteFailedException; + + + /** + * Perform delete of existing data. + */ + void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T data) + throws WriteFailedException; + + /** + * Perform update of existing data. + */ + void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final T dataOld, + @Nonnull final T dataNew) + throws WriteFailedException; + + /** + * Read data identified by provided identifier. + */ + T readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException; + + /** + * Read all nodes of type {@link T}. + */ + List readAll() throws ReadFailedException; +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java new file mode 100644 index 00000000..d17c6c18 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java @@ -0,0 +1,114 @@ +/* + * 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 org.onap.vnf.vlb; + +import io.fd.honeycomb.translate.read.ReadFailedException; +import io.fd.honeycomb.translate.write.WriteFailedException; +import java.util.Collections; +import java.util.List; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPluginState; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Simple example of class handling Crud operations for plugin. + *

+ * No real handling, serves just as an illustration. + * + * TODO update javadoc + */ +final class ElementCrudService implements CrudService { + + private static final Logger LOG = LoggerFactory.getLogger(ElementCrudService.class); + + @Override + public void writeData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance data) + throws WriteFailedException { + if (data != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Writing path[{}] / data [{}]", identifier, data); + } else { + throw new WriteFailedException.CreateFailedException(identifier, data, + new NullPointerException("Provided data are null")); + } + } + + @Override + public void deleteData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance data) + throws WriteFailedException { + if (data != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Removing path[{}] / data [{}]", identifier, data); + } else { + throw new WriteFailedException.DeleteFailedException(identifier, + new NullPointerException("Provided data are null")); + } + } + + @Override + public void updateData(@Nonnull final InstanceIdentifier identifier, @Nonnull final VdnsInstance dataOld, + @Nonnull final VdnsInstance dataNew) throws WriteFailedException { + if (dataOld != null && dataNew != null) { + + // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify + // relationships such as to which parent these data are related to + + // Performs any logic needed for persisting such data + LOG.info("Update path[{}] from [{}] to [{}]", identifier, dataOld, dataNew); + } else { + throw new WriteFailedException.DeleteFailedException(identifier, + new NullPointerException("Provided data are null")); + } + } + + @Override + public VdnsInstance readSpecific(@Nonnull final InstanceIdentifier identifier) throws ReadFailedException { + + // read key specified in path identifier + final VdnsInstanceKey key = identifier.firstKeyOf(VdnsInstance.class); + + // load data by this key + // *Key class will always contain key of entity, in this case long value + + return new VdnsInstanceBuilder() + .setIpAddr(key.getIpAddr()) + .setKey(key) + .setIsEnabled(true) + .build(); + } + + @Override + public List readAll() throws ReadFailedException { + // read all data under parent node,in this case {@link ModuleState} + return Collections.singletonList( + readSpecific(InstanceIdentifier.create(VlbBusinessVnfOnapPluginState.class).child(VdnsInstances.class).child(VdnsInstance.class, new VdnsInstanceKey("")))); + } +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java new file mode 100644 index 00000000..37506d1e --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java @@ -0,0 +1,66 @@ +/* + * 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 org.onap.vnf.vlb; + +import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME; + +import com.google.inject.AbstractModule; +import com.google.inject.TypeLiteral; +import com.google.inject.multibindings.Multibinder; +import com.google.inject.name.Names; +//import org.onap.vnf.vlb.read.ModuleStateReaderFactory; +import org.onap.vnf.vlb.write.ModuleWriterFactory; +import io.fd.honeycomb.data.init.DataTreeInitializer; +import io.fd.honeycomb.translate.read.ReaderFactory; +import io.fd.honeycomb.translate.write.WriterFactory; +import net.jmob.guice.conf.core.ConfigurationModule; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; + +/** + * Module class instantiating vlb-business-vnf-onap-plugin plugin components. + */ +public final class Module extends AbstractModule { + + // TODO This initiates all the plugin components, but it still needs to be registered/wired into an integration + // module producing runnable distributions. There is one such distribution in honeycomb project: + // vpp-integration/minimal-distribution + // In order to integrate this plugin with the distribution: + // 1. Add a dependency on this maven module to the the distribution's pom.xml + // 2. Add an instance of this module into the distribution in its Main class + + @Override + protected void configure() { + // requests injection of properties + install(ConfigurationModule.create()); + requestInjection(ModuleConfiguration.class); + + // creates binding for interface implementation by name + bind(new TypeLiteral>(){}) + .annotatedWith(Names.named(ELEMENT_SERVICE_NAME)) + .to(ElementCrudService.class); + + // creates reader factory binding + // can hold multiple binding for separate yang modules + //final Multibinder readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); + //readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class); + + // create writer factory binding + // can hold multiple binding for separate yang modules + final Multibinder writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class); + writerFactoryBinder.addBinding().to(ModuleWriterFactory.class); + } +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java new file mode 100644 index 00000000..c2a429ab --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java @@ -0,0 +1,46 @@ +/* + * 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 org.onap.vnf.vlb; + +import net.jmob.guice.conf.core.BindConfig; +import net.jmob.guice.conf.core.InjectConfig; +import net.jmob.guice.conf.core.Syntax; + +/** + * Class containing static configuration for vlb-business-vnf-onap-plugin module,
+ * either loaded from property file vlb-business-vnf-onap-plugin.json from classpath. + *

+ * Further documentation for the configuration injection can be found at: + * https://github.com/yyvess/gconf + */ +@BindConfig(value = "vlb-business-vnf-onap-plugin", syntax = Syntax.JSON) +public final class ModuleConfiguration { + + // TODO change the sample property to real plugin configuration + // If there is no such configuration, remove this, vlb-business-vnf-onap-plugin.json resource and its wiring from Module class + + /** + * Sample property that's injected from external json configuration file. + */ + @InjectConfig("sample-prop") + public String sampleProp; + + /** + * Constant name used to identify vlb-business-vnf-onap-plugin plugin specific components during dependency injection. + */ + public static final String ELEMENT_SERVICE_NAME = "element-service"; +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java new file mode 100644 index 00000000..dc3e9248 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java @@ -0,0 +1,142 @@ + +/*************************************************************************//** + * + * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. + * + * 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.onap.vnf.vlb.write; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * Class that maintains a map of all the active vDNS instances. + * A vDNS instance is represented by its IP address and a flag + * that represents its status, i.e. enabled or disabled. + * + * Clients can update the vDNS map via NETCONF or RESTconf. + * Operations are translated by the Honeycomb agent into a JSON + * object that is persisted on disk (see Honeycomb distribution + * configuration for more information). The ElementCustomizer + * class then updates this map. Each operation results in a vLB + * setup change, e.g. GRE tunnels that connect the vLB to the + * vDNS instances are created or deleted, depending on the kind + * of operation that is invoked. Only vDNS instances for which + * the isEnabled flag is true are currently served by the vLB. + * + * The vLB setup and configuration is executed via shell scripts. + * + */ + +public class DnsInstanceManager { + + private static final Logger LOG = LoggerFactory.getLogger(DnsInstanceManager.class); + private Map dnsInstances = new HashMap(); + + /* + * Add a new DNS instance to the map and create a GRE tunnel + * towards that instance if isEnabled is set to true. + */ + void addDnsInstance(String ipAddr, Boolean isEnabled) { + // Call updateDnsInstance in case the DNS instance already exists. + // This is somewhat redundant because Honeycomb already runs this check. + if(dnsInstances.containsKey(ipAddr)) { + updateDnsInstance(ipAddr, isEnabled); + return; + } + + dnsInstances.put(ipAddr, isEnabled); + LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " has been added."); + + // Create a GRE tunnel towards the new DNS instance if isEnabled is true. + if(isEnabled) { + addGreTunnel(ipAddr); + } + } + + /* + * Update an existing DNS instance and create or remove a GRE + * tunnel based on the current value of the isEnabled flag. + */ + void updateDnsInstance(String ipAddr, Boolean isEnabled) { + // This is somewhat redundant because Honeycomb already runs this check. + if(dnsInstances.get(ipAddr) == isEnabled) { + LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " already exists. No update is necessary."); + return; + } + + dnsInstances.put(ipAddr, isEnabled); + LOG.debug("DNS instance " + ipAddr + " has been updated with status isEnabled=" + isEnabled + "."); + + if(isEnabled) { + addGreTunnel(ipAddr); + } + else { + deleteGreTunnel(ipAddr); + } + } + + /* + * Delete an existing DNS instance from the map and remove the + * GRE tunnel if isEnabled was set to true. + */ + void deleteDnsInstance(String ipAddr) { + // This is somewhat redundant because Honeycomb already runs this check. + if(!dnsInstances.containsKey(ipAddr)) { + LOG.debug("DNS instance " + ipAddr + " doesn't exist."); + return; + } + + // Remove a GRE tunnel towards this DNS instance if it exists. + if(dnsInstances.get(ipAddr)) { + deleteGreTunnel(ipAddr); + } + + dnsInstances.remove(ipAddr); + } + + /* + * Auxiliary function that calls a shell script to create a GRE tunnel towards a new vDNS instance. + */ + private void addGreTunnel(String ipAddr) { + String script = new String("bash /opt/add_dns.sh " + ipAddr); + try { + Runtime.getRuntime().exec(script); + LOG.debug("New GRE tunnel towards DNS instance " + ipAddr + " created."); + } catch (IOException e) { + LOG.error("add_dns.sh returned an error."); + e.printStackTrace(); + } + } + + /* + * Auxiliary function that calls a shell script to delete a GRE tunnel towards a vDNS instance. + */ + private void deleteGreTunnel(String ipAddr) { + String script = new String("bash /opt/remove_dns.sh " + ipAddr); + try { + Runtime.getRuntime().exec(script); + LOG.debug("GRE tunnel towards DNS instance " + ipAddr + " removed."); + } catch (IOException e) { + LOG.error("remove_dns.sh returned an error."); + e.printStackTrace(); + } + } +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java new file mode 100644 index 00000000..d8da0b5b --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java @@ -0,0 +1,73 @@ +/* + * 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 org.onap.vnf.vlb.write; + +import org.onap.vnf.vlb.CrudService; +import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; +import io.fd.honeycomb.translate.write.WriteContext; +import io.fd.honeycomb.translate.write.WriteFailedException; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Writer for {@link Element} list node from our YANG model. + */ +public final class ElementCustomizer implements ListWriterCustomizer { + + private final CrudService crudService; + private DnsInstanceManager dnsInstanceManager; + private static final Logger LOG = LoggerFactory.getLogger(ElementCustomizer.class); + + public ElementCustomizer(@Nonnull final CrudService crudService) { + this.crudService = crudService; + dnsInstanceManager = new DnsInstanceManager(); + } + + @Override + public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, @Nonnull final VdnsInstance dataAfter, + @Nonnull final WriteContext writeContext) throws WriteFailedException { + //perform write of data,or throw exception + //invoked by PUT operation,if provided data doesn't exist in Config data + crudService.writeData(id, dataAfter); + dnsInstanceManager.addDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled()); + } + + @Override + public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, + @Nonnull final VdnsInstance dataBefore, + @Nonnull final VdnsInstance dataAfter, @Nonnull final WriteContext writeContext) + throws WriteFailedException { + //perform update of data,or throw exception + //invoked by PUT operation,if provided data does exist in Config data + crudService.updateData(id, dataBefore, dataAfter); + dnsInstanceManager.updateDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled()); + } + + @Override + public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, + @Nonnull final VdnsInstance dataBefore, + @Nonnull final WriteContext writeContext) throws WriteFailedException { + //perform delete of data,or throw exception + //invoked by DELETE operation + crudService.deleteData(id, dataBefore); + dnsInstanceManager.deleteDnsInstance(dataBefore.getIpAddr()); + } +} diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java new file mode 100644 index 00000000..8be4bb10 --- /dev/null +++ b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java @@ -0,0 +1,54 @@ +/* + * 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 org.onap.vnf.vlb.write; + +import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME; + +import com.google.inject.Inject; +import com.google.inject.name.Named; +import org.onap.vnf.vlb.CrudService; +import io.fd.honeycomb.translate.impl.write.GenericWriter; +import io.fd.honeycomb.translate.write.WriterFactory; +import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPlugin; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +/** + * Factory producing writers for vlb-business-vnf-onap-plugin plugin's data. + */ +public final class ModuleWriterFactory implements WriterFactory { + + private static final InstanceIdentifier ROOT_CONTAINER_ID = InstanceIdentifier.create(VlbBusinessVnfOnapPlugin.class); + + /** + * Injected crud service to be passed to customizers instantiated in this factory. + */ + @Inject + @Named(ELEMENT_SERVICE_NAME) + private CrudService crudService; + + @Override + public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { + + //adds writer for child node + //no need to add writers for empty nodes + registry.add(new GenericWriter<>(ROOT_CONTAINER_ID.child(VdnsInstances.class).child(VdnsInstance.class), new ElementCustomizer(crudService))); + } +} diff --git a/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/asciidoc/Readme.adoc deleted file mode 100644 index 0a6c66d4..00000000 --- a/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/asciidoc/Readme.adoc +++ /dev/null @@ -1,3 +0,0 @@ -= vlb-vnf-onap-distribution - -Overview of vlb-vnf-onap-distribution \ No newline at end of file diff --git a/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml b/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml index 2d42c867..693b7456 100644 --- a/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml +++ b/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml @@ -26,7 +26,8 @@ or modules configuration file. --> - org.onap.demo.vnf.vlb.Module + org.onap.vnf.vlb.Module + org.onap.vnf.health.Module @@ -116,6 +117,11 @@ vlb-business-vnf-onap-plugin-impl ${interfaces.mapping.version} + + org.onap.demo.vnf.health + health-vnf-onap-plugin-impl + ${interfaces.mapping.version} + io.fd.honeycomb -- cgit 1.2.3-korg