use of org.onap.so.adapters.vdu.VduModelInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackSuccess.
@Test
public void createStackSuccess() throws MsoException, IOException {
wireMockServer.stubFor(post(urlEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_CREATED)).willSetStateTo("CREATING"));
wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetCreateResponse.json").withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH)).inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED)).willSetStateTo("UPDATING"));
wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetUpdateResponse.json").withStatus(HttpStatus.SC_OK)));
StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
wireMockServer.resetScenarios();
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
use of org.onap.so.adapters.vdu.VduModelInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackMulticloudClientIsNull.
@Ignore
@Test
public void createStackMulticloudClientIsNull() {
try {
multicloudUtilsMock.cloudConfig = cloudConfigMock;
CloudSite cloudSite = new CloudSite();
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).thenReturn(Optional.of(cloudSite));
multicloudUtilsMock.createStack("MNT14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
} catch (MsoException e) {
assertEquals("0 : Multicloud client could not be initialized", e.toString());
return;
}
fail("MsoOpenstackException expected!");
}
use of org.onap.so.adapters.vdu.VduModelInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackBadRequest.
@Test
public void createStackBadRequest() {
try {
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_BAD_REQUEST)));
multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
} catch (MsoException e) {
assertEquals("0 : Bad Request", e.toString());
return;
}
fail("MsoOpenstackException expected!");
}
use of org.onap.so.adapters.vdu.VduModelInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackEmptyResponseEntity.
@Test
public void createStackEmptyResponseEntity() throws MsoException {
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_CREATED).withBody("{}")));
StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
use of org.onap.so.adapters.vdu.VduModelInfo in project so by onap.
the class VfModuleCustomizationToVduMapper method mapVfModuleCustVolumeToVdu.
public VduModelInfo mapVfModuleCustVolumeToVdu(VfModuleCustomization vfModuleCustom) {
VduModelInfo vduModel = new VduModelInfo();
vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUUID());
vduModel.setModelUUID(vfModuleCustom.getVfModule().getModelUUID());
vduModel.setModelInvariantUUID(vfModuleCustom.getVfModule().getModelInvariantUUID());
// Map the cloud templates, attached files, and environment file
mapCloudTemplates(vfModuleCustom.getVfModule().getVolumeHeatTemplate(), vduModel);
mapCloudFiles(vfModuleCustom, vduModel);
mapEnvironment(vfModuleCustom.getVolumeHeatEnv(), vduModel);
return vduModel;
}
Aggregations