Add NETCONF/RESTconf APIs to vLB 63/33263/1
authorMarco Platania <platania@research.att.com>
Tue, 27 Feb 2018 21:32:25 +0000 (16:32 -0500)
committerMarco Platania <platania@research.att.com>
Tue, 27 Feb 2018 21:32:25 +0000 (16:32 -0500)
Create a new directory for the vLB Manual Scale out use case (vLBMS). Add NETCONF/RESTconf APIs for configuring the vLB via ONAP.

Change-Id: I06c557143d3a6d12159fc3195991cd8d49432348
Issue-ID: INT-432
Signed-off-by: Marco Platania <platania@research.att.com>
47 files changed:
.gitignore
pom.xml
scripts/.DS_Store [deleted file]
vnfs/VES/.DS_Store [deleted file]
vnfs/VES/code/.DS_Store [deleted file]
vnfs/VES/code/evel_training/.DS_Store [deleted file]
vnfs/VES/output/.DS_Store [deleted file]
vnfs/honeycomb_plugin/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/honeycomb/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/.DS_Store [deleted file]
vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/.DS_Store [deleted file]
vnfs/vFW/.DS_Store [deleted file]
vnfs/vFW/pg_streams/.DS_Store [deleted file]
vnfs/vFW/scripts/.DS_Store [deleted file]
vnfs/vLB/DNSClient/.DS_Store [deleted file]
vnfs/vLB/DNSClient/src/.DS_Store [deleted file]
vnfs/vLB/DNSClient/src/main/.DS_Store [deleted file]
vnfs/vLB/DNSClient/src/main/java/.DS_Store [deleted file]
vnfs/vLB/DNSManager/.DS_Store [deleted file]
vnfs/vLB/DNSManager/src/.DS_Store [deleted file]
vnfs/vLB/DNSManager/src/main/.DS_Store [deleted file]
vnfs/vLB/DNSManager/src/main/java/.DS_Store [deleted file]
vnfs/vLB/dns_streams/.DS_Store [deleted file]
vnfs/vLBMS/apis/asciidoc/Readme.adoc [new file with mode: 0644]
vnfs/vLBMS/apis/pom.xml [new file with mode: 0755]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/asciidoc/Readme.adoc [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/src/main/yang/vlb-business-vnf-onap-plugin.yang [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-vnf-onap-distribution/asciidoc/Readme.adoc [new file with mode: 0644]
vnfs/vLBMS/apis/vlb-vnf-onap-distribution/pom.xml [new file with mode: 0644]

index 93fc263..bd5fd82 100644 (file)
@@ -1,3 +1,4 @@
 /.project
 /.pydevproject
 .*.sw?
+.DS_Store
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index dc3d7d2..1ce01a4 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,7 @@
     <module>vnfs/VESreporting_vLB5.0</module>
     <module>vnfs/VESreporting_vFW5.0</module>
     <module>vnfs/vCPE/kea-sdnc-notify-mod</module>
+    <module>vnfs/vLBMS/apis</module>
   </modules>
 
   <properties>
diff --git a/scripts/.DS_Store b/scripts/.DS_Store
deleted file mode 100644 (file)
index 5008ddf..0000000
Binary files a/scripts/.DS_Store and /dev/null differ
diff --git a/vnfs/VES/.DS_Store b/vnfs/VES/.DS_Store
deleted file mode 100644 (file)
index 4b31f72..0000000
Binary files a/vnfs/VES/.DS_Store and /dev/null differ
diff --git a/vnfs/VES/code/.DS_Store b/vnfs/VES/code/.DS_Store
deleted file mode 100644 (file)
index a9cc98d..0000000
Binary files a/vnfs/VES/code/.DS_Store and /dev/null differ
diff --git a/vnfs/VES/code/evel_training/.DS_Store b/vnfs/VES/code/evel_training/.DS_Store
deleted file mode 100644 (file)
index 5008ddf..0000000
Binary files a/vnfs/VES/code/evel_training/.DS_Store and /dev/null differ
diff --git a/vnfs/VES/output/.DS_Store b/vnfs/VES/output/.DS_Store
deleted file mode 100644 (file)
index e34c832..0000000
Binary files a/vnfs/VES/output/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/.DS_Store b/vnfs/honeycomb_plugin/.DS_Store
deleted file mode 100644 (file)
index 102e7ce..0000000
Binary files a/vnfs/honeycomb_plugin/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/.DS_Store
deleted file mode 100644 (file)
index 935eda9..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/.DS_Store
deleted file mode 100644 (file)
index 6816049..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/.DS_Store
deleted file mode 100644 (file)
index 7db2c2e..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/.DS_Store
deleted file mode 100644 (file)
index 0645048..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/.DS_Store
deleted file mode 100644 (file)
index 47336c3..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/.DS_Store
deleted file mode 100644 (file)
index 0bb0440..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/honeycomb/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/honeycomb/.DS_Store
deleted file mode 100644 (file)
index 70a4762..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-distribution/src/main/java/io/fd/honeycomb/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/.DS_Store
deleted file mode 100644 (file)
index 935eda9..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/.DS_Store
deleted file mode 100644 (file)
index 6816049..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/.DS_Store
deleted file mode 100644 (file)
index 45c9ff1..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/.DS_Store and /dev/null differ
diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/.DS_Store b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/.DS_Store
deleted file mode 100644 (file)
index 935eda9..0000000
Binary files a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/.DS_Store and /dev/null differ
diff --git a/vnfs/vFW/.DS_Store b/vnfs/vFW/.DS_Store
deleted file mode 100644 (file)
index d5659b6..0000000
Binary files a/vnfs/vFW/.DS_Store and /dev/null differ
diff --git a/vnfs/vFW/pg_streams/.DS_Store b/vnfs/vFW/pg_streams/.DS_Store
deleted file mode 100644 (file)
index 5008ddf..0000000
Binary files a/vnfs/vFW/pg_streams/.DS_Store and /dev/null differ
diff --git a/vnfs/vFW/scripts/.DS_Store b/vnfs/vFW/scripts/.DS_Store
deleted file mode 100644 (file)
index e97f86f..0000000
Binary files a/vnfs/vFW/scripts/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSClient/.DS_Store b/vnfs/vLB/DNSClient/.DS_Store
deleted file mode 100644 (file)
index 210fb02..0000000
Binary files a/vnfs/vLB/DNSClient/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSClient/src/.DS_Store b/vnfs/vLB/DNSClient/src/.DS_Store
deleted file mode 100644 (file)
index dba6f68..0000000
Binary files a/vnfs/vLB/DNSClient/src/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSClient/src/main/.DS_Store b/vnfs/vLB/DNSClient/src/main/.DS_Store
deleted file mode 100644 (file)
index 9206bc7..0000000
Binary files a/vnfs/vLB/DNSClient/src/main/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSClient/src/main/java/.DS_Store b/vnfs/vLB/DNSClient/src/main/java/.DS_Store
deleted file mode 100644 (file)
index 05c3547..0000000
Binary files a/vnfs/vLB/DNSClient/src/main/java/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSManager/.DS_Store b/vnfs/vLB/DNSManager/.DS_Store
deleted file mode 100644 (file)
index cc896b0..0000000
Binary files a/vnfs/vLB/DNSManager/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSManager/src/.DS_Store b/vnfs/vLB/DNSManager/src/.DS_Store
deleted file mode 100644 (file)
index 201b6cf..0000000
Binary files a/vnfs/vLB/DNSManager/src/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSManager/src/main/.DS_Store b/vnfs/vLB/DNSManager/src/main/.DS_Store
deleted file mode 100644 (file)
index d0f5e85..0000000
Binary files a/vnfs/vLB/DNSManager/src/main/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/DNSManager/src/main/java/.DS_Store b/vnfs/vLB/DNSManager/src/main/java/.DS_Store
deleted file mode 100644 (file)
index 097132b..0000000
Binary files a/vnfs/vLB/DNSManager/src/main/java/.DS_Store and /dev/null differ
diff --git a/vnfs/vLB/dns_streams/.DS_Store b/vnfs/vLB/dns_streams/.DS_Store
deleted file mode 100644 (file)
index 5008ddf..0000000
Binary files a/vnfs/vLB/dns_streams/.DS_Store and /dev/null differ
diff --git a/vnfs/vLBMS/apis/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/asciidoc/Readme.adoc
new file mode 100644 (file)
index 0000000..292e5fd
--- /dev/null
@@ -0,0 +1,3 @@
+= 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/pom.xml b/vnfs/vLBMS/apis/pom.xml
new file mode 100755 (executable)
index 0000000..5ce6ed0
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at:
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <artifactId>demo-aggregator</artifactId>
+    <version>1.2.0-SNAPSHOT</version>
+    <groupId>org.onap.demo.vnf</groupId>
+    <relativePath>../../../pom.xml</relativePath>
+  </parent>
+
+  <groupId>org.onap.vnf.vlb</groupId>
+  <artifactId>vlb-business-vnf-onap-plugin-aggregator</artifactId>
+  <version>1.2.0-SNAPSHOT</version>
+  <name>vlb-business-vnf-onap-plugin-aggregator</name>
+  <packaging>pom</packaging>
+  <modelVersion>4.0.0</modelVersion>
+
+  <modules>
+    <module>vlb-business-vnf-onap-plugin-api</module>
+    <module>vlb-business-vnf-onap-plugin-impl</module>
+    <module>vlb-vnf-onap-distribution</module>
+  </modules>
+
+  <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
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
new file mode 100644 (file)
index 0000000..84ed862
--- /dev/null
@@ -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-api/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-api/pom.xml
new file mode 100644 (file)
index 0000000..dd6c597
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at:
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <groupId>io.fd.honeycomb.common</groupId>
+    <artifactId>api-parent</artifactId>
+    <version>1.17.07</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.onap.vnf.vlb</groupId>
+  <artifactId>vlb-business-vnf-onap-plugin-api</artifactId>
+  <name>vlb-business-vnf-onap-plugin-api</name>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>iana-if-type-2014-05-08</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-yang-types-20130715</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-interfaces</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>ietf-inet-types-2013-07-15</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.mdsal.model</groupId>
+      <artifactId>yang-ext</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>none</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
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
new file mode 100644 (file)
index 0000000..229ad7a
--- /dev/null
@@ -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-impl/asciidoc/Readme.adoc b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/asciidoc/Readme.adoc
new file mode 100644 (file)
index 0000000..ab759c7
--- /dev/null
@@ -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-impl/pom.xml b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/pom.xml
new file mode 100644 (file)
index 0000000..7f96b5c
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2015 Cisco and/or its affiliates.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at:
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>io.fd.honeycomb.common</groupId>
+        <artifactId>impl-parent</artifactId>
+        <version>1.17.07</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.onap.vnf.vlb</groupId>
+    <artifactId>vlb-business-vnf-onap-plugin-impl</artifactId>
+    <name>vlb-business-vnf-onap-plugin-impl</name>
+    <packaging>bundle</packaging>
+
+    <properties>
+        <honeycomb.infra.version>1.17.07</honeycomb.infra.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>vlb-business-vnf-onap-plugin-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- Honeycomb infrastructure-->
+        <dependency>
+            <groupId>io.fd.honeycomb</groupId>
+            <artifactId>translate-api</artifactId>
+            <version>${honeycomb.infra.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.fd.honeycomb</groupId>
+            <artifactId>translate-spi</artifactId>
+            <version>${honeycomb.infra.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>io.fd.honeycomb</groupId>
+            <artifactId>cfg-init</artifactId>
+            <version>${honeycomb.infra.version}</version>
+        </dependency>
+
+        <!-- DI -->
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>net.jmob</groupId>
+            <artifactId>guice.conf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.google.inject.extensions</groupId>
+            <artifactId>guice-multibindings</artifactId>
+        </dependency>
+    </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>none</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
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
new file mode 100644 (file)
index 0000000..1e7be67
--- /dev/null
@@ -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.
+ * <p/>
+ * Shared by all the customizers hiding the ugly details of our data management.
+ *
+ * TODO update javadoc
+ */
+public interface CrudService<T extends DataObject> {
+
+    /**
+     * Perform write of provided data.
+     */
+    void writeData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
+            throws WriteFailedException;
+
+
+    /**
+     * Perform delete of existing data.
+     */
+    void deleteData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
+            throws WriteFailedException;
+
+    /**
+     * Perform update of existing data.
+     */
+    void updateData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T dataOld,
+                           @Nonnull final T dataNew)
+            throws WriteFailedException;
+
+    /**
+     * Read data identified by provided identifier.
+     */
+    T readSpecific(@Nonnull final InstanceIdentifier<T> identifier) throws ReadFailedException;
+
+    /**
+     * Read all nodes of type {@link T}.
+     */
+    List<T> 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
new file mode 100644 (file)
index 0000000..d17c6c1
--- /dev/null
@@ -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.
+ * <p/>
+ * No real handling, serves just as an illustration.
+ *
+ * TODO update javadoc
+ */
+final class ElementCrudService implements CrudService<VdnsInstance> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(ElementCrudService.class);
+
+    @Override
+    public void writeData(@Nonnull final InstanceIdentifier<VdnsInstance> 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<VdnsInstance> 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<VdnsInstance> 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<VdnsInstance> 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<VdnsInstance> 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
new file mode 100644 (file)
index 0000000..37506d1
--- /dev/null
@@ -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<CrudService<VdnsInstance>>(){})
+                .annotatedWith(Names.named(ELEMENT_SERVICE_NAME))
+                .to(ElementCrudService.class);
+
+        // creates reader factory binding
+        // can hold multiple binding for separate yang modules
+        //final Multibinder<ReaderFactory> 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<WriterFactory> 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
new file mode 100644 (file)
index 0000000..c2a429a
--- /dev/null
@@ -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,<br>
+ * either loaded from property file vlb-business-vnf-onap-plugin.json from classpath.
+ * <p/>
+ * 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
new file mode 100644 (file)
index 0000000..dc3e924
--- /dev/null
@@ -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<String, Boolean> dnsInstances = new HashMap<String, Boolean>();
+
+       /*
+        * 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
new file mode 100644 (file)
index 0000000..d8da0b5
--- /dev/null
@@ -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<VdnsInstance, VdnsInstanceKey> {
+
+    private final CrudService<VdnsInstance> crudService;
+    private DnsInstanceManager dnsInstanceManager;
+    private static final Logger LOG = LoggerFactory.getLogger(ElementCustomizer.class);
+
+    public ElementCustomizer(@Nonnull final CrudService<VdnsInstance> crudService) {
+        this.crudService = crudService;
+        dnsInstanceManager = new DnsInstanceManager();
+    }
+
+    @Override
+    public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<VdnsInstance> 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<VdnsInstance> 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<VdnsInstance> 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
new file mode 100644 (file)
index 0000000..8be4bb1
--- /dev/null
@@ -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<VlbBusinessVnfOnapPlugin> 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<VdnsInstance> 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
new file mode 100644 (file)
index 0000000..0a6c66d
--- /dev/null
@@ -0,0 +1,3 @@
+= 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
new file mode 100644 (file)
index 0000000..b70c259
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <parent>
+    <groupId>io.fd.honeycomb.common</groupId>
+    <artifactId>minimal-distribution-parent</artifactId>
+    <version>1.17.07</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.onap.vnf.vlb</groupId>
+  <artifactId>vlb-vnf-onap-distribution</artifactId>
+  <version>1.2.0-SNAPSHOT</version>
+
+  <properties>
+    <exec.parameters>-Xms128m -Xmx128m</exec.parameters>
+    <main.class>io.fd.honeycomb.infra.distro.Main</main.class>
+    <interfaces.mapping.version>1.17.07</interfaces.mapping.version>
+    <honeycomb.min.distro.version>1.17.07</honeycomb.min.distro.version>
+    <!--
+       Defines list of specific modules provided by the distribution
+       (adds them to base modules like NetconfModule and RestconfModule).
+
+       Module configuration is placed in 'modules' subdir of the target distro folder.
+       Modules can be disabled by commenting them out in the pom.xml
+       or modules configuration file.
+     -->
+    <distribution.modules>
+      org.onap.vnf.vlb.Module
+    </distribution.modules>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.gmaven</groupId>
+        <artifactId>groovy-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <configuration>
+          <skip>false</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>exec-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>none</phase>
+          </execution>
+        </executions>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- Dependency on sample plugin -->
+    <dependency>
+      <groupId>org.onap.vnf.vlb</groupId>
+      <artifactId>vlb-business-vnf-onap-plugin-impl</artifactId>
+      <version>${interfaces.mapping.version}</version>
+    </dependency>
+    <!-- Dependency on distribution base -->
+    <dependency>
+      <groupId>io.fd.honeycomb</groupId>
+      <artifactId>minimal-distribution</artifactId>
+      <version>${honeycomb.min.distro.version}</version>
+    </dependency>
+
+  </dependencies>
+</project>