+ @Override
+ public List<String> getRelatedToVnfIds(final String globalCustomerId, final String serviceType,
+ final String serviceInstanceId) {
+ final Optional<ServiceInstance> optional = getServiceInstance(globalCustomerId, serviceType, serviceInstanceId);
+
+ if (optional.isPresent()) {
+ LOGGER.info("Found service instance ...");
+ final ServiceInstance serviceInstance = optional.get();
+ final RelationshipList relationshipList = serviceInstance.getRelationshipList();
+
+ if (relationshipList != null) {
+ final List<Relationship> relationships = relationshipList.getRelationship();
+ LOGGER.info("Relationships found {}", relationships);
+ return getGenericVnfIdsIfPresent(relationships);
+ }
+ LOGGER.warn("Relationship list is nulll ...");
+ }
+ LOGGER.error("Unable to find generic-vnf relationships ... ");
+ return Collections.emptyList();
+ }
+
+ private List<String> getGenericVnfIdsIfPresent(final List<Relationship> relationships) {
+ final List<String> vnfIdsFound = new ArrayList<>();
+ relationships.stream().forEach(relationship -> {
+ relationship.getRelationshipData().stream()
+ .filter(existing -> GENERIC_VNF_VNF_ID.equals(existing.getRelationshipKey())).findFirst()
+ .ifPresent(consume -> {
+ vnfIdsFound.add(consume.getRelationshipValue());
+ });
+ });
+ return vnfIdsFound;