- private List<String> extractSoftwareVersions(SubstitutionMappings sm) throws ToscaToCatalogException {
- applicationLogger.debug("Trying to extract the software versions for the vnf configuration");
-
- List<NodeTemplate> imagesNodes = sm.getNodeTemplates().stream()
- .filter(nodeTemplate -> nodeTemplate.getPropertyValue(IMAGES) != null).collect(Collectors.toList());
-
- if (imagesNodes != null && !imagesNodes.isEmpty()) {
- applicationLogger.debug("Found NodeTemplates containing properties with a key called 'images'");
- return imagesNodes.stream()
- .flatMap(imagesNode -> ((Map<String, Object>) imagesNode.getPropertyValue(IMAGES)) //
- .entrySet().stream())
- .map(property -> findSoftwareVersion((Map<String, Object>) property.getValue()))
- .collect(Collectors.toList());
- } else {
- throw new ToscaToCatalogException("No software versions could be found for this csar file");
- }
+ List<String> extractSoftwareVersions(Collection<NodeTemplate> nodeTemplates) {
+ return nodeTemplates.stream() //
+ .filter(nodeTemplate -> nodeTemplate.getPropertyValue(IMAGES) != null) //
+ .flatMap(imagesNode -> ((Map<String, Object>) imagesNode.getPropertyValue(IMAGES)).entrySet().stream())
+ .map(property -> findSoftwareVersion((Map<String, Object>) property.getValue()))
+ .collect(Collectors.toList());