aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/wipro/www/sonhms/BufferNotificationState.java38
-rw-r--r--src/main/java/com/wipro/www/sonhms/BufferedNotificationHandlingState.java34
-rw-r--r--src/main/java/com/wipro/www/sonhms/ChildStatusUpdateState.java88
-rw-r--r--src/main/java/com/wipro/www/sonhms/ChildTriggeringState.java40
-rw-r--r--src/main/java/com/wipro/www/sonhms/ConfigPolicy.java57
-rw-r--r--src/main/java/com/wipro/www/sonhms/MainThread.java49
-rw-r--r--src/main/java/com/wipro/www/sonhms/MainThreadComponent.java55
-rw-r--r--src/main/java/com/wipro/www/sonhms/NewNotification.java40
-rw-r--r--src/main/java/com/wipro/www/sonhms/ResourceCleanupState.java34
-rw-r--r--src/main/java/com/wipro/www/sonhms/SdnrNotificationHandlingState.java259
-rw-r--r--src/main/java/com/wipro/www/sonhms/SonContext.java122
-rw-r--r--src/main/java/com/wipro/www/sonhms/SonRequestsComponent.java40
-rw-r--r--src/main/java/com/wipro/www/sonhms/SonState.java26
-rw-r--r--src/main/java/com/wipro/www/sonhms/WaitState.java90
-rw-r--r--src/main/java/com/wipro/www/sonhms/child/ClusterModification.java147
-rw-r--r--src/main/java/com/wipro/www/sonhms/child/StateOof.java271
-rw-r--r--src/main/java/com/wipro/www/sonhms/dao/CellInfoRepository.java34
-rw-r--r--src/main/java/com/wipro/www/sonhms/dao/DmaapNotificationsRepository.java40
-rw-r--r--src/main/java/com/wipro/www/sonhms/dao/SonRequestsRepository.java43
-rw-r--r--src/main/java/com/wipro/www/sonhms/dmaap/NotificationProducer.java57
-rw-r--r--src/main/java/com/wipro/www/sonhms/dmaap/PolicyDmaapClient.java53
-rw-r--r--src/main/java/com/wipro/www/sonhms/exceptions/ConfigDbNotFoundException.java33
-rw-r--r--src/main/java/com/wipro/www/sonhms/exceptions/OofNotFoundException.java33
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/CellConfig.java47
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Common.java47
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Configurations.java54
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Data.java47
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Lte.java47
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/NotificationCellConfig.java51
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/NotificationLte.java51
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/NotificationPayload.java51
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Payload.java54
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Ran.java50
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/Response.java48
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/SdnrResponse.java37
-rw-r--r--src/main/java/com/wipro/www/sonhms/model/ThreadId.java35
-rw-r--r--src/main/java/com/wipro/www/sonhms/restclient/CellInfo.java48
-rw-r--r--src/main/java/com/wipro/www/sonhms/restclient/OofRequestBody.java44
-rw-r--r--src/main/java/com/wipro/www/sonhms/restclient/PolicyRequestBody.java53
-rw-r--r--src/main/java/com/wipro/www/sonhms/restclient/SonSolution.java44
-rw-r--r--src/main/java/com/wipro/www/sonhms/utils/BeanUtil.java40
-rw-r--r--src/main/java/com/wipro/www/sonhms/utils/FileIo.java50
-rw-r--r--src/main/java/com/wipro/www/sonhms/utils/HttpRequester.java284
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/Application.java (renamed from src/main/java/com/wipro/www/sonhms/Application.java)43
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponent.java (renamed from src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java)47
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponent.java (renamed from src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java)47
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/ConfigPolicy.java58
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java (renamed from src/main/java/com/wipro/www/sonhms/Configuration.java)66
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/ConfigurationFetcher.java72
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponent.java58
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/EventHandler.java252
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java98
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/MainThreadComponent.java43
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/NewNotification.java41
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/NotificationToClusterMapping.java93
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/SonController.java (renamed from src/main/java/com/wipro/www/sonhms/SonController.java)46
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/SonRequestsComponent.java41
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/Topic.java (renamed from src/main/java/com/wipro/www/sonhms/Topic.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThread.java (renamed from src/main/java/com/wipro/www/sonhms/child/ChildThread.java)64
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java94
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/ClusterFormation.java (renamed from src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java)60
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/Detection.java (renamed from src/main/java/com/wipro/www/sonhms/child/Detection.java)43
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/Graph.java (renamed from src/main/java/com/wipro/www/sonhms/child/Graph.java)88
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/PnfUtils.java78
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/StateOof.java193
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/controller/HealthCheck.java36
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dao/BufferedNotificationsRepository.java (renamed from src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java)43
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dao/CellInfoRepository.java35
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dao/ClusterDetailsRepository.java (renamed from src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java)43
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dao/DmaapNotificationsRepository.java41
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dao/SonRequestsRepository.java44
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClient.java (renamed from src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java)50
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationConsumer.java (renamed from src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java)41
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducer.java52
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/PolicyDmaapClient.java52
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotifications.java (renamed from src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/entity/CellInfo.java (renamed from src/main/java/com/wipro/www/sonhms/entity/CellInfo.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/entity/ClusterDetails.java (renamed from src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java)45
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotifications.java (renamed from src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/entity/PciRequests.java (renamed from src/main/java/com/wipro/www/sonhms/entity/PciRequests.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/ConfigDbNotFoundException.java34
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/OofNotFoundException.java34
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/CellConfig.java48
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourList.java (renamed from src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/CellPciPair.java (renamed from src/main/java/com/wipro/www/sonhms/model/CellPciPair.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Common.java48
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Configurations.java55
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Data.java48
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/FapService.java (renamed from src/main/java/com/wipro/www/sonhms/model/FapService.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/FapServiceList.java (renamed from src/main/java/com/wipro/www/sonhms/model/FapServiceList.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Lte.java48
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/LteNeighborListInUseLteCell.java (renamed from src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/NeighborListInUse.java (renamed from src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Notification.java (renamed from src/main/java/com/wipro/www/sonhms/model/Notification.java)46
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationCellConfig.java52
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationLte.java52
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayload.java52
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationRan.java (renamed from src/main/java/com/wipro/www/sonhms/model/NotificationRan.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Payload.java55
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java (renamed from src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java)75
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/RadioAccess.java (renamed from src/main/java/com/wipro/www/sonhms/model/RadioAccess.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Ran.java51
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Response.java49
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponse.java38
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/ThreadId.java36
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/X0005b9Lte.java (renamed from src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBody.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfo.java49
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBody.java45
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClient.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java)55
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBody.java54
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClient.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java)51
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfo.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java)39
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java)62
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/Solution.java (renamed from src/main/java/com/wipro/www/sonhms/restclient/Solution.java)37
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SonSolution.java45
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/AppConfig.java68
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/BeanUtil.java41
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtils.java344
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/FileIo.java51
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/SonHandlerRestTemplate.java162
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/utils/ThreadUtils.java84
122 files changed, 3928 insertions, 3623 deletions
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<String> 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<Thread> 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/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<String, Object> config;
-
- protected ConfigPolicy() {
-
- }
-
- /**
- * Get instance of class.
- */
- public static ConfigPolicy getInstance() {
- if (instance == null) {
- instance = new ConfigPolicy();
- }
- return instance;
- }
-
- public Map<String, Object> getConfig() {
- return config;
- }
-
- public void setConfig(Map<String, Object> config) {
- this.config = config;
- }
-
- @Override
- public String toString() {
- return "ConfigPolicy [config=" + config + "]";
- }
-
-}
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<List<String>>(), 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<Long, ChildThread> 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<FapServiceList> 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> 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<FapServiceList> 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<LteNeighborListInUseLteCell> 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<CellPciPair> 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> clusterDetails) {
-
- String cellId = fapService.getCellConfig().getLte().getRan().getCellIdentity();
- Map<CellPciPair, ArrayList<CellPciPair>> cellPciNeighbourMap;
-
- for (ClusterDetails clusterDetail : clusterDetails) {
- Graph cluster = new Graph(clusterDetail.getClusterInfo());
- cellPciNeighbourMap = cluster.getCellPciNeighbourMap();
- Set<CellPciPair> keys = cellPciNeighbourMap.keySet();
- Iterator<CellPciPair> traverse = keys.iterator();
- while (traverse.hasNext()) {
- CellPciPair key = traverse.next();
- String currentCellId = key.getCellId();
- if (cellId.equals(currentCellId)) {
- return clusterDetail;
- }
- }
- }
-
- return null;
- }
-
- private List<ClusterDetails> getAllClusters() {
- ClusterDetailsComponent clusterDetailsComponent = new ClusterDetailsComponent();
- return clusterDetailsComponent.getClusterDetails();
- }
-
- public static void addChildThreadMap(Long childThreadId, ChildThread child) {
- childThreadMap.put(childThreadId, child);
- }
-
- public static Map<Long, ChildThread> 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<Long, String> childStatus;
- private BlockingQueue<List<String>> 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<List<String>> 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<List<String>> getChildStatusUpdate() {
- return childStatusUpdate;
- }
-
- public void setChildStatusUpdate(BlockingQueue<List<String>> 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/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/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<String> 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<String> 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/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<LteNeighborListInUseLteCell> newNeighbourList;
- newNeighbourList = fapser.getCellConfig().getLte().getRan().getNeighborListInUse()
- .getLteNeighborListInUseLteCell();
-
- Map<CellPciPair, ArrayList<CellPciPair>> clusterMap;
- clusterMap = cluster.getCellPciNeighbourMap();
-
- // coe
-
- List<CellPciPair> tempCellPair = new ArrayList<>();
- for (Map.Entry<CellPciPair, ArrayList<CellPciPair>> 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<CellPciPair> 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/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<List<String>> childStatusUpdate;
-
- public StateOof() {
-
- }
-
- /**
- * Parameterized Constructor.
- *
- */
- public StateOof(BlockingQueue<List<String>> childStatusUpdate) {
- super();
- this.childStatusUpdate = childStatusUpdate;
- }
-
- /**
- * Triggers OOF.
- * @throws OofNotFoundException when trigger oof fails
- */
- public void triggerOof(Map<String, ArrayList<Integer>> result, String networkId) throws OofNotFoundException {
- // check for 0 collision and 0 confusion
- ArrayList<String> cellidList = new ArrayList<>();
- ArrayList<String> cellIds = new ArrayList<>();
-
- for (Map.Entry<String, ArrayList<Integer>> entry : result.entrySet()) {
- String key = entry.getKey();
- ArrayList<Integer> arr;
- arr = entry.getValue();
- if (!arr.isEmpty()) {
- Set<Integer> 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<String> optimizers = config.getOptimizers();
-
- String oofResponse = OofRestClient.queryOof(numSolutions, transactionId.toString(), "create", cellidList,
- networkId, optimizers);
- log.debug("Synchronous Response {}", oofResponse);
-
- List<String> 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<Solution> solutions;
- solutions = async.getSolutions();
-
- Map<String, List<CellPciPair>> pnfs = getPnfs(solutions);
-
- for (Map.Entry<String, List<CellPciPair>> entry : pnfs.entrySet()) {
- String pnfName = entry.getKey();
- List<CellPciPair> 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<CellPciPair> cellPciPairs, String networkId) {
- ArrayList<Configurations> 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<String, List<CellPciPair>> getPnfs(List<Solution> solutions) throws ConfigDbNotFoundException {
-
- Map<String, List<CellPciPair>> pnfs = new HashMap<>();
-
- for (Solution solution : solutions) {
- List<SonSolution> 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> 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<CellPciPair> 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/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<CellInfo, String> {
-
- // public void
-
-}
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<DmaapNotifications, String> {
-
- @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<PciRequests, String> {
-
- @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/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<String> servers;
- private String apiKey;
- private String secret;
-
- /**
- * Parameterised constructor.
- */
- public NotificationProducer(List<String> 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/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/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/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/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/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<Configurations> configuration;
-
- public Payload() {
-
- }
-
- public Payload(List<Configurations> configuration) {
- super();
- this.configuration = configuration;
- }
-
- public List<Configurations> getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(List<Configurations> configuration) {
- this.configuration = configuration;
- }
-
- @Override
- public String toString() {
- return "Payload [configuration=" + configuration + "]";
-
- }
-
-}
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> response;
-
- public List<Response> getResponse() {
- return response;
- }
-
- public void setResponse(List<Response> 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/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<String> cellIdList = new ArrayList<>();
-
- public String getNetworkId() {
- return networkId;
- }
-
- public void setNetworkId(String networkId) {
- this.networkId = networkId;
- }
-
- public List<String> getCellIdList() {
- return cellIdList;
- }
-
- public void setCellIdList(List<String> 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/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/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> T getBean(Class<T> 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;
- }
-
-}
diff --git a/src/main/java/com/wipro/www/sonhms/Application.java b/src/main/java/org/onap/dcaegen2/services/sonhms/Application.java
index 4c831b4..7eb9e62 100644
--- a/src/main/java/com/wipro/www/sonhms/Application.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Application.java
@@ -1,29 +1,30 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.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 org.onap.dcaegen2.services.sonhms.dmaap.DmaapClient;
+import org.onap.dcaegen2.services.sonhms.restclient.PolicyRestClient;
+import org.onap.dcaegen2.services.sonhms.utils.FileIo;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java b/src/main/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponent.java
index 6074a31..50dec11 100644
--- a/src/main/java/com/wipro/www/sonhms/BufferNotificationComponent.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/BufferNotificationComponent.java
@@ -1,28 +1,29 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.dao.BufferedNotificationsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.BufferedNotifications;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
import java.util.List;
public class BufferNotificationComponent {
diff --git a/src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java b/src/main/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponent.java
index 939f9e1..8e4b357 100644
--- a/src/main/java/com/wipro/www/sonhms/ClusterDetailsComponent.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/ClusterDetailsComponent.java
@@ -1,28 +1,29 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigPolicy.java b/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigPolicy.java
new file mode 100644
index 0000000..7c065ac
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigPolicy.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import java.util.Map;
+
+public class ConfigPolicy {
+
+ private static ConfigPolicy instance = null;
+ private Map<String, Object> config;
+
+ protected ConfigPolicy() {
+
+ }
+
+ /**
+ * Get instance of class.
+ */
+ public static ConfigPolicy getInstance() {
+ if (instance == null) {
+ instance = new ConfigPolicy();
+ }
+ return instance;
+ }
+
+ public Map<String, Object> getConfig() {
+ return config;
+ }
+
+ public void setConfig(Map<String, Object> 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/org/onap/dcaegen2/services/sonhms/Configuration.java
index fb53f9b..a90a0b9 100644
--- a/src/main/java/com/wipro/www/sonhms/Configuration.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
import java.util.List;
@@ -50,6 +51,33 @@ public class Configuration {
private int numSolutions;
private int bufferTime;
private int maximumClusters;
+ private String consulHost;
+ private String hostName;
+ private String configBindingService;
+
+ public String getConsulHost() {
+ return consulHost;
+ }
+
+ public void setConsulHost(String consulHost) {
+ this.consulHost = consulHost;
+ }
+
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ public String getConfigBindingService() {
+ return configBindingService;
+ }
+
+ public void setConfigBindingService(String configBindingService) {
+ this.configBindingService = configBindingService;
+ }
public int getMaximumClusters() {
return maximumClusters;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigurationFetcher.java b/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigurationFetcher.java
new file mode 100644
index 0000000..4a55393
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/ConfigurationFetcher.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.utils.SonHandlerRestTemplate;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.ResponseEntity;
+
+
+public class ConfigurationFetcher {
+ private static Logger log = LoggerFactory.getLogger(ConfigurationFetcher.class);
+
+ /**
+ * method that fetches config from config binding service.
+ */
+ public void fetchFromCbs() {
+
+ Configuration configuration = Configuration.getInstance();
+ String consulHost = configuration.getConsulHost();
+ String configBindingService = configuration.getConfigBindingService();
+ ResponseEntity<String> response = null;
+ String requestUrl = "";
+ if ((consulHost != null) && (configBindingService != null)) {
+ requestUrl = consulHost + ":8500/v1/catalog/service/" + configBindingService;
+ response = SonHandlerRestTemplate.sendPostRequest(requestUrl, "",
+ new ParameterizedTypeReference<String>() {});
+ }
+ JSONTokener jsonTokener = new JSONTokener(response.getBody());
+ JSONObject cbsjobj = (JSONObject) new JSONArray(jsonTokener).get(0);
+ String cbsUrl = "";
+ String configurationRequestUrl = "";
+ ResponseEntity<String> configurationResponse = null;
+ if (cbsjobj.has("ServiceAddress") && cbsjobj.has("ServicePort")) {
+ cbsUrl = cbsjobj.getString("ServiceAddress") + ":" + cbsjobj.getInt("ServicePort");
+
+ }
+
+ configurationRequestUrl = cbsUrl + "/service_component/" + configuration.getHostName();
+ configurationResponse = SonHandlerRestTemplate.sendPostRequest1(configurationRequestUrl, "",
+ new ParameterizedTypeReference<String>() {});
+ JSONObject config = new JSONObject(new JSONTokener(configurationResponse.getBody()));
+ String configString = config.toString();
+ log.debug("config:{}",configString);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponent.java b/src/main/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponent.java
new file mode 100644
index 0000000..f28de63
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/DmaapNotificationsComponent.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.dcaegen2.services.sonhms.dao.DmaapNotificationsRepository;
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+import fj.data.Either;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DmaapNotificationsComponent {
+
+ private static Logger log = LoggerFactory.getLogger(DmaapNotificationsComponent.class);
+
+ /**
+ * Get dmaap notifications.
+ */
+ public Either<Notification, Integer> getDmaapNotifications() {
+ DmaapNotificationsRepository dmaapNotificationsRepository = BeanUtil
+ .getBean(DmaapNotificationsRepository.class);
+ String notificationString = dmaapNotificationsRepository.getNotificationFromQueue();
+ ObjectMapper mapper = new ObjectMapper();
+
+ Notification notification = new Notification();
+ try {
+ notification = mapper.readValue(notificationString, Notification.class);
+ return Either.left(notification);
+ } catch (IOException e) {
+ log.error("Exception in parsing notification", notificationString, e);
+ return Either.right(400);
+ }
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/EventHandler.java b/src/main/java/org/onap/dcaegen2/services/sonhms/EventHandler.java
new file mode 100644
index 0000000..312ca60
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/EventHandler.java
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * ============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 org.onap.dcaegen2.services.sonhms;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.dcaegen2.services.sonhms.child.ChildThread;
+import org.onap.dcaegen2.services.sonhms.child.Graph;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.utils.ClusterUtils;
+import org.onap.dcaegen2.services.sonhms.utils.ThreadUtils;
+
+import fj.data.Either;
+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.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EventHandler {
+
+ private static Logger log = LoggerFactory.getLogger(EventHandler.class);
+
+ private static Map<Long, ChildThread> childThreadMap = new HashMap<>();
+
+ private BlockingQueue<List<String>> childStatusQueue;
+
+ private Map<Long, String> childStatus;
+
+ private ExecutorService pool;
+
+ private ClusterUtils clusterUtils;
+
+ private ThreadUtils threadUtils;
+
+ /**
+ * Constructor.
+ */
+ public EventHandler(BlockingQueue<List<String>> childStatusQueue, ExecutorService pool,
+ Map<Long, String> childStatus, ClusterUtils clusterUtils, ThreadUtils threadUtils) {
+
+ this.childStatusQueue = childStatusQueue;
+ this.childStatus = childStatus;
+ this.pool = pool;
+ this.clusterUtils = clusterUtils;
+ this.threadUtils = threadUtils;
+ }
+
+ /**
+ * handle sdnr notification.
+ */
+ public Boolean handleSdnrNotification(Notification notification) {
+ // Check if notification matches with a cluster
+
+ try {
+ List<ClusterDetails> clusterDetails = clusterUtils.getAllClusters();
+
+ NotificationToClusterMapping mapping = new NotificationToClusterMapping();
+ mapping = clusterUtils.getClustersForNotification(notification, clusterDetails);
+
+ // Matching cells
+ System.out.println(mapping);
+ if (mapping.getCellsinCluster() != null) {
+ handleMatchingCells(mapping.getCellsinCluster(), clusterDetails);
+ }
+
+ // unmatched cells
+ if (mapping.getNewCells() != null) {
+ handleUnMatchingCells(mapping.getNewCells());
+ }
+ } catch (Exception e) {
+ log.error("Exception in sdnr notification handling {}", e);
+ return false;
+ }
+
+ return true;
+
+ }
+
+ private void handleUnMatchingCells(List<FapServiceList> newCells) {
+ List<Graph> newClusters = new ArrayList<>();
+
+ for (FapServiceList fapService : newCells) {
+
+ Either<Graph, Integer> existingCluster = clusterUtils.getClusterForCell(fapService, newClusters);
+ if (existingCluster.isRight()) {
+ try {
+ Graph cluster = clusterUtils.createCluster(fapService);
+ newClusters.add(cluster);
+ } catch (ConfigDbNotFoundException e) {
+ log.error("Error connecting with configDB {}", e);
+ }
+ }
+
+ else {
+ Graph cluster = existingCluster.left().value();
+
+ Graph modifiedCluster = clusterUtils.modifyCluster(cluster, fapService);
+ newClusters.remove(cluster);
+ newClusters.add(modifiedCluster);
+ }
+
+ }
+
+ // create new child thread
+
+ threadUtils.createNewThread(newClusters, childStatusQueue, pool, this);
+
+ }
+
+ private void handleMatchingCells(Map<FapServiceList, String> cellsInCluster, List<ClusterDetails> clusterDetails) {
+ for (Entry<FapServiceList, String> entry : cellsInCluster.entrySet()) {
+
+ FapServiceList fapService = entry.getKey();
+ String clusterId = entry.getValue();
+ Either<ClusterDetails, Integer> clusterDetail = clusterUtils.getClusterDetailsFromClusterId(clusterId,
+ clusterDetails);
+
+ if (clusterDetail.isRight()) {
+ log.error("Cannot find the cluster for Cluster ID");
+ return;
+ } else {
+ long threadId = clusterDetail.left().value().getChildThreadId();
+
+ if (childStatus.get(threadId).equals("triggeredOof")) {
+ log.info("OOF triggered for the cluster, buffering notification");
+ bufferNotification(fapService, clusterId);
+ } else {
+ childThreadMap.get(threadId).putInQueue(fapService);
+ }
+ }
+ }
+ }
+
+ 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);
+
+ }
+
+ /**
+ * handle child status update.
+ */
+ public void handleChildStatusUpdate(List<String> childStatus) {
+
+ // update Child status in data structure
+ Long childThreadId = Long.parseLong(childStatus.get(0));
+ addChildStatus(childThreadId, childStatus.get(1));
+
+ // if child status is OOF result success, handle buffered notifications
+ if (childStatus.get(1).equals("success")) {
+ BufferNotificationComponent bufferNotificationComponent = new BufferNotificationComponent();
+ ClusterDetailsComponent clusterDetailsComponent = new ClusterDetailsComponent();
+ String clusterId = clusterDetailsComponent.getClusterId(childThreadId);
+ List<String> bufferedNotifications = bufferNotificationComponent.getBufferedNotification(clusterId);
+
+ if (bufferedNotifications == null || bufferedNotifications.isEmpty()) {
+ log.info("No buffered notification for this thread");
+
+ Set<Thread> setOfThread = Thread.getAllStackTraces().keySet();
+ for (Thread thread : setOfThread) {
+ if (thread.getId() == childThreadId) {
+ deleteChildStatus(childThreadId);
+ thread.interrupt();
+ }
+ }
+ } else {
+ handleBufferedNotifications(childThreadId, bufferedNotifications);
+ }
+ }
+ // else kill the child thread
+
+ }
+
+ private void handleBufferedNotifications(Long childThreadId, List<String> bufferedNotifications) {
+
+ ObjectMapper mapper = new ObjectMapper();
+ for (String notification : bufferedNotifications) {
+ FapServiceList fapServiceList;
+ try {
+ fapServiceList = mapper.readValue(notification, FapServiceList.class);
+ log.debug("fapServiceList{}", fapServiceList);
+
+ childThreadMap.get(childThreadId).putInQueueWithNotify(fapServiceList);
+
+ } catch (IOException e) {
+ log.error("Error parsing the buffered notification, skipping {}", e);
+ }
+ }
+ }
+
+ public static void addChildThreadMap(Long childThreadId, ChildThread child) {
+ childThreadMap.put(childThreadId, child);
+ }
+
+ public static Map<Long, ChildThread> getChildThreadMap() {
+ return childThreadMap;
+ }
+
+ public void addChildStatus(Long threadId, String status) {
+ this.childStatus.put(threadId, status);
+ }
+
+ public String getChildStatus(Long threadId) {
+ return childStatus.get(threadId);
+
+ }
+
+ public void deleteChildStatus(Long childThreadId) {
+ this.childStatus.remove(childThreadId);
+
+ }
+
+ public ExecutorService getPool() {
+ return pool;
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java
new file mode 100644
index 0000000..2026500
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThread.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.utils.ClusterUtils;
+import org.onap.dcaegen2.services.sonhms.utils.ThreadUtils;
+
+import fj.data.Either;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Executors;
+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;
+
+ private BlockingQueue<List<String>> childStatusQueue;
+
+ private DmaapNotificationsComponent dmaapNotificationsComponent;
+
+ private EventHandler eventHandler;
+
+ /**
+ * parameterized constructor.
+ */
+ public MainThread(NewNotification newNotification) {
+ super();
+ this.newNotification = newNotification;
+ childStatusQueue = new LinkedBlockingQueue<>();
+ dmaapNotificationsComponent = new DmaapNotificationsComponent();
+ eventHandler = new EventHandler(childStatusQueue,
+ Executors.newFixedThreadPool(Configuration.getInstance().getMaximumClusters()),
+ new HashMap<>(), new ClusterUtils(), new ThreadUtils());
+ }
+
+ @Override
+ public void run() {
+ log.info("Starting Main Thread");
+
+ // Check for Notifications from Dmaap and Child thread
+ Boolean done = false;
+
+ while (!done) {
+ try {
+ if (!childStatusQueue.isEmpty()) {
+ List<String> childState = childStatusQueue.poll();
+ if (childState != null) {
+ eventHandler.handleChildStatusUpdate(childState);
+ }
+ }
+
+ if (newNotification.getNewNotif()) {
+ Either<Notification, Integer> notification = dmaapNotificationsComponent.getDmaapNotifications();
+ if (notification.isRight()) {
+ log.error("Error parsing the notification from SDNR");
+ } else if (notification.isLeft()) {
+ Boolean result = eventHandler.handleSdnrNotification(notification.left().value());
+ log.debug("SDNR notification handling {}", result);
+ }
+
+ }
+
+ } catch (Exception e) {
+ log.error("Exception in main Thread", e);
+ done = true;
+ }
+
+ }
+
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/MainThreadComponent.java b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThreadComponent.java
new file mode 100644
index 0000000..f83541a
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/MainThreadComponent.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+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);
+
+
+
+ /**
+ * main thread initialization.
+ */
+ public void init(NewNotification newNotification) {
+ log.debug("initializing main thread");
+ Thread thread = new Thread(new MainThread(newNotification));
+ thread.start();
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/NewNotification.java b/src/main/java/org/onap/dcaegen2/services/sonhms/NewNotification.java
new file mode 100644
index 0000000..9f6e57f
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/NewNotification.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/NotificationToClusterMapping.java b/src/main/java/org/onap/dcaegen2/services/sonhms/NotificationToClusterMapping.java
new file mode 100644
index 0000000..14961e5
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/NotificationToClusterMapping.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+
+import java.util.List;
+import java.util.Map;
+
+
+public class NotificationToClusterMapping {
+
+ private Map<FapServiceList, String> cellsinCluster;
+
+ private List<FapServiceList> newCells;
+
+ public Map<FapServiceList, String> getCellsinCluster() {
+ return cellsinCluster;
+ }
+
+ public void setCellsinCluster(Map<FapServiceList, String> cellsinCluster) {
+ this.cellsinCluster = cellsinCluster;
+ }
+
+ public List<FapServiceList> getNewCells() {
+ return newCells;
+ }
+
+ public void setNewCells(List<FapServiceList> newCells) {
+ this.newCells = newCells;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cellsinCluster == null) ? 0 : cellsinCluster.hashCode());
+ result = prime * result + ((newCells == null) ? 0 : newCells.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ NotificationToClusterMapping other = (NotificationToClusterMapping) obj;
+ if (cellsinCluster == null) {
+ if (other.cellsinCluster != null) {
+ return false;
+ }
+ } else if (!cellsinCluster.equals(other.cellsinCluster)) {
+ return false;
+ }
+ if (newCells == null) {
+ if (other.newCells != null) {
+ return false;
+ }
+ } else if (!newCells.equals(other.newCells)) {
+ return false;
+ }
+ return true;
+ }
+
+
+
+
+}
diff --git a/src/main/java/com/wipro/www/sonhms/SonController.java b/src/main/java/org/onap/dcaegen2/services/sonhms/SonController.java
index 8923614..15aa907 100644
--- a/src/main/java/com/wipro/www/sonhms/SonController.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/SonController.java
@@ -1,28 +1,28 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.sonhms.child.ChildThread;
+import org.onap.dcaegen2.services.sonhms.restclient.AsyncResponseBody;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/SonRequestsComponent.java b/src/main/java/org/onap/dcaegen2/services/sonhms/SonRequestsComponent.java
new file mode 100644
index 0000000..51607fa
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/SonRequestsComponent.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms;
+
+import org.onap.dcaegen2.services.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/Topic.java b/src/main/java/org/onap/dcaegen2/services/sonhms/Topic.java
index 3be2087..616d389 100644
--- a/src/main/java/com/wipro/www/sonhms/Topic.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Topic.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms;
public class Topic {
diff --git a/src/main/java/com/wipro/www/sonhms/child/ChildThread.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThread.java
index 718cc46..eff7a84 100644
--- a/src/main/java/com/wipro/www/sonhms/child/ChildThread.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThread.java
@@ -1,32 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.model.ThreadId;
+import org.onap.dcaegen2.services.sonhms.restclient.AsyncResponseBody;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+import org.onap.dcaegen2.services.sonhms.utils.ClusterUtils;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -44,8 +45,7 @@ public class ChildThread implements Runnable {
private BlockingQueue<List<String>> childStatusUpdate;
private BlockingQueue<FapServiceList> queue = new LinkedBlockingQueue<>();
- // static BlockingQueue<AsyncResponseBody> asynchronousResponse = new
- // LinkedBlockingQueue<>();
+
private static Map<Long, AsyncResponseBody> responseMap = new HashMap<>();
private Graph cluster;
private ThreadId threadId;
@@ -98,7 +98,7 @@ public class ChildThread implements Runnable {
*/
public static void putResponse(Long threadId, AsyncResponseBody obj) {
synchronized (responseMap) {
- responseMap.put(threadId, obj);
+ responseMap.put(threadId, obj);
}
}
@@ -130,7 +130,7 @@ public class ChildThread implements Runnable {
ClusterFormation clusterFormation = new ClusterFormation(queue);
StateOof oof = new StateOof(childStatusUpdate);
- ClusterModification clusterModification = new ClusterModification();
+ ClusterUtils clusterUtils = new ClusterUtils();
Detection detect = new Detection();
try {
@@ -152,7 +152,7 @@ public class ChildThread implements Runnable {
if (isNotificationsBuffered()) {
List<FapServiceList> fapServiceLists = bufferNotification();
for (FapServiceList fapService : fapServiceLists) {
- cluster = clusterModification.clustermod(cluster, fapService);
+ cluster = clusterUtils.modifyCluster(cluster, fapService);
}
String cellPciNeighbourString = cluster.getPciNeighbourJson();
UUID clusterId = cluster.getGraphId();
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java
new file mode 100644
index 0000000..d7ff57a
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
+import org.onap.dcaegen2.services.sonhms.model.CellConfig;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.model.Common;
+import org.onap.dcaegen2.services.sonhms.model.Configurations;
+import org.onap.dcaegen2.services.sonhms.model.Data;
+import org.onap.dcaegen2.services.sonhms.model.FapService;
+import org.onap.dcaegen2.services.sonhms.model.Lte;
+import org.onap.dcaegen2.services.sonhms.model.Payload;
+import org.onap.dcaegen2.services.sonhms.model.PolicyNotification;
+import org.onap.dcaegen2.services.sonhms.model.Ran;
+import org.onap.dcaegen2.services.sonhms.model.X0005b9Lte;
+import java.util.ArrayList;
+import java.util.List;
+import org.slf4j.Logger;
+
+public class ChildThreadUtils {
+
+ private static final Logger log = org.slf4j.LoggerFactory.getLogger(ChildThreadUtils.class);
+ ConfigPolicy configPolicy;
+
+ public ChildThreadUtils(ConfigPolicy configPolicy) {
+ this.configPolicy = configPolicy;
+ }
+
+
+ /**
+ * get policy notification string from oof result.
+ *
+ */
+ public String getNotificationString(String pnfName, List<CellPciPair> cellPciPairs, String requestId,
+ Long alarmStartTime) {
+ ArrayList<Configurations> 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);
+ }
+
+ String closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIG_POLICY_NAME");
+ PolicyNotification policyNotification = new PolicyNotification(closedLoopControlName,
+ requestId, alarmStartTime, pnfName);
+
+ 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;
+ }
+
+}
diff --git a/src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ClusterFormation.java
index 7b3d5bf..9a594a1 100644
--- a/src/main/java/com/wipro/www/sonhms/child/ClusterFormation.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ClusterFormation.java
@@ -1,31 +1,33 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
+import org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+import org.onap.dcaegen2.services.sonhms.utils.ClusterUtils;
import java.sql.Timestamp;
import java.util.ArrayList;
@@ -41,7 +43,7 @@ public class ClusterFormation {
private static final Logger log = org.slf4j.LoggerFactory.getLogger(ClusterFormation.class);
private BlockingQueue<FapServiceList> queue;
- private ClusterModification clusterModification;
+ private ClusterUtils clusterUtils;
private Detection detect;
Properties confProp;
ClusterDetails details = new ClusterDetails();
@@ -58,7 +60,7 @@ public class ClusterFormation {
super();
this.queue = queue;
this.detect = new Detection();
- this.clusterModification = new ClusterModification();
+ this.clusterUtils = new ClusterUtils();
}
/**
@@ -123,7 +125,7 @@ public class ClusterFormation {
if ((difference < (timer * 1000)) && (!queue.isEmpty())) {
newNotification = queue.poll();
- cluster = clusterModification.clustermod(cluster, newNotification);
+ cluster = clusterUtils.modifyCluster(cluster, newNotification);
// update cluster in DB
String cellPciNeighbourString = cluster.getPciNeighbourJson();
diff --git a/src/main/java/com/wipro/www/sonhms/child/Detection.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/Detection.java
index fc2e941..847e2d5 100644
--- a/src/main/java/com/wipro/www/sonhms/child/Detection.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/Detection.java
@@ -1,26 +1,27 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/src/main/java/com/wipro/www/sonhms/child/Graph.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/Graph.java
index 5e48dfc..eedbd94 100644
--- a/src/main/java/com/wipro/www/sonhms/child/Graph.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/Graph.java
@@ -1,29 +1,31 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.wipro.www.sonhms.model.CellNeighbourList;
-import com.wipro.www.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.model.CellNeighbourList;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
import java.io.IOException;
import java.util.ArrayList;
@@ -50,8 +52,7 @@ public class Graph {
/**
* Parameterized constructor.
*/
- @SuppressWarnings("unchecked")
- public Graph(String clusterInfo) {
+ public Graph(String clusterInfo) {
JSONArray cells = new JSONArray(clusterInfo);
Map<CellPciPair, ArrayList<CellPciPair>> cellMap = new HashMap<>();
@@ -61,7 +62,8 @@ public class Graph {
ObjectMapper mapper = new ObjectMapper();
ArrayList<CellPciPair> neighbours = new ArrayList<>();
try {
- neighbours = mapper.readValue(cell.getString("neighbours"), ArrayList.class);
+ neighbours = mapper.readValue(cell.getString("neighbours"),
+ new TypeReference<ArrayList<CellPciPair>>() { });
} catch (JSONException | IOException e) {
log.debug("Error parsing json: {}", e);
}
@@ -199,4 +201,42 @@ public class Graph {
return pciNeighbourJson;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cellPciNeighbourMap == null) ? 0 : cellPciNeighbourMap.hashCode());
+ result = prime * result + ((graphId == null) ? 0 : graphId.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Graph other = (Graph) obj;
+ if (cellPciNeighbourMap == null) {
+ if (other.cellPciNeighbourMap != null) {
+ return false;
+ }
+ } else if (!cellPciNeighbourMap.equals(other.cellPciNeighbourMap)) {
+ return false;
+ }
+ if (graphId == null) {
+ if (other.graphId != null) {
+ return false;
+ }
+ } else if (!graphId.equals(other.graphId)) {
+ return false;
+ }
+ return true;
+ }
+
}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/child/PnfUtils.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/PnfUtils.java
new file mode 100644
index 0000000..560fd52
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/PnfUtils.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import org.onap.dcaegen2.services.sonhms.dao.CellInfoRepository;
+import org.onap.dcaegen2.services.sonhms.entity.CellInfo;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.restclient.SdnrRestClient;
+import org.onap.dcaegen2.services.sonhms.restclient.Solution;
+import org.onap.dcaegen2.services.sonhms.restclient.SonSolution;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+
+
+public class PnfUtils {
+
+ /**
+ * get pnfs.
+ *
+ */
+ public Map<String, List<CellPciPair>> getPnfs(List<Solution> solutions) throws ConfigDbNotFoundException {
+
+ Map<String, List<CellPciPair>> pnfs = new HashMap<>();
+
+ for (Solution solution : solutions) {
+ List<SonSolution> 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> 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<CellPciPair> cellPciPairs = new ArrayList<>();
+ cellPciPairs.add(new CellPciPair(cellId, pci));
+ pnfs.put(pnfName, cellPciPairs);
+ }
+ }
+
+ }
+ return pnfs;
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/child/StateOof.java b/src/main/java/org/onap/dcaegen2/services/sonhms/child/StateOof.java
new file mode 100644
index 0000000..d731725
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/StateOof.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.child;
+
+import org.onap.dcaegen2.services.sonhms.ConfigPolicy;
+import org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.dao.SonRequestsRepository;
+import org.onap.dcaegen2.services.sonhms.dmaap.PolicyDmaapClient;
+import org.onap.dcaegen2.services.sonhms.entity.PciRequests;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.exceptions.OofNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.restclient.AsyncResponseBody;
+import org.onap.dcaegen2.services.sonhms.restclient.OofRestClient;
+import org.onap.dcaegen2.services.sonhms.restclient.Solution;
+import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+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<List<String>> childStatusUpdate;
+
+ public StateOof() {
+
+ }
+
+ /**
+ * Parameterized Constructor.
+ *
+ */
+ public StateOof(BlockingQueue<List<String>> childStatusUpdate) {
+ super();
+ this.childStatusUpdate = childStatusUpdate;
+ }
+
+ /**
+ * Triggers OOF.
+ * @throws OofNotFoundException when trigger oof fails
+ */
+ public void triggerOof(Map<String, ArrayList<Integer>> result,
+ String networkId) throws OofNotFoundException, InterruptedException {
+ // check for 0 collision and 0 confusion
+ ArrayList<String> cellidList = new ArrayList<>();
+ ArrayList<String> cellIds = new ArrayList<>();
+
+ for (Map.Entry<String, ArrayList<Integer>> entry : result.entrySet()) {
+ String key = entry.getKey();
+ ArrayList<Integer> arr;
+ arr = entry.getValue();
+ if (!arr.isEmpty()) {
+ Set<Integer> 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<String> optimizers = config.getOptimizers();
+
+ String oofResponse = OofRestClient.queryOof(numSolutions, transactionId.toString(), "create", cellidList,
+ networkId, optimizers);
+ log.debug("Synchronous Response {}", oofResponse);
+
+ List<String> 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)) {
+ Thread.sleep(100);
+ }
+
+ AsyncResponseBody asynResponseBody = ChildThread.getResponseMap().get(childThreadId);
+
+ try {
+ sendToPolicy(asynResponseBody);
+ } 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) throws ConfigDbNotFoundException {
+
+ if (log.isDebugEnabled()) {
+ log.debug(async.toString());
+ }
+
+ List<Solution> solutions;
+ solutions = async.getSolutions();
+
+ PnfUtils pnfUtils = new PnfUtils();
+ Map<String, List<CellPciPair>> pnfs = pnfUtils.getPnfs(solutions);
+
+ for (Map.Entry<String, List<CellPciPair>> entry : pnfs.entrySet()) {
+ String pnfName = entry.getKey();
+ List<CellPciPair> cellPciPairs = entry.getValue();
+
+ ChildThreadUtils childThreadUtils = new ChildThreadUtils(ConfigPolicy.getInstance());
+ String notification = childThreadUtils.getNotificationString(pnfName, cellPciPairs,
+ UUID.randomUUID().toString(), System.currentTimeMillis());
+ 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");
+ }
+
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/controller/HealthCheck.java b/src/main/java/org/onap/dcaegen2/services/sonhms/controller/HealthCheck.java
new file mode 100644
index 0000000..d0d9321
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/controller/HealthCheck.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.controller;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HealthCheck {
+ @RequestMapping(value = "/healthcheck", method = RequestMethod.GET)
+ ResponseEntity<HttpStatus> healthCheck() {
+ return new ResponseEntity(HttpStatus.OK);
+ }
+}
diff --git a/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/BufferedNotificationsRepository.java
index bdbdb6e..43bb1f3 100644
--- a/src/main/java/com/wipro/www/sonhms/dao/BufferedNotificationsRepository.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/BufferedNotificationsRepository.java
@@ -1,26 +1,27 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dao;
+
+import org.onap.dcaegen2.services.sonhms.entity.BufferedNotifications;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/dao/CellInfoRepository.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/CellInfoRepository.java
new file mode 100644
index 0000000..80066ad
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/CellInfoRepository.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dao;
+
+import org.onap.dcaegen2.services.sonhms.entity.CellInfo;
+
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.stereotype.Repository;
+
+
+@Repository
+public interface CellInfoRepository extends CrudRepository<CellInfo, String> {
+
+ // public void
+
+}
diff --git a/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/ClusterDetailsRepository.java
index a833fbf..babef00 100644
--- a/src/main/java/com/wipro/www/sonhms/dao/ClusterDetailsRepository.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/ClusterDetailsRepository.java
@@ -1,26 +1,27 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dao;
+
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/dao/DmaapNotificationsRepository.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/DmaapNotificationsRepository.java
new file mode 100644
index 0000000..356dca6
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/DmaapNotificationsRepository.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dao;
+
+import org.onap.dcaegen2.services.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<DmaapNotifications, String> {
+
+ @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/org/onap/dcaegen2/services/sonhms/dao/SonRequestsRepository.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/SonRequestsRepository.java
new file mode 100644
index 0000000..b54661b
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dao/SonRequestsRepository.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dao;
+
+import org.onap.dcaegen2.services.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<PciRequests, String> {
+
+ @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/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClient.java
index 051b00e..002f835 100644
--- a/src/main/java/com/wipro/www/sonhms/dmaap/DmaapClient.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/DmaapClient.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dmaap;
import com.att.nsa.apiClient.http.HttpException;
import com.att.nsa.cambria.client.CambriaClient;
@@ -27,12 +28,11 @@ 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 org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.NewNotification;
+import org.onap.dcaegen2.services.sonhms.Topic;
+import org.onap.dcaegen2.services.sonhms.dao.DmaapNotificationsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.DmaapNotifications;
import java.io.IOException;
import java.net.MalformedURLException;
diff --git a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationConsumer.java
index 1bdbac2..ba6b83d 100644
--- a/src/main/java/com/wipro/www/sonhms/dmaap/NotificationConsumer.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationConsumer.java
@@ -1,27 +1,28 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dmaap;
import com.att.nsa.cambria.client.CambriaConsumer;
-import com.wipro.www.sonhms.dmaap.DmaapClient.NotificationCallback;
+import org.onap.dcaegen2.services.sonhms.dmaap.DmaapClient.NotificationCallback;
import java.io.IOException;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducer.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducer.java
new file mode 100644
index 0000000..e1db372
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/NotificationProducer.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dmaap;
+
+import com.att.nsa.cambria.client.CambriaBatchingPublisher;
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+public class NotificationProducer {
+
+ private CambriaBatchingPublisher cambriaBatchingPublisher;
+
+
+ /**
+ * Parameterised constructor.
+ */
+ public NotificationProducer(CambriaBatchingPublisher cambriaBatchingPublisher) {
+ super();
+ this.cambriaBatchingPublisher = cambriaBatchingPublisher;
+ }
+
+ /**
+ * sends notification to dmaap.
+ */
+ public int sendNotification(String msg) throws GeneralSecurityException, IOException {
+
+ int result = cambriaBatchingPublisher.send("", msg);
+ System.out.println(result);
+ return result;
+
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/PolicyDmaapClient.java b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/PolicyDmaapClient.java
new file mode 100644
index 0000000..4d5d23b
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/dmaap/PolicyDmaapClient.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.dmaap;
+
+import com.att.nsa.cambria.client.CambriaBatchingPublisher;
+import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
+import org.onap.dcaegen2.services.sonhms.Configuration;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+
+public class PolicyDmaapClient {
+
+
+ /**
+ * Method stub for sending notification to policy.
+ */
+ public boolean sendNotificationToPolicy(String msg) {
+
+ Configuration configuration = Configuration.getInstance();
+ CambriaBatchingPublisher cambriaBatchingPublisher;
+ try {
+ cambriaBatchingPublisher = new PublisherBuilder().usingHosts(configuration.getServers())
+ .onTopic(configuration.getPolicyTopic())
+ .authenticatedBy(configuration.getPcimsApiKey(), configuration.getPcimsSecretKey()).build();
+ NotificationProducer notificationProducer = new NotificationProducer(cambriaBatchingPublisher);
+ notificationProducer.sendNotification(msg);
+ } catch (GeneralSecurityException | IOException e) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotifications.java
index 9ac10aa..34cce77 100644
--- a/src/main/java/com/wipro/www/sonhms/entity/BufferedNotifications.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/BufferedNotifications.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.entity;
import java.sql.Timestamp;
diff --git a/src/main/java/com/wipro/www/sonhms/entity/CellInfo.java b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/CellInfo.java
index e2bb326..0c546d6 100644
--- a/src/main/java/com/wipro/www/sonhms/entity/CellInfo.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/CellInfo.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
diff --git a/src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/ClusterDetails.java
index 59868eb..37dc5bd 100644
--- a/src/main/java/com/wipro/www/sonhms/entity/ClusterDetails.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/ClusterDetails.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -77,4 +78,10 @@ public class ClusterDetails {
this.clusterInfo = clusterInfo;
}
+ @Override
+ public String toString() {
+ return "ClusterDetails [clusterId=" + clusterId + ", clusterInfo=" + clusterInfo + ", childThreadId="
+ + childThreadId + "]";
+ }
+
}
diff --git a/src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotifications.java
index 925a9e6..2e30efc 100644
--- a/src/main/java/com/wipro/www/sonhms/entity/DmaapNotifications.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/DmaapNotifications.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.entity;
import java.sql.Timestamp;
diff --git a/src/main/java/com/wipro/www/sonhms/entity/PciRequests.java b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/PciRequests.java
index cce914d..79120ee 100644
--- a/src/main/java/com/wipro/www/sonhms/entity/PciRequests.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/entity/PciRequests.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/ConfigDbNotFoundException.java b/src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/ConfigDbNotFoundException.java
new file mode 100644
index 0000000..e1f040b
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/ConfigDbNotFoundException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/exceptions/OofNotFoundException.java b/src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/OofNotFoundException.java
new file mode 100644
index 0000000..0bbeff3
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/exceptions/OofNotFoundException.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/CellConfig.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/CellConfig.java
new file mode 100644
index 0000000..1f4f62e
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/CellConfig.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/CellNeighbourList.java
index 5bbff6d..18fdac4 100644
--- a/src/main/java/com/wipro/www/sonhms/model/CellNeighbourList.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/CellNeighbourList.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.model;
public class CellNeighbourList {
diff --git a/src/main/java/com/wipro/www/sonhms/model/CellPciPair.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/CellPciPair.java
index fb4c91a..866c51e 100644
--- a/src/main/java/com/wipro/www/sonhms/model/CellPciPair.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/CellPciPair.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Common.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Common.java
new file mode 100644
index 0000000..8a54f76
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Common.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/Configurations.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Configurations.java
new file mode 100644
index 0000000..e043aaf
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Configurations.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/Data.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Data.java
new file mode 100644
index 0000000..43b6204
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Data.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/FapService.java
index c949922..90b6f23 100644
--- a/src/main/java/com/wipro/www/sonhms/model/FapService.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/FapService.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/wipro/www/sonhms/model/FapServiceList.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/FapServiceList.java
index 96cde4c..1e38927 100644
--- a/src/main/java/com/wipro/www/sonhms/model/FapServiceList.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/FapServiceList.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Lte.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Lte.java
new file mode 100644
index 0000000..4ba5537
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Lte.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/LteNeighborListInUseLteCell.java
index fe85d47..961e5f0 100644
--- a/src/main/java/com/wipro/www/sonhms/model/LteNeighborListInUseLteCell.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/LteNeighborListInUseLteCell.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NeighborListInUse.java
index d240a88..50df1d8 100644
--- a/src/main/java/com/wipro/www/sonhms/model/NeighborListInUse.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NeighborListInUse.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
diff --git a/src/main/java/com/wipro/www/sonhms/model/Notification.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Notification.java
index 417e443..f74896a 100644
--- a/src/main/java/com/wipro/www/sonhms/model/Notification.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Notification.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -109,4 +110,11 @@ public class Notification {
this.version = version;
}
+ @Override
+ public String toString() {
+ return "Notification [requestId=" + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version
+ + ", action=" + action + ", payload=" + payload + "]";
+ }
+
+
}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationCellConfig.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationCellConfig.java
new file mode 100644
index 0000000..aa771fe
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationCellConfig.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/NotificationLte.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationLte.java
new file mode 100644
index 0000000..584db11
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationLte.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/NotificationPayload.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayload.java
new file mode 100644
index 0000000..9fed1e7
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationPayload.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/NotificationRan.java
index cc0e085..6215ebb 100644
--- a/src/main/java/com/wipro/www/sonhms/model/NotificationRan.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/NotificationRan.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Payload.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Payload.java
new file mode 100644
index 0000000..dd10a1f
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Payload.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+public class Payload {
+
+ @JsonProperty("Configurations")
+ private List<Configurations> configuration;
+
+ public Payload() {
+
+ }
+
+ public Payload(List<Configurations> configuration) {
+ super();
+ this.configuration = configuration;
+ }
+
+ public List<Configurations> getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(List<Configurations> 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/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java
index e367b0b..076c7b5 100644
--- a/src/main/java/com/wipro/www/sonhms/model/PolicyNotification.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java
@@ -1,30 +1,30 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashMap;
import java.util.Map;
-import java.util.UUID;
public class PolicyNotification {
@@ -55,10 +55,19 @@ public class PolicyNotification {
* constructor.
*/
public PolicyNotification() {
- this.requestId = UUID.randomUUID().toString();
+
+ }
+
+ /**
+ * Constructor.
+ *
+ */
+ public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName) {
+ this.closedLoopControlName = closedLoopControlName;
+ this.requestId = requestId;
this.closedLoopEventClient = "microservice.PCI";
this.closedLoopEventStatus = "ONSET";
- this.closedLoopAlarmStart = System.currentTimeMillis();
+ this.closedLoopAlarmStart = alarmStartTime;
this.from = "PCIMS";
this.version = "1.0.2";
this.action = "ModifyConfig";
@@ -67,8 +76,7 @@ public class PolicyNotification {
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");
-
+ aai.put("generic-vnf.vnf-id", pnfName);
}
public long getClosedLoopAlarmStart() {
@@ -176,4 +184,23 @@ public class PolicyNotification {
+ ", payload=" + payload + "]";
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((aai == null) ? 0 : aai.hashCode());
+ result = prime * result + ((action == null) ? 0 : action.hashCode());
+ result = prime * result + (int) (closedLoopAlarmStart ^ (closedLoopAlarmStart >>> 32));
+ result = prime * result + ((closedLoopControlName == null) ? 0 : closedLoopControlName.hashCode());
+ result = prime * result + ((closedLoopEventClient == null) ? 0 : closedLoopEventClient.hashCode());
+ result = prime * result + ((closedLoopEventStatus == null) ? 0 : closedLoopEventStatus.hashCode());
+ result = prime * result + ((from == null) ? 0 : from.hashCode());
+ result = prime * result + ((payload == null) ? 0 : payload.hashCode());
+ result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
+ result = prime * result + ((target == null) ? 0 : target.hashCode());
+ result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
+ result = prime * result + ((version == null) ? 0 : version.hashCode());
+ return result;
+ }
+
}
diff --git a/src/main/java/com/wipro/www/sonhms/model/RadioAccess.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/RadioAccess.java
index cc1ee4a..775c14d 100644
--- a/src/main/java/com/wipro/www/sonhms/model/RadioAccess.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/RadioAccess.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Ran.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Ran.java
new file mode 100644
index 0000000..f2be944
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Ran.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/Response.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Response.java
new file mode 100644
index 0000000..46237db
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Response.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/SdnrResponse.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponse.java
new file mode 100644
index 0000000..7fb73b7
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/SdnrResponse.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
+
+import java.util.List;
+
+public class SdnrResponse {
+
+ private List<Response> response;
+
+ public List<Response> getResponse() {
+ return response;
+ }
+
+ public void setResponse(List<Response> response) {
+ this.response = response;
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/ThreadId.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ThreadId.java
new file mode 100644
index 0000000..37d741d
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ThreadId.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/model/X0005b9Lte.java
index cb52715..d6dc61e 100644
--- a/src/main/java/com/wipro/www/sonhms/model/X0005b9Lte.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/X0005b9Lte.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBody.java
index 94e6919..61e0421 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/AsyncResponseBody.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/AsyncResponseBody.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.restclient;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfo.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfo.java
new file mode 100644
index 0000000..edac16f
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CellInfo.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.restclient;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CellInfo {
+ String networkId = null;
+ List<String> cellIdList = new ArrayList<>();
+
+ public String getNetworkId() {
+ return networkId;
+ }
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public List<String> getCellIdList() {
+ return cellIdList;
+ }
+
+ public void setCellIdList(List<String> cellIdList) {
+ this.cellIdList = cellIdList;
+ }
+
+
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBody.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBody.java
new file mode 100644
index 0000000..2e5eeaa
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRequestBody.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/restclient/OofRestClient.java
index 7b95d90..a9ce305 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/OofRestClient.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/OofRestClient.java
@@ -1,36 +1,39 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.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 org.onap.dcaegen2.services.sonhms.ConfigPolicy;
+import org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.exceptions.OofNotFoundException;
+import org.onap.dcaegen2.services.sonhms.utils.SonHandlerRestTemplate;
import java.util.List;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.ResponseEntity;
public class OofRestClient {
private static Logger log = LoggerFactory.getLogger(OofRestClient.class);
@@ -48,7 +51,7 @@ public class OofRestClient {
List<String> cellIdList, String networkId, List<String> optimizers) throws OofNotFoundException {
log.debug("inside queryoof");
- String response = "";
+ ResponseEntity<String> response = null;
Configuration configuration = Configuration.getInstance();
try {
UUID requestUuid = UUID.randomUUID();
@@ -85,17 +88,17 @@ public class OofRestClient {
String requestUrl = configuration.getOofService() + "/api/oof/v1/pci";
log.debug("requestUrl {}", requestUrl);
- response = HttpRequester.sendPostRequestToOof(requestUrl, requestBody);
+ response = SonHandlerRestTemplate.sendPostRequestToOof(requestUrl, requestBody,new ParameterizedTypeReference<String>() {});
if (response == null) {
throw new OofNotFoundException("Request to oof failed");
}
log.debug("response {}", response);
- return response;
+ return response.getBody();
} catch (JsonProcessingException e) {
log.debug("exception{}", e);
}
- return response;
+ return response.getBody();
}
}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBody.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBody.java
new file mode 100644
index 0000000..a7c9f08
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRequestBody.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClient.java
index 7c286af..7334df2 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/PolicyRestClient.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/PolicyRestClient.java
@@ -1,33 +1,36 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.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 org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.utils.SonHandlerRestTemplate;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.ResponseEntity;
public class PolicyRestClient {
private static Logger log = LoggerFactory.getLogger(PolicyRestClient.class);
@@ -43,7 +46,7 @@ public class PolicyRestClient {
log.debug("inside fetconfig from policy");
Configuration configuration = Configuration.getInstance();
- String response = "";
+ ResponseEntity<String> response = null;
String configName = configuration.getConfigName();
String policyName = configuration.getPolicyName();
@@ -60,14 +63,14 @@ public class PolicyRestClient {
log.debug("policyRequestBody{}", requestBody);
String requestUrl = configuration.getPolicyService() + "/pdp/api/getConfig";
- response = HttpRequester.sendPostToPolicy(requestUrl, requestBody);
+ response = SonHandlerRestTemplate.sendPostToPolicy(requestUrl, requestBody,new ParameterizedTypeReference<String>() {});
log.debug("policy response{}", response);
- return response;
+ return response.getBody();
} catch (JsonProcessingException e) {
log.debug("exception", e);
}
- return response;
+ return response.getBody();
}
diff --git a/src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfo.java
index 6dcbf63..ff53b33 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/RequestInfo.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/RequestInfo.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.restclient;
import java.util.List;
diff --git a/src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java
index c37791f..0894146 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/SdnrRestClient.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SdnrRestClient.java
@@ -1,29 +1,30 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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;
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.restclient;
+
+import org.onap.dcaegen2.services.sonhms.Configuration;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.utils.SonHandlerRestTemplate;
import java.sql.Time;
import java.text.SimpleDateFormat;
@@ -34,6 +35,8 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.ResponseEntity;
@@ -55,7 +58,7 @@ public class SdnrRestClient {
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 + "/"
+ String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getCellList" + "/" + networkId + "/"
+ encode(ts);
return sendRequest(requestUrl);
}
@@ -110,7 +113,7 @@ public class SdnrRestClient {
Configuration configuration = Configuration.getInstance();
String ts = new SimpleDateFormat(DATETIMEFORMAT).format(new Time(System.currentTimeMillis()));
String requestUrl = configuration.getSdnrService() + "/SDNCConfigDBAPI/getPnfName" + "/" + cellId + "/"
- + encode(ts);
+ + encode(ts);
String response = sendRequest(requestUrl);
JSONObject responseObject = new JSONObject(response);
return responseObject.getString("value");
@@ -127,11 +130,12 @@ public class SdnrRestClient {
* Method to send request.
*/
private static String sendRequest(String url) throws ConfigDbNotFoundException {
- String response = HttpRequester.sendGetRequest(url);
- if (response.equals("")) {
+ ResponseEntity<String> response = SonHandlerRestTemplate.sendGetRequest(url,
+ new ParameterizedTypeReference<String>() {});
+ if (response.equals(null)) {
throw new ConfigDbNotFoundException("Cannot reach Config DB");
}
- return response;
+ return response.getBody();
}
}
diff --git a/src/main/java/com/wipro/www/sonhms/restclient/Solution.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/Solution.java
index 765501a..66af930 100644
--- a/src/main/java/com/wipro/www/sonhms/restclient/Solution.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/Solution.java
@@ -1,24 +1,25 @@
/*******************************************************************************
- * ============LICENSE_START=======================================================
- * pcims
+ * ============LICENSE_START=======================================================
+ * son-handler
* ================================================================================
- * 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=========================================================
- ******************************************************************************/
+ * Copyright (C) 2019 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;
+package org.onap.dcaegen2.services.sonhms.restclient;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SonSolution.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SonSolution.java
new file mode 100644
index 0000000..25f474a
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/SonSolution.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/utils/AppConfig.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/AppConfig.java
new file mode 100644
index 0000000..a30288a
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/AppConfig.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+
+package org.onap.dcaegen2.services.sonhms.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.http.conn.ssl.NoopHostnameVerifier;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.http.converter.ByteArrayHttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class AppConfig {
+
+
+ /**
+ * Rest Template bean.
+ */
+ @Bean
+ public static RestTemplate initRestTemplateForPdfAsByteArrayAndSelfSignedHttps() {
+ RestTemplate restTemplate = new RestTemplate(useApacheHttpClientWithSelfSignedSupport());
+ restTemplate.getMessageConverters().add(generateByteArrayHttpMessageConverter());
+ return restTemplate;
+ }
+
+ private static HttpComponentsClientHttpRequestFactory useApacheHttpClientWithSelfSignedSupport() {
+ CloseableHttpClient httpClient = HttpClients.custom().setSSLHostnameVerifier(new NoopHostnameVerifier())
+ .build();
+ HttpComponentsClientHttpRequestFactory useApacheHttpClient = new HttpComponentsClientHttpRequestFactory();
+ useApacheHttpClient.setHttpClient(httpClient);
+ return useApacheHttpClient;
+ }
+
+ private static ByteArrayHttpMessageConverter generateByteArrayHttpMessageConverter() {
+ ByteArrayHttpMessageConverter byteArrayHttpMessageConverter = new ByteArrayHttpMessageConverter();
+
+ List<MediaType> supportedApplicationTypes = new ArrayList<MediaType>();
+ supportedApplicationTypes.add(new MediaType("application", "pdf"));
+ byteArrayHttpMessageConverter.setSupportedMediaTypes(supportedApplicationTypes);
+ return byteArrayHttpMessageConverter;
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/utils/BeanUtil.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/BeanUtil.java
new file mode 100644
index 0000000..63a738c
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/BeanUtil.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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> T getBean(Class<T> beanClass) {
+ return context.getBean(beanClass);
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtils.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtils.java
new file mode 100644
index 0000000..79d0c61
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ClusterUtils.java
@@ -0,0 +1,344 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.utils;
+
+import org.onap.dcaegen2.services.sonhms.ClusterDetailsComponent;
+import org.onap.dcaegen2.services.sonhms.NotificationToClusterMapping;
+import org.onap.dcaegen2.services.sonhms.child.Graph;
+import org.onap.dcaegen2.services.sonhms.dao.ClusterDetailsRepository;
+import org.onap.dcaegen2.services.sonhms.entity.ClusterDetails;
+import org.onap.dcaegen2.services.sonhms.exceptions.ConfigDbNotFoundException;
+import org.onap.dcaegen2.services.sonhms.model.CellPciPair;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.model.LteNeighborListInUseLteCell;
+import org.onap.dcaegen2.services.sonhms.model.Notification;
+import org.onap.dcaegen2.services.sonhms.restclient.SdnrRestClient;
+
+import fj.data.Either;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+public class ClusterUtils {
+
+ private static Logger log = LoggerFactory.getLogger(ClusterUtils.class);
+
+ public List<ClusterDetails> getAllClusters() {
+ ClusterDetailsComponent clusterDetailsComponent = new ClusterDetailsComponent();
+ return clusterDetailsComponent.getClusterDetails();
+ }
+
+ /**
+ * Get clusters for notifications.
+ */
+ public NotificationToClusterMapping getClustersForNotification(Notification notification,
+ List<ClusterDetails> clusterDetails) {
+
+ NotificationToClusterMapping mapping = new NotificationToClusterMapping();
+
+ Map<FapServiceList, String> cellsInCluster = new HashMap<>();
+ List<FapServiceList> newCells = new ArrayList<>();
+
+ List<FapServiceList> fapServiceList = notification.getPayload().getRadioAccess().getFapServiceList();
+
+ for (FapServiceList fapService : fapServiceList) {
+
+ for (ClusterDetails clusterDetail : clusterDetails) {
+
+ Set<String> cellsInNotification = getCellsInNotification(fapService);
+
+ Graph cluster = new Graph(clusterDetail.getClusterInfo());
+
+ Set<String> clusterCells = getCellsInCluster(cluster);
+
+ log.debug("cells in cluster {}", clusterCells);
+
+ cellsInNotification.retainAll(clusterCells);
+
+ if (!cellsInNotification.isEmpty()) {
+ log.debug("cell or it's neighbour in the cluster");
+ cellsInCluster.put(fapService, clusterDetail.getClusterId());
+ break;
+ }
+ }
+
+ if (!cellsInCluster.containsKey(fapService)) {
+ newCells.add(fapService);
+ }
+ }
+
+ mapping.setCellsinCluster(cellsInCluster);
+ mapping.setNewCells(newCells);
+ return mapping;
+ }
+
+ /**
+ * Get cluster details from cluster ID.
+ */
+ public Either<ClusterDetails, Integer> getClusterDetailsFromClusterId(String clusterId,
+ List<ClusterDetails> clusterDetails) {
+
+ for (ClusterDetails clusterDetail : clusterDetails) {
+ if (clusterDetail.getClusterId().equals(clusterId)) {
+ return Either.left(clusterDetail);
+ }
+ }
+ return Either.right(404);
+ }
+
+ /**
+ * Get clusters for Cell.
+ */
+ public Either<Graph, Integer> getClusterForCell(FapServiceList fapService, List<Graph> newClusters) {
+
+ if (newClusters.isEmpty()) {
+ return Either.right(404);
+ }
+
+
+ for (Graph cluster : newClusters) {
+
+ Set<String> cellsInNotification = getCellsInNotification(fapService);
+ Set<String> clusterCells = getCellsInCluster(cluster);
+
+ cellsInNotification.retainAll(clusterCells);
+
+ if (!(cellsInNotification.isEmpty())) {
+ return Either.left(cluster);
+ }
+
+ }
+
+ return Either.right(404);
+ }
+
+ private Set<String> getCellsInNotification(FapServiceList fapService) {
+ Set<String> cellsInNotification = new HashSet<>();
+ cellsInNotification.add(fapService.getAlias());
+ List<LteNeighborListInUseLteCell> nbrList = fapService.getCellConfig().getLte().getRan().getNeighborListInUse()
+ .getLteNeighborListInUseLteCell();
+ for (LteNeighborListInUseLteCell nbr : nbrList) {
+ cellsInNotification.add(nbr.getAlias());
+ }
+
+ return cellsInNotification;
+ }
+
+ private Set<String> getCellsInCluster(Graph cluster) {
+ Map<CellPciPair, ArrayList<CellPciPair>> cellPciNeighbourMap = cluster.getCellPciNeighbourMap();
+ log.debug("cell_pci_map {}", cellPciNeighbourMap);
+ Set<CellPciPair> keys = cellPciNeighbourMap.keySet();
+ Set<String> clusterCells = new HashSet<>();
+ for (CellPciPair cellPciPair : keys) {
+ log.debug("cells {}", cellPciPair.getCellId());
+ clusterCells.add(cellPciPair.getCellId());
+ }
+
+ return clusterCells;
+ }
+
+ /**
+ * Create cluster from notification.
+ */
+ public 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();
+
+ CellPciPair val = new CellPciPair();
+ val.setCellId(cellId);
+ val.setPhysicalCellId(phycellId);
+ List<LteNeighborListInUseLteCell> 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();
+
+ 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<CellPciPair> 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;
+ }
+
+ /**
+ * Save cluster.
+ */
+ public 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();
+ }
+
+ /**
+ * update cluster.
+ */
+ public Graph modifyCluster(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<LteNeighborListInUseLteCell> newNeighbourList;
+ newNeighbourList = fapser.getCellConfig().getLte().getRan().getNeighborListInUse()
+ .getLteNeighborListInUseLteCell();
+
+ Map<CellPciPair, ArrayList<CellPciPair>> clusterMap;
+ clusterMap = cluster.getCellPciNeighbourMap();
+
+ // coe
+
+ List<CellPciPair> tempCellPair = new ArrayList<>();
+ for (Map.Entry<CellPciPair, ArrayList<CellPciPair>> 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<CellPciPair> 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;
+ }
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/utils/FileIo.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/FileIo.java
new file mode 100644
index 0000000..7eaafbe
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/FileIo.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.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/org/onap/dcaegen2/services/sonhms/utils/SonHandlerRestTemplate.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/SonHandlerRestTemplate.java
new file mode 100644
index 0000000..7745117
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/SonHandlerRestTemplate.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2019 Wipro Limited.
+ * ==============================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ *
+ *******************************************************************************/
+
+package org.onap.dcaegen2.services.sonhms.utils;
+
+import java.util.Collections;
+
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+@Component
+public class SonHandlerRestTemplate {
+ @Autowired
+ static RestTemplate restTemplate;
+
+ private static final String AUTH = "Authorization";
+ private static final String EXCEPTION_MSG = "Exception caught during request {}";
+ private static final Logger log = org.slf4j.LoggerFactory.getLogger(SonHandlerRestTemplate.class);
+
+ private SonHandlerRestTemplate() {
+
+ }
+
+ /**
+ * Send Post Request.
+ */
+
+ public static <T> ResponseEntity<T> sendPostRequest(String requestUrl, String requestBody,
+ ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+ /**
+ * Send Post Request to policy.
+ */
+ public static <T> ResponseEntity<T> sendPostToPolicy(String requestUrl, String requestBody,
+ ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add("ClientAuth", "cHl0aG9uOnRlc3Q=");
+ headers.add(AUTH, "Basic dGVzdHBkcDphbHBoYTEyMw== ");
+ headers.add("Environment", "TEST");
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+ /**
+ * Send Get Request.
+ */
+
+ public static <T> ResponseEntity<T> sendGetRequest(String requestUrl, ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.GET, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+ /**
+ * Send Get Request to SDNR.
+ */
+
+ public static <T> ResponseEntity<T> sendGetRequest(String requestUrl, String requestBody,
+ ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.TEXT_PLAIN));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add(AUTH, "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==");
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+ /**
+ * Send Post Request1.
+ */
+
+ public static <T> ResponseEntity<T> sendPostRequest1(String requestUrl, String requestBody,
+ ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add(AUTH, "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==");
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+ /**
+ * Send Post Request to oof.
+ */
+
+ public static <T> ResponseEntity<T> sendPostRequestToOof(String requestUrl, String requestBody,
+ ParameterizedTypeReference<T> responseType) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ headers.add(AUTH, "Basic cGNpX3Rlc3Q6cGNpX3Rlc3Rwd2Q=");
+ HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
+ try {
+ return restTemplate.exchange(requestUrl, HttpMethod.POST, requestEntity, responseType);
+ } catch (Exception e) {
+ log.debug(EXCEPTION_MSG, e.getMessage());
+ return new ResponseEntity<>(HttpStatus.NOT_FOUND);
+ }
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ThreadUtils.java b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ThreadUtils.java
new file mode 100644
index 0000000..07e7219
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/utils/ThreadUtils.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * ============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 org.onap.dcaegen2.services.sonhms.utils;
+
+import org.onap.dcaegen2.services.sonhms.EventHandler;
+import org.onap.dcaegen2.services.sonhms.child.ChildThread;
+import org.onap.dcaegen2.services.sonhms.child.Graph;
+import org.onap.dcaegen2.services.sonhms.model.FapServiceList;
+import org.onap.dcaegen2.services.sonhms.model.ThreadId;
+
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+
+public class ThreadUtils {
+
+ private static Logger log = LoggerFactory.getLogger(ThreadUtils.class);
+
+ /**
+ * Create thread.
+ */
+ public Boolean createNewThread(List<Graph> newClusters, BlockingQueue<List<String>> childStatusQueue,
+ ExecutorService pool, EventHandler eventHandler) {
+ for (Graph cluster : newClusters) {
+
+ BlockingQueue<FapServiceList> queue = new LinkedBlockingQueue<>();
+ ThreadId threadId = new ThreadId();
+ threadId.setChildThreadId(0);
+ ChildThread child = new ChildThread(childStatusQueue, cluster, queue, threadId);
+ pool.execute(child);
+ waitForThreadId(threadId);
+ UUID clusterId = UUID.randomUUID();
+
+ ClusterUtils clusterUtils = new ClusterUtils();
+ clusterUtils.saveCluster(cluster, clusterId, threadId.getChildThreadId());
+ EventHandler.addChildThreadMap(threadId.getChildThreadId(), child);
+ eventHandler.addChildStatus(threadId.getChildThreadId(), "processingNotifications");
+ }
+ return true;
+
+ }
+
+ private void waitForThreadId(ThreadId threadId) {
+
+ ThreadId thread = threadId;
+ try {
+ synchronized (thread) {
+ while (thread.getChildThreadId() == 0) {
+ thread.wait();
+ }
+ }
+ } catch (InterruptedException e) {
+
+ log.error("ChildThread queue error {}", e);
+ Thread.currentThread().interrupt();
+ }
+ }
+
+}