Source:
public void addVNFCInstance(String id, String idVnf, VNFComponent component, String projectId) throws NotFoundException, BadFormatException, WrongStatusException { log.info("Adding new VNFCInstance to VNFR with id: " + idVnf); NetworkServiceRecord networkServiceRecord = getNetworkServiceRecordInActiveState(id); if (!networkServiceRecord.getProjectId().equals(projectId)) { throw new UnauthorizedUserException( "NSR not under the project chosen, are you trying to hack us? Just kidding, it's a bug :)"); } VirtualNetworkFunctionRecord virtualNetworkFunctionRecord = getVirtualNetworkFunctionRecord(idVnf, networkServiceRecord); if (!virtualNetworkFunctionRecord.getProjectId().equals(projectId)) { throw new UnauthorizedUserException( "VNFR not under the project chosen, are you trying to hack us? Just kidding, it's a bug :)"); } List<VirtualDeploymentUnit> vdusFound = new LinkedList<>(); VirtualDeploymentUnit virtualDeploymentUnit = null; for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) { if (vdu.getProjectId() != null && vdu.getProjectId().equals(projectId)) vdusFound.add(vdu); } if (vdusFound.size() == 0) throw new NotFoundException("No VirtualDeploymentUnit found"); for (VirtualDeploymentUnit vdu : vdusFound) { if (vdu.getScale_in_out() == vdu.getVnfc_instance().size()) continue; virtualDeploymentUnit = vdu; break; } if (virtualDeploymentUnit == null) throw new WrongStatusException( "All VirtualDeploymentUnits have reached their maximum number of VNFCInstances"); log.debug("A new VNFCInstance will be added to the VDU with id " + virtualDeploymentUnit.getId()); networkServiceRecord.setStatus(Status.SCALING); networkServiceRecord = nsrRepository.save(networkServiceRecord); scaleOUT( networkServiceRecord, virtualNetworkFunctionRecord, virtualDeploymentUnit, component, ""); }

Target:
public void addVNFCInstance(String id, String idVnf, VNFComponent component, String projectId) throws NotFoundException, BadFormatException, WrongStatusException { log.info("Adding new VNFCInstance to VNFR with id: " + idVnf); NetworkServiceRecord networkServiceRecord = getNetworkServiceRecordInActiveState(id); if (!networkServiceRecord.getProjectId().equals(projectId)) { throw new UnauthorizedUserException( "NSR not under the project chosen, are you trying to hack us? Just kidding, it's a bug :)"); } VirtualNetworkFunctionRecord virtualNetworkFunctionRecord = getVirtualNetworkFunctionRecord(idVnf, networkServiceRecord); if (!virtualNetworkFunctionRecord.getProjectId().equals(projectId)) { throw new UnauthorizedUserException( "VNFR not under the project chosen, are you trying to hack us? Just kidding, it's a bug :)"); } List<VirtualDeploymentUnit> vdusFound = new LinkedList<>(); VirtualDeploymentUnit virtualDeploymentUnit = null; for (VirtualDeploymentUnit vdu : virtualNetworkFunctionRecord.getVdu()) { if (vdu.getProjectId() != null && vdu.getProjectId().equals(projectId)) vdusFound.add(vdu); } if (vdusFound.size() == 0) throw new NotFoundException("No VirtualDeploymentUnit found"); for (VirtualDeploymentUnit vdu : vdusFound) { if (vdu.getScale_in_out() == vdu.getVnfc_instance().size()) continue; virtualDeploymentUnit = vdu; break; } if (virtualDeploymentUnit == null) throw new NotFoundException( "All VirtualDeploymentUnits have reached their maximum number of VNFCInstances"); log.debug( "A new VNFCInstance will be added to the VDU with id " + virtualDeploymentUnit.getId()); networkServiceRecord.setStatus(Status.SCALING); networkServiceRecord = nsrRepository.save(networkServiceRecord); scaleOUT( networkServiceRecord, virtualNetworkFunctionRecord, virtualDeploymentUnit, component, ""); }