summaryrefslogtreecommitdiffstats
path: root/core/sliapi
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:48:20 -0800
committerJessica Wagantall <jwagantall@linuxfoundation.org>2020-12-01 11:48:20 -0800
commit32fb53c13342d5ad353c839b7ffd0ca85d14bd48 (patch)
treef1b92068cf7b79d29e96243899e12495abb4795a /core/sliapi
parent53eacd8519a535f96d8b4231e48925324f1086dd (diff)
Migrate sli-core files
Migrate sli-core repo files into new directory "core". Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'core/sliapi')
-rwxr-xr-xcore/sliapi/.gitignore38
-rwxr-xr-xcore/sliapi/README.txt35
-rwxr-xr-xcore/sliapi/installer/pom.xml164
-rw-r--r--core/sliapi/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--core/sliapi/installer/src/assembly/assemble_mvnrepo_zip.xml49
-rw-r--r--core/sliapi/installer/src/main/resources/scripts/install-feature.sh39
-rwxr-xr-xcore/sliapi/model/pom.xml24
-rw-r--r--core/sliapi/model/src/main/resources/sli-api.20161110.yaml254
-rw-r--r--core/sliapi/model/swagger/pom.xml222
-rw-r--r--core/sliapi/model/swagger/src/main/json/sliapi.json1
-rw-r--r--core/sliapi/model/swagger/src/main/yaml/sliapi.yaml378
-rwxr-xr-xcore/sliapi/model/yang/pom.xml27
-rw-r--r--core/sliapi/model/yang/src/main/resources/sli-api.20161110.json554
-rw-r--r--core/sliapi/model/yang/src/main/resources/sli-api.20161110.yaml254
-rwxr-xr-xcore/sliapi/model/yang/src/main/yang/sliapi.yang117
-rwxr-xr-xcore/sliapi/pom.xml28
-rwxr-xr-xcore/sliapi/provider/pom.xml112
-rw-r--r--core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelper.java40
-rw-r--r--core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java676
-rw-r--r--core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml28
-rw-r--r--core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml28
-rw-r--r--core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelperTest.java35
-rw-r--r--core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java209
-rw-r--r--core/sliapi/provider/src/test/resources/simplelogger.properties23
-rw-r--r--core/sliapi/provider/src/test/resources/sli_healthcheck.xml27
-rw-r--r--core/sliapi/provider/src/test/resources/svclogic.properties27
26 files changed, 3448 insertions, 0 deletions
diff --git a/core/sliapi/.gitignore b/core/sliapi/.gitignore
new file mode 100755
index 000000000..1558a77c4
--- /dev/null
+++ b/core/sliapi/.gitignore
@@ -0,0 +1,38 @@
+#####standard .git ignore entries#####
+
+## IDE Specific Files ##
+org.eclipse.core.resources.prefs
+.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
+
+## Derby files
+sdnctl
+derby.log
+
+## Folders which contain auto generated source code ##
+yang-gen-config
+yang-gen-sal
diff --git a/core/sliapi/README.txt b/core/sliapi/README.txt
new file mode 100755
index 000000000..f9f4a2ab5
--- /dev/null
+++ b/core/sliapi/README.txt
@@ -0,0 +1,35 @@
+======================
+Introduction
+======================
+You have generated an MD-SAL module using the Brocade Archetype.
+
+* You should be able to successfully run 'mvn clean install' on this project.
+* This will produce a .zip file under the karaf.extension directory which you can deploy using
+Brocade's extension deployment mechanism.
+
+======================
+Next Steps:
+======================
+* run a 'mvn clean install' if you haven't already. This will generate some code from the yang models.
+* Modify the model yang file under the model project.
+* Follow the comments in the generated provider class to wire your new provider into the generated
+code.
+* Modify the generated provider model to respond to and handle the yang model. Depending on what
+you added to your model you may need to inherit additional interfaces or make other changes to
+the provider model.
+
+======================
+Generated Bundles:
+======================
+* model
+ - Provides the yang model for your application. This is your primary northbound interface.
+* provider
+ - Provides a template implementation for a provider to respond to your yang model.
+* features
+ - Defines a karaf feature. If you add dependencies on third-party bundles then you will need to
+ modify the features.xml to list out the dependencies.
+* karaf.extension
+ - Bundles all of the jars and third party dependencies (minus ODL dependencies) into a single
+ .zip file with the necessary configuration files to work correctly with the Brocade extension
+ mechanism.
+
diff --git a/core/sliapi/installer/pom.xml b/core/sliapi/installer/pom.xml
new file mode 100755
index 000000000..1b3b24a45
--- /dev/null
+++ b/core/sliapi/installer/pom.xml
@@ -0,0 +1,164 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-installer</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
+
+ <properties>
+ <application.name>ccsdk-sliapi</application.name>
+ <features.boot>${application.name}</features.boot>
+ <features.repositories>mvn:org.onap.ccsdk.sli.core/${features.boot}/${project.version}/xml/features
+ </features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${application.name}</artifactId>
+ <version>${project.version}</version>
+ <type>xml</type>
+ <classifier>features</classifier>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sliapi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>true</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>
+ <includeArtifactIds>sliapi-model,sliapi-provider,sliapi-model-yang,ccsdk-sliapi,features-sliapi
+ </includeArtifactIds>
+ <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/core/sliapi/installer/src/assembly/assemble_installer_zip.xml b/core/sliapi/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..2d3c0606d
--- /dev/null
+++ b/core/sliapi/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : CCSDK
+ ================================================================================
+ 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>bin</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/core/sliapi/installer/src/assembly/assemble_mvnrepo_zip.xml b/core/sliapi/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..c4eb9aa25
--- /dev/null
+++ b/core/sliapi/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,49 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : CCSDK
+ ================================================================================
+ 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>repo</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>
+
+
+
+</assembly>
diff --git a/core/sliapi/installer/src/main/resources/scripts/install-feature.sh b/core/sliapi/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..74b95b5c8
--- /dev/null
+++ b/core/sliapi/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# ONAP : CCSDK
+# ================================================================================
+# 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}
+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} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} feature:install ${features.boot}
diff --git a/core/sliapi/model/pom.xml b/core/sliapi/model/pom.xml
new file mode 100755
index 000000000..f23ad8da7
--- /dev/null
+++ b/core/sliapi/model/pom.xml
@@ -0,0 +1,24 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-sli-core :: sliapi</name>
+
+ <modules>
+ <module>yang</module>
+ <module>swagger</module>
+ </modules>
+
+</project>
diff --git a/core/sliapi/model/src/main/resources/sli-api.20161110.yaml b/core/sliapi/model/src/main/resources/sli-api.20161110.yaml
new file mode 100644
index 000000000..3420c66b5
--- /dev/null
+++ b/core/sliapi/model/src/main/resources/sli-api.20161110.yaml
@@ -0,0 +1,254 @@
+---
+swagger: '2.0'
+info:
+ version: 1.0.0
+ title: "SLI API"
+basePath: '/restconf'
+schemes:
+ - http
+ - https
+paths:
+ '/restconf/config/SLI-API:test-results':
+ delete:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ description: Test results
+ operationId: delete-test-results
+ get:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: get-test-results
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: testResults
+ required: false
+ schema:
+ $ref: '#/definitions/test-results'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: post-test-results
+ put:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: testResults
+ required: false
+ schema:
+ $ref: '#/definitions/test-results'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: put-test-results
+
+ '/restconf/config/SLI-API:test-results/test-result/{test-identifier}':
+ delete:
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ responses:
+ '200':
+ description: No response was specified
+ operationId: delete-test-result
+ get:
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-result'
+ operationId: get-test-result
+ put:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ - in: body
+ name: testResult
+ required: false
+ schema:
+ $ref: '#/definitions/test-result'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-result'
+ operationId: PUT-test-result
+
+ '/restconf/operational/SLI-API:test-results':
+ get:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: GET-test-results
+ '/restconf/operations/SLI-API:execute-graph':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: executeGraphInput
+ required: false
+ schema:
+ $ref: '#/definitions/execute-graph-input'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ description: ' Method to add a new parameter.'
+ operationId: execute-graph
+ '/restconf/operations/SLI-API:healthcheck':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ operationId: healthcheck
+ '/restconf/operations/SLI-API:vlbcheck':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ operationId: vlbcheck
+
+definitions:
+ parameter-setting:
+ type: object
+ properties:
+ parameter-name:
+ type: string
+ int-value:
+ type: integer
+ string-value:
+ type: string
+ boolean-value:
+ type: boolean
+
+ response-fields:
+ type: object
+ properties:
+ response-code:
+ type: string
+ ack-final-indicator:
+ type: string
+ response-message:
+ type: string
+ context-memory-json:
+ type: string
+
+ test-results:
+ type: object
+ properties:
+ test-results:
+ type: array
+ items:
+ $ref: '#/definitions/test-result'
+
+ test-result:
+ type: object
+ properties:
+ test-identifier:
+ type: string
+ results:
+ type: array
+ items:
+ type: string
+
+ execute-graph-input:
+ properties:
+ 'input':
+ type: object
+ properties:
+ 'mode':
+ type: string
+ 'module-name':
+ type: string
+ 'rpc-name':
+ type: string
+ 'sli-parameter':
+ items:
+ $ref: '#/definitions/parameter-setting'
+ type: array
+ type: object
+
+
+
+
+
+
+ unique_empty_identifier: {}
+
diff --git a/core/sliapi/model/swagger/pom.xml b/core/sliapi/model/swagger/pom.xml
new file mode 100644
index 000000000..db9ddbc42
--- /dev/null
+++ b/core/sliapi/model/swagger/pom.xml
@@ -0,0 +1,222 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model-swagger</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
+ <description>Generates swagger model from yang model</description>
+ <url>http://wiki.onap.org</url>
+
+ <properties>
+ <api.name>sliapi</api.name>
+ <jackson.version>2.9.5</jackson.version>
+ </properties>
+
+ <dependencies>
+ <!-- This is where the yang comes from -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- End this is where the yang comes from -->
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>&gt;bintray-yang2swagger-yang2swagge</id>
+ <name>bintray</name>
+ <url>https://dl.bintray.com/yang2swagger/yang2swagger</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.10</version>
+ <configuration>
+ <outputDirectory>${project.build.directory}/dependency</outputDirectory>
+ <includes>**\/*.yang</includes>
+ <includeGroupIds>org.opendaylight.mdsal.model,org.opendaylight.mdsal.binding.model.ietf,org.onap.ccsdk.sli.core</includeGroupIds>
+ </configuration>
+ <executions>
+ <execution>
+ <id>unpack-shared-resources</id>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <phase>initialize</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <phase>initialize</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <tasks>
+ <!-- flatten out structure -->
+ <move todir="${project.build.directory}/dependency" failonerror="false">
+ <fileset dir="${project.build.directory}/dependency"/>
+ <mapper type="flatten"/>
+ </move>
+ <!-- move to yang folder -->
+ <copy todir="${project.build.directory}/yang" failonerror="false">
+ <fileset dir="${project.build.directory}/dependency" includes="**/*.yang"/>
+ <mapper type="flatten"/>
+ </copy>
+ </tasks>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>1.2.3</version>
+ <dependencies>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.module</groupId>
+ <artifactId>jackson-module-jaxb-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-base</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mrv.yangtools</groupId>
+ <artifactId>swagger-maven-plugin</artifactId>
+ <version>1.1.12</version>
+ </dependency>
+ <dependency>
+ <groupId>com.github.romix</groupId>
+ <artifactId>java-concurrent-hash-trie-map</artifactId>
+ <version>0.2.23</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>yang2swagger-json</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>com.mrv.yangtools.maven.gen.swagger.MavenSwaggerGenerator</codeGeneratorClass>
+ <outputBaseDir>${project.basedir}/src/main/json</outputBaseDir>
+ <resourceBaseDir>${project.build.directory}/yang</resourceBaseDir>
+ <additionalConfiguration>
+ <api-version>${project.version}</api-version>
+ <base-module>${api.name}</base-module>
+ <swagger-format>json</swagger-format>
+ <path-format>odl</path-format>
+ <use-namespaces>true</use-namespaces>
+ </additionalConfiguration>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>false</inspectDependencies>
+ <yangFilesRootDir>${project.build.directory}/yang</yangFilesRootDir>
+ </configuration>
+ </execution>
+ <execution>
+ <id>yang2swagger-yaml</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>com.mrv.yangtools.maven.gen.swagger.MavenSwaggerGenerator</codeGeneratorClass>
+ <outputBaseDir>${project.basedir}/src/main/yaml</outputBaseDir>
+ <resourceBaseDir>${project.build.directory}/yang</resourceBaseDir>
+ <additionalConfiguration>
+ <api-version>${project.version}</api-version>
+ <base-module>${api.name}</base-module>
+ <swagger-format>yaml</swagger-format>
+ <path-format>odl</path-format>
+ <use-namespaces>true</use-namespaces>
+ </additionalConfiguration>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>false</inspectDependencies>
+ <yangFilesRootDir>${project.build.directory}/yang</yangFilesRootDir>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.10</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>src/main/json/${api.name}.json</file>
+ <type>json</type>
+ </artifact>
+ <artifact>
+ <file>src/main/yaml/${api.name}.yaml</file>
+ <type>yaml</type>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/core/sliapi/model/swagger/src/main/json/sliapi.json b/core/sliapi/model/swagger/src/main/json/sliapi.json
new file mode 100644
index 000000000..b53663201
--- /dev/null
+++ b/core/sliapi/model/swagger/src/main/json/sliapi.json
@@ -0,0 +1 @@
+{"swagger":"2.0","info":{"description":"Defines API to service logic interpreter,This module contains a collection of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.,This module contains a collection of generally useful derived\nYANG data types for Internet addresses and related things.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.","version":"1.1.0-SNAPSHOT","title":"SLI-API,ietf-yang-types,ietf-inet-types API"},"consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"paths":{"/config/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/config/SLI-API:test-results/SLI-API:test-result/":{"post":{"description":"creates sli.api.testresults.TestResult","parameters":[{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}}},"/config/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/operational/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}}},"/operational/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}}},"/operations/SLI-API:execute-graph/":{"post":{"tags":["SLI-API"],"parameters":[{"in":"body","name":"sli.api.executegraph.Input.body-param","required":false,"schema":{"properties":{"input":{"originalRef":"#/definitions/sli.api.executegraph.Input","$ref":"#/definitions/sli.api.executegraph.Input"}}}}],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","schema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"},"responseSchema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"}},"201":{"description":"No response"}}}},"/operations/SLI-API:healthcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","schema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"},"responseSchema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"}},"201":{"description":"No response"}}}},"/operations/SLI-API:vlbcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","schema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"},"responseSchema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"}},"201":{"description":"No response"}}}}},"definitions":{"sli.api.ExecuteGraph":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.Healthcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.ModeEnumeration":{"type":"string","enum":["sync","async"]},"sli.api.ParameterSetting":{"type":"object","properties":{"string-value":{"type":"string"},"boolean-value":{"type":"boolean"},"parameter-name":{"type":"string","description":"Parameter name"},"int-value":{"type":"integer","format":"int32"}}},"sli.api.ResponseFields":{"type":"object","properties":{"response-code":{"type":"string"},"response-message":{"type":"string"},"context-memory-json":{"type":"string"},"ack-final-indicator":{"type":"string"}}},"sli.api.TestResults":{"type":"object","properties":{"test-result":{"type":"array","items":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"sli.api.Vlbcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.executegraph.Input":{"type":"object","properties":{"mode":{"originalRef":"#/definitions/sli.api.ModeEnumeration","$ref":"#/definitions/sli.api.ModeEnumeration"},"module-name":{"type":"string"},"sli-parameter":{"type":"array","items":{"originalRef":"#/definitions/sli.api.ParameterSetting","$ref":"#/definitions/sli.api.ParameterSetting"}},"rpc-name":{"type":"string"}}},"sli.api.testresults.TestResult":{"type":"object","properties":{"results":{"type":"array","items":{"type":"string"}},"test-identifier":{"type":"string"}}}}} \ No newline at end of file
diff --git a/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml b/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml
new file mode 100644
index 000000000..b1a63be5d
--- /dev/null
+++ b/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml
@@ -0,0 +1,378 @@
+---
+swagger: "2.0"
+info:
+ description: "Defines API to service logic interpreter,This module contains a collection\
+ \ of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust\
+ \ and the persons identified as\nauthors of the code. All rights reserved.\n\n\
+ Redistribution and use in source and binary forms, with or\nwithout modification,\
+ \ is permitted pursuant to, and subject\nto the license terms contained in, the\
+ \ Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\n\
+ Relating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version\
+ \ of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal\
+ \ notices.,This module contains a collection of generally useful derived\nYANG\
+ \ data types for Internet addresses and related things.\n\nCopyright (c) 2013\
+ \ IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\
+ \nRedistribution and use in source and binary forms, with or\nwithout modification,\
+ \ is permitted pursuant to, and subject\nto the license terms contained in, the\
+ \ Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\n\
+ Relating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version\
+ \ of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal\
+ \ notices."
+ version: "1.1.0-SNAPSHOT"
+ title: "SLI-API,ietf-yang-types,ietf-inet-types API"
+consumes:
+- "application/json"
+- "application/xml"
+produces:
+- "application/json"
+- "application/xml"
+paths:
+ /config/SLI-API:test-results/:
+ get:
+ tags:
+ - "SLI-API"
+ description: "returns sli.api.TestResults"
+ parameters: []
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "sli.api.TestResults"
+ schema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ post:
+ tags:
+ - "SLI-API"
+ description: "creates sli.api.TestResults"
+ parameters:
+ - in: "body"
+ name: "sli.api.TestResults.body-param"
+ description: "sli.api.TestResults to be added to list"
+ required: false
+ schema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ responses:
+ 400:
+ description: "Internal error"
+ 201:
+ description: "Object created"
+ 409:
+ description: "Object already exists"
+ put:
+ tags:
+ - "SLI-API"
+ description: "creates or updates sli.api.TestResults"
+ parameters:
+ - in: "body"
+ name: "sli.api.TestResults.body-param"
+ description: "sli.api.TestResults to be added or updated"
+ required: false
+ schema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ responses:
+ 400:
+ description: "Internal error"
+ 201:
+ description: "Object created"
+ 204:
+ description: "Object modified"
+ delete:
+ tags:
+ - "SLI-API"
+ description: "removes sli.api.TestResults"
+ parameters: []
+ responses:
+ 400:
+ description: "Internal error"
+ 204:
+ description: "Object deleted"
+ /config/SLI-API:test-results/SLI-API:test-result/:
+ post:
+ description: "creates sli.api.testresults.TestResult"
+ parameters:
+ - in: "body"
+ name: "sli.api.testresults.TestResult.body-param"
+ description: "sli.api.testresults.TestResult to be added to list"
+ required: false
+ schema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ responses:
+ 400:
+ description: "Internal error"
+ 201:
+ description: "Object created"
+ 409:
+ description: "Object already exists"
+ /config/SLI-API:test-results/SLI-API:test-result/{test-identifier}/:
+ get:
+ tags:
+ - "SLI-API"
+ description: "returns sli.api.testresults.TestResult"
+ parameters:
+ - name: "test-identifier"
+ in: "path"
+ description: "Id of test-result"
+ required: true
+ type: "string"
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "sli.api.testresults.TestResult"
+ schema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ post:
+ tags:
+ - "SLI-API"
+ description: "creates sli.api.testresults.TestResult"
+ parameters:
+ - name: "test-identifier"
+ in: "path"
+ description: "Id of test-result"
+ required: true
+ type: "string"
+ - in: "body"
+ name: "sli.api.testresults.TestResult.body-param"
+ description: "sli.api.testresults.TestResult to be added to list"
+ required: false
+ schema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ responses:
+ 400:
+ description: "Internal error"
+ 201:
+ description: "Object created"
+ 409:
+ description: "Object already exists"
+ put:
+ tags:
+ - "SLI-API"
+ description: "creates or updates sli.api.testresults.TestResult"
+ parameters:
+ - name: "test-identifier"
+ in: "path"
+ description: "Id of test-result"
+ required: true
+ type: "string"
+ - in: "body"
+ name: "sli.api.testresults.TestResult.body-param"
+ description: "sli.api.testresults.TestResult to be added or updated"
+ required: false
+ schema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ responses:
+ 400:
+ description: "Internal error"
+ 201:
+ description: "Object created"
+ 204:
+ description: "Object modified"
+ delete:
+ tags:
+ - "SLI-API"
+ description: "removes sli.api.testresults.TestResult"
+ parameters:
+ - name: "test-identifier"
+ in: "path"
+ description: "Id of test-result"
+ required: true
+ type: "string"
+ responses:
+ 400:
+ description: "Internal error"
+ 204:
+ description: "Object deleted"
+ /operational/SLI-API:test-results/:
+ get:
+ tags:
+ - "SLI-API"
+ description: "returns sli.api.TestResults"
+ parameters: []
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "sli.api.TestResults"
+ schema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.TestResults"
+ $ref: "#/definitions/sli.api.TestResults"
+ /operational/SLI-API:test-results/SLI-API:test-result/{test-identifier}/:
+ get:
+ tags:
+ - "SLI-API"
+ description: "returns sli.api.testresults.TestResult"
+ parameters:
+ - name: "test-identifier"
+ in: "path"
+ description: "Id of test-result"
+ required: true
+ type: "string"
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "sli.api.testresults.TestResult"
+ schema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ /operations/SLI-API:execute-graph/:
+ post:
+ tags:
+ - "SLI-API"
+ parameters:
+ - in: "body"
+ name: "sli.api.executegraph.Input.body-param"
+ required: false
+ schema:
+ properties:
+ input:
+ originalRef: "#/definitions/sli.api.executegraph.Input"
+ $ref: "#/definitions/sli.api.executegraph.Input"
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "Correct response"
+ schema:
+ originalRef: "#/definitions/sli.api.ExecuteGraph"
+ $ref: "#/definitions/sli.api.ExecuteGraph"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.ExecuteGraph"
+ $ref: "#/definitions/sli.api.ExecuteGraph"
+ 201:
+ description: "No response"
+ /operations/SLI-API:healthcheck/:
+ post:
+ tags:
+ - "SLI-API"
+ parameters: []
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "Correct response"
+ schema:
+ originalRef: "#/definitions/sli.api.Healthcheck"
+ $ref: "#/definitions/sli.api.Healthcheck"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.Healthcheck"
+ $ref: "#/definitions/sli.api.Healthcheck"
+ 201:
+ description: "No response"
+ /operations/SLI-API:vlbcheck/:
+ post:
+ tags:
+ - "SLI-API"
+ parameters: []
+ responses:
+ 400:
+ description: "Internal error"
+ 200:
+ description: "Correct response"
+ schema:
+ originalRef: "#/definitions/sli.api.Vlbcheck"
+ $ref: "#/definitions/sli.api.Vlbcheck"
+ responseSchema:
+ originalRef: "#/definitions/sli.api.Vlbcheck"
+ $ref: "#/definitions/sli.api.Vlbcheck"
+ 201:
+ description: "No response"
+definitions:
+ sli.api.ExecuteGraph:
+ type: "object"
+ properties:
+ output:
+ originalRef: "#/definitions/sli.api.ResponseFields"
+ $ref: "#/definitions/sli.api.ResponseFields"
+ sli.api.Healthcheck:
+ type: "object"
+ properties:
+ output:
+ originalRef: "#/definitions/sli.api.ResponseFields"
+ $ref: "#/definitions/sli.api.ResponseFields"
+ sli.api.ModeEnumeration:
+ type: "string"
+ enum:
+ - "sync"
+ - "async"
+ sli.api.ParameterSetting:
+ type: "object"
+ properties:
+ string-value:
+ type: "string"
+ boolean-value:
+ type: "boolean"
+ parameter-name:
+ type: "string"
+ description: "Parameter name"
+ int-value:
+ type: "integer"
+ format: "int32"
+ sli.api.ResponseFields:
+ type: "object"
+ properties:
+ response-code:
+ type: "string"
+ response-message:
+ type: "string"
+ context-memory-json:
+ type: "string"
+ ack-final-indicator:
+ type: "string"
+ sli.api.TestResults:
+ type: "object"
+ properties:
+ test-result:
+ type: "array"
+ items:
+ originalRef: "#/definitions/sli.api.testresults.TestResult"
+ $ref: "#/definitions/sli.api.testresults.TestResult"
+ sli.api.Vlbcheck:
+ type: "object"
+ properties:
+ output:
+ originalRef: "#/definitions/sli.api.ResponseFields"
+ $ref: "#/definitions/sli.api.ResponseFields"
+ sli.api.executegraph.Input:
+ type: "object"
+ properties:
+ mode:
+ originalRef: "#/definitions/sli.api.ModeEnumeration"
+ $ref: "#/definitions/sli.api.ModeEnumeration"
+ module-name:
+ type: "string"
+ sli-parameter:
+ type: "array"
+ items:
+ originalRef: "#/definitions/sli.api.ParameterSetting"
+ $ref: "#/definitions/sli.api.ParameterSetting"
+ rpc-name:
+ type: "string"
+ sli.api.testresults.TestResult:
+ type: "object"
+ properties:
+ results:
+ type: "array"
+ items:
+ type: "string"
+ test-identifier:
+ type: "string"
diff --git a/core/sliapi/model/yang/pom.xml b/core/sliapi/model/yang/pom.xml
new file mode 100755
index 000000000..4d35f025c
--- /dev/null
+++ b/core/sliapi/model/yang/pom.xml
@@ -0,0 +1,27 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+ <artifactId>rfc6991</artifactId>
+ </dependency>
+
+
+ </dependencies>
+</project>
diff --git a/core/sliapi/model/yang/src/main/resources/sli-api.20161110.json b/core/sliapi/model/yang/src/main/resources/sli-api.20161110.json
new file mode 100644
index 000000000..1c6cdabfe
--- /dev/null
+++ b/core/sliapi/model/yang/src/main/resources/sli-api.20161110.json
@@ -0,0 +1,554 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0"
+ },
+ "basePath": "/restconf",
+ "paths": {
+ "/config": {
+ "post": {
+ "consumes": [
+ "application/json",
+ "application/xml"
+ ],
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "**(config)test-results",
+ "required": false,
+ "schema": {
+ "$ref": "#/definitions/SLI-API(config)test-results-TOP"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(config)SLI-API_modulePOST"
+ }
+ }
+ },
+ "description": "Defines API to service logic interpreter",
+ "operationId": "POST-SLI-API_module"
+ }
+ },
+ "/config/SLI-API:test-results": {
+ "delete": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified"
+ }
+ },
+ "description": "Test results",
+ "operationId": "DELETE-test-results"
+ },
+ "get": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(config)test-results"
+ }
+ }
+ },
+ "description": "Test results",
+ "operationId": "GET-test-results"
+ },
+ "post": {
+ "consumes": [
+ "application/json",
+ "application/xml"
+ ],
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "**(config)test-result",
+ "required": false,
+ "schema": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result-TOP"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(config)test-resultsPOST"
+ }
+ }
+ },
+ "description": "Test results",
+ "operationId": "POST-test-results"
+ },
+ "put": {
+ "consumes": [
+ "application/json",
+ "application/xml"
+ ],
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "(config)test-results",
+ "required": false,
+ "schema": {
+ "$ref": "#/definitions/SLI-API(config)test-results-TOP"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/SLI-API(config)test-results-TOP"
+ }
+ }
+ },
+ "description": "Test results",
+ "operationId": "PUT-test-results"
+ }
+ },
+ "/config/SLI-API:test-results/test-result/{test-identifier}": {
+ "delete": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "test-identifier",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified"
+ }
+ },
+ "operationId": "DELETE-test-result"
+ },
+ "get": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "test-identifier",
+ "required": true,
+ "type": "string"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(config)test-result"
+ }
+ }
+ },
+ "operationId": "GET-test-result"
+ },
+ "put": {
+ "consumes": [
+ "application/json",
+ "application/xml"
+ ],
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "path",
+ "name": "test-identifier",
+ "required": true,
+ "type": "string"
+ },
+ {
+ "in": "body",
+ "name": "(config)test-result",
+ "required": false,
+ "schema": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result-TOP"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result-TOP"
+ }
+ }
+ },
+ "operationId": "PUT-test-result"
+ }
+ },
+ "/operational/SLI-API:test-results": {
+ "get": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(operational)test-results"
+ }
+ }
+ },
+ "description": "Test results",
+ "operationId": "GET-test-results"
+ }
+ },
+ "/operations/SLI-API:execute-graph": {
+ "post": {
+ "consumes": [
+ "application/json",
+ "application/xml"
+ ],
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "parameters": [
+ {
+ "in": "body",
+ "name": "body",
+ "required": false,
+ "schema": {
+ "$ref": "#/definitions/(execute-graph)input-TOP"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(execute-graph)output-TOP"
+ }
+ }
+ },
+ "description": " Method to add a new parameter.",
+ "operationId": "execute-graph"
+ }
+ },
+ "/operations/SLI-API:healthcheck": {
+ "post": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(healthcheck)output-TOP"
+ }
+ }
+ },
+ "operationId": "healthcheck"
+ }
+ },
+ "/operations/SLI-API:vlbcheck": {
+ "post": {
+ "produces": [
+ "application/json",
+ "application/xml"
+ ],
+ "responses": {
+ "200": {
+ "description": "No response was specified",
+ "schema": {
+ "$ref": "#/definitions/(vlbcheck)output-TOP"
+ }
+ }
+ },
+ "operationId": "vlbcheck"
+ }
+ }
+ },
+ "definitions": {
+ "(config)SLI-API_modulePOST": {
+ "properties": {
+ "test-results": {
+ "items": {
+ "$ref": "#/definitions/SLI-API(config)test-results"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "(config)sli-parameterPOST": {
+ "properties": {
+ "boolean-value": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "int-value": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "parameter-name": {
+ "$ref": "#/definitions/Optional.empty",
+ "description": "Parameter name"
+ },
+ "string-value": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "(config)test-resultPOST": {
+ "properties": {
+ "test-identifier": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "(config)test-resultsPOST": {
+ "properties": {
+ "test-result": {
+ "items": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "(execute-graph)input": {
+ "properties": {
+ "SLI-API:mode": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:module-name": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:rpc-name": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:sli-parameter": {
+ "items": {
+ "$ref": "#/definitions/SLI-API(config)sli-parameter"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "(execute-graph)input-TOP": {
+ "properties": {
+ "SLI-API:input": {
+ "items": {
+ "$ref": "#/definitions/(execute-graph)input"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "(execute-graph)output": {
+ "properties": {
+ "SLI-API:ack-final-indicator": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:context-memory-json": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-code": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-message": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "(execute-graph)output-TOP": {
+ "properties": {
+ "SLI-API:output": {
+ "items": {
+ "$ref": "#/definitions/(execute-graph)output"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "(healthcheck)output": {
+ "properties": {
+ "SLI-API:ack-final-indicator": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:context-memory-json": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-code": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-message": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "(healthcheck)output-TOP": {
+ "properties": {
+ "SLI-API:output": {
+ "items": {
+ "$ref": "#/definitions/(healthcheck)output"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "(vlbcheck)output": {
+ "properties": {
+ "SLI-API:ack-final-indicator": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:context-memory-json": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-code": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:response-message": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "(vlbcheck)output-TOP": {
+ "properties": {
+ "SLI-API:output": {
+ "items": {
+ "$ref": "#/definitions/(vlbcheck)output"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API(config)sli-parameter": {
+ "properties": {
+ "SLI-API:boolean-value": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:int-value": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "SLI-API:parameter-name": {
+ "$ref": "#/definitions/Optional.empty",
+ "description": "Parameter name"
+ },
+ "SLI-API:string-value": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API(config)sli-parameter-TOP": {
+ "properties": {
+ "SLI-API:sli-parameter": {
+ "items": {
+ "$ref": "#/definitions/SLI-API(config)sli-parameter"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API(config)test-results": {
+ "properties": {
+ "SLI-API:test-result": {
+ "items": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API(config)test-results-TOP": {
+ "properties": {
+ "SLI-API:test-results": {
+ "description": "Test results",
+ "items": {
+ "$ref": "#/definitions/SLI-API(config)test-results"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API(operational)test-results": {
+ "type": "object"
+ },
+ "SLI-API(operational)test-results-TOP": {
+ "properties": {
+ "SLI-API:test-results": {
+ "description": "Test results",
+ "items": {
+ "$ref": "#/definitions/SLI-API(operational)test-results"
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API/test-results(config)test-result": {
+ "properties": {
+ "SLI-API:results": {
+ "items": {
+ "$ref": "#/definitions/Optional.empty"
+ },
+ "type": "array"
+ },
+ "SLI-API:test-identifier": {
+ "$ref": "#/definitions/Optional.empty"
+ }
+ },
+ "type": "object"
+ },
+ "SLI-API/test-results(config)test-result-TOP": {
+ "properties": {
+ "SLI-API:test-result": {
+ "items": {
+ "$ref": "#/definitions/SLI-API/test-results(config)test-result"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "unique_empty_identifier": {}
+ }
+}
diff --git a/core/sliapi/model/yang/src/main/resources/sli-api.20161110.yaml b/core/sliapi/model/yang/src/main/resources/sli-api.20161110.yaml
new file mode 100644
index 000000000..3420c66b5
--- /dev/null
+++ b/core/sliapi/model/yang/src/main/resources/sli-api.20161110.yaml
@@ -0,0 +1,254 @@
+---
+swagger: '2.0'
+info:
+ version: 1.0.0
+ title: "SLI API"
+basePath: '/restconf'
+schemes:
+ - http
+ - https
+paths:
+ '/restconf/config/SLI-API:test-results':
+ delete:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ description: Test results
+ operationId: delete-test-results
+ get:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: get-test-results
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: testResults
+ required: false
+ schema:
+ $ref: '#/definitions/test-results'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: post-test-results
+ put:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: testResults
+ required: false
+ schema:
+ $ref: '#/definitions/test-results'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: put-test-results
+
+ '/restconf/config/SLI-API:test-results/test-result/{test-identifier}':
+ delete:
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ responses:
+ '200':
+ description: No response was specified
+ operationId: delete-test-result
+ get:
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-result'
+ operationId: get-test-result
+ put:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: path
+ name: test-identifier
+ required: true
+ type: string
+ - in: body
+ name: testResult
+ required: false
+ schema:
+ $ref: '#/definitions/test-result'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-result'
+ operationId: PUT-test-result
+
+ '/restconf/operational/SLI-API:test-results':
+ get:
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/test-results'
+ description: Test results
+ operationId: GET-test-results
+ '/restconf/operations/SLI-API:execute-graph':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ parameters:
+ - in: body
+ name: executeGraphInput
+ required: false
+ schema:
+ $ref: '#/definitions/execute-graph-input'
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ description: ' Method to add a new parameter.'
+ operationId: execute-graph
+ '/restconf/operations/SLI-API:healthcheck':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ operationId: healthcheck
+ '/restconf/operations/SLI-API:vlbcheck':
+ post:
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/json
+ - application/xml
+ responses:
+ '200':
+ description: No response was specified
+ schema:
+ $ref: '#/definitions/response-fields'
+ operationId: vlbcheck
+
+definitions:
+ parameter-setting:
+ type: object
+ properties:
+ parameter-name:
+ type: string
+ int-value:
+ type: integer
+ string-value:
+ type: string
+ boolean-value:
+ type: boolean
+
+ response-fields:
+ type: object
+ properties:
+ response-code:
+ type: string
+ ack-final-indicator:
+ type: string
+ response-message:
+ type: string
+ context-memory-json:
+ type: string
+
+ test-results:
+ type: object
+ properties:
+ test-results:
+ type: array
+ items:
+ $ref: '#/definitions/test-result'
+
+ test-result:
+ type: object
+ properties:
+ test-identifier:
+ type: string
+ results:
+ type: array
+ items:
+ type: string
+
+ execute-graph-input:
+ properties:
+ 'input':
+ type: object
+ properties:
+ 'mode':
+ type: string
+ 'module-name':
+ type: string
+ 'rpc-name':
+ type: string
+ 'sli-parameter':
+ items:
+ $ref: '#/definitions/parameter-setting'
+ type: array
+ type: object
+
+
+
+
+
+
+ unique_empty_identifier: {}
+
diff --git a/core/sliapi/model/yang/src/main/yang/sliapi.yang b/core/sliapi/model/yang/src/main/yang/sliapi.yang
new file mode 100755
index 000000000..98cbb2aa7
--- /dev/null
+++ b/core/sliapi/model/yang/src/main/yang/sliapi.yang
@@ -0,0 +1,117 @@
+module SLI-API {
+
+ yang-version 1;
+
+ namespace "org:onap:ccsdk:sli:core:sliapi";
+
+ prefix sample;
+
+ import ietf-inet-types { prefix "inet"; revision-date 2013-07-15; }
+
+ organization "ONAP";
+
+ contact
+ "Dan Timoney";
+
+ description
+ "Defines API to service logic interpreter";
+
+ revision "2016-11-10" {
+ description
+ "REST API to Service Logic Interpreter";
+ }
+
+ grouping parameter-setting {
+ description
+ "Parameter setting";
+
+ leaf parameter-name {
+ type string;
+ description "Parameter name";
+ }
+
+ leaf int-value {
+ type int32;
+ }
+ leaf string-value {
+ type string;
+ }
+ leaf boolean-value {
+ type boolean;
+ }
+ }
+
+ grouping response-fields {
+ leaf response-code {
+ type string;
+ }
+ leaf ack-final-indicator {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf context-memory-json {
+ type string;
+ }
+ }
+
+ container test-results {
+ description "Test results";
+
+ list test-result {
+ key "test-identifier";
+
+ leaf test-identifier {
+ type string;
+ }
+
+ leaf-list results {
+ type string;
+ }
+ }
+ }
+
+ rpc execute-graph {
+ description " Method to add a new parameter.";
+ input {
+
+ leaf module-name {
+ type string;
+ }
+
+ leaf rpc-name {
+ type string;
+ }
+
+ leaf mode {
+ type enumeration {
+ enum sync;
+ enum async;
+ }
+ }
+
+ list sli-parameter {
+ key "parameter-name";
+ uses parameter-setting;
+ }
+ }
+
+ output {
+ uses response-fields;
+ }
+ }
+
+ rpc healthcheck {
+ output {
+ uses response-fields;
+ }
+ }
+
+ rpc vlbcheck {
+ output {
+ uses response-fields;
+ }
+ }
+
+}
diff --git a/core/sliapi/pom.xml b/core/sliapi/pom.xml
new file mode 100755
index 000000000..2af92cf7e
--- /dev/null
+++ b/core/sliapi/pom.xml
@@ -0,0 +1,28 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-sli-core :: sliapi</name>
+
+ <modules>
+ <module>model</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+
+ <properties>
+ <feature-name>sliapi</feature-name>
+ </properties>
+</project>
diff --git a/core/sliapi/provider/pom.xml b/core/sliapi/provider/pom.xml
new file mode 100755
index 000000000..79f3d5560
--- /dev/null
+++ b/core/sliapi/provider/pom.xml
@@ -0,0 +1,112 @@
+<?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.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>2.1.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-provider</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>mdsal-binding-dom-adapter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelper.java b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelper.java
new file mode 100644
index 000000000..95e51537f
--- /dev/null
+++ b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelper.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sliapi;
+
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SliapiHelper extends MdsalHelper {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SliapiHelper.class);
+
+ static {
+ ExecuteGraphInputBuilder b1 = new ExecuteGraphInputBuilder();
+ SliParameterBuilder b2 = new SliParameterBuilder();
+
+ }
+
+}
diff --git a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
new file mode 100644
index 000000000..449fc3822
--- /dev/null
+++ b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
@@ -0,0 +1,676 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sliapi;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
+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.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLIAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
+import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+/**
+ * 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>
+ *
+ * &#64;Override
+ * public java.lang.AutoCloseable createInstance() {
+ *
+ * final SliapiProvider provider = new SliapiProvider();
+ * provider.setDataBroker(getDataBrokerDependency());
+ * provider.setNotificationService(getNotificationServiceDependency());
+ * provider.setRpcRegistry(getRpcRegistryDependency());
+ * provider.initialize();
+ * return new AutoCloseable() {
+ *
+ * &#64;Override
+ * public void close() throws Exception {
+ * // TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE
+ * // BROKER/NOTIFICATION
+ * // SERVIE/RPC REGISTRY
+ * provider.close();
+ * }
+ * };
+ * }
+ *
+ * </pre>
+ */
+public class SliapiProvider implements AutoCloseable, SLIAPIService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SliapiProvider.class);
+ private static final String appName = "slitester";
+
+ protected DataBroker dataBroker;
+ protected DOMDataBroker domDataBroker;
+ protected NotificationPublishService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+
+ private SvcLogicService svcLogic;
+
+ protected BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration;
+
+ private static String SLIAPI_NAMESPACE = "org:onap:ccsdk:sli:core:sliapi";
+ private static String SLIAPI_REVISION = "2016-11-10";
+ private static String SDNC_STATUS_FILE = "SDNC_STATUS_FILE";
+ private static String sdncStatusFile = null;
+
+ private static QName TEST_RESULTS_QNAME = null;
+ private static QName TEST_RESULT_QNAME = null;
+ private static QName TEST_ID_QNAME = null;
+ private static QName RESULTS_QNAME = null;
+ private static final String NON_NULL = "non-null";
+
+ static {
+
+ TEST_RESULTS_QNAME = QName.create(SLIAPI_NAMESPACE, SLIAPI_REVISION, "test-results");
+ TEST_RESULT_QNAME = QName.create(TEST_RESULTS_QNAME, "test-result");
+ TEST_ID_QNAME = QName.create(TEST_RESULT_QNAME, "test-identifier");
+ RESULTS_QNAME = QName.create(TEST_RESULT_QNAME, "results");
+ }
+
+ public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderRegistry rpcProviderRegistry) {
+ this(dataBroker, notificationPublishService, rpcProviderRegistry, findSvcLogicService());
+ }
+
+ public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderRegistry rpcProviderRegistry, SvcLogicService svcLogic) {
+ this.LOG.info("Creating provider for " + appName);
+ this.dataBroker = dataBroker;
+ this.notificationService = notificationPublishService;
+ this.rpcRegistry = rpcProviderRegistry;
+ this.svcLogic = svcLogic;
+ initialize();
+ }
+
+ public void initialize() {
+ LOG.info("Initializing provider for " + appName);
+ // initialization code goes here.
+ rpcRegistration = rpcRegistry.addRpcImplementation(SLIAPIService.class, this);
+
+ sdncStatusFile = System.getenv(SDNC_STATUS_FILE);
+ LOG.info("SDNC STATUS FILE = " + sdncStatusFile);
+ 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);
+ // closing code goes here
+
+ rpcRegistration.close();
+ LOG.info("Successfully closed provider for " + appName);
+ }
+
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ if (dataBroker instanceof AbstractForwardedDataBroker) {
+ domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate();
+ }
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("DataBroker set to " + (dataBroker == null ? "null" : NON_NULL) + ".");
+ }
+ }
+
+ public void setNotificationService(NotificationPublishService 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) + ".");
+ }
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<ExecuteGraphOutput>> executeGraph(ExecuteGraphInput input) {
+ RpcResult<ExecuteGraphOutput> rpcResult = null;
+
+ SvcLogicService svcLogic = getSvcLogicService();
+ ExecuteGraphOutputBuilder respBuilder = new ExecuteGraphOutputBuilder();
+
+ String calledModule = input.getModuleName();
+ String calledRpc = input.getRpcName();
+ Mode calledMode = input.getMode();
+ String modeStr = "sync";
+
+ if (calledMode == Mode.Async) {
+ modeStr = "async";
+ }
+
+ if (svcLogic == null) {
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Could not locate OSGi SvcLogicService service");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<ExecuteGraphOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ try {
+ if (!svcLogic.hasGraph(calledModule, calledRpc, null, modeStr)) {
+ respBuilder.setResponseCode("404");
+ respBuilder.setResponseMessage(
+ "Directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr + " not found");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<ExecuteGraphOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception looking for directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr,
+ e);
+
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Internal error : could not determine if target graph exists");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<ExecuteGraphOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ // Load properties
+ Properties parms = new Properties();
+
+ // Pass properties using names from sli-parameters
+ for (SliParameter sliParm : input.getSliParameter()) {
+
+ String propValue = "";
+
+ Boolean boolval = sliParm.isBooleanValue();
+
+ if (boolval != null) {
+ propValue = boolval.toString();
+ } else {
+ Integer intval = sliParm.getIntValue();
+ if (intval != null) {
+ propValue = intval.toString();
+ } else {
+ propValue = sliParm.getStringValue();
+ if (propValue == null) {
+ propValue = "";
+ }
+ }
+ }
+ parms.setProperty(sliParm.getParameterName(), propValue);
+ }
+
+ // Also, pass "meta" properties (i.e. pass SliParameter objects themselves)
+ ExecuteGraphInputBuilder inputBuilder = new ExecuteGraphInputBuilder(input);
+
+ SliapiHelper.toProperties(parms, "input", inputBuilder);
+
+ try {
+ LOG.info("Calling directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr);
+
+ if (LOG.isTraceEnabled()) {
+ StringBuffer argList = new StringBuffer();
+ argList.append("Parameters : {");
+ Enumeration e = parms.propertyNames();
+ while (e.hasMoreElements()) {
+ String propName = (String) e.nextElement();
+ argList.append(" (" + propName + "," + parms.getProperty(propName) + ") ");
+ }
+ argList.append("}");
+ LOG.trace(argList.toString());
+ argList = null;
+ }
+
+ Properties respProps = svcLogic.execute(calledModule, calledRpc, null, modeStr, parms, domDataBroker);
+
+ StringBuilder sb = new StringBuilder("{");
+
+ for (Object key : respProps.keySet()) {
+ String keyValue = (String) key;
+ if (keyValue != null && !"".equals(keyValue) && !keyValue.contains("input.sli-parameter")) {
+ sb.append("\"").append(keyValue).append("\": \"").append(respProps.getProperty(keyValue))
+ .append("\",");
+ }
+ }
+
+ sb.setLength(sb.length() - 1);
+ sb.append("}");
+
+ respBuilder.setResponseCode(respProps.getProperty("error-code", "0"));
+ respBuilder.setResponseMessage(respProps.getProperty("error-message", ""));// TODO change response-text to
+ // response-message to match
+ // other BVC APIs
+ respBuilder.setAckFinalIndicator(respProps.getProperty("ack-final", "Y"));
+ respBuilder.setContextMemoryJson(sb.toString());
+
+ TestResultBuilder testResultBuilder = new TestResultBuilder();
+
+ SliapiHelper.toBuilder(respProps, testResultBuilder);
+
+ String testIdentifier = testResultBuilder.getTestIdentifier();
+
+ if ((testIdentifier != null) && (testIdentifier.length() > 0)) {
+
+ // Add test results to config tree
+ LOG.debug("Saving test results for test id " + testIdentifier);
+
+ DomSaveTestResult(testResultBuilder.build(), true, LogicalDatastoreType.CONFIGURATION);
+
+ }
+
+ } catch (Exception e) {
+ LOG.error("Caught exception executing directed graph for" + calledModule + ":" + calledRpc + "," + modeStr
+ + ">", e);
+
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Internal error : caught exception executing directed graph " + calledModule
+ + "/" + calledRpc + "/" + modeStr);
+ respBuilder.setAckFinalIndicator("Y");
+
+ }
+
+ rpcResult = RpcResultBuilder.<ExecuteGraphOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ private SvcLogicService getSvcLogicService() {
+ if (svcLogic == null) {
+ svcLogic = findSvcLogicService();
+ }
+
+ return (svcLogic);
+ }
+
+ private static SvcLogicService findSvcLogicService() {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ SvcLogicService svcLogic = null;
+
+ // 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);
+
+ }
+
+ return (svcLogic);
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<HealthcheckOutput>> healthcheck(HealthcheckInput healthcheckInput) {
+
+ RpcResult<HealthcheckOutput> rpcResult = null;
+ SvcLogicService svcLogic = getSvcLogicService();
+
+ HealthcheckOutputBuilder respBuilder = new HealthcheckOutputBuilder();
+
+ String calledModule = "sli";
+ String calledRpc = "healthcheck";
+ String modeStr = "sync";
+
+ if (svcLogic == null) {
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Could not locate OSGi SvcLogicService service");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<HealthcheckOutput>failed().withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ try {
+ if (!svcLogic.hasGraph(calledModule, calledRpc, null, modeStr)) {
+ respBuilder.setResponseCode("404");
+ respBuilder.setResponseMessage(
+ "Directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr + " not found");
+
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<HealthcheckOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception looking for directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr,
+ e);
+
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Internal error : could not determine if target graph exists");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<HealthcheckOutput>failed().withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ try {
+ LOG.info("Calling directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr);
+
+ Properties parms = new Properties();
+
+ Properties respProps = svcLogic.execute(calledModule, calledRpc, null, modeStr, parms);
+
+ respBuilder.setResponseCode(respProps.getProperty("error-code", "0"));
+ respBuilder.setResponseMessage(respProps.getProperty("error-message", ""));
+ respBuilder.setAckFinalIndicator(respProps.getProperty("ack-final", "Y"));
+
+ } catch (Exception e) {
+ LOG.error("Caught exception executing directed graph for" + calledModule + ":" + calledRpc + "," + modeStr
+ + ">", e);
+
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Internal error : caught exception executing directed graph " + calledModule
+ + "/" + calledRpc + "/" + modeStr);
+ respBuilder.setAckFinalIndicator("Y");
+
+ }
+
+ rpcResult = RpcResultBuilder.<HealthcheckOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ public ListenableFuture<RpcResult<VlbcheckOutput>> vlbcheck(VlbcheckInput vlbInput) {
+
+ RpcResult<VlbcheckOutput> rpcResult = null;
+ SvcLogicService svcLogic = getSvcLogicService();
+
+ VlbcheckOutputBuilder respBuilder = new VlbcheckOutputBuilder();
+
+ String calledModule = "sli";
+ String calledRpc = "vlbcheck";
+ String modeStr = "sync";
+
+ if (svcLogic == null) {
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Could not locate OSGi SvcLogicService service");
+ respBuilder.setAckFinalIndicator("Y");
+
+ rpcResult = RpcResultBuilder.<VlbcheckOutput>failed().withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ }
+
+ boolean dgExists = true;
+ try {
+ if (!svcLogic.hasGraph(calledModule, calledRpc, null, modeStr)) {
+ dgExists = false;
+ }
+ } catch (Exception e) {
+ LOG.warn(
+ "Caught exception looking for directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr,
+ e);
+
+ dgExists = false;
+ }
+
+ if (dgExists) {
+ try {
+ LOG.info("Calling directed graph for " + calledModule + "/" + calledRpc + "/" + modeStr);
+
+ Properties parms = new Properties();
+
+ Properties respProps = svcLogic.execute(calledModule, calledRpc, null, modeStr, parms);
+
+ respBuilder.setResponseCode(respProps.getProperty("error-code", "0"));
+ respBuilder.setResponseMessage(respProps.getProperty("error-message", ""));
+ respBuilder.setAckFinalIndicator(respProps.getProperty("ack-final", "Y"));
+
+ } catch (Exception e) {
+ LOG.error("Caught exception executing directed graph for" + calledModule + ":" + calledRpc + ","
+ + modeStr + ">", e);
+
+ respBuilder.setResponseCode("500");
+ respBuilder.setResponseMessage("Internal error : caught exception executing directed graph "
+ + calledModule + "/" + calledRpc + "/" + modeStr);
+ respBuilder.setAckFinalIndicator("Y");
+
+ }
+
+ rpcResult = RpcResultBuilder.<VlbcheckOutput>status(true).withResult(respBuilder.build()).build();
+ return (Futures.immediateFuture(rpcResult));
+ } else {
+ // check the state based on the config file
+
+ boolean suspended = false;
+ BufferedReader br = null;
+ String line = "";
+
+ if (sdncStatusFile != null) {
+ try {
+ br = new BufferedReader(new FileReader(sdncStatusFile));
+ while ((line = br.readLine()) != null) {
+ if ("ODL_STATE=SUSPENDED".equals(line)) {
+ suspended = true;
+ LOG.debug("vlbcheck: server is suspended");
+ }
+ }
+ br.close();
+ } catch (FileNotFoundException e) {
+ LOG.trace("Caught File not found exception " + sdncStatusFile + "\n", e);
+ } catch (Exception e) {
+ LOG.trace("Failed to read status file " + sdncStatusFile + "\n", e);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ LOG.warn("Failed to close status file " + sdncStatusFile + "\n", e);
+ }
+ }
+ }
+ }
+
+ if (suspended) {
+ rpcResult = RpcResultBuilder.<VlbcheckOutput>failed()
+ .withError(ErrorType.APPLICATION, "resource-denied", "Server Suspended").build();
+ } else {
+ respBuilder.setResponseMessage("server is normal");
+ rpcResult = RpcResultBuilder.<VlbcheckOutput>status(true).withResult(respBuilder.build()).build();
+ }
+ return (Futures.immediateFuture(rpcResult));
+ }
+ }
+
+ private void DomSaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType) {
+
+ if (domDataBroker == null) {
+ LOG.error("domDataBroker unset - cannot save test result using DOMDataBroker");
+ return;
+ }
+
+ MapEntryNode resultNode = null;
+
+ try {
+ resultNode = toMapEntryNode(entry);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to create map entry node", e);
+ }
+
+ if (resultNode == null) {
+ LOG.error("Could not convert entry to MapEntryNode");
+ return;
+ }
+
+ YangInstanceIdentifier testResultsPid = YangInstanceIdentifier.builder().node(TEST_RESULTS_QNAME)
+ .node(QName.create(TEST_RESULTS_QNAME, "test-result")).build();
+ YangInstanceIdentifier testResultPid = testResultsPid
+ .node(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, resultNode.getIdentifier().getKeyValues()));
+
+ int tries = 2;
+ while (true) {
+ try {
+ DOMDataWriteTransaction wtx = domDataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ LOG.info("Merging test identifier " + entry.getTestIdentifier());
+ wtx.merge(storeType, testResultPid, resultNode);
+ } else {
+ LOG.info("Putting test identifier " + entry.getTestIdentifier());
+ wtx.put(storeType, testResultPid, resultNode);
+ }
+ wtx.submit().checkedGet();
+ LOG.trace("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if (e instanceof OptimisticLockFailedException) {
+ if (--tries <= 0) {
+ LOG.trace("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ LOG.trace("Got OptimisticLockFailedException - trying again ");
+ } else {
+ LOG.trace("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+
+ }
+
+ private void SaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType)
+ throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that
+ // identifier
+
+ InstanceIdentifier.InstanceIdentifierBuilder<TestResult> testResultIdBuilder = InstanceIdentifier
+ .<TestResults>builder(TestResults.class).child(TestResult.class, entry.key());
+ InstanceIdentifier<TestResult> path = testResultIdBuilder.build();
+ 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.trace("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if (e instanceof OptimisticLockFailedException) {
+ if (--tries <= 0) {
+ LOG.trace("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ LOG.trace("Got OptimisticLockFailedException - trying again ");
+ } else {
+ LOG.trace("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ private MapEntryNode toMapEntryNode(TestResult testResult) {
+
+ YangInstanceIdentifier testResultId = YangInstanceIdentifier.builder().node(TEST_RESULTS_QNAME)
+ .node(TEST_RESULT_QNAME).build();
+
+ // Construct results list
+ LinkedList<LeafSetEntryNode<Object>> entryList = new LinkedList<>();
+ for (String result : testResult.getResults()) {
+ LeafSetEntryNode<Object> leafSetEntryNode = ImmutableLeafSetEntryNodeBuilder.create()
+ .withNodeIdentifier(new NodeWithValue(RESULTS_QNAME, result)).withValue(result).build();
+ entryList.add(leafSetEntryNode);
+ }
+ // Construct results LeafSetNode
+ LeafSetNode<?> resultsNode = ImmutableLeafSetNodeBuilder.create()
+ .withNodeIdentifier(new NodeIdentifier(RESULTS_QNAME)).withValue(entryList).build();
+
+ // Construct test result ContainerNode with 2 children - test-identifier leaf
+ // and results leaf-set
+ MapEntryNode testResultNode = ImmutableNodes.mapEntryBuilder()
+ .withNodeIdentifier(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, TEST_ID_QNAME,
+ testResult.getTestIdentifier()))
+ .withChild(ImmutableNodes.leafNode(TEST_ID_QNAME, testResult.getTestIdentifier()))
+ .withChild(resultsNode).build();
+
+ return (testResultNode);
+
+ }
+
+}
diff --git a/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
new file mode 100644
index 000000000..875027e63
--- /dev/null
+++ b/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+
+ </bean>
+</blueprint> \ No newline at end of file
diff --git a/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
new file mode 100644
index 000000000..875027e63
--- /dev/null
+++ b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+
+ </bean>
+</blueprint> \ No newline at end of file
diff --git a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelperTest.java b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelperTest.java
new file mode 100644
index 000000000..228f6127e
--- /dev/null
+++ b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/SliapiHelperTest.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2018 IBM. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.sliapi;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+
+public class SliapiHelperTest {
+
+ @Test
+ public void TestSliapiHelper()
+ {
+ SliapiHelper sliapiHelper= new SliapiHelper();
+ assertNotNull(sliapiHelper);
+ }
+}
diff --git a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
new file mode 100644
index 000000000..f48cf783b
--- /dev/null
+++ b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
@@ -0,0 +1,209 @@
+/**
+ *
+ */
+package org.onap.ccsdk.sli.core.sliapi;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Future;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicParser;
+import org.onap.ccsdk.sli.core.sli.SvcLogicStore;
+import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolver;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl;
+import org.onap.ccsdk.sli.core.sli.provider.base.AbstractSvcLogicNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.BlockNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.CallNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ConfigureNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.DeleteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExecuteNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ExistsNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ForNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.GetResourceNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.IsAvailableNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.NotifyNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.RecordNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReleaseNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReserveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.ReturnNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SaveNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor;
+import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLIAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder;
+
+/**
+ * @author dt5972
+ *
+ */
+public class TestSliapiProvider {
+
+ private SliapiProvider provider;
+
+ private static final String HEALTHCHECK_DG = "sli_healthcheck.xml";
+
+ private static final Map<String, AbstractSvcLogicNodeExecutor> BUILTIN_NODES = new HashMap<String, AbstractSvcLogicNodeExecutor>() {
+ {
+ put("block", new BlockNodeExecutor());
+ put("call", new CallNodeExecutor());
+ put("configure", new ConfigureNodeExecutor());
+ put("delete", new DeleteNodeExecutor());
+ put("execute", new ExecuteNodeExecutor());
+ put("exists", new ExistsNodeExecutor());
+ put("for", new ForNodeExecutor());
+ put("get-resource", new GetResourceNodeExecutor());
+ put("is-available", new IsAvailableNodeExecutor());
+ put("notify", new NotifyNodeExecutor());
+ put("record", new RecordNodeExecutor());
+ put("release", new ReleaseNodeExecutor());
+ put("reserve", new ReserveNodeExecutor());
+ put("return", new ReturnNodeExecutor());
+ put("save", new SaveNodeExecutor());
+ put("set", new SetNodeExecutor());
+ put("switch", new SwitchNodeExecutor());
+ put("update", new UpdateNodeExecutor());
+ put("while", new WhileNodeExecutor());
+
+ }
+ };
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ DataBroker dataBroker = mock(DataBroker.class);
+ NotificationPublishService notifyService = mock(NotificationPublishService.class);
+ RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class);
+ BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration = (BindingAwareBroker.RpcRegistration<SLIAPIService>) mock(
+ BindingAwareBroker.RpcRegistration.class);
+ when(rpcRegistry.addRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration);
+
+ // Load svclogic.properties and get a SvcLogicStore
+ InputStream propStr = TestSliapiProvider.class.getResourceAsStream("/svclogic.properties");
+ Properties svcprops = new Properties();
+ svcprops.load(propStr);
+
+ SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(svcprops);
+
+ assertNotNull(store);
+
+ // Load the DG for the healthcheck api
+ URL testCaseUrl = TestSliapiProvider.class.getClassLoader().getResource(HEALTHCHECK_DG);
+ if (testCaseUrl == null) {
+ fail("Cannot find " + HEALTHCHECK_DG);
+ }
+ SvcLogicParser.load(testCaseUrl.getPath(), store);
+ SvcLogicParser.activate("sli", "healthcheck", "1.0.0", "sync", store);
+
+ // Create a ServiceLogicService and initialize it
+ SvcLogicServiceImpl svc = new SvcLogicServiceImpl(new SvcLogicPropertiesProviderImpl(),
+ new SvcLogicClassResolver());
+ for (String nodeType : BUILTIN_NODES.keySet()) {
+ svc.registerExecutor(nodeType, BUILTIN_NODES.get(nodeType));
+ }
+
+ // Finally ready to create SliapiProvider
+ provider = new SliapiProvider(dataBroker, notifyService, rpcRegistry, svc);
+ provider.setDataBroker(dataBroker);
+ provider.setNotificationService(notifyService);
+ provider.setRpcRegistry(rpcRegistry);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ provider.close();
+ }
+
+ /**
+ * Test method for
+ * {@link SliapiProvider#executeGraph(org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput)}.
+ */
+ @Test
+ public void testExecuteGraph() {
+ ExecuteGraphInputBuilder inputBuilder = new ExecuteGraphInputBuilder();
+
+ // Valid test - graph exists
+ inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
+ inputBuilder.setModuleName("sli");
+ inputBuilder.setRpcName("healthcheck");
+ List<SliParameter> pList = new LinkedList<>();
+ SliParameterBuilder pBuilder = new SliParameterBuilder();
+ pBuilder.setParameterName("int-parameter");
+ pBuilder.setIntValue(1);
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("bool-parameter");
+ pBuilder.setIntValue(null);
+ pBuilder.setBooleanValue(true);
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("str-parameter");
+ pBuilder.setBooleanValue(null);
+ pBuilder.setStringValue("value");
+ pList.add(pBuilder.build());
+ inputBuilder.setSliParameter(pList);
+ provider.executeGraph(inputBuilder.build());
+
+
+ // Invalid test - graph does not exist
+ inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
+ inputBuilder.setModuleName("sli");
+ inputBuilder.setRpcName("no-such-graph");
+ pList = new LinkedList<>();
+ pBuilder = new SliParameterBuilder();
+ pBuilder.setParameterName("int-parameter");
+ pBuilder.setIntValue(1);
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("bool-parameter");
+ pBuilder.setIntValue(null);
+ pBuilder.setBooleanValue(true);
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("str-parameter");
+ pBuilder.setBooleanValue(null);
+ pBuilder.setStringValue("value");
+ pList.add(pBuilder.build());
+ inputBuilder.setSliParameter(pList);
+ provider.executeGraph(inputBuilder.build());
+
+ assertTrue(provider.vlbcheck(mock(VlbcheckInput.class)) instanceof Future<?>);
+ }
+
+ /**
+ * Test method for
+ * {@link SliapiProvider#healthcheck()}.
+ */
+ @Test
+ public void testHealthcheck() {
+ provider.healthcheck(mock(HealthcheckInput.class));
+ }
+
+}
diff --git a/core/sliapi/provider/src/test/resources/simplelogger.properties b/core/sliapi/provider/src/test/resources/simplelogger.properties
new file mode 100644
index 000000000..2f7d8ea0b
--- /dev/null
+++ b/core/sliapi/provider/src/test/resources/simplelogger.properties
@@ -0,0 +1,23 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : CCSDK
+# ================================================================================
+# 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=========================================================
+###
+
+org.slf4j.simpleLogger.defaultLogLevel=info
+org.slf4j.simplelogger.log.org.onap.ccsdk.sli.core.sliapi.SliapiProvider=debug
diff --git a/core/sliapi/provider/src/test/resources/sli_healthcheck.xml b/core/sliapi/provider/src/test/resources/sli_healthcheck.xml
new file mode 100644
index 000000000..d512f546f
--- /dev/null
+++ b/core/sliapi/provider/src/test/resources/sli_healthcheck.xml
@@ -0,0 +1,27 @@
+<!--
+ ============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=========================================================
+ -->
+
+<service-logic xmlns="http://www.onap.org/sdnc/svclogic"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module='sli' version='1.0.0'><method rpc='healthcheck' mode='sync'>
+<set>
+<parameter name='error-code' value='200' />
+<parameter name='error-message' value='SDN-C is healthy'/>
+<parameter name='ack-final' value='Y'/>
+</set></method></service-logic>
diff --git a/core/sliapi/provider/src/test/resources/svclogic.properties b/core/sliapi/provider/src/test/resources/svclogic.properties
new file mode 100644
index 000000000..426960f76
--- /dev/null
+++ b/core/sliapi/provider/src/test/resources/svclogic.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : CCSDK
+# ================================================================================
+# 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=========================================================
+###
+
+org.onap.ccsdk.sli.dbtype = jdbc
+org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true
+org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+org.onap.ccsdk.sli.jdbc.database = sdnctl
+org.onap.ccsdk.sli.jdbc.user = test
+org.onap.ccsdk.sli.jdbc.password = test