summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/slice-analysis-ms/ChangeLog.md3
-rw-r--r--components/slice-analysis-ms/pom.xml2
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java22
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/cps/CpsService.java6
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java5
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SliceUtilization.java2
-rw-r--r--components/slice-analysis-ms/version.properties2
7 files changed, 31 insertions, 11 deletions
diff --git a/components/slice-analysis-ms/ChangeLog.md b/components/slice-analysis-ms/ChangeLog.md
index db380685..15287441 100644
--- a/components/slice-analysis-ms/ChangeLog.md
+++ b/components/slice-analysis-ms/ChangeLog.md
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
+## [1.1.1] - 2022/04/12
+ - [DCAEGEN2-3142](https://jira.onap.org/browse/DCAEGEN2-3142) - Filter data from AAI to avoid possible exceptions, remove null parameters in policy payload and add logs
+
## [1.1.0] - 2022/3/10
- [DCAEGEN2-3063](https://jira.onap.org/browse/DCAEGEN2-3063) - IBN user-triggered CLoud Leased Line update and CCVPN closed-loop
diff --git a/components/slice-analysis-ms/pom.xml b/components/slice-analysis-ms/pom.xml
index d9ab31f8..1f68fe51 100644
--- a/components/slice-analysis-ms/pom.xml
+++ b/components/slice-analysis-ms/pom.xml
@@ -34,7 +34,7 @@
</parent>
<groupId>org.onap.dcaegen2.services.components</groupId>
<artifactId>slice-analysis-ms</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.1-SNAPSHOT</version>
<name>dcaegen2-services-slice-analysis-ms</name>
<description>Network slice PM analyser</description>
<packaging>jar</packaging>
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java
index eb5d243c..289fedfd 100644
--- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java
+++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/aai/AaiService.java
@@ -70,6 +70,7 @@ public class AaiService implements AaiInterface {
Map<String, String> responseMap = fetchSubscriberAndSubscriptionServiceType();
String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType + "/service-instances";
+ log.info("serviceReqUrl {}", serviceReqUrl);
String serviceRole = "AN-NF";
try {
String serviceInstance =
@@ -78,7 +79,7 @@ public class AaiService implements AaiInterface {
JSONArray serviceInstanceList = serviceInstanceJson.getJSONArray("service-instance");
for (int i = 0; i < serviceInstanceList.length(); i++) {
JSONObject serviceObj = serviceInstanceList.getJSONObject(i);
- if (serviceObj.getString("environment-context").equalsIgnoreCase(snssai)) {
+ if (serviceObj.has("environment-context") && serviceObj.getString("environment-context").equalsIgnoreCase(snssai)) {
responseMap.put("sliceProfileId", serviceObj.getString("service-instance-id"));
}
}
@@ -86,7 +87,7 @@ public class AaiService implements AaiInterface {
String serviceRoleReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType
+ "/service-instances/?service-role=nssi&depth=2";
-
+ log.info("serviceRoleReqUrl {}", serviceRoleReqUrl);
String serviceInstanceForServiceRole =
restclient.sendGetRequest(serviceRoleReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
JSONObject serviceInstanceForServiceRoleJson = new JSONObject(serviceInstanceForServiceRole);
@@ -94,7 +95,7 @@ public class AaiService implements AaiInterface {
serviceInstanceForServiceRoleJson.getJSONArray("service-instance");
for (int i = 0; i < serviceInstanceListForServiceRole.length(); i++) {
JSONObject serviceObj = serviceInstanceListForServiceRole.getJSONObject(i);
- if (serviceObj.getString("workload-context").trim().equalsIgnoreCase(serviceRole)) {
+ if (serviceObj.has("workload-context") && serviceObj.getString("workload-context").trim().equalsIgnoreCase(serviceRole)) {
responseMap.put("ranNFNSSIId", serviceObj.getString("service-instance-id"));
}
}
@@ -117,6 +118,7 @@ public class AaiService implements AaiInterface {
String serviceInstaneId = null;
String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType + "/service-instances";
+ log.info("serviceReqUrl {}", serviceReqUrl);
Map<String, Integer> responseMap = new HashMap<String, Integer>();
try {
String serviceInstance =
@@ -126,7 +128,7 @@ public class AaiService implements AaiInterface {
JSONArray serviceInstanceList = serviceInstanceJson.getJSONArray("service-instance");
for (int i = 0; i < serviceInstanceList.length(); i++) {
JSONObject serviceObj = serviceInstanceList.getJSONObject(i);
- if (serviceObj.getString("environment-context").equalsIgnoreCase(snssai)) {
+ if (serviceObj.has("environment-context") && serviceObj.getString("environment-context").equalsIgnoreCase(snssai)) {
serviceInstaneId = serviceObj.getString("service-instance-id");
}
}
@@ -134,7 +136,7 @@ public class AaiService implements AaiInterface {
String sliceProfileReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType
+ "/service-instances/service-instance/" + serviceInstaneId + "/slice-profiles";
-
+ log.info("sliceProfileReqUrl {}", sliceProfileReqUrl);
String sliceProfile = restclient
.sendGetRequest(sliceProfileReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
JSONObject sliceProfileJson = new JSONObject(sliceProfile);
@@ -163,6 +165,7 @@ public class AaiService implements AaiInterface {
log.info("Get GlobalSubscriberId");
String subscriberReqUrl = aaiBaseUrl + "/business/customers";
+ log.info("subscriberReqUrl {}", subscriberReqUrl);
try {
String subscriberReq =
restclient.sendGetRequest(subscriberReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
@@ -178,7 +181,7 @@ public class AaiService implements AaiInterface {
log.info("Get subscriptionServiceType");
String subscriptionServiceReqUrl =
aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId + "/service-subscriptions";
-
+ log.info("subscriptionServiceReqUrl: {}", subscriptionServiceReqUrl);
String subscriptionService = restclient
.sendGetRequest(subscriptionServiceReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
JSONObject subscriptionServiceJson = new JSONObject(subscriptionService);
@@ -214,14 +217,14 @@ public class AaiService implements AaiInterface {
String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType
+ "/service-instances/service-instance/" + sliceInstanceId;
-
+ log.info("serviceReqUrl {}", serviceReqUrl);
try {
String serviceInstanceString =
restclient.sendGetRequest(serviceReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
ServiceInstance serviceInstance = objectMapper.readValue(serviceInstanceString, ServiceInstance.class);
if (serviceInstance.getServiceRole().equalsIgnoreCase("nsi")) {
serviceInstance.getRelationshipList().getRelationship().forEach(relationship -> {
- if (relationship.getRelatedTo().equalsIgnoreCase("allotted-resource")) {
+ if (Objects.nonNull(relationship.getRelatedTo()) && relationship.getRelatedTo().equalsIgnoreCase("allotted-resource")) {
relationship.getRelationshipData().forEach(data -> {
if (data.get("relationship-key").equalsIgnoreCase("service-instance.service-instance-id")) {
allotedResource.add(data.get("relationship-value"));
@@ -280,6 +283,7 @@ public class AaiService implements AaiInterface {
String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType
+ "/service-instances/service-instance/" + serviceInstanceId;
+ log.info("serviceReqUrl {}", serviceReqUrl);
String serviceInstanceString =
restclient.sendGetRequest(serviceReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
ServiceInstance serviceInstance = objectMapper.readValue(serviceInstanceString, ServiceInstance.class);
@@ -326,7 +330,7 @@ public class AaiService implements AaiInterface {
String serviceReqUrl = aaiBaseUrl + "/business/customers/customer/" + globalSubscriberId
+ "/service-subscriptions/service-subscription/" + subscriptionServiceType + "/service-instances/"
+ "service-instance/" + serviceInstanceId;
-
+ log.info("serviceReqUrl {}", serviceReqUrl);
try {
String serviceInstanceString =
restclient.sendGetRequest(serviceReqUrl, new ParameterizedTypeReference<String>() {}).getBody();
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/cps/CpsService.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/cps/CpsService.java
index 743ac3cf..27f37aba 100644
--- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/cps/CpsService.java
+++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/cps/CpsService.java
@@ -58,7 +58,9 @@ public class CpsService implements CpsInterface {
Map<String, Map<String, Object>> responseMap = new HashMap<String, Map<String, Object>>();
String reqUrl = cpsBaseUrl + "/get-nearrtric-config";
log.info("fetching current configuration of RIC from Cps: {s-NSSAI: " + snssai + "}");
+ log.info("reqUrl {}", reqUrl);
String requestBody = "{\"inputParameters\": {\"sNssai\":" + JSONObject.quote(snssai) + "}}";
+ log.info("requestBody {}", requestBody);
try {
String response = restclient
.sendPostRequest(reqUrl, requestBody, new ParameterizedTypeReference<String>() {}).getBody();
@@ -93,7 +95,9 @@ public class CpsService implements CpsInterface {
List<String> responseList = new ArrayList<>();
String reqUrl = cpsBaseUrl + "/get-gnbdufunction-by-snssai";
log.info("fetching network functions of snssai from Cps: {s-NSSAI: " + snssai + "}");
+ log.info("reqUrl {}", reqUrl);
String requestBody = "{\"inputParameters\": {\"sNssai\":" + JSONObject.quote(snssai) + "}}";
+ log.info("requestBody {}", requestBody);
try {
String response = restclient
.sendPostRequest(reqUrl, requestBody, new ParameterizedTypeReference<String>() {}).getBody();
@@ -115,7 +119,9 @@ public class CpsService implements CpsInterface {
Map<String, List<String>> responseMap = new HashMap<>();
String reqUrl = cpsBaseUrl + "/get-nrcelldu-by-snssai";
log.info("fetching RIC of s-NSSAI from Cps: {s-NSSAI: " + snssai + "}");
+ log.info("reqUrl {}", reqUrl);
String requestBody = "{\"inputParameters\": {\"sNssai\":" + JSONObject.quote(snssai) + "}}";
+ log.info("requestBody {}", requestBody);
try {
String response = restclient
.sendPostRequest(reqUrl, requestBody, new ParameterizedTypeReference<String>() {}).getBody();
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java
index e3351541..ceaeb730 100644
--- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java
+++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java
@@ -21,9 +21,14 @@
*******************************************************************************/
package org.onap.slice.analysis.ms.models.policy;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* Model class for the Paylaod Object
*/
+@JsonInclude(Include.NON_NULL)
public class Payload {
private String name;
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SliceUtilization.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SliceUtilization.java
index 94696343..1d53892c 100644
--- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SliceUtilization.java
+++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SliceUtilization.java
@@ -134,6 +134,8 @@ public class SliceUtilization {
String jsonRequestBody = new ObjectMapper().writeValueAsString(inputParameter);
log.info("fetching PM Data for : {}", snssai);
+ log.info("desUrl {}", desUrl);
+ log.info("jsonRequestBody {}", jsonRequestBody);
response =
desRestClient.sendPostRequest(desUrl, jsonRequestBody, new ParameterizedTypeReference<String>() {});
pmData = new JSONObject(response.getBody());
diff --git a/components/slice-analysis-ms/version.properties b/components/slice-analysis-ms/version.properties
index d5c05922..612bdf05 100644
--- a/components/slice-analysis-ms/version.properties
+++ b/components/slice-analysis-ms/version.properties
@@ -21,7 +21,7 @@
###############################################################################
major=1
minor=1
-patch=0
+patch=1
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT