Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package org.openstack4j.api.murano.v1;

import org.openstack4j.api.AbstractTest;
import org.openstack4j.model.murano.v1.domain.Deployment;
import org.openstack4j.model.murano.v1.domain.Report;
import org.testng.annotations.Test;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;

/**
* @author nmakhotkin
*/
@Test(suiteName="Murano/AppCatalog", enabled = true)
public class DeploymentTests extends AbstractTest {
private static final String DEPLOYMENTS_JSON = "/murano/v1/deployments.json";
private static final String REPORTS_JSON = "/murano/v1/reports.json";
private static final String FILTERED_REPORTS_JSON = "/murano/v1/filtered_reports.json";
private static final String envId = "3e57cee8b55448f6af0752d31d7e27d6";
private static final String deploymentId = "ccfd5e951c70428c852bee3b2a9a132e";

public void testDeploymentList() throws IOException {
respondWith(DEPLOYMENTS_JSON);
List<? extends Deployment> deployments = osv3().murano().deployments().list(envId);

assertNotNull(deployments);
assertEquals(deployments.size(), 1);
assertEquals(deployments.get(0).getEnvironmentId(), envId);
assertTrue(deployments.get(0).getResult().isException());
}

public void testReports() throws IOException {
respondWith(REPORTS_JSON);
List<? extends Report> reports = osv3().murano().deployments().reports(envId, deploymentId);

assertNotNull(reports);
assertEquals(reports.size(), 8);
assertEquals(reports.get(reports.size() - 1).getLevel(), "info");
}

public void testFilteredReports() throws IOException {
respondWith(FILTERED_REPORTS_JSON);
List<? extends Report> reports = osv3().murano().deployments().reports(
envId,
deploymentId,
Collections.singletonList("5c2a7dae-097d-4a1c-85cb-e7db2ed62d90")
);

assertNotNull(reports);
assertEquals(reports.size(), 3);
assertEquals(reports.get(reports.size() - 1).getId(), "e5558d941efb4371a8a316c29cb77cf0");
}

@Override
protected Service service() {
return Service.APP_CATALOG;
}
}
75 changes: 75 additions & 0 deletions core-test/src/main/resources/murano/v1/deployments.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"deployments" : [
{
"state" : "completed_w_errors",
"environment_id" : "3e57cee8b55448f6af0752d31d7e27d6",
"started" : "2016-10-03T10:59:16",
"id" : "ccfd5e951c70428c852bee3b2a9a132e",
"created" : "2016-10-03T10:59:16",
"description" : {
"defaultNetworks" : {
"flat" : null,
"environment" : {
"?" : {
"id" : "382b25faadc34d879f7d8ff00ff5f5a7",
"type" : "io.murano.resources.NeutronNetwork"
},
"name" : "test-network"
}
},
"services" : [
{
"instance" : {
"availabilityZone" : "nova",
"assignFloatingIp" : true,
"?" : {
"type" : "io.murano.resources.LinuxMuranoInstance",
"id" : "3adbc662-e6a8-4914-ba22-edc46ba2b3b4"
},
"flavor" : "m1.medium",
"name" : "jpehxitty1jcc1",
"keyname" : "ssh-key",
"image" : "1d35715f-cbca-48ec-9397-82a3fed7d253"
},
"name" : "Docker Standalone Host",
"?" : {
"id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"type" : "com.mirantis.docker.DockerStandaloneHost",
"_26411a1861294160833743e45d0eaad9" : {
"name" : "Docker Standalone Host"
}
},
"dockerRegistry" : ""
},
{
"name" : "DockerHTTPdSite",
"?" : {
"type" : "com.example.docker.DockerHTTPdSite",
"_26411a1861294160833743e45d0eaad9" : {
"name" : "Docker HTTPd Site"
},
"id" : "7c449c3c-ccdf-45ba-bf3c-496149918df7"
},
"siteRepo" : "https://github.com/nmakhotkin/example-web.git",
"host" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"publish" : true
}
],
"name" : "test",
"?" : {
"id" : "3e57cee8b55448f6af0752d31d7e27d6",
"type" : "io.murano.Environment"
}
},
"finished" : "2016-10-03T12:02:16",
"result" : {
"result" : {
"message" : "[murano.common.exceptions.TimeoutException]: The murano-agent did not respond within 3600 seconds",
"details" : "murano.common.exceptions.TimeoutException: The murano-agent did not respond within 3600 seconds\nTraceback (most recent call last):\n File \"/tmp/murano-packages-cache/io.murano/0.0.0/e5fe46b0-ba10-4f97-aa0e-ca25b18b7e3d/Classes/Environment.yaml\", <cut for test>"
},
"isException" : true
},
"updated" : "2016-10-03T12:02:16"
}
]
}
37 changes: 37 additions & 0 deletions core-test/src/main/resources/murano/v1/filtered_reports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"reports" : [
{
"created" : "2016-10-03T10:59:19",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"entity" : null,
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"text" : "Create VM for Docker Server",
"updated" : "2016-10-03T10:59:19",
"level" : "info",
"details" : null,
"id" : "ad4b8072a06f46a8889f3844eb2a5854"
},
{
"level" : "info",
"id" : "bcaae839106341cca9c09b336c3b225c",
"details" : null,
"updated" : "2016-10-03T11:02:15",
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"entity" : null,
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"text" : "Docker Server is up and running",
"created" : "2016-10-03T11:02:15"
},
{
"updated" : "2016-10-03T11:02:16",
"details" : null,
"id" : "e5558d941efb4371a8a316c29cb77cf0",
"level" : "info",
"created" : "2016-10-03T11:02:16",
"text" : "Pulling app image stanlagun/httpdgitsite",
"entity" : null,
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90"
}
]
}
92 changes: 92 additions & 0 deletions core-test/src/main/resources/murano/v1/reports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"reports" : [
{
"level" : "info",
"updated" : "2016-10-03T10:59:15",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"details" : null,
"created" : "2016-10-03T10:59:15",
"text" : "Action deploy is scheduled",
"entity_id" : null,
"id" : "62ab8549892641ad9c7a2dc67d4ae19e",
"entity" : null
},
{
"entity" : null,
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"id" : "ad4b8072a06f46a8889f3844eb2a5854",
"text" : "Create VM for Docker Server",
"created" : "2016-10-03T10:59:19",
"details" : null,
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"level" : "info",
"updated" : "2016-10-03T10:59:19"
},
{
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"level" : "info",
"updated" : "2016-10-03T11:02:15",
"details" : null,
"created" : "2016-10-03T11:02:15",
"text" : "Docker Server is up and running",
"id" : "bcaae839106341cca9c09b336c3b225c",
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"entity" : null
},
{
"entity" : null,
"text" : "Installing HTTPd and site from https://github.com/nmakhotkin/example-web.git",
"id" : "79b9e64e0b1f4e42b27acb7a147ac43b",
"entity_id" : "7c449c3c-ccdf-45ba-bf3c-496149918df7",
"level" : "info",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"updated" : "2016-10-03T11:02:16",
"details" : null,
"created" : "2016-10-03T11:02:16"
},
{
"entity" : null,
"updated" : "2016-10-03T11:02:16",
"level" : "info",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"details" : null,
"created" : "2016-10-03T11:02:16",
"text" : "Pulling app image stanlagun/httpdgitsite",
"entity_id" : "5c2a7dae-097d-4a1c-85cb-e7db2ed62d90",
"id" : "e5558d941efb4371a8a316c29cb77cf0"
},
{
"entity_id" : "7c449c3c-ccdf-45ba-bf3c-496149918df7",
"id" : "c6118ba64013414fab387f627506c711",
"text" : "Error: The murano-agent did not respond within 3600 seconds",
"created" : "2016-10-03T12:02:16",
"details" : null,
"level" : "error",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"updated" : "2016-10-03T12:02:16",
"entity" : null
},
{
"text" : "[murano.common.exceptions.TimeoutException]: The murano-agent did not respond within 3600 seconds",
"id" : "9a794a79c1ea43bd8adbafeae430de32",
"entity_id" : "3e57cee8b55448f6af0752d31d7e27d6",
"level" : "error",
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"updated" : "2016-10-03T12:02:16",
"created" : "2016-10-03T12:02:16",
"details" : null,
"entity" : null
},
{
"entity" : null,
"created" : "2016-10-03T12:02:16",
"details" : null,
"task_id" : "ccfd5e951c70428c852bee3b2a9a132e",
"level" : "info",
"updated" : "2016-10-03T12:02:16",
"entity_id" : null,
"id" : "b49accc24f5944e3a2cf0f620d48fe85",
"text" : "Deployment finished with errors"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ public interface AppCatalogService extends RestService {
* @return the servces API
*/
MuranoApplicationService services();

/**
* Murano deployments API
*
* @return the deployments API
*/
MuranoDeploymentService deployments();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package org.openstack4j.api.murano.v1;

import org.openstack4j.common.RestService;
import org.openstack4j.model.murano.v1.domain.Deployment;
import org.openstack4j.model.murano.v1.domain.Report;

import java.util.List;

/**
* @author Nikolay Mahotkin.
*/
public interface MuranoDeploymentService extends RestService {
/**
* List all the deployments of the environment.
*
* @param environmentId The environment id.
* @return Deployment list.
*/
List<? extends Deployment> list(String environmentId);

/**
* Get the reports (deployment logs) of the specified deployment.
*
* @param environmentId environment id.
* @param deploymentId deployment id.
* @param serviceIds (optional) list of service ids.
* @return Report list.
*/
List<? extends Report> reports(String environmentId, String deploymentId, List<String> serviceIds);
List<? extends Report> reports(String environmentId, String deploymentId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import org.openstack4j.model.ModelEntity;

import java.util.Map;

/**
* @author Nikolay Mahotkin.
*/
public interface Application extends ModelEntity {
/**
*
* @return data in raw format (json-string).
* @return data in map format (Map<String, Object>).
*/
Object getData();
Map<String, Object> getData();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package org.openstack4j.model.murano.v1.domain;

import org.openstack4j.model.ModelEntity;

/**
* @author Nikolay Mahotkin.
*/
public interface Deployment extends ModelEntity {
/**
*
* @return state of the deployment.
*/
String getState();

/**
*
* @return date and time of the start of the deployment.
*/
String getStarted();

/**
*
* @return date and time of the finish of the deployment.
*/
String getFinished();

/**
*
* @return the environment id.
*/
String getEnvironmentId();

/**
*
* @return the id of the deployment.
*/
String getId();

/**
*
* @return the description Object.
*/
EnvironmentDescription getDescription();

/**
*
* @return created date.
*/
String getCreated();

/**
*
* @return updated date.
*/
String getUpdated();

/**
*
* @return the result.
*/
DeploymentResult getResult();
}
Loading