From 93e96836387ee26cb5f2dbb70adef7db484c7d54 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 19 Oct 2018 09:32:18 -0400 Subject: bug fixes october 19th Fixed issue with resource version being added twice. added silent success to orch validation when unassign is not found Removed SNAPSHOT from dependency Fixed failing BBInputSetup tests Updated apih tests to use networkInstanceGroup Updated ModelType enum and fixed compilation issues Change the place where the data for multistage gets set Update treatment of PENDING_ACTIVATION VF_MODULE CREATE entries to SILENT_SUCCESS to support first stage of multistage. Implement second stage of multistage design VF Module Creation Implementation of the first stage of multistage design for VF Module creation. Change-Id: I6d76282d1f37c081355cee72797d8e13da4e3cb0 Issue-ID: SO-1149 Signed-off-by: Benjamin, Max (mb388a) Signed-off-by: Rob Daugherty --- .../validation/RelatedInstancesValidation.java | 2 +- .../so/apihandlerinfra/ServiceInstancesTest.java | 39 +++++++++++++++ .../validation/RelatedInstancesValidationTest.java | 4 +- .../v7CreateVnfNetworkCollection.json | 56 --------------------- .../v7CreateVnfNetworkInstanceGroup.json | 56 +++++++++++++++++++++ .../VnfwithNeteworkInstanceGroup.json | 57 ++++++++++++++++++++++ 6 files changed, 155 insertions(+), 59 deletions(-) delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkInstanceGroup.json create mode 100644 mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfwithNeteworkInstanceGroup.json (limited to 'mso-api-handlers') 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 1f4fbc974a..f22294b33f 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 @@ -106,7 +106,7 @@ public class RelatedInstancesValidation implements ValidationRule{ if(!( relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup) || relatedInstanceModelInfo.getModelType().equals(ModelType.connectionPoint) || relatedInstanceModelInfo.getModelType().equals(ModelType.pnf) || - relatedInstanceModelInfo.getModelType().equals(ModelType.networkCollection))) { + relatedInstanceModelInfo.getModelType().equals(ModelType.networkInstanceGroup))) { if(empty (relatedInstanceModelInfo.getModelInvariantId ())) { throw new ValidationException ("modelInvariantId in relatedInstance"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index dfcf9ffc46..01b5b38d4f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -2392,4 +2392,43 @@ public class ServiceInstancesTest extends BaseTest{ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); assertEquals("Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", realResponse.getServiceException().getText()); } + @Test + public void vnfUpdateWithNetworkInstanceGroup() throws IOException{ + stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfResourceCustomization/2ccae1b4-7d9e-46fa-a452-9180ce008d17")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" + + "[?]nfRole=GR-API-DEFAULT&action=updateInstance")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("UpdateVnfRecipe_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + HttpHeaders headers = new HttpHeaders(); + headers.set(MsoLogger.CLIENT_ID, "VID"); + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "v7/serviceInstances/e05864f0-ab35-47d0-8be4-56fd9619ba3c/vnfs/f501ce76-a9bc-4601-9837-74fd9f4d5eca"; + ResponseEntity response = sendRequest(inputStream("/VnfwithNeteworkInstanceGroup.json"), uri, HttpMethod.PUT, headers); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java index 93542c0a76..02fd7a1aca 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/RelatedInstancesValidationTest.java @@ -38,8 +38,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class RelatedInstancesValidationTest extends BaseTest{ @Test - public void testCreateVnfNetworkCollection() throws IOException, ValidationException { - String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json"))); + public void testCreateVnfNetworkInstanceGroup() throws IOException, ValidationException { + String requestJson = new String(Files.readAllBytes(Paths.get("src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkInstanceGroup.json"))); ObjectMapper mapper = new ObjectMapper(); ServiceInstancesRequest sir = mapper.readValue(requestJson, ServiceInstancesRequest.class); ValidationInformation info = new ValidationInformation(sir, new HashMap(), Action.createInstance, diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json deleted file mode 100644 index 99ca7fcfb0..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkCollection.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "requestDetails": { - "modelInfo": { - "modelType": "vnf", - "modelInvariantId": "9a10143a-13e3-4f56-8661-6625e6bcc310", - "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", - "modelName": "VF01032017", - "modelVersion": "1.0", - "modelCustomizationId": "d752b40b-3e1f-4aac-95d0-9f257c74f442" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "mdt1", - "tenantId": "88a6ca3ee0394ade9403f075db23167e" - }, - "requestInfo": { - "instanceName": "MSOTEST103a", - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", - "suppressRollback": false, - "requestorId": "xxxxxx" - }, - "platform": { - "platformName": "platform" - }, - "lineOfBusiness": { - "lineOfBusinessName": "business" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", - "modelInfo": { - "modelType": "service", - "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", - "modelVersionId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", - "modelName": "Test", - "modelVersion": "1.0" - } - } - }, - { - "relatedInstance": { - "instanceId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", - "modelInfo": { - "modelType": "networkCollection" - } - } - } - ], - "requestParameters": { - "autoBuildVfModules": false , - "aLaCarte": false, - "subscriptionServiceType": "test" - } - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkInstanceGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkInstanceGroup.json new file mode 100644 index 0000000000..da202f657f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/v7CreateVnfNetworkInstanceGroup.json @@ -0,0 +1,56 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "9a10143a-13e3-4f56-8661-6625e6bcc310", + "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "VF01032017", + "modelVersion": "1.0", + "modelCustomizationId": "d752b40b-3e1f-4aac-95d0-9f257c74f442" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTEST103a", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "platform": { + "platformName": "platform" + }, + "lineOfBusiness": { + "lineOfBusinessName": "business" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelVersionId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", + "modelName": "Test", + "modelVersion": "1.0" + } + } + }, + { + "relatedInstance": { + "instanceId": "0fd90c0c-0e3a-46e2-abb5-4c4820d5985b", + "modelInfo": { + "modelType": "networkInstanceGroup" + } + } + } + ], + "requestParameters": { + "autoBuildVfModules": false , + "aLaCarte": false, + "subscriptionServiceType": "test" + } + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfwithNeteworkInstanceGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfwithNeteworkInstanceGroup.json new file mode 100644 index 0000000000..fb6b9c25d3 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/VnfwithNeteworkInstanceGroup.json @@ -0,0 +1,57 @@ +{ + "requestDetails":{ + "requestInfo":{ + "productFamilyId":"e433710f-9217-458d-a79d-1c7aff376d87", + "source":"VID", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "lineOfBusiness":{ + "lineOfBusinessName":"line_of_business" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"DYH1A", + "tenantId":"7f3db563322146a688601ade1294a747" + }, + "platform":{ + + }, + "modelInfo":{ + "modelCustomizationId":"2ccae1b4-7d9e-46fa-a452-9180ce008d17", + "modelCustomizationName":"test_name", + "modelVersionId":"0f161f68-9cd8-41f3-872d-41e58d83d318", + "modelName":"modelName", + "modelInvariantId":"f501ce76-a9bc-4601-9837-74fd9f4d5ecb", + "modelType":"vnf", + "modelVersion":"7.0" + }, + "requestParameters":{ + "userParams":[ + + ], + "testApi":"GR_API" + }, + "relatedInstanceList":[ + { + "relatedInstance":{ + "instanceId":"e05864f0-ab35-47d0-8be4-56fd9619ba3c", + "modelInfo":{ + "modelVersionId":"ecd348d8-41f6-447a-93a6-4300db495688", + "modelName":"Subinterface_SVC_ym161d", + "modelInvariantId":"4c1147bd-de97-43d5-b05e-5faa9aba220d", + "modelType":"service", + "modelVersion":"5.0" + } + } + }, + { + "relatedInstance":{ + "instanceId":"1b53f649-8969-443f-8ca4-d70f2ec6de0b", + "modelInfo":{ + "modelType":"networkInstanceGroup" + } + } + } + ] + } +} \ No newline at end of file -- cgit 1.2.3-korg