aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/northbound/CMNotify
diff options
context:
space:
mode:
authorSandeep Shah <sandeeplinux1068@gmail.com>2020-03-02 10:31:48 -0600
committerSandeep Shah <sandeeplinux1068@gmail.com>2020-03-02 10:31:48 -0600
commit4fdab1fe391c2ecf3ea8bcb0fefb563ba8af042c (patch)
tree5f82e1a690f6600023a400ef899c49e47ea87016 /sdnr/northbound/CMNotify
parentc6f4d650f2652a30aa4d951459e294e37394c559 (diff)
ORAN CMNotify Karaf Feature Development
CMNotify Karaf feature development as part of SDNR meta-feature. This feature relates to receiving VES message for nbrListChangeNotification via DMAAP and making updates to RuntimeDB/ConfigDB Issue-ID: CCSDK-2130 Signed-off-by: SandeepLinux <Sandeep.Shah@ibm.com> Change-Id: Iad5f0bfe855986a202a264b50e1a0591c7015fce
Diffstat (limited to 'sdnr/northbound/CMNotify')
-rw-r--r--sdnr/northbound/CMNotify/feature/pom.xml49
-rw-r--r--sdnr/northbound/CMNotify/installer/pom.xml118
-rw-r--r--sdnr/northbound/CMNotify/installer/src/assembly/assemble_mvnrepo_zip.xml47
-rw-r--r--sdnr/northbound/CMNotify/model/pom.xml77
-rw-r--r--sdnr/northbound/CMNotify/model/src/main/yang/CM-NOTIFY-API.yang123
-rw-r--r--sdnr/northbound/CMNotify/pom.xml50
-rw-r--r--sdnr/northbound/CMNotify/provider/pom.xml195
-rw-r--r--sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClient.java100
-rw-r--r--sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyProvider.java176
-rw-r--r--sdnr/northbound/CMNotify/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml50
-rw-r--r--sdnr/northbound/CMNotify/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml50
-rw-r--r--sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClientTest.java85
-rw-r--r--sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/TestCMNotify.java105
13 files changed, 1225 insertions, 0 deletions
diff --git a/sdnr/northbound/CMNotify/feature/pom.xml b/sdnr/northbound/CMNotify/feature/pom.xml
new file mode 100644
index 000000000..b35521d60
--- /dev/null
+++ b/sdnr/northbound/CMNotify/feature/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>CMNotify-feature</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>feature</packaging>
+
+ <name>ccsdk-features :: sdnr-northbound :: ${project.artifactId}</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>CMNotify-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sdnr/northbound/CMNotify/installer/pom.xml b/sdnr/northbound/CMNotify/installer/pom.xml
new file mode 100644
index 000000000..b451b41b0
--- /dev/null
+++ b/sdnr/northbound/CMNotify/installer/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>CMNotify-installer</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-features :: sdnr-northbound :: ${project.artifactId}</name>
+
+ <properties>
+ <application.name>CMNotify</application.name>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</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>CMNotify-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>CMNotify-model,CMNotify-provider,CMNotify-feature</includeArtifactIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sdnr/northbound/CMNotify/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/northbound/CMNotify/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..dfe5060bf
--- /dev/null
+++ b/sdnr/northbound/CMNotify/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,47 @@
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2017-2020 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:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ 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/CMNotify/model/pom.xml b/sdnr/northbound/CMNotify/model/pom.xml
new file mode 100644
index 000000000..dd8641c46
--- /dev/null
+++ b/sdnr/northbound/CMNotify/model/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>CMNotify-model</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>ccsdk-features :: sdnr-northbound :: ${project.artifactId}</name>
+
+ <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/CMNotify/model/src/main/yang/CM-NOTIFY-API.yang b/sdnr/northbound/CMNotify/model/src/main/yang/CM-NOTIFY-API.yang
new file mode 100644
index 000000000..834dc71ec
--- /dev/null
+++ b/sdnr/northbound/CMNotify/model/src/main/yang/CM-NOTIFY-API.yang
@@ -0,0 +1,123 @@
+module CM-NOTIFY-API {
+
+ namespace "org:onap:ccsdk";
+
+ prefix cm-notify-api;
+
+ revision "2020-02-24" {
+ description
+ "CM Notification API";
+ }
+
+ grouping cm-notification-response {
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ description
+ "Response payload for CM Notify RPC's";
+ }
+
+ grouping x-0005b9-lte-g {
+ leaf phy-cell-id-in-use {
+ type uint64;
+ default 0;
+ }
+ leaf pnf-name {
+ type string {
+ length "0..256";
+ }
+ description
+ "PNF name ";
+ }
+ }
+
+ grouping lte-ran-neighbor-list-in-use-lte-cell-g {
+ description
+ "Table containing the LTE EUTRA (i.e. intra-RAT) cell list.";
+ leaf plmnid {
+ type string {
+ length "0..6";
+ }
+ description
+ "PLMN ID consists of Mobile Country Code (MCC) and Mobile Network Code (MNC) {{bibref|3GPP-TS.23.003}}, {{bibref|3GPP-TS.24.008}}. Mobile Country Code consists of three digits and uniquely identifies the country of domicile of the subscriber. Mobile Network Code consists of two or three digits and identifies the Home PLMN within a country. For a 2-digit MNC the total string length of {{param}} is 5.";
+ reference "BBF TR-196 2.0.3 full - FAPService.{i}.CellConfig.LTE.RAN.NeighborListInUse.LTECell.{i}.PLMNID";
+ }
+ leaf cid {
+ type string {
+ length "0..52";
+ }
+ description
+ "Cell Identity. {{bibref|3GPP-TS.36.331|Section 6.3.4}}. Combination of {{param|PLMNID}} and {{param}} constitutes the Cell Global ID (CGI).";
+ reference "BBF TR-196 2.0.3 full - FAPService.{i}.CellConfig.LTE.RAN.NeighborListInUse.LTECell.{i}.CID";
+ }
+
+ leaf phy-cell-id {
+ type uint64 {
+ range "0..503";
+ }
+ description
+ "Physical cell ID, as specified in {{bibref|3GPP-TS.36.211|Section 6.11}}.";
+ reference "BBF TR-196 2.0.3 full - FAPService.{i}.CellConfig.LTE.RAN.NeighborListInUse.LTECell.{i}.PhyCellID";
+ }
+ leaf pnf-name {
+ type string {
+ length "0..256";
+ }
+ description
+ "PNF name ";
+ }
+ leaf blacklisted {
+ type boolean;
+ description
+ "Indicates whether this neighbor cell is allowed for UEs as handover target or not. If {{true}}, handover is prohibited towards this cell. If {{false}}, handover is allowed toward this cell. The {{param}} parameter allows this cell to be prohibited as a handover target, while still allowing this cell to be included in the BCCH SIB4 or 5.";
+ reference "BBF TR-196 2.0.3 full - FAPService.{i}.CellConfig.LTE.RAN.NeighborListInUse.LTECell.{i}.Blacklisted";
+ }
+
+ reference "BBF TR-196 2.0.3 full - FAPService.{i}.CellConfig.LTE.RAN.NeighborListInUse.LTECell.{i}.";
+ }
+
+
+ rpc nbrlist-change-notification {
+ description
+ "RAN Neighbor List change notification to configure RuntimeDB";
+ input {
+ leaf fap-service-number-of-entries-changed {
+ type uint64;
+ description
+ "Number of cells for which neighbor list has changed";
+ }
+ list fap-service {
+ key "alias";
+ leaf alias {
+ type string {
+ length "1..64";
+ }
+ }
+ leaf cid {
+ type string {
+ length "0..52";
+ }
+ }
+ uses x-0005b9-lte-g;
+ leaf lte-cell-number-of-entries {
+ type uint64;
+ description
+ "Number of cells in a neighbor list that was changed";
+ }
+ list lte-ran-neighbor-list-in-use-lte-cell-changed {
+ key "plmnid cid";
+ uses lte-ran-neighbor-list-in-use-lte-cell-g;
+ description
+ "Changed/Modified List of cells in a neighbor list for this fap service";
+ }
+ }
+ }
+
+ output {
+ uses cm-notification-response;
+ }
+ }
+}
diff --git a/sdnr/northbound/CMNotify/pom.xml b/sdnr/northbound/CMNotify/pom.xml
new file mode 100644
index 000000000..f7afb7d94
--- /dev/null
+++ b/sdnr/northbound/CMNotify/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>CMNotify</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>ccsdk-features :: sdnr-northbound :: ${project.artifactId}</name>
+
+ <modules>
+ <module>model</module>
+ <module>feature</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+
+ <properties>
+ <feature-name>CMNotify</feature-name>
+ </properties>
+</project>
diff --git a/sdnr/northbound/CMNotify/provider/pom.xml b/sdnr/northbound/CMNotify/provider/pom.xml
new file mode 100644
index 000000000..a6a462987
--- /dev/null
+++ b/sdnr/northbound/CMNotify/provider/pom.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ ============LICENSE_START=======================================================
+ ~ ONAP : ccsdk features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.2-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.onap.ccsdk.features.sdnr.northbound</groupId>
+ <artifactId>CMNotify-provider</artifactId>
+ <version>0.7.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+
+ <name>ccsdk-features :: sdnr-northbound :: ${project.artifactId}</name>
+
+ <properties>
+ <ccsdk.sli.core.version>${project.version}</ccsdk.sli.core.version>
+ <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version>
+ </properties>
+
+ <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>CMNotify-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>
+-->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </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.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </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.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </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>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
diff --git a/sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClient.java b/sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClient.java
new file mode 100644
index 000000000..a098904fc
--- /dev/null
+++ b/sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClient.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.CMNotify;
+
+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.rev200224.NbrlistChangeNotificationOutputBuilder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CMNotifyClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CMNotifyClient.class);
+
+ private SvcLogicService svcLogicService = null;
+
+ public CMNotifyClient(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 NbrlistChangeNotification
+
+ public Properties execute(String module, String rpc, String version, String mode,
+ NbrlistChangeNotificationOutputBuilder 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,
+ NbrlistChangeNotificationOutputBuilder 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/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyProvider.java b/sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyProvider.java
new file mode 100644
index 000000000..083b82ee4
--- /dev/null
+++ b/sdnr/northbound/CMNotify/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyProvider.java
@@ -0,0 +1,176 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.features.sdnr.northbound.CMNotify;
+
+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.ccsdk.rev200224.CMNOTIFYAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutputBuilder;
+
+import org.opendaylight.yangtools.concepts.Builder;
+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 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 CMNotifyProvider implements AutoCloseable, CMNOTIFYAPIService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(CMNotifyProvider.class);
+
+ private static final String APPLICATION_NAME = "CMNotify-api";
+ private static final String NBRLIST_CHANGE_NOTIFICATION = "nbrlist-change-notification";
+
+
+ private final ExecutorService executor;
+ protected DataBroker dataBroker;
+ protected NotificationPublishService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<CMNOTIFYAPIService> rpcRegistration;
+ private final CMNotifyClient CMNotifyClient;
+
+ public CMNotifyProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService,
+ final RpcProviderRegistry rpcProviderRegistry, final CMNotifyClient CMNotifyClient) {
+
+ LOG.info("Creating provider for {}", APPLICATION_NAME);
+ executor = Executors.newFixedThreadPool(1);
+ this.dataBroker = dataBroker;
+ this.notificationService = notificationPublishService;
+ this.rpcRegistry = rpcProviderRegistry;
+ this.CMNotifyClient = CMNotifyClient;
+ initialize();
+ }
+
+ public void initialize() {
+ LOG.info("Initializing provider for {}", APPLICATION_NAME);
+ rpcRegistration = rpcRegistry.addRpcImplementation(CMNOTIFYAPIService.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 nbrlist-change-notification
+
+ @Override
+ public ListenableFuture<RpcResult<NbrlistChangeNotificationOutput>> nbrlistChangeNotification(NbrlistChangeNotificationInput input) {
+ final String svcOperation = "nbrlist-change-notification";
+
+ Properties parms = new Properties();
+ NbrlistChangeNotificationOutputBuilder serviceDataBuilder = (NbrlistChangeNotificationOutputBuilder) getServiceData(NBRLIST_CHANGE_NOTIFICATION);
+
+ LOG.info("Reached RPC nbrlist-change-notification");
+
+ LOG.info(svcOperation + " called.");
+
+ if (input == null) {
+ LOG.debug("exiting " + svcOperation + " because of invalid input");
+ serviceDataBuilder.setResponseCode("Input is null");
+ RpcResult<NbrlistChangeNotificationOutput> rpcResult =
+ RpcResultBuilder.<NbrlistChangeNotificationOutput>status(true).withResult(serviceDataBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // add input to parms
+ LOG.info("Adding INPUT data for " + svcOperation + " input: " + input);
+ NbrlistChangeNotificationInputBuilder inputBuilder = new NbrlistChangeNotificationInputBuilder(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 (CMNotifyClient.hasGraph("CM-NOTIFY-API", svcOperation, null, "sync")) {
+ LOG.info("CMNotifyClient has a Directed Graph for '" + svcOperation + "'");
+ try {
+ CMNotifyClient.execute("CM-NOTIFY-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 CMNotify: '" + 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.setResponseMessage("CM Notification Executed and RuntimeDB Updated. ");
+ }
+
+ RpcResult<NbrlistChangeNotificationOutput> rpcResult =
+ RpcResultBuilder.<NbrlistChangeNotificationOutput>status(true).withResult(serviceDataBuilder.build()).build();
+
+ LOG.info("Successful exit from nbrlist-change-notification ");
+
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ protected Builder<?> getServiceData(String svcOperation) {
+ switch (svcOperation) {
+ case NBRLIST_CHANGE_NOTIFICATION:
+ return new NbrlistChangeNotificationOutputBuilder();
+ }
+ return null;
+ }
+}
diff --git a/sdnr/northbound/CMNotify/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/northbound/CMNotify/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..2edb6a766
--- /dev/null
+++ b/sdnr/northbound/CMNotify/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 features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.sdnr.northbound.CMNotify.CMNotifyClient">
+ <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.CMNotify.CMNotifyProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+</blueprint>
diff --git a/sdnr/northbound/CMNotify/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/northbound/CMNotify/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml
new file mode 100644
index 000000000..2edb6a766
--- /dev/null
+++ b/sdnr/northbound/CMNotify/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 features
+ ~ ================================================================================
+ ~ Copyright (C) 2020 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=======================================================
+ ~
+ -->
+
+<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.sdnr.northbound.CMNotify.CMNotifyClient">
+ <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.CMNotify.CMNotifyProvider">
+ <argument ref="dataBroker"/>
+ <argument ref="rpcRegistry"/>
+ <argument ref="notificationService"/>
+ <argument ref="client"/>
+ </bean>
+
+</blueprint>
diff --git a/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClientTest.java b/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClientTest.java
new file mode 100644
index 000000000..06955838e
--- /dev/null
+++ b/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/CMNotifyClientTest.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.CMNotify;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+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.onap.ccsdk.features.sdnr.northbound.CMNotify.CMNotifyClient;
+
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutputBuilder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CMNotifyClientTest {
+
+ SvcLogicService mockSvcLogicService;
+ String module = "test-module";
+ String rpc = "test-rpc";
+ String version = "test-version";
+ String mode = "test-mode";
+ Properties localProp = new Properties();
+
+ @Before
+ public void setUp() throws Exception {
+ mockSvcLogicService = mock(SvcLogicService.class);
+ when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true);
+ }
+
+ @Test
+ public void testCMNotifyClientConstructor() {
+ CMNotifyClient CMNotifyClient = new CMNotifyClient(mockSvcLogicService);
+ assertNotNull(CMNotifyClient);
+ }
+
+ @Test
+ public void testHasGraph() throws SvcLogicException {
+ CMNotifyClient CMNotifyClient = new CMNotifyClient(mockSvcLogicService);
+ boolean result = CMNotifyClient.hasGraph(module, rpc, version, mode);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testExecuteSvcLogicStatusFailure() throws SvcLogicException {
+ NbrlistChangeNotificationOutputBuilder serviceData = mock(NbrlistChangeNotificationOutputBuilder.class);
+ Properties parms = mock(Properties.class);
+ SvcLogicService svcLogicService = mock(SvcLogicService.class);
+ Properties properties = new Properties();
+ properties.setProperty("SvcLogic.status", "failure");
+ when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties);
+ CMNotifyClient sliClient = new CMNotifyClient(svcLogicService);
+ Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties);
+ assertTrue(prop != null);
+ }
+}
diff --git a/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/TestCMNotify.java b/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/TestCMNotify.java
new file mode 100644
index 000000000..060d39949
--- /dev/null
+++ b/sdnr/northbound/CMNotify/provider/src/test/java/org/onap/ccsdk/features/sdnr/northbound/CMNotify/TestCMNotify.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.CMNotify;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.onap.ccsdk.features.sdnr.northbound.CMNotify.CMNotifyClient;
+import org.onap.ccsdk.features.sdnr.northbound.CMNotify.CMNotifyProvider;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+import java.math.*;
+
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev200224.NbrlistChangeNotificationOutputBuilder;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+
+
+public class TestCMNotify extends AbstractConcurrentDataBrokerTest {
+
+ private CMNotifyProvider cMNotifyProvider;
+ private static final Logger LOG = LoggerFactory.getLogger(CMNotifyProvider.class);
+
+ @Before
+ public void setUp() throws Exception {
+ if (null == cMNotifyProvider) {
+ DataBroker dataBroker = getDataBroker();
+ NotificationPublishService mockNotification = mock(NotificationPublishService.class);
+ RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class);
+ CMNotifyClient mockSliClient = mock(CMNotifyClient.class);
+ cMNotifyProvider = new CMNotifyProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
+ }
+ }
+
+ //Testcase should return error 503 when No service logic active for NbrlistChangeNotification
+ @Test
+ public void testNbrlistChangeNotification() {
+
+ NbrlistChangeNotificationInputBuilder inputBuilder = new NbrlistChangeNotificationInputBuilder();
+
+ inputBuilder.setFapServiceNumberOfEntriesChanged(new BigInteger("1"));
+
+ // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
+ ListenableFuture<RpcResult<NbrlistChangeNotificationOutput>> future = cMNotifyProvider
+ .nbrlistChangeNotification(inputBuilder.build());
+ RpcResult<NbrlistChangeNotificationOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("503", rpcResult.getResult().getResponseCode());
+ }
+
+ //Input parameter validation
+ @Test
+ public void testvValidation() {
+
+ ListenableFuture<RpcResult<NbrlistChangeNotificationOutput>> future = cMNotifyProvider
+ .nbrlistChangeNotification(null);
+ RpcResult<NbrlistChangeNotificationOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("Input is null", rpcResult.getResult().getResponseCode());
+ }
+}