aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/config/sonhms/config_all.json4
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java13
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java105
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java24
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java115
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Action.java32
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java94
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java89
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java12
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/ConfigInterface.java6
-rw-r--r--src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java20
11 files changed, 414 insertions, 100 deletions
diff --git a/src/main/docker/config/sonhms/config_all.json b/src/main/docker/config/sonhms/config_all.json
index b6cb345..aae0704 100644
--- a/src/main/docker/config/sonhms/config_all.json
+++ b/src/main/docker/config/sonhms/config_all.json
@@ -117,8 +117,8 @@
"PCI_SDNR_TARGET_NAME": "SDNR",
"PCI_OPTMIZATION_ALGO_CATEGORY_IN_OOF": "OOF-PCI-OPTIMIZATION",
"PCI_NEIGHBOR_CHANGE_CLUSTER_TIMEOUT_IN_SECS": 60,
- "PCI_MODCONFIGANR_POLICY_NAME": "ControlLoop-vSONH-7d4baf04-8875-4d1f-946d-06b874048b61",
- "PCI_MODCONFIG_POLICY_NAME": "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459"
+ "PCI_MODCONFIGANR_POLICY_NAME": "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61",
+ "PCI_MODCONFIG_POLICY_NAME": "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459"
},
"type_version": "1.0.0",
"version": "1.0.0",
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java
index 1824e92..ce8e016 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/Configuration.java
@@ -52,6 +52,7 @@ public class Configuration {
private String getNbrListUrl;
private String getPciUrl;
private String getPnfUrl;
+ private String getRicIdUrl;
private String oofService;
private String oofEndpoint;
private String cg;
@@ -404,7 +405,7 @@ public class Configuration {
public void setPolicyFixedPciTimeInterval(long policyFixedPciTimeInterval) {
this.policyFixedPciTimeInterval = policyFixedPciTimeInterval;
}
-
+
public String getNfNamingCode() {
return nfNamingCode;
}
@@ -461,6 +462,14 @@ public class Configuration {
this.getPnfUrl = getPnfUrl;
}
+ public void setGetRicIdUrl(String getRicIdUrl) {
+ this.getRicIdUrl = getRicIdUrl;
+ }
+
+ public String getGetRicIdUrl() {
+ return getRicIdUrl;
+ }
+
public static void setInstance(Configuration instance) {
Configuration.instance = instance;
}
@@ -470,7 +479,7 @@ public class Configuration {
return "Configuration [pgHost=" + pgHost + ", pgPort=" + pgPort + ", pgUsername=" + pgUsername + ", pgPassword="
+ pgPassword + ", dmaapServers=" + dmaapServers + ", configDbService=" + configDbService
+ ", cpsServiceUrl=" + cpsServiceUrl + ", CpsUsername=" + CpsUsername + ",CpsPassword=" + CpsPassword + ",ConfigClientType=" + ConfigClientType + ", getCellDataUrl=" + getCellDataUrl + ", getNbrListUrl="
- + getNbrListUrl + ", getPciUrl=" + getPciUrl + ", getPnfUrl=" + getPnfUrl + ", oofService=" + oofService + ", oofEndpoint=" + oofEndpoint + ", cg=" + cg + ", cid=" + cid
+ + getNbrListUrl + ", getPciUrl=" + getPciUrl + ", getPnfUrl=" + getPnfUrl + ", getRicIdUrl=" + getRicIdUrl + ",oofService=" + oofService + ", oofEndpoint=" + oofEndpoint + ", cg=" + cg + ", cid=" + cid
+ ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", minCollision="
+ minCollision + ", minConfusion=" + minConfusion + ", sourceId=" + sourceId + ", callbackUrl="
+ callbackUrl + ", pciOptimizer=" + pciOptimizer + ", pciAnrOptimizer=" + pciAnrOptimizer
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java b/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java
index 5b7a58f..a1127fe 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/PmNotificationHandler.java
@@ -2,21 +2,21 @@
* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2019 Wipro Limited.
+ * Copyright (C) 2019-2022 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
- *
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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;
@@ -38,6 +38,7 @@ import org.onap.dcaegen2.services.sonhms.dao.HandOverMetricsRepository;
import org.onap.dcaegen2.services.sonhms.dmaap.PolicyDmaapClient;
import org.onap.dcaegen2.services.sonhms.entity.HandOverMetrics;
import org.onap.dcaegen2.services.sonhms.model.AdditionalMeasurements;
+import org.onap.dcaegen2.services.sonhms.model.ANRPayload;
import org.onap.dcaegen2.services.sonhms.model.CellConfig;
import org.onap.dcaegen2.services.sonhms.model.Common;
import org.onap.dcaegen2.services.sonhms.model.Configurations;
@@ -48,11 +49,15 @@ import org.onap.dcaegen2.services.sonhms.model.HoDetails;
import org.onap.dcaegen2.services.sonhms.model.Lte;
import org.onap.dcaegen2.services.sonhms.model.LteCell;
import org.onap.dcaegen2.services.sonhms.model.NeighborListInUse;
+import org.onap.dcaegen2.services.sonhms.model.Neighbours;
import org.onap.dcaegen2.services.sonhms.model.Payload;
import org.onap.dcaegen2.services.sonhms.model.PmNotification;
+import org.onap.dcaegen2.services.sonhms.model.PolicyData;
import org.onap.dcaegen2.services.sonhms.model.Ran;
import org.onap.dcaegen2.services.sonhms.utils.BeanUtil;
import org.onap.dcaegen2.services.sonhms.utils.DmaapUtils;
+import org.onap.dcaegen2.services.sonhms.restclient.ConfigurationClient;
+import org.onap.dcaegen2.services.sonhms.restclient.CpsClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +83,7 @@ public class PmNotificationHandler {
Boolean newEntryFlag = false;
try {
List<HoDetails> hoDetailsList = new ArrayList<>();
- List<LteCell> lteCellList = new ArrayList<>();
+ List<Neighbours> neighbourList = new ArrayList<>();
String srcCellId = pmNotification.getEvent().getCommonEventHeader().getSourceName();
/*
* check whether entry already exists if yes : read the hometrics and update it
@@ -103,66 +108,16 @@ public class PmNotificationHandler {
.getAdditionalMeasurements()) {
int attemptsCount = Integer.parseInt(additionalMeasurements.getHashMap().get("InterEnbOutAtt_X2HO"));
int successCount = Integer.parseInt(additionalMeasurements.getHashMap().get("InterEnbOutSucc_X2HO"));
- float successRate = ((float) successCount / attemptsCount) * 100;
-
- if (successRate >= badThreshold && successRate <= poorThreshold) { // poor neighbor
- HoDetails hoDetails = new HoDetails();
- hoDetails.setDstCellId(additionalMeasurements.getName());
- hoDetails.setAttemptsCount(attemptsCount);
- hoDetails.setSuccessCount(successCount);
- hoDetails.setSuccessRate(successRate);
- int pc = 1;
- int bc = 0;
- if (dstCellIdPcPair.containsKey(additionalMeasurements.getName())) {
- pc = dstCellIdPcPair.get(additionalMeasurements.getName()) + 1;
- }
- hoDetails.setBadCount(bc);
- hoDetails.setPoorCount(pc);
- hoDetailsList.add(hoDetails);
- log.info("poor neighbor {}", additionalMeasurements.getName());
- } else if (successRate < badThreshold) { // bad neighbor
- log.info(" bad neighbor {}", additionalMeasurements.getName());
- HoDetails hoDetails = new HoDetails();
- hoDetails.setDstCellId(additionalMeasurements.getName());
- hoDetails.setAttemptsCount(attemptsCount);
- hoDetails.setSuccessCount(successCount);
- hoDetails.setSuccessRate(successRate);
- int bc = 1;
- int pc = 0;
- if (dstCellIdBcPair.containsKey(additionalMeasurements.getName())) {
- bc = dstCellIdBcPair.get(additionalMeasurements.getName()) + 1;
- }
- if (dstCellIdPcPair.containsKey(additionalMeasurements.getName())) {
- pc = dstCellIdPcPair.get(additionalMeasurements.getName());
- }
- hoDetails.setBadCount(bc);
- hoDetails.setPoorCount(pc);
- hoDetailsList.add(hoDetails);
- if (bc >= badCountThreshold) {
- LteCell lteCell = new LteCell();
- lteCell.setBlacklisted("true");
- lteCell.setCid(additionalMeasurements.getName());
- lteCell.setPlmnId(additionalMeasurements.getHashMap().get("networkId"));
- lteCell.setPnfName(pmNotification.getEvent().getCommonEventHeader().getReportingEntityName());
- lteCellList.add(lteCell);
- hoDetailsList.remove(hoDetails);
- }
-
- } else if (successRate > poorThreshold) { // good neighbor
- HoDetails hoDetails = new HoDetails();
- hoDetails.setDstCellId(additionalMeasurements.getName());
- hoDetails.setAttemptsCount(attemptsCount);
- hoDetails.setSuccessCount(successCount);
- hoDetails.setSuccessRate(successRate);
- int pc = 0;
- int bc = 0;
- hoDetails.setBadCount(bc);
- hoDetails.setPoorCount(pc);
- hoDetailsList.add(hoDetails);
- log.info("good neighbor {}", additionalMeasurements.getName());
- }
+ int successRate = (int)((float) successCount / attemptsCount) * 100;
+
+ Neighbours neighbourCell = new Neighbours();
+ neighbourCell.setHoKpi(successRate);
+ neighbourCell.setCellId(additionalMeasurements.getName());
+ neighbourCell.setPlmnId(additionalMeasurements.getHashMap().get("networkId"));
+ neighbourCell.setPnfName(pmNotification.getEvent().getCommonEventHeader().getReportingEntityName());
+ neighbourList.add(neighbourCell);
}
- if (!lteCellList.isEmpty()) {
+ if (!neighbourList.isEmpty()) {
log.info("triggering policy to remove bad neighbors");
Flag policyTriggerFlag = BeanUtil.getBean(Flag.class);
@@ -171,7 +126,7 @@ public class PmNotificationHandler {
}
policyTriggerFlag.setHolder("PM");
- result = sendAnrUpdateToPolicy(pmNotification, lteCellList);
+ result = sendAnrUpdateToPolicy(pmNotification, neighbourList);
log.info("Sent ANR update to policy {}", result);
policyTriggerFlag.setHolder("NONE");
}
@@ -199,19 +154,17 @@ public class PmNotificationHandler {
}
- private Boolean sendAnrUpdateToPolicy(PmNotification pmNotification, List<LteCell> lteCellList) {
+ private Boolean sendAnrUpdateToPolicy(PmNotification pmNotification, List<Neighbours> neighbourList) {
ObjectMapper mapper = new ObjectMapper();
try {
mapper.setSerializationInclusion(Include.NON_NULL);
- ArrayList<Configurations> configurations = new ArrayList<>();
String cellId = pmNotification.getEvent().getCommonEventHeader().getSourceName();
- Configurations configuration = new Configurations(
- new Data(new FapService(cellId, null,
- new CellConfig(new Lte(new Ran(new Common(cellId),
- new NeighborListInUse(null, lteCellList, String.valueOf(lteCellList.size()))))))),
- null);
- configurations.add(configuration);
- Payload payload = new Payload(configurations);
+ String pnfName = pmNotification.getEvent().getCommonEventHeader().getReportingEntityName();
+ String plmnId = pmNotification.getEvent().getMeasurementFields()
+ .getAdditionalMeasurements().get(0).getHashMap().get("networkId");
+ String ric_id = CpsClient.getRicId(cellId);
+ ANRPayload payload = new ANRPayload("CreatePolicy",1,1,ric_id,
+ (new PolicyData(pnfName,plmnId,cellId,neighbourList)));
log.info("payload : {}", payload);
String anrUpdateString = mapper.writeValueAsString(payload);
ChildThreadUtils childUtils = new ChildThreadUtils(ConfigPolicy.getInstance(), new PnfUtils(),
@@ -219,7 +172,7 @@ public class PmNotificationHandler {
String requestId = UUID.randomUUID().toString();
String notification = childUtils.getNotificationString(
pmNotification.getEvent().getCommonEventHeader().getReportingEntityName(), requestId,
- anrUpdateString, System.currentTimeMillis(), "ModifyConfigANR");
+ anrUpdateString, System.currentTimeMillis(), "ModifyA1Policy");
log.info("Policy Notification: {}", notification);
Boolean result = policyDmaapClient.sendNotificationToPolicy(notification);
log.info("send notification to policy result {} ", result);
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
index 6b60992..61653cf 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/child/ChildThreadUtils.java
@@ -2,21 +2,21 @@
* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2019-2021 Wipro Limited.
+ * Copyright (C) 2019-2022 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;
@@ -124,8 +124,10 @@ public class ChildThreadUtils {
String action) {
String closedLoopControlName = "";
- if (action.equals("ModifyConfig")) {
- closedLoopControlName = "ControlLoop-vPCI-fb41f388-a5f2-11e8-98d0-529269fb1459";
+ String policyName = "";
+ if (action.equals("ModifyO1Config")) {
+ closedLoopControlName = "ControlLoop-SONO1-fb41f388-a5f2-11e8-98d0-529269fb1459";
+ policyName = "SONO1";
try {
closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIG_POLICY_NAME");
} catch (NullPointerException e) {
@@ -133,7 +135,8 @@ public class ChildThreadUtils {
}
}
else {
- closedLoopControlName = "ControlLoop-vSONH-7d4baf04-8875-4d1f-946d-06b874048b61";
+ closedLoopControlName = "ControlLoop-SONA1-7d4baf04-8875-4d1f-946d-06b874048b61";
+ policyName = "SONA1";
try {
closedLoopControlName = (String) configPolicy.getConfig().get("PCI_MODCONFIGANR_POLICY_NAME");
} catch (NullPointerException e) {
@@ -142,10 +145,11 @@ public class ChildThreadUtils {
}
PolicyNotification policyNotification = new PolicyNotification(closedLoopControlName, requestId, alarmStartTime,
- pnfName, action);
+ pnfName, action, policyName);
policyNotification.setClosedLoopControlName(closedLoopControlName);
policyNotification.setPayload(payloadString);
+ policyNotification.setPolicyName(policyName);
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
@@ -200,7 +204,7 @@ public class ChildThreadUtils {
String requestId = UUID.randomUUID().toString();
String notification = getNotificationString(pnfName, requestId, payloadString,
- System.currentTimeMillis(), "ModifyConfig");
+ System.currentTimeMillis(), "ModifyO1Config");
log.info("Policy Notification: {}", notification);
boolean status = policyDmaapClient.sendNotificationToPolicy(notification);
log.debug("sent Message: {}", status);
@@ -271,7 +275,7 @@ public class ChildThreadUtils {
}
String requestId = UUID.randomUUID().toString();
String notification = getNotificationString(pnfName, requestId, payloadString,
- System.currentTimeMillis(), "ModifyConfigANR");
+ System.currentTimeMillis(), "ModifyA1Policy");
log.info("Policy Notification: {}", notification);
Boolean result = policyDmaapClient.sendNotificationToPolicy(notification);
log.info("send notification to policy result {} ", result);
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java
new file mode 100644
index 0000000..c8ff5e4
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/ANRPayload.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2022 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;
+
+/**
+ * Model class for payload for A1 based control loop
+ */
+
+public class ANRPayload {
+
+ @JsonProperty("action")
+ private String action;
+
+ @JsonProperty("policy_id")
+ private int policy_id;
+
+ @JsonProperty("policy_type_id")
+ private int policy_type_id;
+
+ @JsonProperty("ric_id")
+ private String ric_id;
+
+ @JsonProperty("policy_data")
+ private PolicyData policy_data;
+
+ /**
+ * Constructor
+ */
+
+ public ANRPayload() {
+
+ }
+
+ /**
+ * Constructor
+ */
+
+ public ANRPayload(String action, int policy_id, int policy_type_id, String ric_id, PolicyData policy_data) {
+ super();
+ this.action = action;
+ this.policy_id = policy_id;
+ this.policy_type_id = policy_type_id;
+ this.ric_id = ric_id;
+ this.policy_data=policy_data;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public int getPolicyId(){
+ return policy_id;
+ }
+ public void setPolicyId(int policy_id){
+ this.policy_id = policy_id;
+ }
+
+ public int getPolicyTypeId(){
+ return policy_type_id;
+ }
+
+ public void setPolicyTypeId(int policy_type_id){
+ this.policy_type_id = policy_type_id;
+ }
+
+ public String getRicId(){
+ return ric_id;
+ }
+
+ public void setRicId(String ric_id){
+ this.ric_id = ric_id;
+ }
+
+ public PolicyData getPolicyData(){
+ return policy_data;
+ }
+
+ public void setPolicyData(PolicyData policy_data){
+ this.policy_data = policy_data;
+ }
+
+ @Override
+ public String toString() {
+ return "Payload [=" + action + "]";
+
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Action.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Action.java
new file mode 100644
index 0000000..72bf6a8
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Action.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2022 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 enum Action {
+
+ CreatePolicy,
+ DeletePolicy,
+ GetPolicyStatus
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java
new file mode 100644
index 0000000..73c3cd5
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/Neighbours.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2022 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;
+
+/**
+ * Model class for neighbour details within the payload
+ * for A1 based control loop
+ */
+
+public class Neighbours {
+
+ @JsonProperty("PNFName")
+ private String pnfName;
+
+ @JsonProperty("PLMNID")
+ private String plmnId;
+
+ @JsonProperty("CellID")
+ private String cellId;
+
+ @JsonProperty("ho-kpi1")
+ private int hoKpi;
+
+ public Neighbours() {
+
+ }
+
+ /**
+ * Parameterized Constructor.
+ */
+ public Neighbours(String pnfName, String plmnId, String cellId, int hoKpi) {
+ super();
+ this.pnfName = pnfName;
+ this.plmnId = plmnId;
+ this.cellId = cellId;
+ this.hoKpi = hoKpi;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getPlmnId() {
+ return plmnId;
+ }
+
+ public void setPlmnId(String plmnId) {
+ this.plmnId = plmnId;
+ }
+
+ public String getCellId() {
+ return cellId;
+ }
+
+ public void setCellId(String cellId) {
+ this.cellId = cellId;
+ }
+
+ public int getHoKpi() {
+ return hoKpi;
+ }
+
+ public void setHoKpi(int hoKpi) {
+ this.hoKpi = hoKpi;
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java
new file mode 100644
index 0000000..ff5b48e
--- /dev/null
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyData.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * ============LICENSE_START=======================================================
+ * son-handler
+ * ================================================================================
+ * Copyright (C) 2022 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 PolicyData {
+
+ @JsonProperty("PNFName")
+ private String pnfName;
+
+ @JsonProperty("PLMNID")
+ private String plmnId;
+
+ @JsonProperty("CellID")
+ private String cellId;
+
+ @JsonProperty("neighbours")
+ private List<Neighbours> neighbours;
+
+ public PolicyData() {
+
+ }
+
+ /**
+ * Parameterized Constructor.
+ */
+ public PolicyData(String pnfName, String plmnId, String cellId, List<Neighbours> neighbours) {
+ super();
+ this.pnfName = pnfName;
+ this.plmnId = plmnId;
+ this.cellId = cellId;
+ this.neighbours = neighbours;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getPlmnId() {
+ return plmnId;
+ }
+
+ public void setPlmnId(String plmnId) {
+ this.plmnId = plmnId;
+ }
+
+ public String getCellId() {
+ return cellId;
+ }
+
+ public void setCellId(String cellId) {
+ this.cellId = cellId;
+ }
+
+ public List<Neighbours> getNeighbours() {
+ return neighbours;
+ }
+
+ public void setNeighbours(List<Neighbours> neighbours) {
+ this.neighbours=neighbours;
+ }
+
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java
index 8766dff..74afb10 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/model/PolicyNotification.java
@@ -2,21 +2,21 @@
* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2019-2020 Wipro Limited.
+ * Copyright (C) 2019-2022 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;
@@ -65,7 +65,7 @@ public class PolicyNotification {
* Constructor.
*/
public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName,
- String action) {
+ String action, String policyName) {
this.closedLoopControlName = closedLoopControlName;
this.requestId = requestId;
this.closedLoopEventClient = "microservice.PCI";
@@ -80,7 +80,7 @@ public class PolicyNotification {
aai.put("generic-vnf.is-closed-loop-disabled", "false");
aai.put("generic-vnf.prov-status", "ACTIVE");
aai.put("pnf.pnf-name", pnfName);
- this.policyName = "PCI";
+ this.policyName = policyName;
this.policyVersion = "1.0.2";
}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/ConfigInterface.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/ConfigInterface.java
index ff34cbf..79753b7 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/ConfigInterface.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/ConfigInterface.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* son-handler
* ================================================================================
- * Copyright (C) 2021 Wipro Limited.
+ * Copyright (C) 2021-2022 Wipro Limited.
* ==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public abstract class ConfigInterface
*/
public abstract int getPci(String cellId) throws ConfigDbNotFoundException, CpsNotFoundException;
- /**
+ /**
* Abstract method to get PNF name from SDNR or CPS based on the client mentioned.
*
* @throws ConfigDbNotFoundException,CpsNotFoundException
@@ -70,4 +70,4 @@ public abstract class ConfigInterface
* @see org.onap.dcaegen2.services.sonhms.Configuration
*/
public abstract JSONObject getCellData(String cellId) throws ConfigDbNotFoundException, CpsNotFoundException;
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java
index 461d901..caf94f1 100644
--- a/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java
+++ b/src/main/java/org/onap/dcaegen2/services/sonhms/restclient/CpsClient.java
@@ -131,6 +131,24 @@ public class CpsClient extends ConfigInterface {
return responseObject;
}
+ /*
+ * Method to get NearRTRIC ID from CPS.
+ *
+ * @throws CpsNotFoundException when request to CPS fails
+ */
+
+ public static String getRicId(String cellId) throws CpsNotFoundException {
+ Configuration configuration = Configuration.getInstance();
+ String requestUrl = configuration.getCpsServiceUrl() + "/" + configuration.getGetRicIdUrl();
+ JSONObject inputparam = new JSONObject();
+ JSONObject reqbody = new JSONObject();
+ inputparam.put("cellId", cellId);
+ reqbody.put("inputParameters", inputparam);
+ String response = sendRequest(requestUrl, reqbody);
+ JSONObject responseObject = new JSONObject(response);
+ return responseObject.getString("idNearRTRIC");
+ }
+
/**
* Method to get CellData name from CPS.
*
@@ -151,7 +169,7 @@ public class CpsClient extends ConfigInterface {
return responseObject;
}
- private String sendRequest(String url, JSONObject reqbody) throws CpsNotFoundException {
+ private static String sendRequest(String url, JSONObject reqbody) throws CpsNotFoundException {
ResponseEntity<String> response = SonHandlerRestTemplate.sendPostRequest(url, reqbody.toString(),
new ParameterizedTypeReference<String>() {
});