diff options
Diffstat (limited to 'vid-app-common/src/test')
11 files changed, 652 insertions, 128 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java index ca7a163a8..6055bc390 100644 --- a/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/controllers/HealthCheckControllerTest.java @@ -1,18 +1,32 @@ package org.onap.vid.controllers; +import org.apache.log4j.BasicConfigurator; +import org.junit.Before; import org.junit.Test; -import org.onap.vid.controllers.HealthCheckController; import org.onap.vid.controllers.HealthCheckController.HealthStatus; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + public class HealthCheckControllerTest { - private HealthCheckController createTestSubject() { - return new HealthCheckController(); + private HealthCheckController testSubject; + private MockMvc mockMvc; + + @Before + public void setUp() { + testSubject = new HealthCheckController(); + BasicConfigurator.configure(); + mockMvc = MockMvcBuilders.standaloneSetup(testSubject).build(); } @Test public void testGetProfileCount() throws Exception { - HealthCheckController testSubject; String driver = ""; String URL = ""; String username = ""; @@ -20,29 +34,34 @@ public class HealthCheckControllerTest { int result; // default test - testSubject = createTestSubject(); result = testSubject.getProfileCount(driver, URL, username, password); } @Test public void testGethealthCheckStatusforIDNS() throws Exception { - HealthCheckController testSubject; HealthStatus result; // default test - testSubject = createTestSubject(); result = testSubject.gethealthCheckStatusforIDNS(); } @Test public void testGetHealthCheck() throws Exception { - HealthCheckController testSubject; String UserAgent = ""; String ECOMPRequestID = ""; HealthStatus result; // default test - testSubject = createTestSubject(); result = testSubject.getHealthCheck(UserAgent, ECOMPRequestID); } + + @Test + public void testCommitInfoEndpoint() throws Exception { + mockMvc.perform(get("/commitInfo") + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.commitId").value("123987")) + .andExpect(jsonPath("$.commitMessageShort").value("Test short commit message")) + .andExpect(jsonPath("$.commitTime").value("1999-09-12T13:48:55+0200")); + } }
\ No newline at end of file diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java index 36f4bdd43..54e924d95 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java @@ -1,12 +1,14 @@ package org.onap.vid.mso; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.mockito.*; +import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.changeManagement.RequestDetailsWrapper; +import org.onap.vid.controllers.MsoController; +import org.onap.vid.mso.rest.Request; import org.onap.vid.mso.rest.RequestDetails; import org.onap.vid.properties.Features; -import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; import org.springframework.test.context.web.WebAppConfiguration; @@ -16,16 +18,32 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import org.togglz.core.manager.FeatureManager; -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.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.*; import static org.onap.vid.controllers.MsoController.SVC_INSTANCE_ID; -import static org.onap.vid.controllers.MsoController.VNF_INSTANCE_ID; import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath; @ContextConfiguration(classes = {SystemProperties.class}) @WebAppConfiguration public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { + private static final String SERVICE_INSTANCE_ID = "1"; + private static final String VNF_INSTANCE_ID = "1"; + private static final String EXPECTED_SCALE_OUT_PATH = "/serviceInstantiation/v7/serviceInstances/1/vnfs/1/vfModules/scaleOut"; + private static final Path PATH_TO_NOT_PROCESSED_SCALE_OUT_REQUEST = Paths.get("src", "test", "resources", "payload_jsons", "scaleOutVfModulePayload.json"); + private static final Path PATH_TO_FINAL_SCALE_OUT_REQUEST = Paths.get("src", "test", "resources", "payload_jsons", "scaleOutVfModulePayloadToMso.json"); + private static final Path PATH_TO_EXPECTED_MSO_MODEL_TYPE_REQ = Paths.get("src", "test", "resources", "payload_jsons", "mso_model_info_sample_response.json"); + private static final Path PATH_TO_EXPECTED_MSO_SCALEOUT_REQ = Paths.get("src", "test", "resources", "payload_jsons", "mso_action_scaleout_sample_response.json"); + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + @InjectMocks private MsoBusinessLogicImpl msoBusinessLogic; @@ -37,31 +55,31 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { @BeforeTest - public void initMocks(){ + public void initMocks() { MockitoAnnotations.initMocks(this); } @Test - public void validateEndpointPath_endPointIsNotEmptyAndVaild_returnProperty(){ - System.setProperty("TestEnv","123"); + public void validateEndpointPath_endPointIsNotEmptyAndVaild_returnProperty() { + System.setProperty("TestEnv", "123"); String foundEndPoint = validateEndpointPath("TestEnv"); - Assert.assertEquals("123",foundEndPoint); + Assert.assertEquals("123", foundEndPoint); } @Test(expectedExceptions = RuntimeException.class) - public void validateEndpointPath_endPointIsNull_throwRuntimeException(){ + public void validateEndpointPath_endPointIsNull_throwRuntimeException() { validateEndpointPath("NotExists"); } @Test(expectedExceptions = RuntimeException.class) - public void validateEndpointPath_endPointIsNotEmptyButDoesntExists_throwRuntimeException(){ - System.setProperty("EmptyEndPoint",""); + public void validateEndpointPath_endPointIsNotEmptyButDoesntExists_throwRuntimeException() { + System.setProperty("EmptyEndPoint", ""); validateEndpointPath("EmptyEndPoint"); } //@Test(dataProvider = "unAssignOrDeleteParams") - public void deleteSvcInstance_verifyEndPointPathConstructing_unAssignFeatureOffOrUnAssignFlagIsFalse(boolean isAssignFlag,String status) { + public void deleteSvcInstance_verifyEndPointPathConstructing_unAssignFeatureOffOrUnAssignFlagIsFalse(boolean isAssignFlag, String status) { Mockito.reset(msoInterfaceMock); String endpoint = validateEndpointPath(isAssignFlag ? MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE : MsoProperties.MSO_REST_API_SVC_INSTANCE); RequestDetails requestDetails = new RequestDetails(); @@ -114,7 +132,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, "serviceInstanceTempId"); - msoBusinessLogic.deleteVnf(requestDetails, "serviceInstanceTempId","vnfInstanceTempId"); + msoBusinessLogic.deleteVnf(requestDetails, "serviceInstanceTempId", "vnfInstanceTempId"); verify(msoInterfaceMock).deleteVnf(requestDetails, vnf_endpoint + "/vnfInstanceTempId"); } @@ -123,31 +141,64 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests { String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); RequestDetails requestDetails = new RequestDetails(); - String vf__modules_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, "serviceInstanceTempId").replaceFirst(VNF_INSTANCE_ID, "vnfInstanceTempId"); + String vf__modules_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, "serviceInstanceTempId").replaceFirst(MsoController.VNF_INSTANCE_ID, "vnfInstanceTempId"); + + msoBusinessLogic.deleteVfModule(requestDetails, "serviceInstanceTempId", "vnfInstanceTempId", "vfModuleTempId"); + verify(msoInterfaceMock).deleteVfModule(requestDetails, vf__modules_endpoint + "/vfModuleTempId"); + } + + + @Test + public void shouldSendProperScaleOutRequest() throws IOException { + ArgumentCaptor<RequestDetailsWrapper> requestDetailsWrapperArgumentCaptor = ArgumentCaptor.forClass(RequestDetailsWrapper.class); + org.onap.vid.changeManagement.RequestDetails requestDetails = getScaleOutRequest(); + RequestDetailsWrapper expectedRequestWrapper = getExpectedRequestWrapper(); + + msoBusinessLogic.scaleOutVfModuleInstance(requestDetails, SERVICE_INSTANCE_ID, VNF_INSTANCE_ID); + + verify(msoInterfaceMock).scaleOutVFModuleInstance(requestDetailsWrapperArgumentCaptor.capture(), eq(EXPECTED_SCALE_OUT_PATH)); + RequestDetailsWrapper actual = requestDetailsWrapperArgumentCaptor.getAllValues().get(0); - msoBusinessLogic.deleteVfModule(requestDetails, "serviceInstanceTempId","vnfInstanceTempId", "vfModuleTempId"); - verify(msoInterfaceMock).deleteVfModule(requestDetails, vf__modules_endpoint + "/vfModuleTempId" ); + assertThat(expectedRequestWrapper.requestDetails).isEqualTo(actual.requestDetails); } @Test - public void insertServiceInstantiationToDB_StartJob() { - -// broker = new JobsBrokerServiceInDatabaseImpl(dataAccessServiceMock, sessionFactory); -// ((JobsBrokerServiceInDatabaseImpl)broker).deleteAll(); -// -//// msoBusinessLogic.setDataAccessService(dataAccessServiceMock); -//// msoBusinessLogic.setJobsBrokerService(broker); -//// msoBusinessLogic.setJobAdapter(jobAdapter); -// -// ServiceInstantiation serviceInstantiation = new ServiceInstantiation(); -// serviceInstantiation.setCount(2); -// serviceInstantiation.setInstanceName("TestName"); -// -// msoBusinessLogic.pushBulkJob(serviceInstantiation, "testUserId"); -// -// List<ServiceInfo> serviceInfoList = dataAccessServiceMock.getList(ServiceInfo.class, null); -// int k = 9; -// Assert.assertEquals(serviceInstantiation, containsInAnyOrder(serviceInfoList.toArray())); + public void shouldFilterOutOrchestrationRequestsNotAllowedInDashboard() throws IOException { + String vnfModelTypeOrchestrationRequests = getFileContentAsString(PATH_TO_EXPECTED_MSO_MODEL_TYPE_REQ); + String scaleOutActionOrchestrationRequests = getFileContentAsString(PATH_TO_EXPECTED_MSO_SCALEOUT_REQ); + + MsoResponseWrapper msoResponseWrapperMock = mock(MsoResponseWrapper.class); + when(msoInterfaceMock.getOrchestrationRequestsForDashboard(any(String.class), any(String.class), any(String.class), any(RestObject.class))) + .thenReturn(msoResponseWrapperMock); + when(msoResponseWrapperMock.getEntity()).thenReturn(vnfModelTypeOrchestrationRequests, scaleOutActionOrchestrationRequests); + + List<Request> filteredOrchestrationReqs = msoBusinessLogic.getOrchestrationRequestsForDashboard(); + + assertThat(filteredOrchestrationReqs).hasSize(3); + assertThat(MsoBusinessLogicImpl.DASHBOARD_ALLOWED_TYPES) + .containsAll(filteredOrchestrationReqs + .stream() + .map(el -> el.getRequestType().toUpperCase()) + .collect(Collectors.toList())); + assertThat(filteredOrchestrationReqs + .stream() + .map(org.onap.vid.domain.mso.Request::getRequestScope) + .collect(Collectors.toList())) + .containsOnly("vnf", "vfModule"); + } + + + private String getFileContentAsString(Path pathToFile) throws IOException { + return new String(Files.readAllBytes(pathToFile)); + } + + private org.onap.vid.changeManagement.RequestDetails getScaleOutRequest() throws IOException { + return OBJECT_MAPPER.readValue(PATH_TO_NOT_PROCESSED_SCALE_OUT_REQUEST.toFile(), org.onap.vid.changeManagement.RequestDetails.class); + } + + private RequestDetailsWrapper getExpectedRequestWrapper() throws IOException { + return OBJECT_MAPPER.readValue(PATH_TO_FINAL_SCALE_OUT_REQUEST.toFile(), new TypeReference<RequestDetailsWrapper<org.onap.vid.changeManagement.RequestDetails>>() { + }); } } diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java index 402386a50..69966407d 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java @@ -21,17 +21,11 @@ package org.onap.vid.mso.rest; import com.xebialabs.restito.server.StubServer; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Properties; -import java.util.UUID; import org.glassfish.grizzly.http.util.HttpStatus; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.portalsdk.core.util.SystemProperties; import org.onap.vid.client.SyncRestClient; import org.onap.vid.controllers.MsoController; import org.onap.vid.mso.MsoInterface; @@ -39,16 +33,30 @@ import org.onap.vid.mso.MsoProperties; import org.onap.vid.mso.MsoResponseWrapper; import org.onap.vid.mso.MsoResponseWrapperInterface; import org.onap.vid.mso.RestObject; +import org.springframework.test.context.ContextConfiguration; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Properties; +import java.util.UUID; + +import static org.onap.vid.controllers.MsoController.SVC_INSTANCE_ID; +import static org.onap.vid.controllers.MsoController.VNF_INSTANCE_ID; + +@ContextConfiguration(classes = {SystemProperties.class}) public class MsoRestClientNewTest { private static StubServer server; private static StubServer securedServer; private static Properties props = new Properties(); private static String msoCreateServiceInstanceJson; + private static String msoScaleOutVfModule; private final static String CREATE_INSTANCE_RESPONSE_STR = - "{\"requestReferences\":{\"instanceId\":\"baa13544-0e95-4644-9565-9a198a29a294\"," - + "\"requestId\":\"a42a1a35-3d63-4629-bbe0-4989fa7414cb\"}}"; + "{\"requestReferences\":{\"instanceId\":\"baa13544-0e95-4644-9565-9a198a29a294\"," + + "\"requestId\":\"a42a1a35-3d63-4629-bbe0-4989fa7414cb\"}}"; private final static String SERVICE_INSTANCE_ID = "12345"; private static final String SAMPLE_VNF_INSTANCE_ID = "111"; private static final String SAMPLE_VNF_MODULE_ID = "987"; @@ -63,15 +71,19 @@ public class MsoRestClientNewTest { securedServer = new StubServer().secured().run(); Path resourceDirectory = - Paths.get("src", "test", "resources", "WEB-INF", "conf", "system.properties"); - try(InputStream is = Files.newInputStream(resourceDirectory)) { + Paths.get("src", "test", "resources", "WEB-INF", "conf", "system.properties"); + try (InputStream is = Files.newInputStream(resourceDirectory)) { props.load(is); } Path msoServiceInstantiationJsonFilePath = - Paths.get("src", "test", "resources", "payload_jsons", "mso_service_instantiation.json"); + Paths.get("src", "test", "resources", "payload_jsons", "mso_service_instantiation.json"); + + Path scaleOutJsonFilePath = Paths.get("src", "test", "resources", "payload_jsons", "scaleOutVfModulePayloadToMso.json"); msoCreateServiceInstanceJson = - String.join("\n", Files.readAllLines(msoServiceInstantiationJsonFilePath)); + String.join("\n", Files.readAllLines(msoServiceInstantiationJsonFilePath)); + msoScaleOutVfModule = String.join("\n", Files.readAllLines(scaleOutJsonFilePath)); + } @AfterClass @@ -89,11 +101,11 @@ public class MsoRestClientNewTest { public void testCreateSvcInstance() throws Exception { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_CONFIGURATIONS); endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - endpoint, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createSvcInstance); } } @@ -102,12 +114,12 @@ public class MsoRestClientNewTest { public void testCreateVnf() throws Exception { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE); endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - endpoint, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { - + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { + closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVnf); } } @@ -116,11 +128,11 @@ public class MsoRestClientNewTest { public void testCreateNwInstance() throws Exception { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE); String nw_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - nw_endpoint, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + nw_endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createNwInstance); } } @@ -130,11 +142,11 @@ public class MsoRestClientNewTest { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE); String vnf_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); vnf_endpoint = vnf_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - vnf_endpoint, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + vnf_endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVolumeGroupInstance); } } @@ -144,14 +156,14 @@ public class MsoRestClientNewTest { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE); String partial_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); String vf_module_endpoint = - partial_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); + partial_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - vf_module_endpoint, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + vf_module_endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::createVfModuleInstance); } } @@ -177,11 +189,11 @@ public class MsoRestClientNewTest { endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - endpoint, - HttpStatus.NO_CONTENT_204, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + endpoint, + HttpStatus.NO_CONTENT_204, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteSvcInstance); } } @@ -191,11 +203,11 @@ public class MsoRestClientNewTest { String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE); endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - endpoint, - HttpStatus.NO_CONTENT_204, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + endpoint, + HttpStatus.NO_CONTENT_204, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVnf); } } @@ -207,11 +219,11 @@ public class MsoRestClientNewTest { String vf_modules_endpoint = part_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); String delete_vf_endpoint = vf_modules_endpoint + '/' + SAMPLE_VNF_MODULE_ID; - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - delete_vf_endpoint, - HttpStatus.NO_CONTENT_204, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + delete_vf_endpoint, + HttpStatus.NO_CONTENT_204, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVfModule); } } @@ -223,11 +235,11 @@ public class MsoRestClientNewTest { String vnf_endpoint = svc_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); String delete_volume_group_endpoint = vnf_endpoint + "/" + SAMPLE_VNF_MODULE_ID; - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - delete_volume_group_endpoint, - HttpStatus.NO_CONTENT_204, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + delete_volume_group_endpoint, + HttpStatus.NO_CONTENT_204, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executeDelete(msoCreateServiceInstanceJson, msoRestClient()::deleteVolumeGroupInstance); } } @@ -410,11 +422,11 @@ public class MsoRestClientNewTest { String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE); String removeRelationshipsPath = serviceEndpoint + "/" + SERVICE_INSTANCE_ID + "/removeRelationships"; - try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil( - server, - removeRelationshipsPath, - HttpStatus.ACCEPTED_202, - CREATE_INSTANCE_RESPONSE_STR,CREATE_INSTANCE_RESPONSE_STR)) { + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + removeRelationshipsPath, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { closure.executePost(msoCreateServiceInstanceJson, msoRestClient()::removeRelationshipFromServiceInstance); } } @@ -433,6 +445,20 @@ public class MsoRestClientNewTest { } catch (Exception e) { } } + @Test + public void testScaleOutVfModule() throws IOException { + String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT); + String partial_endpoint = serviceEndpoint.replaceFirst(SVC_INSTANCE_ID, SERVICE_INSTANCE_ID); + String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID); + try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil( + server, + vf_module_endpoint, + HttpStatus.ACCEPTED_202, + CREATE_INSTANCE_RESPONSE_STR, CREATE_INSTANCE_RESPONSE_STR)) { + closure.executePostCall(msoScaleOutVfModule, msoRestClient()::scaleOutVFModuleInstance); + } + + } private MsoRestClientNew msoRestClient() { return new MsoRestClientNew(new SyncRestClient(MsoInterface.objectMapper()), baseUrl()); diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java index e8f556999..c81fa16fd 100644 --- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java +++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientTestUtil.java @@ -20,11 +20,13 @@ import java.util.function.BiFunction; import java.util.function.Function; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; + import org.glassfish.grizzly.http.Method; import org.glassfish.grizzly.http.util.HttpStatus; import org.json.JSONObject; import org.junit.Assert; import org.onap.portalsdk.core.util.SystemProperties; +import org.onap.vid.changeManagement.RequestDetailsWrapper; import org.onap.vid.mso.MsoResponseWrapper; class MsoRestClientTestUtil implements AutoCloseable { @@ -60,6 +62,21 @@ class MsoRestClientTestUtil implements AutoCloseable { verifyServer(server, endpoint, Method.POST); } + void executePostCall(String jsonPayload, BiFunction<RequestDetailsWrapper, String, MsoResponseWrapper> func) throws IOException { + whenHttp(server) + .match(post(endpoint)) + .then(status(expectedStatus), jsonContent(responsePayload), contentType(MediaType.APPLICATION_JSON)); + + RequestDetailsWrapper sampleRequestDetails = + new ObjectMapper().readValue(jsonPayload, RequestDetailsWrapper.class); + + MsoResponseWrapper response = func.apply(sampleRequestDetails, endpoint); + JSONObject actualJson = new JSONObject(response.getEntity()); + + Assert.assertEquals(expectedStatus.getStatusCode(), response.getStatus()); + Assert.assertEquals(expectedResponseStr, actualJson.toString()); + verifyServer(server, endpoint, Method.POST); + } void executeDelete(String jsonPayload, BiFunction<RequestDetails, String, MsoResponseWrapper> func) throws IOException { diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties index 689f55e58..6a8a1a37a 100644 --- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties +++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties @@ -73,18 +73,12 @@ element_map_icon_path = app/fusionapp/icons/ #aai related properties #dev server -#aai.server.url.base=https://mtanjv9aaas40.aic.cip.att.com:8443/aai/ -#aai.server.url=https://mtanjv9aaas40.aic.cip.att.com:8443/aai/v10/ -#aai.oldserver.url.base=https://mtanjv9aaas40.aic.cip.att.com:8443/aai/servers/ -#aai.oldserver.url=https://mtanjv9aaas40.aic.cip.att.com:8443/aai/servers/v3/ #ist servers -aai.server.url.base=https://aai-ext1.test.att.com:8443/aai/ -#aai.server.url=https://aai-ext1.test.att.com:8443/aai/v12/ +aai.server.url.base=http://localhost:8080/vidSimulator/aai/ aai.server.url=http://localhost:8080/vidSimulator/aai/v12/ #aai.server.url=http://localhost:1080/aai -#aai.server.url=https://aai-int2.test.att.com:8443/aai/v12/ -aai.vid.username=VID -aai.vid.passwd.x=OBF:1jm91i0v1jl9 +aai.vid.username=vid@vid.onap.org +aai.vid.passwd.x=OBF:1fia1ju61l871lfe18xp18xr18xt1lc41l531jrk1fek @@ -93,12 +87,10 @@ aai.vid.passwd.x=OBF:1jm91i0v1jl9 -aai.oldserver.url.base=https://aai-ext1.test.att.com:8443/aai/servers/ -aai.oldserver.url=https://aai-ext1.test.att.com:8443/aai/servers/v3/ aai.truststore.filename=tomcat_keystore -aai.truststore.passwd.x=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o +aai.truststore.passwd.x=OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp aai.keystore.filename=aai-client-cert.p12 -aai.keystore.passwd.x=OBF:1i9a1u2a1unz1lr61wn51wn11lss1unz1u301i6o +aai.keystore.passwd.x=OBF:1ks51l8d1o3i1pcc1r2r1e211r391kls1pyj1z7u1njf1lx51go21hnj1y0k1mli1sop1k8o1j651vu91mxw1vun1mze1vv11j8x1k5i1sp11mjc1y161hlr1gm41m111nkj1z781pw31kku1r4p1e391r571pbm1o741l4x1ksp aai.use.client.cert=false aai.vnf.provstatus=PREPROV,NVTPROV,PROV,CAPPED @@ -154,7 +146,8 @@ mso.restapi.svc.instance=/serviceInstances/v5 mso.restapi.vnf.instance=/serviceInstances/v5/<service_instance_id>/vnfs mso.restapi.vnf.changemanagement.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type> mso.restapi.network.instance=/serviceInstances/v5/<service_instance_id>/networks -mso.restapi.vf.module.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules +mso.restapi.vf.module.instance=/serviceInstances/v6/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules +mso.restapi.vf.module.scaleout=/serviceInstantiation/v7/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut mso.restapi.volume.group.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups mso.restapi.get.orc.req=/orchestrationRequests/v5 mso.restapi.get.orc.reqs=/orchestrationRequests/v5? @@ -166,7 +159,7 @@ vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks mso.dme2.client.timeout=30000 mso.dme2.client.read.timeout=120000 -scheduler.server.url=http://mtanjv9sdlg10.aic.cip.att.com:8989/scheduler +scheduler.server.url= scheduler.create.new.vnf.change.instance=/v1/ChangeManagement/schedules/ scheduler.get.time.slots=/v1/ChangeManagement/schedules/ scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/ diff --git a/vid-app-common/src/test/resources/git.properties b/vid-app-common/src/test/resources/git.properties new file mode 100644 index 000000000..d504e3e88 --- /dev/null +++ b/vid-app-common/src/test/resources/git.properties @@ -0,0 +1,3 @@ +git.commit.id=123987 +git.commit.message.short=Test short commit message +git.commit.time=1999-09-12T13\:48\:55+0200
\ No newline at end of file diff --git a/vid-app-common/src/test/resources/mso.properties b/vid-app-common/src/test/resources/mso.properties index fcd20bd7a..d021ffde1 100644 --- a/vid-app-common/src/test/resources/mso.properties +++ b/vid-app-common/src/test/resources/mso.properties @@ -6,7 +6,7 @@ mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz mso.restapi.svc.instance=/serviceInstances/v3 mso.restapi.vnf.instance=/serviceInstances/v3/<service_instance_id>/vnfs mso.restapi.network.instance=/serviceInstances/v3/<service_instance_id>/networks -mso.restapi.vf.module.instance=/serviceInstances/v3/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules +mso.restapi.vf.module.instance=/serviceInstantiation/v7/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut mso.restapi.volume.group.instance=/serviceInstances/v3/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations mso.restapi.get.orc.req=/orchestrationRequests/v3 diff --git a/vid-app-common/src/test/resources/payload_jsons/mso_action_scaleout_sample_response.json b/vid-app-common/src/test/resources/payload_jsons/mso_action_scaleout_sample_response.json new file mode 100644 index 000000000..d37f6af1f --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/mso_action_scaleout_sample_response.json @@ -0,0 +1,174 @@ +{ + "requestList": [ + { + "request": { + "requestId": "799d7380-60fe-4b64-9d99-82f6ab09163b", + "startTime": "Fri, 12 Oct 2018 08:53:07 GMT", + "requestScope": "vfModule", + "requestType": "scaleOut", + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "WsSp..base_ws..module-0", + "modelInvariantId": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelType": "vfModule", + "modelName": "WsSp..base_ws..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelVersionId": "53f52586-236b-4d52-a94c-990883e054f0", + "modelCustomizationId": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelUuid": "53f52586-236b-4d52-a94c-990883e054f0", + "modelInvariantUuid": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelInstanceName": "WsSp..base_ws..module-0" + }, + "requestInfo": { + "source": "VID", + "instanceName": "ws-test-0310-8_NaN", + "suppressRollback": false, + "requestorId": "demo" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "modelInfo": { + "modelInvariantId": "c9817f08-07b2-458b-a02f-cd5407ee7a7b", + "modelType": "service", + "modelName": "ws-service", + "modelVersion": "1.0", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelUuid": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelInvariantUuid": "c9817f08-07b2-458b-a02f-cd5407ee7a7b" + } + } + }, + { + "relatedInstance": { + "instanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "modelInfo": { + "modelCustomizationName": "ws-sp 0", + "modelInvariantId": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelType": "vnf", + "modelName": "ws-sp", + "modelVersion": "1.0", + "modelCustomizationUuid": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelCustomizationId": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelUuid": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelInvariantUuid": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelInstanceName": "ws-sp 0" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "lcpCloudRegionId": "RegionOne" + }, + "requestParameters": {}, + "configurationParameters": [ + { + "availability-zone": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + }, + "instanceReferences": { + "serviceInstanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "vnfInstanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "vfModuleInstanceName": "ws-test-0310-8_NaN", + "requestorId": "demo" + }, + "requestStatus": { + "requestState": "FAILED", + "statusMessage": "No valid vfModuleCustomization is specified", + "percentProgress": 100, + "finishTime": "Fri, 12 Oct 2018 08:53:07 GMT" + } + } + }, + { + "request": { + "requestId": "44b534c7-57b5-42ec-85bb-219167021b34", + "startTime": "Fri, 12 Oct 2018 09:08:01 GMT", + "requestScope": "vfModule", + "requestType": "scaleOut", + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "WsSp..base_ws..module-0", + "modelInvariantId": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelType": "vfModule", + "modelName": "WsSp..base_ws..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelVersionId": "53f52586-236b-4d52-a94c-990883e054f0", + "modelCustomizationId": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelUuid": "53f52586-236b-4d52-a94c-990883e054f0", + "modelInvariantUuid": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelInstanceName": "WsSp..base_ws..module-0" + }, + "requestInfo": { + "source": "VID", + "instanceName": "ws-test-0310-8_NaN", + "suppressRollback": false, + "requestorId": "demo" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "modelInfo": { + "modelInvariantId": "c9817f08-07b2-458b-a02f-cd5407ee7a7b", + "modelType": "service", + "modelName": "ws-service", + "modelVersion": "1.0", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelUuid": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelInvariantUuid": "c9817f08-07b2-458b-a02f-cd5407ee7a7b" + } + } + }, + { + "relatedInstance": { + "instanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "modelInfo": { + "modelCustomizationName": "ws-sp 0", + "modelInvariantId": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelType": "vnf", + "modelName": "ws-sp", + "modelVersion": "1.0", + "modelCustomizationUuid": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelCustomizationId": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelUuid": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelInvariantUuid": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelInstanceName": "ws-sp 0" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "lcpCloudRegionId": "RegionOne" + }, + "requestParameters": {}, + "configurationParameters": [ + { + "availability-zone": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + }, + "instanceReferences": { + "serviceInstanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "vnfInstanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "vfModuleInstanceId": "scaleOut", + "vfModuleInstanceName": "ws-test-0310-8_NaN", + "requestorId": "demo" + }, + "requestStatus": { + "requestState": "FAILED" + } + } + } + ] +}
\ No newline at end of file diff --git a/vid-app-common/src/test/resources/payload_jsons/mso_model_info_sample_response.json b/vid-app-common/src/test/resources/payload_jsons/mso_model_info_sample_response.json new file mode 100644 index 000000000..9dbdfb043 --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/mso_model_info_sample_response.json @@ -0,0 +1,108 @@ +{ + "requestList": [ + { + "request": { + "requestId": "f8c813a2-b22b-4e3d-9be0-8e2d16b1add3", + "startTime": "Wed, 03 Oct 2018 13:13:04 GMT", + "requestScope": "vnf", + "requestType": "createInstance", + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "ws-sp 0", + "modelInvariantId": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelType": "vnf", + "modelName": "ws-sp", + "modelVersion": "1.0", + "modelCustomizationUuid": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelCustomizationId": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "modelUuid": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelInvariantUuid": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelInstanceName": "ws-sp 0" + }, + "requestInfo": { + "productFamilyId": "61cc3239-5c2e-4762-a281-7422a2e54d5a", + "source": "VID", + "instanceName": "ws-test-0310-8", + "suppressRollback": false, + "requestorId": "demo" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "modelInfo": { + "modelInvariantId": "c9817f08-07b2-458b-a02f-cd5407ee7a7b", + "modelType": "service", + "modelName": "ws-service", + "modelVersion": "1.0", + "modelVersionId": "cd3fbd06-6bc8-43a4-b803-933fc2e3cdf7", + "modelUuid": "cd3fbd06-6bc8-43a4-b803-933fc2e3cdf7", + "modelInvariantUuid": "c9817f08-07b2-458b-a02f-cd5407ee7a7b" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "lcpCloudRegionId": "RegionOne" + }, + "requestParameters": { + "testApi": "VNF_API" + }, + "platform": { + "platformName": "Demo" + }, + "lineOfBusiness": { + "lineOfBusinessName": "Demo" + } + }, + "instanceReferences": { + "serviceInstanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "vnfInstanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "vnfInstanceName": "ws-test-0310-8", + "requestorId": "demo" + }, + "requestStatus": { + "requestState": "COMPLETE", + "statusMessage": "Vnf has been created successfully.", + "percentProgress": 100, + "finishTime": "Wed, 03 Oct 2018 13:13:09 GMT" + } + } + }, + { + "request": { + "requestId": "3447ba35-015d-4d72-9345-d89b1e35b2d6", + "startTime": "Thu, 04 Oct 2018 10:35:17 GMT", + "requestScope": "vnf", + "requestType": "inPlaceSoftwareUpdate", + "requestDetails": { + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "demo" + }, + "cloudConfiguration": { + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "lcpCloudRegionId": "RegionOne" + }, + "requestParameters": { + "payload": "{\"existing_software_version\":\"0.7\",\"new_software_version\":\"1.0\",\"operations_timeout\":\"10\"}" + } + }, + "instanceReferences": { + "serviceInstanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "vnfInstanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "requestorId": "demo" + }, + "requestStatus": { + "requestState": "FAILED", + "statusMessage": "Cloud Region with cloudRegionId RegionOne does not exist in A&AI", + "percentProgress": 100, + "finishTime": "Thu, 04 Oct 2018 10:35:21 GMT" + } + } + } + ] +}
\ No newline at end of file diff --git a/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayload.json b/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayload.json new file mode 100644 index 000000000..c509c6247 --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayload.json @@ -0,0 +1,67 @@ +{ + "vnfName":"test", + "vnfInstanceId":"123", + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "c9817f08-07b2-458b-a02f-cd5407ee7a7b", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelName": "ws-service", + "modelVersion": "1.0", + "additionalProperties": {} + } + } + }, + { + "relatedInstance": { + "instanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelName": "ws-sp", + "modelVersion": "1.0", + "modelCustomizationName": "ws-sp 0", + "modelCustomizationId": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "additionalProperties": {} + } + } + } + ], + "cloudConfiguration": { + "lcpCloudRegionId": "RegionOne", + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "additionalProperties": {} + }, + "modelInfo": { + "modelCustomizationName": "WsSp..base_ws..module-0", + "modelCustomizationId": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelInvariantId": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelVersionId": "53f52586-236b-4d52-a94c-990883e054f0", + "modelName": "WsSp..base_ws..module-0", + "modelNameVersionId": null, + "modelType": "vfModule", + "modelVersion": "1", + "additionalProperties": {} + }, + "requestInfo": { + "instanceName": "ws-test-0310-8_NaN", + "source": "VID", + "suppressRollback": false, + "requestorId": "demo", + "additionalProperties": {} + }, + "requestParameters": { + "additionalProperties": {} + }, + "configurationParameters": [ + { + "availability-zone": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + } +}
\ No newline at end of file diff --git a/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayloadToMso.json b/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayloadToMso.json new file mode 100644 index 000000000..ddbebac95 --- /dev/null +++ b/vid-app-common/src/test/resources/payload_jsons/scaleOutVfModulePayloadToMso.json @@ -0,0 +1,66 @@ +{ + "requestDetails": { + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "fd84f066-ea75-4b23-acd0-3cf3fce7a99b", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "c9817f08-07b2-458b-a02f-cd5407ee7a7b", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelName": "ws-service", + "modelVersion": "1.0", + "additionalProperties": {} + } + } + }, + { + "relatedInstance": { + "instanceId": "980fe98e-47f8-4164-862d-4ebb026cec75", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "734f0952-6678-44e7-8918-f9aa4694b687", + "modelVersionId": "0e0bb964-e687-4439-9a9e-de9cd1ff5367", + "modelName": "ws-sp", + "modelVersion": "1.0", + "modelCustomizationName": "ws-sp 0", + "modelCustomizationId": "5815868c-35f8-4c5a-b899-e6eb49f52986", + "additionalProperties": {} + } + } + } + ], + "cloudConfiguration": { + "lcpCloudRegionId": "RegionOne", + "tenantId": "1e097c6713e74fd7ac8e4295e605ee1e", + "additionalProperties": {} + }, + "modelInfo": { + "modelCustomizationName": "WsSp..base_ws..module-0", + "modelCustomizationId": "bfcc8f57-7b56-4be8-a8f1-e44262c83318", + "modelInvariantId": "763b1172-b5f5-4062-9d79-2459710fa0bc", + "modelVersionId": "53f52586-236b-4d52-a94c-990883e054f0", + "modelName": "WsSp..base_ws..module-0", + "modelNameVersionId": null, + "modelType": "vfModule", + "modelVersion": "1", + "additionalProperties": {} + }, + "requestInfo": { + "instanceName": "ws-test-0310-8_NaN", + "source": "VID", + "suppressRollback": false, + "requestorId": "demo", + "additionalProperties": {} + }, + "requestParameters": { + "additionalProperties": {} + }, + "configurationParameters": [ + { + "availability-zone": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]", + "xtz-123": "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]" + } + ] + } +}
\ No newline at end of file |