diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
11 files changed, 353 insertions, 51 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 5c78af3601..ba7fe2b9cb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -192,11 +192,12 @@ public class InstanceManagementTest extends BaseTest { requestReferences.setRequestSelfLink(createExpectedSelfLink("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = instanceManagementUri + "v1" - + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testpnfcId/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf"; + + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testPnfName/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf"; ResponseEntity<String> response = sendRequest(inputStream("/ExecutePNFCustomWorkflow.json"), uri, HttpMethod.POST, headers); 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/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java index f1d5a5487f..d1e5dc717e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java @@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.doReturn; import java.io.IOException; import java.io.StringReader; import java.nio.file.Files; @@ -34,12 +35,19 @@ import javax.ws.rs.core.Response; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.onap.aai.domain.yang.Service; +import org.onap.aai.domain.yang.Tenant; import org.onap.so.apihandler.common.ErrorNumbers; +import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval; import org.onap.so.exceptions.ValidationException; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.springframework.test.context.junit4.rules.SpringClassRule; @@ -75,6 +83,17 @@ public class MsoRequestTest extends BaseTest { @Rule public ExpectedException thrown = ExpectedException.none(); + @Mock + private AAIDataRetrieval aaiDataRet; + + @InjectMocks + private MsoRequest msoRequestMock; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + } + public String inputStream(String JsonInput) throws IOException { JsonInput = "src/test/resources/MsoRequestTest" + JsonInput; String input = new String(Files.readAllBytes(Paths.get(JsonInput))); @@ -1056,5 +1075,37 @@ public class MsoRequestTest extends BaseTest { assertNotNull(result); } + @Test + public void getTenantNameFromAAITest() throws Exception { + this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"), + ServiceInstancesRequest.class); + String tenantId = "88a6ca3ee0394ade9403f075db23167e"; + String tenantNameFromAAI = "testTenantName"; + String cloudRegion = "mdt1"; + String cloudOwner = "cloudOwner"; + this.sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner); + Tenant tenant = new Tenant(); + tenant.setTenantId(tenantId); + tenant.setTenantName(tenantNameFromAAI); + doReturn(tenant).when(aaiDataRet).getTenant(cloudOwner, cloudRegion, tenantId); + String tenantName = msoRequestMock.getTenantNameFromAAI(this.sir); + assertEquals(tenantNameFromAAI, tenantName); + } + + + @Test + public void getProductFamilyNameFromAAITest() throws Exception { + this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"), + ServiceInstancesRequest.class); + String serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; + String serviceDescription = "testServiceDescription"; + Service service = new Service(); + service.setServiceId(serviceId); + service.setServiceDescription(serviceDescription); + doReturn(service).when(aaiDataRet).getService(serviceId); + String productFamilyName = msoRequestMock.getProductFamilyNameFromAAI(this.sir); + assertEquals(serviceDescription, productFamilyName); + } + } 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 f566628ee3..1332ffd913 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 @@ -441,6 +441,10 @@ public class ServiceInstancesTest extends BaseTest { .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); @@ -483,6 +487,10 @@ public class ServiceInstancesTest extends BaseTest { .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); @@ -524,6 +532,10 @@ public class ServiceInstancesTest extends BaseTest { .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service/search/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); @@ -1939,6 +1951,10 @@ public class ServiceInstancesTest extends BaseTest { .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK))); @@ -2114,6 +2130,10 @@ public class ServiceInstancesTest extends BaseTest { .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java index 0beab1bd13..21e6d53c14 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nordix + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,30 +22,15 @@ package org.onap.so.apihandlerinfra; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.List; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.json.JSONException; import org.junit.Test; import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowInputParameter; import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecifications; -import org.onap.so.db.catalog.beans.ActivitySpec; -import org.onap.so.db.catalog.beans.ActivitySpecUserParameters; -import org.onap.so.db.catalog.beans.UserParameters; -import org.onap.so.db.catalog.beans.Workflow; -import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence; +import org.onap.so.db.catalog.beans.*; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -53,10 +40,19 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.util.ResourceUtils; import org.springframework.web.util.UriComponentsBuilder; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; +import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; public class WorkflowSpecificationsHandlerTest extends BaseTest { @Autowired @@ -65,19 +61,20 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { @Value("${wiremock.server.port}") private String wiremockPort; - private final String basePath = "onap/so/infra/workflowSpecifications/v1/workflows"; + private final String basePath = "onap/so/infra/workflowSpecifications"; @Test - public void queryWorkflowSpecifications_Test_Success() + public void queryWorkflowSpecificationsByVnfModelUUID_Test_Success() throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException { + final String urlPath = basePath + "/v1/workflows"; HttpHeaders headers = new HttpHeaders(); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<String>(null, headers); wireMockServer.stubFor(get(urlMatching( - "/workflow/search/findWorkflowByModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52")) + "/workflow/search/findWorkflowByVnfModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("WorkflowSpecificationsQuery_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -147,7 +144,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { .withBody(getWiremockResponseForCatalogdb("UserParameters6_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath)) + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath)) .queryParam("vnfModelVersionId", "b5fa707a-f55a-11e7-a796-005056856d52"); ResponseEntity<String> response = @@ -174,7 +171,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { @Test public void mapWorkflowsToWorkflowSpecifications_Test_Success() throws Exception { - List<Workflow> workflows = new ArrayList<Workflow>(); + List<Workflow> workflows = new ArrayList<>(); Workflow workflow = new Workflow(); workflow.setArtifactUUID("ab6478e4-ea33-3346-ac12-ab121484a333"); workflow.setArtifactName("inPlaceSoftwareUpdate-1_0.bpmn"); @@ -267,8 +264,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { activitySpecUserParameter6.setUserParameters(userParameter6); activitySpecUserParameters.add(activitySpecUserParameter6); - List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = - new ArrayList<WorkflowActivitySpecSequence>(); + List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = new ArrayList<>(); ActivitySpec activitySpec1 = new ActivitySpec(); activitySpec1.setName("VNFQuiesceTrafficActivity"); @@ -324,6 +320,100 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest { assertThat(expectedResult, sameBeanAs(workflowSpecifications).ignoring(WorkflowInputParameter.class)); } + @Test + public void queryWorkflowSpecificationsByPnfModelUUID_Test_Success() throws JSONException, IOException { + + final String urlPath = basePath + "/v1/workflows"; + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + HttpEntity<String> entity = new HttpEntity<String>(null, headers); + + wireMockServer.stubFor(get(urlMatching( + "/workflow/search/findWorkflowByPnfModelUUID[?]pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb( + "WorkflowSpecificationsForPnfQuery_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/workflow/4/workflowActivitySpecSequence")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath)) + .queryParam("pnfModelVersionId", "f2d1f2b2-88bb-49da-b716-36ae420ccbff"); + + ResponseEntity<String> response = + restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + WorkflowSpecifications expectedResponse = mapper.readValue( + new String(Files.readAllBytes( + Paths.get("src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json"))), + WorkflowSpecifications.class); + WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(expectedResponse, sameBeanAs(realResponse)); + assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); + assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); + assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); + assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); + } + + @Test + public void testWorkflowSpecificationsForPnf_Success() throws JSONException, IOException { + + final String urlPath = basePath + "/v1/pnfWorkflows"; + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + HttpEntity<String> entity = new HttpEntity(null, headers); + + wireMockServer.stubFor(get(urlMatching("/workflow/search/findByResourceTarget[?]resource_target=pnf")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody( + getWiremockResponseForCatalogdb("WorkflowSpecificationsForPnfWorkflows_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/infraActiveRequests.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/workflow/1/workflowActivitySpecSequence")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json")) + .withStatus(org.apache.http.HttpStatus.SC_OK))); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath)); + + ResponseEntity<String> response = + restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + WorkflowSpecifications expectedResponse = mapper.readValue( + new String(Files.readAllBytes( + Paths.get("src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json"))), + WorkflowSpecifications.class); + WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(expectedResponse, sameBeanAs(realResponse)); + assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); + assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); + assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); + assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); + } + private String getWiremockResponseForCatalogdb(String file) { try { File resource = ResourceUtils.getFile("classpath:__files/catalogdb/" + file); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json index 63021b611f..09f94b61a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json @@ -1,20 +1,47 @@ { - "requestDetails": { - "requestParameters": { - "userParams": [{ - "nrmObj": { - "EUtranGenericCell" : [ - {"cellLocalId":1, "pci":5}, - {"cellLocalId":2, "pci":6} - ], - "ExternalEUtranCell" : [ - {"cellLocalId":3, "eNBId": "x"}, - {"cellLocalId":4, "eNBId": "y"} - ], - "EUtranRelation": [{"scellLocalId":5, "tcellLocalId":6}] - } - }], - "payload": "[{\"GNBDUFunction\":{\"gNBId\":1,\"gNBDUId\":5}}]" - } - } + "requestDetails":{ + "subscriberInfo":{ + "globalSubscriberId":"Test" + }, + "requestInfo":{ + "suppressRollback": false, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "requestorId": "tester", + "instanceName":"testInstanceName", + "source":"test" + }, + "cloudConfiguration":{ + "lcpCloudRegionId": "RegionOne", + "tenantId": "7320ec4a5b9d4589ba7c4412ccfd290f", + "cloudOwner": "CloudOwner" + }, + "requestParameters":{ + "subscriptionServiceType": "test", + "userParams":[ + { + "name": "key1", + "value": "val1" + }, + { + "name": "key2", + "value": "val2" + }], + "aLaCarte": false, + "payload": "{\"k1\": \"v1\"}" + }, + "project":{ + "projectName": "Test" + }, + "owningEntity":{ + "owningEntityId":"67f2e84c-734d-4e90-a1e4-d2ffa2e75849", + "owningEntityName":"OE-Test" + }, + "modelInfo":{ + "modelVersion": "2.0", + "modelVersionId": "test-version-id", + "modelInvariantId": "test-invariantUUID", + "modelName": "test-name", + "modelType": "pnf" + } + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json new file mode 100644 index 0000000000..f0d511789f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json @@ -0,0 +1,4 @@ +{ + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "service-description": "testServiceDescription" +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json new file mode 100644 index 0000000000..6779c1f3e4 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json @@ -0,0 +1,5 @@ +{ + "_embedded": { + "workflowActivitySpecSequence": [] + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json new file mode 100644 index 0000000000..b5b93873c8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json @@ -0,0 +1,20 @@ +{ + "workflowSpecificationList": [ + { + "workflowSpecification": { + "artifactInfo": { + "artifactType": "workflow", + "artifactUuid": "b2fd5627-55e4-4f4f-8064-9e6f443e9152", + "artifactName": "DummyPnfWorkflow", + "artifactVersion": "1.0", + "artifactDescription": "Dummy Pnf Workflow to test custom Pnf workflow", + "workflowName": "Dummy Pnf Workflow", + "operationName": "DummyPnfWorkflow", + "workflowSource": "native", + "workflowResourceTarget": "pnf" + }, + "workflowInputParameters": [] + } + } + ] +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json new file mode 100644 index 0000000000..a4e1bbcdc5 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json @@ -0,0 +1,41 @@ +{ + "_embedded": { + "workflow": [ + { + "artifactChecksum": "MANUAL RECORD", + "artifactName": "DummyPnfWorkflow", + "artifactUUID": "b2fd5627-55e4-4f4f-8064-9e6f443e9152", + "body": null, + "created": "2020-02-18T08:28:15.000+0000", + "description": "Dummy Pnf Workflow to test custom Pnf workflow", + "id": 4, + "name": "Dummy Pnf Workflow", + "operationName": "DummyPnfWorkflow", + "pnfResourceWorkflow": null, + "resourceTarget": "pnf", + "source": "native", + "timeoutMinutes": null, + "version": 1.0, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff" + }, + "workflow": { + "href": "http://localhost:8090/workflow/4" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence" + } + } + } + ] + }, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence" + } + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json new file mode 100644 index 0000000000..2447617897 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json @@ -0,0 +1,41 @@ +{ + "_embedded": { + "workflow": [ + { + "artifactChecksum": "MANUAL RECORD", + "artifactName": "DummyPnfWorkflow", + "artifactUUID": "b2fd5627-55e4-4f4f-8064-9e6f443e9152", + "body": null, + "created": "2020-02-18T08:28:15.000+0000", + "description": "Dummy Pnf Workflow to test custom Pnf workflow", + "id": 4, + "name": "Dummy Pnf Workflow", + "operationName": "DummyPnfWorkflow", + "pnfResourceWorkflow": null, + "resourceTarget": "pnf", + "source": "native", + "timeoutMinutes": null, + "version": 1.0, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findByResourceTarget?resource_target=pnf" + }, + "workflow": { + "href": "http://localhost:8090/workflow/4" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence" + } + } + } + ] + }, + "_links": { + "self": { + "href": "http://localhost:8090/workflow/search/findByResourceTarget?resource_target=pnf" + }, + "workflowActivitySpecSequence": { + "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 050780c9a2..85a17dd369 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -1262,7 +1262,7 @@ CREATE TABLE `infra_active_requests` ( `END_TIME` datetime DEFAULT NULL, `SOURCE` varchar(45) DEFAULT NULL, `VNF_ID` varchar(45) DEFAULT NULL, - `PNF_ID` varchar(45) DEFAULT NULL, + `PNF_NAME` varchar(45) DEFAULT NULL, `VNF_NAME` varchar(80) DEFAULT NULL, `VNF_TYPE` varchar(200) DEFAULT NULL, `SERVICE_TYPE` varchar(45) DEFAULT NULL, @@ -1297,6 +1297,8 @@ CREATE TABLE `infra_active_requests` ( `ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL, `EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL, `ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL, + `TENANT_NAME` varchar(200) DEFAULT NULL, + `PRODUCT_FAMILY_NAME` varchar(200) DEFAULT NULL, PRIMARY KEY (`REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |