diff options
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
85 files changed, 3344 insertions, 1548 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java index 4e3a930955..7bb1bdf71a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java @@ -26,10 +26,10 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.exceptions.*; -import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; + import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoAlarmLogger; + import org.onap.so.logger.MsoLogger; import java.io.IOException; @@ -102,14 +102,13 @@ public class ApiExceptionTest extends BaseTest { @Test public void testValidateException() throws ApiException { - AlarmLoggerInfo testLog = new AlarmLoggerInfo.Builder("MsoConfigurationError", MsoAlarmLogger.CRITICAL, - Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_SDNC_ADAPTER)).build(); + thrown.expect(ValidateException.class); thrown.expectMessage("Test Message"); thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND))); thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR))); - thrown.expect(hasProperty("alarmLoggerInfo", sameBeanAs(testLog))); - ValidateException testException = new ValidateException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).messageID(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).alarmInfo(testLog).build(); + + ValidateException testException = new ValidateException.Builder("Test Message", HttpStatus.SC_NOT_FOUND,ErrorNumbers.SVC_BAD_PARAMETER).messageID(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build(); throw testException; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index 4072613d09..4d4f23c083 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -31,7 +31,7 @@ import org.junit.runner.RunWith; import org.onap.so.logger.MsoLogger; import org.onap.so.logger.MsoLogger.Catalog; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; @@ -53,7 +53,6 @@ import java.nio.file.Paths; @ActiveProfiles("test") @ContextConfiguration @Transactional -//@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql") @AutoConfigureWireMock(port = 0) public abstract class BaseTest { protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class); @@ -69,6 +68,10 @@ public abstract class BaseTest { return "http://localhost:" + port + uri; } + protected String createURLWithPort(String uri, int iPort) { + return "http://localhost:" + iPort + uri; + } + @After public void tearDown(){ WireMock.reset(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java index a3d388a5c6..8d5539cf8a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java @@ -271,4 +271,4 @@ private final ObjectMapper mapper = new ObjectMapper(); RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); assertTrue(realResponse.getServiceException().getText().contains("Request Failed due to BPEL error with HTTP Status")); } -} +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedCatalogDbConfig.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedCatalogDbConfig.java index f504d88008..1e4b99d4ff 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedCatalogDbConfig.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedCatalogDbConfig.java @@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedRequestDbConfig.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedRequestDbConfig.java index d150fd773a..00efb6b410 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedRequestDbConfig.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/EmbeddedRequestDbConfig.java @@ -25,7 +25,7 @@ import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; import org.springframework.context.annotation.Bean; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java new file mode 100644 index 0000000000..45fadb540a --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java @@ -0,0 +1,236 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.apihandlerinfra; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; + +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import java.net.URI; +import java.util.Collections; +import java.util.List; + +import org.springframework.test.util.ReflectionTestUtils; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; + +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.json.JSONException; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + + +public class GlobalHealthcheckHandlerTest { + @Mock + RestTemplate restTemplate; + + @Mock + ContainerRequestContext requestContext; + + @InjectMocks + @Spy + GlobalHealthcheckHandler globalhealth; + + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Test + public void testQuerySubsystemHealthNullResult(){ + ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); + ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8080"); + + Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), + ArgumentMatchers.any(HttpMethod.class), + ArgumentMatchers.<HttpEntity<?>> any(), + ArgumentMatchers.<Class<Object>> any())).thenReturn(null); + + String result = globalhealth.querySubsystemHealth(MsoSubsystems.BPMN); + System.out.println(result); + assertEquals(HealthcheckStatus.DOWN.toString(),result); + } + + @Test + public void testQuerySubsystemHealthNotNullResult(){ + ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); + ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080"); + + SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse(); + subSystemResponse.setStatus("UP"); + ResponseEntity<Object> r = new ResponseEntity<>(subSystemResponse,HttpStatus.OK); + + Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), + ArgumentMatchers.any(HttpMethod.class), + ArgumentMatchers.<HttpEntity<?>> any(), + ArgumentMatchers.<Class<Object>> any())).thenReturn(r); + + String result = globalhealth.querySubsystemHealth(MsoSubsystems.ASDC); + System.out.println(result); + assertEquals(HealthcheckStatus.UP.toString(),result); + } + + private Response globalHealthcheck (String status){ + ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); + ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080"); + ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081"); + ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082"); + ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083"); + ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084"); + ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085"); + ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086"); + + SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse(); + + subSystemResponse.setStatus(status); + ResponseEntity<Object> r = new ResponseEntity<>(subSystemResponse,HttpStatus.OK); + Mockito.when(restTemplate.exchange(ArgumentMatchers.any(URI.class), + ArgumentMatchers.any(HttpMethod.class), + ArgumentMatchers.<HttpEntity<?>> any(), + ArgumentMatchers.<Class<Object>> any())).thenReturn(r); + + Mockito.when(requestContext.getProperty(anyString())).thenReturn("1234567890"); + Response response = globalhealth.globalHealthcheck(true, requestContext); + + return response; + } + + @Test + public void globalHealthcheckAllUPTest() throws JSONException { + Response response = globalHealthcheck("UP"); + assertEquals(Response.Status.OK.getStatusCode(),response.getStatus()); + HealthcheckResponse root; + root = (HealthcheckResponse) response.getEntity(); + String apistatus = root.getApih(); + assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String bpmnstatus = root.getBpmn(); + assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String sdncstatus = root.getSdncAdapter(); + assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String asdcstatus = root.getAsdcController(); + assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String catastatus = root.getCatalogdbAdapter(); + assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String reqdbstatus = root.getRequestdbAdapter(); + assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String openstatus = root.getOpenstackAdapter(); + assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String reqdbattstatus = root.getRequestdbAdapterAttsvc(); + assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + } + + @Test + public void globalHealthcheckAllDOWNTest() throws JSONException { + Response response = globalHealthcheck("DOWN"); + assertEquals(Response.Status.OK.getStatusCode(),response.getStatus()); + HealthcheckResponse root; + root = (HealthcheckResponse) response.getEntity(); + String apistatus = root.getApih(); + assertTrue(apistatus.equalsIgnoreCase(HealthcheckStatus.UP.toString())); + + String bpmnstatus = root.getBpmn(); + assertTrue(bpmnstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String sdncstatus = root.getSdncAdapter(); + assertTrue(sdncstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String asdcstatus = root.getAsdcController(); + assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String catastatus = root.getCatalogdbAdapter(); + assertTrue(catastatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String reqdbstatus = root.getRequestdbAdapter(); + assertTrue(reqdbstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String openstatus = root.getOpenstackAdapter(); + assertTrue(openstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + + String reqdbattstatus = root.getRequestdbAdapterAttsvc(); + assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.DOWN.toString())); + } + + @Test + public void buildHttpEntityForRequestTest(){ + HttpEntity<String> he = globalhealth.buildHttpEntityForRequest(); + assertEquals (MediaType.APPLICATION_JSON,he.getHeaders().getAccept().get(0)); + assertEquals (MediaType.APPLICATION_JSON,he.getHeaders().getContentType()); + } + + @Test + public void getEndpointUrlForSubsystemEnumTest(){ + ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage"); + ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080"); + ReflectionTestUtils.setField(globalhealth, "endpointSdnc", "http://localhost:8081"); + ReflectionTestUtils.setField(globalhealth, "endpointBpmn", "http://localhost:8082"); + ReflectionTestUtils.setField(globalhealth, "endpointCatalogdb", "http://localhost:8083"); + ReflectionTestUtils.setField(globalhealth, "endpointOpenstack", "http://localhost:8084"); + ReflectionTestUtils.setField(globalhealth, "endpointRequestdb", "http://localhost:8085"); + ReflectionTestUtils.setField(globalhealth, "endpointRequestdbAttsvc", "http://localhost:8086"); + + String result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.ASDC); + assertEquals("http://localhost:8080", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.SDNC); + assertEquals("http://localhost:8081", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.BPMN); + assertEquals("http://localhost:8082", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.CATALOGDB); + assertEquals("http://localhost:8083", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.OPENSTACK); + assertEquals("http://localhost:8084", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDB); + assertEquals("http://localhost:8085", result); + result = globalhealth.getEndpointUrlForSubsystemEnum(MsoSubsystems.REQUESTDBATT); + assertEquals("http://localhost:8086", result); + } + + @Test + public void processResponseFromSubsystemTest(){ + SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse(); + subSystemResponse.setStatus("UP"); + ResponseEntity<SubsystemHealthcheckResponse> r = new ResponseEntity<>(subSystemResponse,HttpStatus.OK); + String result = globalhealth.processResponseFromSubsystem(r,MsoSubsystems.BPMN); + assertEquals("UP",result); + } + +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java deleted file mode 100644 index 8b4d353a56..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/HealthCheckHandlerTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -import javax.ws.rs.core.Response; - -import org.json.JSONException; -import org.junit.Test; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; - - -public class HealthCheckHandlerTest extends BaseTest{ - - @Test - public void testHealthcheckGet() throws JSONException { - HttpHeaders headers = new HttpHeaders(); - HttpEntity<String> entity = new HttpEntity<String>(null, headers); - - ResponseEntity<String> response = restTemplate.exchange( - createURLWithPort("/manage/health"), - HttpMethod.GET, entity, String.class); - - assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); - assertThat(response.getBody(), containsString("UP")); - - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index f4fede15e1..bb78c822f7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -27,7 +27,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; import java.io.IOException; import java.util.Map; @@ -44,6 +45,8 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference; import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest; import org.onap.so.apihandlerinfra.tasksbeans.ValidResponses; import org.onap.so.logger.MsoLogger; +import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -52,6 +55,7 @@ import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.http.Fault; import ch.qos.logback.classic.spi.ILoggingEvent; @@ -134,4 +138,111 @@ public class ManualTasksTest extends BaseTest{ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); } } + @Test + public void completeTaskMappingError() throws IOException { + String invalidRequest = "test"; + RequestError expectedResponse = new RequestError(); + ServiceException se = new ServiceException(); + se.setMessageId("SVC0002"); + se.setText("Mapping of request to JSON object failed: Unrecognized token \'test\': " + + "was expecting \'null\', \'true\', \'false\' or NaN\n at [Source: (String)\"test\"; line: 1, column: 9]"); + expectedResponse.setServiceException(se); + + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); + headers.set(MsoLogger.CLIENT_ID, "VID"); + HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + "55" + "/complete"); + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.POST, entity, String.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertThat(realResponse, sameBeanAs(expectedResponse)); + } + @Test + public void completeTaskValidationError() throws IOException { + String taskId = "55"; + TasksRequest taskReq = new TasksRequest(); + RequestDetails reqDetail = new RequestDetails(); + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setSource("testSource"); + reqInfo.setResponseValue(ValidResponses.skip); + reqDetail.setRequestInfo(reqInfo); + taskReq.setRequestDetails(reqDetail); + + RequestError expectedResponse = new RequestError(); + ServiceException se = new ServiceException(); + se.setMessageId("SVC0002"); + se.setText("Mapping of request to JSON Object failed. No valid requestorId is specified"); + expectedResponse.setServiceException(se); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); + headers.set(MsoLogger.CLIENT_ID, "VID"); + HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.POST, entity, String.class); + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + assertThat(realResponse, sameBeanAs(expectedResponse)); + } + @Test + public void completeTaskBpelResponseError() throws IOException { + stubFor(post(urlPathEqualTo("/sobpmnengine/task/55/complete")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withFault(Fault.EMPTY_RESPONSE))); + + String taskId = "55"; + TasksRequest taskReq = new TasksRequest(); + RequestDetails reqDetail = new RequestDetails(); + RequestInfo reqInfo = new RequestInfo(); + reqInfo.setRequestorId("testId"); + reqInfo.setSource("testSource"); + reqInfo.setResponseValue(ValidResponses.skip); + reqDetail.setRequestInfo(reqInfo); + taskReq.setRequestDetails(reqDetail); + + RequestError expectedResponse = new RequestError(); + ServiceException se = new ServiceException(); + se.setMessageId("SVC1000"); + se.setText("Request Failed due to BPEL error with HTTP Status = 502"); + expectedResponse.setServiceException(se); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set(MsoLogger.ECOMP_REQUEST_ID, "987654321"); + headers.set(MsoLogger.CLIENT_ID, "VID"); + HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers); + + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath) + taskId + "/complete"); + ResponseEntity<String> response = restTemplate.exchange( + builder.toUriString(), + HttpMethod.POST, entity, String.class); + + + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + assertEquals(Response.Status.BAD_GATEWAY.getStatusCode(), response.getStatusCode().value()); + assertThat(realResponse, sameBeanAs(expectedResponse)); + } } 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 fa3ce07d70..145213fc6c 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 @@ -25,11 +25,13 @@ import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.StringReader; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.Optional; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; @@ -177,6 +179,7 @@ public class MsoRequestTest extends BaseTest { this.version = "v" + reqVersion; this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000"); this.instanceIdMapTest.put("vnfInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000"); + this.instanceIdMapTest.put("instanceGroupId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000"); thrown.expect(ValidationException.class); thrown.expectMessage(expectedException); this.msoRequest = new MsoRequest(); @@ -241,6 +244,7 @@ public class MsoRequestTest extends BaseTest { {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/v5ActivateModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/ScaleOutNoModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/VnfRecreateModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.recreateInstance, 7}, + {"No valid modelVersionId is specified", mapper.readValue(inputStream("/ModelInfo/CreateInstanceGroupNoModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 7}, //ValidationException for Platform and LineOfBusiness {"No valid lineOfBusinessName is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/EmptyLineOfBusiness.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid platform is specified", mapper.readValue(inputStream("/PlatformAndLineOfBusiness/Platform.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 6}, @@ -284,6 +288,9 @@ public class MsoRequestTest extends BaseTest { {"No valid source vnf relatedInstance for Port Configuration is specified", mapper.readValue(inputStream("/RelatedInstances/v5CreateNoSourceRelatedInstance.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid vnfInstanceId matching the vnfInstanceId in request URI is specified", mapper.readValue(inputStream("/RelatedInstances/RelatedInstancesVnfInstanceId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.activateInstance, 5}, {"No valid instanceName format is specified", mapper.readValue(inputStream("/RelatedInstances/InvalidInstanceName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 2}, + {"No valid relatedInstanceList is specified", mapper.readValue(inputStream("/RelatedInstances/CreateInstanceGroupNoRelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 7}, + {"No valid related service instance for instanceGroup request is specified", mapper.readValue(inputStream("/RelatedInstances/CreateInstanceGroupService.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 7}, + {"No valid modelVersionId in relatedInstance is specified", mapper.readValue(inputStream("/RelatedInstances/CreateInstanceGroupRelatedInstanceModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 7}, //ValidationException for RequestInfo {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/RequestInfoNull.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.createInstance, 5}, {"No valid requestInfo is specified", mapper.readValue(inputStream("/RequestInfo/RequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.applyUpdatedConfig, 6}, @@ -310,9 +317,9 @@ public class MsoRequestTest extends BaseTest { //Validation for UserParams {"No valid cloudConfiguration in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/AssignCloudConfigVnf.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid cloudConfiguration in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/NetworkCloudConfig.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid model-info in userParams is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid model-info in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsVnfModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid modelVersionId in userParams is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + {"No valid modelInfo in userParams is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + {"No valid modelInfo in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsVnfModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + {"No valid modelVersionId in userParams service modelInfo is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelVersionId in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/VnfModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelVersionId in userParams vfModule resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModuleModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelVersionId in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/NetworkModelVersionId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, @@ -320,13 +327,21 @@ public class MsoRequestTest extends BaseTest { {"No valid platformName in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/UserParamsPlatformName.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid productFamilyId in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/ProductFamilyId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid vfModules in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModules.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid model-info in userParams vfModules resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModulesModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, - {"No valid model-info in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/Network.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + {"No valid modelInfo in userParams vfModules resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModulesModelInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, + {"No valid modelInfo in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/Network.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelCustomizationId in userParams vfModule resources is specified", mapper.readValue(inputStream("/RequestParameters/VfModuleModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelCustomizationId in userParams vnf resources is specified", mapper.readValue(inputStream("/RequestParameters/VnfModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, {"No valid modelCustomizationId in userParams network resources is specified", mapper.readValue(inputStream("/RequestParameters/NetworkModelCustomizationId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.assignInstance, 7}, //Validation for ConfigurationParameters - {"No valid configuration parameters is specified", mapper.readValue(inputStream("/ConfigurationParameters/NoConfigurationParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7} + {"No valid configuration parameters is specified", mapper.readValue(inputStream("/ConfigurationParameters/NoConfigurationParameters.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.scaleOut, 7}, + //Validation for Add and Remove Members + {"No valid vnf relatedInstance is specified", mapper.readValue(inputStream("/MembersValidation/RelatedInstancesVnf.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid related instances is specified", mapper.readValue(inputStream("/MembersValidation/RelatedInstances.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid requestInfo is specified", mapper.readValue(inputStream("/MembersValidation/MembersRequestInfo.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid requestorId is specified", mapper.readValue(inputStream("/MembersValidation/MembersRequestorId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid source is specified", mapper.readValue(inputStream("/MembersValidation/AddMembersSource.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid instanceId in relatedInstances is specified", mapper.readValue(inputStream("/MembersValidation/AddMembersInstanceId.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.addMembers, 7}, + {"No valid modelType in relatedInstance is specified", mapper.readValue(inputStream("/MembersValidation/DeleteMembersModelType.json"), ServiceInstancesRequest.class), instanceIdMapTest, Action.removeMembers, 7} }); } @Test @@ -413,6 +428,18 @@ public class MsoRequestTest extends BaseTest { this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON, reqVersion, false); } @Test + public void instanceGroupIdHashMapFailureTest() throws JsonParseException, JsonMappingException, IOException, ValidationException{ + this.sir = mapper.readValue(inputStream("/SuccessfulValidation/InstanceIdHashMap.json"), ServiceInstancesRequest.class); + this.instanceIdMapTest.put("instanceGroupId", "test"); + this.action = Action.createInstance; + thrown.expect(ValidationException.class); + this.reqVersion = 7; + this.version = "v" + reqVersion; + thrown.expectMessage("No valid instanceGroupId is specified"); + this.msoRequest = new MsoRequest(); + this.msoRequest.parse(sir, instanceIdMapTest, action, version, originalRequestJSON, reqVersion, false); + } + @Test public void testVfModuleV4UsePreLoad() throws JsonParseException, JsonMappingException, IOException, ValidationException { this.requestJSON = inputStream("/SuccessfulValidation/v4CreateVfModule.json"); this.instanceIdMapTest.put("serviceInstanceId", "3eecada1-83a4-4f33-9ed2-7937e7b8dbbc"); @@ -480,4 +507,20 @@ public class MsoRequestTest extends BaseTest { String result = MsoRequest.domToStr(document); assertNotNull(result); } + + @Test + public void buildSelfLinkUrlTest() throws Exception { + // v - version + String incomingUrl = "http://localhost:8080/onap/infra/so/serviceInstantiation/v7/serviceInstances"; + String expectedSelfLink = "http://localhost:8080/orchestrationRequests/v7/efce3167-5e45-4666-9d4d-22e23648e5d1"; + String requestId = "efce3167-5e45-4666-9d4d-22e23648e5d1"; + this.msoRequest = new MsoRequest(); + Optional<URL> actualSelfLinkUrl = msoRequest.buildSelfLinkUrl(incomingUrl, requestId); + assertEquals(expectedSelfLink, actualSelfLinkUrl.get().toString()); + // V - Version + String incomingUrlV = "http://localhost:8080/onap/infra/so/serviceInstantiation/V7/serviceInstances"; + String expectedSelfLinkV = "http://localhost:8080/orchestrationRequests/V7/efce3167-5e45-4666-9d4d-22e23648e5d1"; + Optional<URL> actualSelfLinkUrlV = msoRequest.buildSelfLinkUrl(incomingUrlV, requestId); + assertEquals(expectedSelfLinkV, actualSelfLinkUrlV.get().toString()); + } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index ea2261a94a..28797d247b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -31,6 +31,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.io.File; import java.io.IOException; @@ -118,12 +119,40 @@ public class OrchestrationRequestsTest extends BaseTest { assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertThat(response.getBody(), - sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.requestStatus.finishTime")); + sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime") + .ignoring("request.requestStatus.timeStamp")); 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("7.0.0", response.getHeaders().get("X-LatestVersion").get(0)); assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0)); + assertNotNull(response.getBody().getRequest().getFinishTime()); + } + + @Test + public void testGetOrchestrationRequestInstanceGroup() throws Exception { + setupTestGetOrchestrationRequestInstanceGroup(); + // TEST VALID REQUEST + GetOrchestrationResponse testResponse = new GetOrchestrationResponse(); + + Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest(); + testResponse.setRequest(request); + String testRequestId = request.getRequestId(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); + + UriComponentsBuilder builder = UriComponentsBuilder + .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId)); + + ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET, + entity, GetOrchestrationResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), + sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime") + .ignoring("request.requestStatus.timeStamp")); } @Test @@ -149,7 +178,8 @@ public class OrchestrationRequestsTest extends BaseTest { assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertThat(response.getBody(), - sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.requestStatus.finishTime")); + sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.finishTime") + .ignoring("request.requestStatus.timeStamp")); 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)); @@ -197,7 +227,8 @@ public class OrchestrationRequestsTest extends BaseTest { ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationListResponse.class); assertThat(response.getBody(), - sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.requestStatus.finishTime")); + sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.finishTime") + .ignoring("requestList.request.requestStatus.timeStamp")); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertEquals(requests.size(), response.getBody().getRequestList().size()); @@ -401,6 +432,17 @@ public class OrchestrationRequestsTest extends BaseTest { .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json")))) .withStatus(HttpStatus.SC_OK))); } + public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception{ + //For testGetOrchestrationRequest + stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json")))) + .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) + .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json")))) + .withStatus(HttpStatus.SC_OK))); + } private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{ stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) 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 0ce31a23e3..5603ee8380 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 @@ -29,12 +29,17 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; @@ -45,15 +50,21 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException; +import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.LogConstants; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.RequestInfo; import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.RequestReferences; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @@ -68,6 +79,7 @@ import org.springframework.util.ResourceUtils; import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; @@ -78,6 +90,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; public class ServiceInstancesTest extends BaseTest{ private final ObjectMapper mapper = new ObjectMapper(); + private ObjectMapper errorMapper = new ObjectMapper(); @Autowired private ServiceInstances servInstances; @@ -88,9 +101,27 @@ public class ServiceInstancesTest extends BaseTest{ private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/"; private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/"; private String uri; + private URL selfLink; + private URL initialUrl; + private int initialPort; + private HttpHeaders headers; @Before public void beforeClass() { + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + errorMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + errorMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + // set headers + headers = new HttpHeaders(); + headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name"); + headers.set(ONAPLogConstants.Headers.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); + headers.set(MsoLogger.REQUESTOR_ID, "xxxxxx"); + try { // generate one-time port number to avoid RANDOM port number later. + initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH)); + initialPort = initialUrl.getPort(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } stubFor(post(urlMatching(".*/infraActiveRequests.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); @@ -101,6 +132,16 @@ public class ServiceInstancesTest extends BaseTest{ return new String(Files.readAllBytes(Paths.get(JsonInput))); } + private URL createExpectedSelfLink(String version, String requestId) { + System.out.println("createdUrl: " + initialUrl.toString()); + try { + selfLink = new URL(initialUrl.toString().concat("/").concat(version).concat("/").concat(requestId)); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + return selfLink; + } + private String getWiremockResponseForCatalogdb(String file) { try { File resource= ResourceUtils.getFile("classpath:__files/catalogdb/"+file); @@ -121,7 +162,7 @@ public class ServiceInstancesTest extends BaseTest{ headers.set(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON); } - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath, initialPort)); HttpEntity<String> request = new HttpEntity<>(requestJson, headers); @@ -174,20 +215,16 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(MsoLogger.CLIENT_ID, "VID"); + //expect ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5/serviceInstances"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, 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); @@ -248,17 +285,14 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - //expect ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceUriPrev7 + "v5"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers); //then assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); @@ -358,9 +392,9 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void activateServiceInstanceNoRecipeALaCarte() throws IOException{ uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; - HttpHeaders headers = new HttpHeaders(); - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST, headers); + HttpHeaders requestIDheaders = new HttpHeaders(); + requestIDheaders.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST, requestIDheaders); Service defaultService = new Service(); defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a"); @@ -419,19 +453,15 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - HttpHeaders headers = new HttpHeaders(); - headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivate.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -467,16 +497,14 @@ public class ServiceInstancesTest extends BaseTest{ .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - //expected response + //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/deactivate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivate.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -515,12 +543,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a8868/"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDelete.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDelete.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -555,16 +581,14 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); - //expected response + //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/assign"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceAssign.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceAssign.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -604,12 +628,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/unassign"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceUnassign.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceUnassign.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -620,19 +642,15 @@ public class ServiceInstancesTest extends BaseTest{ stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - HttpHeaders headers = new HttpHeaders(); - headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -651,19 +669,15 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - HttpHeaders headers = new HttpHeaders(); - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstance.json"), uri, HttpMethod.DELETE, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -677,12 +691,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/enablePort"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEnablePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEnablePort.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -697,12 +709,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/disablePort"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDisablePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDisablePort.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -717,12 +727,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/activate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivatePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceActivatePort.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -737,12 +745,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations/f7ce78bb-423b-11e7-93f8-0050569a7970/deactivate"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivatePort.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDeactivatePort.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -753,17 +759,14 @@ public class ServiceInstancesTest extends BaseTest{ stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/addRelationships"; - ResponseEntity<String> response = sendRequest(inputStream("/AddRelationships.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/AddRelationships.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -774,17 +777,14 @@ public class ServiceInstancesTest extends BaseTest{ stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/removeRelationships"; - ResponseEntity<String> response = sendRequest(inputStream("/RemoveRelationships.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/RemoveRelationships.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -816,12 +816,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/49585b36-2b5a-443a-8b10-c75d34bb5e46/vnfs"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfCreateDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/VnfCreateDefault.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -853,20 +851,15 @@ public class ServiceInstancesTest extends BaseTest{ .withBody(getWiremockResponseForCatalogdb("vnfRecipeCreateInstance_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3"; - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstance.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -883,13 +876,9 @@ public class ServiceInstancesTest extends BaseTest{ public void createVnfInstanceInvalidVnfResource() throws IOException { uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs"; ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("No valid vnfResource is specified", realResponse.getServiceException().getText()); } @Test @@ -916,12 +905,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnf.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnf.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -952,12 +939,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnfRecreate.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVnfRecreate.json"), uri, HttpMethod.POST, headers); logger.debug(response.getBody()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -988,12 +974,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/recreate"; - ResponseEntity<String> response = sendRequest(inputStream("/VnfRecreate.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/VnfRecreate.json"), uri, HttpMethod.POST, headers); logger.debug(response.getBody()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1025,12 +1010,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVnf.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVnf.json"), uri, HttpMethod.PUT, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1049,20 +1032,15 @@ public class ServiceInstancesTest extends BaseTest{ .withBody(getWiremockResponseForCatalogdb("vnfRecipeApplyUpdatedConfig_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5"; - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/applyUpdatedConfig"; ResponseEntity<String> response = sendRequest(inputStream("/ApplyUpdatedConfig.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1082,20 +1060,17 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5" + "/serviceInstances/e446b97d-9c35-437a-95a2-6b4c542c4507/vnfs/49befbfe-fccb-421d-bb4c-0734a43f5ea0"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVnfV5.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVnfV5.json"), uri, HttpMethod.DELETE, headers); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } @Test public void createVfModuleInstance() throws IOException { - stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json")) @@ -1124,12 +1099,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/7a88cbeb-0ec8-4765-a271-4f9e90c3da7b/vnfs/cbba721b-4803-4df7-9347-307c9a955426/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleWithRelatedInstances.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleWithRelatedInstances.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1185,9 +1158,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v6","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelCustomization.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelCustomization.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ObjectMapper mapper = new ObjectMapper(); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1239,9 +1213,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v6","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoMatchingModelUUID.json"), uri, HttpMethod.DELETE); + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoMatchingModelUUID.json"), uri, HttpMethod.DELETE, headers); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ObjectMapper mapper = new ObjectMapper(); @@ -1274,12 +1250,10 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules"; - ResponseEntity<String> response = sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST); - + ResponseEntity<String> response = sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST, headers); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("No valid vfModuleCustomization is specified", realResponse.getServiceException().getText()); } @Test @@ -1303,12 +1277,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace"; - ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVfModule.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ReplaceVfModule.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1345,22 +1317,18 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVfModule.json"), uri, HttpMethod.PUT); + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVfModule.json"), uri, HttpMethod.PUT, headers); logger.debug(response.getBody()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); } @Test public void createVfModuleNoModelType() throws IOException{ - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); InfraActiveRequests expectedRecord = new InfraActiveRequests(); expectedRecord.setRequestStatus("FAILED"); expectedRecord.setAction("createInstance"); @@ -1399,12 +1367,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/inPlaceSoftwareUpdate"; - ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1433,12 +1399,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModule.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModule.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1460,12 +1424,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/196b4a84-0858-4317-a1f6-497e2e52ae43/vnfs/36e4f902-ec32-451e-8d53-e3edc19e40a4/vfModules/09f3a38d-933f-450a-8784-9e6c4dec3f72"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModuleNoModelInvariantId.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVfModuleNoModelInvariantId.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1493,13 +1455,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/deactivateAndCloudDelete"; - ResponseEntity<String> response = sendRequest(inputStream("/DeactivateAndCloudDeleteVfModule.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - + ResponseEntity<String> response = sendRequest(inputStream("/DeactivateAndCloudDeleteVfModule.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")); @@ -1530,12 +1490,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups"; - ResponseEntity<String> response = sendRequest(inputStream("/VolumeGroup.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/VolumeGroup.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1568,12 +1526,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateVolumeGroup.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/UpdateVolumeGroup.json"), uri, HttpMethod.PUT, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1609,13 +1565,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-431b-adb2-eb6b9e5ff000"; - ResponseEntity<String> response = sendRequest(inputStream("/DeleteVolumeGroup.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - + ResponseEntity<String> response = sendRequest(inputStream("/DeleteVolumeGroup.json"), uri, HttpMethod.DELETE, headers); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1642,20 +1596,15 @@ public class ServiceInstancesTest extends BaseTest{ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); - String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4"; - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.ONAP_REQUEST_ID, requestId); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreate.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1685,12 +1634,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1723,12 +1670,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1751,12 +1696,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v6","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v6" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstanceNoReqParams.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstanceNoReqParams.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -1764,8 +1707,6 @@ public class ServiceInstancesTest extends BaseTest{ } @Test public void convertJsonToServiceInstanceRequestFail() throws IOException { - HttpHeaders headers = new HttpHeaders(); - headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); //ExpectedRecord InfraActiveRequests expectedRecord = new InfraActiveRequests(); expectedRecord.setRequestStatus("FAILED"); @@ -1818,17 +1759,15 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v7" + "/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceMacro.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceMacro.json"), uri, HttpMethod.POST, headers); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1857,17 +1796,15 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateAlternateInstanceName.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateAlternateInstanceName.json"), uri, HttpMethod.POST, headers); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1888,9 +1825,6 @@ public class ServiceInstancesTest extends BaseTest{ requestReferences.setInstanceId("1882939"); expectedResponse.setRequestReferences(requestReferences); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @@ -1917,17 +1851,15 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiGrApi.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiGrApi.json"), uri, HttpMethod.POST, headers); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1956,17 +1888,15 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(org.apache.http.HttpStatus.SC_OK))); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiVnfApi.json"), uri, HttpMethod.POST); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiVnfApi.json"), uri, HttpMethod.POST, headers); //expected response ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -1986,8 +1916,6 @@ public class ServiceInstancesTest extends BaseTest{ 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))); - HttpHeaders headers = new HttpHeaders(); - headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d"); stubFor(get(urlMatching(".*/service/.*")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) @@ -2003,13 +1931,11 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7999/activate"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePrev8.json"), uri, HttpMethod.POST, headers); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); @@ -2018,11 +1944,10 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void invalidRequestId() throws IOException { String illegalRequestId = "1234"; - HttpHeaders headers = new HttpHeaders(); - headers.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); - + HttpHeaders ivalidRequestIdHeaders = new HttpHeaders(); + ivalidRequestIdHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, ivalidRequestIdHeaders); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); assertTrue(response.getBody().contains("Request Id " + illegalRequestId + " is not a valid UUID")); @@ -2054,14 +1979,10 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("Request Failed due to BPEL error with HTTP Status = 202{\"instanceId\": \"1882939\"}", realResponse.getServiceException().getText()); } @Test @@ -2091,14 +2012,10 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("Exception caught mapping Camunda JSON response to object", realResponse.getServiceException().getText()); } @@ -2128,14 +2045,10 @@ public class ServiceInstancesTest extends BaseTest{ .withBody(mapper.writeValueAsString(serviceRecipe)) .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertTrue(realResponse.getServiceException().getText().contains("<aetgt:ErrorMessage>Exception in create execution list 500")); } @@ -2172,12 +2085,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v5","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceUriPrev7 + "v5"; - ResponseEntity<String> response = sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/MacroServiceInstance.json"), uri, HttpMethod.POST, headers); //then assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); @@ -2254,12 +2165,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/7a88cbeb-0ec8-4765-a271-4f9e90c3da7b/vnfs/cbba721b-4803-4df7-9347-307c9a955426/vfModules/scaleOut"; - ResponseEntity<String> response = sendRequest(inputStream("/ScaleOutRequest.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/ScaleOutRequest.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -2292,14 +2201,10 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("Exception caught mapping Camunda JSON response to object", realResponse.getServiceException().getText()); } @Test @@ -2309,16 +2214,60 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals("Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", realResponse.getServiceException().getText()); + } + @Test + public void createServiceInstanceDuplicateHistoryCheck() throws IOException{ + stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("InfraActiveRequests/createInfraActiveRequests.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("Camunda/HistoryCheckResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + + assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals("Error: Locked instance - This service (testService9) already has a request being worked with a status of UNLOCKED (RequestId - f0a35706-efc4-4e27-80ea-a995d7a2a40f). The existing request must finish or be cleaned up before proceeding.", realResponse.getServiceException().getText()); + } + @Test + public void createServiceInstanceDuplicateHistoryCheckException() throws IOException{ + stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBodyFile("InfraActiveRequests/createInfraActiveRequests.json") + .withStatus(HttpStatus.SC_ACCEPTED))); + stubFor(get(("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_f0a35706-efc4-4e27-80ea-a995d7a2a40f")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals("Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException: 500 Server Error", realResponse.getServiceException().getText()); + } + @Test + public void createServiceInstanceDuplicate() throws IOException{ + stubFor(post(urlMatching(".*/infraActiveRequests/checkInstanceNameDuplicate")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + uri = servInstanceuri + "v5/serviceInstances"; + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals("Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", realResponse.getServiceException().getText()); } + @Test public void createServiceInstanceSaveError() throws IOException{ ServiceRecipe serviceRecipe = new ServiceRecipe(); @@ -2343,14 +2292,10 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); uri = servInstanceuri + "v5/serviceInstances"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.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 @@ -2362,17 +2307,11 @@ public class ServiceInstancesTest extends BaseTest{ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK))); - HttpHeaders headers = new HttpHeaders(); - uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST, headers); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.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 @@ -2382,18 +2321,15 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations"; - ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST, headers); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.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{ + TestAppender.events.clear(); 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))); @@ -2413,18 +2349,139 @@ public class ServiceInstancesTest extends BaseTest{ .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"); + headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "VID"); //expect ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7/serviceInstances/e05864f0-ab35-47d0-8be4-56fd9619ba3c/vnfs/f501ce76-a9bc-4601-9837-74fd9f4d5eca"; ResponseEntity<String> response = sendRequest(inputStream("/VnfwithNeteworkInstanceGroup.json"), uri, HttpMethod.PUT, headers); + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + assertEquals(response.getHeaders().get(MsoLogger.TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d"); + + for(ILoggingEvent logEvent : TestAppender.events){ + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging") && + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + } + } + } + @Test + public void createInstanceGroup() 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))); + + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "/v7/instanceGroups"; + ResponseEntity<String> response = sendRequest(inputStream("/CreateInstanceGroup.json"), uri, HttpMethod.POST, 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")); + } + @Test + public void deleteInstanceGroup() 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))); + + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c"; + ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, headers); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void deleteInstanceGroupNoRequestIdHeader() throws IOException{ + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c"; + ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE); + //then + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-RequestID header is specified"); + } + @Test + public void deleteInstanceGroupNoPartnerNameHeader() throws IOException{ + HttpHeaders noPartnerHeaders = new HttpHeaders(); + noPartnerHeaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4"); + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c"; + ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noPartnerHeaders); + //then + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-PartnerName header is specified"); + } + @Test + public void deleteInstanceGroupNoRquestorIdHeader() throws IOException{ + HttpHeaders noRequestorIdHheaders = new HttpHeaders(); + noRequestorIdHheaders.set(ONAPLogConstants.Headers.REQUEST_ID, "eca3a1b1-43ab-457e-ab1c-367263d148b4"); + noRequestorIdHheaders.set(ONAPLogConstants.Headers.PARTNER_NAME, "eca3a1b1-43ab-457e-ab1c-367263d148b4"); + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c"; + ResponseEntity<String> response = sendRequest(null, uri, HttpMethod.DELETE, noRequestorIdHheaders); + + //then + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); + assertEquals(realResponse.getServiceException().getText(), "No valid X-RequestorID header is specified"); + } + @Test + public void addMembers() 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))); + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c/addMembers"; + ResponseEntity<String> response = sendRequest(inputStream("/AddMembers.json"), uri, HttpMethod.POST, headers); + + //then + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); + assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); + } + @Test + public void removeMembers() 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))); + //expect + ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); + RequestReferences requestReferences = new RequestReferences(); + requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); + expectedResponse.setRequestReferences(requestReferences); + uri = servInstanceuri + "/v7/instanceGroups/e05864f0-ab35-47d0-8be4-56fd9619ba3c/removeMembers"; + ResponseEntity<String> response = sendRequest(inputStream("/RemoveMembers.json"), uri, HttpMethod.POST, headers); //then assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); @@ -2451,12 +2508,10 @@ public class ServiceInstancesTest extends BaseTest{ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse(); RequestReferences requestReferences = new RequestReferences(); requestReferences.setInstanceId("1882939"); + requestReferences.setRequestSelfLink(createExpectedSelfLink("v7","32807a28-1a14-4b88-b7b3-2950918aa76d")); expectedResponse.setRequestReferences(requestReferences); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + ResponseEntity<String> response = sendRequest(inputStream("/NetworkInstance.json"), uri, HttpMethod.DELETE, headers); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); @@ -2469,14 +2524,100 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_NOT_FOUND))); uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks/1710966e-097c-4d63-afda-e0d3bb7015fb"; - ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - + ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT, headers); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class); + RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals(realResponse.getServiceException().getText(), "No valid modelCustomizationId for networkResourceCustomization lookup is specified"); } + + @Test + public void setServiceTypeTestALaCarte() throws JsonProcessingException{ + String requestScope = ModelType.service.toString(); + Boolean aLaCarteFlag = true; + ServiceInstancesRequest sir = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setSource("VID"); + requestDetails.setRequestInfo(requestInfo); + sir.setRequestDetails(requestDetails); + Service defaultService = new Service(); + defaultService.setServiceType("testServiceTypeALaCarte"); + + stubFor(get(urlMatching(".*/service/search/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(defaultService)) + .withStatus(HttpStatus.SC_OK))); + + String serviceType = servInstances.getServiceType(requestScope, sir, aLaCarteFlag); + assertEquals(serviceType, "testServiceTypeALaCarte"); + } + @Test + public void setServiceTypeTest() throws JsonProcessingException{ + String requestScope = ModelType.service.toString(); + Boolean aLaCarteFlag = false; + ServiceInstancesRequest sir = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a"); + requestInfo.setSource("VID"); + requestDetails.setModelInfo(modelInfo); + requestDetails.setRequestInfo(requestInfo); + sir.setRequestDetails(requestDetails); + Service defaultService = new Service(); + defaultService.setServiceType("testServiceType"); + + stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(defaultService)) + .withStatus(HttpStatus.SC_OK))); + + String serviceType = servInstances.getServiceType(requestScope, sir, aLaCarteFlag); + assertEquals(serviceType, "testServiceType"); + } + @Test + public void setServiceTypeTestDefault() throws JsonProcessingException{ + String requestScope = ModelType.service.toString(); + Boolean aLaCarteFlag = false; + ServiceInstancesRequest sir = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelVersionId("0dd91181-49da-446b-b839-cd959a96f04a"); + requestInfo.setSource("VID"); + requestDetails.setModelInfo(modelInfo); + requestDetails.setRequestInfo(requestInfo); + sir.setRequestDetails(requestDetails); + Service defaultService = new Service(); + defaultService.setServiceType("testServiceType"); + + stubFor(get(urlMatching(".*/service/0dd91181-49da-446b-b839-cd959a96f04a")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_NOT_FOUND))); + stubFor(get(urlMatching(".*/service/search/.*")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(defaultService)) + .withStatus(HttpStatus.SC_OK))); + + String serviceType = servInstances.getServiceType(requestScope, sir, aLaCarteFlag); + assertEquals(serviceType, "testServiceType"); + } + @Test + public void setServiceTypeTestNetwork() throws JsonProcessingException{ + String requestScope = ModelType.network.toString(); + Boolean aLaCarteFlag = null; + ServiceInstancesRequest sir = new ServiceInstancesRequest(); + RequestDetails requestDetails = new RequestDetails(); + RequestInfo requestInfo = new RequestInfo(); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelName("networkModelName"); + requestInfo.setSource("VID"); + requestDetails.setModelInfo(modelInfo); + requestDetails.setRequestInfo(requestInfo); + sir.setRequestDetails(requestDetails); + + String serviceType = servInstances.getServiceType(requestScope, sir, aLaCarteFlag); + assertEquals(serviceType, "networkModelName"); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java index fa323a12c2..c7b4cc0574 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/TasksHandlerTest.java @@ -120,4 +120,4 @@ public class TasksHandlerTest extends BaseTest{ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); } -} +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetailsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetailsTest.java deleted file mode 100644 index 80cd0fac2f..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestDetailsTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - - -public class RequestDetailsTest { - - RequestDetails _requestDetails; - RequestInfo _requestInfo; - - public RequestDetailsTest() { - } - - @Before - public void setUp() { - _requestDetails = mock(RequestDetails.class); - _requestInfo = new RequestInfo(); - when(_requestDetails.getRequestInfo()).thenReturn(_requestInfo); - } - - @After - public void tearDown() { - _requestDetails = null; - _requestInfo = null; - } - - /** - * Test of getRequestInfo method - */ - @Test - public void testGetRequestInfo() { - _requestDetails.setRequestInfo(_requestInfo); - assertTrue(_requestDetails.getRequestInfo().equals(_requestInfo)); - - } - - /** - * Test setRequestInfo - */ - @Test - public void testSetRequestInfo() { - _requestDetails.setRequestInfo(_requestInfo); - verify(_requestDetails).setRequestInfo(_requestInfo); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfoTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfoTest.java deleted file mode 100644 index 852376eb7a..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/RequestInfoTest.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; - -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class RequestInfoTest { - - RequestInfo _requestInfo; - String _source; - ValidResponses _responseValue; - String _requestorId; - - public RequestInfoTest() { - } - - @Before - public void setUp() { - _requestInfo = mock(RequestInfo.class); - _responseValue = ValidResponses.abort; - _requestorId = "xxxxxx"; - _source = "VID"; - when(_requestInfo.getRequestorId()).thenReturn(_requestorId); - when(_requestInfo.getSource()).thenReturn(_source); - when(_requestInfo.getResponseValue()).thenReturn(_responseValue); - - } - - @After - public void tearDown() { - _requestInfo = null; - _responseValue = null; - } - - /** - * Test of getSource method - */ - @Test - public void testGetSource() { - String result = _requestInfo.getSource(); - assertEquals(_source, result); - - } - - /** - * Test setSource - */ - @Test - public void testSetSource() { - _requestInfo.setSource("VID"); - verify(_requestInfo).setSource(_source); - } - - /** - * Test of getRequestorId method - */ - @Test - public void testGetRequestorId() { - String result = _requestInfo.getRequestorId(); - assertEquals(_requestorId, result); - - } - - /** - * Test setRequestInfo - */ - @Test - public void testSetRequestorId() { - _requestInfo.setRequestorId(_requestorId); - verify(_requestInfo).setRequestorId(_requestorId); - } - - - /** - * Test of getResponseValue method - */ - @Test - public void testGetResponseValue() { - ValidResponses result = _requestInfo.getResponseValue(); - assertEquals(_responseValue, result); - - } - - /** - * Test setResponseValues method - */ - @Test - public void testSetResponseValue() { - _requestInfo.setResponseValue(ValidResponses.abort); - verify(_requestInfo).setResponseValue(_responseValue); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskListTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskListTest.java deleted file mode 100644 index 62bfee989b..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskListTest.java +++ /dev/null @@ -1,247 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class TaskListTest { - - TaskList _taskList; - protected String _taskId; - protected String _type; - protected String _nfRole; - protected String _subscriptionServiceType; - protected String _originalRequestId; - protected String _originalRequestorId; - protected String _errorSource; - protected String _errorCode; - protected String _errorMessage; - protected String _buildingBlockName; - protected String _buildingBlockStep; - protected List<String> _validResponses; - - public TaskListTest() { - } - - @Before - public void setUp() { - _taskList = mock(TaskList.class); - _taskId = "_taskid"; - _type = "type"; - _nfRole = "nfrole"; - _subscriptionServiceType = "subscriptionservicetype"; - _originalRequestId = "originalrequestid"; - _originalRequestorId = "originalrequestorid"; - _errorSource = "errorsource"; - _errorCode = "errorcode"; - _errorMessage = "errormessage"; - _buildingBlockName = "buildingblockname"; - _buildingBlockStep = "buildingblockstep"; - _validResponses = mock(List.class); - - when(_taskList.getTaskId()).thenReturn(_taskId); - when(_taskList.getType()).thenReturn(_type); - when(_taskList.getNfRole()).thenReturn(_nfRole); - when(_taskList.getSubscriptionServiceType()).thenReturn(_subscriptionServiceType); - when(_taskList.getOriginalRequestId()).thenReturn(_originalRequestId); - when(_taskList.getOriginalRequestorId()).thenReturn(_originalRequestorId); - when(_taskList.getErrorSource()).thenReturn(_errorSource); - when(_taskList.getErrorCode()).thenReturn(_errorCode); - when(_taskList.getErrorMessage()).thenReturn(_errorMessage); - when(_taskList.getBuildingBlockName()).thenReturn(_buildingBlockName); - when(_taskList.getBuildingBlockStep()).thenReturn(_buildingBlockStep); - when(_taskList.getValidResponses()).thenReturn(_validResponses); - } - - @After - public void tearDown() { - _taskList = null; - _validResponses = null; - } - - @Test - public void testGetTaskId() { - String result = _taskList.getTaskId(); - assertEquals(_taskId, result); - - } - - @Test - public void testSetTaskId() { - _taskList.setTaskId("_taskid"); - verify(_taskList).setTaskId(_taskId); - } - - @Test - public void testGetType() { - String result = _taskList.getType(); - assertEquals(_type, result); - - } - - @Test - public void testSetType() { - _taskList.setType(_type); - verify(_taskList).setType(_type); - } - - @Test - public void testGetNfRole() { - String result = _taskList.getNfRole(); - assertEquals(_nfRole, result); - - } - - @Test - public void testSetNfRole() { - _taskList.setType(_nfRole); - verify(_taskList).setType(_nfRole); - } - - @Test - public void testGetSubscriptionServiceType() { - String result = _taskList.getSubscriptionServiceType(); - assertEquals(_subscriptionServiceType, result); - - } - - @Test - public void testSetSubscriptionServiceType() { - _taskList.setSubscriptionServiceType(_subscriptionServiceType); - verify(_taskList).setSubscriptionServiceType(_subscriptionServiceType); - } - - @Test - public void testGetOriginalRequestId() { - String result = _taskList.getOriginalRequestId(); - assertEquals(_originalRequestId, result); - - } - - @Test - public void testSetOriginalRequestId() { - _taskList.setOriginalRequestId(_originalRequestId); - verify(_taskList).setOriginalRequestId(_originalRequestId); - } - - @Test - public void testGetOriginalRequestorId() { - String result = _taskList.getOriginalRequestorId(); - assertEquals(_originalRequestorId, result); - - } - - @Test - public void testSetOriginalRequestorId() { - _taskList.setOriginalRequestorId(_originalRequestorId); - verify(_taskList).setOriginalRequestorId(_originalRequestorId); - } - - @Test - public void testGetErrorSource() { - String result = _taskList.getErrorSource(); - assertEquals(_errorSource, result); - - } - - @Test - public void testSetErrorSource() { - _taskList.setErrorSource(_errorSource); - verify(_taskList).setErrorSource(_errorSource); - } - - @Test - public void testGetErrorCode() { - String result = _taskList.getErrorCode(); - assertEquals(_errorCode, result); - - } - - @Test - public void testSetErrorCode() { - _taskList.setErrorCode(_errorCode); - verify(_taskList).setErrorCode(_errorCode); - } - - @Test - public void testGetErrorMessage() { - String result = _taskList.getErrorMessage(); - assertEquals(_errorMessage, result); - - } - - @Test - public void testSetErrorMessage() { - _taskList.setErrorMessage(_errorMessage); - verify(_taskList).setErrorMessage(_errorMessage); - } - - @Test - public void testGetBuildingBlockName() { - String result = _taskList.getBuildingBlockName(); - assertEquals(_buildingBlockName, result); - - } - - @Test - public void testSetBuildingBlockName() { - _taskList.setBuildingBlockName(_buildingBlockName); - verify(_taskList).setBuildingBlockName(_buildingBlockName); - } - - @Test - public void testGetBuildingBlockStep() { - String result = _taskList.getBuildingBlockStep(); - assertEquals(_buildingBlockStep, result); - - } - - @Test - public void testSetBuildingBlockStep() { - _taskList.setBuildingBlockStep(_buildingBlockStep); - verify(_taskList).setBuildingBlockStep(_buildingBlockStep); - } - - @Test - public void testGetValidResponses() { - - List<String> result = _taskList.getValidResponses(); - assertEquals(_validResponses, result); - - } - - @Test - public void testSetValidResponses() { - _taskList.setValidResponses(_validResponses); - verify(_taskList).setValidResponses(_validResponses); - } - - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java deleted file mode 100644 index 043f4ea93d..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskRequestReferenceTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; - -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class TaskRequestReferenceTest { - - TaskRequestReference _taskRequestReference; - - protected String _taskId; - public TaskRequestReferenceTest() { - } - - @Before - public void setUp() { - _taskRequestReference = mock(TaskRequestReference.class); - _taskId = "taskid"; - - when(_taskRequestReference.getTaskId()).thenReturn(_taskId); - } - - @After - public void tearDown() { - _taskRequestReference = null; - } - - /** - * Test getTaskRequestReference - */ - @Test - public void taskGetRequestReference() { - String result = _taskRequestReference.getTaskId(); - assertEquals(_taskId, result); - } - - /** - * Test setTaskRequestReference - */ - @Test - public void testSetRequestInfo() { - _taskRequestReference.setTaskId(_taskId); - verify(_taskRequestReference).setTaskId(_taskId); - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValueTest.java deleted file mode 100644 index bc6a5ab890..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariableValueTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class TaskVariableValueTest { - TaskVariableValue _taskVariableValue; - protected String _name; - protected String _value; - protected String _operator; - - public TaskVariableValueTest() { - } - - @Before - public void setUp() { - _taskVariableValue = mock(TaskVariableValue.class); - _name = "name"; - _value = "value"; - _operator = "operator"; - when(_taskVariableValue.getName()).thenReturn(_name); - when(_taskVariableValue.getValue()).thenReturn(_value); - when(_taskVariableValue.getOperator()).thenReturn(_operator); - } - - @After - public void tearDown() { - _taskVariableValue = null; - } - - /** - * Test of getName method - */ - @Test - public void testGetName() { - _taskVariableValue.setName(_name); - assertEquals(_taskVariableValue.getName(),_name); - - } - - /** - * Test setName - */ - @Test - public void testSetName() { - _taskVariableValue.setName(_name); - verify(_taskVariableValue).setName(_name); - } - - /** - * Test of getName method - */ - @Test - public void testGetValue() { - _taskVariableValue.setValue(_value); - assertEquals(_taskVariableValue.getValue(),_value); - - } - - /** - * Test setName - */ - @Test - public void testSetValue() { - _taskVariableValue.setValue(_value); - verify(_taskVariableValue).setValue(_value); - } - - /** - * Test of getName method - */ - @Test - public void testGetOperator() { - _taskVariableValue.setOperator(_operator); - assertEquals(_taskVariableValue.getOperator(),_operator); - - } - - /** - * Test setName - */ - @Test - public void testSetRequestDetails() { - _taskVariableValue.setOperator(_operator); - verify(_taskVariableValue).setOperator(_operator); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariablesTest.java deleted file mode 100644 index 8e2c3ae7da..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TaskVariablesTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; - -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.List; - -public class TaskVariablesTest { - - TaskVariables _taskVariables; - private List<TaskVariableValue> _taskVariableValueList; - - public TaskVariablesTest() { - } - - @SuppressWarnings("unchecked") - @Before - public void setUp() { - _taskVariables = mock(TaskVariables.class); - _taskVariableValueList = mock(List.class); - when(_taskVariables.getTaskVariables()).thenReturn(_taskVariableValueList); - } - - @After - public void tearDown() { - _taskVariables = null; - } - - @Test - public void testGetTaskVariables() { - List<TaskVariableValue> result = _taskVariables.getTaskVariables(); - assertEquals(_taskVariableValueList, result); - - } - - @Test - public void testSetTaskVariables() { - _taskVariables.setTaskVariables(_taskVariableValueList); - verify(_taskVariables).setTaskVariables(_taskVariableValueList); - - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/ValueTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksBeansTest.java index dc5cf8ed39..cbdfe6b831 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/ValueTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksBeansTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,49 +20,22 @@ package org.onap.so.apihandlerinfra.tasksbeans; -import org.junit.After; -import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import org.onap.so.apihandlerinfra.BaseTest; -public class ValueTest { - Value _valueInstance; - protected String _value; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; - public ValueTest() { - } - - @Before - public void setUp() { - _valueInstance = mock(Value.class); - _value = "_value"; - when(_valueInstance.getValue()).thenReturn(_value); - } - - @After - public void tearDown() { - _valueInstance = null; - } - - /** - * Test of getValue method - */ - @Test - public void testGetValue() { - _valueInstance.setValue(_value); - assertEquals(_valueInstance.getValue(),_value); - - } - - /** - * Test setValue - */ +public class TasksBeansTest extends BaseTest{ @Test - public void testSetValue() { - _valueInstance.setValue(_value); - verify(_valueInstance).setValue(_value); + public void validateGettersAndSetters() { + Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule()) + .with(new SetterTester(), new GetterTester()).build(); + validator.validate("org.onap.so.apihandlerinfra.tasksbeans", new FilterPackageInfo()); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponseTest.java deleted file mode 100644 index f4ec27e852..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksGetResponseTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; - -import static org.junit.Assert.assertEquals; -import org.junit.Before; -import org.junit.Test; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.List; - -public class TasksGetResponseTest { - - TasksGetResponse _tasksGetResponse; - private List<TaskList> _taskList; - - public TasksGetResponseTest() { - } - - @SuppressWarnings("unchecked") - @Before - public void setUp() { - _tasksGetResponse = mock(TasksGetResponse.class); - _taskList = mock(List.class); - when(_tasksGetResponse.getTaskList()).thenReturn(_taskList); - } - - @After - public void tearDown() { - _tasksGetResponse = null; - } - - @Test - public void testGetTaskList() { - List<TaskList> result = _tasksGetResponse.getTaskList(); - assertEquals(_taskList, result); - - } - - @Test - public void testSetTaskList() { - _tasksGetResponse.setTaskList(_taskList); - verify(_tasksGetResponse).setTaskList(_taskList); - - } -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequestTest.java deleted file mode 100644 index 09af2b0a52..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/TasksRequestTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - - -public class TasksRequestTest { - TasksRequest _tasksRequest; - private RequestDetails _requestDetails; - - public TasksRequestTest() { - } - - @Before - public void setUp() { - _tasksRequest = mock(TasksRequest.class); - _requestDetails = new RequestDetails(); - when(_tasksRequest.getRequestDetails()).thenReturn(_requestDetails); - } - - @After - public void tearDown() { - _tasksRequest = null; - } - - /** - * Test of getRequestDetails method - */ - @Test - public void testGetRequestDetails() { - _tasksRequest.setRequestDetails(_requestDetails); - assertTrue(_tasksRequest.getRequestDetails().equals(_requestDetails)); - - } - - /** - * Test setRequestDetails - */ - @Test - public void testSetRequestDetails() { - _tasksRequest.setRequestDetails(_requestDetails); - verify(_tasksRequest).setRequestDetails(_requestDetails); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/VariablesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/VariablesTest.java deleted file mode 100644 index d79e5f6294..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tasksbeans/VariablesTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.apihandlerinfra.tasksbeans; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class VariablesTest { - - Variables _variables; - protected Value _source; - protected Value _responseValue; - protected Value _requestorId; - - @Before - public void setUp() { - _variables = mock(Variables.class); - _source = mock(Value.class); - _responseValue = mock(Value.class); - _requestorId = mock(Value.class); - - when(_variables.getSource()).thenReturn(_source); - when(_variables.getRequestorId()).thenReturn(_requestorId); - when(_variables.getResponseValue()).thenReturn(_responseValue); - - } - - @After - public void tearDown() { - _variables = null; - _source = null; - _responseValue = null; - _requestorId = null; - } - - @Test - public void testGetSource() { - _variables.setSource(_source); - assertTrue(_variables.getSource().equals(_source)); - } - - @Test - public void testSetSource(){ - _variables.setSource(_source); - verify(_variables).setSource(_source); - } - - @Test - public void testGetResponseValue() { - _variables.setResponseValue(_responseValue); - assertTrue(_variables.getResponseValue().equals(_responseValue)); - } - - @Test - public void testSetResponseValue(){ - _variables.setResponseValue(_responseValue); - verify(_variables).setResponseValue(_responseValue); - } - - @Test - public void testGetRequestorId() { - _variables.setRequestorId(_requestorId); - assertTrue(_variables.getRequestorId().equals(_requestorId)); - } - - @Test - public void testSetRequestorId(){ - _variables.setRequestorId(_requestorId); - verify(_variables).setRequestorId(_requestorId); - } - -} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java index 37ec14a0b5..9a8f4880f7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java @@ -25,9 +25,9 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.contains; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.contains; import static org.mockito.Mockito.doNothing; import javax.inject.Provider; @@ -43,7 +43,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.ApiHandlerApplication; import org.onap.so.apihandlerinfra.BaseTest; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java index 9aa961c665..0a57b4f245 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/AAIClientHelperTest.java @@ -28,8 +28,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java index 7fd92d2d7e..76bf0b0dbc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelperTest.java @@ -7,9 +7,9 @@ * 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 - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,9 +41,9 @@ public class SDCClientHelperTest extends BaseTest{ String operationalEnvironmentId = "TEST_operationalEnvironmentId"; String workloadContext = "TEST_workloadContext"; - @Autowired - private SDCClientHelper sdcClientUtils; - + @Autowired + private SDCClientHelper sdcClientUtils; + @Test public void postActivateOperationalEnvironment_Test() throws ApiException { @@ -51,77 +51,77 @@ public class SDCClientHelperTest extends BaseTest{ jsonObject.put("statusCode", "202"); jsonObject.put("message", "Success"); jsonObject.put("distributionId", "TEST_distributionId"); - + stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED))); - + JSONObject jsonResponse = sdcClientUtils.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); - + assertEquals("202", jsonResponse.get("statusCode")); assertEquals("Success", jsonResponse.get("message")); - } - + } + @Test public void postActivateOperationalEnvironment_InvalidJson_Test() throws ApiException { - + // ERROR in asdc response, invalid json object JSONObject jsonErrorResponse = new JSONObject(); - jsonErrorResponse.put("requestError", ""); - + jsonErrorResponse.put("requestError", ""); + stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_uuid1/distr.*")) .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonErrorResponse.toString()).withStatus(HttpStatus.SC_BAD_REQUEST))); - + JSONObject jsonResponse = sdcClientUtils.postActivateOperationalEnvironment(serviceModelVersionId, operationalEnvironmentId, workloadContext); - + assertEquals("500", jsonResponse.get("statusCode")); assertEquals("", jsonResponse.get("messageId")); assertEquals(" Encountered Error while calling SDC POST Activate. JSONObject[\"requestError\"] is not a JSONObject.", jsonResponse.get("message")); - } - + } + @Test public void buildUriBuilderTest() { - - try { + + try { String url = sdcClientUtils.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId); assertEquals("http://localhost:" + env.getProperty("wiremock.server.port") + "/sdc/v1/catalog/services/TEST_uuid1/distribution/TEST_operationalEnvironmentId/activate", url); - + } catch (Exception e) { fail("Exception caught: " + e.getMessage()); - } - } + } + } + - @Test public void buildJsonWorkloadContextTest() throws JSONException { - + String jsonPayload = sdcClientUtils.buildJsonWorkloadContext(workloadContext); assertEquals("{\"workloadContext\":\"TEST_workloadContext\"}", jsonPayload); - - } - + + } + @Test public void enhanceJsonResponseTest_Success() throws JSONException { - + // build success response data JSONObject sdcResponseJsonObj = new JSONObject(); sdcResponseJsonObj.put("distributionId", "TEST_distributionId"); int statusCode = 202; sdcResponseJsonObj = sdcClientUtils.enhanceJsonResponse(sdcResponseJsonObj, statusCode); - + assertEquals("202", sdcResponseJsonObj.getString("statusCode")); assertEquals("", sdcResponseJsonObj.getString("messageId")); assertEquals("Success", sdcResponseJsonObj.getString("message")); assertEquals("TEST_distributionId", sdcResponseJsonObj.getString("distributionId")); - - } - + + } + @Test public void enhanceJsonResponseTest_Error() throws JSONException { - + // build error response data JSONObject jsonMessages = new JSONObject(); jsonMessages.put("messageId", "SVC4675"); @@ -132,20 +132,20 @@ public class SDCClientHelperTest extends BaseTest{ jsonErrorRequest.put("requestError", jsonServException); String responseData = jsonErrorRequest.toString(); - + JSONObject sdcResponseJsonObj = new JSONObject(responseData); int statusCode = 409; sdcResponseJsonObj = sdcClientUtils.enhanceJsonResponse(sdcResponseJsonObj, statusCode); - + assertEquals("409", sdcResponseJsonObj.getString("statusCode")); assertEquals("SVC4675", sdcResponseJsonObj.getString("messageId")); assertEquals("Error: Service state is invalid for this action.", sdcResponseJsonObj.getString("message")); - - } + + } @Test public void enhanceJsonResponseTest_Error_policyException() throws JSONException { - + // build error response data JSONObject jsonMessages = new JSONObject(); jsonMessages.put("messageId", "POL5003"); @@ -156,20 +156,20 @@ public class SDCClientHelperTest extends BaseTest{ jsonErrorRequest.put("requestError", jsonServException); String responseData = jsonErrorRequest.toString(); - + JSONObject sdcResponseJsonObj = new JSONObject(responseData); int statusCode = 403; sdcResponseJsonObj = sdcClientUtils.enhanceJsonResponse(sdcResponseJsonObj, statusCode); - + assertEquals("403", sdcResponseJsonObj.getString("statusCode")); assertEquals("POL5003", sdcResponseJsonObj.getString("messageId")); assertEquals("Error: Not authorized to use the API.", sdcResponseJsonObj.getString("message")); - - } - + + } + @Test public void enhanceJsonResponseTest_Error_UnexpectedFormat() throws JSONException { - + // build error response data JSONObject jsonMessages = new JSONObject(); jsonMessages.put("messageId", "POL5003"); @@ -180,15 +180,15 @@ public class SDCClientHelperTest extends BaseTest{ jsonErrorRequest.put("unexpectedResponseTag", jsonServException); String responseData = jsonErrorRequest.toString(); - + JSONObject sdcResponseJsonObj = new JSONObject(responseData); int statusCode = 403; sdcResponseJsonObj = sdcClientUtils.enhanceJsonResponse(sdcResponseJsonObj, statusCode); - + assertEquals("500", sdcResponseJsonObj.getString("statusCode")); assertEquals("Undefined Error Message!", sdcResponseJsonObj.getString("messageId")); assertEquals("Unexpected response format from SDC.", sdcResponseJsonObj.getString("message")); - - } - + + } + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 585eff23c4..ce1dde835d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -89,7 +89,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/infraActiveRequests/")) - .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: SUCCESSFULLY Created ECOMP OperationalEnvironment.\",\"progress\":100")) + .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: SUCCESSFULLY Created ECOMP OperationalEnvironment.\",\"rollbackStatusMessage\":null,\"flowStatus\":null,\"retryStatusMessage\":null,\"progress\":100")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java index 809e39c772..100bc82f7a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java @@ -52,6 +52,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ private CloudOrchestrationRequest request; private ServiceEndPointList serviceEndpoints; + private ServiceEndPointList serviceEndpoints2; @Autowired private CreateVnfOperationalEnvironment createVnfOpEnv; @@ -63,6 +64,8 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ request = mapper.readValue(jsonRequest, CloudOrchestrationRequest.class); String jsonServiceEndpoints = getFileContentsAsString("__files/vnfoperenv/endpoints.json"); serviceEndpoints = mapper.readValue(jsonServiceEndpoints, ServiceEndPointList.class); + String jsonServiceEndpoints2 = getFileContentsAsString("__files/vnfoperenv/endpoints2.json"); + serviceEndpoints2 = mapper.readValue(jsonServiceEndpoints2, ServiceEndPointList.class); } @Test public void testGetEcompManagingEnvironmentId() throws Exception { @@ -83,6 +86,13 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ assertEquals("DEV", createVnfOpEnv.getEnvironmentName(props)); } + @Test + public void testGetEnvironmentNameEndpointListBeginWithUpperCase() { + createVnfOpEnv.setRequest(request); + List<Property> props = serviceEndpoints2.getServiceEndPointList().get(0).getProperties(); + assertEquals("DEV", createVnfOpEnv.getEnvironmentName(props)); + } + @Test public void testBuildServiceNameForVnf() throws Exception { createVnfOpEnv.setRequest(request); @@ -141,4 +151,34 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); createVnfOpEnv.execute(requestId, request); } + + @Test + public void testExecuteEndpointsListBeginWithUppercase() throws ApiException, JsonProcessingException { + stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); + stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/endpoints2.json").withStatus(HttpStatus.SC_ACCEPTED))); + stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/add")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED))); + stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED))); + String requestId = UUID.randomUUID().toString(); + InfraActiveRequests iar = new InfraActiveRequests(); + iar.setRequestId(requestId); + iar.setOperationalEnvName("myOpEnv"); + iar.setRequestScope("create"); + iar.setRequestStatus("PENDING"); + iar.setRequestAction("UNKNOWN"); + ObjectMapper mapper = new ObjectMapper(); + stubFor(post(urlPathEqualTo("/infraActiveRequests/")) + .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + + stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId)) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(mapper.writeValueAsString(iar)) + .withStatus(HttpStatus.SC_OK))); + createVnfOpEnv.execute(requestId, request); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java new file mode 100644 index 0000000000..c1c4915672 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/validation/UserParamsValidationTest.java @@ -0,0 +1,109 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.apihandlerinfra.validation; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Map; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.apihandlerinfra.Action; +import org.onap.so.exceptions.ValidationException; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class UserParamsValidationTest{ + + UserParamsValidation validation = new UserParamsValidation(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + public ValidationInformation setupValidationInformation(String path) throws IOException{ + String jsonInput = new String(Files.readAllBytes(Paths.get(path))); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest sir = mapper.readValue(jsonInput, ServiceInstancesRequest.class); + ValidationInformation info = new ValidationInformation(sir, null, Action.createInstance, 7, false, sir.getRequestDetails().getRequestParameters()); + for(Map<String, Object> params : sir.getRequestDetails().getRequestParameters().getUserParams()){ + ObjectMapper obj = new ObjectMapper(); + String input = obj.writeValueAsString(params.get("service")); + Service validate = obj.readValue(input, Service.class); + info.setUserParams(validate); + break; + } + info.setRequestInfo(sir.getRequestDetails().getRequestInfo()); + return info; + } + + @Test + public void validateModelTypeExceptionTest() throws IOException, ValidationException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("No valid modelType in userParams service modelInfo is specified"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelInfoNoModelType.json")); + } + @Test + public void validateInstanceNameExceptionTest() throws IOException, ValidationException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("instanceName in requestInfo does not match instanceName in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/MacroRequest.json")); + } + @Test + public void validateModelTypeTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelType in modelInfo does not match modelType in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelType.json")); + } + @Test + public void validateModelInvariantIdTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelInvariantId in modelInfo does not match modelInvariantId in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelInvariantId.json")); + } + @Test + public void validateModelVersionIdTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelVersionId in modelInfo does not match modelVersionId in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelVersionId.json")); + } + @Test + public void validateModelNameTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelName in modelInfo does not match modelName in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelName.json")); + } + @Test + public void validateModelVersionTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelVersion in modelInfo does not match modelVersion in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelVersion.json")); + } + @Test + public void validateModelCustomizationIdTest() throws ValidationException, IOException{ + thrown.expect(ValidationException.class); + thrown.expectMessage("modelCustomizationId in modelInfo does not match modelCustomizationId in userParams service"); + validation.validate(setupValidationInformation("src/test/resources/Validation/UserParamsValidation/ModelCustomizationId.json")); + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java new file mode 100644 index 0000000000..6555a9a66e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.grm; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.matching; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import java.io.File; +import java.nio.file.Files; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.apihandlerinfra.BaseTest; +import org.onap.so.apihandlerinfra.TestAppender; +import org.onap.so.client.grm.GRMClient; +import org.onap.so.client.grm.beans.ServiceEndPoint; +import org.onap.so.client.grm.beans.ServiceEndPointList; +import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest; +import org.onap.so.client.grm.beans.ServiceEndPointRequest; +import org.onap.so.client.grm.exceptions.GRMClientCallFailed; +import org.slf4j.MDC; + +import ch.qos.logback.classic.spi.ILoggingEvent; + + +public class GRMClientTest extends BaseTest{ + + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private static final String uuidRegex = "(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-5][0-9a-f]{3}-?[089ab][0-9a-f]{3}-?[0-9a-f]{12}$"; + + @BeforeClass + public static void setUp() throws Exception { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void testFind() throws Exception { + TestAppender.events.clear(); + String endpoints = getFileContentsAsString("__files/grm/endpoints.json"); + stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", MediaType.APPLICATION_JSON) + .withBody(endpoints))); + + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, "/test"); + GRMClient client = new GRMClient(); + ServiceEndPointList sel = client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST"); + List<ServiceEndPoint> list = sel.getServiceEndPointList(); + assertEquals(3, list.size()); + + boolean foundInvoke = false; + boolean foundInvokeReturn = false; + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") && + logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("GRM",mdc.get("TargetEntity")); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + foundInvoke=true; + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("INVOKE_RETURN")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + foundInvokeReturn=true; + } + + if(!foundInvoke) + fail("INVOKE Marker not found"); + + if(!foundInvokeReturn) + fail("INVOKE RETURN Marker not found"); + + verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + .withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex)) + .withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex)) + .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO"))); + TestAppender.events.clear(); + } + + @Test + public void testFindFail() throws Exception { + stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + .willReturn(aResponse() + .withStatus(400) + .withHeader("Content-Type", MediaType.APPLICATION_JSON) + .withBody(""))); + + GRMClient client = new GRMClient(); + thrown.expect(GRMClientCallFailed.class); + client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST"); + } + + @Test + public void testAddFail() throws Exception { + stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", MediaType.APPLICATION_JSON) + .withBody("test"))); + ServiceEndPointRequest request = new ServiceEndPointRequest(); + GRMClient client = new GRMClient(); + thrown.expect(GRMClientCallFailed.class); + client.addServiceEndPoint(request); + } + + @Test + public void testBuildServiceEndPointLookupRequest() { + GRMClient client = new GRMClient(); + ServiceEndPointLookupRequest request = client.buildServiceEndPointlookupRequest("TEST.ECOMP_PSL.Inventory", 1, "DEV"); + assertEquals("TEST.ECOMP_PSL.Inventory", request.getServiceEndPoint().getName()); + assertEquals(Integer.valueOf(1), Integer.valueOf(request.getServiceEndPoint().getVersion().getMajor())); + assertEquals("DEV", request.getEnv()); + + } + + protected String getFileContentsAsString(String fileName) { + String content = ""; + try { + ClassLoader classLoader = this.getClass().getClassLoader(); + File file = new File(classLoader.getResource(fileName).getFile()); + content = new String(Files.readAllBytes(file.toPath())); + } + catch(Exception e) { + e.printStackTrace(); + System.out.println("Exception encountered reading " + fileName + ". Error: " + e.getMessage()); + } + return content; + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql index a5d38e6478..6d8e2e8b09 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql @@ -1,15 +1,16 @@ -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES -('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null), -('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null), -('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null), -('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null), -('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null); -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES -('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null), -('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null), -('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null),('0017f68c-eb2d-45bb-b7c7-ec31b37dc350', null, 'createInstance', 'IN_PROGRESS', 'Error parsing request. +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('0017f68c-eb2d-45bb-b7c7-ec31b37dc350', null, 'createInstance', 'IN_PROGRESS', 'Error parsing request. No valid instanceName is specified', null, '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', '1882938', null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"serviceInstanceId":"1882939","vnfInstanceId":"1882938","networkInstanceId":"1882937","volumeGroupInstanceId":"1882935","vfModuleInstanceId":"1882934","requestDetails":{"requestInfo":{"source":"VID","requestorId":"xxxxxx","instanceName":"testService9"},"requestParameters":{"aLaCarte":true,"autoBuildVfModules":false,"subscriptionServiceType":"test"},"modelInfo":{"modelInvariantId":"f7ce78bb-423b-11e7-93f8-0050569a7965","modelVersion":"1","modelVersionId":"10","modelType":"service","modelName":"serviceModel","modelInstanceName":"modelInstanceName","modelCustomizationId":"f7ce78bb-423b-11e7-93f8-0050569a796"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"}}}', - null, 'APIH', null, null, '1882935', null, '1882934', null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', '1882939', 'testService10', 'xxxxxx', 'test', null, null, null); + null, 'APIH', null, null, '1882935', null, '1882934', null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', '1882939', 'testService10', 'xxxxxx', 'test', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); COMMIT;
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersInstanceId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersInstanceId.json new file mode 100644 index 0000000000..10805134da --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersInstanceId.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersSource.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersSource.json new file mode 100644 index 0000000000..ca4798e79f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/AddMembersSource.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "requestInfo": { + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be related vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/DeleteMembersModelType.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/DeleteMembersModelType.json new file mode 100644 index 0000000000..d3afee1189 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/DeleteMembersModelType.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be related vnf-id}", + "modelInfo": { + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestInfo.json new file mode 100644 index 0000000000..c4240a86b8 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestInfo.json @@ -0,0 +1,14 @@ +{ + "requestDetails": { + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be related vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestorId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestorId.json new file mode 100644 index 0000000000..8564b605d2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/MembersRequestorId.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be removed as member vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstances.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstances.json new file mode 100644 index 0000000000..616f79b651 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstances.json @@ -0,0 +1,15 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "requestParameters": { + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstancesVnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstancesVnf.json new file mode 100644 index 0000000000..0d3396481e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/MembersValidation/RelatedInstancesVnf.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "96f40d14-705d-40d9-b829-3dab90811321", + "modelInfo": { + "modelType": "vfModule" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/CreateInstanceGroupNoModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/CreateInstanceGroupNoModelVersionId.json new file mode 100644 index 0000000000..0bac9ce4b2 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/ModelInfo/CreateInstanceGroupNoModelVersionId.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "96f40d14-705d-40d9-b829-3dab90811321", + "modelInfo": { + "modelType": "service" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +} + diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoModelCustomizationId.json new file mode 100644 index 0000000000..058daf2aa9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoModelCustomizationId.json @@ -0,0 +1,33 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "96f40d14-705d-40d9-b829-3dab90811321", + "modelInfo": { + "modelType": "service" + } + } + }, + { + "relatedInstance": { + "modelInfo": { + "modelType": "service" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +} + diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoRelatedInstances.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoRelatedInstances.json new file mode 100644 index 0000000000..5827c52f3b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupNoRelatedInstances.json @@ -0,0 +1,16 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "requestParameters": { + "userParams": [] + } + } +} + diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupRelatedInstanceModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupRelatedInstanceModelVersionId.json new file mode 100644 index 0000000000..d855078fef --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupRelatedInstanceModelVersionId.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc", + "modelInfo": { + "modelType": "service" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupService.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupService.json new file mode 100644 index 0000000000..0d3396481e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RelatedInstances/CreateInstanceGroupService.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "96f40d14-705d-40d9-b829-3dab90811321", + "modelInfo": { + "modelType": "vfModule" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignCloudConfigVnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignCloudConfigVnf.json index 9e571e6e37..9d575695c5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignCloudConfigVnf.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/AssignCloudConfigVnf.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "testModelName", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "testModelName", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json index 26bb2172f8..a7d930f756 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/Network.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json index 6b32f3ebe3..75e8fb5cd1 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkCloudConfig.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json index 1aa6094513..baf620b668 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelCustomizationId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json index 1fddf7970b..6c152855ee 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/NetworkModelVersionId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/ProductFamilyId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/ProductFamilyId.json index f9a5ea9a01..3f93139587 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/ProductFamilyId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/ProductFamilyId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelVersionId.json index 8d3ed69863..f3592c2e05 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelVersionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsModelVersionId.json @@ -34,8 +34,10 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatform.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatform.json index f05fdb06ba..0fbe1dadcc 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatform.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatform.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatformName.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatformName.json index 4436baffe4..e94c5aad13 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatformName.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsPlatformName.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsVnfModelInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsVnfModelInfo.json index e31523f99d..c19784f2fe 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsVnfModelInfo.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/UserParamsVnfModelInfo.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelCustomizationId.json index 0cf4928581..f315ff89a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelCustomizationId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelCustomizationId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json index 5362b439dc..91e71839a2 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModuleModelVersionId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModules.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModules.json index ad1c02e37b..fedaad42df 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModules.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModules.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModulesModelInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModulesModelInfo.json index 81904fe66a..612586c84f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModulesModelInfo.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VfModulesModelInfo.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelCustomizationId.json index 5b4097793c..8709619fb9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelCustomizationId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelCustomizationId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelVersionId.json index b52be1f4c2..9c650ad439 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelVersionId.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/RequestParameters/VnfModelVersionId.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json index 2d7ab4ae7c..bc6f8fc610 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/MsoRequestTest/SuccessfulValidation/ServiceAssign.json @@ -34,9 +34,11 @@ { "service": { "modelInfo": { - "modelName": "MOW vMX BV 1 Service", - "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0b" + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW vMX BV 1 Service", + "modelVersion": "10" }, "instanceParams": [], "resources": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json index 561ed0d31f..dde4392c38 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json @@ -27,9 +27,9 @@ }, "requestStatus": { "requestState": "COMPLETE", - "statusMessage": "COMPLETED", + "statusMessage": "STATUS: COMPLETED", "percentProgress": 100, - "finishTime": "Tue, 02 May 2017 06:33:34 GMT" + "timeStamp": "Fri, 01 Jul 2016 04:41:42 GMT" } } }, @@ -61,9 +61,9 @@ }, "requestStatus": { "requestState": "COMPLETE", - "statusMessage": "Vf Module has been deleted successfully.", + "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.", "percentProgress": 100, - "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT" } } }, @@ -95,9 +95,9 @@ }, "requestStatus": { "requestState": "PENDING", - "statusMessage": "Vf Module deletion pending.", + "statusMessage": "STATUS: Vf Module deletion pending.", "percentProgress": 0, - "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT" } } }, @@ -179,9 +179,9 @@ }, "requestStatus": { "requestState": "UNLOCKED", - "statusMessage": "Vf Module deletion pending.", + "statusMessage": "STATUS: Vf Module deletion pending.", "percentProgress": 0, - "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + "timeStamp": "Mon, 30 Jul 2018 06:09:01 GMT" } } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json index 1b1530d3a6..ecbf7a92a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json @@ -26,8 +26,9 @@ }, "requestStatus":{ "requestState":"COMPLETE", - "statusMessage":"Vf Module has been deleted successfully.", - "percentProgress":100 + "statusMessage":"STATUS: Vf Module has been deleted successfully.", + "percentProgress":100, + "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT" } } }, @@ -57,8 +58,9 @@ }, "requestStatus":{ "requestState":"PENDING", - "statusMessage":"Vf Module deletion pending.", - "percentProgress":0 + "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.", + "percentProgress":0, + "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT" } } }, @@ -293,6 +295,37 @@ "statusMessage":"Error parsing request.\n\tNo valid instanceName is specified" } } + }, + { + "request":{ + "requestId":"00032ab7-na18-42e5-965d-8ea592502018", + "requestScope":"instanceGroup", + "requestType":"addMembers", + "requestDetails":{ + "modelInfo":{ + "modelType":"vfModule", + "modelName":"test::base::module-0" + }, + "requestInfo":{ + "source":"VID", + "suppressRollback":false + }, + "cloudConfiguration":{ + "tenantId":"6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId":"n6" + } + }, + "instanceReferences":{ + "instanceGroupId": "00032ab7-na18-42e5-965d-8ea592502019", + "instanceGroupName": "testInstanceGroup" + }, + "requestStatus":{ + "requestState":"PENDING", + "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.", + "percentProgress":0, + "timeStamp": "Thu, 22 Dec 2016 08:30:28 GMT" + } + } } ] -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json index ada3cced48..8953dfdfe0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json @@ -2,7 +2,7 @@ "clientRequestId": "00032ab7-fake-42e5-965d-8ea592502018", "action": "deleteInstance", "requestStatus": "PENDING", - "statusMessage": "Vf Module deletion pending.", + "statusMessage": null, "progress": 0, "startTime": "2016-12-22T13:29:54.000+0000", "endTime": "2016-12-22T13:30:28.000+0000", @@ -42,6 +42,9 @@ "configurationName": null, "operationalEnvId": null, "operationalEnvName": null, + "rollbackStatusMessage": "Rollback has been completed successfully.", + "flowStatus": "Building blocks 1 of 3 completed.", + "retryStatusMessage": "Retry 2/5 will be started in 8 min.", "requestURI": "00032ab7-na18-42e5-965d-8ea592502018", "_links": { "self": { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json new file mode 100644 index 0000000000..e0ea6a805b --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json @@ -0,0 +1,59 @@ +{ + "clientRequestId": "00032ab7-fake-42e5-965d-8ea592502018", + "action": "addMembers", + "requestStatus": "PENDING", + "statusMessage": "Adding members.", + "progress": 0, + "startTime": "2016-12-22T13:29:54.000+0000", + "endTime": "2016-12-22T13:30:28.000+0000", + "source": "VID", + "vnfId": null, + "vnfName": null, + "vnfType": null, + "serviceType": null, + "aicNodeClli": null, + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "provStatus": null, + "vnfParams": null, + "vnfOutputs": null, + "requestBody": "{\"requestDetails\": {\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"test::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"n6\"}}}", + "responseBody": null, + "lastModifiedBy": "BPMN", + "modifyTime": "2016-12-22T13:30:28.000+0000", + "requestType": null, + "volumeGroupId": null, + "volumeGroupName": null, + "vfModuleId": null, + "vfModuleName": null, + "vfModuleModelName": "test::base::module-0", + "aaiServiceId": null, + "aicCloudRegion": "n6", + "callBackUrl": null, + "correlator": null, + "serviceInstanceId": null, + "serviceInstanceName": null, + "requestScope": "instanceGroup", + "requestAction": "addMembers", + "networkId": null, + "networkName": null, + "networkType": null, + "requestorId": null, + "configurationId": null, + "configurationName": null, + "operationalEnvId": null, + "operationalEnvName": null, + "rollbackStatusMessage": "Rollback has been completed successfully.", + "flowStatus": "Building blocks 1 of 3 completed.", + "retryStatusMessage": "Retry 2/5 will be started in 8 min.", + "requestURI": "00032ab7-na18-42e5-965d-8ea592502018", + "instanceGroupId": "00032ab7-na18-42e5-965d-8ea592502019", + "instanceGroupName": "testInstanceGroup", + "_links": { + "self": { + "href": "http://localhost:8087/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018" + }, + "infraActiveRequests": { + "href": "http://localhost:8087/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json index 9e429a0176..0f71dd48d3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json @@ -91,7 +91,9 @@ "configurationName": null, "operationalEnvId": null, "operationalEnvName": null, - "requestURI": "00032ab7-3fb3-42e5-965d-8ea592502017" + "requestURI": "00032ab7-3fb3-42e5-965d-8ea592502017", + "rollbackStatusMessage": "Rollback has been completed successfully.", + "flowStatus":"Building blocks 1 of 3 completed." }, { "requestId": "00032ab7-na18-42e5-965d-8ea592502018", diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AddMembers.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AddMembers.json new file mode 100644 index 0000000000..e9d056c3dc --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AddMembers.json @@ -0,0 +1,18 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be related vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CreateInstanceGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CreateInstanceGroup.json new file mode 100644 index 0000000000..474c8015a7 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CreateInstanceGroup.json @@ -0,0 +1,26 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "instanceGroup", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + }, + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc", + "modelInfo": { + "modelType": "service", + "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/MembersRequestInfo.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/MembersRequestInfo.json new file mode 100644 index 0000000000..58f83ef917 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/MembersRequestInfo.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be related vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/RemoveMembers.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/RemoveMembers.json new file mode 100644 index 0000000000..437f19dc8d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/RemoveMembers.json @@ -0,0 +1,18 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{the to be removed as member vnf-id}", + "modelInfo": { + "modelType": "vnf" + } + } + } + ] + } +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json index 7625bf7589..fd8b7c4e69 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceAssign.json @@ -35,9 +35,10 @@ "service":{ "modelInfo":{ "modelType":"service", - "modelName":"MOW", - "modelVersionId":"3c40d244-808e-42ca-b09a-256d83d19d0a", - "modelCustomizationId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + "modelInvariantId":"5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId":"3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName":"MOW vMX BV 1 Service", + "modelVersion":"10.0" }, "instanceParams":[ diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/MacroRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/MacroRequest.json new file mode 100644 index 0000000000..c3ee53b3b4 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/MacroRequest.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelCustomizationId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelCustomizationId.json new file mode 100644 index 0000000000..f5209ac774 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelCustomizationId.json @@ -0,0 +1,137 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbad" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbae" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInfoNoModelType.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInfoNoModelType.json new file mode 100644 index 0000000000..ffcb48daf3 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInfoNoModelType.json @@ -0,0 +1,134 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInvariantId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInvariantId.json new file mode 100644 index 0000000000..13796ed3f9 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelInvariantId.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531e", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelName.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelName.json new file mode 100644 index 0000000000..0410b9c50d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelName.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST2", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelType.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelType.json new file mode 100644 index 0000000000..f287864a93 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelType.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "vnf", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersion.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersion.json new file mode 100644 index 0000000000..ed2dffeb41 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersion.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "2.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersionId.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersionId.json new file mode 100644 index 0000000000..feb08a3b6d --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/Validation/UserParamsValidation/ModelVersionId.json @@ -0,0 +1,135 @@ +{ + "requestDetails": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daee", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "requestInfo": { + "productFamilyId": "testaaS", + "source": "VID", + "suppressRollback": false, + "requestorId": "ss616y", + "instanceName": "instanceName" + }, + "subscriberInfo": { + "globalSubscriberId": "21014aa2-526b-11e6-beb8-9e71128cae77" + }, + "requestParameters": { + "subscriptionServiceType": "test", + "userParams": [ + { + "service": { + "modelInfo": { + "modelInvariantId": "282bdcd2-34ed-4665-9ab2-63455814531d", + "modelType": "service", + "modelName": "MOW_ADIG_test_BV_IST", + "modelVersion": "1.0", + "modelVersionId": "109a153e-325f-4df5-8161-edd91314daed", + "modelUuid": "109a153e-325f-4df5-8161-edd91314daee", + "modelInvariantUuid": "282bdcd2-34ed-4665-9ab2-63455814531d" + }, + "instanceName" : "test", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_bandwidth": "10", + "mow_adig_test_bv_ist0_ASN": "2685", + "mow_adig_test_bv_ist0_availability_zone_0": "mdt25b-kvm-az01", + "mow_adig_test_bv_ist0_AIC_CLLI": "MTSNJA4LCP1", + "mow_adig_test_bv_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_bv_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth_units": "Gbps" + } + ], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelCustomizationName": "MOW_ADIG_test_BV_IST 0", + "modelCustomizationId": "31d41ef2-0a3e-43bf-a4f0-0b1f31b1cbac", + "modelInvariantId": "33fb95d0-5f18-4dfb-8e7d-0c8ac8d743c5", + "modelVersionId": "bdf50902-4b07-4dcf-a2e2-ec6cfe568798", + "modelName": "MOW_ADIG_test_BV_IST", + "modelType": "service", + "modelVersion": "2.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt25b", + "tenantId": "aefb697db6524ddebfe4915591b0a347" + }, + "platform": { + "platformName": "AIC" + }, + "lineOfBusiness": {}, + "productFamilyId": "testaaS", + "instanceParams": [ + { + "mow_adig_test_bv_ist0_vnf_config_template": "17.2", + "mow_adig_test_bv_ist0_vnf_instance": "wswdc403me6", + "mow_adig_test_bv_ist0_bandwidth": "Gbps" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelCustomizationId": "34c57c2d-cf19-4926-9296-acde6a967f70", + "modelInvariantId": "f3093158-a609-41d5-a2fb-07dbc0ca8096", + "modelVersionId": "2507f79d-6e1b-413b-b2a8-c434113ff862", + "modelName": "MowAdigtestBvIst..ADIG_vRE_BV_v2..module-1", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [ + { + "mow_adig_test_ist0_vnf_config_template_version": "17.2", + "mow_adig_test_ist0_vnf_instance_name": "wswdc403me6", + "mow_adig_test_ist0_bandwidth_units": "Gbps" + } + ] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelCustomizationId": "f4a414c4-b71a-43ed-82be-51478d7e154f", + "modelInvariantId": "af867fdc-3808-4b62-ae76-bdb1b9ae7ee8", + "modelVersionId": "3fcf6cb6-2ef2-4154-99a6-06ce889c79f1", + "modelName": "MowAdigtestBvIst..ADIG_base_test_BV_v2..module-0", + "modelType": "service", + "modelVersion": "1" + }, + "instanceParams": [] + }, + { + "modelInfo": { + "modelCustomizationName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelCustomizationId": "583c2280-23d9-4338-a607-69c238d4899d", + "modelInvariantId": "90c2be4f-cb6f-4e75-9c65-04fdc5c30cef", + "modelVersionId": "7c8a69e0-6612-4b7b-8e9c-fb8b9f31cb4f", + "modelName": "MowAdigtestBvIst..ADIG_vPFE_BV_v2..module-2", + "modelType": "service", + "modelVersion": "1" + } + } + ] + } + ] + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "GigaPower" + }, + "owningEntity": { + "owningEntityId": "2811e2fb-005e-40de-990b-c0794f362399", + "owningEntityName": "PACKET-CORE" + } + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponse.json new file mode 100644 index 0000000000..196c71e010 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponse.json @@ -0,0 +1,21 @@ +[ + { + "id":"d1a0456e-1458-11e9-8afb-0242ac190006", + "businessKey":null, + "processDefinitionId":"86cfa113-141a-11e9-8afb-0242ac190006", + "processDefinitionKey":"UnassignServiceInstanceATTBB", + "processDefinitionName":"UnassignServiceInstanceATTBB", + "processDefinitionVersion":1, + "startTime":"2019-01-09T21:52:11.813+0000", + "endTime":"2019-01-09T21:52:12.353+0000", + "durationInMillis":540, + "startUserId":null, + "startActivityId":"Start_UnassignServiceInstanceBB", + "deleteReason":null, + "superProcessInstanceId":"d15f6c9e-1458-11e9-8afb-0242ac190006", + "superCaseInstanceId":null, + "caseInstanceId":null, + "tenantId":null, + "state":"ACTIVE" + } +]
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponseCompleted.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponseCompleted.json new file mode 100644 index 0000000000..fdf0e9a286 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/Camunda/HistoryCheckResponseCompleted.json @@ -0,0 +1,21 @@ +[ + { + "id":"d1a0456e-1458-11e9-8afb-0242ac190006", + "businessKey":null, + "processDefinitionId":"86cfa113-141a-11e9-8afb-0242ac190006", + "processDefinitionKey":"UnassignServiceInstanceATTBB", + "processDefinitionName":"UnassignServiceInstanceATTBB", + "processDefinitionVersion":1, + "startTime":"2019-01-09T21:52:11.813+0000", + "endTime":"2019-01-09T21:52:12.353+0000", + "durationInMillis":540, + "startUserId":null, + "startActivityId":"Start_UnassignServiceInstanceBB", + "deleteReason":null, + "superProcessInstanceId":"d15f6c9e-1458-11e9-8afb-0242ac190006", + "superCaseInstanceId":null, + "caseInstanceId":null, + "tenantId":null, + "state":"COMPLETED" + } +]
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/createInfraActiveRequests.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/createInfraActiveRequests.json index 822d847cf6..6be015694c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/createInfraActiveRequests.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/createInfraActiveRequests.json @@ -1 +1,50 @@ -{"requestId":"%1$s","clientRequestId":null,"action":"activateInstance","requestStatus":"UNLOCKED","statusMessage":null,"progress":20,"startTime":1506422369000,"endTime":null,"source":"VID","vnfId":null,"vnfName":null,"vnfType":null,"serviceType":null,"aicNodeClli":null,"tenantId":null,"provStatus":null,"vnfParams":null,"vnfOutputs":null,"requestBody":"{\"modelInfo\":{\"modelCustomizationName\":null,\"modelInvariantId\":\"1587cf0e-f12f-478d-8530-5c55ac578c39\",\"modelType\":\"configuration\",\"modelNameVersionId\":null,\"modelName\":null,\"modelVersion\":null,\"modelCustomizationUuid\":null,\"modelVersionId\":\"36a3a8ea-49a6-4ac8-b06c-89a545444455\",\"modelCustomizationId\":\"68dc9a92-214c-11e7-93ae-92361f002671\",\"modelUuid\":null,\"modelInvariantUuid\":null,\"modelInstanceName\":null},\"requestInfo\":{\"billingAccountNumber\":null,\"callbackUrl\":null,\"correlator\":null,\"orderNumber\":null,\"productFamilyId\":null,\"orderVersion\":null,\"source\":\"VID\",\"instanceName\":null,\"suppressRollback\":false,\"requestorId\":\"xxxxxx\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceName\":null,\"instanceId\":\"9e15a443-af65-4f05-9000-47ae495e937d\",\"modelInfo\":{\"modelCustomizationName\":null,\"modelInvariantId\":\"de19ae10-9a25-11e7-abc4-cec278b6b50a\",\"modelType\":\"service\",\"modelNameVersionId\":null,\"modelName\":\"Infra_Configuration_Service\",\"modelVersion\":\"1.0\",\"modelCustomizationUuid\":null,\"modelVersionId\":\"ee938612-9a25-11e7-abc4-cec278b6b50a\",\"modelCustomizationId\":null,\"modelUuid\":null,\"modelInvariantUuid\":null,\"modelInstanceName\":null},\"instanceDirection\":null}}],\"subscriberInfo\":null,\"cloudConfiguration\":{\"aicNodeClli\":null,\"tenantId\":null,\"lcpCloudRegionId\":\"n6\"},\"requestParameters\":{\"subscriptionServiceType\":null,\"userParams\":[],\"aLaCarte\":false,\"autoBuildVfModules\":false,\"cascadeDelete\":false,\"usePreload\":true},\"project\":null,\"owningEntity\":null,\"platform\":null,\"lineOfBusiness\":null}","responseBody":null,"lastModifiedBy":"APIH","modifyTime":1532945172000,"requestType":null,"volumeGroupId":null,"volumeGroupName":null,"vfModuleId":null,"vfModuleName":null,"vfModuleModelName":null,"aaiServiceId":null,"aicCloudRegion":"n6","callBackUrl":null,"correlator":null,"serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d","serviceInstanceName":null,"requestScope":"configuration","requestAction":"activateInstance","networkId":null,"networkName":null,"networkType":null,"requestorId":"xxxxxx","configurationId":"26ef7f15-57bb-48df-8170-e59edc26234c","configurationName":null,"operationalEnvId":null,"operationalEnvName":null,"handler":{},"requestURI":"http://localhost:8087/infraActiveRequests/%1$s"} +{ + "requestId":"f0a35706-efc4-4e27-80ea-a995d7a2a40f", + "clientRequestId":null, + "action":"activateInstance", + "requestStatus":"UNLOCKED", + "statusMessage":null, + "progress":20, + "startTime":1506422369000, + "endTime":null, + "source":"VID", + "vnfId":null, + "vnfName":null, + "vnfType":null, + "serviceType":null, + "aicNodeClli":null, + "tenantId":null, + "provStatus":null, + "vnfParams":null, + "vnfOutputs":null, + "requestBody":"{\"modelInfo\":{\"modelCustomizationName\":null,\"modelInvariantId\":\"1587cf0e-f12f-478d-8530-5c55ac578c39\",\"modelType\":\"configuration\",\"modelNameVersionId\":null,\"modelName\":null,\"modelVersion\":null,\"modelCustomizationUuid\":null,\"modelVersionId\":\"36a3a8ea-49a6-4ac8-b06c-89a545444455\",\"modelCustomizationId\":\"68dc9a92-214c-11e7-93ae-92361f002671\",\"modelUuid\":null,\"modelInvariantUuid\":null,\"modelInstanceName\":null},\"requestInfo\":{\"billingAccountNumber\":null,\"callbackUrl\":null,\"correlator\":null,\"orderNumber\":null,\"productFamilyId\":null,\"orderVersion\":null,\"source\":\"VID\",\"instanceName\":null,\"suppressRollback\":false,\"requestorId\":\"xxxxxx\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceName\":null,\"instanceId\":\"9e15a443-af65-4f05-9000-47ae495e937d\",\"modelInfo\":{\"modelCustomizationName\":null,\"modelInvariantId\":\"de19ae10-9a25-11e7-abc4-cec278b6b50a\",\"modelType\":\"service\",\"modelNameVersionId\":null,\"modelName\":\"Infra_Configuration_Service\",\"modelVersion\":\"1.0\",\"modelCustomizationUuid\":null,\"modelVersionId\":\"ee938612-9a25-11e7-abc4-cec278b6b50a\",\"modelCustomizationId\":null,\"modelUuid\":null,\"modelInvariantUuid\":null,\"modelInstanceName\":null},\"instanceDirection\":null}}],\"subscriberInfo\":null,\"cloudConfiguration\":{\"aicNodeClli\":null,\"tenantId\":null,\"lcpCloudRegionId\":\"n6\"},\"requestParameters\":{\"subscriptionServiceType\":null,\"userParams\":[],\"aLaCarte\":false,\"autoBuildVfModules\":false,\"cascadeDelete\":false,\"usePreload\":true},\"project\":null,\"owningEntity\":null,\"platform\":null,\"lineOfBusiness\":null}", + "responseBody":null, + "lastModifiedBy":"APIH", + "modifyTime":1532945172000, + "requestType":null, + "volumeGroupId":null, + "volumeGroupName":null, + "vfModuleId":null, + "vfModuleName":null, + "vfModuleModelName":null, + "aaiServiceId":null, + "aicCloudRegion":"n6", + "callBackUrl":null, + "correlator":null, + "serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d", + "serviceInstanceName":null, + "requestScope":"configuration", + "requestAction":"activateInstance", + "networkId":null, + "networkName":null, + "networkType":null, + "requestorId":"xxxxxx", + "configurationId":"26ef7f15-57bb-48df-8170-e59edc26234c", + "configurationName":null, + "operationalEnvId":null, + "operationalEnvName":null, + "handler":{ + + }, + "requestURI":"http://localhost:8087/infraActiveRequests/%1$s" +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/grm/endpoints.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/grm/endpoints.json new file mode 100644 index 0000000000..7e92c21c9e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/grm/endpoints.json @@ -0,0 +1,145 @@ +{ + "serviceEndPointList": [ + { + "name": "dummy.pod.ns.dummy-pod3", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.218", + "listenPort": "32004", + "latitude": "37.7022", + "longitude": "121.9358", + "registrationTime": "2017-07-18T15:39:17.367+0000", + "expirationTime": "9999-10-09T15:39:17.368+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:17.367+0000", + "updatedTimestamp": "2017-07-18T15:39:17.367+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + }, + { + "name": "dummy.pod.ns.dummy-pod3", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.22", + "listenPort": "32004", + "latitude": "1.0", + "longitude": "1.0", + "registrationTime": "2017-07-18T15:39:17.816+0000", + "expirationTime": "9999-10-09T15:39:17.817+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:17.816+0000", + "updatedTimestamp": "2017-07-18T15:39:17.816+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + }, + { + "name": "dummy.pod.ns.dummy-pod1", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.218", + "listenPort": "32002", + "latitude": "1.0", + "longitude": "1.0", + "registrationTime": "2017-07-18T15:39:14.443+0000", + "expirationTime": "9999-10-09T15:39:14.453+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:14.443+0000", + "updatedTimestamp": "2017-07-18T15:39:14.443+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + } + ] +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json new file mode 100644 index 0000000000..7c9816ff55 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/vnfoperenv/endpoints2.json @@ -0,0 +1,145 @@ +{ + "ServiceEndPointList": [ + { + "name": "dummy.pod.ns.dummy-pod3", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.218", + "listenPort": "32004", + "latitude": "37.7022", + "longitude": "121.9358", + "registrationTime": "2017-07-18T15:39:17.367+0000", + "expirationTime": "9999-10-09T15:39:17.368+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:17.367+0000", + "updatedTimestamp": "2017-07-18T15:39:17.367+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + }, + { + "name": "dummy.pod.ns.dummy-pod3", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.22", + "listenPort": "32004", + "latitude": "1.0", + "longitude": "1.0", + "registrationTime": "2017-07-18T15:39:17.816+0000", + "expirationTime": "9999-10-09T15:39:17.817+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:17.816+0000", + "updatedTimestamp": "2017-07-18T15:39:17.816+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + }, + { + "name": "dummy.pod.ns.dummy-pod1", + "version": { + "major": 1, + "minor": 0, + "patch": "0" + }, + "hostAddress": "192.168.120.218", + "listenPort": "32002", + "latitude": "1.0", + "longitude": "1.0", + "registrationTime": "2017-07-18T15:39:14.443+0000", + "expirationTime": "9999-10-09T15:39:14.453+0000", + "contextPath": "/", + "routeOffer": "DEFAULT", + "statusInfo": { + "status": "RUNNING" + }, + "eventStatusInfo": { + "status": "RUNNING" + }, + "validatorStatusInfo": { + "status": "RUNNING" + }, + "operationalInfo": { + "createdBy": "edge", + "updatedBy": "edge", + "createdTimestamp": "2017-07-18T15:39:14.443+0000", + "updatedTimestamp": "2017-07-18T15:39:14.443+0000" + }, + "protocol": "dummypod-port", + "properties": [ + { + "name": "Environment", + "value": "DEV" + }, + { + "name": "Kubernetes Namespace", + "value": "dummy-pod-ns" + }, + { + "name": "cpfrun_cluster_name", + "value": "CI-PDK1-TFINIT-CJ9125401" + } + ], + "disableType": [] + } + ] +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml index b7b6a8c1cb..63eb0534ea 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml @@ -6,17 +6,17 @@ server: max-threads: 50 ssl-enable: false -apih-healthcheck-urn: /ecomp/mso/healthcheck,/ecomp/mso/homing/healthcheck,/ecomp/mso/infra/healthcheck,/asdc/healthcheck,/dbadapters/healthcheck,/ecomp/mso/catalog/v2/healthcheck -jra-healthcheck-urn: /networks/rest/healthcheck,/adapters/rest/healthcheck,/vnfs/rest/healthcheck,/tenants/rest/healthcheck,/appc/rest/healthcheck,/workflows/messages/healthcheck -camunda-healthcheck-urn: /mso/healthcheck - -apih-nodehealthcheck-urn: /ecomp/mso/infra/nodehealthcheck -jra-nodehealthcheck-urn: /adapters/rest/nodehealthcheck -camunda-nodehealthcheck-urn: /mso/nodehealthcheck - - - mso: + health: + endpoints: + catalogdb: http://localhost:${wiremock.server.port} + requestdb: http://localhost:${wiremock.server.port} + sdnc: http://localhost:${wiremock.server.port} + openstack: http://localhost:${wiremock.server.port} + bpmn: http://localhost:${wiremock.server.port} + asdc: http://localhost:${wiremock.server.port} + requestdbattsvc: http://localhost:${wiremock.server.port} + infra-requests: archived: period: 180 @@ -48,14 +48,14 @@ mso: apiMinorVersion: 0 apiPatchVersion: 0 camundaURL: http://localhost:${wiremock.server.port}/ - camundaAuth: F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D + camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE async: core-pool-size: 50 max-pool-size: 50 queue-capacity: 500 sdc: client: - auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862 + auth: 97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF activate: instanceid: test userid: cs0008 @@ -67,11 +67,10 @@ mso: count: 3 aai: endpoint: http://localhost:${wiremock.server.port} - auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C grm: endpoint: http://localhost:${wiremock.server.port} - username: gmruser - password: test + auth: 6AAD26000E278148A0B987436D9696A5B2D99BBF0DC545F9E64D6DF05298FFA987A6CF565F6F274EBC085678 so: operational-environment: dmaap: @@ -84,12 +83,11 @@ mso: spring: datasource: - url: jdbc:mariadb://localhost:3307/catalogdb + jdbc-url: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never + initialization-mode: always jpa: generate-ddl: false show-sql: false @@ -108,24 +106,21 @@ spring: role: InfraPortal-Client request: datasource: - url: jdbc:mariadb://localhost:3307/requestdb + jdbc-url: jdbc:mariadb://localhost:3307/requestdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver - intialize: false mariaDB4j: dataDir: port: 3307 databaseName: catalogdb databaseName2: requestdb -#Actuator -management: - context-path: /manage - endpoints: - enabled-by-default: false - endpoint: - info: - enabled: true - health: - enabled: true
\ No newline at end of file + + +org: + onap: + so: + adapters: + network: + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql index afcd7330f3..712cb98c07 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql @@ -1,19 +1,20 @@ --Changes here should also be made in InfraActiveRequestsReset.sql to be re-inserted after tests -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES -('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null), -('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null), -('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null), -('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null), -('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null); -INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME) VALUES -('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null), -('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null), -('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null),('0017f68c-eb2d-45bb-b7c7-ec31b37dc350', null, 'createInstance', 'IN_PROGRESS', 'Error parsing request. +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, null), +('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails": {"modelInfo": {"modelType": "vfModule","modelName": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); +INSERT INTO requestdb.infra_active_requests(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES +('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, null), +('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"Infra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'), +('0017f68c-eb2d-45bb-b7c7-ec31b37dc350', null, 'createInstance', 'IN_PROGRESS', 'Error parsing request. No valid instanceName is specified', null, '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', '1882938', null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"serviceInstanceId":"1882939","vnfInstanceId":"1882938","networkInstanceId":"1882937","volumeGroupInstanceId":"1882935","vfModuleInstanceId":"1882934","requestDetails":{"requestInfo":{"source":"VID","requestorId":"xxxxxx","instanceName":"testService9"},"requestParameters":{"aLaCarte":true,"autoBuildVfModules":false,"subscriptionServiceType":"test"},"modelInfo":{"modelInvariantId":"f7ce78bb-423b-11e7-93f8-0050569a7965","modelVersion":"1","modelVersionId":"10","modelType":"service","modelName":"serviceModel","modelInstanceName":"modelInstanceName","modelCustomizationId":"f7ce78bb-423b-11e7-93f8-0050569a796"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"}}}', - null, 'APIH', null, null, '1882935', null, '1882934', null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', '1882939', 'testService10', 'xxxxxx', 'test', null, null, null); + null, 'APIH', null, null, '1882935', null, '1882934', null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', '1882939', 'testService10', 'xxxxxx', 'test', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'); INSERT INTO requestdb.site_status(SITE_NAME, STATUS, CREATION_TIMESTAMP) VALUES 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 98b26a4be2..95db1c2b7a 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 @@ -520,36 +520,29 @@ default character set = latin1; engine = innodb auto_increment = 20654 default character set = latin1; - create table if not exists `service_proxy` ( - `model_uuid` varchar(200) not null, - `model_invariant_uuid` varchar(200) not null, - `model_version` varchar(20) not null, - `model_name` varchar(200) not null, - `description` varchar(1200) null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_uuid`)) - engine = innodb auto_increment = 20654 - default character set = latin1; - -create table if not exists `service_proxy_customization` ( -`model_customization_uuid` varchar(200) not null, -`model_instance_name` varchar(200) not null, -`tosca_node_type` varchar(200) not null, -`source_service_model_uuid` varchar(200) not null, -`creation_timestamp` datetime not null default current_timestamp, -`service_proxy_model_uuid` varchar(200) not null, -primary key (`model_customization_uuid`), -index `fk_service_proxy_customization__service_proxy1_idx` (`service_proxy_model_uuid` asc), -index `fk_service_proxy_customization__service1_idx` (`source_service_model_uuid` asc), -constraint`fk_spr_customization__service_proxy_resource1` -foreign key (`service_proxy_model_uuid`) references `service_proxy` (`model_uuid`) -on delete cascade on update cascade, -constraint `fk_service_proxy_resource_customization__service1` -foreign key (`source_service_model_uuid`) references `service` -(`model_uuid`) on delete cascade on update cascade) -engine = innodb -auto_increment = 20654 -default character set = latin1; + CREATE TABLE IF NOT EXISTS `service_proxy_customization` ( + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC), + UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_service_proxy_resource_customization__service1` + FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`) + REFERENCES `service` (`MODEL_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; create table if not exists `configuration_customization` ( `model_customization_uuid` varchar(200) not null, @@ -563,19 +556,13 @@ create table if not exists `configuration_customization` ( `configuration_customization_model_customization_uuid` varchar(200) null, primary key (`model_customization_uuid`), index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc), -index `fk_configuration_customization__service_proxy_customization_idx` -(`service_proxy_customization_model_customization_uuid` asc), index `fk_configuration_customization__configuration_customization_idx` (`configuration_customization_model_customization_uuid` asc), constraint `fk_configuration_resource_customization__configuration_resour1` foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`) on delete cascade on update cascade, -constraint `fk_configuration_customization__service_proxy_customization1` foreign -key (`service_proxy_customization_model_customization_uuid`) references -`service_proxy_customization` (`model_customization_uuid`) -on delete cascade on update cascade, constraint -`fk_configuration_customization__configuration_customization1` foreign -key (`configuration_customization_model_customization_uuid`) references +constraint `fk_configuration_customization__configuration_customization1` +foreign key (`configuration_customization_model_customization_uuid`) references `configuration_customization` (`model_customization_uuid`) on delete cascade on update cascade) engine = innodb @@ -894,6 +881,7 @@ CREATE TABLE `infra_active_requests` ( `CONFIGURATION_NAME` varchar(200) DEFAULT NULL, `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, + `REQUEST_URL` varchar(500) DEFAULT NULL, PRIMARY KEY (`REQUEST_ID`), UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; @@ -943,6 +931,7 @@ CREATE TABLE `archived_infra_requests` ( `CONFIGURATION_NAME` varchar(200) DEFAULT NULL, `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, + `REQUEST_URL` varchar(500) DEFAULT NULL, PRIMARY KEY (`REQUEST_ID`), UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d59h` (`CLIENT_REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |