aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java308
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerUnitTest.java378
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandlerTest.java182
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java55
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java91
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java225
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java100
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql31
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json33
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/createInfraActiveRequests.json10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequest.json10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequestNoBody.json9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql31
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql31
43 files changed, 1217 insertions, 787 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
deleted file mode 100644
index 276b438529..0000000000
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandler/filters/RequestUriFilterTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * 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.apihandler.filters;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.net.URI;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.UriInfo;
-import org.junit.Test;
-import org.onap.so.apihandlerinfra.BaseTest;
-
-
-
-public class RequestUriFilterTest extends BaseTest {
-
- @Test
- public void filterTest() throws IOException {
- RequestUriFilter URIFilter = new RequestUriFilter();
- URI baseURI = URI.create("http://localhost:58879/");
- String requestURI = "onap/so/infra/serviceInstances/v5";
-
- ContainerRequestContext mockContext = mock(ContainerRequestContext.class);
- UriInfo mockInfo = mock(UriInfo.class);
-
- when(mockContext.getUriInfo()).thenReturn(mockInfo);
- when(mockInfo.getBaseUri()).thenReturn(baseURI);
- when(mockInfo.getPath()).thenReturn(requestURI);
-
-
- URIFilter.filter(mockContext);
- assertEquals("http://localhost:58879/onap/so/infra/serviceInstantiation/v5/serviceInstances",
- URIFilter.getRequestUri());
- }
-}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
index e6b5163f59..4dc281b3fc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerTest.java
@@ -17,311 +17,39 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.onap.so.apihandlerinfra;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
-import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
-import org.junit.Before;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import javax.ws.rs.core.MediaType;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
-import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.core.env.Environment;
-import org.springframework.http.HttpEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.HttpClientErrorException;
-import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.ResourceAccessException;
-import org.springframework.web.client.RestTemplate;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@RunWith(MockitoJUnitRunner.class)
-public class CamundaRequestHandlerTest {
-
- @Mock
- private RestTemplate restTemplate;
- @Mock
- private Environment env;
+public class CamundaRequestHandlerTest extends BaseTest {
- @InjectMocks
- @Spy
+ @Autowired
private CamundaRequestHandler camundaRequestHandler;
+ @Value("${wiremock.server.port}")
+ private String wiremockPort;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
- private static final String REQUEST_ID = "eca3a1b1-43ab-457e-ab1c-367263d148b4";
- private ResponseEntity<List<HistoricActivityInstanceEntity>> activityInstanceResponse = null;
- private ResponseEntity<List<HistoricProcessInstanceEntity>> processInstanceResponse = null;
- private List<HistoricActivityInstanceEntity> activityInstanceList = null;
- private List<HistoricProcessInstanceEntity> processInstanceList = null;
-
-
-
- @Before
- public void setup() throws IOException {
- ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- activityInstanceList = mapper.readValue(
- new String(Files.readAllBytes(
- Paths.get("src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))),
- new TypeReference<List<HistoricActivityInstanceEntity>>() {});
- processInstanceList = mapper.readValue(
- new String(Files.readAllBytes(
- Paths.get("src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json"))),
- new TypeReference<List<HistoricProcessInstanceEntity>>() {});
- processInstanceResponse =
- new ResponseEntity<List<HistoricProcessInstanceEntity>>(processInstanceList, HttpStatus.ACCEPTED);
- activityInstanceResponse =
- new ResponseEntity<List<HistoricActivityInstanceEntity>>(activityInstanceList, HttpStatus.ACCEPTED);
-
- doReturn("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_").when(env)
- .getProperty("mso.camunda.rest.history.uri");
- doReturn("/sobpmnengine/history/activity-instance?processInstanceId=").when(env)
- .getProperty("mso.camunda.rest.activity.uri");
- doReturn("auth").when(env).getRequiredProperty("mso.camundaAuth");
- doReturn("key").when(env).getRequiredProperty("mso.msoKey");
- doReturn("http://localhost:8089").when(env).getProperty("mso.camundaURL");
- }
-
- public HttpHeaders setHeaders() {
- HttpHeaders headers = new HttpHeaders();
- List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
- acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
- headers.setAccept(acceptableMediaTypes);
- headers.add(HttpHeaders.AUTHORIZATION, "auth");
-
- return headers;
- }
-
- @Test
- public void getActivityNameTest() throws IOException {
- String expectedActivityName = "Last task executed: BB to Execute";
- String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
-
- assertEquals(expectedActivityName, actualActivityName);
- }
-
- @Test
- public void getActivityNameNullActivityNameTest() throws IOException {
- String expectedActivityName = "Task name is null.";
- HistoricActivityInstanceEntity activityInstance = new HistoricActivityInstanceEntity();
- List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
- activityInstanceList.add(activityInstance);
-
- String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
-
- assertEquals(expectedActivityName, actualActivityName);
- }
-
- @Test
- public void getActivityNameNullListTest() throws IOException {
- String expectedActivityName = "No results returned on activityInstance history lookup.";
- List<HistoricActivityInstanceEntity> activityInstanceList = null;
- String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
-
- assertEquals(expectedActivityName, actualActivityName);
- }
-
@Test
- public void getActivityNameEmptyListTest() throws IOException {
- String expectedActivityName = "No results returned on activityInstance history lookup.";
- List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
- String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
-
- assertEquals(expectedActivityName, actualActivityName);
- }
-
- @Test
- public void getTaskNameTest() throws IOException, ContactCamundaException {
- doReturn(processInstanceResponse).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
- doReturn(activityInstanceResponse).when(camundaRequestHandler)
- .getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
- doReturn("Last task executed: BB to Execute").when(camundaRequestHandler).getActivityName(activityInstanceList);
- String expectedTaskName = "Last task executed: BB to Execute";
-
- String actualTaskName = camundaRequestHandler.getTaskName(REQUEST_ID);
-
- assertEquals(expectedTaskName, actualTaskName);
- }
-
- @Test
- public void getTaskNameNullProcessInstanceListTest() throws IOException, ContactCamundaException {
- ResponseEntity<List<HistoricProcessInstanceEntity>> response = new ResponseEntity<>(null, HttpStatus.OK);
- doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
- String expected = "No processInstances returned for requestId: " + REQUEST_ID;
-
- String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void getTaskNameNullProcessInstanceIdTest() throws IOException, ContactCamundaException {
- HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
- List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
- processInstanceList.add(processInstance);
- ResponseEntity<List<HistoricProcessInstanceEntity>> response =
- new ResponseEntity<>(processInstanceList, HttpStatus.OK);
- doReturn(response).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID);
- String expected = "No processInstanceId returned for requestId: " + REQUEST_ID;
-
- String actual = camundaRequestHandler.getTaskName(REQUEST_ID);
-
- assertEquals(expected, actual);
- }
-
- @Test
- public void getTaskNameProcessInstanceLookupFailureTest() throws IOException, ContactCamundaException {
- doThrow(HttpClientErrorException.class).when(camundaRequestHandler)
- .getCamundaProcessInstanceHistory(REQUEST_ID);
-
- thrown.expect(ContactCamundaException.class);
- camundaRequestHandler.getTaskName(REQUEST_ID);
- }
-
- @Test
- public void getCamundaActivityHistoryTest() throws IOException, ContactCamundaException {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
- + "c4c6b647-a26e-11e9-b144-0242ac14000b";
- doReturn(activityInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
- ResponseEntity<List<HistoricActivityInstanceEntity>> actualResponse =
- camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
- assertEquals(activityInstanceResponse, actualResponse);
- }
-
- @Test
- public void getCamundaActivityHistoryErrorTest() {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
- + "c4c6b647-a26e-11e9-b144-0242ac14000b";
- doThrow(new ResourceAccessException("IOException")).when(restTemplate).exchange(targetUrl, HttpMethod.GET,
- requestEntity, new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
-
- try {
- camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b", REQUEST_ID);
- } catch (ContactCamundaException e) {
- // Exception thrown after retries are completed
- }
-
- verify(restTemplate, times(4)).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
- }
-
- @Test
- public void getCamundaProccesInstanceHistoryTest() throws IOException, ContactCamundaException {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl =
- "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
- doReturn(processInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
-
- ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
- camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
- assertEquals(processInstanceResponse, actualResponse);
- }
-
- @Test
- public void getCamundaProccesInstanceHistoryRetryTest() {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl =
- "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
- doThrow(new ResourceAccessException("I/O error")).when(restTemplate).exchange(targetUrl, HttpMethod.GET,
- requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
-
- try {
- camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
- } catch (ResourceAccessException e) {
- // Exception thrown after retries are completed
- }
- verify(restTemplate, times(4)).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- }
-
- @Test
- public void getCamundaProccesInstanceHistoryNoRetryTest() {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl =
- "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
- doThrow(HttpClientErrorException.class).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
-
- try {
- camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
- } catch (HttpStatusCodeException e) {
- // Exception thrown, no retries
- }
- verify(restTemplate, times(1)).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- }
-
- @Test
- public void getCamundaProccesInstanceHistoryFailThenSuccessTest() throws IOException, ContactCamundaException {
- HttpHeaders headers = setHeaders();
- HttpEntity<?> requestEntity = new HttpEntity<>(headers);
- String targetUrl =
- "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
- when(restTemplate.exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {}))
- .thenThrow(new ResourceAccessException("I/O Exception")).thenReturn(processInstanceResponse);
- doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
-
- ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
- camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID);
- assertEquals(processInstanceResponse, actualResponse);
- verify(restTemplate, times(2)).exchange(targetUrl, HttpMethod.GET, requestEntity,
- new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
- }
-
- @Test
- public void setCamundaHeadersTest() throws ContactCamundaException, RequestDbFailureException {
- String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
- String key = "07a7159d3bf51a0e53be7a8f89699be7";
-
- HttpHeaders headers = camundaRequestHandler.setCamundaHeaders(encryptedAuth, key);
- List<org.springframework.http.MediaType> acceptedType = headers.getAccept();
-
- String expectedAcceptedType = "application/json";
- assertEquals(expectedAcceptedType, acceptedType.get(0).toString());
- String basicAuth = headers.getFirst(HttpHeaders.AUTHORIZATION);
- String expectedBasicAuth = "Basic dXNlcjpwYXNzd29yZA==";
+ public void timeoutTest() {
+ wireMockServer.stubFor(get(
+ ("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_6718de35-b9a5-4670-b19f-a0f4ac22bfaf"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/HistoryCheckResponse.json")
+ .withStatus(org.apache.http.HttpStatus.SC_OK).withFixedDelay(40000)));
- assertEquals(expectedBasicAuth, basicAuth);
+ thrown.expect(ResourceAccessException.class);
+ camundaRequestHandler.getCamundaProcessInstanceHistory("6718de35-b9a5-4670-b19f-a0f4ac22bfaf", false);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerUnitTest.java
new file mode 100644
index 0000000000..261b64f2e6
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/CamundaRequestHandlerUnitTest.java
@@ -0,0 +1,378 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
+import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.env.Environment;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.ResourceAccessException;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CamundaRequestHandlerUnitTest {
+
+ @Mock
+ private RestTemplate restTemplate;
+
+ @Mock
+ private RestTemplate restTemplateRetry;
+
+ @Mock
+ private Environment env;
+
+ @InjectMocks
+ @Spy
+ private CamundaRequestHandler camundaRequestHandler;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private static final String REQUEST_ID = "eca3a1b1-43ab-457e-ab1c-367263d148b4";
+ private ResponseEntity<List<HistoricActivityInstanceEntity>> activityInstanceResponse = null;
+ private ResponseEntity<List<HistoricProcessInstanceEntity>> processInstanceResponse = null;
+ private List<HistoricActivityInstanceEntity> activityInstanceList = null;
+ private List<HistoricProcessInstanceEntity> processInstanceList = null;
+
+
+
+ @Before
+ public void setup() throws IOException {
+ ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ activityInstanceList = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))),
+ new TypeReference<List<HistoricActivityInstanceEntity>>() {});
+ processInstanceList = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/OrchestrationRequest/ProcessInstanceHistoryResponse.json"))),
+ new TypeReference<List<HistoricProcessInstanceEntity>>() {});
+ processInstanceResponse =
+ new ResponseEntity<List<HistoricProcessInstanceEntity>>(processInstanceList, HttpStatus.ACCEPTED);
+ activityInstanceResponse =
+ new ResponseEntity<List<HistoricActivityInstanceEntity>>(activityInstanceList, HttpStatus.ACCEPTED);
+
+ doReturn("/sobpmnengine/history/process-instance?variables=mso-request-id_eq_").when(env)
+ .getProperty("mso.camunda.rest.history.uri");
+ doReturn("/sobpmnengine/history/activity-instance?processInstanceId=").when(env)
+ .getProperty("mso.camunda.rest.activity.uri");
+ doReturn("auth").when(env).getRequiredProperty("mso.camundaAuth");
+ doReturn("key").when(env).getRequiredProperty("mso.msoKey");
+ doReturn("http://localhost:8089").when(env).getProperty("mso.camundaURL");
+
+ HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
+ factory.setReadTimeout(30000);
+ factory.setConnectTimeout(30000);
+ restTemplate.setRequestFactory(factory);
+ doReturn(restTemplate).when(camundaRequestHandler).getRestTemplate(false);
+
+ HttpComponentsClientHttpRequestFactory factoryRetry = new HttpComponentsClientHttpRequestFactory();
+ factoryRetry.setReadTimeout(15000);
+ factoryRetry.setConnectTimeout(15000);
+ restTemplate.setRequestFactory(factoryRetry);
+ doReturn(restTemplateRetry).when(camundaRequestHandler).getRestTemplate(true);
+ }
+
+ public HttpHeaders setHeaders() {
+ HttpHeaders headers = new HttpHeaders();
+ List<org.springframework.http.MediaType> acceptableMediaTypes = new ArrayList<>();
+ acceptableMediaTypes.add(org.springframework.http.MediaType.APPLICATION_JSON);
+ headers.setAccept(acceptableMediaTypes);
+ headers.add(HttpHeaders.AUTHORIZATION, "auth");
+
+ return headers;
+ }
+
+ @Test
+ public void getActivityNameTest() throws IOException {
+ String expectedActivityName = "Last task executed: BB to Execute";
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameNullActivityNameTest() throws IOException {
+ String expectedActivityName = "Task name is null.";
+ HistoricActivityInstanceEntity activityInstance = new HistoricActivityInstanceEntity();
+ List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
+ activityInstanceList.add(activityInstance);
+
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameNullListTest() throws IOException {
+ String expectedActivityName = "No results returned on activityInstance history lookup.";
+ List<HistoricActivityInstanceEntity> activityInstanceList = null;
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getActivityNameEmptyListTest() throws IOException {
+ String expectedActivityName = "No results returned on activityInstance history lookup.";
+ List<HistoricActivityInstanceEntity> activityInstanceList = new ArrayList<>();
+ String actualActivityName = camundaRequestHandler.getActivityName(activityInstanceList);
+
+ assertEquals(expectedActivityName, actualActivityName);
+ }
+
+ @Test
+ public void getCamundActivityHistoryNullTest() throws IOException, ContactCamundaException {
+ HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
+ processInstance.setId("c4c6b647-a26e-11e9-b144-0242ac14000b");
+ List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
+ processInstanceList.add(processInstance);
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(processInstanceList, HttpStatus.OK);
+ doReturn(null).when(camundaRequestHandler).getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b");
+
+ String actualTaskName = camundaRequestHandler.getTaskInformation(response, REQUEST_ID);
+
+ assertNull(actualTaskName);
+ }
+
+ @Test
+ public void getCamundActivityHistoryErrorTest() throws IOException, ContactCamundaException {
+ HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
+ processInstance.setId("c4c6b647-a26e-11e9-b144-0242ac14000b");
+ List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
+ processInstanceList.add(processInstance);
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(processInstanceList, HttpStatus.OK);
+ doThrow(RestClientException.class).when(camundaRequestHandler)
+ .getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b");
+
+ String actualTaskName = camundaRequestHandler.getTaskInformation(response, REQUEST_ID);
+
+ assertNull(actualTaskName);
+ }
+
+ @Test
+ public void getTaskName() throws IOException, ContactCamundaException {
+ doReturn(processInstanceResponse).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID,
+ false);
+ doReturn(activityInstanceResponse).when(camundaRequestHandler)
+ .getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b");
+ doReturn("Last task executed: BB to Execute").when(camundaRequestHandler).getActivityName(activityInstanceList);
+ String expectedTaskName = "Last task executed: BB to Execute";
+
+ String actualTaskName = camundaRequestHandler.getTaskName(REQUEST_ID);
+
+ assertEquals(expectedTaskName, actualTaskName);
+ }
+
+ @Test
+ public void getTaskNameNullProcessInstanceListTest() throws IOException, ContactCamundaException {
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response = new ResponseEntity<>(null, HttpStatus.OK);
+
+ String actual = camundaRequestHandler.getTaskInformation(response, REQUEST_ID);
+
+ assertNull(actual);
+ }
+
+ @Test
+ public void getTaskNameNullProcessInstanceIdTest() throws IOException, ContactCamundaException {
+ HistoricProcessInstanceEntity processInstance = new HistoricProcessInstanceEntity();
+ List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
+ processInstanceList.add(processInstance);
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(processInstanceList, HttpStatus.OK);
+
+ String actual = camundaRequestHandler.getTaskInformation(response, REQUEST_ID);
+
+ assertNull(actual);
+ }
+
+ @Test
+ public void getTaskNameEmptyProcessInstanceListTest() throws IOException, ContactCamundaException {
+ List<HistoricProcessInstanceEntity> processInstanceList = new ArrayList<>();
+ ResponseEntity<List<HistoricProcessInstanceEntity>> response =
+ new ResponseEntity<>(processInstanceList, HttpStatus.OK);
+
+ String actual = camundaRequestHandler.getTaskInformation(response, REQUEST_ID);
+
+ assertNull(actual);
+ }
+
+ @Test
+ public void getTaskNameProcessInstanceLookupFailureTest() throws IOException, ContactCamundaException {
+ doThrow(HttpClientErrorException.class).when(camundaRequestHandler).getCamundaProcessInstanceHistory(REQUEST_ID,
+ false);
+
+ String result = camundaRequestHandler.getTaskName(REQUEST_ID);
+ assertNull(result);
+ }
+
+ @Test
+ public void getCamundaActivityHistoryTest() throws IOException, ContactCamundaException {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
+ + "c4c6b647-a26e-11e9-b144-0242ac14000b";
+ doReturn(activityInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+ ResponseEntity<List<HistoricActivityInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b");
+ assertEquals(activityInstanceResponse, actualResponse);
+ }
+
+ @Test
+ public void getCamundaActivityHistoryErrorTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl = "http://localhost:8089/sobpmnengine/history/activity-instance?processInstanceId="
+ + "c4c6b647-a26e-11e9-b144-0242ac14000b";
+ doThrow(new ResourceAccessException("IOException")).when(restTemplate).exchange(targetUrl, HttpMethod.GET,
+ requestEntity, new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ thrown.expect(ResourceAccessException.class);
+ camundaRequestHandler.getCamundaActivityHistory("c4c6b647-a26e-11e9-b144-0242ac14000b");
+
+ verify(restTemplate, times(1)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricActivityInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryTest() throws IOException, ContactCamundaException {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doReturn(processInstanceResponse).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID, false);
+ assertEquals(processInstanceResponse, actualResponse);
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryRetryTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doThrow(new ResourceAccessException("I/O error")).when(restTemplateRetry).exchange(targetUrl, HttpMethod.GET,
+ requestEntity, new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ thrown.expect(ResourceAccessException.class);
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID, true);
+
+ verify(restTemplateRetry, times(2)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryNoRetryTest() {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ doThrow(HttpClientErrorException.class).when(restTemplate).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ thrown.expect(HttpStatusCodeException.class);
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID, false);
+
+ verify(restTemplate, times(1)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void getCamundaProccesInstanceHistoryFailThenSuccessTest() throws IOException, ContactCamundaException {
+ HttpHeaders headers = setHeaders();
+ HttpEntity<?> requestEntity = new HttpEntity<>(headers);
+ String targetUrl =
+ "http://localhost:8089/sobpmnengine/history/process-instance?variables=mso-request-id_eq_" + REQUEST_ID;
+ when(restTemplateRetry.exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {}))
+ .thenThrow(new ResourceAccessException("I/O Exception")).thenReturn(processInstanceResponse);
+ doReturn(headers).when(camundaRequestHandler).setCamundaHeaders("auth", "key");
+
+ ResponseEntity<List<HistoricProcessInstanceEntity>> actualResponse =
+ camundaRequestHandler.getCamundaProcessInstanceHistory(REQUEST_ID, true);
+
+ assertEquals(processInstanceResponse, actualResponse);
+ verify(restTemplateRetry, times(2)).exchange(targetUrl, HttpMethod.GET, requestEntity,
+ new ParameterizedTypeReference<List<HistoricProcessInstanceEntity>>() {});
+ }
+
+ @Test
+ public void setCamundaHeadersTest() throws ContactCamundaException, RequestDbFailureException {
+ String encryptedAuth = "015E7ACF706C6BBF85F2079378BDD2896E226E09D13DC2784BA309E27D59AB9FAD3A5E039DF0BB8408"; // user:password
+ String key = "07a7159d3bf51a0e53be7a8f89699be7";
+
+ HttpHeaders headers = camundaRequestHandler.setCamundaHeaders(encryptedAuth, key);
+ List<org.springframework.http.MediaType> acceptedType = headers.getAccept();
+
+ String expectedAcceptedType = "application/json";
+ assertEquals(expectedAcceptedType, acceptedType.get(0).toString());
+ String basicAuth = headers.getFirst(HttpHeaders.AUTHORIZATION);
+ String expectedBasicAuth = "Basic dXNlcjpwYXNzd29yZA==";
+
+ assertEquals(expectedBasicAuth, basicAuth);
+ }
+}
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 7ddab572e3..979aa8fbb1 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
@@ -62,14 +62,13 @@ public class E2EServiceInstancesTest extends BaseTest {
wireMockServer.stubFor(post(urlPathEqualTo("/testOrchestrationUri")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")).withRequestBody(equalToJson(
- "{\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"Error parsing request: No valid requestorId is specified\",\"progress\":100,\"startTime\":1533541051247,\"endTime\":1533541051247,\"source\":null,\"vnfId\":null,\"vnfName\":null,\"vnfType\":null,\"serviceType\":null,\"aicNodeClli\":null,\"tenantId\":null,\"provStatus\":null,\"vnfParams\":null,\"vnfOutputs\":null,\"requestBody\":\"{\\r\\n \\\"service\\\":{\\r\\n \\\"name\\\":\\\"so_test4\\\",\\r\\n \\\"description\\\":\\\"so_test2\\\",\\r\\n \\\"serviceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561519\\\",\\r\\n \\\"serviceUuid\\\":\\\"592f9437-a9c0-4303-b9f6-c445bb7e9814\\\",\\r\\n \\\"globalSubscriberId\\\":\\\"123457\\\",\\r\\n \\\"serviceType\\\":\\\"voLTE\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"resources\\\":[\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vIMS\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vBAS-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vMME-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vEPC\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"61c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"62c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-CSCF-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad1\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"underlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561513\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561514\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"overlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561517\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561518\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n }\\r\\n ],\\r\\n \\\"requestInputs\\\":{\\r\\n \\\"externalDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"m6000_mng_ip\\\":\\\"181.18.20.2\\\",\\r\\n \\\"externalCompanyFtpDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"externalPluginManageNetworkName\\\":\\\"plugin_net_2014\\\",\\r\\n \\\"externalManageNetworkName\\\":\\\"mng_net_2017\\\",\\r\\n \\\"sfc_data_network\\\":\\\"sfc_data_net_2016\\\",\\r\\n \\\"NatIpRange\\\":\\\"210.1.1.10-210.1.1.20\\\",\\r\\n \\\"location\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\",\\r\\n \\\"sdncontroller\\\":\\\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\\\"\\r\\n }\\r\\n }\\r\\n\\r\\n }\\r\\n\\r\\n}\",\"responseBody\":null,\"lastModifiedBy\":\"APIH\",\"modifyTime\":null,\"requestType\":null,\"volumeGroupId\":null,\"volumeGroupName\":null,\"vfModuleId\":null,\"vfModuleName\":null,\"vfModuleModelName\":null,\"aaiServiceId\":null,\"aicCloudRegion\":null,\"callBackUrl\":null,\"correlator\":null,\"serviceInstanceId\":null,\"serviceInstanceName\":null,\"requestScope\":\"service\",\"requestAction\":\"createInstance\",\"networkId\":null,\"networkName\":null,\"networkType\":null,\"requestorId\":null,\"configurationId\":null,\"configurationName\":null,\"operationalEnvId\":null,\"operationalEnvName\":null,\"requestURI\":\"d167c9d0-1785-4e93-b319-996ebbcc3272\"}"))
+ "{\"requestStatus\":\"FAILED\",\"statusMessage\":\"Error parsing request: No valid requestorId is specified\",\"progress\":100,\"startTime\":1533541051247,\"endTime\":1533541051247,\"source\":null,\"vnfId\":null,\"vnfName\":null,\"vnfType\":null,\"serviceType\":null,\"tenantId\":null,\"vnfParams\":null,\"vnfOutputs\":null,\"requestBody\":\"{\\r\\n \\\"service\\\":{\\r\\n \\\"name\\\":\\\"so_test4\\\",\\r\\n \\\"description\\\":\\\"so_test2\\\",\\r\\n \\\"serviceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561519\\\",\\r\\n \\\"serviceUuid\\\":\\\"592f9437-a9c0-4303-b9f6-c445bb7e9814\\\",\\r\\n \\\"globalSubscriberId\\\":\\\"123457\\\",\\r\\n \\\"serviceType\\\":\\\"voLTE\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"resources\\\":[\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vIMS\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vBAS-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-vMME-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"vEPC\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"61c3e96e-0970-4871-b6e0-3b6de7561516\\\",\\r\\n \\\"resourceUuid\\\":\\\"62c3e96e-0970-4871-b6e0-3b6de7561512\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n {\\r\\n \\\"vnfProfileId\\\":\\\"zte-CSCF-1.0\\\",\\r\\n \\\"locationConstraints\\\":{\\r\\n \\\"vimId\\\":\\\"4050083f-465f-4838-af1e-47a545222ad1\\\"\\r\\n }\\r\\n }\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"underlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561513\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561514\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n },\\r\\n {\\r\\n \\\"resourceName\\\":\\\"overlayvpn\\\",\\r\\n \\\"resourceInvariantUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561517\\\",\\r\\n \\\"resourceUuid\\\":\\\"60c3e96e-0970-4871-b6e0-3b6de7561518\\\",\\r\\n \\\"parameters\\\":{\\r\\n \\\"locationConstraints\\\":[\\r\\n\\r\\n ]\\r\\n }\\r\\n }\\r\\n ],\\r\\n \\\"requestInputs\\\":{\\r\\n \\\"externalDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"m6000_mng_ip\\\":\\\"181.18.20.2\\\",\\r\\n \\\"externalCompanyFtpDataNetworkName\\\":\\\"Flow_out_net\\\",\\r\\n \\\"externalPluginManageNetworkName\\\":\\\"plugin_net_2014\\\",\\r\\n \\\"externalManageNetworkName\\\":\\\"mng_net_2017\\\",\\r\\n \\\"sfc_data_network\\\":\\\"sfc_data_net_2016\\\",\\r\\n \\\"NatIpRange\\\":\\\"210.1.1.10-210.1.1.20\\\",\\r\\n \\\"location\\\":\\\"4050083f-465f-4838-af1e-47a545222ad0\\\",\\r\\n \\\"sdncontroller\\\":\\\"9b9f02c0-298b-458a-bc9c-be3692e4f35e\\\"\\r\\n }\\r\\n }\\r\\n\\r\\n }\\r\\n\\r\\n}\",\"responseBody\":null,\"lastModifiedBy\":\"APIH\",\"modifyTime\":null,\"volumeGroupId\":null,\"volumeGroupName\":null,\"vfModuleId\":null,\"vfModuleName\":null,\"vfModuleModelName\":null,\"cloudRegion\":null,\"callBackUrl\":null,\"correlator\":null,\"serviceInstanceId\":null,\"serviceInstanceName\":null,\"requestScope\":\"service\",\"requestAction\":\"createInstance\",\"networkId\":null,\"networkName\":null,\"networkType\":null,\"requestorId\":null,\"configurationId\":null,\"configurationName\":null,\"operationalEnvId\":null,\"operationalEnvName\":null,\"requestURI\":\"d167c9d0-1785-4e93-b319-996ebbcc3272\"}"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
Service defaultService = new Service();
defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
ServiceRecipe serviceRecipe = new ServiceRecipe();
serviceRecipe.setServiceModelUUID(defaultService.getModelUUID());
- serviceRecipe.setAction(Action.scaleInstance.name());
serviceRecipe.setRecipeTimeout(180);
serviceRecipe.setOrchestrationUri("/testOrchestrationUri");
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
index 928b488f6a..0291cfd2ea 100644
--- 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
@@ -20,70 +20,67 @@
package org.onap.so.apihandlerinfra;
-import static org.junit.Assert.assertArrayEquals;
+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.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyObject;
+import static org.junit.Assert.assertThat;
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.junit.runner.RunWith;
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.onap.so.apihandlerinfra.HealthCheckConfig.Endpoint;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestTemplate;
+import com.fasterxml.jackson.core.JsonProcessingException;
+@RunWith(SpringRunner.class)
+@ContextConfiguration(classes = {GenericStringConverter.class, HealthCheckConverter.class},
+ initializers = {ConfigFileApplicationContextInitializer.class})
+@ActiveProfiles("test")
+@EnableConfigurationProperties({HealthCheckConfig.class})
public class GlobalHealthcheckHandlerTest {
- @Mock
- RestTemplate restTemplate;
+ @MockBean
+ private RestTemplate restTemplate;
- @Mock
- ContainerRequestContext requestContext;
+ @MockBean
+ private ContainerRequestContext requestContext;
- @InjectMocks
- @Spy
- GlobalHealthcheckHandler globalhealth;
-
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule();
+ @SpyBean
+ private GlobalHealthcheckHandler globalhealth;
@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);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.BPMN, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.DOWN, result.getStatus());
}
@Test
public void testQuerySubsystemHealthNotNullResult() {
ReflectionTestUtils.setField(globalhealth, "actuatorContextPath", "/manage");
- ReflectionTestUtils.setField(globalhealth, "endpointAsdc", "http://localhost:8080");
SubsystemHealthcheckResponse subSystemResponse = new SubsystemHealthcheckResponse();
subSystemResponse.setStatus("UP");
@@ -92,20 +89,13 @@ public class GlobalHealthcheckHandlerTest {
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);
+ HealthCheckSubsystem result = globalhealth
+ .querySubsystemHealth(new Endpoint(SoSubsystems.ASDC, UriBuilder.fromPath("http://localhost").build()));
+ assertEquals(HealthCheckStatus.UP, result.getStatus());
}
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();
@@ -116,70 +106,41 @@ public class GlobalHealthcheckHandlerTest {
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()));
+ public void globalHealthcheckAllUPTest() throws JSONException, JsonProcessingException {
- String asdcstatus = root.getAsdcController();
- assertTrue(asdcstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
+ HealthCheckResponse expected = new HealthCheckResponse();
- 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()));
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.UP));
+ }
+ expected.setMessage("HttpStatus: 200");
+ Response response = globalHealthcheck("UP");
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
- String reqdbattstatus = root.getRequestdbAdapterAttsvc();
- assertTrue(reqdbattstatus.equalsIgnoreCase(HealthcheckStatus.UP.toString()));
}
@Test
public void globalHealthcheckAllDOWNTest() throws JSONException {
+ HealthCheckResponse expected = new HealthCheckResponse();
+
+ for (Subsystem system : SoSubsystems.values()) {
+ expected.getSubsystems().add(new HealthCheckSubsystem(system,
+ UriBuilder.fromUri("http://localhost").build(), HealthCheckStatus.DOWN));
+ }
+ expected.setMessage("HttpStatus: 200");
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()));
+ HealthCheckResponse root;
+ root = (HealthCheckResponse) response.getEntity();
+ assertThat(root, sameBeanAs(expected).ignoring("subsystems.uri").ignoring("subsystems.subsystem"));
}
@Test
@@ -189,40 +150,15 @@ public class GlobalHealthcheckHandlerTest {
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);
+ Endpoint endpoint = new Endpoint(SoSubsystems.BPMN, UriBuilder.fromUri("http://localhost").build());
+ HealthCheckStatus result = globalhealth.processResponseFromSubsystem(r, endpoint);
+ assertEquals(HealthCheckStatus.UP, result);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 9fc9e4a51b..5c78af3601 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -29,9 +29,10 @@ 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.assertThat;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -81,10 +82,10 @@ public class InstanceManagementTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
@@ -171,4 +172,32 @@ public class InstanceManagementTest extends BaseTest {
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
+
+ @Test
+ public void executePNFCustomWorkflow() throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/testingPNFWorkflow"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/workflow/search/findByArtifactUUID[?]artifactUUID=81526781-e55c-4cb7-adb3-97e09d9c76bf"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("workflow_pnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ // expected response
+ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ requestReferences.setInstanceId("1882939");
+ requestReferences.setRequestSelfLink(createExpectedSelfLink("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
+ expectedResponse.setRequestReferences(requestReferences);
+ uri = instanceManagementUri + "v1"
+ + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testpnfcId/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ExecutePNFCustomWorkflow.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
+ assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index ad0a878931..b8d1e56cf7 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
@@ -26,24 +26,13 @@ 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 static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID;
-import static org.onap.so.logger.MdcConstants.ENDTIME;
-import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
-import static org.onap.so.logger.MdcConstants.PARTNERNAME;
-import static org.onap.so.logger.MdcConstants.RESPONSECODE;
-import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
-import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
-import static org.onap.so.logger.MdcConstants.STATUSCODE;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
import java.io.IOException;
-import java.util.Map;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Test;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails;
import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
@@ -59,7 +48,6 @@ 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;
public class ManualTasksTest extends BaseTest {
@@ -89,7 +77,7 @@ public class ManualTasksTest extends BaseTest {
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
headers.set(ECOMP_REQUEST_ID, "987654321");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder =
@@ -108,34 +96,6 @@ public class ManualTasksTest extends BaseTest {
// then
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
assertThat(realResponse, sameBeanAs(expectedResponse));
-
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(STATUSCODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
- assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- }
}
@Test
@@ -152,7 +112,7 @@ public class ManualTasksTest extends BaseTest {
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
headers.set(ECOMP_REQUEST_ID, "987654321");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
HttpEntity<String> entity = new HttpEntity<String>(invalidRequest, headers);
UriComponentsBuilder builder =
@@ -161,7 +121,6 @@ public class ManualTasksTest extends BaseTest {
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);
@@ -189,7 +148,7 @@ public class ManualTasksTest extends BaseTest {
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
headers.set(ECOMP_REQUEST_ID, "987654321");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder =
@@ -198,7 +157,6 @@ public class ManualTasksTest extends BaseTest {
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);
@@ -230,7 +188,7 @@ public class ManualTasksTest extends BaseTest {
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
headers.set(ECOMP_REQUEST_ID, "987654321");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
HttpEntity<TasksRequest> entity = new HttpEntity<TasksRequest>(taskReq, headers);
UriComponentsBuilder builder =
@@ -240,7 +198,6 @@ public class ManualTasksTest extends BaseTest {
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);
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 86bf8060a7..f1d5a5487f 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
@@ -278,10 +278,6 @@ public class MsoRequestTest extends BaseTest {
ServiceInstancesRequest.class),
instanceIdMapTest, Action.createInstance, 5},
{"No valid cloudConfiguration is specified",
- mapper.readValue(inputStream("/CloudConfiguration/CloudConfigurationVnf.json"),
- ServiceInstancesRequest.class),
- instanceIdMapTest, Action.replaceInstance, 5},
- {"No valid cloudConfiguration is specified",
mapper.readValue(inputStream("/CloudConfiguration/CloudConfigurationConfig.json"),
ServiceInstancesRequest.class),
instanceIdMapTest, Action.enablePort, 5},
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 12f0ffcc11..aa6a3836c1 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
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -64,7 +65,6 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -107,6 +107,18 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get(
"src/test/resources/OrchestrationRequest/ActivityInstanceHistoryResponse.json"))))
.withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(
+ ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-1a18-42e5-965d-8ea592502018&IS_INTERNAL_DATA=false"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get(
+ "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(
+ ("/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc?SO_REQUEST_ID=00032ab7-3fb3-42e5-965d-8ea592502017&IS_INTERNAL_DATA=false"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get(
+ "src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json"))))
+ .withStatus(HttpStatus.SC_OK)));
}
@Test
@@ -117,10 +129,21 @@ public class OrchestrationRequestsTest extends BaseTest {
Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
testResponse.setRequest(request);
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
String testRequestId = request.getRequestId();
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "1e45215d-b7b3-4c5a-9316-65bdddaf649f");
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
UriComponentsBuilder builder = UriComponentsBuilder
@@ -136,7 +159,41 @@ public class OrchestrationRequestsTest extends BaseTest {
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-1a18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
+ assertEquals("1e45215d-b7b3-4c5a-9316-65bdddaf649f", response.getHeaders().get("X-TransactionID").get(0));
+ assertNotNull(response.getBody().getRequest().getFinishTime());
+ }
+
+ @Test
+ public void getOrchestrationRequestSimpleTest() throws Exception {
+ setupTestGetOrchestrationRequest();
+ // TEST VALID REQUEST
+ GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
+
+ Request request = ORCHESTRATION_LIST.getRequestList().get(1).getRequest();
+ request.setRequestProcessingData(null);
+ testResponse.setRequest(request);
+
+ String testRequestId = request.getRequestId();
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "e5e3c007-9fe9-4a20-8691-bdd20e14504d");
+ HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId))
+ .queryParam("format", "simple");
+
+ 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"));
+ 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("e5e3c007-9fe9-4a20-8691-bdd20e14504d", response.getHeaders().get("X-TransactionID").get(0));
assertNotNull(response.getBody().getRequest().getFinishTime());
}
@@ -148,6 +205,16 @@ public class OrchestrationRequestsTest extends BaseTest {
Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
testResponse.setRequest(request);
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
String testRequestId = request.getRequestId();
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
@@ -184,10 +251,21 @@ public class OrchestrationRequestsTest extends BaseTest {
request.setCloudRequestData(cloudRequestData);
testResponse.setRequest(request);
String testRequestId = request.getRequestId();
+ testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
+ RequestProcessingData e = new RequestProcessingData();
+ e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ e.setTag("pincFabricConfigRequest");
+ List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
+ HashMap<String, String> data1 = new HashMap<String, String>();
+ data1.put("requestAction", "assign");
+ data.add(data1);
+ e.setDataPairs(data);
+ testResponse.getRequest().getRequestProcessingData().add(e);
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.REQUEST_ID, "0321e28d-3dde-4b31-9b28-1e0f07231b93");
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(
@@ -204,7 +282,7 @@ public class OrchestrationRequestsTest extends BaseTest {
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-3fb3-42e5-965d-8ea592502017", response.getHeaders().get("X-TransactionID").get(0));
+ assertEquals("0321e28d-3dde-4b31-9b28-1e0f07231b93", response.getHeaders().get("X-TransactionID").get(0));
}
@Test
@@ -281,7 +359,6 @@ public class OrchestrationRequestsTest extends BaseTest {
public void testUnlockOrchestrationRequest() throws Exception {
setupTestUnlockOrchestrationRequest("0017f68c-eb2d-45bb-b7c7-ec31b37dc349", "UNLOCKED");
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
String requestJSON =
new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
HttpHeaders headers = new HttpHeaders();
@@ -317,7 +394,6 @@ public class OrchestrationRequestsTest extends BaseTest {
public void testUnlockOrchestrationRequest_invalid_Json() throws Exception {
setupTestUnlockOrchestrationRequest_invalid_Json();
ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
String requestJSON =
new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/Request.json")));
HttpHeaders headers = new HttpHeaders();
@@ -335,7 +411,7 @@ public class OrchestrationRequestsTest extends BaseTest {
expectedRequestError = new RequestError();
se = new ServiceException();
se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
- se.setText("Null response from RequestDB when searching by RequestId");
+ se.setText("Null response from RequestDB when searching by RequestId " + INVALID_REQUEST_ID);
expectedRequestError.setServiceException(se);
builder = UriComponentsBuilder.fromHttpUrl(
@@ -345,7 +421,7 @@ public class OrchestrationRequestsTest extends BaseTest {
actualRequestError = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
- assertThat(actualRequestError, sameBeanAs(expectedRequestError));
+ assertThat(expectedRequestError, sameBeanAs(actualRequestError));
}
@Test
@@ -408,6 +484,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertThat(actualProcessingData, sameBeanAs(expectedDataList));
}
+
public void setupTestGetOrchestrationRequest() throws Exception {
// For testGetOrchestrationRequest
wireMockServer.stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-1a18-42e5-965d-8ea592502018"))
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 5023155768..47aa3cccb5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -21,10 +21,12 @@
package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
@@ -38,6 +40,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.constants.OrchestrationRequestFormat;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -232,6 +235,21 @@ public class OrchestrationRequestsUnitTest {
}
@Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestErrorMessageTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ iar.setExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ iar.setFlowStatus(null);
+ iar.setStatusMessage("Error retrieving cloud region from AAI");
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.DETAIL.toString());
+
+ assertTrue(actual.getRequestStatus().getStatusMessage()
+ .contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE));
+ }
+
+ @Test
public void mapRequestStatusAndExtSysErrSrcToRequestFlowStatusSuccessfulCompletionTest() throws ApiException {
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
@@ -295,6 +313,14 @@ public class OrchestrationRequestsUnitTest {
assertEquals(Status.ABORTED.toString(), result);
}
+ @Test
+ public void mapRequestStatusToRequestForFormatStatusDetailTest() throws ApiException {
+ iar.setRequestStatus(Status.ABORTED.toString());
+ String result = orchestrationRequests.mapRequestStatusToRequest(iar, "statusDetail");
+
+ assertEquals(Status.ABORTED.toString(), result);
+ }
+
@Test
public void mapRequestStatusToRequestForFormatEmptyStringTest() throws ApiException {
@@ -303,4 +329,13 @@ public class OrchestrationRequestsUnitTest {
assertEquals(Status.FAILED.toString(), result);
}
+
+ @Test
+ public void infraActiveRequestNullValidationExceptionTest() throws ApiException {
+ iar.setRequestId(REQUEST_ID);
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage(containsString("Null response from RequestDB when searching by RequestId " + REQUEST_ID));
+ orchestrationRequests.infraActiveRequestLookup(iar.getRequestId());
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
index e4532cd8d7..abdf38dfa6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
@@ -30,9 +30,10 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -95,10 +96,10 @@ public class RequestHandlerUtilsTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
index d4b0c3aad1..557771d298 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsUnitTest.java
@@ -25,10 +25,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.sql.Timestamp;
+import java.util.HashMap;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -102,7 +104,7 @@ public class RequestHandlerUtilsUnitTest {
private void setInfraActiveRequest() throws IOException {
infraActiveRequest.setTenantId("tenant-id");
infraActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
- infraActiveRequest.setAicCloudRegion("cloudRegion");
+ infraActiveRequest.setCloudRegion("cloudRegion");
infraActiveRequest.setRequestScope("service");
infraActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
infraActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
@@ -117,7 +119,7 @@ public class RequestHandlerUtilsUnitTest {
currentActiveRequest.setStartTime(startTimeStamp);
currentActiveRequest.setTenantId("tenant-id");
currentActiveRequest.setRequestBody(getRequestBody("/RequestBodyNewRequestorId.json"));
- currentActiveRequest.setAicCloudRegion("cloudRegion");
+ currentActiveRequest.setCloudRegion("cloudRegion");
currentActiveRequest.setRequestScope("service");
currentActiveRequest.setRequestStatus(Status.IN_PROGRESS.toString());
currentActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
@@ -441,4 +443,28 @@ public class RequestHandlerUtilsUnitTest {
assertEquals(expected, result);
}
+ @Test
+ public void checkForDuplicateRequestsTest() throws ApiException {
+ InfraActiveRequests currentActiveReq = new InfraActiveRequests();
+ currentActiveReq.setCloudRegion("testRegion");
+ currentActiveReq.setRequestId("792a3158-d9a3-49fd-b3ac-ab09842d6a1a");
+ Action action = Action.createInstance;
+ String requestScope = ModelType.service.toString();
+
+ InfraActiveRequests duplicate = new InfraActiveRequests();
+
+ HashMap<String, String> instanceIdMap = new HashMap<String, String>();
+ String instanceName = "instanceName";
+
+ doReturn(duplicate).when(requestHandler).duplicateCheck(action, instanceIdMap, instanceName, requestScope,
+ currentActiveReq);
+ doReturn(true).when(requestHandler).camundaHistoryCheck(duplicate, currentActiveReq);
+ doNothing().when(requestHandler).buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap,
+ instanceName, requestScope, duplicate);
+
+ requestHandler.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq, instanceName);
+ verify(requestHandler).buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, instanceName,
+ requestScope, duplicate);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
index 1e755419be..7191e297ec 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
@@ -21,6 +21,7 @@ package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
@@ -30,7 +31,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -56,10 +56,10 @@ import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.onap.so.serviceinstancebeans.ModelType;
@RunWith(MockitoJUnitRunner.class)
public class ResumeOrchestrationRequestTest {
@@ -149,7 +149,7 @@ public class ResumeOrchestrationRequestTest {
private void setInfraActiveRequest() throws IOException {
infraActiveRequest.setTenantId("tenant-id");
infraActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
- infraActiveRequest.setAicCloudRegion("cloudRegion");
+ infraActiveRequest.setCloudRegion("cloudRegion");
infraActiveRequest.setRequestScope(SERVICE);
infraActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
infraActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
@@ -173,7 +173,7 @@ public class ResumeOrchestrationRequestTest {
currentActiveRequest.setStartTime(startTimeStamp);
currentActiveRequest.setTenantId("tenant-id");
currentActiveRequest.setRequestBody(getRequestBody("/RequestBody.json"));
- currentActiveRequest.setAicCloudRegion("cloudRegion");
+ currentActiveRequest.setCloudRegion("cloudRegion");
currentActiveRequest.setRequestScope(SERVICE);
currentActiveRequest.setServiceInstanceId(SERVICE_INSTANCE_ID);
currentActiveRequest.setServiceInstanceName(SERVICE_INSTANCE_NAME);
@@ -258,7 +258,7 @@ public class ResumeOrchestrationRequestTest {
when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(),
anyString())).thenReturn(sir);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
@@ -311,7 +311,7 @@ public class ResumeOrchestrationRequestTest {
anyString())).thenReturn(sirNullALaCarte);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
doReturn(false).when(msoRequest).getAlacarteFlag(sirNullALaCarte);
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sirNullALaCarte);
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 e28e36d307..006b82ac58 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
@@ -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.
@@ -29,21 +29,13 @@ 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.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
-import static org.onap.so.logger.MdcConstants.ENDTIME;
-import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
-import static org.onap.so.logger.MdcConstants.PARTNERNAME;
-import static org.onap.so.logger.MdcConstants.RESPONSECODE;
-import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
-import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
-import static org.onap.so.logger.MdcConstants.STATUSCODE;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -64,7 +56,6 @@ 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.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -89,12 +80,10 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.tomakehurst.wiremock.http.Fault;
-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;
@@ -116,15 +105,13 @@ public class ServiceInstancesTest extends BaseTest {
@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(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
- headers.set(CLIENT_ID, "VID");
+ headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
@@ -132,7 +119,7 @@ public class ServiceInstancesTest extends BaseTest {
} catch (MalformedURLException e) {
e.printStackTrace();
}
- wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests.*")).willReturn(aResponse()
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
}
@@ -225,35 +212,6 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
-
-
-
- for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(STATUSCODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
- Map<String, String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
- assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
- assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
- assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
- assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
- }
}
@Test
@@ -285,14 +243,13 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/ServiceInstancePrev7.json"), uri, HttpMethod.POST, headers);
// then
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
- assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
@@ -896,7 +853,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response =
sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST);
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -905,7 +862,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("No valid vnfResource is specified", realResponse.getServiceException().getText());
}
@@ -948,6 +905,45 @@ public class ServiceInstancesTest extends BaseTest {
}
@Test
+ public void replaceVnfInstanceNoCloudConfig() throws IOException {
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/v1/getInfraActiveRequests.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("infra/VnfLookup.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.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)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfResourceCustomization/search/findByModelCustomizationUUID[?]MODEL_CUSTOMIZATION_UUID=68dc9a92-214c-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "vnfResourceCustomization_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/vnfResourceCustomization/1/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.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/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ReplaceVnfNoCloudConfig.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"));
+ }
+
+ @Test
public void replaceVnfRecreateInstance() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
@@ -1338,7 +1334,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("No valid vfModuleCustomization is specified", realResponse.getServiceException().getText());
}
@@ -1379,6 +1375,44 @@ public class ServiceInstancesTest extends BaseTest {
}
@Test
+ public void replaceVfModuleInstanceNoCloudConfigurationTest() throws IOException {
+ wireMockServer.stubFor(
+ get(urlPathEqualTo("/aai/v19/network/generic-vnfs/generic-vnf/ff305d54-75b4-431b-adb2-eb6b9e5ff000"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("infra/Vnf.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.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)));
+ wireMockServer
+ .stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]"
+ + "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction"
+ + "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "vnfComponentRecipeDeleteVfModule_Response.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/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules/ff305d54-75b4-431b-adb2-eb6b9e5ff000/replace";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ReplaceVfModuleNoCloudConfig.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"));
+ }
+
+ @Test
public void updateVfModuleInstance() throws IOException {
wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
@@ -1429,7 +1463,6 @@ public class ServiceInstancesTest extends BaseTest {
public void createVfModuleNoModelType() throws IOException {
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
- expectedRecord.setAction("createInstance");
expectedRecord.setStatusMessage("Error parsing request: No valid modelType is specified");
expectedRecord.setProgress(100L);
expectedRecord.setSource("VID");
@@ -2142,7 +2175,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Request Failed due to BPEL error with HTTP Status = 202{\"instanceId\": \"1882939\"}",
realResponse.getServiceException().getText());
}
@@ -2177,7 +2210,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Exception caught mapping Camunda JSON response to object",
realResponse.getServiceException().getText());
}
@@ -2210,7 +2243,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertTrue(realResponse.getServiceException().getText()
.contains("<aetgt:ErrorMessage>Exception in create execution list 500"));
}
@@ -2248,14 +2281,12 @@ public class ServiceInstancesTest extends BaseTest {
requestReferences.setInstanceId("1882939");
requestReferences.setRequestSelfLink(createExpectedSelfLink("v5", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceUriPrev7 + "v5";
+ uri = servInstanceuri + "v5";
ResponseEntity<String> response =
sendRequest(inputStream("/MacroServiceInstance.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"));
+ assertEquals(404, response.getStatusCode().value());
}
@Test
@@ -2266,7 +2297,7 @@ public class ServiceInstancesTest extends BaseTest {
RequestParameters requestParameters = request.getRequestDetails().getRequestParameters();
String userParamsTxt = inputStream("/userParams.txt");
- List<Map<String, Object>> userParams = servInstances.configureUserParams(requestParameters);
+ List<Map<String, Object>> userParams = requestHandlerUtils.configureUserParams(requestParameters);
System.out.println(userParams);
assertTrue(userParams.size() > 0);
assertTrue(userParams.get(0).containsKey("name"));
@@ -2280,7 +2311,7 @@ public class ServiceInstancesTest extends BaseTest {
ServiceInstancesRequest request =
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
CloudConfiguration cloudConfig =
- servInstances.configureCloudConfig(request.getRequestDetails().getRequestParameters());
+ requestHandlerUtils.configureCloudConfig(request.getRequestDetails().getRequestParameters());
assertEquals("mdt25b", cloudConfig.getLcpCloudRegionId());
assertEquals("aefb697db6524ddebfe4915591b0a347", cloudConfig.getTenantId());
@@ -2293,7 +2324,7 @@ public class ServiceInstancesTest extends BaseTest {
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest expected =
mapper.readValue(inputStream("/LegacyMacroServiceInstance.json"), ServiceInstancesRequest.class);
- servInstances.mapToLegacyRequest(request.getRequestDetails());
+ requestHandlerUtils.mapToLegacyRequest(request.getRequestDetails());
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request));
assertThat(request, sameBeanAs(expected));
}
@@ -2380,7 +2411,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals("Exception caught mapping Camunda JSON response to object",
realResponse.getServiceException().getText());
}
@@ -2396,7 +2427,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2419,7 +2450,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.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());
@@ -2441,7 +2472,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.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$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2458,7 +2489,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2490,7 +2521,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2510,7 +2541,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstancePortConfiguration.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2527,7 +2558,7 @@ public class ServiceInstancesTest extends BaseTest {
sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(
"Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error",
realResponse.getServiceException().getText());
@@ -2572,15 +2603,6 @@ public class ServiceInstancesTest extends BaseTest {
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
assertEquals(response.getHeaders().get(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));
- assertEquals("VID", mdc.get(PARTNERNAME));
- }
- }
}
@Test
@@ -2632,7 +2654,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-RequestID header is specified");
}
@@ -2645,7 +2667,7 @@ public class ServiceInstancesTest extends BaseTest {
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);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-ONAP-PartnerName header is specified");
}
@@ -2664,7 +2686,7 @@ public class ServiceInstancesTest extends BaseTest {
// then
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(), "No valid X-RequestorID header is specified");
}
@@ -2752,7 +2774,7 @@ public class ServiceInstancesTest extends BaseTest {
ResponseEntity<String> response = sendRequest(inputStream("/UpdateNetwork.json"), uri, HttpMethod.PUT, headers);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class);
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
assertEquals(realResponse.getServiceException().getText(),
"No valid modelCustomizationId for networkResourceCustomization lookup is specified");
}
@@ -2934,15 +2956,20 @@ public class ServiceInstancesTest extends BaseTest {
Actions action = servInstances.handleReplaceInstance(Action.replaceInstance, sir);
assertEquals(Action.replaceInstanceRetainAssignments, action);
}
- /*
- * @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"; Optional<URL> actualSelfLinkUrl = 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 = buildSelfLinkUrl(incomingUrlV, requestId); assertEquals(expectedSelfLinkV,
- * actualSelfLinkUrlV.get().toString()); }
- */
+
+ @Test
+ public void getCloudConfigurationAAIEntityNotFoundTest() throws IOException {
+ RequestError expectedResponse =
+ mapper.readValue(inputStream("/AAIEntityNotFoundResponse.json"), RequestError.class);
+ 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("/ReplaceVfModuleNoCloudConfig.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
+ RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ }
+
}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java
new file mode 100644
index 0000000000..d399de0b7a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesUnitTest.java
@@ -0,0 +1,100 @@
+package org.onap.so.apihandlerinfra;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.util.HashMap;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.infra.rest.BpmnRequestBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.exception.CloudConfigurationNotFoundException;
+import org.onap.so.apihandlerinfra.vnfbeans.ModelType;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ServiceInstancesUnitTest {
+
+ @Mock
+ private BpmnRequestBuilder bpmnRequestBuilder;
+
+ @Spy
+ @InjectMocks
+ private ServiceInstances serviceInstances;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+
+ @Test
+ public void getCloudConfigurationOnReplaceVnfTest() throws ApiException {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ String requestScope = ModelType.vnf.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(cloudConfiguration).when(bpmnRequestBuilder)
+ .mapCloudConfigurationVnf("17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ CloudConfiguration result =
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+
+ assertEquals(cloudConfiguration, result);
+ }
+
+ @Test
+ public void getCloudConfigurationOnReplaceVfModuleTest() throws ApiException {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ String requestScope = ModelType.vfModule.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ instanceIdMap.put("vfModuleInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(cloudConfiguration).when(bpmnRequestBuilder).getCloudConfigurationVfModuleReplace(
+ "17c10d8e-48f4-4ee6-b162-a801943df6d6", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ CloudConfiguration result =
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+
+ assertEquals(cloudConfiguration, result);
+ }
+
+ @Test
+ public void getCloudConfigurationReturnsNullTest() throws ApiException {
+ String requestScope = ModelType.vfModule.toString();
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("vnfInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d6");
+ instanceIdMap.put("vfModuleInstanceId", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+
+ doReturn(null).when(bpmnRequestBuilder).getCloudConfigurationVfModuleReplace(
+ "17c10d8e-48f4-4ee6-b162-a801943df6d6", "17c10d8e-48f4-4ee6-b162-a801943df6d8");
+ thrown.expect(CloudConfigurationNotFoundException.class);
+ thrown.expectMessage("CloudConfiguration not found during autofill for replace request.");
+
+ serviceInstances.getCloudConfigurationOnReplace(requestScope, instanceIdMap, currentActiveRequest);
+ }
+
+ @Test
+ public void setCloudConfigurationCurrentActiveRequestTest() {
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+
+ InfraActiveRequests currentActiveRequest = new InfraActiveRequests();
+ serviceInstances.setCloudConfigurationCurrentActiveRequest(cloudConfiguration, currentActiveRequest);
+
+ assertEquals("tenantId", currentActiveRequest.getTenantId());
+ assertEquals("lcpCloudRegionId", currentActiveRequest.getCloudRegion());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
index 3644dd8e7f..faac11715a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/BpmnRequestBuilderTest.java
@@ -22,8 +22,12 @@ package org.onap.so.apihandlerinfra.infra.rest;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
@@ -32,7 +36,6 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
@@ -40,10 +43,14 @@ import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.constants.Status;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -55,15 +62,19 @@ public class BpmnRequestBuilderTest {
@Rule
public ExpectedException exceptionRule = ExpectedException.none();
+
+ @Mock
+ private AAIResourcesClient aaiResourcesClient;
+
@InjectMocks
- @Spy
- BpmnRequestBuilder reqBuilder;
+ private AAIDataRetrieval aaiData = spy(AAIDataRetrieval.class);
@Mock
private RequestsDbClient requestDBClient;
- @Mock
- private AAIResourcesClient aaiResourcesClient;
+ @InjectMocks
+ private BpmnRequestBuilder reqBuilder = spy(BpmnRequestBuilder.class);
+
private ObjectMapper mapper = new ObjectMapper();
@@ -71,8 +82,7 @@ public class BpmnRequestBuilderTest {
@Before
public void setup() {
- reqBuilder.setAaiResourcesClient(aaiResourcesClient);
-
+ // aaiData.setAaiResourcesClient(aaiResourcesClient);
}
@Test
@@ -80,11 +90,11 @@ public class BpmnRequestBuilderTest {
ServiceInstance service =
provider.getMapper().readValue(new File(RESOURCE_PATH + "ServiceInstance.json"), ServiceInstance.class);
- doReturn(service).when(reqBuilder).getServiceInstance("serviceId");
+ doReturn(service).when(aaiData).getServiceInstance("serviceId");
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedServiceRequest.json"), ServiceInstancesRequest.class);
- expectedRequest.getRequestDetails().getModelInfo().setModelId(null);
- // bad getter/setter setting multiple fields
+ expectedRequest.getRequestDetails().getModelInfo().setModelId(null); // bad getter/setter setting multiple
+ // fields
ServiceInstancesRequest actualRequest = reqBuilder.buildServiceDeleteRequest("serviceId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
@@ -128,13 +138,59 @@ public class BpmnRequestBuilderTest {
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId"));
VolumeGroup volumeGroup =
provider.getMapper().readValue(new File(RESOURCE_PATH + "VolumeGroup.json"), VolumeGroup.class);
-
- doReturn(Optional.of(volumeGroup)).when(aaiResourcesClient).get(VolumeGroup.class, AAIUriFactory
- .createResourceUri(AAIObjectType.VOLUME_GROUP, "cloudOwner", "regionOne", "volumeGroupId"));
+ AAIResultWrapper wrapper = new AAIResultWrapper(volumeGroup);
+ doReturn(wrapper).when(aaiResourcesClient)
+ .get(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
+ .relatedTo(AAIObjectType.VOLUME_GROUP, "volumeGroupId"));
ServiceInstancesRequest expectedRequest = mapper
.readValue(new File(RESOURCE_PATH + "ExpectedVolumeGroupRequest.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest actualRequest = reqBuilder.buildVolumeGroupDeleteRequest("vnfId", "volumeGroupId");
assertThat(actualRequest, sameBeanAs(expectedRequest));
}
+
+ @Test
+ public void test_getCloudConfigurationVfModuleReplace() throws Exception {
+ String vnfId = "vnfId";
+ String vfModuleId = "vfModuleId";
+
+ GenericVnf vnf = provider.getMapper().readValue(new File(RESOURCE_PATH + "Vnf.json"), GenericVnf.class);
+
+ doReturn(Optional.of(vnf)).when(aaiResourcesClient).get(GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+
+ CloudConfiguration result = reqBuilder.getCloudConfigurationVfModuleReplace(vnfId, vfModuleId);
+ assertEquals("0422ffb57ba042c0800a29dc85ca70f8", result.getTenantId());
+ assertEquals("cloudOwner", result.getCloudOwner());
+ assertEquals("regionOne", result.getLcpCloudRegionId());
+ }
+
+ @Test
+ public void test_mapCloudConfigurationVnf() throws Exception {
+ String vnfId = "6fb01019-c3c4-41fe-b307-d1c56850b687";
+ Map<String, String[]> filters = new HashMap<>();
+ filters.put("vnfId", new String[] {"EQ", vnfId});
+ filters.put("requestStatus", new String[] {"EQ", Status.COMPLETE.toString()});
+ filters.put("action", new String[] {"EQ", "createInstance"});
+
+ ServiceInstancesRequest serviceRequest = new ServiceInstancesRequest();
+ CloudConfiguration cloudConfiguration = new CloudConfiguration();
+ RequestDetails requestDetails = new RequestDetails();
+ cloudConfiguration.setCloudOwner("cloudOwner");
+ cloudConfiguration.setTenantId("tenantId");
+ cloudConfiguration.setLcpCloudRegionId("lcpCloudRegionId");
+ requestDetails.setCloudConfiguration(cloudConfiguration);
+ serviceRequest.setRequestDetails(requestDetails);
+
+ doReturn(filters).when(reqBuilder).createQueryRequest("vnfId", vnfId);
+ doReturn(Optional.of(serviceRequest)).when(reqBuilder).findServiceInstanceRequest(filters);
+
+
+ CloudConfiguration result = reqBuilder.mapCloudConfigurationVnf(vnfId);
+ assertEquals("tenantId", result.getTenantId());
+ assertEquals("cloudOwner", result.getCloudOwner());
+ assertEquals("lcpCloudRegionId", result.getLcpCloudRegionId());
+ }
+
}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
index 59308215ac..0ae963ab15 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/NetworkRestHandlerTest.java
@@ -108,7 +108,6 @@ public class NetworkRestHandlerTest {
public void test_createInfraActiveRequestForDelete() throws Exception {
InfraActiveRequests expected = new InfraActiveRequests();
expected.setRequestAction(Action.deleteInstance.toString());
- expected.setAction(Action.deleteInstance.toString());
expected.setServiceInstanceId("serviceInstanceId");
expected.setNetworkId("networkId");
expected.setRequestId("requestId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
index c1e6347943..602eb51f41 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/ServiceInstanceRestHandlerTest.java
@@ -154,7 +154,6 @@ public class ServiceInstanceRestHandlerTest {
public void test_createInfraActiveRequestForDelete() throws Exception {
InfraActiveRequests expected = new InfraActiveRequests();
expected.setRequestAction(Action.deleteInstance.toString());
- expected.setAction(Action.deleteInstance.toString());
expected.setServiceInstanceId("serviceInstanceId");
expected.setRequestId("requestId");
expected.setRequestorId("userId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
index 7d146791fe..ca81124833 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VfModuleRestHandlerTest.java
@@ -154,7 +154,6 @@ public class VfModuleRestHandlerTest {
public void test_createInfraActiveRequestForDelete() throws Exception {
InfraActiveRequests expected = new InfraActiveRequests();
expected.setRequestAction(Action.deleteInstance.toString());
- expected.setAction(Action.deleteInstance.toString());
expected.setServiceInstanceId("serviceInstanceId");
expected.setVnfId("vnfId");
expected.setVfModuleId("vfModuleId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
index 03725ec85b..3ae3abb16d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandlerTest.java
@@ -119,7 +119,6 @@ public class VnfRestHandlerTest {
public void test_createInfraActiveRequestForDelete() throws Exception {
InfraActiveRequests expected = new InfraActiveRequests();
expected.setRequestAction(Action.deleteInstance.toString());
- expected.setAction(Action.deleteInstance.toString());
expected.setServiceInstanceId("serviceInstanceId");
expected.setVnfId("vnfId");
expected.setRequestId("requestId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
index efa27743ef..1315f13892 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/VolumeRestHandlerTest.java
@@ -109,7 +109,6 @@ public class VolumeRestHandlerTest {
public void test_createInfraActiveRequestForDelete() throws Exception {
InfraActiveRequests expected = new InfraActiveRequests();
expected.setRequestAction(Action.deleteInstance.toString());
- expected.setAction(Action.deleteInstance.toString());
expected.setServiceInstanceId("serviceInstanceId");
expected.setVnfId("vnfId");
expected.setVolumeGroupId("volumeGroupId");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
index a74c11c08b..71784fa286 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
@@ -262,7 +262,6 @@ public class CloudOrchestrationTest extends BaseTest {
iar.setRequestId("requestId");
iar.setOperationalEnvName("myVnfOpEnv");
iar.setRequestStatus(Status.IN_PROGRESS.toString());
- iar.setAction(Action.create.toString());
iar.setRequestAction(Action.create.toString());
iar.setRequestScope("UNKNOWN");
// iarRepo.saveAndFlush(iar);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
index 5f12060059..1917ee592f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
@@ -271,7 +271,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest {
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId("requestId-getOpEnvFilterEx1");
iar.setRequestScope("requestScope");
- iar.setRequestType("requestType");
iar.setOperationalEnvId("operationalEnvironmentId");
iar.setOperationalEnvName("operationalEnvName");
iar.setRequestorId("xxxxxx");
@@ -296,7 +295,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest {
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId("requestIdFilterException2");
iar.setRequestScope("requestScope");
- iar.setRequestType("requestType");
iar.setOperationalEnvId("operationalEnvId");
iar.setOperationalEnvName("operationalEnvName");
iar.setRequestorId("xxxxxx");
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 3114f91096..8d8f4969d7 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
@@ -95,7 +95,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(iar)).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/")).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"))
+ "{\"requestId\":\"123\",\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: SUCCESSFULLY Created ECOMP OperationalEnvironment.\",\"progress\":100"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -127,7 +127,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest {
.withBody(mapper.writeValueAsString(iar)).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
.withRequestBody(containing("{\"requestId\":\"" + uuid
- + "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:"))
+ + "\",\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:"))
.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 ebed4fa16b..6c00f8db27 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
@@ -151,7 +151,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest {
ObjectMapper mapper = new ObjectMapper();
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
.withRequestBody(containing("{\"requestId\":\"" + requestId
- + "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ + "\",\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -188,7 +188,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest {
ObjectMapper mapper = new ObjectMapper();
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
.withRequestBody(containing("{\"requestId\":\"" + requestId
- + "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ + "\",\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
.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/DeactivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
index 16738e9799..9911bb8cb8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
@@ -64,7 +64,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest {
public void init() {
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
.withRequestBody(containing("{\"requestId\":\"" + requestId
- + "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ + "\",\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
}
@@ -129,7 +129,7 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest {
.withBody(mapper.writeValueAsString(iar)).withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
.withRequestBody(containing("{\"requestId\":\"" + requestId
- + "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE"))
+ + "\",\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE"))
.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/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index f178a3c0cb..2e9576cf7c 100644
--- 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
@@ -28,12 +28,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
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;
@@ -48,7 +45,6 @@ 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 {
@@ -79,36 +75,10 @@ public class GRMClientTest extends BaseTest {
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");
-
wireMockServer.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();
+ .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO.APIH")));
}
@Test
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 6d8e2e8b09..f5373a1f15 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,16 +1,17 @@
-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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, 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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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', '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, '19123c2924c648eb8e42a3c1f14b7682', 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, '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', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, '381b9ff6c75e4625b7a4182f90fc68d3', 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', null, null, null, 'MODULENAME1', 'moduleModelName', '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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, 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', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', 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, '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', '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, 'a259ae7b7c3f493cb3d91f95a7c18149', 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, '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', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', 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, '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', '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, 'a259ae7b7c3f493cb3d91f95a7c18149', 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, '1882935', null, '1882934', 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/OrchestrationRequest/getRequestProcessingDataArray.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
new file mode 100644
index 0000000000..c746020e7f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
@@ -0,0 +1,8 @@
+[{
+ "id": 1,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "name": "requestAction",
+ "value": "assign",
+ "tag": "pincFabricConfigRequest"
+}]
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json
new file mode 100644
index 0000000000..2004a82ed7
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/AAIEntityNotFoundResponse.json
@@ -0,0 +1,8 @@
+{
+ "requestError": {
+ "serviceException": {
+ "messageId": "SVC0001",
+ "text": "Generic Vnf Not Found In Inventory, VnfId: ff305d54-75b4-431b-adb2-eb6b9e5ff000"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json
new file mode 100644
index 0000000000..63021b611f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json
@@ -0,0 +1,20 @@
+{
+ "requestDetails": {
+ "requestParameters": {
+ "userParams": [{
+ "nrmObj": {
+ "EUtranGenericCell" : [
+ {"cellLocalId":1, "pci":5},
+ {"cellLocalId":2, "pci":6}
+ ],
+ "ExternalEUtranCell" : [
+ {"cellLocalId":3, "eNBId": "x"},
+ {"cellLocalId":4, "eNBId": "y"}
+ ],
+ "EUtranRelation": [{"scellLocalId":5, "tcellLocalId":6}]
+ }
+ }],
+ "payload": "[{\"GNBDUFunction\":{\"gNBId\":1,\"gNBDUId\":5}}]"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json
new file mode 100644
index 0000000000..766d49bee8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModuleNoCloudConfig.json
@@ -0,0 +1,28 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "testService60"
+ },
+ "requestParameters": {
+ "aLaCarte": true,
+ "autoBuildVfModules": false,
+ "subscriptionServiceType": "test"
+ },
+ "modelInfo":{
+ "modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "modelVersion":"2",
+ "modelVersionId":"78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelType":"vfModule",
+ "modelName":"serviceModel",
+ "modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "MSO_1610_dev",
+ "subscriberName": "MSO_1610_dev"
+ }
+ }
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json
new file mode 100644
index 0000000000..46873588c0
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVnfNoCloudConfig.json
@@ -0,0 +1,58 @@
+{
+ "vnfInstanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "modelName": "vSAMP12..base..module-0",
+ "modelVersion": "1",
+ "modelVersionId": "1",
+ "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671"
+ },
+ "requestInfo": {
+ "instanceName": "VNFTEST-10",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "xxxxxx",
+ "productFamilyId": "FamilyID"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "instanceDirection": "source",
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "b0ed83ec-b7b4-4c70-91c2-63feeaf8609b"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "aLaCarte": true,
+ "userParams": []
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lobName"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
new file mode 100644
index 0000000000..a6aa3e1c25
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceNoOE.json
@@ -0,0 +1,33 @@
+{
+ "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",
+ "disableOwningEntityProject": true
+ },
+ "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": "someTestId",
+ "subscriberName": "someTestId"
+ }
+ }
+}
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 6be015694c..c79900a15d 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,7 +1,5 @@
{
"requestId":"f0a35706-efc4-4e27-80ea-a995d7a2a40f",
- "clientRequestId":null,
- "action":"activateInstance",
"requestStatus":"UNLOCKED",
"statusMessage":null,
"progress":20,
@@ -12,23 +10,19 @@
"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",
+ "cloudRegion":"n6",
"callBackUrl":null,
"correlator":null,
"serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d",
@@ -47,4 +41,4 @@
},
"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/InfraActiveRequests/getInfraActiveRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequest.json
index d63525b297..db33df4d76 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequest.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequest.json
@@ -1,6 +1,4 @@
{
- "clientRequestId": null,
- "action": "deleteInstance",
"requestStatus": "%2$s",
"statusMessage": null,
"progress": 20,
@@ -11,23 +9,19 @@
"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": "2018-07-30T10:06:12.000+0000",
- "requestType": null,
"volumeGroupId": null,
"volumeGroupName": null,
"vfModuleId": null,
"vfModuleName": null,
"vfModuleModelName": null,
- "aaiServiceId": null,
- "aicCloudRegion": "n6",
+ "cloudRegion": "n6",
"callBackUrl": null,
"correlator": null,
"serviceInstanceId": "9e15a443-af65-4f05-9000-47ae495e937d",
@@ -51,4 +45,4 @@
"href": "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/InfraActiveRequests/getInfraActiveRequestNoBody.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequestNoBody.json
index 21568e5273..f36ae0f9da 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequestNoBody.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/InfraActiveRequests/getInfraActiveRequestNoBody.json
@@ -1,5 +1,4 @@
{
- "clientRequestId": null,
"action": "deleteInstance",
"requestStatus": "%2$s",
"statusMessage": null,
@@ -11,23 +10,19 @@
"vnfName": null,
"vnfType": null,
"serviceType": null,
- "aicNodeClli": null,
"tenantId": null,
- "provStatus": null,
"vnfParams": null,
"vnfOutputs": null,
"requestBody": null,
"responseBody": null,
"lastModifiedBy": "APIH",
"modifyTime": "2018-07-30T10:06:12.000+0000",
- "requestType": null,
"volumeGroupId": null,
"volumeGroupName": null,
"vfModuleId": null,
"vfModuleName": null,
"vfModuleModelName": null,
- "aaiServiceId": null,
- "aicCloudRegion": "n6",
+ "cloudRegion": "n6",
"callBackUrl": null,
"correlator": null,
"serviceInstanceId": "9e15a443-af65-4f05-9000-47ae495e937d",
@@ -51,4 +46,4 @@
"href": "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/catalogdb/workflow_pnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json
new file mode 100644
index 0000000000..133d8bed9b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_pnf_Response.json
@@ -0,0 +1,5 @@
+{
+ "artifactUUID": "81526781-e55c-4cb7-adb3-97e09d9c76bf",
+ "artifactName": "testingPNFWorkflow.bpmn",
+ "name": "testingPNFWorkflow"
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
index 09f6d81da3..0b03f56caa 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/Vnf.json
@@ -101,7 +101,7 @@
},
{
"relationship-key": "volume-group.volume-group-id",
- "relationship-value": "18b220c8-af84-4b82-a8c0-41bbea6328a6"
+ "relationship-value": "volumeGroupId"
}
]
},
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json
new file mode 100644
index 0000000000..eef0776f5d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/infra/VnfLookup.json
@@ -0,0 +1,30 @@
+[
+ {
+ "requestId":"b15f30dc-56b1-4a1a-aaf1-156c0d685142",
+ "action":"createInstance",
+ "requestStatus":"COMPLETE",
+ "statusMessage":"ALaCarte-Vnf-createInstance request was executed correctly.",
+ "flowStatus":"Successfully completed all Building Blocks",
+ "progress":100,
+ "startTime":"2019-11-11T19:28:56.000+0000",
+ "endTime":"2019-11-11T19:29:15.000+0000",
+ "source":"VID",
+ "vnfId":"5b20c24e-cabb-4725-8f88-57ca99a8ffe1",
+ "vnfName":"Robot_VNF_For_Volume_Group",
+ "vnfType":"Vf zrdm5bpxmc02092017-Service/Vf zrdm5bpxmc02092017-VF 0",
+ "tenantId":"0422ffb57ba042c0800a29dc85ca70f8",
+ "requestBody":"{\"requestDetails\": {\"relatedInstanceList\": [{\"relatedInstance\": {\"instanceId\": \"f5435110-b276-4920-9261-a18a5582d357\", \"modelInfo\": {\"modelVersionId\": \"bad955c3-29b2-4a27-932e-28e942cc6480\", \"modelVersion\": \"1\", \"modelName\": \"Vf zrdm5bpxmc02092017-Service\", \"modelInvariantId\": \"b16a9398-ffa3-4041-b78c-2956b8ad9c7b\", \"modelType\": \"service\"}}}], \"requestParameters\": {\"userParams\": [], \"enforceValidNfValues\": false, \"testApi\": \"GR_API\"}, \"lineOfBusiness\": {\"lineOfBusinessName\": \"vSAMP12_14-2XXX-Aug18-9001 - LOB\"}, \"requestInfo\": {\"source\": \"VID\", \"requestorId\": \"az2016\", \"instanceName\": \"Robot_VNF_For_Volume_Group\", \"suppressRollback\": false, \"productFamilyId\": \"06f76284-8710-11e6-ae22-56b6b6499611\"}, \"platform\": {\"platformName\": \"vSAMP12_14-2XXX-Aug18-9001 - Platform\"}, \"modelInfo\": {\"modelName\": \"Vf zrdm5bpxmc02092017-VF\", \"modelVersion\": \"1\", \"modelInvariantId\": \"23122c9b-dd7f-483f-bf0a-e069303db2f7\", \"modelType\": \"vnf\", \"modelCustomizationName\": \"Vf zrdm5bpxmc02092017-VF 0\", \"modelVersionId\": \"d326f424-2312-4dd6-b7fe-364fadbd1ef5\", \"modelCustomizationId\": \"96c23a4a-6887-4b2c-9cce-1e4ea35eaade\"}, \"cloudConfiguration\": {\"cloudOwner\": \"cloudOwner\", \"tenantId\": \"0422ffb57ba042c0800a29dc85ca70f8\", \"lcpCloudRegionId\": \"regionOne\"}}}",
+ "lastModifiedBy":"CamundaBPMN",
+ "modifyTime":"2019-11-11T19:29:15.000+0000",
+ "cloudRegion":"regionOne",
+ "serviceInstanceId":"f5435110-b276-4920-9261-a18a5582d357",
+ "requestScope":"vnf",
+ "requestAction":"createInstance",
+ "requestorId":"az2016",
+ "requestUrl":"http://192.168.99.100:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/f5435110-b276-4920-9261-a18a5582d357/vnfs",
+ "cloudApiRequests":[
+
+ ],
+ "requestURI":"b15f30dc-56b1-4a1a-aaf1-156c0d685142"
+ }
+]
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 2e1c6a9bdc..1d6722278c 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
@@ -9,14 +9,22 @@ server:
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}
-
+ - subsystem: apih
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: asdc
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: bpmn
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: catalogdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: openstack
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: requestdb
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: sdnc
+ uri: http://localhost:${wiremock.server.port}
+ - subsystem: soappcorchestrator
+ uri: http://localhost:${wiremock.server.port}
infra-requests:
archived:
period: 180
@@ -118,7 +126,13 @@ mariaDB4j:
port: 3307
databaseName: catalogdb
databaseName2: requestdb
-
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
org:
onap:
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 22f68e0579..5a1c532d0e 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,27 +1,22 @@
--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, 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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-
+INSERT INTO requestdb.infra_active_requests(REQUEST_ID, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, 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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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', '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, '19123c2924c648eb8e42a3c1f14b7682', 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, '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', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, '381b9ff6c75e4625b7a4182f90fc68d3', 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', null, null, null, 'MODULENAME1', 'moduleModelName', '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', '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, '6accefef3cb442ff9e644d589fb04107', 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, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', '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, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, 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', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', 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, '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', '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, 'a259ae7b7c3f493cb3d91f95a7c18149', 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, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, null),
+('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', 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, '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', '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, 'a259ae7b7c3f493cb3d91f95a7c18149', 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, '1882935', null, '1882934', 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
('testSite', 0, '2017-11-30 15:48:09');
-
-
INSERT INTO requestdb.activate_operational_env_service_model_distribution_status(OPERATIONAL_ENV_ID, SERVICE_MODEL_VERSION_ID, REQUEST_ID, SERVICE_MOD_VER_FINAL_DISTR_STATUS, RECOVERY_ACTION, RETRY_COUNT_LEFT, WORKLOAD_CONTEXT, CREATE_TIME, MODIFY_TIME, VNF_OPERATIONAL_ENV_ID) VALUES
('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '37305814-4949-45ce-ae24-c378c7ed07d1', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'RETRY', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:45:06', 'vnf_1234'),
('1dfe7154-eae0-44f2-8e7a-8e5e7882e55d', '7bfa2197-8cbb-4080-b369-56c4d53c4573', '483646fe-36cc-4e90-895a-c472f6da3f74', 'DISTRIBUTION_COMPLETE_OK', 'SKIP', 0, 'VNF_D2D', '2018-02-02 18:44:27', '2018-02-02 18:44:56', 'vnf_1235');
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 731d2bec4d..050780c9a2 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
@@ -809,6 +809,10 @@ CREATE TABLE `service` (
`OVERALL_DISTRIBUTION_STATUS` varchar(45),
`ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL,
`NAMING_POLICY` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -963,6 +967,7 @@ CREATE TABLE `vf_module_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VF_MODULE_MODEL_UUID` varchar(200) NOT NULL,
`VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`ID`),
KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`),
KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`),
@@ -1111,7 +1116,9 @@ CREATE TABLE `vnf_resource_customization` (
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `NF_DATA_VALID` tinyint(1) DEFAULT '0',
`VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`),
KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`),
@@ -1192,6 +1199,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
@@ -1247,8 +1255,6 @@ USE requestdb;
CREATE TABLE `infra_active_requests` (
`REQUEST_ID` varchar(45) NOT NULL,
- `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL,
- `ACTION` varchar(45) DEFAULT NULL,
`REQUEST_STATUS` varchar(20) DEFAULT NULL,
`STATUS_MESSAGE` longtext DEFAULT NULL,
`PROGRESS` bigint(20) DEFAULT NULL,
@@ -1256,26 +1262,23 @@ CREATE TABLE `infra_active_requests` (
`END_TIME` datetime DEFAULT NULL,
`SOURCE` varchar(45) DEFAULT NULL,
`VNF_ID` varchar(45) DEFAULT NULL,
+ `PNF_ID` varchar(45) DEFAULT NULL,
`VNF_NAME` varchar(80) DEFAULT NULL,
`VNF_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(45) DEFAULT NULL,
- `AIC_NODE_CLLI` varchar(11) DEFAULT NULL,
`TENANT_ID` varchar(45) DEFAULT NULL,
- `PROV_STATUS` varchar(20) DEFAULT NULL,
`VNF_PARAMS` longtext,
`VNF_OUTPUTS` longtext,
`REQUEST_BODY` longtext,
`RESPONSE_BODY` longtext,
`LAST_MODIFIED_BY` varchar(100) DEFAULT NULL,
`MODIFY_TIME` datetime DEFAULT NULL,
- `REQUEST_TYPE` varchar(20) DEFAULT NULL,
`VOLUME_GROUP_ID` varchar(45) DEFAULT NULL,
`VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL,
`VF_MODULE_ID` varchar(45) DEFAULT NULL,
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
- `AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1294,14 +1297,11 @@ CREATE TABLE `infra_active_requests` (
`ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
`EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
`ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
- PRIMARY KEY (`REQUEST_ID`),
- UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`)
+ PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `archived_infra_requests` (
`REQUEST_ID` varchar(45) NOT NULL,
- `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL,
- `ACTION` varchar(45) DEFAULT NULL,
`REQUEST_STATUS` varchar(20) DEFAULT NULL,
`STATUS_MESSAGE` longtext DEFAULT NULL,
`PROGRESS` bigint(20) DEFAULT NULL,
@@ -1312,23 +1312,19 @@ CREATE TABLE `archived_infra_requests` (
`VNF_NAME` varchar(80) DEFAULT NULL,
`VNF_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(45) DEFAULT NULL,
- `AIC_NODE_CLLI` varchar(11) DEFAULT NULL,
`TENANT_ID` varchar(45) DEFAULT NULL,
- `PROV_STATUS` varchar(20) DEFAULT NULL,
`VNF_PARAMS` longtext,
`VNF_OUTPUTS` longtext,
`REQUEST_BODY` longtext,
`RESPONSE_BODY` longtext,
`LAST_MODIFIED_BY` varchar(100) DEFAULT NULL,
`MODIFY_TIME` datetime DEFAULT NULL,
- `REQUEST_TYPE` varchar(20) DEFAULT NULL,
`VOLUME_GROUP_ID` varchar(45) DEFAULT NULL,
`VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL,
`VF_MODULE_ID` varchar(45) DEFAULT NULL,
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
- `AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1344,8 +1340,7 @@ CREATE TABLE `archived_infra_requests` (
`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`)
+ PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `site_status` (