Fix: Wrong type of Exception thrown
A NotFoundException suits better to the case in which all the VDUs have reached their max or min number of VNFCInstances in a scaling request.
@@ -489,10 +489,11 @@ public class NetworkServiceRecordManagement
break;
}
if (virtualDeploymentUnit == null)
- throw new WrongStatusException(
+ 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());
+ log.debug(
+ "A new VNFCInstance will be added to the VDU with id " + virtualDeploymentUnit.getId());
networkServiceRecord.setStatus(Status.SCALING);
networkServiceRecord = nsrRepository.save(networkServiceRecord);
@@ -621,10 +622,11 @@ public class NetworkServiceRecordManagement
}
if (virtualDeploymentUnit == null)
- throw new WrongStatusException(
+ throw new NotFoundException(
"All VirtualDeploymentUnits have reached their minimum number of VNFCInstances");
- log.debug("A VNFCInstance will be deleted from the VDU with id " + virtualDeploymentUnit.getId());
+ log.debug(
+ "A VNFCInstance will be deleted from the VDU with id " + virtualDeploymentUnit.getId());
VNFCInstance vnfcInstance = virtualDeploymentUnit.getVnfc_instance().iterator().next();
if (vnfcInstance == null) {
