aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
index 707c9e9..a4347d4 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
@@ -102,16 +102,19 @@ public class ServiceInventoryService {
List<LinkedHashMap> vnfs = new ArrayList<>();
LinkedHashMap relationShip = (LinkedHashMap) serviceResponse.get("relationship-list");
- List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship");
- for (LinkedHashMap relation : relationsList) {
- String relatedLink = (String) relation.get("related-link");
- LinkedHashMap vnf = aaiClient.getVNF(relatedLink);
- if (vnf != null) {
- vnfs.add(vnf);
+ if(relationShip!=null) {
+ List<LinkedHashMap> relationsList = (List<LinkedHashMap>) relationShip.get("relationship");
+ if(relationsList!=null) {
+ for (LinkedHashMap relation : relationsList) {
+ String relatedLink = (String) relation.get("related-link");
+ LinkedHashMap vnf = aaiClient.getVNF(relatedLink);
+ if (vnf != null) {
+ vnfs.add(vnf);
+ }
+ }
+ serviceResponse.put("vnfs", vnfs);
}
}
- serviceResponse.put("vnfs", vnfs);
-
}