diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
3 files changed, 71 insertions, 3 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java index 0b438a1b17..edb92ef68b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidation.java @@ -21,8 +21,6 @@ package org.onap.so.apihandlerinfra.validation; -import java.util.Map; - import org.onap.so.apihandlerinfra.Action; import org.onap.so.apihandlerinfra.Actions; import org.onap.so.exceptions.ValidationException; @@ -75,7 +73,7 @@ public class RequestParametersValidation implements ValidationRule{ if(action == Action.createInstance || action == Action.updateInstance){ if(requestParameters.isUsePreload() == null){ if(reqVersion >= 4){ - if (requestParameters.getALaCarte() == false) { + if (requestParameters.getALaCarte() == null || requestParameters.getALaCarte() == false) { requestParameters.setUsePreload(false); } else { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java index 3fc5a16d9d..2813ef7b70 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RequestParametersValidationTest.java @@ -55,6 +55,21 @@ public class RequestParametersValidationTest extends BaseTest{ } @Test + public void testVfModuleWithNoALaCarte() throws IOException, ValidationException { + String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json"))); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class); + ValidationInformation info = new ValidationInformation(sir, new HashMap<String, String>(), Action.createInstance, + 6, false, sir.getRequestDetails().getRequestParameters()); + info.setRequestScope("vfModule"); + sir.setServiceInstanceId("0fd90c0c-0e3a-46e2-abb5-4c4820d5985b"); + RequestParametersValidation validation = new RequestParametersValidation(); + validation.validate(info); + + assertFalse(info.getReqParameters().getUsePreload()); + } + + @Test public void testVfModuleWithTrueALaCarte() throws IOException, ValidationException { String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersIsALaCarte.json"))); ObjectMapper mapper = new ObjectMapper(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json new file mode 100644 index 0000000000..304065f930 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleRequestParametersNoALaCarte.json @@ -0,0 +1,55 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "InframsoVsamp10a2..vSAMP10a_addon_2..module-1", + "modelVersionId": "dcd3d939-67cd-438c-a55f-48073811f83f", + "modelInvariantId": "b42d49f3-6429-4c2e-a73c-29bef87ca1b9", + "modelVersion": "1", + "modelCustomizationId": "3bec51f8-b410-40f5-b470-25d31f7210dc" + }, + "cloudConfiguration": { + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "mtn6", + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8" + }, + "requestInfo": { + "instanceName": "InfraMSO-vSAMP10a_6.0-VF-Module_1-1902-est01-GR_API-101", + "source": "VID", + "suppressRollback": false, + "requestorId": "bs7527" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "43075e6e-4d95-4bca-b9e5-712d0a14fbc2", + "modelInfo": { + "modelType": "service", + "modelName": "InfraMSO_vSAMP10a_Service", + "modelVersionId": "8f6fba78-8eab-4149-8be1-491ef7f63cf7", + "modelInvariantId": "653030db-85e2-4bd1-8c61-3764ebf5860a", + "modelVersion": "6.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "7c1ff5bc-fb41-48a7-b997-f9fdb3ab4a77", + "modelInfo": { + "modelType": "vnf", + "modelName": "InfraMSO_vSAMP10a-2", + "modelVersionId": "cb79c25f-b30d-4d95-afb5-97be4021f3db", + "modelInvariantId": "e93d3a7a-446d-486b-ae48-d474a9156064", + "modelVersion": "1.0", + "modelCustomizationId": "034226ae-879a-46b5-855c-d02babcb6cb6", + "modelCustomizationName": "InfraMSO_vSAMP10a-2 0" + } + } + } + ], + "requestParameters": { + "testApi": "GR_API", + "userParams": [] + } + } +} |