summaryrefslogtreecommitdiffstats
path: root/a1-adapter/a1-adapter-api
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2020-08-06 10:19:33 +0100
committerLathish <lathishbabu.ganesan@est.tech>2020-08-13 22:29:47 +0100
commit5d0ad5f3d3158357183849ca329ac6999be6281d (patch)
treeafd019d339ef1e9f872d2e5fbb5b6cbafb97038d /a1-adapter/a1-adapter-api
parent0e3740a9011f59e18b0e65230d1ba61ec6ab8ba6 (diff)
Initial A1 adapter api implmentation
Issue-ID: CCSDK-2604 Change-Id: If946b4f0cc92410e6b903928fd9cb2fd79996dc3 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
Diffstat (limited to 'a1-adapter/a1-adapter-api')
-rw-r--r--a1-adapter/a1-adapter-api/feature/.gitignore1
-rw-r--r--a1-adapter/a1-adapter-api/feature/pom.xml48
-rw-r--r--a1-adapter/a1-adapter-api/installer/pom.xml78
-rw-r--r--a1-adapter/a1-adapter-api/model/pom.xml2
-rw-r--r--a1-adapter/a1-adapter-api/pom.xml3
-rw-r--r--a1-adapter/a1-adapter-api/provider/pom.xml9
-rw-r--r--a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterClient.java75
-rw-r--r--a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProvider.java174
-rw-r--r--a1-adapter/a1-adapter-api/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml50
-rw-r--r--a1-adapter/a1-adapter-api/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml50
-rw-r--r--a1-adapter/a1-adapter-api/provider/src/test/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProviderTest.java101
11 files changed, 585 insertions, 6 deletions
diff --git a/a1-adapter/a1-adapter-api/feature/.gitignore b/a1-adapter/a1-adapter-api/feature/.gitignore
new file mode 100644
index 00000000..eacf31a6
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/feature/.gitignore
@@ -0,0 +1 @@
+/target-ide/
diff --git a/a1-adapter/a1-adapter-api/feature/pom.xml b/a1-adapter/a1-adapter-api/feature/pom.xml
new file mode 100644
index 00000000..cc4c681e
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/feature/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk oran
+ ~ ================================================================================
+ ~ Copyright (C) 2020 Nordix Foundation. 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=======================================================
+ ~
+-->
+<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>2.0.1-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.oran</groupId>
+ <artifactId>a1-adapter-feature</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name>ccsdk-oran :: ${project.artifactId}</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>a1-adapter-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/a1-adapter/a1-adapter-api/installer/pom.xml b/a1-adapter/a1-adapter-api/installer/pom.xml
index 22b4e9e1..2e55f7d1 100644
--- a/a1-adapter/a1-adapter-api/installer/pom.xml
+++ b/a1-adapter/a1-adapter-api/installer/pom.xml
@@ -19,14 +19,13 @@
~ ============LICENSE_END=======================================================
~
-->
-
<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.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -42,4 +41,77 @@
<include.transitive.dependencies>false</include.transitive.dependencies>
</properties>
-</project>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.oran</groupId>
+ <artifactId>${application.name}-feature</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>a1-adapter-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>a1-adapter-model,a1-adapter-provider,a1-adapter-feature</includeArtifactIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/a1-adapter/a1-adapter-api/model/pom.xml b/a1-adapter/a1-adapter-api/model/pom.xml
index 3c90faff..7aa386e5 100644
--- a/a1-adapter/a1-adapter-api/model/pom.xml
+++ b/a1-adapter/a1-adapter-api/model/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<relativePath />
</parent>
<groupId>org.onap.ccsdk.oran</groupId>
diff --git a/a1-adapter/a1-adapter-api/pom.xml b/a1-adapter/a1-adapter-api/pom.xml
index 122d2956..c1176eb2 100644
--- a/a1-adapter/a1-adapter-api/pom.xml
+++ b/a1-adapter/a1-adapter-api/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<relativePath />
</parent>
<groupId>org.onap.ccsdk.oran</groupId>
@@ -38,6 +38,7 @@
<modules>
<module>model</module>
<module>provider</module>
+ <module>feature</module>
<module>installer</module>
</modules>
<build>
diff --git a/a1-adapter/a1-adapter-api/provider/pom.xml b/a1-adapter/a1-adapter-api/provider/pom.xml
index bf7ae330..8f1d94e8 100644
--- a/a1-adapter/a1-adapter-api/provider/pom.xml
+++ b/a1-adapter/a1-adapter-api/provider/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.ccsdk.parent</groupId>
<artifactId>binding-parent</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.0.1-SNAPSHOT</version>
<relativePath/>
</parent>
@@ -135,6 +135,13 @@
</lifecycleMappingMetadata>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <source>8</source>
+ </configuration>
+ </plugin>
</plugins>
</pluginManagement>
</build>
diff --git a/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterClient.java b/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterClient.java
new file mode 100644
index 00000000..fb21de4c
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterClient.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.a1.adapter;
+
+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.a1.adapter.rev200122.GetA1PolicyTypeOutputBuilder;
+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);
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode,
+ GetA1PolicyTypeOutputBuilder 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/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProvider.java b/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProvider.java
new file mode 100644
index 00000000..a1b9ef92
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/provider/src/main/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProvider.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.a1.adapter;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+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.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.A1ADAPTERAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.DeleteA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.DeleteA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyStatusInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyStatusOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.PutA1PolicyInput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.PutA1PolicyOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Defines a base implementation for your provider. This class overrides the generated interface
+ * from the YANG model and implements the request model for the A1 interface. This class identifies
+ * the Near-RT RIC throught the IP passed over the payload and calls the corresponding Near-RT RIC
+ * over Rest API
+ *
+ * <pre>
+ *
+ */
+@SuppressWarnings("squid:S1874") // "@Deprecated" code should not be used
+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) {
+
+ 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);
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<DeleteA1PolicyOutput>> deleteA1Policy(
+ DeleteA1PolicyInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetA1PolicyOutput>> getA1Policy(GetA1PolicyInput input) {
+ log.info("Start of getA1Policy");
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetA1PolicyStatusOutput>> getA1PolicyStatus(
+ GetA1PolicyStatusInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetA1PolicyTypeOutput>> getA1PolicyType(
+ GetA1PolicyTypeInput input) {
+ log.info("Start of getA1PolicyType");
+ final String svcOperation = "getA1PolicyType";
+ Properties parms = new Properties();
+ GetA1PolicyTypeOutputBuilder policyTypeResponse = new GetA1PolicyTypeOutputBuilder();
+ // add input to parms
+ log.info("Adding INPUT data for " + svcOperation + " input: " + input);
+ GetA1PolicyTypeInputBuilder inputBuilder = new GetA1PolicyTypeInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+ log.info("Printing SLI parameters to be passed");
+ // iterate properties file to get key-value pairs
+ for (String key : parms.stringPropertyNames()) {
+ String value = parms.getProperty(key);
+ log.info("The SLI parameter in " + key + " is: " + value);
+ }
+ // 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", policyTypeResponse,
+ parms);
+ policyTypeResponse.setHttpStatus(200);
+ } catch (Exception e) {
+ log.error("Caught exception executing service logic for " + svcOperation, e);
+ policyTypeResponse.setHttpStatus(500);
+ }
+ } else {
+ log.error("No service logic active for A1Adapter: '" + svcOperation + "'");
+ policyTypeResponse.setHttpStatus(503);
+ }
+ } catch (Exception e) {
+ log.error("Caught exception looking for service logic", e);
+ policyTypeResponse.setHttpStatus(500);
+ }
+ RpcResult<GetA1PolicyTypeOutput> rpcResult = RpcResultBuilder
+ .<GetA1PolicyTypeOutput>status(true).withResult(policyTypeResponse.build()).build();
+ log.info("End of getA1PolicyType");
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<PutA1PolicyOutput>> putA1Policy(PutA1PolicyInput input) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/a1-adapter/a1-adapter-api/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/a1-adapter/a1-adapter-api/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
new file mode 100644
index 00000000..29403607
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk oran
+ ~ ================================================================================
+ ~ Copyright (C) 2020 Nordix Foundation. 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=======================================================
+ ~
+-->
+
+<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns="http://www.osgi.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.a1.adapter.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.a1.adapter.A1AdapterProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+</blueprint>
diff --git a/a1-adapter/a1-adapter-api/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/a1-adapter/a1-adapter-api/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644
index 00000000..29403607
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk oran
+ ~ ================================================================================
+ ~ Copyright (C) 2020 Nordix Foundation. 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=======================================================
+ ~
+-->
+
+<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns="http://www.osgi.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.a1.adapter.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.a1.adapter.A1AdapterProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+</blueprint>
diff --git a/a1-adapter/a1-adapter-api/provider/src/test/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProviderTest.java b/a1-adapter/a1-adapter-api/provider/src/test/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProviderTest.java
new file mode 100644
index 00000000..901bc008
--- /dev/null
+++ b/a1-adapter/a1-adapter-api/provider/src/test/java/org/onap/ccsdk/features/a1/adapter/A1AdapterProviderTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.a1.adapter;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+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.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeOutput;
+import org.opendaylight.yang.gen.v1.org.onap.a1.adapter.rev200122.GetA1PolicyTypeOutputBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class Tests all the methods in A1AdapterProvider
+ *
+ */
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class A1AdapterProviderTest {
+
+ protected static final Logger LOG = LoggerFactory.getLogger(A1AdapterProviderTest.class);
+
+ class A1AdapterProviderMock extends A1AdapterProvider {
+
+ A1AdapterProviderMock(final DataBroker dataBroker,
+ final NotificationPublishService notificationPublishService,
+ final RpcProviderRegistry rpcProviderRegistry, final A1AdapterClient A1AdapterClient) {
+ super(dataBroker, mockNotificationPublishService, mockRpcProviderRegistry, a1AdapterClient);
+ }
+
+ }
+
+ private A1AdapterProviderMock a1AdapterProviderMock = null;
+ @Mock
+ private DataBroker dataBroker;
+ @Mock
+ private NotificationPublishService mockNotificationPublishService;
+ @Mock
+ private RpcProviderRegistry mockRpcProviderRegistry;
+ @Mock
+ private A1AdapterClient a1AdapterClient;
+ private static String module = "A1-ADAPTER-API";
+ private static String mode = "sync";
+
+ @Before
+ public void setUp() throws Exception {
+
+ a1AdapterProviderMock = new A1AdapterProviderMock(dataBroker, mockNotificationPublishService,
+ mockRpcProviderRegistry, a1AdapterClient);
+ a1AdapterProviderMock = Mockito.spy(a1AdapterProviderMock);
+
+ }
+
+ @Test
+ public void test_getA1PolicyType()
+ throws SvcLogicException, InterruptedException, ExecutionException {
+ String rpc = "getA1PolicyType";
+ Properties respProps = new Properties();
+ GetA1PolicyTypeInputBuilder inputBuilder = new GetA1PolicyTypeInputBuilder();
+ when(a1AdapterClient.hasGraph(module, rpc, null, mode)).thenReturn(true);
+ when(a1AdapterClient.execute(eq(module), eq(rpc), eq(null), eq(mode),
+ any(GetA1PolicyTypeOutputBuilder.class), any(Properties.class))).thenReturn(respProps);
+ ListenableFuture<RpcResult<GetA1PolicyTypeOutput>> result =
+ a1AdapterProviderMock.getA1PolicyType(inputBuilder.build());
+ assertEquals("200", String.valueOf(result.get().getResult().getHttpStatus()));
+ }
+}