summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ANR-App/Dockerfile12
-rw-r--r--ANR-App/README.md11
-rw-r--r--ANR-App/config/RanInputMSG.txt34
-rw-r--r--ANR-App/config/RanOutputMSG.txt59
-rw-r--r--ANR-App/config/application.properties14
-rw-r--r--ANR-App/docker-compose.yml16
-rw-r--r--ANR-App/pom.xml140
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java33
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/controller/A1Controller_OSC_2_1_0.java59
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java28
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java22
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/client/KafkaClientRanappTopic.java100
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/listener/RanAppEventConsumer.java169
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANRInputMessage.java57
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANROutputMessage.java26
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Aai.java65
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/AppDescriptorKafkaTemplate.java29
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/CellConfig.java31
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Common.java31
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Configuration.java31
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Data.java42
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/FAPService.java43
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTE.java31
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTECell.java66
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/NeighborListInUse.java44
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Neighbour.java75
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Payload.java86
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PayloadOutput.java32
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicyData.java76
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicytypetoTopicMapping.java31
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/RAN.java43
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ResponsetoA1.java30
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java44
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java54
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java44
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java19
-rw-r--r--ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java234
-rw-r--r--ANR-App/src/test/java/org/onap/ranwebclient/webclient/WebclientApplicationTests.java9
38 files changed, 1970 insertions, 0 deletions
diff --git a/ANR-App/Dockerfile b/ANR-App/Dockerfile
new file mode 100644
index 0000000..0a8c056
--- /dev/null
+++ b/ANR-App/Dockerfile
@@ -0,0 +1,12 @@
+FROM openjdk:16-jdk-alpine
+RUN apk update
+RUN apk add vim
+RUN apk add curl
+EXPOSE 9091
+RUN mkdir -p /var/opt/ranapp/config
+RUN chmod -R 777 /var/opt/ranapp
+WORKDIR /var/opt/ranapp
+ADD config/application.properties /var/opt/ranapp/config/application.properties
+RUN chmod -R 777 /var/opt/ranapp/config/
+COPY target/ranapp-0.0.1-SNAPSHOT.jar /var/opt/ranapp/ranapp-0.0.1-SNAPSHOT.jar
+ENTRYPOINT ["java","-jar","ranapp-0.0.1-SNAPSHOT.jar"]
diff --git a/ANR-App/README.md b/ANR-App/README.md
new file mode 100644
index 0000000..a2bb5f8
--- /dev/null
+++ b/ANR-App/README.md
@@ -0,0 +1,11 @@
+RAN App - abstraction of xApp functionality
+A new RAN App module in RAN-Sim is an abstraction of the function provided by an xApp to support A1-based actions. For Kohn release, RAN App will provide the following functions to support A1-based action for the ANR SON use case:
+1.Receive A1 policy message over Kafka bus from A1 Termination
+2.Communicate via websocket with RAN-Sim Controller to control the CU/DU NF in the Honeycomb NF modules, to achieve an end result similar to what an xApp would have done over E2.
+For Kohn release, the A1 message received has handover (HO) related kpis and RAN App will effect a change in the configuration of the NR Cell Relation property in the appropriate CU(s).
+Installation:
+1. to build a new ran app.
+ mvn clean install -Dcheckstyle.skip -Dmaven.test.skip=true -Dmaven.javadoc.skip=true
+2. to build and run a new ran app container
+ mvn clean install -Dcheckstyle.skip -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -P docker
+ docker-compose up -d
diff --git a/ANR-App/config/RanInputMSG.txt b/ANR-App/config/RanInputMSG.txt
new file mode 100644
index 0000000..befc04c
--- /dev/null
+++ b/ANR-App/config/RanInputMSG.txt
@@ -0,0 +1,34 @@
+{"closedLoopControlName":"ControlLoop-vSONH-7d4baf04-8875-4d1f-946d-06b874048b61","closedLoopAlarmStart":1606805921693,"closedLoopEventClient":"microservice.PCI","closedLoopEventStatus":"ONSET","target":"pnf.pnf-name","from":"PCIMS","version":"1.0.2","policyName":"PCI","policyVersion":"1.0.2","target_type":"PNF","requestID":"82feb01e-4f3e-40e2-b8df-683adabae893","AAI":{"generic-vnf.prov-status":"ACTIVE","generic-vnf.is-closed-loop-disabled":"false","pnf.pnf-name":"ncserver1"},
+"Action":"CreateA1Policy",
+"payload":{"action":"CreatePolicy","policy_id":1,"policy_type_id":1,"ric_id":"ric1",
+"policy_data":{"PNFName":"ncserver1","PLMNID":"ran-1","CellID":"Chn0014","neighbours":[{"PNFName":"ncserver1","PLMNID":"ran-1","CellID":"Chn0000","ho-kpi1":100},
+{"PNFName":"ncserver1","PLMNID":"ran-1","CellID":"Chn0001","ho-kpi1":90}]}}}
+{"action": "CreatePolicy/DeletePolicy/GetPolicyStatus/..","payload":{"action":"CreatePolicy","policy_id":1,"policy_type_id":1,"ric_id":"22","policy_data":{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"15549","neighbours":[{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"14427","ho-kpi1":100},{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"15548","ho-kpi1":90}]}},"policy_type_id":"String / {"name":"","version":"")","policy_id": "string(unique id)"}
+{"action": "CreatePolicy/DeletePolicy/GetPolicyStatus/..","payload":{"action":"CreatePolicy","policy_id":1,"policy_type_id":1,"ric_id":"22","policy_data":{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"15549","neighbours":[{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"14427","ho-kpi1":100},{"PNFName":"cucpserver2","PLMNID":"ran-1","CellID":"15548","ho-kpi1":90}]}},"policy_type_id":"String","policy_id": "string(unique id)"}
+{
+ "action": "CreatePolicy/DeletePolicy/GetPolicyStatus/..",
+ "payload": {
+ "action": "CreatePolicy",
+ "policy_id": 1,
+ "policy_type_id": 1,
+ "ric_id": "22",
+ "policy_data": {
+ "PNFName": "cucpserver2",
+ "PLMNID": "ran-1",
+ "CellID": "15549",
+ "neighbours": [{
+ "PNFName": "cucpserver2",
+ "PLMNID": "ran-1",
+ "CellID": "14427",
+ "ho-kpi1": 100
+ }, {
+ "PNFName": "cucpserver2",
+ "PLMNID": "ran-1",
+ "CellID": "15548",
+ "ho-kpi1": 90
+ }]
+ }
+ },
+ "policy_type_id": "String",
+ "policy_id": "string(unique id)"
+}
diff --git a/ANR-App/config/RanOutputMSG.txt b/ANR-App/config/RanOutputMSG.txt
new file mode 100644
index 0000000..8c9b4ef
--- /dev/null
+++ b/ANR-App/config/RanOutputMSG.txt
@@ -0,0 +1,59 @@
+{
+ "closedLoopControlName":"ControlLoop-vSONH-7d4baf04-8875-4d1f-946d-06b874048b61",
+ "closedLoopAlarmStart":1606805921693,
+ "closedLoopEventClient":"microservice.PCI",
+ "closedLoopEventStatus":"ONSET",
+ "target":"pnf.pnf-name",
+ "from":"PCIMS",
+ "version":"1.0.2",
+ "policyName":"PCI",
+ "policyVersion":"1.0.2",
+ "payload":{
+ "Configurations":[
+ {
+ "data":{
+ "ric_id": "ric1",
+ "FAPService":{
+ "alias":"Chn0014",
+ "CellConfig":{
+ "LTE":{
+ "RAN":{
+ "Common":{
+ "CellIdentity":"Chn0014"
+ },
+ "NeighborListInUse":{
+ "LTECell":[
+ {
+ "PNFName":"ncserver1",
+ "PLMNID":"ran-1",
+ "CID":"Chn0000",
+ "PhyCellID":0,
+ "isHOAllowed":"true"
+ },
+ {
+ "PNFName":"ncserver1",
+ "PLMNID":"ran-1",
+ "CID":"Chn0001",
+ "PhyCellID":0,
+ "isHOAllowed":"true"
+ }
+ ],
+ "LTECellNumberOfEntries":"2"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "target_type":"PNF",
+ "requestID":"82feb01e-4f3e-40e2-b8df-683adabae893",
+ "AAI":{
+ "generic-vnf.prov-status":"ACTIVE",
+ "generic-vnf.is-closed-loop-disabled":"false",
+ "pnf.pnf-name":"ncserver1"
+ },
+ "Action":"ModifyConfigANR"
+} \ No newline at end of file
diff --git a/ANR-App/config/application.properties b/ANR-App/config/application.properties
new file mode 100644
index 0000000..947987e
--- /dev/null
+++ b/ANR-App/config/application.properties
@@ -0,0 +1,14 @@
+server.port=9091
+kafka.bootstrapAddress=localhost:9092
+spring.kafka.producer.bootstrap-servers=localhost:9092
+spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
+spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
+ranapp.testing.topic.name=xapptest-topic
+ranapp.testing.topic.id=group1
+restapi.version=v1
+websocketserver.address=43.204.239.187:8081
+websocketserver.endpoint=/ransim/RansimAgent/ANR-xAPP:9091
+ranapp.name=ANR-RanAPP:9091
+ranapp.policytype=ANR
+ranapp.hokpi1_threshold=100
+kafkadispatcher.url=http://localhost:7075/policytypetotopicmapping/
diff --git a/ANR-App/docker-compose.yml b/ANR-App/docker-compose.yml
new file mode 100644
index 0000000..fd6d85f
--- /dev/null
+++ b/ANR-App/docker-compose.yml
@@ -0,0 +1,16 @@
+version: '2'
+networks:
+ default:
+ driver: bridge
+ driver_opts:
+ com.docker.network.driver.mtu: 1400
+services:
+ ranapp:
+ image: 'onap/anr-ranapp:0.0.1-SNAPSHOT'
+ container_name: ranapp
+ hostname: ranapp
+ ports:
+ - '9091:9091'
+ command: ranapp
+ volumes:
+ - '/var/opt/ranapp/config/application.properties:/tmp/ranapp-install/config/application.properties'
diff --git a/ANR-App/pom.xml b/ANR-App/pom.xml
new file mode 100644
index 0000000..7006923
--- /dev/null
+++ b/ANR-App/pom.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>2.6.4</version>
+ <relativePath /> <!-- lookup parent from repository -->
+ </parent>
+ <groupId>org.onap.ranwebclient</groupId>
+ <artifactId>ranapp</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>ranapp</name>
+ <description>ranapp project on spring boot for creating websocket client and netconf client</description>
+ <properties>
+ <!--<java.version>16</java.version> -->
+ <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
+ <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
+ <!--docker -->
+ <docker.tag>${project.version}</docker.tag>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-websocket</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.kafka</groupId>
+ <artifactId>spring-kafka</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <scope>runtime</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.projectreactor</groupId>
+ <artifactId>reactor-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- https://mvnrepository.com/artifact/org.json/json -->
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20200518</version>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>docker</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.28.0</version>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <images>
+ <image>
+ <name>onap/anr-ranapp:${docker.tag}</name>
+ <build>
+ <cleanup>true</cleanup>
+ <dockerFileDir>${project.basedir}</dockerFileDir>
+ <args>
+ <PKG_FILENAME>${project.build.finalName}.${project.packaging}</PKG_FILENAME>
+ </args>
+ </build>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <configuration>
+ <removeMode>all</removeMode>
+ </configuration>
+ </execution>
+ <execution>
+ <id>generate-images</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>push-images</id>
+ <phase>deploy</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ </exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java b/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java
new file mode 100644
index 0000000..e63c141
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java
@@ -0,0 +1,33 @@
+package org.onap.ranapp;
+import org.springframework.context.ApplicationContext;
+import org.onap.ranapp.kafka.client.KafkaClientRanappTopic;
+import org.onap.ranapp.websocket.WebsocketClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+@SpringBootApplication
+public class WebclientApplication {
+ @Autowired
+ private WebsocketClient websocketClient;
+
+ @Autowired
+ private KafkaClientRanappTopic kafkaclient;
+ public static void main(String[] args) {
+ SpringApplication.run(WebclientApplication.class, args);
+
+ }
+ /*
+ *Starts the Websocket client service. @param ctx the
+ * application context. // * // * @return the command line runner for the
+ * Websocket client. //
+ */
+ @Bean public CommandLineRunner websocketClientRunner(ApplicationContext ctx) {
+ return args -> websocketClient.start();
+ }
+ @Bean
+ public CommandLineRunner policytopicKafkaClientRunner(ApplicationContext ctx) {
+ return args -> kafkaclient.getRanApp_KafkaTopicnames();
+ }
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/controller/A1Controller_OSC_2_1_0.java b/ANR-App/src/main/java/org/onap/ranapp/controller/A1Controller_OSC_2_1_0.java
new file mode 100644
index 0000000..1fa8f07
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/controller/A1Controller_OSC_2_1_0.java
@@ -0,0 +1,59 @@
+package org.onap.ranapp.controller;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import org.springframework.http.ResponseEntity;
+import org.springframework.messaging.simp.SimpMessagingTemplate;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+/**
+ * A1 interface facade
+ * Only operations defined by OSC_2.1.0 should be provided here
+ */
+@RestController
+@RequestMapping({"${restapi.version}/a1-p"})
+public class A1Controller_OSC_2_1_0 {
+ @GetMapping(value = "/healthcheck")
+ public ResponseEntity<String> healthcheck() throws URISyntaxException {
+ return null;
+ }
+ @PutMapping(value = "/policytypes/{policyTypeId}")
+ public ResponseEntity<String> putPolicySchema(@PathVariable Integer policyTypeId, @RequestBody String body)
+ throws URISyntaxException {
+ return null;
+ }
+ @PutMapping(value = "/policytypes/{policyTypeId}/policies/{policyInstanceId}")
+ public ResponseEntity<String> putPolicyInstance(@PathVariable Integer policyTypeId,
+ @PathVariable String policyInstanceId, @RequestBody String body) throws URISyntaxException {
+ return null;
+ }
+ @DeleteMapping(value = "/policytypes/{policyTypeId}/policies/{policyInstanceId}")
+ public ResponseEntity<String> deletePolicyInstance(@PathVariable Integer policyTypeId,
+ @PathVariable String policyInstanceId) throws URISyntaxException {
+ return null;
+ }
+ @GetMapping(value = "/policytypes")
+ public ResponseEntity<String> getPolicyTypeIds() throws URISyntaxException {
+ return null;
+ }
+ @GetMapping(value = "/policytypes/{policyTypeId}")
+ public ResponseEntity<String> getPolicyType(@PathVariable Integer policyTypeId) throws URISyntaxException {
+ return null;
+ }
+ @GetMapping(value = "/policytypes/{policyTypeId}/policies")
+ public ResponseEntity<String> getPolicyIdsOfType(@PathVariable Integer policyTypeId)
+ throws URISyntaxException, IOException {
+ return null;
+ }
+ @GetMapping(value = "/policytypes/{policyTypeId}/policies/{policyInstanceId}")
+ public ResponseEntity<String> getPolicy(@PathVariable Integer policyTypeId, @PathVariable String policyInstanceId)
+ throws URISyntaxException {
+ return null;
+ }
+
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java
new file mode 100644
index 0000000..e3907a5
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * 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
+ */
+package org.onap.ranapp.data;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+@Data
+@AllArgsConstructor
+public class PolicyNotification {
+ private String id;
+ private Integer typeId;
+ private PolicyNotificationActionEnum action;
+ private String content;
+ public PolicyNotification(String id, Integer typeId, PolicyNotificationActionEnum action) {
+ this.id = id;
+ this.typeId = typeId;
+ this.action = action;
+ }
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java
new file mode 100644
index 0000000..e77a4ad
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2021 Samsung Electronics
+ * 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
+ */
+package org.onap.ranapp.data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+@JsonFormat(shape = JsonFormat.Shape.OBJECT)
+public enum PolicyNotificationActionEnum {
+ CREATED("CREATED"), DELETED("DELETED");
+ public final String value;
+ PolicyNotificationActionEnum(String stateName) {
+ this.value = stateName;
+ }
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/client/KafkaClientRanappTopic.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/client/KafkaClientRanappTopic.java
new file mode 100644
index 0000000..e80b8e1
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/client/KafkaClientRanappTopic.java
@@ -0,0 +1,100 @@
+package org.onap.ranapp.kafka.client;
+import java.util.Arrays;
+import java.util.Properties;
+import org.apache.kafka.clients.consumer.ConsumerConfig;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.common.serialization.StringDeserializer;
+import org.onap.ranapp.kafka.listener.RanAppEventConsumer;
+import org.onap.ranapp.kafka.model.appmodels.PolicytypetoTopicMapping;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.http.ResponseEntity;
+import org.springframework.retry.backoff.FixedBackOffPolicy;
+import org.springframework.retry.policy.SimpleRetryPolicy;
+import org.springframework.retry.support.RetryTemplate;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+import lombok.AccessLevel;
+import lombok.Getter;
+import reactor.core.Disposable;
+@Component
+public class KafkaClientRanappTopic {
+
+ private static final Logger logger = LoggerFactory.getLogger(KafkaClientRanappTopic.class);
+
+ @Value("${kafkadispatcher.url}")
+ private String kafkaclient_url;
+ @Value("${ranapp.policytype}")
+ private String policytype_name;
+
+ @Value(value = "${kafka.bootstrapAddress}")
+ private String bootstrapAddress;
+ @Value(value = "${ranapp.testing.topic.id}")
+ private String groupId;
+
+ public static String requestTopicName = "";
+
+ public static String responseTopicName = "";
+
+ @Getter(AccessLevel.PROTECTED)
+ private Disposable refreshTask = null;
+
+ @Autowired
+ RanAppEventConsumer ranappeventconsumer;
+
+ private RestTemplate restTemplate = new RestTemplate();
+
+ @Bean
+ public RetryTemplate retryTemplate() {
+ int maxAttempt = Integer.parseInt("10");
+ int retryTimeInterval = Integer.parseInt("5000");
+ SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
+ retryPolicy.setMaxAttempts(maxAttempt);
+ FixedBackOffPolicy backOffPolicy = new FixedBackOffPolicy();
+ backOffPolicy.setBackOffPeriod(retryTimeInterval); // 1.5 seconds
+ RetryTemplate template = new RetryTemplate();
+ template.setRetryPolicy(retryPolicy);
+ template.setBackOffPolicy(backOffPolicy);
+ return template;
+ }
+
+ public void getRanApp_KafkaTopicnames() {
+ logger.info("Requesting for KafkaTopics");
+ stop();
+ refreshTask=retryTemplate().execute(context -> {
+ String url = kafkaclient_url + policytype_name ;
+ System.out.println("retrying Connection: "+url);
+
+
+ ResponseEntity<PolicytypetoTopicMapping> requestData = restTemplate.getForEntity(url, PolicytypetoTopicMapping.class);
+ PolicytypetoTopicMapping policytoTopicMapping=requestData.getBody();
+ requestTopicName=policytoTopicMapping.getRequest_topic();
+ responseTopicName=policytoTopicMapping.getResponse_topic();
+ logger.info("Request Topic for Policy "+ policytype_name +" "+ requestTopicName);
+ logger.info("Response Topic for Policy "+ policytype_name +" "+ responseTopicName);
+
+ Properties properties=new Properties();
+ properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,bootstrapAddress);
+ properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
+ properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,StringDeserializer.class.getName());
+ properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG,groupId);
+ properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"earliest");
+ //creating consumer
+ KafkaConsumer<String,String> consumer= new KafkaConsumer<String,String>(properties);
+ //Subscribing
+ consumer.subscribe(Arrays.asList(requestTopicName));
+ ranappeventconsumer.consume(consumer,requestTopicName,responseTopicName);
+ logger.info("Response ..."+ requestData);
+ throw new IllegalStateException("Something went wrong");
+ });
+ }
+
+ public void stop() {
+ if (refreshTask != null) {
+ refreshTask.dispose();
+ }
+ }
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/listener/RanAppEventConsumer.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/listener/RanAppEventConsumer.java
new file mode 100644
index 0000000..037dd54
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/listener/RanAppEventConsumer.java
@@ -0,0 +1,169 @@
+package org.onap.ranapp.kafka.listener;
+import java.time.Duration;
+import java.util.LinkedList;
+import java.util.List;
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.json.JSONObject;
+import org.onap.ranapp.kafka.model.appmodels.ANRInputMessage;
+import org.onap.ranapp.kafka.model.appmodels.ANROutputMessage;
+import org.onap.ranapp.kafka.model.appmodels.CellConfig;
+import org.onap.ranapp.kafka.model.appmodels.Common;
+import org.onap.ranapp.kafka.model.appmodels.Configuration;
+import org.onap.ranapp.kafka.model.appmodels.Data;
+import org.onap.ranapp.kafka.model.appmodels.FAPService;
+import org.onap.ranapp.kafka.model.appmodels.LTE;
+import org.onap.ranapp.kafka.model.appmodels.LTECell;
+import org.onap.ranapp.kafka.model.appmodels.NeighborListInUse;
+import org.onap.ranapp.kafka.model.appmodels.PayloadOutput;
+import org.onap.ranapp.kafka.model.appmodels.RAN;
+import org.onap.ranapp.kafka.model.appmodels.ResponsetoA1;
+import org.onap.ranapp.models.DeviceData;
+import org.onap.ranapp.models.MessageType;
+import org.onap.ranapp.websocket.WebsocketClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.stereotype.Service;
+import com.fasterxml.jackson.databind.ObjectMapper;
+@Service
+public class RanAppEventConsumer {
+ private final Logger logger = LoggerFactory.getLogger(RanAppEventConsumer.class);
+ public RanAppEventConsumer() {
+ }
+
+
+ @Value("${ranapp.hokpi1_threshold}")
+ private int hokpiThreshold;
+
+ @Value(value = "${kafka.bootstrapAddress}")
+ private String bootstrapAddress;
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ @Autowired
+ KafkaTemplate<String, Object> Kafkatemplate;
+
+ @Autowired
+ WebsocketClient websocketclient;
+
+ ResponsetoA1 response=new ResponsetoA1();
+
+ public static String requestTopicName,responseTopicName;
+
+ //@KafkaListener(topics = "#{topicUtil.suffixTopics()}", groupId = "${ranapp.testing.topic.id}", containerFactory = "kafkaListenerFactory")
+ public void consume(KafkaConsumer<String,String> consumer, String requesttopicName, String responsetopicName) {
+ try {
+ requestTopicName=requesttopicName;
+ responseTopicName=responsetopicName;
+ WebsocketClient.requestTopicName=requesttopicName;
+ WebsocketClient.responseTopicName=responsetopicName;
+
+ while(true){
+ ConsumerRecords<String,String> records=consumer.poll(Duration.ofMillis(1000));
+ for(ConsumerRecord<String,String> record: records){
+ logger.info("Key: "+ record.key() + ", Value:" +record.value());
+ logger.info("Partition:" + record.partition()+",Offset:"+record.offset());
+ JSONObject obj_name = new JSONObject(record.value());
+ logger.info(String.format("ranapp message recieved \n-> %s \n", obj_name));
+
+ ANRInputMessage ANRInputMessage=null;
+ try {
+ logger.info(String.format("Parsing the incoming json object to ANRInputMessage class"));
+ ANRInputMessage = objectMapper.readValue(obj_name.toString(), ANRInputMessage.class);
+ } catch (Exception ex) {
+ logger.info(String.format(
+ "Invalid Message received . Exception while parsing JSON object -> %s",
+ ex.getLocalizedMessage()));
+
+ ex.printStackTrace();
+ return;
+ }
+ try {
+ logger.info(String.format("Invoking convertInputMessagetoANROutput Function"));
+ ANROutputMessage ANROutputMessage= convertInputMessagetoANROutput(ANRInputMessage);
+ logger.info(String.format("ANROutputMessage"));
+ logger.info(String.format(objectMapper.writeValueAsString(ANROutputMessage)));
+
+ // Output Payload is sent as Websocket message to RC
+ DeviceData devicedata=new DeviceData();
+ devicedata.setMessage(objectMapper.writeValueAsString(ANROutputMessage.getPayload()));
+ devicedata.setType(MessageType.KAFKA_MSG);
+ logger.info(String.format("Sending Output Payload to RC WS Server"));
+ websocketclient.sendMessage(devicedata);
+
+ } catch (Exception e) {
+ e.getLocalizedMessage();
+ e.printStackTrace();
+ }
+ }
+ }}catch (Exception e) {
+ e.getLocalizedMessage();
+ e.printStackTrace();
+ }
+ }
+ private ANROutputMessage convertInputMessagetoANROutput(ANRInputMessage ANRInputMessage) {
+ // TODO Auto-generated method stub
+ logger.info(String.format("Creating OutputMessage from ANRInput Function"));
+ ANROutputMessage ANROutputMessage=new ANROutputMessage();
+
+
+
+ logger.info(String.format("initializing output parameters"));
+ //initializing Output Params
+ PayloadOutput payloadOutput=new PayloadOutput();
+ List<Configuration> listconfiguration= new LinkedList<Configuration>();
+ Configuration configuration=new Configuration();
+ Data data=new Data();
+ FAPService fapservice=new FAPService();
+ CellConfig cellconfig=new CellConfig();
+ LTE lte=new LTE();
+ RAN ran=new RAN();
+ Common common=new Common();
+ NeighborListInUse neighbourlistinuse=new NeighborListInUse();
+ List<LTECell> listltecell=new LinkedList<LTECell>();
+
+
+
+ logger.info(String.format("Iterating Neighbour cells to validate KPI"));
+ // Parsing the payload.policydata into output message payload
+ common.setCellIdentity(ANRInputMessage.getPayload().getPolicyData().getCellID());
+ int length=ANRInputMessage.getPayload().getPolicyData().getNeighbours().size();
+ for(int i=0;i<length;i++) {
+ LTECell ltecell=new LTECell();
+ ltecell.setIdGNBCUCPFunction(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getPNFName());
+ ltecell.setPlmnid(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getPlmnid());
+ ltecell.setnRTCI(0);
+ ltecell.setIdNRCellRelation(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getCellID());
+ //Identify KPI Measurement
+ if(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getHoKpi1() < hokpiThreshold)
+ ltecell.setIsHOAllowed("true");
+ else
+ ltecell.setIsHOAllowed("false");
+ listltecell.add(ltecell);
+ }
+ neighbourlistinuse.setLTECell(listltecell);
+ neighbourlistinuse.setLTECellNumberOfEntries(Integer.toString(listltecell.size()));
+ ran.setCommon(common);
+ ran.setNeighborListInUse(neighbourlistinuse);
+ lte.setRan(ran);
+ cellconfig.setLte(lte);
+ fapservice.setIdNRCellCU(ANRInputMessage.getPayload().getPolicyData().getPNFName());
+ fapservice.setCellConfig(cellconfig);
+ data.setRicId(ANRInputMessage.getPayload().getRicId());
+ data.setFAPService(fapservice);
+ configuration.setData(data);
+ //how do we iterate in a standard way, currently working in a static way
+ listconfiguration.add(configuration);
+ payloadOutput.setConfigurations(listconfiguration);
+
+
+ ANROutputMessage.setPayload(payloadOutput);
+
+ logger.info(String.format("returning back output msg"));
+ return ANROutputMessage;
+ }
+
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANRInputMessage.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANRInputMessage.java
new file mode 100644
index 0000000..6fc85ba
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANRInputMessage.java
@@ -0,0 +1,57 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"action",
+"payload",
+"policy_type_id",
+"policy_id"
+})
+@Generated("jsonschema2pojo")
+public class ANRInputMessage {
+@JsonProperty("policy_type_id")
+private String policyTypeId;
+@JsonProperty("policy_id")
+private String policyId;
+@JsonProperty("action")
+private String action;
+@JsonProperty("payload")
+private Payload payload;
+public String getPolicyTypeId() {
+ return policyTypeId;
+}
+public void setPolicyTypeId(String policyTypeId) {
+ this.policyTypeId = policyTypeId;
+}
+public String getPolicyId() {
+ return policyId;
+}
+public void setPolicyId(String policyId) {
+ this.policyId = policyId;
+}
+public String getAction() {
+ return action;
+}
+public void setAction(String action) {
+ this.action = action;
+}
+public Payload getPayload() {
+ return payload;
+}
+public void setPayload(Payload payload) {
+ this.payload = payload;
+}
+@Override
+public String toString() {
+ return "ANRInputMessage [policyTypeId=" + policyTypeId + ", policyId=" + policyId + ", action=" + action
+ + ", payload=" + payload + "]";
+}
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANROutputMessage.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANROutputMessage.java
new file mode 100644
index 0000000..64c71bb
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ANROutputMessage.java
@@ -0,0 +1,26 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"payload"
+})
+@Generated("jsonschema2pojo")
+public class ANROutputMessage {
+@JsonProperty("payload")
+private PayloadOutput payload;
+@JsonProperty("payload")
+public PayloadOutput getPayload() {
+return payload;
+}
+@JsonProperty("payload")
+public void setPayload(PayloadOutput payload) {
+this.payload = payload;
+}
+@Override
+public String toString() {
+ return "ANROutputMessage [payload=" + payload + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Aai.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Aai.java
new file mode 100644
index 0000000..c1c92c3
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Aai.java
@@ -0,0 +1,65 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"generic-vnf.prov-status",
+"generic-vnf.is-closed-loop-disabled",
+"pnf.pnf-name"
+})
+@Generated("jsonschema2pojo")
+public class Aai {
+@JsonProperty("generic-vnf.prov-status")
+private String genericVnfProvStatus;
+@JsonProperty("generic-vnf.is-closed-loop-disabled")
+private String genericVnfIsClosedLoopDisabled;
+@JsonProperty("pnf.pnf-name")
+private String pnfPnfName;
+@JsonIgnore
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+@JsonProperty("generic-vnf.prov-status")
+public String getGenericVnfProvStatus() {
+return genericVnfProvStatus;
+}
+@JsonProperty("generic-vnf.prov-status")
+public void setGenericVnfProvStatus(String genericVnfProvStatus) {
+this.genericVnfProvStatus = genericVnfProvStatus;
+}
+@JsonProperty("generic-vnf.is-closed-loop-disabled")
+public String getGenericVnfIsClosedLoopDisabled() {
+return genericVnfIsClosedLoopDisabled;
+}
+@JsonProperty("generic-vnf.is-closed-loop-disabled")
+public void setGenericVnfIsClosedLoopDisabled(String genericVnfIsClosedLoopDisabled) {
+this.genericVnfIsClosedLoopDisabled = genericVnfIsClosedLoopDisabled;
+}
+@JsonProperty("pnf.pnf-name")
+public String getPnfPnfName() {
+return pnfPnfName;
+}
+@JsonProperty("pnf.pnf-name")
+public void setPnfPnfName(String pnfPnfName) {
+this.pnfPnfName = pnfPnfName;
+}
+@JsonAnyGetter
+public Map<String, Object> getAdditionalProperties() {
+return this.additionalProperties;
+}
+@JsonAnySetter
+public void setAdditionalProperty(String name, Object value) {
+this.additionalProperties.put(name, value);
+}
+@Override
+public String toString() {
+ return "Aai [genericVnfProvStatus=" + genericVnfProvStatus + ", genericVnfIsClosedLoopDisabled="
+ + genericVnfIsClosedLoopDisabled + ", pnfPnfName=" + pnfPnfName +
+ "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/AppDescriptorKafkaTemplate.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/AppDescriptorKafkaTemplate.java
new file mode 100644
index 0000000..38cc396
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/AppDescriptorKafkaTemplate.java
@@ -0,0 +1,29 @@
+package org.onap.ranapp.kafka.model.appmodels;
+public class AppDescriptorKafkaTemplate {
+private String requestType;
+
+
+ @Override
+ public String toString() {
+ return "AppDescriptorKafkaTemplate [requestType=" + requestType + ", plainText=" + plainText
+ + ", getRequestType()=" + getRequestType() + ", getPlainText()=" + getPlainText() + ", getClass()="
+ + getClass() + ", hashCode()=" + hashCode() + ", toString()=" + super.toString() + "]";
+ }
+ public AppDescriptorKafkaTemplate() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+ public String getRequestType() {
+ return requestType;
+ }
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+ public String getPlainText() {
+ return plainText;
+ }
+ public void setPlainText(String plainText) {
+ this.plainText = plainText;
+ }
+ private String plainText;
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/CellConfig.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/CellConfig.java
new file mode 100644
index 0000000..e861f4c
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/CellConfig.java
@@ -0,0 +1,31 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"LTE"
+})
+@Generated("jsonschema2pojo")
+public class CellConfig {
+@JsonProperty("LTE")
+private LTE lte;
+@JsonProperty("LTE")
+public LTE getLte() {
+return lte;
+}
+@JsonProperty("LTE")
+public void setLte(LTE lte) {
+this.lte = lte;
+}
+@Override
+public String toString() {
+ return "CellConfig [lte=" + lte + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Common.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Common.java
new file mode 100644
index 0000000..dbd6bc8
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Common.java
@@ -0,0 +1,31 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"CellIdentity"
+})
+@Generated("jsonschema2pojo")
+public class Common {
+@JsonProperty("CellIdentity")
+private String cellIdentity;
+@JsonProperty("CellIdentity")
+public String getCellIdentity() {
+return cellIdentity;
+}
+@JsonProperty("CellIdentity")
+public void setCellIdentity(String cellIdentity) {
+this.cellIdentity = cellIdentity;
+}
+@Override
+public String toString() {
+ return "Common [cellIdentity=" + cellIdentity + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Configuration.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Configuration.java
new file mode 100644
index 0000000..acfdbc5
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Configuration.java
@@ -0,0 +1,31 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"data"
+})
+@Generated("jsonschema2pojo")
+public class Configuration {
+@JsonProperty("data")
+private Data data;
+@JsonProperty("data")
+public Data getData() {
+return data;
+}
+@JsonProperty("data")
+public void setData(Data data) {
+this.data = data;
+}
+@Override
+public String toString() {
+ return "Configuration [data=" + data + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Data.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Data.java
new file mode 100644
index 0000000..7b403bb
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Data.java
@@ -0,0 +1,42 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"FAPService"
+})
+@Generated("jsonschema2pojo")
+public class Data {
+@JsonProperty("ric_id")
+private String ricId;
+
+@JsonProperty("FAPService")
+private FAPService fAPService;
+@JsonProperty("ric_id")
+public String getRicId() {
+ return ricId;
+}
+@JsonProperty("ric_id")
+public void setRicId(String ricId) {
+ this.ricId = ricId;
+}
+@JsonProperty("FAPService")
+public FAPService getFAPService() {
+return fAPService;
+}
+@JsonProperty("FAPService")
+public void setFAPService(FAPService fAPService) {
+this.fAPService = fAPService;
+}
+@Override
+public String toString() {
+ return "Data [ricId=" + ricId + ", fAPService=" + fAPService + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/FAPService.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/FAPService.java
new file mode 100644
index 0000000..e53d50c
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/FAPService.java
@@ -0,0 +1,43 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"alias",
+"CellConfig"
+})
+@Generated("jsonschema2pojo")
+public class FAPService {
+@JsonProperty("idNRCellCU")
+private String idNRCellCU;
+@JsonProperty("CellConfig")
+private CellConfig cellConfig;
+@JsonProperty("idNRCellCU")
+public String getIdNRCellCU() {
+ return idNRCellCU;
+}
+@JsonProperty("idNRCellCU")
+public void setIdNRCellCU(String idNRCellCU) {
+ this.idNRCellCU = idNRCellCU;
+}
+@JsonProperty("CellConfig")
+public CellConfig getCellConfig() {
+return cellConfig;
+}
+@JsonProperty("CellConfig")
+public void setCellConfig(CellConfig cellConfig) {
+this.cellConfig = cellConfig;
+}
+@Override
+public String toString() {
+ return "FAPService [alias=" + idNRCellCU + ", cellConfig=" + cellConfig +
+ "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTE.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTE.java
new file mode 100644
index 0000000..2d0d3d0
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTE.java
@@ -0,0 +1,31 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"RAN"
+})
+@Generated("jsonschema2pojo")
+public class LTE {
+@JsonProperty("RAN")
+private RAN ran;
+@JsonProperty("RAN")
+public RAN getRan() {
+return ran;
+}
+@JsonProperty("RAN")
+public void setRan(RAN ran) {
+this.ran = ran;
+}
+@Override
+public String toString() {
+ return "LTE [ran=" + ran + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTECell.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTECell.java
new file mode 100644
index 0000000..2bc02bc
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/LTECell.java
@@ -0,0 +1,66 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"idGNBCUCPFunction",
+"PLMNID",
+"idNRCellRelation",
+"nRTCI",
+"isHOAllowed"
+})
+@Generated("jsonschema2pojo")
+public class LTECell {
+@JsonProperty("idGNBCUCPFunction")
+private String idGNBCUCPFunction;
+@JsonProperty("PLMNID")
+private String plmnid;
+@JsonProperty("idNRCellRelation")
+private String idNRCellRelation;
+@JsonProperty("nRTCI")
+private Integer nRTCI;
+@JsonProperty("isHOAllowed")
+private String isHOAllowed;
+public String getIdGNBCUCPFunction() {
+ return idGNBCUCPFunction;
+}
+public void setIdGNBCUCPFunction(String idGNBCUCPFunction) {
+ this.idGNBCUCPFunction = idGNBCUCPFunction;
+}
+public String getPlmnid() {
+ return plmnid;
+}
+public void setPlmnid(String plmnid) {
+ this.plmnid = plmnid;
+}
+public String getIdNRCellRelation() {
+ return idNRCellRelation;
+}
+public void setIdNRCellRelation(String idNRCellRelation) {
+ this.idNRCellRelation = idNRCellRelation;
+}
+public Integer getnRTCI() {
+ return nRTCI;
+}
+public void setnRTCI(Integer nRTCI) {
+ this.nRTCI = nRTCI;
+}
+public String getIsHOAllowed() {
+ return isHOAllowed;
+}
+public void setIsHOAllowed(String isHOAllowed) {
+ this.isHOAllowed = isHOAllowed;
+}
+@Override
+public String toString() {
+ return "LTECell [idGNBCUCPFunction=" + idGNBCUCPFunction + ", plmnid=" + plmnid + ", idNRCellRelation="
+ + idNRCellRelation + ", nRTCI=" + nRTCI + ", isHOAllowed=" + isHOAllowed + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/NeighborListInUse.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/NeighborListInUse.java
new file mode 100644
index 0000000..bb1c33e
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/NeighborListInUse.java
@@ -0,0 +1,44 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"LTECell",
+"LTECellNumberOfEntries"
+})
+@Generated("jsonschema2pojo")
+public class NeighborListInUse {
+@JsonProperty("LTECell")
+private List<LTECell> lTECell = null;
+@JsonProperty("LTECellNumberOfEntries")
+private String lTECellNumberOfEntries;
+@JsonProperty("LTECell")
+public List<LTECell> getLTECell() {
+return lTECell;
+}
+@JsonProperty("LTECell")
+public void setLTECell(List<LTECell> lTECell) {
+this.lTECell = lTECell;
+}
+@JsonProperty("LTECellNumberOfEntries")
+public String getLTECellNumberOfEntries() {
+return lTECellNumberOfEntries;
+}
+@JsonProperty("LTECellNumberOfEntries")
+public void setLTECellNumberOfEntries(String lTECellNumberOfEntries) {
+this.lTECellNumberOfEntries = lTECellNumberOfEntries;
+}
+@Override
+public String toString() {
+ return "NeighborListInUse [lTECell=" + lTECell + ", lTECellNumberOfEntries=" + lTECellNumberOfEntries
+ + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Neighbour.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Neighbour.java
new file mode 100644
index 0000000..e4bf0f6
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Neighbour.java
@@ -0,0 +1,75 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"PNFName",
+"PLMNID",
+"CellID",
+"ho-kpi1"
+})
+@Generated("jsonschema2pojo")
+public class Neighbour {
+@JsonProperty("PNFName")
+private String pNFName;
+@JsonProperty("PLMNID")
+private String plmnid;
+@JsonProperty("CellID")
+private String cellID;
+@JsonProperty("ho-kpi1")
+private Integer hoKpi1;
+@JsonIgnore
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+@JsonProperty("PNFName")
+public String getPNFName() {
+return pNFName;
+}
+@JsonProperty("PNFName")
+public void setPNFName(String pNFName) {
+this.pNFName = pNFName;
+}
+@JsonProperty("PLMNID")
+public String getPlmnid() {
+return plmnid;
+}
+@JsonProperty("PLMNID")
+public void setPlmnid(String plmnid) {
+this.plmnid = plmnid;
+}
+@JsonProperty("CellID")
+public String getCellID() {
+return cellID;
+}
+@JsonProperty("CellID")
+public void setCellID(String cellID) {
+this.cellID = cellID;
+}
+@JsonProperty("ho-kpi1")
+public Integer getHoKpi1() {
+return hoKpi1;
+}
+@JsonProperty("ho-kpi1")
+public void setHoKpi1(Integer hoKpi1) {
+this.hoKpi1 = hoKpi1;
+}
+@JsonAnyGetter
+public Map<String, Object> getAdditionalProperties() {
+return this.additionalProperties;
+}
+@JsonAnySetter
+public void setAdditionalProperty(String name, Object value) {
+this.additionalProperties.put(name, value);
+}
+@Override
+public String toString() {
+ return "Neighbour [pNFName=" + pNFName + ", plmnid=" + plmnid + ", cellID=" + cellID + ", hoKpi1=" + hoKpi1
+ + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Payload.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Payload.java
new file mode 100644
index 0000000..c3c7f90
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/Payload.java
@@ -0,0 +1,86 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"action",
+"policy_id",
+"policy_type_id",
+"ric_id",
+"policy_data"
+})
+@Generated("jsonschema2pojo")
+public class Payload {
+@JsonProperty("action")
+private String action;
+@JsonProperty("policy_id")
+private Integer policyId;
+@JsonProperty("policy_type_id")
+private Integer policyTypeId;
+@JsonProperty("ric_id")
+private String ricId;
+@JsonProperty("policy_data")
+private PolicyData policyData;
+@JsonIgnore
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+@JsonProperty("action")
+public String getAction() {
+return action;
+}
+@JsonProperty("action")
+public void setAction(String action) {
+this.action = action;
+}
+@JsonProperty("policy_id")
+public Integer getPolicyId() {
+return policyId;
+}
+@JsonProperty("policy_id")
+public void setPolicyId(Integer policyId) {
+this.policyId = policyId;
+}
+@JsonProperty("policy_type_id")
+public Integer getPolicyTypeId() {
+return policyTypeId;
+}
+@JsonProperty("policy_type_id")
+public void setPolicyTypeId(Integer policyTypeId) {
+this.policyTypeId = policyTypeId;
+}
+@JsonProperty("ric_id")
+public String getRicId() {
+return ricId;
+}
+@JsonProperty("ric_id")
+public void setRicId(String ricId) {
+this.ricId = ricId;
+}
+@JsonProperty("policy_data")
+public PolicyData getPolicyData() {
+return policyData;
+}
+@JsonProperty("policy_data")
+public void setPolicyData(PolicyData policyData) {
+this.policyData = policyData;
+}
+@JsonAnyGetter
+public Map<String, Object> getAdditionalProperties() {
+return this.additionalProperties;
+}
+@JsonAnySetter
+public void setAdditionalProperty(String name, Object value) {
+this.additionalProperties.put(name, value);
+}
+@Override
+public String toString() {
+ return "Payload [action=" + action + ", policyId=" + policyId + ", policyTypeId=" + policyTypeId + ", ricId="
+ + ricId + ", policyData=" + policyData + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PayloadOutput.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PayloadOutput.java
new file mode 100644
index 0000000..0f3d42c
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PayloadOutput.java
@@ -0,0 +1,32 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"Configurations"
+})
+@Generated("jsonschema2pojo")
+public class PayloadOutput {
+@JsonProperty("Configurations")
+private List<Configuration> configurations = null;
+@JsonProperty("Configurations")
+public List<Configuration> getConfigurations() {
+return configurations;
+}
+@JsonProperty("Configurations")
+public void setConfigurations(List<Configuration> configurations) {
+this.configurations = configurations;
+}
+@Override
+public String toString() {
+ return "PayloadOutput [configurations=" + configurations + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicyData.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicyData.java
new file mode 100644
index 0000000..6f53145
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicyData.java
@@ -0,0 +1,76 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"PNFName",
+"PLMNID",
+"CellID",
+"neighbours"
+})
+@Generated("jsonschema2pojo")
+public class PolicyData {
+@JsonProperty("PNFName")
+private String pNFName;
+@JsonProperty("PLMNID")
+private String plmnid;
+@JsonProperty("CellID")
+private String cellID;
+@JsonProperty("neighbours")
+private List<Neighbour> neighbours = null;
+@JsonIgnore
+private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+@JsonProperty("PNFName")
+public String getPNFName() {
+return pNFName;
+}
+@JsonProperty("PNFName")
+public void setPNFName(String pNFName) {
+this.pNFName = pNFName;
+}
+@JsonProperty("PLMNID")
+public String getPlmnid() {
+return plmnid;
+}
+@JsonProperty("PLMNID")
+public void setPlmnid(String plmnid) {
+this.plmnid = plmnid;
+}
+@JsonProperty("CellID")
+public String getCellID() {
+return cellID;
+}
+@JsonProperty("CellID")
+public void setCellID(String cellID) {
+this.cellID = cellID;
+}
+@JsonProperty("neighbours")
+public List<Neighbour> getNeighbours() {
+return neighbours;
+}
+@JsonProperty("neighbours")
+public void setNeighbours(List<Neighbour> neighbours) {
+this.neighbours = neighbours;
+}
+@JsonAnyGetter
+public Map<String, Object> getAdditionalProperties() {
+return this.additionalProperties;
+}
+@JsonAnySetter
+public void setAdditionalProperty(String name, Object value) {
+this.additionalProperties.put(name, value);
+}
+@Override
+public String toString() {
+ return "PolicyData [pNFName=" + pNFName + ", plmnid=" + plmnid + ", cellID=" + cellID + ", neighbours=" + neighbours
+ + "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicytypetoTopicMapping.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicytypetoTopicMapping.java
new file mode 100644
index 0000000..c6198d2
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicytypetoTopicMapping.java
@@ -0,0 +1,31 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import com.fasterxml.jackson.annotation.JsonProperty;
+public class PolicytypetoTopicMapping {
+ @JsonProperty("request_topic")
+ private String request_topic;
+ @JsonProperty("response_topic")
+ private String response_topic;
+ @JsonProperty("request_topic")
+ public String getRequest_topic() {
+ return request_topic;
+ }
+ @JsonProperty("request_topic")
+ public void setRequest_topic(String request_topic) {
+ this.request_topic = request_topic;
+ }
+ @JsonProperty("response_topic")
+ public String getResponse_topic() {
+ return response_topic;
+ }
+ @JsonProperty("response_topic")
+ public void setResponse_topic(String response_topic) {
+ this.response_topic = response_topic;
+ }
+ @Override
+ public String toString() {
+ return "PolicytypetoTopicMapping [request_topic=" + request_topic + ", response_topic=" + response_topic + "]";
+ }
+
+
+
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/RAN.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/RAN.java
new file mode 100644
index 0000000..e6d7287
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/RAN.java
@@ -0,0 +1,43 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+"Common",
+"NeighborListInUse"
+})
+@Generated("jsonschema2pojo")
+public class RAN {
+@JsonProperty("Common")
+private Common common;
+@JsonProperty("Common")
+public Common getCommon() {
+return common;
+}
+@JsonProperty("Common")
+public void setCommon(Common common) {
+this.common = common;
+}
+@JsonProperty("NeighborListInUse")
+private NeighborListInUse neighborListInUse;
+@JsonProperty("NeighborListInUse")
+public NeighborListInUse getNeighborListInUse() {
+return neighborListInUse;
+}
+@JsonProperty("NeighborListInUse")
+public void setNeighborListInUse(NeighborListInUse neighborListInUse) {
+this.neighborListInUse = neighborListInUse;
+}
+@Override
+public String toString() {
+ return "RAN [common=" + common + ", neighborListInUse=" + neighborListInUse +
+ "]";
+}
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ResponsetoA1.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ResponsetoA1.java
new file mode 100644
index 0000000..91fa7fe
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/ResponsetoA1.java
@@ -0,0 +1,30 @@
+package org.onap.ranapp.kafka.model.appmodels;
+import com.fasterxml.jackson.annotation.JsonProperty;
+public class ResponsetoA1 {
+ @Override
+ public String toString() {
+ return "{ \"response-code\":" + response_code + ", \"error-info\":\"" + error_info +"\"}";
+ }
+ @JsonProperty("response-code")
+ private int response_code;
+
+
+ @JsonProperty("error-info")
+ private String error_info;
+ @JsonProperty("response-code")
+ public int getResponse_code() {
+ return response_code;
+ }
+ @JsonProperty("response-code")
+ public void setResponse_code(int response_code) {
+ this.response_code = response_code;
+ }
+ @JsonProperty("error-info")
+ public String getError_info() {
+ return error_info;
+ }
+ @JsonProperty("error-info")
+ public void setError_info(String error_info) {
+ this.error_info = error_info;
+ }
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java
new file mode 100644
index 0000000..8172173
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Ran Simulator Controller
+ * ================================================================================
+ * Copyright (C) 2018 Wipro Limited.
+ * ================================================================================
+ * 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.ranapp.models;
+import java.io.Serializable;
+public class DeviceData implements Serializable {
+
+ private static final long serialVersionUID = 4388248209444904611L;
+
+ private MessageType type;
+ private String message;
+
+
+
+ public MessageType getType() {
+ return type;
+ }
+ public void setType(MessageType type) {
+ this.type = type;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+} \ No newline at end of file
diff --git a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java
new file mode 100644
index 0000000..8d0cd58
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Ran Simulator Controller
+ * ================================================================================
+ * Copyright (C) 2018 Wipro Limited.
+ * ================================================================================
+ * 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.ranapp.models;
+import javax.websocket.DecodeException;
+import javax.websocket.Decoder;
+import javax.websocket.EndpointConfig;
+public class DeviceDataDecoder implements Decoder.Text<DeviceData> {
+
+ // public class DeviceDataDecoder implements Decoder.Text<DeviceData>
+ @Override
+ public void destroy() {
+ }
+
+ @Override
+ public void init(EndpointConfig arg0) {
+ }
+
+ @Override
+ public DeviceData decode(String msgInfo) throws DecodeException {
+ DeviceData data = new DeviceData();
+ String[] strInfo = msgInfo.split(":", 2);
+ if (strInfo.length < 2) {
+ data.setMessage("");
+ } else {
+ data.setMessage(strInfo[1]);
+ }
+ data.setType(MessageType.valueOf(strInfo[0]));
+ return data;
+ }
+
+ @Override
+ public boolean willDecode(String arg0) {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java
new file mode 100644
index 0000000..1b70cee
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Ran Simulator Controller
+ * ================================================================================
+ * Copyright (C) 2018 Wipro Limited.
+ * ================================================================================
+ * 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.ranapp.models;
+import javax.websocket.EncodeException;
+import javax.websocket.Encoder;
+import javax.websocket.EndpointConfig;
+public class DeviceDataEncoder implements Encoder.Text<DeviceData> {
+
+ @Override
+ public void destroy() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(EndpointConfig arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public String encode(DeviceData msg) throws EncodeException {
+ String result = msg.getType() + ":" + msg.getMessage();
+ return result;
+ }
+
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java b/ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java
new file mode 100644
index 0000000..9d759e3
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+package org.onap.ranapp.models;
+public enum MessageType {
+ INITIAL_CONFIRMATION, INITIAL_CONFIG, RC_TO_HC_PMFILEDATA, ALLOCATION_UPDATE, PING, SLICE_DETAILS, NSSAI_DETAILS, HC_TO_RC_RRM_POLICY, HC_TO_RC_PLMN, HC_TO_RC_SLICE_PROFILE, HC_TO_RC_RRM_POLICY_DEL, HC_TO_RC_PLMN_DEL, HC_TO_RC_SLICE_PROFILE_DEL, RTRIC_CONFIG, KAFKA_MSG
+}
diff --git a/ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java b/ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java
new file mode 100644
index 0000000..612ec3f
--- /dev/null
+++ b/ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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.
+ */
+package org.onap.ranapp.websocket;
+import java.io.IOException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import javax.websocket.ClientEndpoint;
+import javax.websocket.CloseReason;
+import javax.websocket.ContainerProvider;
+import javax.websocket.EncodeException;
+import javax.websocket.OnClose;
+import javax.websocket.OnMessage;
+import javax.websocket.OnOpen;
+import javax.websocket.Session;
+import javax.websocket.WebSocketContainer;
+import javax.websocket.server.PathParam;
+import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.common.serialization.StringSerializer;
+import org.json.JSONObject;
+import org.onap.ranapp.kafka.model.appmodels.ResponsetoA1;
+import org.onap.ranapp.models.DeviceData;
+import org.onap.ranapp.models.DeviceDataDecoder;
+import org.onap.ranapp.models.DeviceDataEncoder;
+import org.onap.ranapp.models.MessageType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.kafka.core.DefaultKafkaProducerFactory;
+import org.springframework.kafka.core.KafkaTemplate;
+import org.springframework.kafka.core.ProducerFactory;
+import org.springframework.kafka.support.SendResult;
+import org.springframework.kafka.support.serializer.JsonSerializer;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.concurrent.ListenableFuture;
+import org.springframework.util.concurrent.ListenableFutureCallback;
+import com.fasterxml.jackson.databind.ObjectMapper;
+//import src.main.java.com.wipro.www.websocket.Exception;
+@Component
+@ClientEndpoint(encoders = {DeviceDataEncoder.class}, decoders = {DeviceDataDecoder.class})
+public class WebsocketClient {
+
+ private static final Logger LOG = LoggerFactory.getLogger(WebsocketClient.class);
+ private Session clientSession;
+ private String url;
+ @Value("${websocketserver.address}")
+ private String websocketaddress;
+
+ @Value("${websocketserver.endpoint}")
+ private String websocketendpoint;
+
+ @Value("${ranapp.name}")
+ private String ranappName;
+ @Value(value = "${kafka.bootstrapAddress}")
+ private String bootstrapAddress;
+
+ @Autowired
+ KafkaTemplate<String, Object> Kafkatemplate;
+ ResponsetoA1 response=new ResponsetoA1();
+
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ public static String requestTopicName,responseTopicName;
+
+ @OnOpen
+ public void onOpen(Session session,@PathParam("IpPort") String ipPort) throws IOException {
+
+
+ LOG.info("WebSocket opened (jetty server) Session Id: {}", session.getId());
+ DeviceData devicedata=new DeviceData();
+ devicedata.setType(MessageType.INITIAL_CONFIRMATION);
+
+ devicedata.setMessage("------------Connection Established to RAN_SIM from "+ ranappName +" ------------");
+ try {
+ session.getBasicRemote().sendObject(devicedata);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ LOG.error("Exception while sending message {}", e.getMessage());
+ } catch (EncodeException e) {
+ // TODO Auto-generated catch block
+ LOG.error("Exception while sending message {}", e.getMessage());
+ }
+ }
+ @OnClose
+ public void OnClose(CloseReason reason, Session session) {
+ LOG.info("Websocket {} closed. Close reason {}. If closed unintentionally, Retrying...", session.getId(),
+ reason.getReasonPhrase());
+ clientSession = null;
+ new RetryWebsocket(this).start();
+ }
+
+ @OnMessage
+ public void onMessage(DeviceData deviceData, Session session) {
+ try {
+ if (deviceData != null) {
+ if (deviceData.getMessage() == null || deviceData.getMessage().trim().equals("")) {
+ LOG.debug("Periodic ping message.... ignore");
+ return;
+ } else {
+ if (deviceData.getType().equals(MessageType.KAFKA_MSG)) {
+ LOG.info("Message Received: Type:{}, msg:{}, Session Id:{}", deviceData.getType(), deviceData.getMessage(),
+ session.getId());
+ produce(deviceData.getMessage());
+
+
+ }
+ }
+
+ }
+ } catch (Exception e) {
+ LOG.error("Exception in processing message {}", e.getMessage());
+ }
+ }
+
+
+ public void sendMessage(DeviceData deviceData) {
+ try {
+ LOG.info("Message to Send: Type:{}, msg:{}, Session Id:{}", deviceData.getType(),
+ deviceData.getMessage(), clientSession.getId());
+ if (clientSession != null) {
+ clientSession.getBasicRemote().sendObject(deviceData);
+ } else {
+ LOG.error("Could not get websocket client session!!");
+ }
+ } catch (Exception e) {
+ LOG.error("Exception while sending message {}", e.getMessage());
+ }
+ }
+
+ public void initWebsocketClient() {
+ LOG.info("Initializing web socket client");
+ this.url = "ws://" + websocketaddress + websocketendpoint ;
+ this.ranappName= ranappName;
+ new RetryWebsocket(this).start();
+ }
+ class RetryWebsocket extends Thread {
+ WebsocketClient client;
+ public RetryWebsocket(WebsocketClient client) {
+ this.client = client;
+ }
+ public void run() {
+ boolean toContinue = true;
+ while (toContinue) {
+ try {
+ client.connectWebsocket();
+ toContinue = false;
+ LOG.info("Connection established, Stopping RetryWebsocket");
+ } catch (Exception e) {
+ LOG.info("Failed to connect to server, Retrying...");
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e1) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ }
+ }
+ public void connectWebsocket() throws Exception {
+ WebSocketContainer container = ContainerProvider.getWebSocketContainer();
+ LOG.info("Connecting to Server:"+ url);
+
+ clientSession = container.connectToServer(this, new URI(url));
+ LOG.info("Connected to server, Session id: {}", clientSession.getId());
+ }
+ public void start() {
+ // TODO Auto-generated method stub
+
+
+ initWebsocketClient();
+ }
+ public void produce(String responsetoA1) {
+ JSONObject obj_name = new JSONObject(responsetoA1);
+ LOG.info(String.format("response message recieved from Ransim \n-> %s \n", obj_name));
+
+ try {
+
+
+ response = objectMapper.readValue(obj_name.toString(), ResponsetoA1.class);
+
+ LOG.info(String.format("Parsing the incoming json object to ResponsetoA1 class: "+ response +", kafkaresponse topic: "+responseTopicName));
+ if(ObjectUtils.isEmpty(Kafkatemplate)) {
+ LOG.info(String.format("Initializing Kakfa producer factory"));
+ Map<String,Object> config = new HashMap<>();
+ config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,bootstrapAddress);
+ config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
+ config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
+ ProducerFactory<String,Object> producerfactory= new DefaultKafkaProducerFactory(config);
+ Kafkatemplate=new KafkaTemplate<String, Object>(producerfactory);
+
+ }
+
+ ListenableFuture<SendResult<String, Object>> future = Kafkatemplate.send(responseTopicName, response);
+ //Kafkatemplate.send(responseTopicName, response);
+ future.addCallback(new ListenableFutureCallback<SendResult<String, Object>>() {
+ @Override
+ public void onSuccess(SendResult<String, Object> result) {
+ System.out.println("Sent message=[" + response.toString() +
+ "] with offset=[" + result.getRecordMetadata().offset() + "Data" + result + "]");
+ }
+ @Override
+ public void onFailure(Throwable ex) {
+ System.out.println("Unable to send message=["
+ + response + "] due to : " + ex.getMessage());
+ }
+ });
+
+
+ } catch (Exception ex) {
+ LOG.info(String.format("Parsing the incoming json object to ResponsetoA1 class: "+ response +", kafkaresponse topic: "+responseTopicName));
+ LOG.info(String.format(
+ "Invalid Message received . Exception while parsing JSON object -> %s",
+ ex.getLocalizedMessage()));
+
+ ex.printStackTrace();
+ return;
+ }
+ }
+}
diff --git a/ANR-App/src/test/java/org/onap/ranwebclient/webclient/WebclientApplicationTests.java b/ANR-App/src/test/java/org/onap/ranwebclient/webclient/WebclientApplicationTests.java
new file mode 100644
index 0000000..66c4d96
--- /dev/null
+++ b/ANR-App/src/test/java/org/onap/ranwebclient/webclient/WebclientApplicationTests.java
@@ -0,0 +1,9 @@
+package org.onap.ranwebclient.webclient;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+@SpringBootTest
+class WebclientApplicationTests {
+ @Test
+ void contextLoads() {
+ }
+}