aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/northbound/a1Adapter
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-11-03 02:15:40 +0000
committerGerrit Code Review <gerrit@onap.org>2019-11-03 02:15:40 +0000
commit479b6c2f2ef248a805537762d2b461ff1a4c6ef5 (patch)
treeb119d0a6dc1b85e018c39d82eabd78c12bbee6c4 /sdnr/northbound/a1Adapter
parentc7df5f53e2d525230170dc818572883de0bdf2ca (diff)
parent8ee521ed01b956d1c6939513d617de9cd5e9a68f (diff)
Merge "ORAN A1 Adapter Karaf feature development"
Diffstat (limited to 'sdnr/northbound/a1Adapter')
-rw-r--r--sdnr/northbound/a1Adapter/feature/pom.xml28
-rw-r--r--sdnr/northbound/a1Adapter/installer/pom.xml97
-rw-r--r--sdnr/northbound/a1Adapter/installer/src/assembly/assemble_mvnrepo_zip.xml49
-rw-r--r--sdnr/northbound/a1Adapter/model/pom.xml55
-rw-r--r--sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang245
-rw-r--r--sdnr/northbound/a1Adapter/pom.xml29
-rw-r--r--sdnr/northbound/a1Adapter/provider/pom.xml129
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java624
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java880
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml34
-rw-r--r--sdnr/northbound/a1Adapter/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml34
11 files changed, 2204 insertions, 0 deletions
diff --git a/sdnr/northbound/a1Adapter/feature/pom.xml b/sdnr/northbound/a1Adapter/feature/pom.xml
new file mode 100644
index 000000000..8d331ad02
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/feature/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>single-feature-parent</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>sdnr-a1Adapter</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name>ccsdk-features-sdnr-northbound :: a1Adapter :: ${project.artifactId}</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>a1Adapter-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sdnr/northbound/a1Adapter/installer/pom.xml b/sdnr/northbound/a1Adapter/installer/pom.xml
new file mode 100644
index 000000000..38767b74d
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/installer/pom.xml
@@ -0,0 +1,97 @@
+<?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>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>a1Adapter-installer</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-features-sdnr-northbound :: a1Adapter :: ${project.artifactId}</name>
+
+ <properties>
+ <application.name>sdnr-a1Adapter</application.name>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</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>a1Adapter-provider</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>
+ </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>a1Adapter-model,a1Adapter-provider,sdnr-a1Adapter</includeArtifactIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sdnr/northbound/a1Adapter/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/northbound/a1Adapter/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..c4eb9aa25
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/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/sdnr/northbound/a1Adapter/model/pom.xml b/sdnr/northbound/a1Adapter/model/pom.xml
new file mode 100644
index 000000000..917b6c214
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/model/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onap.ccsdk.parent</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>a1Adapter-model</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
+ <artifactId>rfc6991</artifactId>
+ </dependency>
+
+
+ </dependencies>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>set-system-properties</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang b/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang
new file mode 100644
index 000000000..297787b32
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/model/src/main/yang/A1-ADAPTER-API.yang
@@ -0,0 +1,245 @@
+module A1-ADAPTER-API {
+
+ namespace "org:onap:ccsdk";
+
+ prefix a1-adapter-api;
+
+ revision "2019-12-12" {
+ description
+ "Added standard output payload for all RPC's";
+ }
+
+ revision "2019-10-02" {
+ description
+ "A1 adapter for Frankfurt";
+ }
+
+
+
+ grouping a1-adapter-response {
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ description
+ "Response payload for A1 Adapter RPC's";
+ }
+
+
+///Flattend interface using RPC
+
+ //Get a comma separated list of near-rt rics, e.g. domain-name1:port1,domainname2:port2
+ //Each item in the returned list will be regarded as one near-rt-ric-id.
+ rpc getNearRT-RICs {
+ output {
+ uses a1-adapter-response;
+ leaf-list near-rt-ric-id-list {
+ type string;
+ }
+ }
+ }
+
+ //Get health status for a Near-RT-RIC. true - health ok, false - health is not ok.
+ rpc getHealthCheck {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ }
+
+ output {
+ uses a1-adapter-response;
+ leaf health-status {
+ type boolean;
+ }
+ }
+ }
+
+ //Get a comma separated list of integer policy type ids
+ //Each item in the returned list will be regarded as one policy-type-id.
+ rpc getPolicyTypes {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ leaf-list policy-type-id-list {
+ type uint32;
+ }
+ }
+ }
+
+ //Create a policy type
+ rpc createPolicyType {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ leaf description {
+ type string;
+ }
+ leaf name {
+ type string;
+ }
+ leaf policy-type {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ leaf status {
+ type string;
+ }
+ leaf code {
+ type string;
+ }
+ }
+ }
+
+ //Get a policy type
+ rpc getPolicyType {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ leaf description {
+ type string;
+ }
+ leaf name {
+ type string;
+ }
+ leaf policy-type {
+ type string;
+ }
+ }
+ }
+
+ //Delete a policy type
+ rpc deletePolicyType {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ }
+ }
+
+ //Get a comma separeated list of string policy instance ids
+ //Each item in the returned list will be regarded as one policy-instance-id.
+ rpc getPolicyInstances {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ }
+
+ output {
+ uses a1-adapter-response;
+ leaf-list policy-instance-id-list {
+ type string;
+ }
+ }
+ }
+
+ //Create a policy instance
+ rpc createPolicyInstance {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ leaf policy-instance-id {
+ type string;
+ }
+ leaf policy-instance {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ }
+ }
+
+ ///Get a policy instance
+ rpc getPolicyInstance {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ leaf policy-instance-id {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ leaf policy-instance {
+ type string;
+ }
+ }
+ }
+
+ //Delete a policy instance
+ rpc deletePolicyInstance {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ leaf policy-instance-id {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ }
+ }
+
+ //Get the status for a policy instance
+ rpc getStatus {
+ input {
+ leaf near-rt-ric-id {
+ type string;
+ }
+ leaf policy-type-id {
+ type uint32;
+ }
+ leaf policy-instance-id {
+ type string;
+ }
+ }
+ output {
+ uses a1-adapter-response;
+ leaf status {
+ type string;
+ }
+ }
+ }
+}
diff --git a/sdnr/northbound/a1Adapter/pom.xml b/sdnr/northbound/a1Adapter/pom.xml
new file mode 100644
index 000000000..44b035725
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/pom.xml
@@ -0,0 +1,29 @@
+<?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>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>a1Adapter</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-features-sdnr-northbound :: a1Adapter</name>
+
+ <modules>
+ <module>model</module>
+ <module>feature</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+
+ <properties>
+ <feature-name>a1Adapter</feature-name>
+ </properties>
+</project>
diff --git a/sdnr/northbound/a1Adapter/provider/pom.xml b/sdnr/northbound/a1Adapter/provider/pom.xml
new file mode 100644
index 000000000..dce7da2c1
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/provider/pom.xml
@@ -0,0 +1,129 @@
+<?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>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>a1Adapter-provider</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>1.6.1</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-core-artifacts</artifactId>
+ <version>${ccsdk.sli.core.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>a1Adapter-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ </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.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>utils-provider</artifactId>
+ <!-- <version>${sdnctl.sli.version}</version> -->
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>properties-maven-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>set-system-properties</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java
new file mode 100644
index 000000000..216f9bd38
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterClient.java
@@ -0,0 +1,624 @@
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.a1Adapter;
+
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class A1AdapterClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(A1AdapterClient.class);
+
+ private SvcLogicService svcLogicService = null;
+
+ public A1AdapterClient(final SvcLogicService svcLogicService) {
+ this.svcLogicService = svcLogicService;
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return svcLogicService.hasGraph(module, rpc, version, mode);
+ }
+
+// Client for GetNearRTRICs
+
+public Properties execute(String module, String rpc, String version, String mode, GetNearRTRICsOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+}
+
+public Properties execute(String module, String rpc, String version, String mode, GetNearRTRICsOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+}
+
+// Client for GetHealthCheck
+
+ public Properties execute(String module, String rpc, String version, String mode, GetHealthCheckOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetHealthCheckOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+ // Client for getPolicyTypes
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyTypesOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyTypesOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+ // Client for createPolicyType
+
+
+ public Properties execute(String module, String rpc, String version, String mode, CreatePolicyTypeOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, CreatePolicyTypeOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+ // Client for getPolicyType
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyTypeOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyTypeOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+ // Client for deletePolicyType
+
+ public Properties execute(String module, String rpc, String version, String mode, DeletePolicyTypeOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, DeletePolicyTypeOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+ // Client for getPolicyInstances
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyInstancesOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyInstancesOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+
+ // Client for createPolicyInstance
+
+ public Properties execute(String module, String rpc, String version, String mode, CreatePolicyInstanceOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, CreatePolicyInstanceOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+ // Client for getPolicyInstance
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyInstanceOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetPolicyInstanceOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+ // Client for deletePolicyInstance
+
+ public Properties execute(String module, String rpc, String version, String mode, DeletePolicyInstanceOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, DeletePolicyInstanceOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+ // Client for getStatus
+
+
+ public Properties execute(String module, String rpc, String version, String mode, GetStatusOutputBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, GetStatusOutputBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+ Properties localProp;
+ localProp = MdsalHelper.toProperties(parms, serviceData);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters passed to SLI");
+
+ for (Object key : localProp.keySet()) {
+ String parmName = (String) key;
+ String parmValue = localProp.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+
+ Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
+
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Parameters returned by SLI");
+
+ for (Object key : respProps.keySet()) {
+ String parmName = (String) key;
+ String parmValue = respProps.getProperty(parmName);
+
+ LOG.debug(parmName+" = "+parmValue);
+
+ }
+ }
+ if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
+ return respProps;
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return respProps;
+ }
+
+
+
+
+
+
+}
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java
new file mode 100644
index 000000000..cb4fa903d
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/a1Adapter/A1AdapterProvider.java
@@ -0,0 +1,880 @@
+/*-
+ * ============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=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.a1Adapter;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+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.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev191212.*;
+
+import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+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.
+ *
+ */
+public class A1AdapterProvider implements AutoCloseable, A1ADAPTERAPIService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(A1AdapterProvider.class);
+
+ private static final String APPLICATION_NAME = "a1Adapter-api";
+
+ private final ExecutorService executor;
+
+ protected DataBroker dataBroker;
+ protected NotificationPublishService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<A1ADAPTERAPIService> rpcRegistration;
+ private final A1AdapterClient A1AdapterClient;
+
+
+ public A1AdapterProvider(final DataBroker dataBroker,
+ final NotificationPublishService notificationPublishService,
+ final RpcProviderRegistry rpcProviderRegistry,
+ final A1AdapterClient A1AdapterClient) {
+
+ this.LOG.info( "Creating provider for {}", APPLICATION_NAME);
+ executor = Executors.newFixedThreadPool(1);
+ this.dataBroker = dataBroker;
+ this.notificationService = notificationPublishService;
+ this.rpcRegistry = rpcProviderRegistry;
+ this.A1AdapterClient = A1AdapterClient;
+ initialize();
+ }
+
+ public void initialize(){
+ LOG.info( "Initializing provider for {}", APPLICATION_NAME);
+ rpcRegistration = rpcRegistry.addRpcImplementation(A1ADAPTERAPIService.class, this);
+ LOG.info( "Initialization complete for {}", APPLICATION_NAME);
+ }
+
+ protected void initializeChild() {
+ //Override if you have custom initialization intelligence
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info( "Closing provider for {}", APPLICATION_NAME);
+ executor.shutdown();
+ rpcRegistration.close();
+ LOG.info( "Successfully closed provider for {}", APPLICATION_NAME);
+ }
+
+// RPC getNearRT-RICs
+
+@Override
+public ListenableFuture<RpcResult<GetNearRTRICsOutput>> getNearRTRICs(
+ GetNearRTRICsInput input) {
+ final String svcOperation = "getNearRT-RICs";
+
+ Properties parms = new Properties();
+ GetNearRTRICsOutputBuilder serviceDataBuilder = new GetNearRTRICsOutputBuilder();
+
+ LOG.info( "Reached RPC getNearRT-RICs");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetNearRTRICsOutput> rpcResult =
+ RpcResultBuilder.<GetNearRTRICsOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetNearRTRICsInputBuilder inputBuilder = new GetNearRTRICsInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetNearRTRICs " );
+ }
+
+ RpcResult<GetNearRTRICsOutput> rpcResult =
+ RpcResultBuilder.<GetNearRTRICsOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getNearRT-RICs ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+// RPC getHealthCheck
+
+ @Override
+ public ListenableFuture<RpcResult<GetHealthCheckOutput>> getHealthCheck(
+ GetHealthCheckInput input) {
+ final String svcOperation = "getHealthCheck";
+
+ Properties parms = new Properties();
+ GetHealthCheckOutputBuilder serviceDataBuilder = new GetHealthCheckOutputBuilder();
+
+ LOG.info( "Reached RPC getHealthCheck");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetHealthCheckOutput> rpcResult =
+ RpcResultBuilder.<GetHealthCheckOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetHealthCheck. " );
+ }
+
+ RpcResult<GetHealthCheckOutput> rpcResult =
+ RpcResultBuilder.<GetHealthCheckOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getHealthCheck ");
+
+ return Futures.immediateFuture(rpcResult);
+ }
+
+// RPC getPolicyTypes
+
+@Override
+public ListenableFuture<RpcResult<GetPolicyTypesOutput>> getPolicyTypes(
+ GetPolicyTypesInput input) {
+ final String svcOperation = "getPolicyTypes";
+
+ Properties parms = new Properties();
+ GetPolicyTypesOutputBuilder serviceDataBuilder = new GetPolicyTypesOutputBuilder();
+
+ LOG.info( "Reached RPC getPolicyTypes");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetPolicyTypesOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyTypesOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetPolicyTypes ");
+ }
+
+ RpcResult<GetPolicyTypesOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyTypesOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getPolicyTypes ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+// RPC createPolicyType
+
+@Override
+public ListenableFuture<RpcResult<CreatePolicyTypeOutput>> createPolicyType(
+ CreatePolicyTypeInput input) {
+ final String svcOperation = "createPolicyType";
+
+ Properties parms = new Properties();
+ CreatePolicyTypeOutputBuilder serviceDataBuilder = new CreatePolicyTypeOutputBuilder();
+
+ LOG.info( "Reached RPC createPolicyType");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<CreatePolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<CreatePolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for CreatePolicyType" );
+ }
+
+ RpcResult<CreatePolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<CreatePolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from createPolicyType ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+// RPC getPolicyType
+
+@Override
+public ListenableFuture<RpcResult<GetPolicyTypeOutput>> getPolicyType(
+ GetPolicyTypeInput input) {
+ final String svcOperation = "getPolicyType";
+
+ Properties parms = new Properties();
+ GetPolicyTypeOutputBuilder serviceDataBuilder = new GetPolicyTypeOutputBuilder();
+
+ LOG.info( "Reached RPC getPolicyType");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetPolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetPolicyType. " );
+ }
+
+ RpcResult<GetPolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getPolicyType ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+// RPC deletePolicyType
+
+@Override
+public ListenableFuture<RpcResult<DeletePolicyTypeOutput>> deletePolicyType(
+ DeletePolicyTypeInput input) {
+ final String svcOperation = "deletePolicyType";
+
+ Properties parms = new Properties();
+ DeletePolicyTypeOutputBuilder serviceDataBuilder = new DeletePolicyTypeOutputBuilder();
+
+ LOG.info( "Reached RPC deletePolicyType");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<DeletePolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<DeletePolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for DeletePolicyType ");
+ }
+
+ RpcResult<DeletePolicyTypeOutput> rpcResult =
+ RpcResultBuilder.<DeletePolicyTypeOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from deletePolicyType ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+// RPC getPolicyInstances
+
+@Override
+public ListenableFuture<RpcResult<GetPolicyInstancesOutput>> getPolicyInstances(
+ GetPolicyInstancesInput input) {
+ final String svcOperation = "getPolicyInstances";
+
+ Properties parms = new Properties();
+ GetPolicyInstancesOutputBuilder serviceDataBuilder = new GetPolicyInstancesOutputBuilder();
+
+ LOG.info( "Reached RPC getPolicyInstances");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetPolicyInstancesOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyInstancesOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetPolicyInstances " );
+ }
+
+ RpcResult<GetPolicyInstancesOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyInstancesOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getPolicyInstances ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+
+// RPC createPolicyInstance
+
+@Override
+public ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> createPolicyInstance(
+ CreatePolicyInstanceInput input) {
+ final String svcOperation = "createPolicyInstance";
+
+ Properties parms = new Properties();
+ CreatePolicyInstanceOutputBuilder serviceDataBuilder = new CreatePolicyInstanceOutputBuilder();
+
+ LOG.info( "Reached RPC createPolicyInstance");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<CreatePolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<CreatePolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for CreatePolicyInstance. " );
+ }
+
+ RpcResult<CreatePolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<CreatePolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from createPolicyInstance ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+
+
+// RPC getPolicyInstance
+
+@Override
+public ListenableFuture<RpcResult<GetPolicyInstanceOutput>> getPolicyInstance(
+ GetPolicyInstanceInput input) {
+ final String svcOperation = "getPolicyInstance";
+
+ Properties parms = new Properties();
+ GetPolicyInstanceOutputBuilder serviceDataBuilder = new GetPolicyInstanceOutputBuilder();
+
+ LOG.info( "Reached RPC getPolicyInstance");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetPolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetPolicyInstance. " );
+ }
+
+ RpcResult<GetPolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<GetPolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getPolicyInstance ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+
+
+// RPC deletePolicyInstance
+
+@Override
+public ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> deletePolicyInstance(
+ DeletePolicyInstanceInput input) {
+ final String svcOperation = "deletePolicyInstance";
+
+ Properties parms = new Properties();
+ DeletePolicyInstanceOutputBuilder serviceDataBuilder = new DeletePolicyInstanceOutputBuilder();
+
+ LOG.info( "Reached RPC deletePolicyInstance");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<DeletePolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<DeletePolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for DeletePolicyInstance. ");
+ }
+
+ RpcResult<DeletePolicyInstanceOutput> rpcResult =
+ RpcResultBuilder.<DeletePolicyInstanceOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from deletePolicyInstance ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+
+
+// RPC getStatus
+
+@Override
+public ListenableFuture<RpcResult<GetStatusOutput>> getStatus(
+ GetStatusInput input) {
+ final String svcOperation = "getStatus";
+
+ Properties parms = new Properties();
+ GetStatusOutputBuilder serviceDataBuilder = new GetStatusOutputBuilder();
+
+ LOG.info( "Reached RPC getStatus");
+
+ LOG.info( svcOperation +" called." );
+
+ if(input == null ) {
+ LOG.debug("exiting " +svcOperation+ " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<GetStatusOutput> rpcResult =
+ RpcResultBuilder.<GetStatusOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for "+svcOperation+" input: " + input);
+ GetStatusInputBuilder inputBuilder = new GetStatusInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ try
+ {
+ if (A1AdapterClient.hasGraph("A1-ADAPTER-API", svcOperation , null, "sync"))
+ {
+ LOG.info( "A1AdapterClient has a Directed Graph for '" + svcOperation + "'");
+ try
+ {
+ A1AdapterClient.execute("A1-ADAPTER-API", svcOperation, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception executing service logic for "+ svcOperation, e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+ } else {
+ LOG.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ serviceDataBuilder.setResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getResponseCode();
+
+ if (!("0".equals(errorCode) || "200".equals(errorCode))) {
+ LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'");
+ } else {
+ LOG.info("Returned SUCCESS for "+svcOperation+" ");
+ serviceDataBuilder.setResponseCode("A1 Adapter Executed for GetStatus. " );
+ }
+
+ RpcResult<GetStatusOutput> rpcResult =
+ RpcResultBuilder.<GetStatusOutput> status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from getStatus ");
+
+ return Futures.immediateFuture(rpcResult);
+}
+
+
+
+
+}
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/northbound/a1Adapter/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..271288442
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Copyright © ${copyrightYear} ${copyright} and others. All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available
+ at http://www.eclipse.org/legal/epl-v10.html -->
+
+<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" />
+
+ <bean id="client" class="org.onap.ccsdk.features.sdnr.northbound.a1Adapter.A1AdapterClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <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.features.sdnr.northbound.a1Adapter.A1AdapterProvider">
+ <argument ref="dataBroker" />
+ <argument ref="rpcRegistry" />
+ <argument ref="notificationService" />
+ <argument ref="client" />
+ </bean>
+
+</blueprint>
diff --git a/sdnr/northbound/a1Adapter/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/northbound/a1Adapter/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..271288442
--- /dev/null
+++ b/sdnr/northbound/a1Adapter/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Copyright © ${copyrightYear} ${copyright} and others. All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available
+ at http://www.eclipse.org/legal/epl-v10.html -->
+
+<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" />
+
+ <bean id="client" class="org.onap.ccsdk.features.sdnr.northbound.a1Adapter.A1AdapterClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <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.features.sdnr.northbound.a1Adapter.A1AdapterProvider">
+ <argument ref="dataBroker" />
+ <argument ref="rpcRegistry" />
+ <argument ref="notificationService" />
+ <argument ref="client" />
+ </bean>
+
+</blueprint>