aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
index b02bd95d97..3b87d91d3f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidation.java
@@ -119,12 +119,25 @@ public class RelatedInstancesValidation implements ValidationRule {
isRelatedServiceInstancePresent = true;
}
+ if (requestScope.equalsIgnoreCase(ModelType.service.name())) {
+ if (empty(relatedInstance.getInstanceName())
+ && ModelType.vpnBinding.equals(relatedInstanceModelInfo.getModelType())) {
+ throw new ValidationException("instanceName in relatedInstance for vpnBinding modelType", true);
+ }
+ if (empty(relatedInstance.getInstanceName())
+ && ModelType.network.equals(relatedInstanceModelInfo.getModelType())) {
+ throw new ValidationException("instanceName in relatedInstance for network modelType", true);
+ }
+ }
+
if (action != Action.deleteInstance
&& !requestScope.equalsIgnoreCase(ModelType.instanceGroup.toString())) {
if (!(relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)
|| relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint)
|| relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- || relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup))) {
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.network)
+ || relatedInstanceModelInfo.getModelType().equals(ModelType.vpnBinding))) {
if (empty(relatedInstanceModelInfo.getModelInvariantId())) {
throw new ValidationException("modelInvariantId in relatedInstance");