Fix: Apply previous changes also to the second addVNFCInstance method
There were changes regarding vim name checks etc on one method, but the other one was left out.
@@ -614,6 +614,24 @@ public class NetworkServiceRecordManagement
"The VirtualDeploymentUnit chosen has reached the maximum number of VNFCInstance");
}
+ Set<String> names = new HashSet<>();
+ for (VimInstance vimInstance : vimInstanceRepository.findByProjectId(projectId)) {
+ names.add(vimInstance.getName());
+ }
+ if (vimInstanceNames == null || vimInstanceNames.isEmpty()) {
+ vimInstanceNames = new ArrayList<>();
+ for (VimInstance vimInstance : vimInstanceRepository.findByProjectId(projectId)) {
+ vimInstanceNames.add(vimInstance.getName());
+ }
+ }
+ names.retainAll(vimInstanceNames);
+ if (names.size() == 0) {
+ log.error("VimInstance names passed not found");
+ throw new NotFoundException("VimInstance names passed not found");
+ }
+ log.debug(
+ "A new VNFCInstance will be added to the VDU with id " + virtualDeploymentUnit.getId());
+
networkServiceRecord.setStatus(Status.SCALING);
networkServiceRecord = nsrRepository.save(networkServiceRecord);
scaleOUT(
