diff options
20 files changed, 5237 insertions, 0 deletions
diff --git a/generic-resource-api/.gitignore b/generic-resource-api/.gitignore new file mode 100644 index 00000000..930c0337 --- /dev/null +++ b/generic-resource-api/.gitignore @@ -0,0 +1,40 @@ +#####standard .git ignore entries##### + +## IDE Specific Files ## +.classpath +.project +.settings +.idea +.externalToolBuilders +maven-eclipse.xml +workspace + +## Compilation Files ## +*.class +**/target +target +target-ide +MANIFEST.MF + +## Misc Ignores (OS specific etc) ## +bin/ +dist +*~ +*.ipr +*.iml +*.iws +classes +out/ +.DS_STORE +.metadata + +## Folders which contain auto generated source code ## +yang-gen-config +yang-gen-sal + + + +#####Archetype specific .git ignore entries####### +generate +Archetype_Next_Steps.README + diff --git a/generic-resource-api/features/pom.xml b/generic-resource-api/features/pom.xml new file mode 100644 index 00000000..7c2e8907 --- /dev/null +++ b/generic-resource-api/features/pom.xml @@ -0,0 +1,101 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <artifactId>generic-resource-api.features</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.model</artifactId> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.provider</artifactId> + <type>xml</type> + <classifier>config</classifier> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.provider</artifactId> + </dependency> + + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>features-mdsal</artifactId> + <version>${odl.mdsal.features.version}</version> + <type>xml</type> + <classifier>features</classifier> + <scope>runtime</scope> + </dependency> + + <dependency><!-- Required for launching the feature tests--> + <groupId>org.opendaylight.odlparent</groupId> + <artifactId>features-test</artifactId> + <version>${odl.commons.opendaylight.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>features-yangtools</artifactId> + <version>${odl.yangtools.version}</version> + <type>xml</type> + <classifier>features</classifier> + <scope>runtime</scope> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <filtering>true</filtering> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>filter</id> + <goals> + <goal>resources</goal> + </goals> + <phase>generate-resources</phase> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/${features.file}</file> + <type>xml</type> + <classifier>features</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/generic-resource-api/features/src/main/resources/features.xml b/generic-resource-api/features/src/main/resources/features.xml new file mode 100644 index 00000000..ac7a1d06 --- /dev/null +++ b/generic-resource-api/features/src/main/resources/features.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<features name="generic-resource-api-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0"> + + <feature name='GENERIC-RESOURCE-API' description="generic-resource-api.GENERIC-RESOURCE-API" version='${project.version}'> + <feature version="${odl.controller.mdsal.version}">odl-mdsal-broker</feature> + <feature version="${sdnctl.sli.version}">sdnc-sli</feature> + <!-- It is assumed that applications are installed on BVC, which installs bvc-core including MD-SAL etc. + Do not list those features out here as that will tie your implementation to a specific version + of MD-SAL / BVC and force updates to your application for every upgrade of BVC core platform.--> + <bundle>mvn:org.onap.sdnc.northbound/generic-resource-api.model/${project.version}</bundle> + <bundle>mvn:org.onap.sdnc.northbound/generic-resource-api.provider/${project.version}</bundle> + <configfile finalname="etc/opendaylight/karaf/200-generic-resource-api-provider.xml">mvn:org.onap.sdnc.northbound/generic-resource-api.provider/${project.version}/xml/config</configfile> + </feature> + +</features> diff --git a/generic-resource-api/installer/pom.xml b/generic-resource-api/installer/pom.xml new file mode 100755 index 00000000..b190ff7b --- /dev/null +++ b/generic-resource-api/installer/pom.xml @@ -0,0 +1,140 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>generic-resource-api</artifactId> + <groupId>org.onap.sdnc.northbound</groupId> + <version>1.2.0-SNAPSHOT</version> + </parent> + <artifactId>generic-resource-api-installer</artifactId> + <name>Generic Resource API - Karaf Installer</name> + <packaging>pom</packaging> + + <properties> + <application.name>sdnc-generic-resources-api</application.name> + <features.boot>sdnc-generic-resources-api</features.boot> + <features.repositories>mvn:org.onap.sdnc.northbound/generic-resources-api-features/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.features</artifactId> + <version>${project.version}</version> + <classifier>features</classifier> + <type>xml</type> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.provider</artifactId> + <version>${project.version}</version> + </dependency> + + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>false</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.sdnc</includeGroupIds> + <excludeArtifactIds>sli-common,sli-provider,dblib-common,dblib-provider</excludeArtifactIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> + +</project> diff --git a/generic-resource-api/installer/src/assembly/assemble_installer_zip.xml b/generic-resource-api/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 00000000..13156fda --- /dev/null +++ b/generic-resource-api/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,56 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + 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========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + +</assembly> diff --git a/generic-resource-api/installer/src/assembly/assemble_mvnrepo_zip.xml b/generic-resource-api/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 00000000..c1b6357f --- /dev/null +++ b/generic-resource-api/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,57 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + 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========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>mvnrepo_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + + <files> + <file> + <source>../provider/src/main/resources/initial/${feature-name}-provider.xml</source> + <destName>./etc/opendaylight/karaf/200-${feature-name}-provider.xml</destName> + </file> + <file> + <source>../model/target/generic-resource-api.properties</source> + <destName>./configuration/generic-resource-api.properties</destName> + + </file> + </files> + +</assembly> diff --git a/generic-resource-api/installer/src/main/resources/scripts/install-feature.sh b/generic-resource-api/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 00000000..6e8620e1 --- /dev/null +++ b/generic-resource-api/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# 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========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} diff --git a/generic-resource-api/model/pom.xml b/generic-resource-api/model/pom.xml new file mode 100644 index 00000000..9b8b3fe1 --- /dev/null +++ b/generic-resource-api/model/pom.xml @@ -0,0 +1,161 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <artifactId>generic-resource-api.model</artifactId> + <packaging>bundle</packaging> + + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + <version>${odl.mdsal.yang.binding.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + <version>${odl.yangtools.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> + </dependencies> + + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <configuration> + <executable>python</executable> + <arguments> + <argument>scripts/python/yang2props.py</argument> + <argument>src/main/yang/GENERIC-RESOURCE-API.yang</argument> + <argument>target/generic-resource-api.properties</argument> + </arguments> + </configuration> + <id>generation</id> + <phase>generate-resources</phase> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/generic-resource-api.properties</file> + <type>properties</type> + <classifier>generic-resource-api</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId> + org.codehaus.mojo + </groupId> + <artifactId> + exec-maven-plugin + </artifactId> + <versionRange> + [1.2.1,) + </versionRange> + <goals> + <goal>exec</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/generic-resource-api/model/scripts/python/yang2props.py b/generic-resource-api/model/scripts/python/yang2props.py new file mode 100755 index 00000000..559d31b8 --- /dev/null +++ b/generic-resource-api/model/scripts/python/yang2props.py @@ -0,0 +1,57 @@ +#!/usr/bin/python + +import re +import sys + + +# Convert word from foo-bar to FooBar +# words begining with a digit will be converted to _digit +def to_enum(s): + if s[0].isdigit(): + s = "_" + s + else: + s = s[0].upper() + s[1:] + return re.sub(r'(?!^)-([a-zA-Z])', lambda m: m.group(1).upper(), s) + +leaf = "" +val = "" +li = [] + +if len(sys.argv) < 3: + print 'yang2props.py <input yang> <output properties>' + sys.exit(2) + +with open(sys.argv[1], "r") as ins: + for line in ins: + # if we see a leaf save the name for later + if "leaf " in line: + match = re.search(r'leaf (\S+)', line) + if match: + leaf = match.group(1) + + # if we see enum convert the value to enum format and see if it changed + # if the value is different write a property entry + if "enum " in line: + match = re.search(r'enum "(\S+)";', line) + if match: + val = match.group(1) + enum = to_enum(val) + + # see if converting to enum changed the string + if val != enum: + property = "yang."+leaf+"."+enum+"="+val + if property not in li: + li.append( property) + + +# Open output file +fo = open(sys.argv[2], "wb") +fo.write("# yang conversion properties \n") +fo.write("# used to convert Enum back to the original yang value \n") +fo.write("\n".join(li)) +fo.write("\n") + +# Close opend file +fo.close() + + diff --git a/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang b/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang new file mode 100644 index 00000000..233fbaf8 --- /dev/null +++ b/generic-resource-api/model/src/main/yang/GENERIC-RESOURCE-API.yang @@ -0,0 +1,1670 @@ +module GENERIC-RESOURCE-API {
+
+ namespace "org:onap:sdnc:northbound:generic-resource";
+
+ prefix generic-resource-api;
+
+ import ietf-inet-types { prefix "inet"; revision-date "2010-09-24"; }
+
+ import ietf-yang-types { prefix yang; }
+
+ revision "2017-08-24" {
+ description
+ "ONAP Amsterdam version";
+ }
+
+ grouping service-model-infrastructure {
+ list service {
+ key "service-instance-id";
+ leaf service-instance-id {
+ description "Keep as M";
+ type string;
+ mandatory true;
+ }
+ uses service-data;
+ uses service-status;
+ }
+ }
+ grouping service-data {
+ container service-data {
+ uses service-operation-information;
+ uses service-topology;
+ uses service-level-oper-status;
+ container networks {
+ list network {
+ key "network-id";
+ leaf network-id {
+ type string;
+ mandatory true;
+ }
+ container network-data {
+ uses network-operation-information;
+ uses network-topology;
+ container network-provided-allotted-resources {
+ leaf-list network-provided-ar-id {
+ description "List of allotted resources using capacity from this network";
+ type string;
+ ordered-by user;
+ }
+ }
+ uses network-level-oper-status;
+ }
+ }
+ }
+ container vnfs {
+ list vnf {
+ key "vnf-id";
+ leaf vnf-id {
+ type string;
+ mandatory true;
+ }
+ container vnf-data {
+ uses vnf-operation-information;
+ uses vnf-topology;
+ container vnf-provided-allotted-resources {
+ leaf-list vnf-provided-ar-id {
+ description "List of allotted resources using capacity from this vnf";
+ type string;
+ ordered-by user;
+ }
+ }
+ uses vnf-level-oper-status;
+ container vf-modules {
+ list vf-module {
+ key "vf-module-id";
+ leaf vf-module-id {
+ type string;
+ mandatory true;
+ }
+ container vf-module-data {
+ uses vf-module-operation-information;
+ uses vf-module-topology;
+ uses vf-module-level-oper-status;
+ }
+ }
+ }
+ }
+ }
+ }
+ container consumed-allotted-resources {
+ list consumed-allotted-resource {
+ key "allotted-resource-id";
+ uses allotted-resource-info;
+ }
+ }
+ container provided-allotted-resources {
+ list provided-allotted-resource {
+ key "allotted-resource-id";
+ uses allotted-resource-info;
+ }
+ }
+ }
+ }
+ grouping service-status {
+ container service-status {
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf final-indicator {
+ type string;
+ }
+ leaf request-status {
+ type enumeration {
+ enum "synccomplete";
+ enum "asynccomplete";
+ enum "notifycomplete";
+ }
+ }
+ leaf action {
+ description "value would one of possible request-actions; match the list in service-data oper-status";
+ type string;
+ }
+ leaf rpc-name {
+ type string;
+ }
+ leaf rpc-action {
+ description "this is the svc-action from the incoming request";
+ type enumeration {
+ enum "assign";
+ enum "activate";
+ enum "configure";
+ enum "delete";
+ enum "unassign";
+ enum "deactivate";
+ }
+ }
+ leaf response-timestamp {
+ type string;
+ }
+ }
+ }
+ grouping service-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses service-request-input;
+ }
+ grouping service-request-input {
+ container service-request-input {
+ leaf service-instance-name {
+ type string;
+ }
+ container service-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping service-topology {
+ container service-topology {
+ uses service-topology-identifier;
+ uses ecomp-model-information;
+ uses service-assignments;
+ uses service-parameters;
+ }
+ }
+ grouping service-topology-identifier {
+ container service-topology-identifier {
+ leaf service-instance-id {
+ description "repeated";
+ type string;
+ }
+ leaf service-type {
+ description "tag labeled subscription-service-type in the service-information input";
+ type string;
+ }
+ leaf service-id {
+ description "from MSO input on STO assign";
+ type string;
+ }
+ leaf service-instance-name {
+ description "optionally comes from service-request-input container or is assigned by sdn-c";
+ type string;
+ }
+ leaf global-customer-id {
+ type string;
+ }
+ }
+ }
+ grouping service-assignments {
+ container service-assignments {
+ }
+ }
+ grouping service-parameters {
+ container service-parameters {
+ list service-parameter {
+ key "service-parameter-name";
+ leaf service-parameter-name {
+ type string;
+ }
+ leaf service-parameter-value {
+ type string;
+ }
+ }
+ }
+ }
+ grouping service-level-oper-status {
+ container service-level-oper-status {
+ uses oper-status-data;
+ }
+ }
+ grouping network-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses network-information;
+ uses network-request-input;
+ }
+ grouping network-information {
+ container network-information {
+ leaf network-id {
+ type string;
+ }
+ leaf network-type {
+ type string;
+ }
+ uses ecomp-model-information;
+ }
+ }
+ grouping network-request-input {
+ container network-request-input {
+ leaf network-name {
+ type string;
+ }
+ uses region-identifier;
+ container network-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping network-topology {
+ container network-topology {
+ uses network-topology-identifier-structure;
+ uses region-identifier;
+ uses ecomp-model-information;
+ uses network-assignments;
+ uses network-parameters;
+ }
+ }
+ grouping network-topology-identifier-structure {
+ container network-topology-identifier-structure {
+ leaf network-id {
+ type string;
+ }
+ leaf network-name {
+ type string;
+ }
+ leaf network-role {
+ type string;
+ }
+ leaf network-type {
+ type string;
+ }
+ leaf network-technology {
+ description "should we keep this?";
+ type string;
+ }
+ leaf eipam-v4-address-plan {
+ description "??";
+ type string;
+ }
+ leaf eipam-v6-address-plan {
+ type string;
+ }
+ }
+ }
+ grouping network-assignments {
+ container network-assignments {
+ }
+ }
+ grouping network-parameters {
+ container network-parameters {
+ list network-parameter {
+ key "network-parameter-name";
+ leaf network-parameter-name {
+ type string;
+ }
+ leaf network-parameter-value {
+ type string;
+ }
+ }
+ }
+ }
+ grouping network-level-oper-status {
+ container network-level-oper-status {
+ uses oper-status-data;
+ }
+ }
+ grouping vnf-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vnf-information;
+ uses vnf-request-input;
+ }
+ grouping vnf-information {
+ container vnf-information {
+ leaf vnf-id {
+ type string;
+ }
+ leaf vnf-type {
+ description "vnf-model-id in Pats model?in Pats vnf submodule, contained within vnf-instance-topology-identifier grouping (along with vnf-name and vnf-instance-id)";
+ type string;
+ }
+ uses ecomp-model-information;
+ }
+ }
+ grouping vnf-request-input {
+ container vnf-request-input {
+ leaf request-version {
+ description "keep this? e.g. 1702";
+ type string;
+ }
+ leaf vnf-name {
+ description "in Pats vnf submodule, contained within vnf-instance-topology-identifier (along with vnf-model-id and vnf-instance-id)";
+ type string;
+ }
+ uses region-identifier;
+ container vnf-networks {
+ list vnf-network {
+ key "network-role";
+ uses vnf-network-data;
+ }
+ }
+ container vnf-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping vnf-topology {
+ container vnf-topology {
+ uses vnf-topology-identifier-structure;
+ uses region-identifier;
+ uses ecomp-model-information;
+ uses vnf-resource-assignments;
+ container vnf-parameters-data {
+ uses param;
+ }
+ }
+ }
+ grouping vnf-topology-identifier-structure {
+ container vnf-topology-identifier-structure {
+ leaf vnf-id {
+ type string;
+ }
+ leaf vnf-type {
+ description "In preload tree, this label is used for the vf-module-type";
+ type string;
+ }
+ leaf nf-type {
+ type string;
+ }
+ leaf nf-role {
+ type string;
+ }
+ leaf nf-function {
+ type string;
+ }
+ leaf nf-code {
+ description "used in vnf naming";
+ type string;
+ }
+ leaf vnf-name {
+ description "optionally comes from vnf-request-input container or is assigned by sdn-c";
+ type string;
+ }
+ }
+ }
+ grouping vnf-resource-assignments {
+ container vnf-resource-assignments {
+ leaf vnf-status {
+ description "Do we need this?Orchestration status from AAI - to be set by SDNCWill not be used for vIPR.";
+ type string;
+ }
+ container availability-zones {
+ leaf-list availability-zone {
+ description "Openstack availability zone name or UUID";
+ type string;
+ ordered-by user;
+ }
+ leaf max-count {
+ description "From the TOSCA data. Indicates the largest availability zone count needed by any vf-module in the VNF.";
+ type uint8;
+ }
+ }
+ container vnf-networks {
+ list vnf-network {
+ key "network-role";
+ uses vnf-network-data;
+ }
+ }
+ }
+ }
+ grouping vnf-network-data {
+ leaf network-role {
+ description "A Network Role to which a VNF must connect";
+ type string;
+ }
+ leaf network-name {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf neutron-id {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf network-id {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf contrail-network-fqdn {
+ description "contrail network policy object";
+ type string;
+ }
+ container subnets-data {
+ list subnet-data {
+ key "ip-version";
+ leaf ip-version {
+ description "Should be ipv4 or ipv6";
+ type string;
+ }
+ leaf subnet-id {
+ description "subnet UUID to be passed into the HEAT template";
+ type string;
+ }
+ }
+ }
+ }
+ grouping vnf-level-oper-status {
+ container vnf-level-oper-status {
+ uses oper-status-data;
+ }
+ }
+ grouping vf-module-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vnf-information;
+ uses vf-module-information;
+ uses vf-module-request-input;
+ }
+ grouping vf-module-information {
+ container vf-module-information {
+ leaf vf-module-id {
+ type string;
+ }
+ leaf vf-module-type {
+ type string;
+ }
+ uses ecomp-model-information;
+ }
+ }
+ grouping vf-module-request-input {
+ container vf-module-request-input {
+ leaf request-version {
+ description "keep this?";
+ type string;
+ }
+ leaf vf-module-name {
+ type string;
+ }
+ uses region-identifier;
+ container vf-module-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping vf-module-topology {
+ container vf-module-topology {
+ uses vf-module-topology-identifier;
+ uses region-identifier;
+ uses ecomp-model-information;
+ uses vf-module-assignments;
+ container vf-module-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping vf-module-topology-identifier {
+ container vf-module-topology-identifier {
+ leaf vf-module-id {
+ description "vf-module id";
+ type string;
+ }
+ leaf vf-module-name {
+ description "vf-module-name";
+ type string;
+ }
+ leaf vf-module-type {
+ description "In Pats model referred to as model-id";
+ type string;
+ }
+ }
+ }
+ grouping vf-module-assignments {
+ container vf-module-assignments {
+ leaf vf-module-status {
+ description "Do we need this?Orchestration status from AAI - to be set by SDNCNot being used for vIPR.";
+ type string;
+ }
+ container vms {
+ list vm {
+ key "vm-type";
+ uses vm-topology-data;
+ }
+ }
+ }
+ }
+ grouping vm-topology-data {
+ leaf vm-type {
+ type string;
+ mandatory true;
+ }
+ leaf nfc-naming-code {
+ description "used in vm naming(draft 29: changed from nfc-code)";
+ type string;
+ }
+ leaf vm-type-tag {
+ description "from tosca data on vfc";
+ type string;
+ }
+ leaf vm-count {
+ type uint8;
+ }
+ container vm-names {
+ leaf-list vm-name {
+ description "ordered-by: user";
+ type string;
+ ordered-by user;
+ }
+ }
+ container vm-networks {
+ list vm-network {
+ key "network-role";
+ uses vm-network-data;
+ }
+ }
+ }
+ grouping vm-network-data {
+ leaf network-role {
+ description "network (identified by role) that this VM connects to. Should also be included in the vnf-networks for the containing VNF";
+ type string;
+ mandatory true;
+ }
+ leaf network-role-tag {
+ type string;
+ }
+ container network-information-items {
+ list network-information-item {
+ key "ip-version";
+ leaf ip-version {
+ description "Use ipv4 or ipv6";
+ type string;
+ }
+ leaf use-dhcp {
+ description "Indicator to use DHCP on this network for this VM";
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ leaf ip-count {
+ description "The number of ip addresses to be assigned per vm for this network role";
+ type uint8;
+ }
+ container network-ips {
+ leaf-list network-ip {
+ description "List of assigned ip addresses of type ip-version on a network. Is there a way to specify format to indicate ipv4 or ipv6 format?";
+ type string;
+ ordered-by user;
+ }
+ }
+ }
+ }
+ container mac-addresses {
+ leaf-list mac-address {
+ description "List of network assignments for this vm-type";
+ type string;
+ ordered-by user;
+ }
+ }
+ container floating-ips {
+ leaf-list floating-ip-v4 {
+ description "Floating ipv4 for VMs of a given type on this network";
+ type inet:ip-address;
+ ordered-by user;
+ }
+ leaf-list floating-ip-v6 {
+ description "Floating ipv6 for VMs of a given type on this network";
+ type inet:ipv6-address;
+ ordered-by user;
+ }
+ }
+ container interface-route-prefixes {
+ leaf-list interface-route-prefix {
+ description "ordered-by: user";
+ type string;
+ ordered-by user;
+ }
+ }
+ container sriov-parameters {
+ container heat-vlan-filters {
+ leaf-list heat-vlan-filter {
+ type string;
+ ordered-by user;
+ }
+ }
+ container application-tags {
+ container c-tags {
+ leaf-list c-tag {
+ type string;
+ ordered-by user;
+ }
+ }
+ container s-tags {
+ leaf-list s-tag {
+ type string;
+ ordered-by user;
+ }
+ }
+ }
+ }
+ }
+ grouping vf-module-level-oper-status {
+ container vf-module-level-oper-status {
+ uses oper-status-data;
+ }
+ }
+ grouping allotted-resource-info {
+ leaf allotted-resource-id {
+ type string;
+ }
+ leaf allotted-resource-type {
+ description "Not an enum, but expected values are contrail-route and security-zone.";
+ type string;
+ }
+ leaf allotted-resource-pointer {
+ description "Pointer to the allotted-resources topology";
+ type string;
+ }
+ }
+ grouping contrail-route-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses allotted-resource-information;
+ uses contrail-route-request-input;
+ }
+ grouping contrail-route-request-input {
+ container contrail-route-request-input {
+ container source-network {
+ uses network-info;
+ }
+ container dest-network {
+ uses network-info;
+ }
+ container contrail-applied-service-info {
+ leaf service-instance-id {
+ description "The service-instance-id of the service in which the resource(s) providing the applied-service are. For vIPR, this is the service-instance-id of the vIPR-ATM service in which the vIPR-ATM VNF Contrail service is the applied service. MSO will populate with the input data.";
+ type string;
+ }
+ leaf contrail-fqdn {
+ description "For future use by MSO on input; MSO not expected to populate in 1707. If MSO can identify the contrail-fqdn of the Contrail applied service for this contrail-route, then it would be specified here on input. Otherwise, SDN-C will look it up by the vIPR-ATM VNF in the service-instance-id of the contrail-applied-service-info grouing.";
+ type string;
+ }
+ }
+ container contrail-route-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping network-info {
+ leaf network-id {
+ type string;
+ }
+ leaf network-role {
+ type string;
+ }
+ }
+ grouping contrail-route-topology {
+ container contrail-route-topology {
+ uses allotted-resource-identifiers;
+ uses ecomp-model-information;
+ uses contrail-route-assignments;
+ container contrail-route-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping contrail-route-assignments {
+ container contrail-route-assignments {
+ leaf fq-name {
+ description "The Contrail fq-name of the network policy";
+ type string;
+ }
+ leaf contrail-id {
+ description "The ID assigned by Contrail to the network-policy (one for one with the fq-name)";
+ type string;
+ }
+ container source-network {
+ uses network-info;
+ }
+ container dest-network {
+ uses network-info;
+ }
+ container contrail-applied-service {
+ leaf service-instance-id {
+ description "The service-instance-id of the vnf from which the contrail applied service is coming";
+ type string;
+ }
+ leaf vnf-id {
+ description "The vnf representing the contrail applied service";
+ type string;
+ }
+ leaf contrail-fqdn {
+ description "This is the fq-name of the Contrail service instance through which the route is passing.";
+ type string;
+ }
+ }
+ leaf vlan-tag {
+ description "Contrail-assigned vlan-tag to the vipr vm interface for this route.";
+ type string;
+ }
+ }
+ }
+ grouping security-zone-operation-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses allotted-resource-information;
+ uses security-zone-request-input;
+ }
+ grouping security-zone-request-input {
+ container security-zone-request-input {
+ leaf vlan-tag {
+ type string;
+ }
+ leaf trusted-network-role {
+ description "In the case of vIPR, this is the landing networks network-role; used in naming";
+ type string;
+ }
+ leaf untrusted-network-role {
+ description "In the case of vIPR, this is the tenant oam networks network-role; used in naming";
+ type string;
+ }
+ container security-zone-input-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping security-zone-topology {
+ container security-zone-topology {
+ uses allotted-resource-identifiers;
+ uses ecomp-model-information;
+ uses security-zone-assignments;
+ container security-zone-parameters {
+ uses param;
+ }
+ }
+ }
+ grouping security-zone-assignments {
+ container security-zone-assignments {
+ leaf trusted-network-role {
+ description "In the case of vIPR, this is the landing networks network-role; used in naming";
+ type string;
+ }
+ leaf security-zone-name-trusted {
+ type string;
+ }
+ leaf untrusted-network-role {
+ description "In the case of vIPR, this is the tenant oam networks network-role; used in naming";
+ type string;
+ }
+ leaf security-zone-name-untrusted {
+ type string;
+ }
+ leaf security-zone-service-instance-id {
+ description "Will be the same as the parent-service-instance-id";
+ type string;
+ }
+ leaf security-zone-vnf-id {
+ description "Selected by SDNC from the security-zone-service-instance-id";
+ type string;
+ }
+ leaf vlan-tag {
+ type string;
+ }
+ }
+ }
+ grouping allotted-resource-information {
+ container allotted-resource-information {
+ leaf allotted-resource-id {
+ type string;
+ }
+ leaf allotted-resource-type {
+ description "Not an enum, but expected values are contrail-route and security-zone.";
+ type string;
+ }
+ leaf parent-service-instance-id {
+ description "Service-instance-id of the parent service to which this allotted resource belongs.";
+ type string;
+ }
+ uses ecomp-model-information;
+ }
+ }
+ grouping allotted-resource-identifiers {
+ container allotted-resource-identifiers {
+ leaf allotted-resource-id {
+ type string;
+ }
+ leaf allotted-resource-name {
+ description "For a contrail-route, the network policy name.";
+ type string;
+ }
+ leaf allotted-resource-type {
+ description "(Added in draft 32)Expected to be contrail-route or security-zone.";
+ type string;
+ }
+ leaf consuming-service-instance-id {
+ description "The service-instance-id of the consuming service of this allotted resource";
+ type string;
+ }
+ leaf parent-service-instance-id {
+ description "Service-instance-id of the parent service to which this allotted resource belongs.";
+ type string;
+ }
+ }
+ }
+ grouping allotted-resource-oper-status {
+ container allotted-resource-oper-status {
+ uses oper-status-data;
+ }
+ }
+ grouping allotted-resource-status {
+ container allotted-resource-status {
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf final-indicator {
+ type string;
+ }
+ leaf request-status {
+ type enumeration {
+ enum "synccomplete";
+ enum "asynccomplete";
+ enum "notifycomplete";
+ }
+ }
+ leaf action {
+ description "value would one of possible request-actions; match the list in service-data oper-status";
+ type string;
+ }
+ leaf rpc-name {
+ type string;
+ }
+ leaf rpc-action {
+ description "this is the svc-action from the incoming request";
+ type enumeration {
+ enum "assign";
+ enum "activate";
+ enum "create";
+ enum "delete";
+ enum "unassign";
+ enum "deactivate";
+ }
+ }
+ leaf response-timestamp {
+ type string;
+ }
+ }
+ }
+ grouping topology-response-common {
+ leaf svc-request-id {
+ description "the request id from the request message for which this is the responseKeep as M";
+ type string;
+ }
+ leaf response-code {
+ description "a success code or an defined error codeKeep as M";
+ type string;
+ }
+ leaf response-message {
+ description "message included for error code";
+ type string;
+ }
+ leaf ack-final-indicator {
+ description "Expected to be Y or N.";
+ type string;
+ }
+ }
+ grouping sdnc-request-header {
+ container sdnc-request-header {
+ leaf svc-request-id {
+ description "Uniquely generated by calling system (e.g. MSO or SDN-GP)";
+ type string;
+ }
+ leaf svc-action {
+ description "Enumerated listThis is the rpcAction";
+ type enumeration {
+ enum "reserve";
+ enum "assign";
+ enum "activate";
+ enum "delete";
+ enum "changeassign";
+ enum "changedelete";
+ enum "rollback";
+ enum "deactivate";
+ enum "unassign";
+ enum "create";
+ }
+ }
+ leaf svc-notification-url {
+ description "Contains URL for asynchronous response";
+ type string;
+ }
+ }
+ }
+ grouping request-information {
+ container request-information {
+ leaf request-id {
+ description "Request ID generated upstream of MSO";
+ type string;
+ }
+ leaf request-action {
+ description "still need to work Disconnect";
+ type enumeration {
+ enum "CreateNetworkInstance";
+ enum "ActivateNetworkInstance";
+ enum "CreateServiceInstance";
+ enum "DeleteServiceInstance";
+ enum "DeleteNetworkInstance";
+ enum "CreateVnfInstance";
+ enum "ActivateVnfInstance";
+ enum "DeleteVnfInstance";
+ enum "CreateVfModuleInstance";
+ enum "ActivateVfModuleInstance";
+ enum "DeleteVfModuleInstance";
+ enum "CreateContrailRouteInstance";
+ enum "DeleteContrailRouteInstance";
+ enum "CreateSecurityZoneInstance";
+ enum "DeleteSecurityZoneInstance";
+ }
+ }
+ leaf source {
+ type string;
+ }
+ leaf notification-url {
+ type string;
+ }
+ leaf order-number {
+ type string;
+ }
+ leaf order-version {
+ type string;
+ }
+ }
+ }
+ grouping service-information {
+ container service-information {
+ leaf service-id {
+ description "This maps to the product-family-id in A&AI";
+ type string;
+ }
+ leaf subscription-service-type {
+ description "used to reference a&ai subscription-service-type. For example, we show as vIPR-ATM in example.";
+ type string;
+ }
+ uses ecomp-model-information;
+ leaf service-instance-id {
+ type string;
+ }
+ leaf global-customer-id {
+ description "need for put of data to AnAI (MSO provides)";
+ type string;
+ }
+ leaf subscriber-name {
+ description "Would not be expected for vIPR-ATM or mobility services.";
+ type string;
+ }
+ }
+ }
+ grouping ecomp-model-information {
+ container ecomp-model-information {
+ leaf model-invariant-uuid {
+ description "identifies the invariant uuid for this service or resource";
+ type string;
+ }
+ leaf model-customization-uuid {
+ description "customized resource for use within a given service.Would not be present at the service level but would be present for the resource level";
+ type string;
+ }
+ leaf model-uuid {
+ description "identifies the uuid for this service or resource, which is version specific";
+ type string;
+ }
+ leaf model-version {
+ type string;
+ }
+ leaf model-name {
+ type string;
+ }
+ }
+ }
+ grouping region-identifier {
+ leaf tenant {
+ type string;
+ }
+ leaf aic-cloud-region {
+ description "The AIC cloud region which maps to contrail versions";
+ type string;
+ }
+ leaf aic-clli {
+ description "Not expected to be used";
+ type string;
+ }
+ }
+ grouping param {
+ list param {
+ key "name";
+ leaf name {
+ type string;
+ }
+ leaf value {
+ type string;
+ }
+ }
+ }
+ grouping instance-reference {
+ leaf instance-id {
+ type string;
+ }
+ leaf object-path {
+ description "restconf retrieval path to this particular objectE.g. restconf/config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/service-topology/";
+ type string;
+ }
+ }
+ grouping oper-status-data {
+ leaf order-status {
+ description "TBD - do we need Request failed statuses? RequestFailed | InProgressTimeout";
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+ enum "Created";
+ }
+ }
+ leaf last-rpc-action {
+ type enumeration {
+ enum "assign";
+ enum "activate";
+ enum "delete";
+ enum "unassign";
+ enum "deactivate";
+ enum "create";
+ }
+ }
+ leaf last-action {
+ description "should be list of possible request-actions";
+ type enumeration {
+ enum "CreateNetworkInstance";
+ enum "ActivateNetworkInstance";
+ enum "CreateServiceInstance";
+ enum "DeleteServiceInstance";
+ enum "DeleteNetworkInstance";
+ enum "CreateVnfInstance";
+ enum "ActivateVnfInstance";
+ enum "DeleteVnfInstance";
+ enum "CreateVfModuleInstance";
+ enum "ActivateVfModuleInstance";
+ enum "DeleteVfModuleInstance";
+ enum "CreateContrailRouteInstance";
+ enum "DeleteContrailRouteInstance";
+ enum "CreateSecurityZoneInstance";
+ enum "DeleteSecurityZoneInstance";
+ }
+ }
+ leaf last-svc-request-id {
+ description "Not currently populated in service data.";
+ type string;
+ }
+ leaf last-order-status {
+ description "fieldused by generic-resource-api";
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+ enum "Created";
+ }
+ }
+ leaf create-timestamp {
+ description "Not currently populated in service data.";
+ type string;
+ }
+ leaf modify-timestamp {
+ type string;
+ }
+ }
+ grouping service-response-information {
+ container service-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping network-response-information {
+ container network-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping vnf-response-information {
+ container vnf-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping vf-module-response-information {
+ container vf-module-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping contrail-route-response-information {
+ container contrail-route-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping security-zone-response-information {
+ container security-zone-response-information {
+ uses instance-reference;
+ }
+ }
+ grouping preload-model-information {
+ list vnf-preload-list {
+ key "vnf-name vnf-type";
+ leaf vnf-name {
+ description "vf-module-name or network name";
+ type string;
+ mandatory true;
+ }
+ leaf vnf-type {
+ description "vf-module-type or network type";
+ type string;
+ mandatory true;
+ }
+ uses preload-data;
+ }
+ }
+ grouping vnf-topology-response-body {
+ leaf svc-request-id {
+ type string;
+ }
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf ack-final-indicator {
+ type string;
+ }
+ }
+ grouping preload-data {
+ container preload-data {
+ uses vnf-topology-information;
+ uses network-topology-information;
+ uses oper-status;
+ }
+ }
+ grouping vnf-topology-information {
+ container vnf-topology-information {
+ uses vnf-topology-identifier;
+ uses vnf-assignments;
+ uses vnf-parameters;
+ }
+ }
+ grouping vnf-topology-identifier {
+ container vnf-topology-identifier {
+ leaf service-type {
+ type string;
+ }
+ leaf service-id {
+ type string;
+ }
+ leaf vnf-name {
+ description "vf-module-name";
+ type string;
+ }
+ leaf vnf-type {
+ description "vf-module-type";
+ type string;
+ }
+ leaf generic-vnf-name {
+ type string;
+ }
+ leaf generic-vnf-type {
+ type string;
+ }
+ leaf generic-vnf-id {
+ type string;
+ }
+ }
+ }
+ grouping vnf-assignments {
+ container vnf-assignments {
+ leaf vnf-status {
+ description "Orchestration Status from AAI - to be set by SDNC";
+ type string;
+ }
+ list availability-zones {
+ key "availability-zone";
+ leaf availability-zone {
+ description "Openstack availability zone name or UUID";
+ type string;
+ }
+ }
+ list vnf-networks {
+ key "";
+ uses vnf-network;
+ uses sriov-vlan-filter-list;
+ }
+ uses vm-topology;
+ }
+ }
+ grouping vm-topology {
+ list vnf-vms {
+ key "vm-type";
+ leaf vm-type {
+ type string;
+ mandatory true;
+ }
+ leaf vm-count {
+ type uint8;
+ }
+ list vm-names {
+ key "vm-name";
+ leaf vm-name {
+ type string;
+ }
+ }
+ list vm-networks {
+ key "";
+ uses vm-network;
+ }
+ }
+ }
+ grouping vnf-network {
+ leaf network-role {
+ description "A Network Role to which a VNF must connect";
+ type string;
+ mandatory true;
+ }
+ leaf network-name {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf neutron-id {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf network-id {
+ description "Unique Neutron UUID of an instance of the network role ";
+ type string;
+ }
+ leaf subnet-id {
+ description "ipv4 subnet UUID to be passed into the HEAT template";
+ type string;
+ }
+ leaf subnet-name {
+ description "ipv4 subnet-name that corresponds to the ipv4 subnet-id";
+ type string;
+ }
+ leaf contrail-network-fqdn {
+ description "contrail network policy object";
+ type string;
+ }
+ leaf ipv6-subnet-id {
+ description "ipv6 subnet UUID to be passed into the HEAT template";
+ type string;
+ }
+ leaf ipv6-subnet-name {
+ description "ipv6 subnet-name that corresponds to the ipv6 subnet-id";
+ type string;
+ }
+ }
+ grouping sriov-vlan-filter-list {
+ list sriov-vlan-filter-list {
+ key "sriov-vlan-filter";
+ leaf sriov-vlan-filter {
+ type string;
+ }
+ }
+ }
+ grouping vm-network {
+ leaf network-role {
+ description "network (identified by role) that this VM connects to. Should also be included in the vnf-networks for the containing VNF";
+ type string;
+ }
+ leaf use-dhcp {
+ description "Indicator to use DHCP on this network for this VM";
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ leaf ip-count {
+ description "The number of ip addresses to be assigned per vm for this network role";
+ type uint8;
+ }
+ list network-ips {
+ key "ip-address";
+ leaf ip-address {
+ description "List of assigned ipv4 addresses on a network";
+ type inet:ip-address;
+ }
+ }
+ list network-ips-v6 {
+ key "ip-address-ipv6";
+ leaf ip-address-ipv6 {
+ description "List of assigned ipv6 addresses on a network";
+ type inet:ipv6-address;
+ }
+ }
+ list network-macs {
+ key "mac-address";
+ leaf mac-address {
+ description "List of network assignments for this VM (one per network)";
+ type string;
+ }
+ }
+ leaf floating-ip {
+ description "Floating ipv4 for VMs of a given type on this network";
+ type inet:ip-address;
+ }
+ leaf floating-ip-v6 {
+ description "Floating ipv6 for VMs of a given type on this network";
+ type inet:ipv6-address;
+ }
+ list interface-route-prefixes {
+ key "interface-route-prefix-cidr";
+ leaf interface-route-prefix-cidr {
+ description "route prefixes (CIDRs) in ip/cidr format to be provided to MSO in vnf-topology as a list of static routes";
+ type string;
+ mandatory true;
+ }
+ leaf interface-route-prefix {
+ description "route prefixes (CIDRs) to be provided to MSO in vnf-topology as a list of static routes";
+ type inet:ip-address;
+ }
+ }
+ }
+ grouping vnf-parameters {
+ list vnf-parameters {
+ key "vnf-parameter-name";
+ leaf vnf-parameter-name {
+ description "The name of an arbitrary instance-specific vnf-parameters";
+ type string;
+ }
+ leaf vnf-parameter-value {
+ description "The value of an arbitrary instance-specific vnf-parameters ";
+ type string;
+ }
+ }
+ }
+ grouping network-topology-information {
+ container network-topology-information {
+ uses network-topology-identifier;
+ uses subnets;
+ uses vpn-bindings;
+ uses network-policy;
+ uses route-table-reference;
+ uses provider-network-information;
+ }
+ }
+ grouping network-topology-identifier {
+ container network-topology-identifier {
+ leaf service-type {
+ type string;
+ }
+ leaf network-name {
+ type string;
+ }
+ leaf network-role {
+ type string;
+ }
+ leaf network-type {
+ type string;
+ }
+ leaf network-technology {
+ type string;
+ }
+ }
+ }
+ grouping subnets {
+ list subnets {
+ key "start-address";
+ leaf start-address {
+ type inet:ip-address;
+ }
+ leaf gateway-address {
+ type inet:ip-address;
+ }
+ leaf cidr-mask {
+ type string;
+ }
+ leaf ip-version {
+ type string;
+ }
+ leaf dhcp-enabled {
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ leaf dhcp-start-address {
+ type string;
+ }
+ leaf dhcp-end-address {
+ type string;
+ }
+ leaf subnet-name {
+ type string;
+ }
+ }
+ }
+ grouping vpn-bindings {
+ list vpn-bindings {
+ key "vpn-binding-id";
+ leaf vpn-binding-id {
+ type string;
+ }
+ leaf global-route-target {
+ type string;
+ }
+ }
+ }
+ grouping network-policy {
+ list network-policy {
+ key "network-policy-fqdn";
+ leaf network-policy-fqdn {
+ type string;
+ }
+ leaf network-policy-id {
+ type string;
+ }
+ }
+ }
+ grouping route-table-reference {
+ list route-table-reference {
+ key "route-table-reference-fqdn";
+ leaf route-table-reference-fqdn {
+ type string;
+ mandatory true;
+ }
+ leaf route-table-reference-id {
+ type string;
+ }
+ }
+ }
+ grouping provider-network-information {
+ leaf physical-network-name {
+ type string;
+ }
+ leaf is-provider-network {
+ type boolean;
+ }
+ leaf is-shared-network {
+ type boolean;
+ }
+ leaf is-external-network {
+ type boolean;
+ }
+ }
+ grouping oper-status {
+ container oper-status {
+ leaf order-status {
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+ }
+ }
+ leaf last-action {
+ description "this is preload request actions";
+ type enumeration {
+ enum "VNFActivateRequest";
+ enum "ChangeVNFActivateRequest";
+ enum "VnfInstanceActivateRequest";
+ enum "ChangeVnfInstanceActivateRequest";
+ enum "VfModuleActivateRequest";
+ enum "ChangeVfModuleActivateRequest";
+ enum "DisconnectVNFRequest";
+ enum "DisconnectVnfInstanceRequest";
+ enum "DisconnectVfModuleRequest";
+ enum "PreloadVNFRequest";
+ enum "DeletePreloadVNFRequest";
+ enum "PreloadVnfInstanceRequest";
+ enum "DeletePreloadVnfInstanceRequest";
+ enum "PreloadVfModuleRequest";
+ enum "DeletePreloadVfModuleRequest";
+ }
+ }
+ leaf last-svc-request-id {
+ type string;
+ }
+ leaf last-order-status {
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+ }
+ }
+ leaf create-timestamp {
+ type string;
+ }
+ leaf modify-timestamp {
+ type string;
+ }
+ leaf maintenance-indicator {
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ }
+ }
+ container services {
+ uses service-model-infrastructure;
+ }
+ container contrail-route-allotted-resources {
+ list contrail-route-allotted-resource {
+ key "allotted-resource-id";
+ leaf allotted-resource-id {
+ type string;
+ mandatory true;
+ }
+ container allotted-resource-data {
+ container allotted-resource-operation-information {
+ uses contrail-route-operation-information;
+ }
+ uses contrail-route-topology;
+ uses allotted-resource-oper-status;
+ }
+ uses allotted-resource-status;
+ }
+ }
+ container security-zone-allotted-resources {
+ list security-zone-allotted-resource {
+ key "allotted-resource-id";
+ leaf allotted-resource-id {
+ type string;
+ mandatory true;
+ }
+ container allotted-resource-data {
+ container allotted-resource-operation-information {
+ uses security-zone-operation-information;
+ }
+ uses security-zone-topology;
+ container security-zone-parameters {
+ uses param;
+ }
+ uses allotted-resource-oper-status;
+ }
+ uses allotted-resource-status;
+ }
+ }
+ rpc service-topology-operation {
+ input {
+ uses service-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses service-response-information;
+ }
+ }
+ rpc network-topology-operation {
+ input {
+ uses network-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses network-response-information;
+ uses service-response-information;
+ }
+ }
+ rpc vnf-topology-operation {
+ input {
+ uses vnf-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses vnf-response-information;
+ uses service-response-information;
+ }
+ }
+ rpc vf-module-topology-operation {
+ input {
+ uses vf-module-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses vf-module-response-information;
+ uses vnf-response-information;
+ uses service-response-information;
+ }
+ }
+ rpc contrail-route-topology-operation {
+ input {
+ uses contrail-route-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses contrail-route-response-information;
+ uses service-response-information;
+ }
+ }
+ rpc security-zone-topology-operation {
+ input {
+ uses security-zone-operation-information;
+ }
+ output {
+ uses topology-response-common;
+ uses security-zone-response-information;
+ uses service-response-information;
+ }
+ }
+ container preload-vnfs {
+ uses preload-model-information;
+ }
+ rpc preload-vnf-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses vnf-topology-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ }
+ }
+ rpc preload-network-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses network-topology-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ }
+ }
+} ////closes the module
diff --git a/generic-resource-api/pom.xml b/generic-resource-api/pom.xml new file mode 100644 index 00000000..2d761019 --- /dev/null +++ b/generic-resource-api/pom.xml @@ -0,0 +1,55 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>sdnc-northbound</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <properties> + <feature-name>generic-resource-api</feature-name> + </properties> + <modules> + <module>model</module> + <module>features</module> + <module>installer</module> + <module>provider</module> + </modules> + + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.features</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.provider</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>config</classifier> + </dependency> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/generic-resource-api/provider/pom.xml b/generic-resource-api/provider/pom.xml new file mode 100644 index 00000000..c3f61c97 --- /dev/null +++ b/generic-resource-api/provider/pom.xml @@ -0,0 +1,190 @@ +<?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"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api</artifactId> + <version>1.2.0-SNAPSHOT</version> + </parent> + + <artifactId>generic-resource-api.provider</artifactId> + <packaging>bundle</packaging> + + <dependencies> + <dependency> + <groupId>org.onap.sdnc.northbound</groupId> + <artifactId>generic-resource-api.model</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>config-api</artifactId> + <version>${odl.controller.config.api.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-config</artifactId> + <version>${odl.mdsal.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + <version>${odl.mdsal.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + <version>${odl.mdsal.version}</version> + </dependency> + + <!-- + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-test-model</artifactId> + <version>${odl.mdsal.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.netconf</groupId> + <artifactId>sal-rest-connector</artifactId> + <version>${odl.mdsal.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <version>${odl.mdsal.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <version>${odl.mdsal.version}}</version> + <type>test-jar</type> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${sdnctl.sli.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <version>${sdnctl.sli.version}</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- + <plugin> + <groupId>com.brocade.tools</groupId> + <artifactId>providermodule-plugin</artifactId> + <version>1.0.0-SNAPSHOT</version> + <configuration> + <packageId>org.onap.sdnc.northbound</packageId> + <appName>generic-resource-api</appName> + </configuration> + <executions> + <execution> + <phase>process-sources</phase> + <goals> + <goal>process</goal> + </goals> + </execution> + </executions> + </plugin> + --> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package>org.opendaylight.controller.config.yang.config.generic-resource-api_provider.impl</Export-Package> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <executions> + <execution> + <id>config</id> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <codeGenerators> + <generator> + <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass> + <outputBaseDir>${jmxGeneratorPath}</outputBaseDir> + <additionalConfiguration> + <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1> + </additionalConfiguration> + </generator> + <generator> + <codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>yang-jmx-generator-plugin</artifactId> + <version>${odl.yang.jmx.generator.version}</version> + </dependency> + </dependencies> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>attach-artifacts</id> + <goals> + <goal>attach-artifact</goal> + </goals> + <phase>package</phase> + <configuration> + <artifacts> + <artifact> + <file>${project.build.directory}/classes/initial/generic-resource-api-provider.xml</file> + <type>xml</type> + <classifier>config</classifier> + </artifact> + </artifacts> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java new file mode 100644 index 00000000..702e4b87 --- /dev/null +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java @@ -0,0 +1,2067 @@ +package org.onap.sdnc.northbound; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; +import java.util.TimeZone; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.NotificationProviderService; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.GENERICRESOURCEAPIService; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfs; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.SecurityZoneTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.Services; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutput; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.contrail.route.response.information.ContrailRouteResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadData; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadList; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListKey; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformation; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeader.SvcAction; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.security.zone.response.information.SecurityZoneResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceData; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.Service; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceKey; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus.RequestStatus; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatus.RpcAction; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Optional; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.SettableFuture; + + +/** + * Defines a base implementation for your provider. This class extends from a helper class + * which provides storage for the most commonly used components of the MD-SAL. Additionally the + * base class provides some basic logging and initialization / clean up methods. + * + * To use this, copy and paste (overwrite) the following method into the TestApplicationProviderModule + * class which is auto generated under src/main/java in this project + * (created only once during first compilation): + * + * <pre> + + @Override + public java.lang.AutoCloseable createInstance() { + + //final GENERIC-RESOURCE-APIProvider provider = new GENERIC-RESOURCE-APIProvider(); + final GenericResourceApiProvider provider = new GenericResourceApiProvider(); + provider.setDataBroker( getDataBrokerDependency() ); + provider.setNotificationService( getNotificationServiceDependency() ); + provider.setRpcRegistry( getRpcRegistryDependency() ); + provider.initialize(); + return new AutoCloseable() { + + @Override + public void close() throws Exception { + //TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE BROKER/NOTIFICATION + //SERVIE/RPC REGISTRY + provider.close(); + } + }; + } + + + </pre> + */ + +public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURCEAPIService{ + + private final Logger log = LoggerFactory.getLogger( GenericResourceApiProvider.class ); + private final String appName = "generic-resource-api"; + + private final ExecutorService executor; + + protected DataBroker dataBroker; + protected NotificationProviderService notificationService; + protected RpcProviderRegistry rpcRegistry; + protected BindingAwareBroker.RpcRegistration<GENERICRESOURCEAPIService> rpcRegistration; + + public GenericResourceApiProvider(DataBroker dataBroker2, + NotificationProviderService notificationProviderService, + RpcProviderRegistry rpcProviderRegistry) { + this.log.info( "Creating provider for " + appName ); + executor = Executors.newFixedThreadPool(1); + dataBroker = dataBroker2; + notificationService = notificationProviderService; + rpcRegistry = rpcProviderRegistry; + initialize(); + + } + + public void initialize(){ + log.info( "Initializing provider for " + appName ); + // Create the top level containers + createContainers(); + try { + GenericResourceApiUtil.loadProperties(); + } catch (Exception e) { + log.error("Caught Exception while trying to load properties file"); + } + rpcRegistration = rpcRegistry.addRpcImplementation(GENERICRESOURCEAPIService.class, this); + + log.info( "Initialization complete for " + appName ); + } + + + protected void initializeChild() { + //Override if you have custom initialization intelligence + } + + + @Override + public void close() throws Exception { + log.info( "Closing provider for " + appName ); + executor.shutdown(); + rpcRegistration.close(); + log.info( "Successfully closed provider for " + appName ); + } + + private static class Iso8601Util + { + private static TimeZone tz = TimeZone.getTimeZone("UTC"); + private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); + + static { df.setTimeZone(tz); } + + private static String now() { + return df.format(new Date()); + } + } + + + public void setDataBroker(DataBroker dataBroker) { + this.dataBroker = dataBroker; + if( log.isDebugEnabled() ){ + log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." ); + } + } + + public void setNotificationService( + NotificationProviderService notificationService) { + this.notificationService = notificationService; + if( log.isDebugEnabled() ){ + log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." ); + } + } + + public void setRpcRegistry(RpcProviderRegistry rpcRegistry) { + this.rpcRegistry = rpcRegistry; + if( log.isDebugEnabled() ){ + log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." ); + } + } + + private void createContainers() { + + final WriteTransaction t = dataBroker.newReadWriteTransaction(); + + // Create the service-instance container + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Services.class), + new ServicesBuilder().build()); + t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Services.class), + new ServicesBuilder().build()); + + // Create the PreloadVnfs container + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfs.class), + new PreloadVnfsBuilder().build()); + t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfs.class), + new PreloadVnfsBuilder().build()); + + try { + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); + checkedFuture.get(); + log.info("Create Containers succeeded!: "); + + } catch (InterruptedException | ExecutionException e) { + log.error("Create Containers Failed: " + e); + e.printStackTrace(); + } + } + + private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, String errorCode, String errorMessage, String ackFinal) + { + serviceStatusBuilder.setResponseCode(errorCode); + serviceStatusBuilder.setResponseMessage(errorMessage); + serviceStatusBuilder.setFinalIndicator(ackFinal); + serviceStatusBuilder.setResponseTimestamp(Iso8601Util.now()); + } + + private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, RequestInformation requestInformation) + { + if (requestInformation != null && requestInformation.getRequestAction() != null) { + serviceStatusBuilder.setAction(requestInformation.getRequestAction().toString()); + } + + /* + if (requestInformation != null && requestInformation.getRequestSubAction() != null) { + switch (requestInformation.getRequestSubAction()) + { + case SUPP: + serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.SUPP); + break; + case CANCEL: + serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.CANCEL); + break; + default: + log.error("Unknown RequestSubAction: " + requestInformation.getRequestSubAction() ); + break; + }; + } + */ + } + + private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, SdncRequestHeader requestHeader) + { + if (requestHeader != null && requestHeader.getSvcAction() != null) { + switch (requestHeader.getSvcAction()) + { + case Assign: + serviceStatusBuilder.setRpcAction(RpcAction.Assign); + break; + case Unassign: + serviceStatusBuilder.setRpcAction(RpcAction.Unassign); + break; + case Activate: + serviceStatusBuilder.setRpcAction(RpcAction.Activate); + break; + case Deactivate: + serviceStatusBuilder.setRpcAction(RpcAction.Deactivate); + break; + case Delete: + serviceStatusBuilder.setRpcAction(RpcAction.Delete); + break; + default: + log.error("Unknown SvcAction: " + requestHeader.getSvcAction() ); + break; + }; + } + } + + private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder) + { + // default to config + getServiceData(siid,serviceDataBuilder,LogicalDatastoreType.CONFIGURATION); + } + + + private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder, LogicalDatastoreType type) + { + // See if any data exists yet for this siid, if so grab it. + InstanceIdentifier serviceInstanceIdentifier = + InstanceIdentifier.<Services>builder(Services.class) + .child(Service.class, new ServiceKey(siid)).toInstance(); + ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); + Optional<Service> data = null; + try { + data = (Optional<Service>) readTx.read(type, serviceInstanceIdentifier).get(); + } catch (InterruptedException | ExecutionException e) { + log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e); + } + + if (data.isPresent()) { + ServiceData serviceData = (ServiceData) data.get().getServiceData(); + if (serviceData != null) { + log.info("Read MD-SAL ("+type+") data for ["+siid+"] ServiceData: " + serviceData); + serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader()); + serviceDataBuilder.setRequestInformation(serviceData.getRequestInformation()); + serviceDataBuilder.setServiceInformation(serviceData.getServiceInformation()); + serviceDataBuilder.setServiceRequestInput(serviceData.getServiceRequestInput()); + serviceDataBuilder.setServiceTopology(serviceData.getServiceTopology()); + serviceDataBuilder.setServiceLevelOperStatus(serviceData.getServiceLevelOperStatus()); + serviceDataBuilder.setNetworks(serviceData.getNetworks()); + serviceDataBuilder.setVnfs(serviceData.getVnfs()); + serviceDataBuilder.setProvidedAllottedResources(serviceData.getProvidedAllottedResources()); + serviceDataBuilder.setConsumedAllottedResources(serviceData.getConsumedAllottedResources()); + // service-instance-id needs to be set + } else { + log.info("No service-data found in MD-SAL ("+type+") for ["+siid+"] "); + } + } else { + log.info("No data found in MD-SAL ("+type+") for ["+siid+"] "); + } + } + + private void getPreloadData(String vnf_name, String vnf_type, PreloadDataBuilder preloadDataBuilder) + { + // default to config + getPreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION); + } + + private void getPreloadData(String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type) + { + // See if any data exists yet for this name/type, if so grab it. + InstanceIdentifier preloadInstanceIdentifier = + InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class) + .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).toInstance(); + ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); + Optional<VnfPreloadList> data = null; + try { + data = (Optional<VnfPreloadList>) readTx.read(type, preloadInstanceIdentifier).get(); + } catch (InterruptedException | ExecutionException e) { + log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e); + } + + if ( data.isPresent()) { + PreloadData preloadData = (PreloadData) data.get().getPreloadData(); + if (preloadData != null) { + log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] PreloadData: " + preloadData); + preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation()); + preloadDataBuilder.setNetworkTopologyInformation(preloadData.getNetworkTopologyInformation()); + preloadDataBuilder.setOperStatus(preloadData.getOperStatus()); + } else { + log.info("No preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] "); + } + } else { + log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] "); + } + } + + private void SaveService (final Service entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException { + // Each entry will be identifiable by a unique key, we have to create that identifier + InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceBuilder = + InstanceIdentifier.<Services>builder(Services.class) + .child(Service.class, entry.getKey()); + InstanceIdentifier<Service> path = serviceBuilder.toInstance(); + + int tries = 2; + while(true) { + try { + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + if (merge) { + tx.merge(storeType, path, entry); + } else { + tx.put(storeType, path, entry); + } + tx.submit().checkedGet(); + log.debug("Update DataStore succeeded"); + break; + } catch (final TransactionCommitFailedException e) { + if(e instanceof OptimisticLockFailedException) { + if(--tries <= 0) { + log.debug("Got OptimisticLockFailedException on last try - failing "); + throw new IllegalStateException(e); + } + log.debug("Got OptimisticLockFailedException - trying again "); + } else { + log.debug("Update DataStore failed"); + throw new IllegalStateException(e); + } + } + } + } + + private void DeleteService(final Service entry, LogicalDatastoreType storeType) throws IllegalStateException { + // Each entry will be identifiable by a unique key, we have to create + // that identifier + InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceListIdBuilder = InstanceIdentifier.<Services> builder(Services.class).child(Service.class, entry.getKey()); + InstanceIdentifier<Service> path = serviceListIdBuilder.toInstance(); + + int tries = 2; + while (true) { + try { + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + tx.delete(storeType, path); + tx.submit().checkedGet(); + log.debug("DataStore delete succeeded"); + break; + } catch (final TransactionCommitFailedException e) { + if (e instanceof OptimisticLockFailedException) { + if (--tries <= 0) { + log.debug("Got OptimisticLockFailedException on last try - failing "); + throw new IllegalStateException(e); + } + log.debug("Got OptimisticLockFailedException - trying again "); + } else { + log.debug("Update DataStore failed"); + throw new IllegalStateException(e); + } + } + } + } + + private void SavePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{ + + // Each entry will be identifiable by a unique key, we have to create that identifier + InstanceIdentifier.InstanceIdentifierBuilder<VnfPreloadList> vnfPreloadListBuilder = + InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class) + .child(VnfPreloadList.class, entry.getKey()); + InstanceIdentifier<VnfPreloadList> path = vnfPreloadListBuilder.toInstance(); + int tries = 2; + while(true) { + try { + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + if (merge) { + tx.merge(storeType, path, entry); + } else { + tx.put(storeType, path, entry); + } + tx.submit().checkedGet(); + log.debug("Update DataStore succeeded"); + break; + } catch (final TransactionCommitFailedException e) { + if(e instanceof OptimisticLockFailedException) { + if(--tries <= 0) { + log.debug("Got OptimisticLockFailedException on last try - failing "); + throw new IllegalStateException(e); + } + log.debug("Got OptimisticLockFailedException - trying again "); + } else { + log.debug("Update DataStore failed"); + throw new IllegalStateException(e); + } + } + } + } + + @Override + public Future<RpcResult<ServiceTopologyOperationOutput>> serviceTopologyOperation( + ServiceTopologyOperationInput input) { + + final String SVC_OPERATION = "service-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + ServiceTopologyOperationOutputBuilder responseBuilder = new ServiceTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<ServiceTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Grab the service instance ID from the input buffer + String siid = input.getServiceInformation().getServiceInstanceId(); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + ServiceDataBuilder operDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL ); + + // Set the serviceStatus based on input + setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader()); + setServiceStatus(serviceStatusBuilder, input.getRequestInformation()); + + /* + // setup a service-data object builder + // ACTION service-topology-operation + // INPUT: + // USES uses service-operation-information + // OUTPUT: + // uses topology-response-common; + // uses service-response-information; + */ + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + ServiceTopologyOperationInputBuilder inputBuilder = new ServiceTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String serviceObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + serviceObjectPath = respProps.getProperty("service-object-path"); + } + + setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal); + serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete); + //serviceStatusBuilder.setRpcName(RpcName.ServiceTopologyOperation); + serviceStatusBuilder.setRpcName(SVC_OPERATION); + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + try { + SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + } + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<ServiceTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on delete + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete)) + { + log.info("Delete from both CONFIGURATION and OPERATIONAL tree."); + DeleteService(serviceBuilder.build(), LogicalDatastoreType.OPERATIONAL); + DeleteService(serviceBuilder.build(), LogicalDatastoreType.CONFIGURATION); + } + } + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<ServiceTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<ServiceTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ServiceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<VnfTopologyOperationOutput>> vnfTopologyOperation( + VnfTopologyOperationInput input) { + + final String SVC_OPERATION = "vnf-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<VnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + // Grab the service instance ID from the input buffer + String siid = input.getServiceInformation().getServiceInstanceId(); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + if(input.getVnfInformation() == null || + input.getVnfInformation().getVnfId() == null || + input.getVnfInformation().getVnfId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty vnf-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<VnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + /* Mobility wont use vipr intf in 1707 + + String preload_name = null; + String preload_type = null; + if (input.getVnfRequestInput() != null && + input.getVnfRequestInput().getVnfName() != null && input.getVnfRequestInput().getVnfName().length() != 0) { + preload_name = input.getVnfRequestInput().getVnfName(); + } + if (input.getVnfInformation().getVnfType() != null && + input.getVnfInformation().getVnfType().length() != 0) { + preload_type = input.getVnfInformation().getVnfType(); + } + + PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); + if (preload_name != null && preload_type != null) { + getPreloadData(preload_name, preload_type, preloadDataBuilder); + } + else { + log.info("vnf-name and vnf-type not present in the request"); + } + */ + + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + ServiceDataBuilder operDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL ); + + // Set the serviceStatus based on input + setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader()); + setServiceStatus(serviceStatusBuilder, input.getRequestInformation()); + + // + // setup a service-data object builder + // ACTION vnf-topology-operation + // INPUT: + // USES sdnc-request-header; + // USES request-information; + // USES service-information; + // USES vnf-request-information + // OUTPUT: + // USES vnf-topology-response-body; + // USES vnf-information + // USES service-information + // + // container service-data + // uses vnf-configuration-information; + // uses oper-status; + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); + + /* + log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " + preloadDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "preload-data", preloadDataBuilder); + */ + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String serviceObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + serviceObjectPath = respProps.getProperty("vnf-object-path"); + } + + setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal); + serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete); + //serviceStatusBuilder.setRpcName(RpcName.VnfTopologyOperation); + serviceStatusBuilder.setRpcName(SVC_OPERATION); + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + try { + SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on activate or delete + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) || + input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + } + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<VnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on Assign + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<VnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<VnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return success + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<VfModuleTopologyOperationOutput>> vfModuleTopologyOperation( + VfModuleTopologyOperationInput input) { + + final String SVC_OPERATION = "vf-module-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + if(input.getVnfInformation() == null || + input.getVnfInformation().getVnfId() == null || + input.getVnfInformation().getVnfId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty vnf-id"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("invalid input, null or empty vnf-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + if(input.getVfModuleInformation() == null || + input.getVfModuleInformation().getVfModuleId() == null || + input.getVfModuleInformation().getVfModuleId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty vf-module-id"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("invalid input, vf-module-id is null or empty"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Grab the service instance ID from the input buffer + String siid = input.getServiceInformation().getServiceInstanceId(); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + /* + String preload_name = null; + String preload_type = null; + + preload_name = input.getVfModuleRequestInput().getVfModuleName(); + + if(input.getVfModuleInformation().getVfModuleType() != null && + input.getVfModuleInformation().getVfModuleType().length() != 0) { + preload_type = input.getVfModuleInformation().getVfModuleType(); + } + + PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); + if (preload_name != null && preload_type != null) { + getPreloadData(preload_name, preload_type, preloadDataBuilder); + } + else { + log.debug("vf-module-name and vf-module-type not present in the request."); + } + */ + + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + ServiceDataBuilder operDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL ); + + // Set the serviceStatus based on input + setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader()); + setServiceStatus(serviceStatusBuilder, input.getRequestInformation()); + + // + // setup a service-data object builder + // ACTION vnf-topology-operation + // INPUT: + // USES sdnc-request-header; + // USES request-information; + // USES service-information; + // USES vnf-request-information + // OUTPUT: + // USES vnf-topology-response-body; + // USES vnf-information + // USES service-information + // + // container service-data + // uses vnf-configuration-information; + // uses oper-status; + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); + + /* + log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " +preloadDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "preload-data", preloadDataBuilder); + */ + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String serviceObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + serviceObjectPath = respProps.getProperty("vf-module-object-path"); + } + + setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal); + serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete); + serviceStatusBuilder.setRpcName(SVC_OPERATION); + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + try { + SaveService (serviceBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + } + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + //serviceBuilder.setServiceInstanceId(serviceData.getServiceTopology().getServiceTopologyIdentifier().getServiceInstanceId()); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on activate or delete + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) || + input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<VfModuleTopologyOperationOutput> rpcResult = + RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + // return success + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation( + NetworkTopologyOperationInput input) { + + final String SVC_OPERATION = "network-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<NetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + String siid = input.getServiceInformation().getServiceInstanceId(); + + // Get the service-instance service data from MD-SAL + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + ServiceData sd = serviceDataBuilder.build(); + if (sd == null || sd.getServiceLevelOperStatus() == null) + { + log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<NetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + + /* + //String preload_name = null; + //String preload_type = null; + // If both network-name and network-type are present in request, get the preload network from MD-SAL + if (input.getNetworkRequestInput() != null && + input.getNetworkRequestInput().getNetworkName() != null && + input.getNetworkRequestInput().getNetworkName().length() != 0) { + preload_name = input.getNetworkRequestInput().getNetworkName(); + } + if (input.getNetworkInformation() != null && + input.getNetworkInformation().getNetworkType() != null && + input.getNetworkInformation().getNetworkType().length() != 0) { + preload_type = input.getNetworkInformation().getNetworkType(); + } + + PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); + if (preload_name != null && preload_type != null) { + getPreloadData(preload_name, preload_type, preloadDataBuilder); + } + else { + log.debug("network-name and network-type not present in request"); + } + */ + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String networkId = "error"; + String serviceObjectPath = null; + String networkObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + networkId = respProps.getProperty("networkId"); + serviceObjectPath = respProps.getProperty("service-object-path"); + networkObjectPath = respProps.getProperty("network-object-path"); + } + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<NetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on Activate + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + NetworkResponseInformationBuilder networkResponseInformationBuilder = new NetworkResponseInformationBuilder(); + networkResponseInformationBuilder.setInstanceId(networkId); + networkResponseInformationBuilder.setObjectPath(networkObjectPath); + responseBuilder.setNetworkResponseInformation(networkResponseInformationBuilder.build()); + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (IllegalStateException e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<NetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<NetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<ContrailRouteTopologyOperationOutput>> contrailRouteTopologyOperation( + ContrailRouteTopologyOperationInput input) { + + final String SVC_OPERATION = "contrail-route-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + ContrailRouteTopologyOperationOutputBuilder responseBuilder = new ContrailRouteTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + String siid = input.getServiceInformation().getServiceInstanceId(); + + // Get the service-instance service data from MD-SAL + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + ServiceData sd = serviceDataBuilder.build(); + if (sd == null || sd.getServiceLevelOperStatus() == null) + { + log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + ContrailRouteTopologyOperationInputBuilder inputBuilder = new ContrailRouteTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String allottedResourceId = "error"; + String serviceObjectPath = null; + String contrailRouteObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + allottedResourceId = respProps.getProperty("allotted-resource-id"); + serviceObjectPath = respProps.getProperty("service-object-path"); + contrailRouteObjectPath = respProps.getProperty("contrail-route-object-path"); + } + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on activate or delete + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) || + input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + ContrailRouteResponseInformationBuilder contrailRouteResponseInformationBuilder = new ContrailRouteResponseInformationBuilder(); + contrailRouteResponseInformationBuilder.setInstanceId(allottedResourceId); + contrailRouteResponseInformationBuilder.setObjectPath(contrailRouteObjectPath); + responseBuilder.setContrailRouteResponseInformation(contrailRouteResponseInformationBuilder.build()); + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (IllegalStateException e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<ContrailRouteTopologyOperationOutput> rpcResult = + RpcResultBuilder.<ContrailRouteTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<SecurityZoneTopologyOperationOutput>> securityZoneTopologyOperation( + SecurityZoneTopologyOperationInput input) { + + final String SVC_OPERATION = "security-zone-topology-operation"; + ServiceData serviceData = null; + ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + SecurityZoneTopologyOperationOutputBuilder responseBuilder = new SecurityZoneTopologyOperationOutputBuilder(); + + if(input == null || + input.getServiceInformation() == null || + input.getServiceInformation().getServiceInstanceId() == null || + input.getServiceInformation().getServiceInstanceId().length() == 0) + { + log.debug("exiting " +SVC_OPERATION+ " because of null or empty service-instance-id"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = + RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + String siid = input.getServiceInformation().getServiceInstanceId(); + + // Get the service-instance service data from MD-SAL + ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); + getServiceData(siid,serviceDataBuilder); + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + ServiceData sd = serviceDataBuilder.build(); + if (sd == null || sd.getServiceLevelOperStatus() == null) + { + log.debug("exiting " +SVC_OPERATION+ " because the service-instance does not have any service data in SDNC"); + responseBuilder.setResponseCode("404"); + responseBuilder.setResponseMessage("invalid input: the service-instance does not have any service data in SDNC"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = + RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input); + SecurityZoneTopologyOperationInputBuilder inputBuilder = new SecurityZoneTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + String allottedResourceId = "error"; + String serviceObjectPath = null; + String securityZoneObjectPath = null; + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + allottedResourceId = respProps.getProperty("allotted-resource-id"); + serviceObjectPath = respProps.getProperty("service-object-path"); + securityZoneObjectPath = respProps.getProperty("security-zone-object-path"); + } + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = + RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + + serviceData = serviceDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData); + + // service object + ServiceBuilder serviceBuilder = new ServiceBuilder(); + serviceBuilder.setServiceData(serviceData); + serviceBuilder.setServiceInstanceId(siid); + serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); + SaveService (serviceBuilder.build(), false,LogicalDatastoreType.CONFIGURATION); + + if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) + { + // Only update operational tree on activate or delete + if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) || + input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) + { + log.info("Updating OPERATIONAL tree."); + SaveService (serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } + } + + SecurityZoneResponseInformationBuilder securityZoneResponseInformationBuilder = new SecurityZoneResponseInformationBuilder(); + securityZoneResponseInformationBuilder.setInstanceId(allottedResourceId); + securityZoneResponseInformationBuilder.setObjectPath(securityZoneObjectPath); + responseBuilder.setSecurityZoneResponseInformation(securityZoneResponseInformationBuilder.build()); + + ServiceResponseInformationBuilder serviceResponseInformationBuilder = new ServiceResponseInformationBuilder(); + serviceResponseInformationBuilder.setInstanceId(siid); + serviceResponseInformationBuilder.setObjectPath(serviceObjectPath); + responseBuilder.setServiceResponseInformation(serviceResponseInformationBuilder.build()); + + } catch (IllegalStateException e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = + RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build()); + + RpcResult<SecurityZoneTopologyOperationOutput> rpcResult = + RpcResultBuilder.<SecurityZoneTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + @Override + public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation( + PreloadVnfTopologyOperationInput input) { + + final String SVC_OPERATION = "preload-vnf-topology-operation"; + PreloadData preloadData = null; + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder(); + + // Result from savePreloadData + final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create(); + + if(input == null || input.getVnfTopologyInformation() == null || + input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null) { + log.debug("exiting " +SVC_OPERATION+ " because of null input"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("invalid input: input is null"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Grab the name and type from the input buffer + String preload_name = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName(); + String preload_type = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType(); + + // Make sure we have a preload_name and preload_type + if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) { + log.debug("exiting "+ SVC_OPERATION + " vnf-name or vnf-type is null or empty"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("invalid input: vnf-name or vnf-type is null or empty"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); + getPreloadData(preload_name, preload_type, preloadDataBuilder); + + PreloadDataBuilder operDataBuilder = new PreloadDataBuilder(); + getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL ); + + // setup a preload-data object builder + // ACTION preload-vnf-topology-operation + // INPUT: + // USES sdnc-request-header; + // USES request-information; + // uses vnf-topology-information; + // OUTPUT: + // USES vnf-topology-response-body; + // + // container preload-data + // uses vnf-topology-information; + // uses network-topology-information; + // uses oper-status; + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input); + PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", preloadDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName + ": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + // internalError = respProps.getProperty("internal-error", "false"); + } + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); + preloadVnfListBuilder.setVnfName(preload_name); + preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); + try { + SavePreloadList (preloadVnfListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + } + log.debug("Sending Success rpc result due to external error"); + RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + preloadData = preloadDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData); + // svc-configuration-list + VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); + preloadVnfListBuilder.setVnfName(preload_name); + preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setPreloadData(preloadData); + + // merge flag sets to false to allow it to be overwritten (not appended) + SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); + log.info("Updating OPERATIONAL tree."); + SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + + RpcResult<PreloadVnfTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + + @Override + public Future<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation( + PreloadNetworkTopologyOperationInput input) { + + final String SVC_OPERATION = "preload-network-topology-operation"; + PreloadData preloadData = null; + Properties parms = new Properties(); + + log.info( SVC_OPERATION +" called." ); + // create a new response object + PreloadNetworkTopologyOperationOutputBuilder responseBuilder = new PreloadNetworkTopologyOperationOutputBuilder(); + + // Result from savePreloadData + final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create(); + + if(input == null || input.getNetworkTopologyInformation() == null || + input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null) { + + log.debug("exiting " +SVC_OPERATION+ " because of null input"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("input is null"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Grab the name and type from the input buffer + String preload_name = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName(); + String preload_type = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType(); + + // Make sure we have a preload_name and preload_type + if(preload_name == null || preload_name.length() == 0 || preload_type == null || preload_type.length() == 0 ) { + log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name"); + responseBuilder.setResponseCode("403"); + responseBuilder.setResponseMessage("input, invalid preload-name"); + responseBuilder.setAckFinalIndicator("Y"); + RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + if (input.getSdncRequestHeader() != null) { + responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId()); + } + + PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder(); + getPreloadData(preload_name, preload_type, preloadDataBuilder); + + PreloadDataBuilder operDataBuilder = new PreloadDataBuilder(); + getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL ); + + // + // setup a preload-data object builder + // ACTION preload-network-topology-operation + // INPUT: + // USES sdnc-request-header; + // USES request-information; + // uses network-topology-information; + // OUTPUT: + // USES vnf-topology-response-body; + // + // container preload-data + // uses vnf-topology-information; + // uses network-topology-information; + // uses oper-status; + + + log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input); + PreloadNetworkTopologyOperationInputBuilder inputBuilder = new PreloadNetworkTopologyOperationInputBuilder(input); + GenericResourceApiUtil.toProperties(parms, inputBuilder.build()); + log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build()); + GenericResourceApiUtil.toProperties(parms, "operational-data", operDataBuilder); + + // Call SLI sync method + // Get SvcLogicService reference + + GenericResourceApiSvcLogicServiceClient svcLogicClient = new GenericResourceApiSvcLogicServiceClient(); + Properties respProps = null; + + String errorCode = "200"; + String errorMessage = null; + String ackFinal = "Y"; + + + try + { + if (svcLogicClient.hasGraph(appName, SVC_OPERATION , null, "sync")) + { + + try + { + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", preloadDataBuilder, parms); + } + catch (Exception e) + { + log.error("Caught exception executing service logic for "+ SVC_OPERATION, e); + errorMessage = e.getMessage(); + errorCode = "500"; + } + } else { + errorMessage = "No service logic active for "+ appName +": '" + SVC_OPERATION + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + log.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message"); + ackFinal = respProps.getProperty("ack-final", "Y"); + // internalError = respProps.getProperty("internal-error", "false"); + } + + if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) { + + responseBuilder.setResponseCode(errorCode); + responseBuilder.setResponseMessage(errorMessage); + responseBuilder.setAckFinalIndicator(ackFinal); + + VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); + preloadVnfListBuilder.setVnfName(preload_name); + preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build()); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'"); + try { + SavePreloadList (preloadVnfListBuilder.build(),true,LogicalDatastoreType.CONFIGURATION); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + + } + log.debug("Sending Success rpc result due to external error"); + RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Got success from SLI + try { + preloadData = preloadDataBuilder.build(); + log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData); + // svc-configuration-list + VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder(); + preloadVnfListBuilder.setVnfName(preload_name); + preloadVnfListBuilder.setVnfType(preload_type); + preloadVnfListBuilder.setPreloadData(preloadData); + + // merge flag sets to false to allow it to be overwritten (not appended) + SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); + log.info("Updating OPERATIONAL tree."); + SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); + } catch (Exception e) { + log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e); + responseBuilder.setResponseCode("500"); + responseBuilder.setResponseMessage(e.toString()); + responseBuilder.setAckFinalIndicator("Y"); + log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // Update succeeded + responseBuilder.setResponseCode(errorCode); + responseBuilder.setAckFinalIndicator(ackFinal); + if (errorMessage != null) + { + responseBuilder.setResponseMessage(errorMessage); + } + log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] "); + log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build()); + + RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult = + RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } +} diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java new file mode 100644 index 00000000..04b71e79 --- /dev/null +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java @@ -0,0 +1,144 @@ +package org.onap.sdnc.northbound; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder; +import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GenericResourceApiSvcLogicServiceClient { + + private static final Logger LOG = LoggerFactory + .getLogger(GenericResourceApiSvcLogicServiceClient.class); + + private SvcLogicService svcLogic = null; + + public GenericResourceApiSvcLogicServiceClient() + { + BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext(); + + // Get SvcLogicService reference + ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME); + if (sref != null) + { + svcLogic = (SvcLogicService) bctx.getService(sref); + + } + else + { + LOG.warn("Cannot find service reference for "+SvcLogicService.NAME); + + } + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return(svcLogic.hasGraph(module, rpc, version, mode)); + } + + public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + + public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder serviceData, Properties parms) + throws SvcLogicException { + + parms = GenericResourceApiUtil.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : parms.keySet()) { + String parmName = (String) key; + String parmValue = parms.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogic.execute(module, rpc, version, mode, parms); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + return (respProps); + } + + GenericResourceApiUtil.toBuilder(respProps, serviceData); + + return (respProps); + } + + + public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData, Properties parms) + throws SvcLogicException { + + parms = GenericResourceApiUtil.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : parms.keySet()) { + String parmName = (String) key; + String parmValue = parms.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogic.execute(module, rpc, version, mode, parms); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + return (respProps); + } + + GenericResourceApiUtil.toBuilder(respProps, serviceData); + + return (respProps); + } +} diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java new file mode 100644 index 00000000..56a2fae7 --- /dev/null +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java @@ -0,0 +1,280 @@ +package org.onap.sdnc.northbound; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GenericResourceApiUtil extends MdsalHelper { + + private static final Logger LOG = LoggerFactory.getLogger(GenericResourceApiUtil.class); + + public static final String PROPERTIES_FILE="/opt/bvc/controller/configuration/generic-resource-api.properties"; + private static Properties properties; + + + public static void loadProperties() { + + File file = new File(PROPERTIES_FILE); + properties = new Properties(); + InputStream input = null; + if (file.isFile() && file.canRead()) { + try { + input = new FileInputStream(file); + properties.load(input); + LOG.info("Loaded properties from " + PROPERTIES_FILE ); + setProperties(properties); + } catch (Exception e) { + LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e); + } finally { + if (input != null) { + try { + input.close(); + } catch (IOException e) { + LOG.error("Failed to close properties file " + PROPERTIES_FILE +"\n",e); + } + } + } + } + } + + static { + + // Trick class loader into loading builders. Some of + // these will be needed later by Reflection classes, but need + // to explicitly "new" them here to get class loader to load them. + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder u1 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ecomp.model.information.EcompModelInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder u2 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.assignments.NetworkAssignmentsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder u3 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.information.NetworkInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.level.oper.status.NetworkLevelOperStatusBuilder u4 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.level.oper.status.NetworkLevelOperStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.NetworkParametersBuilder u5 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.NetworkParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.network.parameters.NetworkParameterBuilder u6 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.parameters.network.parameters.NetworkParameterBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.policy.NetworkPolicyBuilder u7 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.policy.NetworkPolicyBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.NetworkRequestInputBuilder u8 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.NetworkRequestInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.network.request.input.NetworkInputParametersBuilder u9 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.request.input.network.request.input.NetworkInputParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder u10 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.response.information.NetworkResponseInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.NetworkTopologyIdentifierBuilder u11 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.NetworkTopologyIdentifierBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.structure.NetworkTopologyIdentifierStructureBuilder u12 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.identifier.structure.NetworkTopologyIdentifierStructureBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.information.NetworkTopologyInformationBuilder u13 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.information.NetworkTopologyInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.NetworkTopologyBuilder u14 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.network.topology.NetworkTopologyBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder u15 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder u16 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.NetworkTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.oper.status.OperStatusBuilder u17 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.oper.status.OperStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamBuilder u18 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.param.ParamBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder u19 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.data.PreloadDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder u20 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.preload.model.information.VnfPreloadListBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder u21 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder u22 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadNetworkTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder u23 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder u24 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder u25 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.PreloadVnfTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder u26 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.request.information.RequestInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.route.table.reference.RouteTableReferenceBuilder u27 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.route.table.reference.RouteTableReferenceBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder u28 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sdnc.request.header.SdncRequestHeaderBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.assignments.ServiceAssignmentsBuilder u29 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.assignments.ServiceAssignmentsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder u30 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.ServiceDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.NetworksBuilder u31 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.NetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.NetworkBuilder u32 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.NetworkBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.network.NetworkDataBuilder u33 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.networks.network.NetworkDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.VnfsBuilder u34 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.VnfsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.VnfBuilder u35 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.VnfBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.VnfDataBuilder u36 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.VnfDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.VfModulesBuilder u37 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.VfModulesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.VfModuleBuilder u38 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.VfModuleBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.vf.module.VfModuleDataBuilder u39 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.data.service.data.vnfs.vnf.vnf.data.vf.modules.vf.module.VfModuleDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder u40 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.information.ServiceInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.level.oper.status.ServiceLevelOperStatusBuilder u41 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.level.oper.status.ServiceLevelOperStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder u42 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.model.infrastructure.ServiceBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.ServiceParametersBuilder u43 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.ServiceParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.service.parameters.ServiceParameterBuilder u44 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.parameters.service.parameters.ServiceParameterBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.ServiceRequestInputBuilder u45 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.ServiceRequestInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.service.request.input.ServiceInputParametersBuilder u46 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.request.input.service.request.input.ServiceInputParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder u47 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.response.information.ServiceResponseInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder u48 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServicesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder u49 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.status.ServiceStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.identifier.ServiceTopologyIdentifierBuilder u50 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.identifier.ServiceTopologyIdentifierBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder u51 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder u52 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ServiceTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.ServiceTopologyBuilder u53 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.service.topology.ServiceTopologyBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sriov.vlan.filter.list.SriovVlanFilterListBuilder u54 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.sriov.vlan.filter.list.SriovVlanFilterListBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.subnets.SubnetsBuilder u55 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.subnets.SubnetsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.VfModuleAssignmentsBuilder u56 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.VfModuleAssignmentsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.VmsBuilder u57 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.VmsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.vms.VmBuilder u58 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf.module.assignments.vms.VmBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder u59 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.information.VfModuleInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.level.oper.status.VfModuleLevelOperStatusBuilder u60 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.level.oper.status.VfModuleLevelOperStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.VfModuleRequestInputBuilder u61 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.VfModuleRequestInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.vf.module.request.input.VfModuleInputParametersBuilder u62 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.request.input.vf.module.request.input.VfModuleInputParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder u63 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.response.information.VfModuleResponseInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.identifier.VfModuleTopologyIdentifierBuilder u64 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.identifier.VfModuleTopologyIdentifierBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder u65 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder u66 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VfModuleTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.VfModuleTopologyBuilder u67 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.VfModuleTopologyBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.vf.module.topology.VfModuleParametersBuilder u68 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.topology.vf.module.topology.VfModuleParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.FloatingIpsBuilder u69 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.FloatingIpsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.InterfaceRoutePrefixesBuilder u70 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.InterfaceRoutePrefixesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.MacAddressesBuilder u71 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.MacAddressesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.NetworkInformationItemsBuilder u72 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.NetworkInformationItemsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.NetworkInformationItemBuilder u73 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.NetworkInformationItemBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.network.information.item.NetworkIpsBuilder u74 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.network.information.items.network.information.item.NetworkIpsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.ApplicationTagsBuilder u75 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.ApplicationTagsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.CTagsBuilder u76 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.CTagsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.STagsBuilder u77 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.application.tags.STagsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.SriovParametersBuilder u78 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.SriovParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.HeatVlanFiltersBuilder u79 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.data.sriov.parameters.HeatVlanFiltersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.InterfaceRoutePrefixesBuilder u80 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.InterfaceRoutePrefixesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsBuilder u81 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsV6Builder u82 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkIpsV6Builder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkMacsBuilder u83 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.network.NetworkMacsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNamesBuilder u84 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNamesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNetworksBuilder u85 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.VmNetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.vm.networks.VmNetworkBuilder u86 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.data.vm.networks.VmNetworkBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.VnfVmsBuilder u87 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.VnfVmsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNamesBuilder u88 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNamesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNetworksBuilder u89 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vm.topology.vnf.vms.VmNetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder u90 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.VnfAssignmentsBuilder u91 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.VnfAssignmentsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.VnfNetworksBuilder u92 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.assignments.vnf.assignments.VnfNetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder u93 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.information.VnfInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.level.oper.status.VnfLevelOperStatusBuilder u94 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.level.oper.status.VnfLevelOperStatusBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.SubnetsDataBuilder u95 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.SubnetsDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.subnets.data.SubnetDataBuilder u96 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.network.data.subnets.data.SubnetDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.parameters.VnfParametersBuilder u97 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.parameters.VnfParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.VnfRequestInputBuilder u98 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.VnfRequestInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfInputParametersBuilder u99 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfInputParametersBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfNetworksBuilder u100 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.VnfNetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.vnf.networks.VnfNetworkBuilder u101 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.request.input.vnf.request.input.vnf.networks.VnfNetworkBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.AvailabilityZonesBuilder u102 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.AvailabilityZonesBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.VnfResourceAssignmentsBuilder u103 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.VnfResourceAssignmentsBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.VnfNetworksBuilder u104 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.VnfNetworksBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.vnf.networks.VnfNetworkBuilder u105 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.resource.assignments.vnf.resource.assignments.vnf.networks.VnfNetworkBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder u106 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.response.information.VnfResponseInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.structure.VnfTopologyIdentifierStructureBuilder u107 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.structure.VnfTopologyIdentifierStructureBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.VnfTopologyIdentifierBuilder u108 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.identifier.VnfTopologyIdentifierBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.information.VnfTopologyInformationBuilder u109 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.information.VnfTopologyInformationBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder u110 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationInputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder u111 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.VnfTopologyOperationOutputBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.VnfTopologyBuilder u112 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.VnfTopologyBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.vnf.topology.VnfParametersDataBuilder u113 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vnf.topology.vnf.topology.VnfParametersDataBuilder(); + org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vpn.bindings.VpnBindingsBuilder u114 = + new org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vpn.bindings.VpnBindingsBuilder(); + } +} diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java new file mode 100644 index 00000000..ff2775d0 --- /dev/null +++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModule.java @@ -0,0 +1,35 @@ +package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523; + +import org.onap.sdnc.northbound.GenericResourceApiProvider; + +public class GENERICRESOURCEAPIProviderModule extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.AbstractGENERICRESOURCEAPIProviderModule { + public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { + super(identifier, dependencyResolver); + } + + public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.GENERICRESOURCEAPIProviderModule oldModule, java.lang.AutoCloseable oldInstance) { + super(identifier, dependencyResolver, oldModule, oldInstance); + } + + @Override + public void customValidation() { + // add custom validation form module attributes here. + } + + @Override + public java.lang.AutoCloseable createInstance() { + final GenericResourceApiProvider provider = new GenericResourceApiProvider(getDataBrokerDependency() + , getNotificationServiceDependency() + , getRpcRegistryDependency()); + + return new AutoCloseable() { + + @Override + public void close() throws Exception { + provider.close(); + } + }; + } + + +} diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java new file mode 100644 index 00000000..abad5350 --- /dev/null +++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev140523/GENERICRESOURCEAPIProviderModuleFactory.java @@ -0,0 +1,13 @@ +/* +* Generated file +* +* Generated from: yang module name: GENERIC-RESOURCE-API-provider-impl yang module local name: GENERIC-RESOURCE-API-provider-impl +* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator +* Generated at: Tue Sep 05 14:01:41 EDT 2017 +* +* Do not modify this file unless it is present under src/main directory +*/ +package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523; +public class GENERICRESOURCEAPIProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev140523.AbstractGENERICRESOURCEAPIProviderModuleFactory { + +} diff --git a/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml new file mode 100644 index 00000000..2ba353ca --- /dev/null +++ b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- vi: set et smarttab sw=4 tabstop=4: --> +<snapshot> + <configuration> + <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> + <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"> + <module> + + <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file + The prefix: inside type should match the prefix of the yang file. --> + <type xmlns:prefix="org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl"> + prefix:GENERIC-RESOURCE-API-provider-impl + </type> + <name>GENERIC-RESOURCE-API-provider-impl</name> + + <!-- The following sections contain bindings to services defined in the + *-provider-impl yang file. For example the rpc-registry is required + because we have a dependency (or augmentation) named "rpc-registry" + and which binds to the md-sa-binding-registry. If you remove those + dependencies from the yang file then you can remove them from here. --> + <rpc-registry> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type> + <name>binding-rpc-broker</name> + </rpc-registry> + + <data-broker> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type> + <name>binding-data-broker</name> + </data-broker> + + <notification-service> + <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding"> + binding:binding-notification-service + </type> + <name>binding-notification-broker</name> + </notification-service> + </module> + + </modules> + </data> + + </configuration> + + <!-- Required capabilities are basically a listing of all modules that need to be imported before + our service can be resolved. Capabilities for dependencies defined above are implied which is + why we do not have define a required capability for the data broker, for example. --> + <required-capabilities> + <capability>org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl?module=GENERIC-RESOURCE-API-provider-impl&revision=2014-05-23</capability> + </required-capabilities> + +</snapshot> diff --git a/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang new file mode 100644 index 00000000..f6f49ee1 --- /dev/null +++ b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang @@ -0,0 +1,61 @@ +module GENERIC-RESOURCE-API-provider-impl { + + yang-version 1; + namespace "org:onap:sdnc:northbound:GENERIC-RESOURCE-API:provider:impl"; + prefix "GENERIC-RESOURCE-API-provider-impl"; + + import config { prefix config; revision-date 2013-04-05; } + import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; } + + description + "This module contains the base YANG definitions for + GENERIC-RESOURCE-API-provider impl implementation."; + + revision "2014-05-23" { + description + "Initial revision."; + } + + // This is the definition of the service implementation as a module identity. + identity GENERIC-RESOURCE-API-provider-impl { + base config:module-type; + + // Specifies the prefix for generated java classes. + config:java-name-prefix GENERIC-RESOURCE-APIProvider; + } + + // Augments the 'configuration' choice node under modules/module. + // We consume the three main services, RPCs, DataStore, and Notifications + augment "/config:modules/config:module/config:configuration" { + case GENERIC-RESOURCE-API-provider-impl { + when "/config:modules/config:module/config:type = 'GENERIC-RESOURCE-API-provider-impl'"; + + container rpc-registry { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-rpc-registry; + } + } + } + + container notification-service { + uses config:service-ref { + refine type { + mandatory true; + config:required-identity mdsal:binding-notification-service; + } + } + } + + container data-broker { + uses config:service-ref { + refine type { + mandatory false; + config:required-identity mdsal:binding-async-data-broker; + } + } + } + } + } +} @@ -106,6 +106,7 @@ </build> <modules> + <module>generic-resource-api</module> <module>vnfapi</module> <module>vnftools</module> </modules> |