Search in sources :

Example 1 with VduModelInfo

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());
}
Also used : VduModelInfo(org.onap.so.adapters.vdu.VduModelInfo) StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 2 with VduModelInfo

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!");
}
Also used : MsoException(org.onap.so.openstack.exceptions.MsoException) CloudSite(org.onap.so.db.catalog.beans.CloudSite) CloudIdentity(org.onap.so.db.catalog.beans.CloudIdentity) VduModelInfo(org.onap.so.adapters.vdu.VduModelInfo) Ignore(org.junit.Ignore) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 3 with VduModelInfo

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!");
}
Also used : MsoException(org.onap.so.openstack.exceptions.MsoException) VduModelInfo(org.onap.so.adapters.vdu.VduModelInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 4 with VduModelInfo

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());
}
Also used : VduModelInfo(org.onap.so.adapters.vdu.VduModelInfo) StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 5 with VduModelInfo

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;
}
Also used : VduModelInfo(org.onap.so.adapters.vdu.VduModelInfo)

Aggregations

VduModelInfo (org.onap.so.adapters.vdu.VduModelInfo)10 Test (org.junit.Test)7 BaseTest (org.onap.so.BaseTest)5 VfModule (org.onap.so.db.catalog.beans.VfModule)3 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)3 MsoException (org.onap.so.openstack.exceptions.MsoException)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CloudInfo (org.onap.so.adapters.vdu.CloudInfo)2 VduInstance (org.onap.so.adapters.vdu.VduInstance)2 CloudSite (org.onap.so.db.catalog.beans.CloudSite)2 StackInfo (org.onap.so.openstack.beans.StackInfo)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 Ignore (org.junit.Ignore)1 PluginAction (org.onap.so.adapters.vdu.PluginAction)1 VduArtifact (org.onap.so.adapters.vdu.VduArtifact)1 VduException (org.onap.so.adapters.vdu.VduException)1 VduPlugin (org.onap.so.adapters.vdu.VduPlugin)1 VduStateType (org.onap.so.adapters.vdu.VduStateType)1 VduStatus (org.onap.so.adapters.vdu.VduStatus)1