From 3cd4023832810e8b65f85a9db807c8bafec38d82 Mon Sep 17 00:00:00 2001 From: ramya Date: Mon, 11 Mar 2019 17:34:41 +0530 Subject: code coverage for M3 Change-Id: Ib421ce2ac9357a3210d99293497f9e304f8cd2f5 Issue-ID: DCAEGEN2-1259 Signed-off-by: Ramya Ravichandran --- .../java/com/wipro/www/sonhms/Application.java | 128 ---------- .../www/sonhms/BufferNotificationComponent.java | 62 ----- .../wipro/www/sonhms/BufferNotificationState.java | 38 --- .../sonhms/BufferedNotificationHandlingState.java | 34 --- .../wipro/www/sonhms/ChildStatusUpdateState.java | 88 ------- .../com/wipro/www/sonhms/ChildTriggeringState.java | 40 --- .../wipro/www/sonhms/ClusterDetailsComponent.java | 58 ----- .../java/com/wipro/www/sonhms/ConfigPolicy.java | 57 ----- .../java/com/wipro/www/sonhms/Configuration.java | 281 -------------------- src/main/java/com/wipro/www/sonhms/MainThread.java | 49 ---- .../com/wipro/www/sonhms/MainThreadComponent.java | 55 ---- .../java/com/wipro/www/sonhms/NewNotification.java | 40 --- .../com/wipro/www/sonhms/ResourceCleanupState.java | 34 --- .../www/sonhms/SdnrNotificationHandlingState.java | 259 ------------------- src/main/java/com/wipro/www/sonhms/SonContext.java | 122 --------- .../java/com/wipro/www/sonhms/SonController.java | 59 ----- .../com/wipro/www/sonhms/SonRequestsComponent.java | 40 --- src/main/java/com/wipro/www/sonhms/SonState.java | 26 -- src/main/java/com/wipro/www/sonhms/Topic.java | 72 ------ src/main/java/com/wipro/www/sonhms/WaitState.java | 90 ------- .../com/wipro/www/sonhms/child/ChildThread.java | 245 ------------------ .../wipro/www/sonhms/child/ClusterFormation.java | 144 ----------- .../www/sonhms/child/ClusterModification.java | 147 ----------- .../java/com/wipro/www/sonhms/child/Detection.java | 87 ------- .../java/com/wipro/www/sonhms/child/Graph.java | 202 --------------- .../java/com/wipro/www/sonhms/child/StateOof.java | 271 -------------------- .../dao/BufferedNotificationsRepository.java | 43 ---- .../wipro/www/sonhms/dao/CellInfoRepository.java | 34 --- .../www/sonhms/dao/ClusterDetailsRepository.java | 59 ----- .../sonhms/dao/DmaapNotificationsRepository.java | 40 --- .../www/sonhms/dao/SonRequestsRepository.java | 43 ---- .../com/wipro/www/sonhms/dmaap/DmaapClient.java | 215 ---------------- .../www/sonhms/dmaap/NotificationConsumer.java | 59 ----- .../www/sonhms/dmaap/NotificationProducer.java | 57 ----- .../wipro/www/sonhms/dmaap/PolicyDmaapClient.java | 53 ---- .../www/sonhms/entity/BufferedNotifications.java | 84 ------ .../java/com/wipro/www/sonhms/entity/CellInfo.java | 69 ----- .../wipro/www/sonhms/entity/ClusterDetails.java | 80 ------ .../www/sonhms/entity/DmaapNotifications.java | 69 ----- .../com/wipro/www/sonhms/entity/PciRequests.java | 68 ----- .../exceptions/ConfigDbNotFoundException.java | 33 --- .../sonhms/exceptions/OofNotFoundException.java | 33 --- .../com/wipro/www/sonhms/model/CellConfig.java | 47 ---- .../wipro/www/sonhms/model/CellNeighbourList.java | 69 ----- .../com/wipro/www/sonhms/model/CellPciPair.java | 98 ------- .../java/com/wipro/www/sonhms/model/Common.java | 47 ---- .../com/wipro/www/sonhms/model/Configurations.java | 54 ---- src/main/java/com/wipro/www/sonhms/model/Data.java | 47 ---- .../com/wipro/www/sonhms/model/FapService.java | 74 ------ .../com/wipro/www/sonhms/model/FapServiceList.java | 80 ------ src/main/java/com/wipro/www/sonhms/model/Lte.java | 47 ---- .../sonhms/model/LteNeighborListInUseLteCell.java | 135 ---------- .../wipro/www/sonhms/model/NeighborListInUse.java | 64 ----- .../com/wipro/www/sonhms/model/Notification.java | 112 -------- .../www/sonhms/model/NotificationCellConfig.java | 51 ---- .../wipro/www/sonhms/model/NotificationLte.java | 51 ---- .../www/sonhms/model/NotificationPayload.java | 51 ---- .../wipro/www/sonhms/model/NotificationRan.java | 63 ----- .../java/com/wipro/www/sonhms/model/Payload.java | 54 ---- .../wipro/www/sonhms/model/PolicyNotification.java | 179 ------------- .../com/wipro/www/sonhms/model/RadioAccess.java | 64 ----- src/main/java/com/wipro/www/sonhms/model/Ran.java | 50 ---- .../java/com/wipro/www/sonhms/model/Response.java | 48 ---- .../com/wipro/www/sonhms/model/SdnrResponse.java | 37 --- .../java/com/wipro/www/sonhms/model/ThreadId.java | 35 --- .../com/wipro/www/sonhms/model/X0005b9Lte.java | 63 ----- .../www/sonhms/restclient/AsyncResponseBody.java | 79 ------ .../com/wipro/www/sonhms/restclient/CellInfo.java | 48 ---- .../www/sonhms/restclient/OofRequestBody.java | 44 ---- .../wipro/www/sonhms/restclient/OofRestClient.java | 101 -------- .../www/sonhms/restclient/PolicyRequestBody.java | 53 ---- .../www/sonhms/restclient/PolicyRestClient.java | 74 ------ .../wipro/www/sonhms/restclient/RequestInfo.java | 100 -------- .../www/sonhms/restclient/SdnrRestClient.java | 137 ---------- .../com/wipro/www/sonhms/restclient/Solution.java | 74 ------ .../wipro/www/sonhms/restclient/SonSolution.java | 44 ---- .../java/com/wipro/www/sonhms/utils/BeanUtil.java | 40 --- .../java/com/wipro/www/sonhms/utils/FileIo.java | 50 ---- .../com/wipro/www/sonhms/utils/HttpRequester.java | 284 --------------------- 79 files changed, 6515 deletions(-) delete mode 100644 src/main/java/com/wipro/www/sonhms/Application.java delete mode 100644 src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java delete mode 100644 src/main/java/com/wipro/www/sonhms/BufferNotificationState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/BufferedNotificationHandlingState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/ChildStatusUpdateState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/ChildTriggeringState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java delete mode 100644 src/main/java/com/wipro/www/sonhms/ConfigPolicy.java delete mode 100644 src/main/java/com/wipro/www/sonhms/Configuration.java delete mode 100644 src/main/java/com/wipro/www/sonhms/MainThread.java delete mode 100644 src/main/java/com/wipro/www/sonhms/MainThreadComponent.java delete mode 100644 src/main/java/com/wipro/www/sonhms/NewNotification.java delete mode 100644 src/main/java/com/wipro/www/sonhms/ResourceCleanupState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/SdnrNotificationHandlingState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/SonContext.java delete mode 100644 src/main/java/com/wipro/www/sonhms/SonController.java delete mode 100644 src/main/java/com/wipro/www/sonhms/SonRequestsComponent.java delete mode 100644 src/main/java/com/wipro/www/sonhms/SonState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/Topic.java delete mode 100644 src/main/java/com/wipro/www/sonhms/WaitState.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/ChildThread.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/ClusterModification.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/Detection.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/Graph.java delete mode 100644 src/main/java/com/wipro/www/sonhms/child/StateOof.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dmaap/NotificationProducer.java delete mode 100644 src/main/java/com/wipro/www/sonhms/dmaap/PolicyDmaapClient.java delete mode 100644 src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java delete mode 100644 src/main/java/com/wipro/www/sonhms/entity/CellInfo.java delete mode 100644 src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java delete mode 100644 src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java delete mode 100644 src/main/java/com/wipro/www/sonhms/entity/PciRequests.java delete mode 100644 src/main/java/com/wipro/www/sonhms/exceptions/ConfigDbNotFoundException.java delete mode 100644 src/main/java/com/wipro/www/sonhms/exceptions/OofNotFoundException.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/CellConfig.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/CellPciPair.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Common.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Configurations.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Data.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/FapService.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/FapServiceList.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Lte.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Notification.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/NotificationCellConfig.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/NotificationLte.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/NotificationPayload.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/NotificationRan.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Payload.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/RadioAccess.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Ran.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/Response.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/SdnrResponse.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/ThreadId.java delete mode 100644 src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/CellInfo.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/OofRequestBody.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/PolicyRequestBody.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/Solution.java delete mode 100644 src/main/java/com/wipro/www/sonhms/restclient/SonSolution.java delete mode 100644 src/main/java/com/wipro/www/sonhms/utils/BeanUtil.java delete mode 100644 src/main/java/com/wipro/www/sonhms/utils/FileIo.java delete mode 100644 src/main/java/com/wipro/www/sonhms/utils/HttpRequester.java (limited to 'src/main/java/com') diff --git a/src/main/java/com/wipro/www/sonhms/Application.java b/src/main/java/com/wipro/www/sonhms/Application.java deleted file mode 100644 index 4c831b4..0000000 --- a/src/main/java/com/wipro/www/sonhms/Application.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.dmaap.DmaapClient; -import com.wipro.www.sonhms.restclient.PolicyRestClient; -import com.wipro.www.sonhms.utils.FileIo; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.annotation.PostConstruct; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class Application { - - @Autowired - DmaapClient dmaapClient; - - @Autowired - MainThreadComponent mainThreadComponent; - - private static Logger log = LoggerFactory.getLogger(Application.class); - - /** - * Main method where the pci context is initially set. - */ - public static void main(String[] args) { - SpringApplication.run(Application.class); - - } - - /** - * initialization. - */ - @PostConstruct - void init() { - getConfig(); - fetchIntialConfigFromPolicy(); - NewNotification newNotification = new NewNotification(false); - dmaapClient.initClient(newNotification); - mainThreadComponent.init(newNotification); - } - - /** - * Gets configuration from policy. - */ - @SuppressWarnings("unchecked") - private void fetchIntialConfigFromPolicy() { - log.debug("fetch initial config from policy"); - String configPolicyResponseJson = PolicyRestClient.fetchConfigFromPolicy(); - if (configPolicyResponseJson.equals("Post failed")) { - log.debug("cannot fetch config from policy"); - return; - } - ObjectMapper mapper = new ObjectMapper(); - List> configPolicyResponse = new ArrayList<>(); - try { - configPolicyResponse = mapper.readValue(configPolicyResponseJson, List.class); - } catch (IOException e) { - log.debug("exception during parsing response from policy", e); - } - String configPolicyJson = null; - if (configPolicyResponse != null) { - configPolicyJson = (String) configPolicyResponse.get(0).get("config"); - } else { - return; - } - Map configPolicyMap = new HashMap<>(); - try { - configPolicyMap = mapper.readValue(configPolicyJson, HashMap.class); - } catch (IOException e) { - log.debug("exception during parsing config body from policy", e); - } - ConfigPolicy configPolicy = ConfigPolicy.getInstance(); - configPolicy.setConfig(configPolicyMap); - if (log.isDebugEnabled()) { - log.debug(configPolicy.toString()); - } - } - - /** - * Gets config from config.json. - * - */ - private void getConfig() { - log.debug("getting initial config"); - String configJson = FileIo.readFromFile("/etc/config.json"); - ObjectMapper mapper = new ObjectMapper(); - Configuration configuration = Configuration.getInstance(); - try { - mapper.readerForUpdating(configuration).readValue(configJson); - if (log.isDebugEnabled()) { - log.debug(configuration.toString()); - } - } catch (IOException e) { - log.debug("exception during parsing configuration", e); - } - } -} diff --git a/src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java b/src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java deleted file mode 100644 index 6074a31..0000000 --- a/src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.wipro.www.sonhms.dao.BufferedNotificationsRepository; -import com.wipro.www.sonhms.entity.BufferedNotifications; -import com.wipro.www.sonhms.utils.BeanUtil; -import java.util.List; - -public class BufferNotificationComponent { - - /** - * Buffers notification along with cluster id in the database. - */ - public void bufferNotification(String notification, String clusterId) { - BufferedNotifications bufferedNotifications = new BufferedNotifications(); - bufferedNotifications.setNotification(notification); - bufferedNotifications.setClusterId(clusterId); - BufferedNotificationsRepository bufferedNotificationsRepository = BeanUtil - .getBean(BufferedNotificationsRepository.class); - bufferedNotificationsRepository.save(bufferedNotifications); - - } - - /** - * Retrieves buffered notification from the database. - */ - public List getBufferedNotification(String clusterId) { - BufferedNotificationsRepository bufferedNotificationsRepository = BeanUtil - .getBean(BufferedNotificationsRepository.class); - return bufferedNotificationsRepository.getNotificationsFromQueue(clusterId); - - } - - /** - * Retrieves clusterid from the database. - */ - public String getClusterId(String notification) { - BufferedNotificationsRepository bufferedNotificationsRepository = BeanUtil - .getBean(BufferedNotificationsRepository.class); - return bufferedNotificationsRepository.getClusterIdForNotification(notification); - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/BufferNotificationState.java b/src/main/java/com/wipro/www/sonhms/BufferNotificationState.java deleted file mode 100644 index 62d485f..0000000 --- a/src/main/java/com/wipro/www/sonhms/BufferNotificationState.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class BufferNotificationState implements SonState { - private static Logger log = LoggerFactory.getLogger(BufferNotificationState.class); - - @Override - public void stateChange(SonContext sonContext) { - log.debug("inside buffer notification state"); - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/BufferedNotificationHandlingState.java b/src/main/java/com/wipro/www/sonhms/BufferedNotificationHandlingState.java deleted file mode 100644 index ef76bdb..0000000 --- a/src/main/java/com/wipro/www/sonhms/BufferedNotificationHandlingState.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -public class BufferedNotificationHandlingState implements SonState { - - @Override - public void stateChange(SonContext sonContext) { - // any other pci context change to be done - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/ChildStatusUpdateState.java b/src/main/java/com/wipro/www/sonhms/ChildStatusUpdateState.java deleted file mode 100644 index b8d0cf4..0000000 --- a/src/main/java/com/wipro/www/sonhms/ChildStatusUpdateState.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.model.FapServiceList; - -import java.io.IOException; -import java.util.List; -import java.util.Set; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ChildStatusUpdateState implements SonState { - private static Logger log = LoggerFactory.getLogger(ChildStatusUpdateState.class); - - @Override - public void stateChange(SonContext sonContext) { - if (sonContext.getChildStatus(sonContext.getChildThreadId()).equals("triggeredOof")) { - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - } else if (sonContext.getChildStatus(sonContext.getChildThreadId()).equals("success")) { - BufferNotificationComponent bufferNotificationComponent = new BufferNotificationComponent(); - ClusterDetailsComponent clusterDetailsComponent = new ClusterDetailsComponent(); - String clusterId = clusterDetailsComponent.getClusterId(sonContext.getChildThreadId()); - List bufferedNotifications = bufferNotificationComponent.getBufferedNotification(clusterId); - if ((bufferedNotifications == null) || bufferedNotifications.isEmpty()) { - // resource clean up - // kill the child thread cleanup resources for the cluster - log.debug("no buffered notification to be handled"); - - Set setOfThread = Thread.getAllStackTraces().keySet(); - for (Thread thread : setOfThread) { - if (thread.getId() == sonContext.getChildThreadId()) { - sonContext.deleteChildStatus(); - thread.interrupt(); - } - } - - sonContext.setPciState(new ResourceCleanupState()); - sonContext.stateChange(sonContext); - - } else { - // forward to child thread - ObjectMapper mapper = new ObjectMapper(); - log.debug("handling buffer notification"); - long childThreadId = sonContext.getChildThreadId(); - for (String notification : bufferedNotifications) { - FapServiceList fapServiceList; - try { - fapServiceList = mapper.readValue(notification, FapServiceList.class); - log.debug("fapServiceList{}", fapServiceList); - - SdnrNotificationHandlingState.getChildThreadMap().get(childThreadId) - .putInQueueWithNotify(fapServiceList); - sonContext.setPciState(new BufferedNotificationHandlingState()); - sonContext.stateChange(sonContext); - - } catch (IOException e) { - log.error("caught in child status update {}", e); - } - - } - } - } - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/ChildTriggeringState.java b/src/main/java/com/wipro/www/sonhms/ChildTriggeringState.java deleted file mode 100644 index 6683085..0000000 --- a/src/main/java/com/wipro/www/sonhms/ChildTriggeringState.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ChildTriggeringState implements SonState { - private static Logger log = LoggerFactory.getLogger(ChildTriggeringState.class); - - @Override - public void stateChange(SonContext sonContext) { - // any other pci context change to be done - - log.debug("inside child trigger state"); - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java b/src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java deleted file mode 100644 index 939f9e1..0000000 --- a/src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.wipro.www.sonhms.dao.ClusterDetailsRepository; -import com.wipro.www.sonhms.entity.ClusterDetails; -import com.wipro.www.sonhms.utils.BeanUtil; - -import java.util.List; - - -public class ClusterDetailsComponent { - - /** - * get cluster details. - */ - public List getClusterDetails() { - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - return clusterDetailsRepository.getAllClusterDetails(); - } - - /** - * get child thread. - */ - public long getChildThread(String clusterId) { - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - return clusterDetailsRepository.getChildThreadForCluster(clusterId); - - } - - /** - * get cluster id. - */ - public String getClusterId(long childThreadId) { - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - return clusterDetailsRepository.getClusterIdForChildThread(childThreadId); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/ConfigPolicy.java b/src/main/java/com/wipro/www/sonhms/ConfigPolicy.java deleted file mode 100644 index 6d2994f..0000000 --- a/src/main/java/com/wipro/www/sonhms/ConfigPolicy.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import java.util.Map; - -public class ConfigPolicy { - - private static ConfigPolicy instance = null; - private Map config; - - protected ConfigPolicy() { - - } - - /** - * Get instance of class. - */ - public static ConfigPolicy getInstance() { - if (instance == null) { - instance = new ConfigPolicy(); - } - return instance; - } - - public Map getConfig() { - return config; - } - - public void setConfig(Map config) { - this.config = config; - } - - @Override - public String toString() { - return "ConfigPolicy [config=" + config + "]"; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/Configuration.java b/src/main/java/com/wipro/www/sonhms/Configuration.java deleted file mode 100644 index fb53f9b..0000000 --- a/src/main/java/com/wipro/www/sonhms/Configuration.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import java.util.List; - -public class Configuration { - - private static Configuration instance = null; - private List topics; - private String sdnrTopic; - private String policyTopic; - private List servers; - private String managerApiKey; - private String managerSecretKey; - private String pcimsApiKey; - private String pcimsSecretKey; - private String cg; - private String cid; - private int pollingInterval; - private int pollingTimeout; - private int minCollision; - private int minConfusion; - private String sdnrService; - private String policyService; - private String oofService; - private String sourceId; - private String policyName; - private String configName; - private String callbackUrl; - private List optimizers; - private int numSolutions; - private int bufferTime; - private int maximumClusters; - - public int getMaximumClusters() { - return maximumClusters; - } - - public void setMaximumClusters(int maximumClusters) { - this.maximumClusters = maximumClusters; - } - - protected Configuration() { - - } - - /** - * Get instance of class. - */ - public static Configuration getInstance() { - if (instance == null) { - instance = new Configuration(); - } - return instance; - } - - public List getServers() { - return servers; - } - - public void setServers(List servers) { - this.servers = servers; - } - - public String getManagerApiKey() { - return managerApiKey; - } - - public void setManagerApiKey(String managerApiKey) { - this.managerApiKey = managerApiKey; - } - - public String getManagerSecretKey() { - return managerSecretKey; - } - - public void setManagerSecretKey(String managerSecretKey) { - this.managerSecretKey = managerSecretKey; - } - - public String getPcimsApiKey() { - return pcimsApiKey; - } - - public void setPcimsApiKey(String pcimsApiKey) { - this.pcimsApiKey = pcimsApiKey; - } - - public String getPcimsSecretKey() { - return pcimsSecretKey; - } - - public void setPcimsSecretKey(String pcimsSecretKey) { - this.pcimsSecretKey = pcimsSecretKey; - } - - public String getCg() { - return cg; - } - - public void setCg(String cg) { - this.cg = cg; - } - - public String getCid() { - return cid; - } - - public void setCid(String cid) { - this.cid = cid; - } - - public int getPollingInterval() { - return pollingInterval; - } - - public void setPollingInterval(int pollingInterval) { - this.pollingInterval = pollingInterval; - } - - public int getPollingTimeout() { - return pollingTimeout; - } - - public void setPollingTimeout(int pollingTimeout) { - this.pollingTimeout = pollingTimeout; - } - - public int getMinCollision() { - return minCollision; - } - - public void setMinCollision(int minCollision) { - this.minCollision = minCollision; - } - - public int getMinConfusion() { - return minConfusion; - } - - public void setMinConfusion(int minConfusion) { - this.minConfusion = minConfusion; - } - - public String getSdnrService() { - return sdnrService; - } - - public void setSdnrService(String sdnrService) { - this.sdnrService = sdnrService; - } - - public String getPolicyService() { - return policyService; - } - - public void setPolicyService(String policyService) { - this.policyService = policyService; - } - - public String getOofService() { - return oofService; - } - - public void setOofService(String oofService) { - this.oofService = oofService; - } - - public String getSourceId() { - return sourceId; - } - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getConfigName() { - return configName; - } - - public void setConfigName(String configName) { - this.configName = configName; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public List getOptimizers() { - return optimizers; - } - - public void setOptimizers(List optimizers) { - this.optimizers = optimizers; - } - - public int getNumSolutions() { - return numSolutions; - } - - public void setNumSolutions(int numSolutions) { - this.numSolutions = numSolutions; - } - - public int getBufferTime() { - return bufferTime; - } - - public void setBufferTime(int bufferTime) { - this.bufferTime = bufferTime; - } - - public List getTopics() { - return topics; - } - - public void setTopics(List topics) { - this.topics = topics; - } - - public String getSdnrTopic() { - return sdnrTopic; - } - - public void setSdnrTopic(String sdnrTopic) { - this.sdnrTopic = sdnrTopic; - } - - public String getPolicyTopic() { - return policyTopic; - } - - public void setPolicyTopic(String policyTopic) { - this.policyTopic = policyTopic; - } - - @Override - public String toString() { - return "Configuration [topics=" + topics + ", sdnrTopic=" + sdnrTopic + ", policyTopic=" + policyTopic - + ", servers=" + servers + ", managerApiKey=" + managerApiKey + ", managerSecretKey=" + managerSecretKey - + ", pcimsApiKey=" + pcimsApiKey + ", pcimsSecretKey=" + pcimsSecretKey + ", cg=" + cg + ", cid=" + cid - + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", minCollision=" - + minCollision + ", minConfusion=" + minConfusion + ", sdnrService=" + sdnrService + ", policyService=" - + policyService + ", oofService=" + oofService + ", sourceId=" + sourceId + ", policyName=" + policyName - + ", configName=" + configName + ", callbackUrl=" + callbackUrl + ", optimizers=" + optimizers - + ", numSolutions=" + numSolutions + ", bufferTime=" + bufferTime + ", maximumClusters=" - + maximumClusters + "]"; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/MainThread.java b/src/main/java/com/wipro/www/sonhms/MainThread.java deleted file mode 100644 index 2b6c843..0000000 --- a/src/main/java/com/wipro/www/sonhms/MainThread.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import java.util.List; -import java.util.concurrent.LinkedBlockingQueue; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class MainThread implements Runnable { - private static Logger log = LoggerFactory.getLogger(MainThread.class); - - private NewNotification newNotification; - - @Override - public void run() { - log.debug("Starting pci context"); - SonContext sonContext = new SonContext(new LinkedBlockingQueue>(), newNotification); - log.debug("initializing pci state to wait state"); - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - } - - public MainThread(NewNotification newNotification) { - super(); - this.newNotification = newNotification; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/MainThreadComponent.java b/src/main/java/com/wipro/www/sonhms/MainThreadComponent.java deleted file mode 100644 index 2b8516d..0000000 --- a/src/main/java/com/wipro/www/sonhms/MainThreadComponent.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -@Component -public class MainThreadComponent { - - private static Logger log = LoggerFactory.getLogger(MainThreadComponent.class); - - private ExecutorService pool; - - public ExecutorService getPool() { - return pool; - } - - /** - * main thread initialization. - */ - public void init(NewNotification newNotification) { - log.debug("initializing main thread"); - log.debug("initializing executors"); - Configuration configuration = Configuration.getInstance(); - int maximumClusters = configuration.getMaximumClusters(); - log.debug("pool creating"); - pool = Executors.newFixedThreadPool(maximumClusters); - log.debug("pool created"); - Thread thread = new Thread(new MainThread(newNotification)); - thread.start(); - } -} diff --git a/src/main/java/com/wipro/www/sonhms/NewNotification.java b/src/main/java/com/wipro/www/sonhms/NewNotification.java deleted file mode 100644 index 5d4f704..0000000 --- a/src/main/java/com/wipro/www/sonhms/NewNotification.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -public class NewNotification { - - private Boolean newNotif; - - public Boolean getNewNotif() { - return newNotif; - } - - public void setNewNotif(Boolean newNotif) { - this.newNotif = newNotif; - } - - public NewNotification(Boolean newNotif) { - super(); - this.newNotif = newNotif; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/ResourceCleanupState.java b/src/main/java/com/wipro/www/sonhms/ResourceCleanupState.java deleted file mode 100644 index 1487b5e..0000000 --- a/src/main/java/com/wipro/www/sonhms/ResourceCleanupState.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -public class ResourceCleanupState implements SonState { - - @Override - public void stateChange(SonContext sonContext) { - // any other pci context change to be done - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/SdnrNotificationHandlingState.java b/src/main/java/com/wipro/www/sonhms/SdnrNotificationHandlingState.java deleted file mode 100644 index 2637790..0000000 --- a/src/main/java/com/wipro/www/sonhms/SdnrNotificationHandlingState.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.child.ChildThread; -import com.wipro.www.sonhms.child.Graph; -import com.wipro.www.sonhms.dao.CellInfoRepository; -import com.wipro.www.sonhms.dao.ClusterDetailsRepository; -import com.wipro.www.sonhms.entity.CellInfo; -import com.wipro.www.sonhms.entity.ClusterDetails; -import com.wipro.www.sonhms.exceptions.ConfigDbNotFoundException; -import com.wipro.www.sonhms.model.CellPciPair; -import com.wipro.www.sonhms.model.FapServiceList; -import com.wipro.www.sonhms.model.LteNeighborListInUseLteCell; -import com.wipro.www.sonhms.model.Notification; -import com.wipro.www.sonhms.model.ThreadId; -import com.wipro.www.sonhms.restclient.SdnrRestClient; -import com.wipro.www.sonhms.utils.BeanUtil; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; - -import org.slf4j.Logger; - -public class SdnrNotificationHandlingState implements SonState { - private static Map childThreadMap = new HashMap<>(); - private static final Logger log = org.slf4j.LoggerFactory.getLogger(SdnrNotificationHandlingState.class); - - @Override - public void stateChange(SonContext sonContext) { - // logic to determine if notif to be processed - log.debug("inside statechange of sdnr notif state"); - String notification = sonContext.getSdnrNotification(); - Notification notificationObject; - try { - - ObjectMapper mapper = new ObjectMapper(); - notificationObject = mapper.readValue(notification, Notification.class); - log.debug("notificationObject{}", notificationObject); - - List serviceList = notificationObject.getPayload().getRadioAccess().getFapServiceList(); - for (FapServiceList fapService : serviceList) { - String cellId = fapService.getCellConfig().getLte().getRan().getCellIdentity(); - log.debug("cellId:{}", cellId); - log.debug("inside for loop"); - - List clusterDetails = getAllClusters(); - - ClusterDetails clusterDetail = getClusterForNotification(fapService, clusterDetails); - - if (clusterDetail == null) { - // form the cluster - Graph cluster = createCluster(fapService); - // save to db - UUID clusterId = UUID.randomUUID(); - cluster.setGraphId(clusterId); - // create the child thread - log.debug("creating new child"); - BlockingQueue queue = new LinkedBlockingQueue<>(); - ThreadId threadId = new ThreadId(); - threadId.setChildThreadId(0); - ChildThread child = new ChildThread(sonContext.getChildStatusUpdate(), cluster, queue, threadId); - queue.put(fapService); - MainThreadComponent mainThreadComponent = BeanUtil.getBean(MainThreadComponent.class); - mainThreadComponent.getPool().execute(child); - - waitForThreadId(threadId); - - saveCluster(cluster, clusterId, threadId.getChildThreadId()); - addChildThreadMap(threadId.getChildThreadId(), child); - sonContext.addChildStatus(threadId.getChildThreadId(), "processingNotifications"); - - } - - else { - if (isOofTriggeredForCluster(sonContext, clusterDetail)) { - sonContext.setNotifToBeProcessed(false); - bufferNotification(fapService, clusterDetail.getClusterId()); - } else { - sonContext.setNotifToBeProcessed(true); - log.debug("childThreadId:{}", clusterDetail.getChildThreadId()); - childThreadMap.get(clusterDetail.getChildThreadId()).putInQueue(fapService); - } - } - } - } catch (Exception e) { - log.error("caught in sdnr notif handling state{}", e); - } - - WaitState waitState = WaitState.getInstance(); - sonContext.setPciState(waitState); - sonContext.stateChange(sonContext); - } - - private void waitForThreadId(ThreadId threadId) { - try { - synchronized (threadId) { - while (threadId.getChildThreadId() == 0) { - threadId.wait(); - } - } - } catch (InterruptedException e) { - - log.error("ChildThread queue error {}", e); - Thread.currentThread().interrupt(); - } - } - - private String saveCluster(Graph cluster, UUID clusterId, Long threadId) { - - String cellPciNeighbourString = cluster.getPciNeighbourJson(); - - log.debug("cluster hahsmap to string : {}", cellPciNeighbourString); - cluster.setGraphId(clusterId); - - ClusterDetails details = new ClusterDetails(); - details.setClusterId(clusterId.toString()); - details.setClusterInfo(cellPciNeighbourString); - details.setChildThreadId(threadId); - - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - clusterDetailsRepository.save(details); - - return clusterId.toString(); - } - - private Graph createCluster(FapServiceList fapService) throws ConfigDbNotFoundException { - - Graph cluster = new Graph(); - log.debug("cluster formation started"); - int phycellId = fapService.getX0005b9Lte().getPhyCellIdInUse(); - String cellId = fapService.getCellConfig().getLte().getRan().getCellIdentity(); - - CellInfoRepository cellInfoRepository = BeanUtil.getBean(CellInfoRepository.class); - cellInfoRepository.save(new CellInfo(cellId, fapService.getX0005b9Lte().getPnfName())); - - CellPciPair val = new CellPciPair(); - val.setCellId(cellId); - val.setPhysicalCellId(phycellId); - List neighbourlist; - neighbourlist = fapService.getCellConfig().getLte().getRan().getNeighborListInUse() - .getLteNeighborListInUseLteCell(); - log.debug("Neighbor list size: {}", neighbourlist.size()); - - for (int i = 0; i < neighbourlist.size(); i++) { - String cell = neighbourlist.get(i).getAlias(); - int phy = neighbourlist.get(i).getPhyCellId(); - - cellInfoRepository.save(new CellInfo(cell, neighbourlist.get(i).getPnfName())); - - log.debug("cellID: {}", cell); - log.debug("PCI: {}", phy); - CellPciPair val1 = new CellPciPair(); - val1.setCellId(cell); - val1.setPhysicalCellId(phy); - cluster.addEdge(val, val1); - log.debug("cluster: {}", cluster); - - List nbrList = SdnrRestClient.getNbrList(neighbourlist.get(i).getAlias()); - - for (CellPciPair nbr : nbrList) { - String cid = nbr.getCellId(); - int pci = nbr.getPhysicalCellId(); - CellPciPair val3 = new CellPciPair(); - val3.setCellId(cid); - val3.setPhysicalCellId(pci); - - cluster.addEdge(val1, val3); - } - } - - log.debug("final cluster: {}", cluster); - return cluster; - } - - private void bufferNotification(FapServiceList fapService, String clusterId) { - - ObjectMapper mapper = new ObjectMapper(); - BufferNotificationComponent bufferNotifComponent = new BufferNotificationComponent(); - String serviceListString = ""; - try { - serviceListString = mapper.writeValueAsString(fapService); - } catch (JsonProcessingException e) { - log.debug("JSON processing exception: {}", e); - } - bufferNotifComponent.bufferNotification(serviceListString, clusterId); - - } - - private boolean isOofTriggeredForCluster(SonContext pciContext, ClusterDetails clusterDetail) { - Long childThreadId = clusterDetail.getChildThreadId(); - String childStatus = pciContext.getChildStatus(childThreadId); - return childStatus.equals("triggeredOof"); - - } - - private ClusterDetails getClusterForNotification(FapServiceList fapService, List clusterDetails) { - - String cellId = fapService.getCellConfig().getLte().getRan().getCellIdentity(); - Map> cellPciNeighbourMap; - - for (ClusterDetails clusterDetail : clusterDetails) { - Graph cluster = new Graph(clusterDetail.getClusterInfo()); - cellPciNeighbourMap = cluster.getCellPciNeighbourMap(); - Set keys = cellPciNeighbourMap.keySet(); - Iterator traverse = keys.iterator(); - while (traverse.hasNext()) { - CellPciPair key = traverse.next(); - String currentCellId = key.getCellId(); - if (cellId.equals(currentCellId)) { - return clusterDetail; - } - } - } - - return null; - } - - private List getAllClusters() { - ClusterDetailsComponent clusterDetailsComponent = new ClusterDetailsComponent(); - return clusterDetailsComponent.getClusterDetails(); - } - - public static void addChildThreadMap(Long childThreadId, ChildThread child) { - childThreadMap.put(childThreadId, child); - } - - public static Map getChildThreadMap() { - return childThreadMap; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/SonContext.java b/src/main/java/com/wipro/www/sonhms/SonContext.java deleted file mode 100644 index 491dccc..0000000 --- a/src/main/java/com/wipro/www/sonhms/SonContext.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.BlockingQueue; - -public class SonContext implements SonState { - private SonState pciState; - boolean notifToBeProcessed; - private String sdnrNotification; - private long childThreadId; - private Map childStatus; - private BlockingQueue> childStatusUpdate; - private NewNotification newNotification; - - public String getSdnrNotification() { - return sdnrNotification; - } - - public void setSdnrNotification(String sdnrNotification) { - this.sdnrNotification = sdnrNotification; - } - - SonContext(SonState pciState) { - this.pciState = pciState; - this.childStatus = new HashMap<>(); - } - - public SonContext() { - - } - - /** - * Parameterized constructor. - */ - public SonContext(BlockingQueue> childStatusUpdate, NewNotification newNotification) { - this.setChildStatusUpdate(childStatusUpdate); - this.setNewNotification(newNotification); - this.childStatus = new HashMap<>(); - } - - public SonState getPciState() { - return pciState; - } - - public long getChildThreadId() { - return childThreadId; - } - - public void setChildThreadId(long childThreadId) { - this.childThreadId = childThreadId; - } - - public void setPciState(SonState pciState) { - this.pciState = pciState; - } - - public boolean isNotifToBeProcessed() { - return notifToBeProcessed; - } - - public void setNotifToBeProcessed(boolean notifToBeProcessed) { - this.notifToBeProcessed = notifToBeProcessed; - } - - @Override - public void stateChange(SonContext pciContext) { - this.pciState.stateChange(pciContext); - } - - public BlockingQueue> getChildStatusUpdate() { - return childStatusUpdate; - } - - public void setChildStatusUpdate(BlockingQueue> childStatusUpdate) { - this.childStatusUpdate = childStatusUpdate; - } - - public void addChildStatus(Long threadId, String status) { - this.childStatus.put(threadId, status); - } - - public String getChildStatus(Long threadId) { - return childStatus.get(threadId); - - } - - public NewNotification getNewNotification() { - return newNotification; - } - - public void setNewNotification(NewNotification newNotification) { - this.newNotification = newNotification; - } - - public void deleteChildStatus() { - this.childStatus.remove(childThreadId); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/SonController.java b/src/main/java/com/wipro/www/sonhms/SonController.java deleted file mode 100644 index 8923614..0000000 --- a/src/main/java/com/wipro/www/sonhms/SonController.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - - -import com.wipro.www.sonhms.child.ChildThread; -import com.wipro.www.sonhms.restclient.AsyncResponseBody; - -import org.slf4j.Logger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - - -@RestController -public class SonController { - private static final Logger log = org.slf4j.LoggerFactory.getLogger(SonController.class); - - @Autowired - SonRequestsComponent pciRequestsComponent; - - @RequestMapping(value = "/callbackUrl", method = RequestMethod.POST) - String callBackUrl(@RequestBody AsyncResponseBody callback) { - log.debug("received request to callback url"); - String async = callback.toString(); - log.debug("AsyncResponseBody{}", async); - - String transactionId = callback.getTransactionId(); - log.debug("transaction id {}", transactionId); - - long childThreadId = pciRequestsComponent.getChildThread(transactionId); - log.debug("childThreadId {}", childThreadId); - - ChildThread.putResponse(childThreadId, callback); - return "Forwarded to child thread"; - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/SonRequestsComponent.java b/src/main/java/com/wipro/www/sonhms/SonRequestsComponent.java deleted file mode 100644 index 5b57850..0000000 --- a/src/main/java/com/wipro/www/sonhms/SonRequestsComponent.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.wipro.www.sonhms.dao.SonRequestsRepository; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - - -@Component -public class SonRequestsComponent { - - @Autowired - private SonRequestsRepository sonRequestsRepository; - - public long getChildThread(String transactionId) { - return sonRequestsRepository.getChildThreadMapping(transactionId); - } - -} - diff --git a/src/main/java/com/wipro/www/sonhms/SonState.java b/src/main/java/com/wipro/www/sonhms/SonState.java deleted file mode 100644 index c287c6b..0000000 --- a/src/main/java/com/wipro/www/sonhms/SonState.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -public interface SonState { - - public void stateChange(SonContext pciContext); -} diff --git a/src/main/java/com/wipro/www/sonhms/Topic.java b/src/main/java/com/wipro/www/sonhms/Topic.java deleted file mode 100644 index 3be2087..0000000 --- a/src/main/java/com/wipro/www/sonhms/Topic.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -public class Topic { - - private String name; - private String producer; - private String consumer; - - public Topic() { - - } - - /** - * Parameterized constructor. - */ - public Topic(String name, String producer, String consumer) { - super(); - this.name = name; - this.producer = producer; - this.consumer = consumer; - } - - @Override - public String toString() { - return "topic [name=" + name + ", producer=" + producer + ", consumer=" + consumer + "]"; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getProducer() { - return producer; - } - - public void setProducer(String producer) { - this.producer = producer; - } - - public String getConsumer() { - return consumer; - } - - public void setConsumer(String consumer) { - this.consumer = consumer; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/WaitState.java b/src/main/java/com/wipro/www/sonhms/WaitState.java deleted file mode 100644 index a74f795..0000000 --- a/src/main/java/com/wipro/www/sonhms/WaitState.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms; - -import com.wipro.www.sonhms.dao.DmaapNotificationsRepository; -import com.wipro.www.sonhms.utils.BeanUtil; -import java.util.ArrayList; -import java.util.List; -import org.slf4j.Logger; - - - -public class WaitState implements SonState { - - private static WaitState instance; - private List sdnrNotification = new ArrayList<>(); - private static final Logger log = org.slf4j.LoggerFactory.getLogger(WaitState.class); - - protected WaitState() { - - } - - /** - * singleton. - */ - public static WaitState getInstance() { - if (instance == null) { - return new WaitState(); - } - return instance; - } - - public void putSdnrNotification(String notification) { - sdnrNotification.add(notification); - log.debug("sdnrNotification size: {}", sdnrNotification.size()); - } - - @Override - public void stateChange(SonContext pciContext) { - log.debug("inside state change of wait state"); - - while (pciContext.getChildStatusUpdate().isEmpty() && !pciContext.getNewNotification().getNewNotif()) { - } - - List childStatus = pciContext.getChildStatusUpdate().poll(); - if (childStatus != null) { - Long threadId = Long.parseLong(childStatus.get(0)); - log.debug("threadId: {}", threadId); - log.debug("childStatus: {}", childStatus.get(1)); - pciContext.setChildThreadId(threadId); - pciContext.addChildStatus(threadId, childStatus.get(1)); - pciContext.setPciState(new ChildStatusUpdateState()); - pciContext.stateChange(pciContext); - } - - DmaapNotificationsRepository dmaapNotificationsRepository = BeanUtil - .getBean(DmaapNotificationsRepository.class); - String notification = dmaapNotificationsRepository.getNotificationFromQueue(); - if (notification != null) { - log.debug("notification from sdnr:{}", notification); - pciContext.setSdnrNotification(notification); - pciContext.setPciState(new SdnrNotificationHandlingState()); - pciContext.stateChange(pciContext); - } else { - pciContext.getNewNotification().setNewNotif(false); - log.debug("setting new notification to false"); - pciContext.setPciState(this); - pciContext.stateChange(pciContext); - } - - } -} diff --git a/src/main/java/com/wipro/www/sonhms/child/ChildThread.java b/src/main/java/com/wipro/www/sonhms/child/ChildThread.java deleted file mode 100644 index 718cc46..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/ChildThread.java +++ /dev/null @@ -1,245 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - - -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.dao.ClusterDetailsRepository; -import com.wipro.www.sonhms.model.FapServiceList; -import com.wipro.www.sonhms.model.ThreadId; -import com.wipro.www.sonhms.restclient.AsyncResponseBody; -import com.wipro.www.sonhms.utils.BeanUtil; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; -import org.slf4j.Logger; -import org.slf4j.MDC; - - -public class ChildThread implements Runnable { - - private BlockingQueue> childStatusUpdate; - private BlockingQueue queue = new LinkedBlockingQueue<>(); - // static BlockingQueue asynchronousResponse = new - // LinkedBlockingQueue<>(); - private static Map responseMap = new HashMap<>(); - private Graph cluster; - private ThreadId threadId; - FapServiceList fapServiceList = new FapServiceList(); - private static final Logger log = org.slf4j.LoggerFactory.getLogger(ChildThread.class); - - /** - * Constructor with parameters. - */ - public ChildThread(BlockingQueue> childStatusUpdate, Graph cluster, - BlockingQueue queue, ThreadId threadId) { - super(); - this.childStatusUpdate = childStatusUpdate; - this.queue = queue; - this.threadId = threadId; - this.cluster = cluster; - } - - /** - * Puts notification in queue. - */ - public void putInQueue(FapServiceList fapserviceList) { - try { - queue.put(fapserviceList); - } catch (InterruptedException e) { - log.error(" The Thread is Interrupted", e); - Thread.currentThread().interrupt(); - } - } - - /** - * Puts notification in queue with notify. - */ - public void putInQueueWithNotify(FapServiceList fapserviceList) { - synchronized (queue) { - try { - queue.put(fapserviceList); - queue.notifyAll(); - } catch (InterruptedException e) { - log.error(" The Thread is Interrupted", e); - Thread.currentThread().interrupt(); - } - - } - - } - - /** - * Puts response in queue. - */ - public static void putResponse(Long threadId, AsyncResponseBody obj) { - synchronized (responseMap) { - responseMap.put(threadId, obj); - } - - } - - public static Map getResponseMap() { - return responseMap; - } - - @Override - public void run() { - - threadId.setChildThreadId(Thread.currentThread().getId()); - synchronized (threadId) { - threadId.notifyAll(); - } - - MDC.put("logFileName", Thread.currentThread().getName()); - log.debug("Starting child thread"); - - try { - fapServiceList = queue.take(); - if (log.isDebugEnabled()) { - log.debug("fapServicelist: {}", fapServiceList); - } - } catch (InterruptedException e1) { - log.error("InterruptedException is {}", e1); - Thread.currentThread().interrupt(); - } - - ClusterFormation clusterFormation = new ClusterFormation(queue); - StateOof oof = new StateOof(childStatusUpdate); - ClusterModification clusterModification = new ClusterModification(); - Detection detect = new Detection(); - - try { - String networkId = fapServiceList.getCellConfig().getLte().getRan().getNeighborListInUse() - .getLteNeighborListInUseLteCell().get(0).getPlmnid(); - - Boolean done = false; - - while (!done) { - - Map> collisionConfusionResult = detect.detectCollisionConfusion(cluster); - Boolean trigger = clusterFormation.triggerOrWait(collisionConfusionResult); - - if (!trigger) { - collisionConfusionResult = clusterFormation.waitForNotification(collisionConfusionResult, cluster); - } - oof.triggerOof(collisionConfusionResult, networkId); - - if (isNotificationsBuffered()) { - List fapServiceLists = bufferNotification(); - for (FapServiceList fapService : fapServiceLists) { - cluster = clusterModification.clustermod(cluster, fapService); - } - String cellPciNeighbourString = cluster.getPciNeighbourJson(); - UUID clusterId = cluster.getGraphId(); - ClusterDetailsRepository clusterDetailsRepository = BeanUtil - .getBean(ClusterDetailsRepository.class); - clusterDetailsRepository.updateCluster(cellPciNeighbourString, clusterId.toString()); - - } else { - done = true; - } - - } - - } catch (Exception e) { - log.error("{}", e); - } - - cleanup(); - } - - private boolean isNotificationsBuffered() { - synchronized (queue) { - - try { - while (queue.isEmpty()) { - queue.wait(); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return false; - } - } - return true; - } - - /** - * cleanup resources. - */ - private void cleanup() { - log.debug("cleaning up database and killing child thread"); - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - clusterDetailsRepository.deleteByChildThreadId(threadId.getChildThreadId()); - log.debug("Child thread :{} {}", Thread.currentThread().getId(), "completed"); - MDC.remove("logFileName"); - - } - - /** - * Buffer Notification. - */ - public List bufferNotification() { - - // Processing Buffered notifications - - List fapServiceLists = new ArrayList<>(); - - Configuration config = Configuration.getInstance(); - - int bufferTime = config.getBufferTime(); - - Timestamp currentTime = new Timestamp(System.currentTimeMillis()); - log.debug("Current time {}", currentTime); - - Timestamp laterTime = new Timestamp(System.currentTimeMillis()); - log.debug("Later time {}", laterTime); - - long difference = laterTime.getTime() - currentTime.getTime(); - while (difference < bufferTime) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - log.error("InterruptedException {}", e); - Thread.currentThread().interrupt(); - - } - laterTime = new Timestamp(System.currentTimeMillis()); - difference = laterTime.getTime() - currentTime.getTime(); - - log.debug("Timer has run for seconds {}", difference); - - if (!queue.isEmpty()) { - FapServiceList fapService; - fapService = queue.poll(); - fapServiceLists.add(fapService); - } - } - return fapServiceLists; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java b/src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java deleted file mode 100644 index 7b3d5bf..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - -import com.wipro.www.sonhms.ConfigPolicy; -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.dao.ClusterDetailsRepository; -import com.wipro.www.sonhms.entity.ClusterDetails; -import com.wipro.www.sonhms.model.FapServiceList; -import com.wipro.www.sonhms.utils.BeanUtil; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; -import java.util.concurrent.BlockingQueue; - -import org.slf4j.Logger; - - -public class ClusterFormation { - - private static final Logger log = org.slf4j.LoggerFactory.getLogger(ClusterFormation.class); - private BlockingQueue queue; - private ClusterModification clusterModification; - private Detection detect; - Properties confProp; - ClusterDetails details = new ClusterDetails(); - - public ClusterFormation() { - this.detect = new Detection(); - } - - /** - * parameterized constructor. - * - */ - public ClusterFormation(BlockingQueue queue) { - super(); - this.queue = queue; - this.detect = new Detection(); - this.clusterModification = new ClusterModification(); - } - - /** - * Determines whether to trigger Oof or wait for notifications. - */ - public Boolean triggerOrWait(Map> collisionConfusionResult) { - // determine collision or confusion - - Configuration configuration = Configuration.getInstance(); - int collisionSum = 0; - int confusionSum = 0; - - for (Map.Entry> entry : collisionConfusionResult.entrySet()) { - - ArrayList arr; - arr = entry.getValue(); - // check for 0 collision and confusion - if (!arr.isEmpty()) { - collisionSum = collisionSum + arr.get(0); - confusionSum = confusionSum + arr.get(1); - } - } - return ((collisionSum >= configuration.getMinCollision()) && (confusionSum >= configuration.getMinConfusion())); - - } - - /** - * Waits for notifications. - */ - public Map> waitForNotification(Map> collisionConfusionResult, - Graph cluster) { - - FapServiceList newNotification; - ConfigPolicy config = ConfigPolicy.getInstance(); - int timer = 60; - try { - timer = (int) config.getConfig().get("PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS"); - } catch (NullPointerException e) { - log.debug("Policy config not available. Using default timeout - 60 seconds"); - } - - Timestamp currentTime = new Timestamp(System.currentTimeMillis()); - log.debug("Current Time {}", currentTime); - - Timestamp laterTime = new Timestamp(System.currentTimeMillis()); - log.debug("LaterTime {}", laterTime); - - long difference = laterTime.getTime() - currentTime.getTime(); - - int flag = 0; - - while (difference < (timer * 1000)) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - log.error("Interrupted Exception is {}", e); - Thread.currentThread().interrupt(); - } - - laterTime = new Timestamp(System.currentTimeMillis()); - difference = laterTime.getTime() - currentTime.getTime(); - - if ((difference < (timer * 1000)) && (!queue.isEmpty())) { - newNotification = queue.poll(); - cluster = clusterModification.clustermod(cluster, newNotification); - - // update cluster in DB - String cellPciNeighbourString = cluster.getPciNeighbourJson(); - UUID clusterId = cluster.getGraphId(); - ClusterDetailsRepository clusterDetailsRepository = BeanUtil.getBean(ClusterDetailsRepository.class); - clusterDetailsRepository.updateCluster(cellPciNeighbourString, clusterId.toString()); - flag++; - - } - } - if (flag != 0) { - return detect.detectCollisionConfusion(cluster); - - } - return collisionConfusionResult; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/child/ClusterModification.java b/src/main/java/com/wipro/www/sonhms/child/ClusterModification.java deleted file mode 100644 index 9926cf4..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/ClusterModification.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - -import com.wipro.www.sonhms.model.CellPciPair; -import com.wipro.www.sonhms.model.FapServiceList; -import com.wipro.www.sonhms.model.LteNeighborListInUseLteCell; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; - - - -public class ClusterModification { - private static final Logger log = org.slf4j.LoggerFactory.getLogger(ClusterModification.class); - - /** - * Forms a modified cluster for the existing cluster. - */ - - public Graph clustermod(Graph cluster, FapServiceList fapser) { - - int phycellId = fapser.getX0005b9Lte().getPhyCellIdInUse(); - String cellId = fapser.getCellConfig().getLte().getRan().getCellIdentity(); - CellPciPair mainCellPciPair = new CellPciPair(); - mainCellPciPair.setCellId(cellId); - mainCellPciPair.setPhysicalCellId(phycellId); - List newNeighbourList; - newNeighbourList = fapser.getCellConfig().getLte().getRan().getNeighborListInUse() - .getLteNeighborListInUseLteCell(); - - Map> clusterMap; - clusterMap = cluster.getCellPciNeighbourMap(); - - // coe - - List tempCellPair = new ArrayList<>(); - for (Map.Entry> entry : clusterMap.entrySet()) { - CellPciPair oldClusterKeys = entry.getKey(); - tempCellPair.add(oldClusterKeys); - } - - for (CellPciPair entry : tempCellPair) { - String cell = entry.getCellId(); - int physicalCell = entry.getPhysicalCellId(); - CellPciPair mapVal = new CellPciPair(); - mapVal.setCellId(cell); - mapVal.setPhysicalCellId(physicalCell); - - if (cellId.equals(cell)) { - - // removes the old neighbours and adds new neighbours for that cell - cluster.updateVertex(mapVal, mainCellPciPair); - - } - - } - - /////// update cluster with new pci values for the same cell - - if (clusterMap.containsKey(mainCellPciPair)) { - ArrayList oldClusterArray; - oldClusterArray = clusterMap.get(mainCellPciPair); - oldClusterArray.clear(); - - for (int i = 0; i < newNeighbourList.size(); i++) { - String cid = newNeighbourList.get(i).getAlias(); - int phy = newNeighbourList.get(i).getPhyCellId(); - CellPciPair val2 = new CellPciPair(); - val2.setCellId(cid); - val2.setPhysicalCellId(phy); - cluster.addEdge(mainCellPciPair, val2); - } - - } - - for (CellPciPair entry : tempCellPair) { - String cell = entry.getCellId(); - int physicalCell = entry.getPhysicalCellId(); - CellPciPair mapVal = new CellPciPair(); - mapVal.setCellId(cell); - mapVal.setPhysicalCellId(physicalCell); - for (int j = 0; j < newNeighbourList.size(); j++) { - String cid1 = newNeighbourList.get(j).getAlias(); - int phy1 = newNeighbourList.get(j).getPhyCellId(); - CellPciPair val3 = new CellPciPair(); - val3.setCellId(cid1); - val3.setPhysicalCellId(phy1); - - if (cid1.equals(cell)) { - - // removes the old neighbours and adds new neighbours for that cell - cluster.updateVertex(mapVal, val3); - - } - - } - } - - for (int j = 0; j < newNeighbourList.size(); j++) { - String cid1 = newNeighbourList.get(j).getAlias(); - int phy1 = newNeighbourList.get(j).getPhyCellId(); - CellPciPair val3 = new CellPciPair(); - val3.setCellId(cid1); - val3.setPhysicalCellId(phy1); - if (clusterMap.containsKey(val3)) { - cluster.addEdge(mainCellPciPair, val3); - } - - } - - for (int k = 0; k < newNeighbourList.size(); k++) { - String cid2 = newNeighbourList.get(k).getAlias(); - int phy2 = newNeighbourList.get(k).getPhyCellId(); - CellPciPair val5 = new CellPciPair(); - val5.setCellId(cid2); - val5.setPhysicalCellId(phy2); - cluster.addEdge(mainCellPciPair, val5); - } - - log.debug("Modified Cluster {}", cluster); - - return cluster; - } - -} \ No newline at end of file diff --git a/src/main/java/com/wipro/www/sonhms/child/Detection.java b/src/main/java/com/wipro/www/sonhms/child/Detection.java deleted file mode 100644 index fc2e941..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/Detection.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - -import com.wipro.www.sonhms.model.CellPciPair; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.slf4j.Logger; - - -public class Detection { - - private static final Logger log = org.slf4j.LoggerFactory.getLogger(Detection.class); - - /** - * Returns a map with key as cellid and its value is a list of its collision and - * confusion. - */ - - public Map> detectCollisionConfusion(Graph cluster) { - - Map> clusterMap = cluster.getCellPciNeighbourMap(); - HashMap> hash = new HashMap<>(); - - for (Map.Entry> entry : clusterMap.entrySet()) { - int collisionCount = 0; - int confusionCount = 0; - CellPciPair val = entry.getKey(); - String cellId = val.getCellId(); - int pci = val.getPhysicalCellId(); - ArrayList arr; - // getting colision and confusion count - ArrayList counts = new ArrayList<>(); - // gets the value for the key - arr = entry.getValue(); - if (!arr.isEmpty()) { - for (int i = 0; i < arr.size(); i++) { - if (pci == arr.get(i).getPhysicalCellId()) { - collisionCount++; - } - - } - counts.add(collisionCount); - - for (int j = 0; j < arr.size(); j++) { - for (int k = j + 1; k < arr.size(); k++) { - if (arr.get(j).getPhysicalCellId() == arr.get(k).getPhysicalCellId()) { - confusionCount++; - - } - } - - } - counts.add(confusionCount); - log.debug("count {}", counts); - - } - hash.put(cellId, counts); - - } - log.debug("collison and confusion map {}", hash); - - return hash; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/child/Graph.java b/src/main/java/com/wipro/www/sonhms/child/Graph.java deleted file mode 100644 index 5e48dfc..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/Graph.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.model.CellNeighbourList; -import com.wipro.www.sonhms.model.CellPciPair; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.UUID; - -import java.util.concurrent.ConcurrentHashMap; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.slf4j.Logger; - -public class Graph { - private static final Logger log = org.slf4j.LoggerFactory.getLogger(Graph.class); - - // symbol table: key = string vertex, value = set of neighboring vertices - private Map> cellPciNeighbourMap; - private UUID graphId; - - /** - * Parameterized constructor. - */ - @SuppressWarnings("unchecked") - public Graph(String clusterInfo) { - JSONArray cells = new JSONArray(clusterInfo); - - Map> cellMap = new HashMap<>(); - for (int i = 0; i < cells.length(); i++) { - JSONObject cell = (JSONObject) cells.get(i); - CellPciPair cellPciPair = new CellPciPair(cell.getString("cellId"), cell.getInt("physicalCellId")); - ObjectMapper mapper = new ObjectMapper(); - ArrayList neighbours = new ArrayList<>(); - try { - neighbours = mapper.readValue(cell.getString("neighbours"), ArrayList.class); - } catch (JSONException | IOException e) { - log.debug("Error parsing json: {}", e); - } - cellMap.put(cellPciPair, neighbours); - - } - - this.cellPciNeighbourMap = cellMap; - } - - public UUID getGraphId() { - return graphId; - } - - public void setGraphId(UUID graphId) { - this.graphId = graphId; - } - - public Map> getCellPciNeighbourMap() { - return cellPciNeighbourMap; - } - - public void setCellPciNeighbourMap(Map> cellPciNeighbourMap) { - this.cellPciNeighbourMap = cellPciNeighbourMap; - } - - /** - * Initializes an empty graph with no vertices or edges. - */ - public Graph() { - this.cellPciNeighbourMap = new ConcurrentHashMap<>(); - } - - // throw an exception if v is not a vertex - private void validateVertex(CellPciPair start) { - if (!hasVertex(start)) { - throw new IllegalArgumentException(start + " is not a vertex"); - } - } - - /** - * Adds the edge v-w to this graph (if it is not already an edge). - */ - public void addEdge(CellPciPair start, CellPciPair end) { - if (!hasVertex(start)) { - addVertex(start); - } - if (!hasVertex(end)) { - addVertex(end); - } - if (!hasEdge(start, end)) { - this.cellPciNeighbourMap.get(start).add(end); - } - } - - /** - * Adds vertex v to this graph (if it is not already a vertex). - */ - public void addVertex(CellPciPair start) { - if (!hasVertex(start)) { - this.cellPciNeighbourMap.put(start, new ArrayList()); - } - } - - /** - * Returns true if v is a vertex in this graph. - */ - public boolean hasVertex(CellPciPair start) { - return this.cellPciNeighbourMap.containsKey(start); - } - - /** - * Returns true if v-w is an edge in this graph. - */ - public boolean hasEdge(CellPciPair start, CellPciPair end) { - validateVertex(start); - validateVertex(end); - return this.cellPciNeighbourMap.get(start).contains(end); - } - - /** - * Updates Vertex. - */ - public void updateVertex(CellPciPair oldPair, CellPciPair newPair) { - int oldPci = oldPair.getPhysicalCellId(); - int newPci = newPair.getPhysicalCellId(); - - if (oldPci != newPci) { - - this.cellPciNeighbourMap.put(newPair, this.cellPciNeighbourMap.get(oldPair)); - this.cellPciNeighbourMap.remove(oldPair); - - } - for (Map.Entry> entry : this.cellPciNeighbourMap.entrySet()) { - - ArrayList al = entry.getValue(); - for (int i = 0; i < al.size(); i++) { - int pci = al.get(i).getPhysicalCellId(); - if ((pci != newPci) && al.contains(oldPair)) { - al.remove(oldPair); - al.add(newPair); - } - } - } - log.debug("Final Map {}", cellPciNeighbourMap); - - } - - @Override - public String toString() { - return "Graph [cellPciNeighbourMap=" + cellPciNeighbourMap + ", graphId=" + graphId + "]"; - } - - /** - * Convert Graph into a json. - */ - public String getPciNeighbourJson() { - - List cells = new ArrayList<>(); - - for (Entry> entry : cellPciNeighbourMap.entrySet()) { - CellPciPair key = entry.getKey(); - JSONArray neighbours = new JSONArray(cellPciNeighbourMap.get(key)); - CellNeighbourList cell = new CellNeighbourList(key.getCellId(), key.getPhysicalCellId(), - neighbours.toString()); - cells.add(cell); - } - ObjectMapper mapper = new ObjectMapper(); - String pciNeighbourJson = ""; - try { - pciNeighbourJson = mapper.writeValueAsString(cells); - } catch (JsonProcessingException e) { - log.debug("Error while processing json: {}", e); - } - return pciNeighbourJson; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/child/StateOof.java b/src/main/java/com/wipro/www/sonhms/child/StateOof.java deleted file mode 100644 index 3215c46..0000000 --- a/src/main/java/com/wipro/www/sonhms/child/StateOof.java +++ /dev/null @@ -1,271 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.child; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.ConfigPolicy; -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.dao.CellInfoRepository; -import com.wipro.www.sonhms.dao.SonRequestsRepository; -import com.wipro.www.sonhms.dmaap.PolicyDmaapClient; -import com.wipro.www.sonhms.entity.CellInfo; -import com.wipro.www.sonhms.entity.PciRequests; -import com.wipro.www.sonhms.exceptions.ConfigDbNotFoundException; -import com.wipro.www.sonhms.exceptions.OofNotFoundException; -import com.wipro.www.sonhms.model.CellConfig; -import com.wipro.www.sonhms.model.CellPciPair; -import com.wipro.www.sonhms.model.Common; -import com.wipro.www.sonhms.model.Configurations; -import com.wipro.www.sonhms.model.Data; -import com.wipro.www.sonhms.model.FapService; -import com.wipro.www.sonhms.model.Lte; -import com.wipro.www.sonhms.model.Payload; -import com.wipro.www.sonhms.model.PolicyNotification; -import com.wipro.www.sonhms.model.Ran; -import com.wipro.www.sonhms.model.X0005b9Lte; -import com.wipro.www.sonhms.restclient.AsyncResponseBody; -import com.wipro.www.sonhms.restclient.OofRestClient; -import com.wipro.www.sonhms.restclient.SdnrRestClient; -import com.wipro.www.sonhms.restclient.Solution; -import com.wipro.www.sonhms.restclient.SonSolution; -import com.wipro.www.sonhms.utils.BeanUtil; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.BlockingQueue; - -import org.slf4j.Logger; - -public class StateOof { - private static final Logger log = org.slf4j.LoggerFactory.getLogger(StateOof.class); - private BlockingQueue> childStatusUpdate; - - public StateOof() { - - } - - /** - * Parameterized Constructor. - * - */ - public StateOof(BlockingQueue> childStatusUpdate) { - super(); - this.childStatusUpdate = childStatusUpdate; - } - - /** - * Triggers OOF. - * @throws OofNotFoundException when trigger oof fails - */ - public void triggerOof(Map> result, String networkId) throws OofNotFoundException { - // check for 0 collision and 0 confusion - ArrayList cellidList = new ArrayList<>(); - ArrayList cellIds = new ArrayList<>(); - - for (Map.Entry> entry : result.entrySet()) { - String key = entry.getKey(); - ArrayList arr; - arr = entry.getValue(); - if (!arr.isEmpty()) { - Set set = new HashSet<>(arr); - if (((set.size() == 1) && !set.contains(0)) || (set.size() != 1)) { - cellIds.add(key); - - } - } - - } - - for (String cell : cellIds) { - log.debug("cellidList entries: {}", cell); - cellidList.add(cell); - } - log.debug("the cells triggering the oof are {}", cellidList); - - UUID transactionId = UUID.randomUUID(); - - Configuration config = Configuration.getInstance(); - int numSolutions = config.getNumSolutions(); - List optimizers = config.getOptimizers(); - - String oofResponse = OofRestClient.queryOof(numSolutions, transactionId.toString(), "create", cellidList, - networkId, optimizers); - log.debug("Synchronous Response {}", oofResponse); - - List childStatus = new ArrayList<>(); - childStatus.add(Long.toString(Thread.currentThread().getId())); - childStatus.add("triggeredOof"); - try { - childStatusUpdate.put(childStatus); - } catch (InterruptedException e1) { - log.debug("Interrupted execption {}", e1); - Thread.currentThread().interrupt(); - - } - - // Store Request details in Database - - PciRequests pciRequest = new PciRequests(); - - long childThreadId = Thread.currentThread().getId(); - pciRequest.setTransactionId(transactionId.toString()); - pciRequest.setChildThreadId(childThreadId); - SonRequestsRepository pciRequestsRepository = BeanUtil.getBean(SonRequestsRepository.class); - pciRequestsRepository.save(pciRequest); - - while (!ChildThread.getResponseMap().containsKey(childThreadId)) { - - } - - AsyncResponseBody asynResponseBody = ChildThread.getResponseMap().get(childThreadId); - - try { - sendToPolicy(asynResponseBody, networkId); - } catch (ConfigDbNotFoundException e1) { - log.debug("Config DB is unreachable: {}", e1); - } - - pciRequestsRepository = BeanUtil.getBean(SonRequestsRepository.class); - pciRequestsRepository.deleteByChildThreadId(childThreadId); - - childStatus = new ArrayList<>(); - childStatus.add(Long.toString(Thread.currentThread().getId())); - childStatus.add("success"); - try { - childStatusUpdate.put(childStatus); - } catch (InterruptedException e) { - log.debug("InterruptedException {}", e); - Thread.currentThread().interrupt(); - - } - - } - - /** - * Sends Dmaap notification to Policy. - * - * @throws ConfigDbNotFoundException - * when config db is unreachable - */ - private void sendToPolicy(AsyncResponseBody async, String networkId) throws ConfigDbNotFoundException { - - if (log.isDebugEnabled()) { - log.debug(async.toString()); - } - - List solutions; - solutions = async.getSolutions(); - - Map> pnfs = getPnfs(solutions); - - for (Map.Entry> entry : pnfs.entrySet()) { - String pnfName = entry.getKey(); - List cellPciPairs = entry.getValue(); - - String notification = getNotificationString(pnfName, cellPciPairs, networkId); - log.debug("Policy Notification: {}", notification); - PolicyDmaapClient policy = new PolicyDmaapClient(); - boolean status = policy.sendNotificationToPolicy(notification); - log.debug("sent Message: {}", status); - if (status) { - log.debug("Message sent to policy"); - } else { - log.debug("Sending notification to policy failed"); - } - - } - } - - private String getNotificationString(String pnfName, List cellPciPairs, String networkId) { - ArrayList configurations = new ArrayList<>(); - for (CellPciPair cellPciPair : cellPciPairs) { - String cellId = cellPciPair.getCellId(); - int pci = cellPciPair.getPhysicalCellId(); - Configurations configuration = new Configurations(new Data(new FapService(cellId, - new X0005b9Lte(pci, pnfName), new CellConfig(new Lte(new Ran(new Common(cellId))))))); - configurations.add(configuration); - } - - Payload payload = new Payload(configurations); - ObjectMapper mapper = new ObjectMapper(); - String payloadString = ""; - try { - payloadString = mapper.writeValueAsString(payload); - } catch (JsonProcessingException e) { - log.debug("JSON processing exception: {}", e); - } - PolicyNotification policyNotification = new PolicyNotification(); - ConfigPolicy configPolicy = ConfigPolicy.getInstance(); - String closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIG_POLICY_NAME"); - policyNotification.setClosedLoopControlName(closedLoopControlName); - policyNotification.setPayload(payloadString); - - mapper.setSerializationInclusion(Include.NON_NULL); - String notification = ""; - try { - notification = mapper.writeValueAsString(policyNotification); - } catch (JsonProcessingException e1) { - log.debug("JSON processing exception: {}", e1); - } - return notification; - } - - private Map> getPnfs(List solutions) throws ConfigDbNotFoundException { - - Map> pnfs = new HashMap<>(); - - for (Solution solution : solutions) { - List pciSolutions = solution.getPciSolutions(); - for (SonSolution pciSolution : pciSolutions) { - String cellId = pciSolution.getCellId(); - int pci = pciSolution.getPci(); - - String pnfName = ""; - CellInfoRepository cellInfoRepository = BeanUtil.getBean(CellInfoRepository.class); - Optional cellInfo = cellInfoRepository.findById(cellId); - if (cellInfo.isPresent()) { - pnfName = cellInfo.get().getPnfName(); - } else { - pnfName = SdnrRestClient.getPnfName(cellId); - cellInfoRepository.save(new CellInfo(cellId, pnfName)); - } - if (pnfs.containsKey(pnfName)) { - pnfs.get(pnfName).add(new CellPciPair(cellId, pci)); - } else { - List cellPciPairs = new ArrayList<>(); - cellPciPairs.add(new CellPciPair(cellId, pci)); - pnfs.put(pnfName, cellPciPairs); - } - } - - } - return pnfs; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java deleted file mode 100644 index bdbdb6e..0000000 --- a/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dao; - -import com.wipro.www.sonhms.entity.BufferedNotifications; - -import java.util.List; - -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - - -@Repository -public interface BufferedNotificationsRepository extends CrudRepository { - - @Query(nativeQuery = true, value = "SELECT cluster_id FROM buffered_notifications WHERE notification=?1") - public String getClusterIdForNotification(String notification); - - @Query(nativeQuery = true, - value = "DELETE FROM buffered_notifications " + "WHERE notification = ( SELECT notification " - + "FROM buffered_notifications WHERE cluster_id=?1) RETURNING notification;") - public List getNotificationsFromQueue(String clusterId); - -} diff --git a/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java b/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java deleted file mode 100644 index c4e1f8b..0000000 --- a/src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dao; - -import com.wipro.www.sonhms.entity.CellInfo; - -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - - -@Repository -public interface CellInfoRepository extends CrudRepository { - - // public void - -} diff --git a/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java deleted file mode 100644 index a833fbf..0000000 --- a/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dao; - -import com.wipro.www.sonhms.entity.ClusterDetails; - -import java.util.List; - -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - - -@Repository -@Transactional -public interface ClusterDetailsRepository extends CrudRepository { - - @Modifying - @Query(nativeQuery = true, value = "UPDATE CLUSTER_DETAILS SET cluster_info=?1 WHERE cluster_id = ?2") - public void updateCluster(String clusterInfo, String clusterId); - - @Query(nativeQuery = true, value = "SELECT * FROM cluster_details") - public List getAllClusterDetails(); - - @Query(nativeQuery = true, value = "SELECT child_thread_id FROM cluster_details WHERE cluster_id = ?1") - public long getChildThreadForCluster(String clusterId); - - @Query(nativeQuery = true, value = "SELECT cluster_id FROM cluster_details WHERE child_thread_id = ?1") - public String getClusterIdForChildThread(long childThreadId); - - @Modifying - @Query(nativeQuery = true, value = "DELETE FROM cluster_details WHERE child_thread_id = ?1") - public void deleteByChildThreadId(Long threadId); - - @Modifying - @Query(nativeQuery = true, value = "UPDATE cluster_details SET child_thread_id = ?2 WHERE cluster_id = ?1") - public void updateThreadId(String clusterId, Long threadId); - -} diff --git a/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java deleted file mode 100644 index 1ac2ff4..0000000 --- a/src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dao; - -import com.wipro.www.sonhms.entity.DmaapNotifications; - -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; - - -@Repository -public interface DmaapNotificationsRepository extends CrudRepository { - - @Query(nativeQuery = true, - value = "DELETE FROM dmaap_notifications " - + "WHERE notification = ( SELECT notification FROM dmaap_notifications ORDER BY " - + "created_at FOR UPDATE SKIP LOCKED LIMIT 1 ) RETURNING notification;") - - public String getNotificationFromQueue(); - -} diff --git a/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java b/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java deleted file mode 100644 index 6b0458d..0000000 --- a/src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dao; - -import com.wipro.www.sonhms.entity.PciRequests; - -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.CrudRepository; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - - -@Repository -@Transactional -public interface SonRequestsRepository extends CrudRepository { - - @Query(nativeQuery = true, value = "SELECT child_thread_id FROM pci_requests WHERE transaction_id = ?1") - public long getChildThreadMapping(String transactionId); - - @Modifying - @Query(nativeQuery = true, value = "DELETE FROM pci_requests WHERE child_thread_id = ?1") - public void deleteByChildThreadId(Long threadId); - -} diff --git a/src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java b/src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java deleted file mode 100644 index 051b00e..0000000 --- a/src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dmaap; - -import com.att.nsa.apiClient.http.HttpException; -import com.att.nsa.cambria.client.CambriaClient; -import com.att.nsa.cambria.client.CambriaClientBuilders; -import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder; -import com.att.nsa.cambria.client.CambriaClientBuilders.TopicManagerBuilder; -import com.att.nsa.cambria.client.CambriaConsumer; -import com.att.nsa.cambria.client.CambriaTopicManager; -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.NewNotification; -import com.wipro.www.sonhms.Topic; -import com.wipro.www.sonhms.dao.DmaapNotificationsRepository; -import com.wipro.www.sonhms.entity.DmaapNotifications; - - -import java.io.IOException; -import java.net.MalformedURLException; -import java.security.GeneralSecurityException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class DmaapClient { - - @Autowired - private DmaapNotificationsRepository dmaapNotificationsRepository; - private Configuration configuration; - private static Logger log = LoggerFactory.getLogger(DmaapClient.class); - private static final String CONSUMER = "CONSUMER"; - private static final String PRODUCER = "PRODUCER"; - private static final String DESCRIPTION = "api keys for OOF PCI use case"; - private static final int PARTITION_COUNT = 1; - private static final int REPLICATION_COUNT = 1; - private NewNotification newNotification; - private CambriaTopicManager topicManager; - - public class NotificationCallback { - DmaapClient dmaapClient; - - public NotificationCallback(DmaapClient dmaapClient) { - this.dmaapClient = dmaapClient; - } - - public void activateCallBack(String msg) { - handleNotification(msg); - } - - private void handleNotification(String msg) { - DmaapNotifications dmaapNotification = new DmaapNotifications(); - dmaapNotification.setNotification(msg); - if (log.isDebugEnabled()) { - log.debug(dmaapNotification.toString()); - } - dmaapNotificationsRepository.save(dmaapNotification); - newNotification.setNewNotif(true); - } - } - - /** - * init dmaap client. - */ - public void initClient(NewNotification newNotification) { - log.debug("initializing client"); - configuration = Configuration.getInstance(); - if (log.isDebugEnabled()) { - log.debug(configuration.toString()); - } - this.newNotification = newNotification; - - createAndConfigureTopics(); - startClient(); - } - - /** - * create and configures topics. - */ - private void createAndConfigureTopics() { - - try { - topicManager = buildCambriaClient(new TopicManagerBuilder().usingHosts(configuration.getServers()) - .authenticatedBy(configuration.getManagerApiKey(), configuration.getManagerSecretKey())); - } catch (GeneralSecurityException | IOException e) { - log.debug("exception during creating topic", e); - } - List topics = configuration.getTopics(); - - for (Topic topic : topics) { - Set topicsInDmaap = getAllTopicsFromDmaap(); - - createTopic(topic, topicsInDmaap); - subscribeToTopic(topic.getName(), topic.getProducer(), PRODUCER); - subscribeToTopic(topic.getName(), topic.getConsumer(), CONSUMER); - - } - - topicManager.close(); - - } - - /** - * create topic. - */ - private void createTopic(Topic topic, Set topicsInDmaap) { - if (topicsInDmaap.contains(topic.getName())) { - log.debug("topic exists in dmaap"); - } else { - try { - topicManager.createTopic(topic.getName(), DESCRIPTION, PARTITION_COUNT, REPLICATION_COUNT); - } catch (HttpException | IOException e) { - log.debug("error while creating topic: {}", e); - } - } - } - - /** - * get all topics from dmaap. - */ - private Set getAllTopicsFromDmaap() { - Set topics = new HashSet<>(); - try { - topics = topicManager.getTopics(); - } catch (IOException e) { - log.debug("IOException while fetching topics"); - } - return topics; - - } - - /** - * start dmaap client. - */ - private synchronized void startClient() { - - ScheduledExecutorService executorPool; - CambriaConsumer cambriaConsumer = null; - - try { - cambriaConsumer = new ConsumerBuilder() - .authenticatedBy(configuration.getPcimsApiKey(), configuration.getPcimsSecretKey()) - .knownAs(configuration.getCg(), configuration.getCid()).onTopic(configuration.getSdnrTopic()) - .usingHosts(configuration.getServers()).withSocketTimeout(configuration.getPollingTimeout() * 1000) - .build(); - - // create notification consumers for SNDR and policy - NotificationConsumer notificationConsumer = new NotificationConsumer(cambriaConsumer, - new NotificationCallback(this)); - - // start notification consumer threads - executorPool = Executors.newScheduledThreadPool(10); - executorPool.scheduleAtFixedRate(notificationConsumer, 0, configuration.getPollingInterval(), - TimeUnit.SECONDS); - } catch (MalformedURLException | GeneralSecurityException e) { - log.debug("exception during starting client", e); - } - - } - - /** - * subscribe to topic. - */ - private void subscribeToTopic(String topicName, String subscriberApiKey, String subscriberType) { - if (subscriberType.equals(PRODUCER)) { - try { - topicManager.allowProducer(topicName, subscriberApiKey); - } catch (HttpException | IOException e) { - log.debug("error while subscribing to a topic: {}", e); - } - } else if (subscriberType.equals(CONSUMER)) { - try { - topicManager.allowConsumer(topicName, subscriberApiKey); - } catch (HttpException | IOException e) { - log.debug("error while subscribing to a topic: {}", e); - } - } - - } - - @SuppressWarnings("unchecked") - private static T buildCambriaClient( - CambriaClientBuilders.AbstractAuthenticatedManagerBuilder client) - throws MalformedURLException, GeneralSecurityException { - return (T) client.build(); - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java b/src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java deleted file mode 100644 index 1bdbac2..0000000 --- a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dmaap; - -import com.att.nsa.cambria.client.CambriaConsumer; -import com.wipro.www.sonhms.dmaap.DmaapClient.NotificationCallback; - -import java.io.IOException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NotificationConsumer implements Runnable { - - private static Logger log = LoggerFactory.getLogger(NotificationConsumer.class); - private CambriaConsumer cambriaConsumer; - private NotificationCallback notificationCallback; - - /** - * Parameterized Constructor. - */ - public NotificationConsumer(CambriaConsumer cambriaConsumer, NotificationCallback notificationCallback) { - super(); - this.cambriaConsumer = cambriaConsumer; - this.notificationCallback = notificationCallback; - } - - @Override - public void run() { - try { - Iterable msgs = cambriaConsumer.fetch(); - for (String msg : msgs) { - log.debug(msg); - notificationCallback.activateCallBack(msg); - } - } catch (IOException e) { - log.debug("exception when fetching msgs from dmaap", e); - } - - } -} diff --git a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationProducer.java b/src/main/java/com/wipro/www/sonhms/dmaap/NotificationProducer.java deleted file mode 100644 index 7dd505f..0000000 --- a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationProducer.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dmaap; - -import com.att.nsa.cambria.client.CambriaBatchingPublisher; -import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder; - -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.util.List; - -public class NotificationProducer { - - private List servers; - private String apiKey; - private String secret; - - /** - * Parameterised constructor. - */ - public NotificationProducer(List servers, String apiKey, String secret) { - super(); - this.servers = servers; - this.apiKey = apiKey; - this.secret = secret; - } - - /** - * sends notification to dmaap. - */ - public int sendNotification(String topic, String msg) throws GeneralSecurityException, IOException { - CambriaBatchingPublisher cambriaBatchingPublisher = null; - cambriaBatchingPublisher = new PublisherBuilder().usingHosts(servers).onTopic(topic) - .authenticatedBy(apiKey, secret).build(); - return cambriaBatchingPublisher.send("", msg); - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/dmaap/PolicyDmaapClient.java b/src/main/java/com/wipro/www/sonhms/dmaap/PolicyDmaapClient.java deleted file mode 100644 index f1491b4..0000000 --- a/src/main/java/com/wipro/www/sonhms/dmaap/PolicyDmaapClient.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.dmaap; - -import com.wipro.www.sonhms.Configuration; - -import java.io.IOException; -import java.security.GeneralSecurityException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class PolicyDmaapClient { - - private static Logger log = LoggerFactory.getLogger(PolicyDmaapClient.class); - - /** - * Method stub for sending notification to policy. - */ - public boolean sendNotificationToPolicy(String msg) { - - Configuration configuration = Configuration.getInstance(); - NotificationProducer notificationProducer = new NotificationProducer(configuration.getServers(), - configuration.getPcimsApiKey(), configuration.getPcimsSecretKey()); - try { - int result = notificationProducer.sendNotification(configuration.getPolicyTopic(), msg); - log.debug("result: {}", result); - } catch (GeneralSecurityException | IOException e) { - log.debug("exception when sending notification to policy", e); - return false; - } - return true; - } -} diff --git a/src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java b/src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java deleted file mode 100644 index 9ac10aa..0000000 --- a/src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.entity; - -import java.sql.Timestamp; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -import org.hibernate.annotations.CreationTimestamp; - -@Entity -@Table(name = "BUFFERED_NOTIFICATIONS") -public class BufferedNotifications { - - @Id - @Column(name = "notification", columnDefinition = "text") - private String notification; - - @Column(name = "cluster_id", columnDefinition = "text") - private String clusterId; - - @CreationTimestamp - @Column(name = "created_at", columnDefinition = "timestamp") - private Timestamp createdAt; - - public BufferedNotifications() { - - } - - /** - * Parameterised constructor. - */ - public BufferedNotifications(String notification, Timestamp createdAt, String clusterId) { - this.notification = notification; - this.createdAt = createdAt; - this.clusterId = clusterId; - } - - public String getNotification() { - return notification; - } - - public void setNotification(String notification) { - this.notification = notification; - } - - public String getClusterId() { - return clusterId; - } - - public void setClusterId(String clusterId) { - this.clusterId = clusterId; - } - - public Timestamp getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Timestamp createdAt) { - this.createdAt = createdAt; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/entity/CellInfo.java b/src/main/java/com/wipro/www/sonhms/entity/CellInfo.java deleted file mode 100644 index e2bb326..0000000 --- a/src/main/java/com/wipro/www/sonhms/entity/CellInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "CELL_INFO") -public class CellInfo { - - @Id - @Column(name = "CELL_ID") - private String cellId; - - @Column(name = "PNF_NAME") - private String pnfName; - - public CellInfo() { - - } - - /** - * CellIdPnf Constructor. - */ - - public CellInfo(String cellId, String pnfName) { - super(); - this.cellId = cellId; - this.pnfName = pnfName; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java b/src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java deleted file mode 100644 index 59868eb..0000000 --- a/src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "CLUSTER_DETAILS") -public class ClusterDetails { - - @Id - @Column(name = "CLUSTER_ID") - private String clusterId; - - @Column(name = "CLUSTER_INFO") - private String clusterInfo; - - @Column(name = "CHILD_THREAD_ID") - private long childThreadId; - - public ClusterDetails() { - - } - - /** - * Parameterised constructor. - */ - public ClusterDetails(String clusterId, String clusterInfo, long childThreadId) { - super(); - this.clusterId = clusterId; - this.clusterInfo = clusterInfo; - this.childThreadId = childThreadId; - } - - public long getChildThreadId() { - return childThreadId; - } - - public void setChildThreadId(long childThreadId) { - this.childThreadId = childThreadId; - } - - public String getClusterId() { - return clusterId; - } - - public void setClusterId(String clusterId) { - this.clusterId = clusterId; - } - - public String getClusterInfo() { - return clusterInfo; - } - - public void setClusterInfo(String clusterInfo) { - this.clusterInfo = clusterInfo; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java b/src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java deleted file mode 100644 index 925a9e6..0000000 --- a/src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.entity; - -import java.sql.Timestamp; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -import org.hibernate.annotations.CreationTimestamp; - -@Entity -@Table(name = "DMAAP_NOTIFICATIONS") -public class DmaapNotifications { - - @Id - @Column(name = "notification", columnDefinition = "text") - private String notification; - - @CreationTimestamp - @Column(name = "created_at", columnDefinition = "timestamp") - private Timestamp createdAt; - - public DmaapNotifications() { - - } - - public DmaapNotifications(String notification, Timestamp createdAt) { - this.notification = notification; - this.createdAt = createdAt; - } - - public String getNotification() { - return notification; - } - - public void setNotification(String notification) { - this.notification = notification; - } - - public Timestamp getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Timestamp createdAt) { - this.createdAt = createdAt; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/entity/PciRequests.java b/src/main/java/com/wipro/www/sonhms/entity/PciRequests.java deleted file mode 100644 index cce914d..0000000 --- a/src/main/java/com/wipro/www/sonhms/entity/PciRequests.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.entity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name = "PCI_REQUESTS") -public class PciRequests { - - @Id - @Column(name = "TRANSACTION_ID") - private String transactionId; - - @Column(name = "CHILD_THREAD_ID") - private long childThreadId; - - public PciRequests() { - - } - - /** - * Parameterised constructor. - */ - public PciRequests(String transactionId, long childThreadId) { - super(); - this.transactionId = transactionId; - this.childThreadId = childThreadId; - } - - public String getTransactionId() { - return transactionId; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - public long getChildThreadId() { - return childThreadId; - } - - public void setChildThreadId(long childThreadId) { - this.childThreadId = childThreadId; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/exceptions/ConfigDbNotFoundException.java b/src/main/java/com/wipro/www/sonhms/exceptions/ConfigDbNotFoundException.java deleted file mode 100644 index 70127b5..0000000 --- a/src/main/java/com/wipro/www/sonhms/exceptions/ConfigDbNotFoundException.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.exceptions; - -public class ConfigDbNotFoundException extends Exception { - - /** - * serial version. - */ - private static final long serialVersionUID = 1L; - - public ConfigDbNotFoundException(String message) { - super(message); - } -} diff --git a/src/main/java/com/wipro/www/sonhms/exceptions/OofNotFoundException.java b/src/main/java/com/wipro/www/sonhms/exceptions/OofNotFoundException.java deleted file mode 100644 index fb95a0f..0000000 --- a/src/main/java/com/wipro/www/sonhms/exceptions/OofNotFoundException.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.exceptions; - -public class OofNotFoundException extends Exception { - /** - * serial version. - */ - private static final long serialVersionUID = 1L; - - public OofNotFoundException(String message) { - super(message); - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/CellConfig.java b/src/main/java/com/wipro/www/sonhms/model/CellConfig.java deleted file mode 100644 index 1fab733..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/CellConfig.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class CellConfig { - - @JsonProperty(value = "LTE") - private Lte lte; - - public CellConfig() { - - } - - public CellConfig(Lte lte) { - super(); - this.lte = lte; - } - - public Lte getLte() { - return lte; - } - - public void setLte(Lte lte) { - this.lte = lte; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java b/src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java deleted file mode 100644 index 5bbff6d..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -public class CellNeighbourList { - - private String cellId; - private int physicalCellId; - private String neighbours; - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public int getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(int physicalCellId) { - this.physicalCellId = physicalCellId; - } - - public String getNeighbours() { - return neighbours; - } - - public void setNeighbours(String neighbours) { - this.neighbours = neighbours; - } - - /** - * constructor. - */ - public CellNeighbourList() { - - } - - /** - * Parameterized constructor. - */ - public CellNeighbourList(String cellId, int physicalCellId, String neighbours) { - super(); - this.cellId = cellId; - this.physicalCellId = physicalCellId; - this.neighbours = neighbours; - } -} diff --git a/src/main/java/com/wipro/www/sonhms/model/CellPciPair.java b/src/main/java/com/wipro/www/sonhms/model/CellPciPair.java deleted file mode 100644 index fb4c91a..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/CellPciPair.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class CellPciPair { - @JsonProperty("cellId") - private String cellId; - - @JsonProperty("physicalCellId") - private int physicalCellId; - - @Override - public String toString() { - return "CellPciPair [cellId=" + cellId + ", physicalCellId=" + physicalCellId + "]"; - } - - public CellPciPair() { - - } - - /** - * Parameterized constructor. - */ - public CellPciPair(String cellId, int physicalCellId) { - super(); - this.cellId = cellId; - this.physicalCellId = physicalCellId; - } - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public int getPhysicalCellId() { - return physicalCellId; - } - - public void setPhysicalCellId(int physicalCellId) { - this.physicalCellId = physicalCellId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = (prime * result) + ((cellId == null) ? 0 : cellId.hashCode()); - result = (prime * result) + physicalCellId; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - CellPciPair other = (CellPciPair) obj; - if (cellId == null) { - if (other.cellId != null) { - return false; - } - } else if (!cellId.equals(other.cellId)) { - return false; - } - return (physicalCellId == other.physicalCellId); - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Common.java b/src/main/java/com/wipro/www/sonhms/model/Common.java deleted file mode 100644 index f317467..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Common.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Common { - - @JsonProperty(value = "CellIdentity") - private String cellIdentity; - - public Common() { - - } - - public Common(String cellIdentity) { - super(); - this.cellIdentity = cellIdentity; - } - - public String getCellIdentity() { - return cellIdentity; - } - - public void setCellIdentity(String cellIdentity) { - this.cellIdentity = cellIdentity; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Configurations.java b/src/main/java/com/wipro/www/sonhms/model/Configurations.java deleted file mode 100644 index f5dcd7e..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Configurations.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Configurations { - @JsonProperty("data") - private Data data; - - /** - * constructor. - * - */ - public Configurations() { - - } - - /** - * Parameterized constructor. - * - */ - public Configurations(Data data) { - super(); - this.data = data; - } - - public Data getData() { - return data; - } - - public void setData(Data data) { - this.data = data; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Data.java b/src/main/java/com/wipro/www/sonhms/model/Data.java deleted file mode 100644 index 6bff144..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Data.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Data { - - @JsonProperty("FAPService") - private FapService fapservice; - - public Data() { - - } - - public Data(FapService fapservice) { - super(); - this.fapservice = fapservice; - } - - public FapService getFapservice() { - return fapservice; - } - - public void setFapservice(FapService fapservice) { - this.fapservice = fapservice; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/FapService.java b/src/main/java/com/wipro/www/sonhms/model/FapService.java deleted file mode 100644 index c949922..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/FapService.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FapService { - - @JsonProperty("alias") - private String alias; - - @JsonProperty("X0005b9Lte") - private X0005b9Lte x0005b9Lte; - - @JsonProperty("CellConfig") - private CellConfig cellConfig; - - public FapService() { - - } - - /** - * Parameterized constructor. - */ - public FapService(String alias, X0005b9Lte x0005b9Lte, CellConfig cellConfig) { - super(); - this.alias = alias; - this.x0005b9Lte = x0005b9Lte; - this.cellConfig = cellConfig; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public CellConfig getCellConfig() { - return cellConfig; - } - - public void setCellConfig(CellConfig cellConfig) { - this.cellConfig = cellConfig; - } - - public X0005b9Lte getX0005b9Lte() { - return x0005b9Lte; - } - - public void setX0005b9Lte(X0005b9Lte x0005b9Lte) { - this.x0005b9Lte = x0005b9Lte; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/FapServiceList.java b/src/main/java/com/wipro/www/sonhms/model/FapServiceList.java deleted file mode 100644 index 96cde4c..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/FapServiceList.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class FapServiceList { - - @Override - public String toString() { - return "FapServiceList [alias=" + alias + ", x0005b9Lte=" + x0005b9Lte + ", cellConfig=" + cellConfig + "]"; - } - - @JsonProperty("alias") - private String alias; - - @JsonProperty("X0005b9Lte") - private X0005b9Lte x0005b9Lte; - - @JsonProperty("CellConfig") - private NotificationCellConfig cellConfig; - - public FapServiceList() { - - } - - /** - * Parameterized Constructor. - */ - - public FapServiceList(String alias, X0005b9Lte x0005b9Lte, NotificationCellConfig cellConfig) { - super(); - this.alias = alias; - this.x0005b9Lte = x0005b9Lte; - this.cellConfig = cellConfig; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public X0005b9Lte getX0005b9Lte() { - return x0005b9Lte; - } - - public void setX0005b9Lte(X0005b9Lte x0005b9Lte) { - this.x0005b9Lte = x0005b9Lte; - } - - public NotificationCellConfig getCellConfig() { - return cellConfig; - } - - public void setCellConfig(NotificationCellConfig cellConfig) { - this.cellConfig = cellConfig; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Lte.java b/src/main/java/com/wipro/www/sonhms/model/Lte.java deleted file mode 100644 index 871f100..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Lte.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Lte { - - @JsonProperty(value = "RAN") - private Ran ran; - - public Lte() { - - } - - public Lte(Ran ran) { - super(); - this.ran = ran; - } - - public Ran getRan() { - return ran; - } - - public void setRan(Ran ran) { - this.ran = ran; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java b/src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java deleted file mode 100644 index fe85d47..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class LteNeighborListInUseLteCell { - @JsonProperty("pnfName") - private String pnfName; - - @JsonProperty("enable") - private String enable; - - @JsonProperty("alias") - private String alias; - - @JsonProperty("mustInclude") - private String mustInclude; - - @JsonProperty("plmnid") - private String plmnId; - - @JsonProperty("cid") - private String cid; - - @JsonProperty("phyCellId") - private int phyCellId; - - @JsonProperty("blacklisted") - private String blacklisted; - - public LteNeighborListInUseLteCell() { - - } - - /** - * Parameterized Constructor. - */ - - public LteNeighborListInUseLteCell(String pnfName, String enable, String alias, String mustInclude, String plmnId, - String cid, int phyCellId, String blacklisted) { - super(); - this.pnfName = pnfName; - this.enable = enable; - this.alias = alias; - this.mustInclude = mustInclude; - this.plmnId = plmnId; - this.cid = cid; - this.phyCellId = phyCellId; - this.blacklisted = blacklisted; - } - - public String getMustInclude() { - return mustInclude; - } - - public void setMustInclude(String mustInclude) { - this.mustInclude = mustInclude; - } - - public int getPhyCellId() { - return phyCellId; - } - - public void setPhyCellId(int phyCellId) { - this.phyCellId = phyCellId; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - public String getEnable() { - return enable; - } - - public void setEnable(String enable) { - this.enable = enable; - } - - public String getBlacklisted() { - return blacklisted; - } - - public void setBlacklisted(String blacklisted) { - this.blacklisted = blacklisted; - } - - public String getCid() { - return cid; - } - - public void setCid(String cid) { - this.cid = cid; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - - public String getPlmnid() { - return plmnId; - } - - public void setPlmnid(String plmnId) { - this.plmnId = plmnId; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java b/src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java deleted file mode 100644 index d240a88..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -public class NeighborListInUse { - @JsonProperty("LTENeighborListInUseLTECell") - private List lteNeighborListInUseLteCell; - - @JsonProperty("LTECellNumberOfEntries") - private String lteCellNumberOfEntries; - - public NeighborListInUse() { - - } - - /** - * Parameterized Constructor. - */ - - public NeighborListInUse(List lteNeighborListInUseLteCell, - String lteCellNumberOfEntries) { - super(); - this.lteNeighborListInUseLteCell = lteNeighborListInUseLteCell; - this.lteCellNumberOfEntries = lteCellNumberOfEntries; - } - - public List getLteNeighborListInUseLteCell() { - return lteNeighborListInUseLteCell; - } - - public void setLteNeighborListInUseLteCell(List lteNeighborListInUseLteCell) { - this.lteNeighborListInUseLteCell = lteNeighborListInUseLteCell; - } - - public String getLteCellNumberOfEntries() { - return lteCellNumberOfEntries; - } - - public void setLteCellNumberOfEntries(String lteCellNumberOfEntries) { - this.lteCellNumberOfEntries = lteCellNumberOfEntries; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Notification.java b/src/main/java/com/wipro/www/sonhms/model/Notification.java deleted file mode 100644 index 417e443..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Notification.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Notification { - - @JsonProperty("requestID") - private String requestId; - - @JsonProperty("AAI") - private Object aai; - - @JsonProperty("from") - private String from; - - @JsonProperty("version") - private String version; - - @JsonProperty("Action") - private String action; - - @JsonProperty("Payload") - private NotificationPayload payload; - - public Notification() { - - } - - /** - * Parameterized Constructor. - */ - - public Notification(String requestId, Object aai, String from, String version, String action, - NotificationPayload payload) { - super(); - this.requestId = requestId; - this.aai = aai; - this.from = from; - this.version = version; - this.action = action; - this.payload = payload; - } - - public NotificationPayload getPayload() { - return payload; - } - - public void setPayload(NotificationPayload payload) { - this.payload = payload; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public Object getAai() { - return aai; - } - - public void setAai(Object aai) { - this.aai = aai; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/NotificationCellConfig.java b/src/main/java/com/wipro/www/sonhms/model/NotificationCellConfig.java deleted file mode 100644 index a3acaf0..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/NotificationCellConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NotificationCellConfig { - - @JsonProperty("LTE") - private NotificationLte lte; - - public NotificationCellConfig() { - - } - - /** - * Parameterized Constructor. - */ - - public NotificationCellConfig(NotificationLte lte) { - super(); - this.lte = lte; - } - - public NotificationLte getLte() { - return lte; - } - - public void setLte(NotificationLte lte) { - this.lte = lte; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/NotificationLte.java b/src/main/java/com/wipro/www/sonhms/model/NotificationLte.java deleted file mode 100644 index f1e26e7..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/NotificationLte.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NotificationLte { - - @JsonProperty("RAN") - private NotificationRan ran; - - public NotificationLte() { - - } - - /** - * Parameterized Constructor. - */ - - public NotificationLte(NotificationRan ran) { - super(); - this.ran = ran; - } - - public NotificationRan getRan() { - return ran; - } - - public void setRan(NotificationRan ran) { - this.ran = ran; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/NotificationPayload.java b/src/main/java/com/wipro/www/sonhms/model/NotificationPayload.java deleted file mode 100644 index fea882b..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/NotificationPayload.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NotificationPayload { - - @JsonProperty("RadioAccess") - private RadioAccess radioAccess; - - public NotificationPayload() { - - } - - /** - * Parameterized Constructor. - */ - - public NotificationPayload(RadioAccess radioAccess) { - super(); - this.radioAccess = radioAccess; - } - - public RadioAccess getRadioAccess() { - return radioAccess; - } - - public void setRadioAccess(RadioAccess radioAccess) { - this.radioAccess = radioAccess; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/NotificationRan.java b/src/main/java/com/wipro/www/sonhms/model/NotificationRan.java deleted file mode 100644 index cc0e085..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/NotificationRan.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class NotificationRan { - - @JsonProperty("NeighborListInUse") - private NeighborListInUse neighborListInUse; - - @JsonProperty("CellIdentity") - private String cellIdentity; - - public NotificationRan() { - - } - - /** - * Parameterized Constructor. - */ - - public NotificationRan(NeighborListInUse neighborListInUse, String cellIdentity) { - super(); - this.neighborListInUse = neighborListInUse; - this.cellIdentity = cellIdentity; - } - - public NeighborListInUse getNeighborListInUse() { - return neighborListInUse; - } - - public void setNeighborListInUse(NeighborListInUse neighborListInUse) { - this.neighborListInUse = neighborListInUse; - } - - public String getCellIdentity() { - return cellIdentity; - } - - public void setCellIdentity(String cellIdentity) { - this.cellIdentity = cellIdentity; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Payload.java b/src/main/java/com/wipro/www/sonhms/model/Payload.java deleted file mode 100644 index 9f10acb..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Payload.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -public class Payload { - - @JsonProperty("Configurations") - private List configuration; - - public Payload() { - - } - - public Payload(List configuration) { - super(); - this.configuration = configuration; - } - - public List getConfiguration() { - return configuration; - } - - public void setConfiguration(List configuration) { - this.configuration = configuration; - } - - @Override - public String toString() { - return "Payload [configuration=" + configuration + "]"; - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java b/src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java deleted file mode 100644 index e367b0b..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class PolicyNotification { - - private String closedLoopControlName; - private long closedLoopAlarmStart; - private String closedLoopEventClient; - private String closedLoopEventStatus; - - @JsonProperty("target_type") - private String targetType; - - private String target; - - @JsonProperty("requestID") - private String requestId; - - @JsonProperty("AAI") - private Map aai; - - private String from; - private String version; - - @JsonProperty("Action") - private String action; - private String payload; - - /** - * constructor. - */ - public PolicyNotification() { - this.requestId = UUID.randomUUID().toString(); - this.closedLoopEventClient = "microservice.PCI"; - this.closedLoopEventStatus = "ONSET"; - this.closedLoopAlarmStart = System.currentTimeMillis(); - this.from = "PCIMS"; - this.version = "1.0.2"; - this.action = "ModifyConfig"; - this.target = "generic-vnf.vnf-id"; - this.targetType = "VNF"; - this.aai = new HashMap<>(); - aai.put("generic-vnf.is-closed-loop-disabled", "false"); - aai.put("generic-vnf.prov-status", "ACTIVE"); - aai.put("generic-vnf.vnf-id", "notused"); - - } - - public long getClosedLoopAlarmStart() { - return closedLoopAlarmStart; - } - - public void setClosedLoopAlarmStart(long closedLoopAlarmStart) { - this.closedLoopAlarmStart = closedLoopAlarmStart; - } - - public String getClosedLoopEventClient() { - return closedLoopEventClient; - } - - public void setClosedLoopEventClient(String closedLoopEventClient) { - this.closedLoopEventClient = closedLoopEventClient; - } - - public String getClosedLoopEventStatus() { - return closedLoopEventStatus; - } - - public void setClosedLoopEventStatus(String closedLoopEventStatus) { - this.closedLoopEventStatus = closedLoopEventStatus; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getFrom() { - return from; - } - - public void setFrom(String from) { - this.from = from; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getClosedLoopControlName() { - return closedLoopControlName; - } - - public void setClosedLoopControlName(String closedLoopControlName) { - this.closedLoopControlName = closedLoopControlName; - } - - public String getPayload() { - return payload; - } - - public void setPayload(String payload) { - this.payload = payload; - } - - public String getTargetType() { - return targetType; - } - - public void setTargetType(String targetType) { - this.targetType = targetType; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Map getAai() { - return aai; - } - - public void setAai(Map aai) { - this.aai = aai; - } - - @Override - public String toString() { - return "PolicyNotification [closedLoopControlName=" + closedLoopControlName + ", closedLoopAlarmStart=" - + closedLoopAlarmStart + ", closedLoopEventClient=" + closedLoopEventClient + ", closedLoopEventStatus=" - + closedLoopEventStatus + ", targetType=" + targetType + ", target=" + target + ", requestId=" - + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version + ", action=" + action - + ", payload=" + payload + "]"; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/RadioAccess.java b/src/main/java/com/wipro/www/sonhms/model/RadioAccess.java deleted file mode 100644 index cc1ee4a..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/RadioAccess.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -public class RadioAccess { - - @JsonProperty("FAPServiceNumberOfEntries") - private String fapServiceNumberOfEntries; - - @JsonProperty("FAPServiceList") - private List fapServiceList; - - public RadioAccess() { - - } - - /** - * Parameterized Constructor. - */ - - public RadioAccess(String fapServiceNumberOfEntries, List fapServiceList) { - super(); - this.fapServiceNumberOfEntries = fapServiceNumberOfEntries; - this.fapServiceList = fapServiceList; - } - - public String getFapServiceNumberOfEntries() { - return fapServiceNumberOfEntries; - } - - public void setFapServiceNumberOfEntries(String fapServiceNumberOfEntries) { - this.fapServiceNumberOfEntries = fapServiceNumberOfEntries; - } - - public List getFapServiceList() { - return fapServiceList; - } - - public void setFapServiceList(List fapServiceList) { - this.fapServiceList = fapServiceList; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Ran.java b/src/main/java/com/wipro/www/sonhms/model/Ran.java deleted file mode 100644 index d4dda3a..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Ran.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Ran { - - @JsonProperty(value = "Common") - private Common common; - - public Ran() { - - } - - /** - * Parameterized constructor. - */ - public Ran(Common common) { - super(); - this.common = common; - } - - public Common getCommon() { - return common; - } - - public void setCommon(Common common) { - this.common = common; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/Response.java b/src/main/java/com/wipro/www/sonhms/model/Response.java deleted file mode 100644 index e34c10f..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/Response.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Response { - - @JsonProperty(value = "cellId") - private String cellId; - - private int pci; - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public int getPci() { - return pci; - } - - public void setPci(int pci) { - this.pci = pci; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/SdnrResponse.java b/src/main/java/com/wipro/www/sonhms/model/SdnrResponse.java deleted file mode 100644 index b57b20e..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/SdnrResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import java.util.List; - -public class SdnrResponse { - - private List response; - - public List getResponse() { - return response; - } - - public void setResponse(List response) { - this.response = response; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/ThreadId.java b/src/main/java/com/wipro/www/sonhms/model/ThreadId.java deleted file mode 100644 index d0139f2..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/ThreadId.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -public class ThreadId { - - private long childThreadId; - - public long getChildThreadId() { - return childThreadId; - } - - public void setChildThreadId(long childThreadId) { - this.childThreadId = childThreadId; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java b/src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java deleted file mode 100644 index cb52715..0000000 --- a/src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.model; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class X0005b9Lte { - - @JsonProperty("phyCellIdInUse") - private int phyCellIdInUse; - - @JsonProperty("pnfName") - private String pnfName; - - public X0005b9Lte() { - - } - - /** - * Parameterized Constructor. - */ - - public X0005b9Lte(int phyCellIdInUse, String pnfName) { - super(); - this.phyCellIdInUse = phyCellIdInUse; - this.pnfName = pnfName; - } - - public int getPhyCellIdInUse() { - return phyCellIdInUse; - } - - public void setPhyCellIdInUse(int phyCellIdInUse) { - this.phyCellIdInUse = phyCellIdInUse; - } - - public String getPnfName() { - return pnfName; - } - - public void setPnfName(String pnfName) { - this.pnfName = pnfName; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java b/src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java deleted file mode 100644 index 94e6919..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import java.util.List; - -public class AsyncResponseBody { - - String transactionId = null; - String requestId = null; - String requestStatus = null; - String statusMessage = null; - List solutions; - - public String getTransactionId() { - return transactionId; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getRequestStatus() { - return requestStatus; - } - - @Override - public String toString() { - return "AsyncResponseBody [transactionId=" + transactionId + ", requestId=" + requestId + ", requestStatus=" - + requestStatus + ", statusMessage=" + statusMessage + ", solutions=" + solutions + "]"; - } - - public void setRequestStatus(String requestStatus) { - this.requestStatus = requestStatus; - } - - public String getStatusMessage() { - return statusMessage; - } - - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - - public List getSolutions() { - return solutions; - } - - public void setSolutions(List solutions) { - this.solutions = solutions; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/CellInfo.java b/src/main/java/com/wipro/www/sonhms/restclient/CellInfo.java deleted file mode 100644 index 77d4003..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/CellInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import java.util.ArrayList; -import java.util.List; - -public class CellInfo { - String networkId = null; - List cellIdList = new ArrayList<>(); - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public List getCellIdList() { - return cellIdList; - } - - public void setCellIdList(List cellIdList) { - this.cellIdList = cellIdList; - } - - - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/OofRequestBody.java b/src/main/java/com/wipro/www/sonhms/restclient/OofRequestBody.java deleted file mode 100644 index edee572..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/OofRequestBody.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -public class OofRequestBody { - - protected RequestInfo requestInfo = new RequestInfo(); - protected CellInfo cellInfo = new CellInfo(); - - public RequestInfo getRequestInfo() { - return requestInfo; - } - - public void setRequestInfo(RequestInfo requestInfo) { - this.requestInfo = requestInfo; - } - - public CellInfo getCellInfo() { - return cellInfo; - } - - public void setCellInfo(CellInfo cellInfo) { - this.cellInfo = cellInfo; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java b/src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java deleted file mode 100644 index 7b95d90..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.ConfigPolicy; -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.exceptions.OofNotFoundException; -import com.wipro.www.sonhms.utils.HttpRequester; - -import java.util.List; -import java.util.UUID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class OofRestClient { - private static Logger log = LoggerFactory.getLogger(OofRestClient.class); - - private OofRestClient() { - - } - - /** - * rest client that pci uses to query the OOF for pci solutions. - * @throws OofNotFoundException when request to oof fails - */ - - public static String queryOof(int numSolutions, String transactionId, String requestType, - List cellIdList, String networkId, List optimizers) throws OofNotFoundException { - log.debug("inside queryoof"); - - String response = ""; - Configuration configuration = Configuration.getInstance(); - try { - UUID requestUuid = UUID.randomUUID(); - String requestId = requestUuid.toString(); - String callbackUrl = configuration.getCallbackUrl(); - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setTransactionId(transactionId); - requestInfo.setRequestId(requestId); - requestInfo.setCallbackUrl(callbackUrl); - String sourceId = configuration.getSourceId(); - requestInfo.setSourceId(sourceId); - requestInfo.setRequestType(requestType); - requestInfo.setNumSolutions(numSolutions); - requestInfo.setOptimizers(optimizers); - ConfigPolicy config = ConfigPolicy.getInstance(); - int timeout = 60; - try { - timeout = (int) config.getConfig().get("PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS"); - } catch (NullPointerException e) { - log.debug("No config policy available. Using default timeout 60 sec"); - } - requestInfo.setTimeout(timeout); - CellInfo cellInfo = new CellInfo(); - cellInfo.setCellIdList(cellIdList); - cellInfo.setNetworkId(networkId); - OofRequestBody oofRequestBody = new OofRequestBody(); - oofRequestBody.setRequestInfo(requestInfo); - oofRequestBody.setCellInfo(cellInfo); - - ObjectMapper mapper = new ObjectMapper(); - String requestBody = mapper.writeValueAsString(oofRequestBody); - log.debug("requestBody{}", requestBody); - - String requestUrl = configuration.getOofService() + "/api/oof/v1/pci"; - log.debug("requestUrl {}", requestUrl); - - response = HttpRequester.sendPostRequestToOof(requestUrl, requestBody); - if (response == null) { - throw new OofNotFoundException("Request to oof failed"); - } - log.debug("response {}", response); - - return response; - } catch (JsonProcessingException e) { - log.debug("exception{}", e); - - } - return response; - } -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/PolicyRequestBody.java b/src/main/java/com/wipro/www/sonhms/restclient/PolicyRequestBody.java deleted file mode 100644 index e9e7b0d..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/PolicyRequestBody.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -public class PolicyRequestBody { - - String configName = null; - String policyName = null; - String requestId = null; - - public String getConfigName() { - return configName; - } - - public void setConfigName(String configName) { - this.configName = configName; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java b/src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java deleted file mode 100644 index 7c286af..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.utils.HttpRequester; - -import java.util.UUID; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PolicyRestClient { - private static Logger log = LoggerFactory.getLogger(PolicyRestClient.class); - - private PolicyRestClient() { - - } - - /** - * Fetches configuration from policy. - */ - public static String fetchConfigFromPolicy() { - log.debug("inside fetconfig from policy"); - - Configuration configuration = Configuration.getInstance(); - String response = ""; - String configName = configuration.getConfigName(); - String policyName = configuration.getPolicyName(); - - try { - PolicyRequestBody policyRequestBody = new PolicyRequestBody(); - policyRequestBody.setConfigName(configName); - policyRequestBody.setPolicyName(policyName); - UUID requestUuid = UUID.randomUUID(); - String requestId = requestUuid.toString(); - policyRequestBody.setRequestId(requestId); - ObjectMapper mapper = new ObjectMapper(); - String requestBody; - requestBody = mapper.writeValueAsString(policyRequestBody); - - log.debug("policyRequestBody{}", requestBody); - String requestUrl = configuration.getPolicyService() + "/pdp/api/getConfig"; - response = HttpRequester.sendPostToPolicy(requestUrl, requestBody); - log.debug("policy response{}", response); - - return response; - } catch (JsonProcessingException e) { - log.debug("exception", e); - } - return response; - - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java b/src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java deleted file mode 100644 index 6dcbf63..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import java.util.List; - -public class RequestInfo { - String transactionId = null; - String requestId = null; - String callbackUrl = null; - String sourceId = null; - String requestType = null; - int numSolutions; - List optimizers = null; - - public void setOptimizers(List optimizers) { - this.optimizers = optimizers; - } - - public List getOptimizers() { - return optimizers; - } - - int timeout; - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public String getSourceId() { - return sourceId; - } - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public int getNumSolutions() { - return numSolutions; - } - - public void setNumSolutions(int numSolutions) { - this.numSolutions = numSolutions; - } - - public int getTimeout() { - return timeout; - } - - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - public String getTransactionId() { - return transactionId; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java b/src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java deleted file mode 100644 index c37791f..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import com.wipro.www.sonhms.Configuration; -import com.wipro.www.sonhms.exceptions.ConfigDbNotFoundException; -import com.wipro.www.sonhms.model.CellPciPair; -import com.wipro.www.sonhms.utils.HttpRequester; - -import java.sql.Time; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.List; - -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - - -public class SdnrRestClient { - - private static final String DATETIMEFORMAT = "yyyy-MM-dd HH:mm:ss"; - private static Logger log = LoggerFactory.getLogger(SdnrRestClient.class); - - private SdnrRestClient() { - - } - - /** - * Method to get cell list from SDNR. - * - * @throws ConfigDbNotFoundException - * when request to configDB fails - */ - public static String getCellList(String networkId) throws ConfigDbNotFoundException { - Configuration configuration = Configuration.getInstance(); - String ts = new SimpleDateFormat(DATETIMEFORMAT).format(new Time(System.currentTimeMillis())); - String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getCellList" + "/" + networkId + "/" - + encode(ts); - return sendRequest(requestUrl); - } - - /** - * Method to get neibhbour list from SDNR. - * - * @throws ConfigDbNotFoundException - * when request to configDB fails - */ - public static List getNbrList(String cellId) throws ConfigDbNotFoundException { - Configuration configuration = Configuration.getInstance(); - String ts = new SimpleDateFormat(DATETIMEFORMAT).format(new Time(System.currentTimeMillis())); - String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getNbrList" + "/" + cellId + "/" - + encode(ts); - log.debug("request url: {}", requestUrl); - String response = sendRequest(requestUrl); - List nbrList = new ArrayList<>(); - JSONArray nbrListObj = new JSONArray(response); - for (int i = 0; i < nbrListObj.length(); i++) { - JSONObject cellObj = nbrListObj.getJSONObject(i); - CellPciPair cell = new CellPciPair(cellObj.getString("cellId"), cellObj.getInt("pciValue")); - nbrList.add(cell); - } - - return nbrList; - } - - /** - * Method to get PCI from SDNR. - * - * @throws ConfigDbNotFoundException - * when request to configDB fails - */ - public static int getPci(String cellId) throws ConfigDbNotFoundException { - Configuration configuration = Configuration.getInstance(); - String ts = new SimpleDateFormat(DATETIMEFORMAT).format(new Time(System.currentTimeMillis())); - String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getPCI" + "/" + cellId + "/" - + encode(ts); - String response = sendRequest(requestUrl); - JSONObject respObj = new JSONObject(response); - return respObj.getInt("value"); - } - - /** - * Method to get PNF name from SDNR. - * - * @throws ConfigDbNotFoundException - * when request to configDB fails - */ - public static String getPnfName(String cellId) throws ConfigDbNotFoundException { - Configuration configuration = Configuration.getInstance(); - String ts = new SimpleDateFormat(DATETIMEFORMAT).format(new Time(System.currentTimeMillis())); - String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getPnfName" + "/" + cellId + "/" - + encode(ts); - String response = sendRequest(requestUrl); - JSONObject responseObject = new JSONObject(response); - return responseObject.getString("value"); - } - - /** - * Method to encode url. - */ - private static String encode(String url) { - return url.replace(" ", "%20"); - } - - /** - * Method to send request. - */ - private static String sendRequest(String url) throws ConfigDbNotFoundException { - String response = HttpRequester.sendGetRequest(url); - if (response.equals("")) { - throw new ConfigDbNotFoundException("Cannot reach Config DB"); - } - return response; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/Solution.java b/src/main/java/com/wipro/www/sonhms/restclient/Solution.java deleted file mode 100644 index 765501a..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/Solution.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -import java.util.ArrayList; -import java.util.List; - -public class Solution { - String startTime = null; - String finishTime = null; - String networkId = null; - List pciSolutions = new ArrayList<>(); - - public String getStartTime() { - return startTime; - } - - public void setStartTime(String startTime) { - this.startTime = startTime; - } - - public String getFinishTime() { - return finishTime; - } - - public void setFinishTime(String finishTime) { - this.finishTime = finishTime; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public List getPciSolutions() { - return pciSolutions; - } - - /** - * Sets PciSolutions. - */ - public void setPciSolutions(List pciSolutions) { - - this.pciSolutions = pciSolutions; - - } - - @Override - public String toString() { - return "Solutions [startTime=" + startTime + ", finishTime=" + finishTime + ", networkId=" + networkId - + ", pciSolutions=" + pciSolutions + "]"; - } -} diff --git a/src/main/java/com/wipro/www/sonhms/restclient/SonSolution.java b/src/main/java/com/wipro/www/sonhms/restclient/SonSolution.java deleted file mode 100644 index 4872fc7..0000000 --- a/src/main/java/com/wipro/www/sonhms/restclient/SonSolution.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.restclient; - -public class SonSolution { - - String cellId = null; - int pci; - - public String getCellId() { - return cellId; - } - - public void setCellId(String cellId) { - this.cellId = cellId; - } - - public int getPci() { - return pci; - } - - public void setPci(int pci) { - this.pci = pci; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/utils/BeanUtil.java b/src/main/java/com/wipro/www/sonhms/utils/BeanUtil.java deleted file mode 100644 index 9d7cdb3..0000000 --- a/src/main/java/com/wipro/www/sonhms/utils/BeanUtil.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.utils; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Service; - -@Service -public class BeanUtil implements ApplicationContextAware { - private static ApplicationContext context; - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - context = applicationContext; - } - - public static T getBean(Class beanClass) { - return context.getBean(beanClass); - } -} diff --git a/src/main/java/com/wipro/www/sonhms/utils/FileIo.java b/src/main/java/com/wipro/www/sonhms/utils/FileIo.java deleted file mode 100644 index 929ae95..0000000 --- a/src/main/java/com/wipro/www/sonhms/utils/FileIo.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.utils; - -import java.io.BufferedReader; -import java.io.FileReader; - -public class FileIo { - - private FileIo() { - - } - - /** - * Reads from File. - */ - public static String readFromFile(String file) { - String content = ""; - try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) { - content = bufferedReader.readLine(); - String temp; - while ((temp = bufferedReader.readLine()) != null) { - content = content.concat(temp); - } - content = content.trim(); - } catch (Exception e) { - content = null; - } - return content; - } - -} diff --git a/src/main/java/com/wipro/www/sonhms/utils/HttpRequester.java b/src/main/java/com/wipro/www/sonhms/utils/HttpRequester.java deleted file mode 100644 index 4e4e411..0000000 --- a/src/main/java/com/wipro/www/sonhms/utils/HttpRequester.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * ============LICENSE_START======================================================= - * pcims - * ================================================================================ - * 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 com.wipro.www.sonhms.utils; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.net.HttpURLConnection; -import java.net.URL; - -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLSession; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class HttpRequester { - - private static final String ACCEPT = "Accept"; - private static final String JSON = "application/json"; - private static final String CONTENT = "Content-Type"; - private static final String UTF = "UTF-8"; - private static final String FAILMSG = "Post failed"; - private static final String AUTH = "Authorization"; - private static Logger log = LoggerFactory.getLogger(HttpRequester.class); - - public static class MyHostnameVerifier implements HostnameVerifier { - - @Override - public boolean verify(String hostname, SSLSession session) { - // verification of hostname is switched off - log.debug("Hostname: {}", hostname); - return true; - } - } - - /** - * Send Post Request. - */ - public static String sendPostRequest(String requestUrl, String requestBody) { - String response = ""; - - try { - URL url = new URL(requestUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestMethod("POST"); - connection.setRequestProperty(ACCEPT, JSON); - connection.setRequestProperty(CONTENT, JSON); - OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), UTF); - writer.write(requestBody); - writer.close(); - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String temp; - int responseCode = connection.getResponseCode(); - log.debug("response code: {}", responseCode); - response = br.readLine(); - while ((temp = br.readLine()) != null) { - response = response.concat(temp); - } - br.close(); - connection.disconnect(); - - if (response == null) { - response = String.valueOf(responseCode); - } - - } catch (Exception e) { - response = FAILMSG; - } - - return response; - } - - /** - * Send Post Request to policy. - */ - public static String sendPostToPolicy(String requestUrl, String requestBody) { - String response = ""; - log.debug("inside post to policy"); - - try { - URL url = new URL(requestUrl); - - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); - connection.setHostnameVerifier(new MyHostnameVerifier()); - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestMethod("POST"); - connection.setRequestProperty(ACCEPT, JSON); - connection.setRequestProperty(CONTENT, JSON); - connection.setRequestProperty("ClientAuth", "cHl0aG9uOnRlc3Q="); - connection.setRequestProperty("Environment", "TEST"); - connection.setRequestProperty(AUTH, "Basic dGVzdHBkcDphbHBoYTEyMw=="); - OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), UTF); - writer.write(requestBody); - writer.close(); - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String temp; - int responseCode = connection.getResponseCode(); - log.debug("response code: {}", responseCode); - response = br.readLine(); - while ((temp = br.readLine()) != null) { - response = response.concat(temp); - } - br.close(); - connection.disconnect(); - - } catch (Exception e) { - log.debug("Exception during post to policy: {}", e); - response = FAILMSG; - } - - return response; - } - - /** - * Send Get Request. - */ - public static String sendGetRequest(String requestUrl) { - String response = ""; - int returnCode = 0; - - try { - URL url = new URL(requestUrl); - HttpURLConnection connection = null; - connection = (HttpURLConnection) url.openConnection(); - connection.setDoInput(true); - connection.setRequestMethod("GET"); - connection.setRequestProperty(ACCEPT, JSON); - returnCode = connection.getResponseCode(); - InputStream connectionIn = null; - if (returnCode == 200) { - connectionIn = connection.getInputStream(); - BufferedReader buffer = new BufferedReader(new InputStreamReader(connectionIn)); - String inputLine; - while ((inputLine = buffer.readLine()) != null) { - response = response.concat(inputLine); - } - buffer.close(); - } - - else { - response = ""; - log.debug("return code: {}", returnCode); - } - } catch (Exception e) { - log.debug("Get failed,Exception : {}", e); - response = ""; - } - return response; - - } - - /** - * Send Get Request to SDNR. - */ - public String sendGetRequest(String requestUrl, String requestBody) { - String response; - try { - URL url = new URL(requestUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestMethod("POST"); - connection.setRequestProperty(ACCEPT, "text/plain"); - connection.setRequestProperty(CONTENT, JSON); - connection.setRequestProperty(AUTH, "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=="); - OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), UTF); - writer.write(requestBody); - writer.close(); - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String temp; - response = br.readLine(); - while ((temp = br.readLine()) != null) { - response = response.concat(temp); - } - br.close(); - connection.disconnect(); - - } catch (Exception e) { - response = FAILMSG; - } - - return response; - } - - /** - * Send Post Request. - */ - public String sendPostRequest1(String requestUrl, String requestBody) { - String response; - try { - URL url = new URL(requestUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestMethod("POST"); - connection.setRequestProperty(ACCEPT, JSON); - connection.setRequestProperty(CONTENT, JSON); - connection.setRequestProperty(AUTH, "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=="); - connection.setRequestProperty("Content-Length", "" + requestBody.length()); - OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), UTF); - writer.write(requestBody); - writer.close(); - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String temp; - response = br.readLine(); - while ((temp = br.readLine()) != null) { - response = response.concat(temp); - } - br.close(); - connection.disconnect(); - - } catch (Exception e) { - response = FAILMSG; - } - - return response; - } - - /** - * Send Post Request to oof. - */ - public static String sendPostRequestToOof(String requestUrl, String requestBody) { - String response = ""; - - try { - URL url = new URL(requestUrl); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setDoOutput(true); - connection.setDoInput(true); - connection.setRequestMethod("POST"); - connection.setRequestProperty(ACCEPT, JSON); - connection.setRequestProperty(CONTENT, JSON); - connection.setRequestProperty(AUTH, "Basic cGNpX3Rlc3Q6cGNpX3Rlc3Rwd2Q="); - OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream(), UTF); - writer.write(requestBody); - writer.close(); - BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String temp; - int responseCode = connection.getResponseCode(); - log.debug("response code: {}", responseCode); - response = br.readLine(); - while ((temp = br.readLine()) != null) { - response = response.concat(temp); - } - br.close(); - connection.disconnect(); - - if (response == null) { - log.debug("Response code: {}", responseCode); - } - - } catch (Exception e) { - log.debug("exception occured when posting: {}", e); - return null; - } - - return response; - } - -} -- cgit 1.2.3-korg