diff options
author | vvarvate <vv00489503@techmahindra.com> | 2022-11-29 00:30:51 +0530 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@t-mobile.pl> | 2023-04-19 07:35:38 +0000 |
commit | 59ec623b673959cb44937ba601abbe15c9b4501e (patch) | |
tree | ecd2807e346c5b03f147230d3e6d2b1e6e6e46d5 | |
parent | 41fc37f06fa55039720a9690da797236be861bb5 (diff) |
INT-2142 RAN App Integration with A1 Terminator RAN App will interact with A1 Terminator to start receiving A1 PoliciesHEADmaster
Added license Anotations for all files
Issue-ID: INT-2129
Signed-off-by: vvarvate <vv00489503@techmahindra.com>
Change-Id: I61c90086b87766119ba7939a06e93bd2e7d22bad
33 files changed, 444 insertions, 307 deletions
diff --git a/ANR-App/README.md b/ANR-App/README.md index a2bb5f8..63aa48c 100644 --- a/ANR-App/README.md +++ b/ANR-App/README.md @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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. + */ 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 diff --git a/ANR-App/config/application.properties b/ANR-App/config/application.properties index 947987e..c319429 100644 --- a/ANR-App/config/application.properties +++ b/ANR-App/config/application.properties @@ -1,14 +1,14 @@ server.port=9091 -kafka.bootstrapAddress=localhost:9092 -spring.kafka.producer.bootstrap-servers=localhost:9092 +kafka.bootstrapAddress=10.31.4.44:9092 +#spring.kafka.producer.bootstrap-servers=10.31.4.44: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 +ranapp.testing.topic.id=testtopic restapi.version=v1 -websocketserver.address=43.204.239.187:8081 +websocketserver.address=10.31.4.44: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/ +kafkadispatcher.url=http://10.31.4.44:7075/policytypetotopicmapping/ diff --git a/ANR-App/pom.xml b/ANR-App/pom.xml index 7006923..b2110be 100644 --- a/ANR-App/pom.xml +++ b/ANR-App/pom.xml @@ -13,7 +13,7 @@ <name>ranapp</name> <description>ranapp project on spring boot for creating websocket client and netconf client</description> <properties> - <!--<java.version>16</java.version> --> + <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 --> @@ -64,7 +64,6 @@ <version>20200518</version> </dependency> </dependencies> - <profiles> <profile> <id>docker</id> diff --git a/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java b/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java index e63c141..5c2fbc8 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java +++ b/ANR-App/src/main/java/org/onap/ranapp/WebclientApplication.java @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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; import org.springframework.context.ApplicationContext; import org.onap.ranapp.kafka.client.KafkaClientRanappTopic; @@ -11,12 +26,10 @@ import org.springframework.context.annotation.Bean; 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 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 index 1fa8f07..f4f1cbb 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.controller; import java.io.IOException; import java.net.URISyntaxException; @@ -55,5 +70,4 @@ public class A1Controller_OSC_2_1_0 { 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 index e3907a5..1884138 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java +++ b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotification.java @@ -1,14 +1,17 @@ /* - * Copyright (C) 2021 Samsung Electronics + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * * 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 + * 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 + * limitations under the License. */ package org.onap.ranapp.data; import lombok.AllArgsConstructor; 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 index e77a4ad..60a50d3 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java +++ b/ANR-App/src/main/java/org/onap/ranapp/data/PolicyNotificationActionEnum.java @@ -1,14 +1,17 @@ /* - * Copyright (C) 2021 Samsung Electronics + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * * 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 + * 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 + * limitations under the License. */ package org.onap.ranapp.data; import com.fasterxml.jackson.annotation.JsonFormat; 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 index e80b8e1..090fbfd 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.client; import java.util.Arrays; import java.util.Properties; @@ -22,31 +37,22 @@ 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"); @@ -60,22 +66,18 @@ public class KafkaClientRanappTopic { 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()); @@ -91,7 +93,6 @@ public class KafkaClientRanappTopic { 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 index 037dd54..b251f0f 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.listener; import java.time.Duration; import java.util.LinkedList; @@ -34,25 +49,17 @@ 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; - + public static String requestTopicName,responseTopicName,kafkakeyName; //@KafkaListener(topics = "#{topicUtil.suffixTopics()}", groupId = "${ranapp.testing.topic.id}", containerFactory = "kafkaListenerFactory") public void consume(KafkaConsumer<String,String> consumer, String requesttopicName, String responsetopicName) { try { @@ -60,15 +67,17 @@ public class RanAppEventConsumer { responseTopicName=responsetopicName; WebsocketClient.requestTopicName=requesttopicName; WebsocketClient.responseTopicName=responsetopicName; - while(true){ - ConsumerRecords<String,String> records=consumer.poll(Duration.ofMillis(1000)); + ConsumerRecords<String,String> records=consumer.poll(Duration.ofMillis(5000)); for(ConsumerRecord<String,String> record: records){ - logger.info("Key: "+ record.key() + ", Value:" +record.value()); + String msg=record.value().translateEscapes().strip().stripIndent().trim().replaceAll("(?m)^[ \t]*\r?\n", ""); + msg=msg.substring( 1, msg.length() - 1 ); + logger.info("Key: "+ record.key() + ", Value:" +msg); logger.info("Partition:" + record.partition()+",Offset:"+record.offset()); - JSONObject obj_name = new JSONObject(record.value()); + JSONObject obj_name = new JSONObject(msg); logger.info(String.format("ranapp message recieved \n-> %s \n", obj_name)); - + kafkakeyName=record.key(); + WebsocketClient.kafkakeyName=record.key(); ANRInputMessage ANRInputMessage=null; try { logger.info(String.format("Parsing the incoming json object to ANRInputMessage class")); @@ -77,7 +86,6 @@ public class RanAppEventConsumer { logger.info(String.format( "Invalid Message received . Exception while parsing JSON object -> %s", ex.getLocalizedMessage())); - ex.printStackTrace(); return; } @@ -86,14 +94,12 @@ public class RanAppEventConsumer { 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(); @@ -108,9 +114,6 @@ public class RanAppEventConsumer { // 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(); @@ -124,21 +127,18 @@ public class RanAppEventConsumer { 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(); + common.setCellIdentity(ANRInputMessage.getPayload().getCellID()); + int length=ANRInputMessage.getPayload().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.setIdGNBCUCPFunction(ANRInputMessage.getPayload().getNeighbours().get(i).getPNFName()); + ltecell.setPlmnid(ANRInputMessage.getPayload().getNeighbours().get(i).getPlmnid()); ltecell.setnRTCI(0); - ltecell.setIdNRCellRelation(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getCellID()); + ltecell.setIdNRCellRelation(ANRInputMessage.getPayload().getNeighbours().get(i).getCellID()); //Identify KPI Measurement - if(ANRInputMessage.getPayload().getPolicyData().getNeighbours().get(i).getHoKpi1() < hokpiThreshold) + if(ANRInputMessage.getPayload().getNeighbours().get(i).getHoKpi1() < hokpiThreshold) ltecell.setIsHOAllowed("true"); else ltecell.setIsHOAllowed("false"); @@ -150,20 +150,15 @@ public class RanAppEventConsumer { ran.setNeighborListInUse(neighbourlistinuse); lte.setRan(ran); cellconfig.setLte(lte); - fapservice.setIdNRCellCU(ANRInputMessage.getPayload().getPolicyData().getPNFName()); + fapservice.setIdNRCellCU(ANRInputMessage.getPayload().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 index 6fc85ba..8752d0e 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 64c71bb..c1567de 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import javax.annotation.Generated; import com.fasterxml.jackson.annotation.JsonInclude; 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 index c1c92c3..aed3ded 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 38cc396..9819273 100644 --- 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 @@ -1,8 +1,21 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; public class AppDescriptorKafkaTemplate { private String requestType; - - @Override public String toString() { return "AppDescriptorKafkaTemplate [requestType=" + requestType + ", plainText=" + 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 index e861f4c..26f65ae 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index dbd6bc8..c068334 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index acfdbc5..4fb199f 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 7b403bb..6bf5b7c 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; @@ -14,19 +29,8 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; }) @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; @@ -37,6 +41,6 @@ this.fAPService = fAPService; } @Override public String toString() { - return "Data [ricId=" + ricId + ", fAPService=" + fAPService + "]"; + return "Data [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 index e53d50c..78c595d 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 2d0d3d0..97a36f3 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 2bc02bc..2af6b4f 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index bb1c33e..9feae88 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.List; 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 index e4bf0f6..b1c1cb3 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index c3c7f90..6388617 100644 --- 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 @@ -1,5 +1,21 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.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; @@ -10,77 +26,66 @@ 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" +"PNFName", +"PLMNID", +"CellID", +"neighbours" }) @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 + "]"; -} + @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 "Payload [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/PayloadOutput.java b/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PayloadOutput.java index 0f3d42c..cdd308c 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.List; 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 deleted file mode 100644 index 6f53145..0000000 --- a/ANR-App/src/main/java/org/onap/ranapp/kafka/model/appmodels/PolicyData.java +++ /dev/null @@ -1,76 +0,0 @@ -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 index c6198d2..5b0ac5a 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import com.fasterxml.jackson.annotation.JsonProperty; public class PolicytypetoTopicMapping { @@ -25,7 +40,4 @@ public class PolicytypetoTopicMapping { 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 index e6d7287..d4af8e8 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * + * 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.kafka.model.appmodels; import java.util.HashMap; import java.util.Map; 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 index 91fa7fe..a9b9203 100644 --- 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 @@ -7,8 +7,6 @@ public class ResponsetoA1 { } @JsonProperty("response-code") private int response_code; - - @JsonProperty("error-info") private String error_info; @JsonProperty("response-code") 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 index 8172173..8c54a42 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java +++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceData.java @@ -1,33 +1,24 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2018 Wipro Limited. - * ================================================================================ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * * 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 + * You may obtain a copy of the License at: * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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; } @@ -37,7 +28,6 @@ public class DeviceData implements Serializable { public void setMessage(String message) { this.message = message; } - public String getMessage() { return message; } 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 index 8d0cd58..e48fba0 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java +++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataDecoder.java @@ -1,37 +1,30 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2018 Wipro Limited. - * ================================================================================ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * * 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 + * You may obtain a copy of the License at: * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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(); @@ -44,11 +37,9 @@ public class DeviceDataDecoder implements Decoder.Text<DeviceData> { 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 index 1b70cee..05e08cd 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java +++ b/ANR-App/src/main/java/org/onap/ranapp/models/DeviceDataEncoder.java @@ -1,44 +1,34 @@ -/*- - * ============LICENSE_START======================================================= - * Ran Simulator Controller - * ================================================================================ - * Copyright (C) 2018 Wipro Limited. - * ================================================================================ +/* + * Copyright (C) 2022 CAPGEMINI ENGINEERING. + * * 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 + * You may obtain a copy of the License at: * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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 index 9d759e3..ea244cb 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java +++ b/ANR-App/src/main/java/org/onap/ranapp/models/MessageType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (C) 2022 CAPGEMINI ENGINEERING. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. 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 index 612ec3f..722d399 100644 --- a/ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java +++ b/ANR-App/src/main/java/org/onap/ranapp/websocket/WebsocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Cisco and/or its affiliates. + * Copyright (C) 2022 CAPGEMINI ENGINEERING. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,37 +54,28 @@ import com.fasterxml.jackson.databind.ObjectMapper; @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; - + public static String kafkakeyName; @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); @@ -103,7 +94,6 @@ public class WebsocketClient { clientSession = null; new RetryWebsocket(this).start(); } - @OnMessage public void onMessage(DeviceData deviceData, Session session) { try { @@ -116,18 +106,13 @@ public class WebsocketClient { 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(), @@ -141,7 +126,6 @@ public class WebsocketClient { LOG.error("Exception while sending message {}", e.getMessage()); } } - public void initWebsocketClient() { LOG.info("Initializing web socket client"); this.url = "ws://" + websocketaddress + websocketendpoint ; @@ -174,25 +158,18 @@ public class WebsocketClient { 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")); @@ -202,16 +179,14 @@ public class WebsocketClient { 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); + ListenableFuture<SendResult<String, Object>> future = Kafkatemplate.send(responseTopicName, kafkakeyName, 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 + "]"); + "] with offset=[" + result.getRecordMetadata().offset() + "Data" + result + "with topic"+ kafkakeyName +"]"); } @Override public void onFailure(Throwable ex) { @@ -219,14 +194,11 @@ public class WebsocketClient { + 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; } |