use of org.onap.so.adapters.vdu.CloudInfo in project so by onap.
the class MsoHeatUtilsITTest method instantiateVduTest.
@Test
public void instantiateVduTest() throws MsoException, IOException {
VduInstance expected = new VduInstance();
expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b");
expected.setVduInstanceName("name");
VduStatus status = new VduStatus();
status.setState(VduStateType.INSTANTIATED);
status.setLastAction((new PluginAction("create", "complete", null)));
expected.setStatus(status);
CloudInfo cloudInfo = new CloudInfo();
cloudInfo.setCloudSiteId("MTN13");
cloudInfo.setTenantId("tenantId");
VduModelInfo vduModel = new VduModelInfo();
vduModel.setModelCustomizationUUID("blueprintId");
vduModel.setTimeoutMinutes(1);
VduArtifact artifact = new VduArtifact();
artifact.setName("name");
artifact.setType(ArtifactType.MAIN_TEMPLATE);
byte[] content = new byte[1];
artifact.setContent(content);
List<VduArtifact> artifacts = new ArrayList<>();
artifacts.add(artifact);
vduModel.setArtifacts(artifacts);
Map<String, byte[]> blueprintFiles = new HashMap<>();
blueprintFiles.put(artifact.getName(), artifact.getContent());
String instanceName = "stackname";
Map<String, Object> inputs = new HashMap<>();
boolean rollbackOnFailure = true;
StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackname/stackId")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.adapters.vdu.CloudInfo in project so by onap.
the class MsoHeatUtilsITTest method deleteVduTest.
@Test
public void deleteVduTest() throws Exception {
VduInstance expected = new VduInstance();
expected.setVduInstanceId("name/stackId");
expected.setVduInstanceName("instanceId");
VduStatus status = new VduStatus();
status.setState(VduStateType.DELETED);
expected.setStatus(status);
CloudInfo cloudInfo = new CloudInfo();
cloudInfo.setCloudSiteId("mtn13");
cloudInfo.setTenantId("tenantId");
String instanceId = "instanceId";
int timeoutInMinutes = 1;
StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
StubOpenStack.mockOpenStackDelete(wireMockServer, "name/da886914-efb2-4917-b335-c8381528d90b");
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK)));
VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.adapters.vdu.CloudInfo in project so by onap.
the class MsoMulticloudUtilsTest method deleteVdu.
@Test
public void deleteVdu() throws VduException {
CloudInfo cloudInfo = new CloudInfo("cloudSiteId", "cloudOwner", "tenantId", "tenantName");
VduInstance vduInstance = multicloudUtils.deleteVdu(cloudInfo, "instanceId", 3);
assertNotNull(vduInstance);
assertTrue(VduStateType.DELETED == vduInstance.getStatus().getState());
}
Aggregations