Search in sources :

Example 16 with StackInfo

use of org.onap.so.openstack.beans.StackInfo in project so by onap.

the class MsoHeatUtilsITTest method createStackSuccessTest.

@Test
public final void createStackSuccessTest() throws MsoException, IOException {
    CloudSite cloudSite = getCloudSite(getCloudIdentity());
    StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
    StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
    StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
    StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null, "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
    assertNotNull(stackInfo);
}
Also used : CloudSite(org.onap.so.db.catalog.beans.CloudSite) StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 17 with StackInfo

use of org.onap.so.openstack.beans.StackInfo 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 18 with StackInfo

use of org.onap.so.openstack.beans.StackInfo in project so by onap.

the class MsoMulticloudUtilsTest method deleteStack.

@Test
public void deleteStack() throws MsoException {
    wireMockServer.stubFor(delete(urlEqualTo(MULTICLOUD_DELETE_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT)));
    wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetDeleteResponse.json").withStatus(HttpStatus.SC_OK)));
    StackInfo result = multicloudUtils.deleteStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack/TEST-workload");
    assertNotNull(result);
    assertTrue(HeatStatus.NOTFOUND == result.getStatus());
}
Also used : StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 19 with StackInfo

use of org.onap.so.openstack.beans.StackInfo in project so by onap.

the class MsoMulticloudUtilsTest method queryStack.

@Test
public void queryStack() throws MsoException {
    StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
    assertTrue(HeatStatus.NOTFOUND == result.getStatus());
}
Also used : StackInfo(org.onap.so.openstack.beans.StackInfo) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 20 with StackInfo

use of org.onap.so.openstack.beans.StackInfo 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)

Aggregations

StackInfo (org.onap.so.openstack.beans.StackInfo)38 MsoException (org.onap.so.openstack.exceptions.MsoException)17 HashMap (java.util.HashMap)11 Test (org.junit.Test)11 Stack (com.woorea.openstack.heat.model.Stack)9 CloudSite (org.onap.so.db.catalog.beans.CloudSite)8 MsoOpenstackException (org.onap.so.openstack.exceptions.MsoOpenstackException)8 VduException (org.onap.so.adapters.vdu.VduException)7 BaseTest (org.onap.so.BaseTest)6 MsoAdapterException (org.onap.so.openstack.exceptions.MsoAdapterException)6 Heat (com.woorea.openstack.heat.Heat)4 MalformedURLException (java.net.MalformedURLException)4 Response (javax.ws.rs.core.Response)4 UriBuilderException (javax.ws.rs.core.UriBuilderException)4 RestClient (org.onap.so.client.RestClient)4 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)4 StackInfoMapper (org.onap.so.openstack.mappers.StackInfoMapper)4 OpenStackConnectException (com.woorea.openstack.base.client.OpenStackConnectException)3 OpenStackRequest (com.woorea.openstack.base.client.OpenStackRequest)3 OpenStackResponseException (com.woorea.openstack.base.client.OpenStackResponseException)3