Commit 2bbc0d82 authored by Spiros Koulouzis's avatar Spiros Koulouzis

removed status from topology. All nodes have state attribute

parent 369b1304
...@@ -3,9 +3,9 @@ topology_template: ...@@ -3,9 +3,9 @@ topology_template:
node_templates: node_templates:
compute: compute:
properties: properties:
disk_size: "50000 MB" disk_size: "10000 MB"
mem_size: "6000 MB" mem_size: "1000 MB"
num_cores: 2.0 num_cores: 1.0
os: "Ubuntu 18.04" os: "Ubuntu 18.04"
user_name: "vm_user" user_name: "vm_user"
interfaces: interfaces:
...@@ -16,22 +16,22 @@ topology_template: ...@@ -16,22 +16,22 @@ topology_template:
user_key_pair: user_key_pair:
protocol: "ssh" protocol: "ssh"
keys: keys:
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDV3l6VEoxS1pycDVvVHVBVm15dmxKL2prMnRNdktZSlAvSWtHZ1JKeTVFNUgrbjl0eU1QRXdyUDN4c0lUMVZzRjlVNVhLTkkvVDVpZDgxNko5RmxjbEhOSHVrbEFTMlhqV3QzNnlZekorMkhsa3JET0I4Q25DdmgvQlQ5K2liNkpjVFpUd21Xb1FQbjFuVXpSelRSVGU5NUlyOUl4djgrTnNLVWYxdVYzNDBRPT0gYXV0byBnZW5lcmF0ZWQgdXNlciBhY2NlZXMga2V5cwo=" public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDRm9tbkNaR2JYaGthdFkrV2VLQ29yRzdSRUlYSTBhclNLb2VrVU13Wks3c1NjNTloTFN3a09TcGZiTExuNnlGWG1Tc1h3bkk5SmJvY1lCdUR2bllJdVVrdnY5bmtQWVc3S0RXdU01UU5oanlhQUtkVUlXeGhZZ3pka2JJYkVUNlo2QkgvZGxzV2NsSU9aMnNSeGFidkNPQVVsT0xNWDFMQUlFK1ZacDlpekl3PT0gZ2VuZXJhdGVkIHVzZXIgYWNjZWVzIGtleXMK"
private_key: "LS0tLS1CRUdJTiBSU0EgUFJJVkFURS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h0RTFsZjNsSk9SdzNQZVFIVEwrYTlReHoKRE1OYkpmV0NhamMxY3Fnc0pRSkFkNmhoekxVTmFtYVVycTdoNkdMTUZ4TFdOdDJleGhWZWhZU3IyeTBZZ2RXZwpaUTc1eTV2Rm9zMXFTTDl6dU83cVpKRmpqc2doVVhvRGtVbFNYWk9DMlE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
public_ip: "192.125.18.246" public_ip: "52.59.190.147"
role: "master" role: "master"
node_type: "t2.medium" node_type: "t2.micro"
root_key_pair: root_key_pair:
protocol: "ssh" protocol: "ssh"
keys: keys:
public_key: "cHVibGljS2V5LTM5NjBjZThjLTA0NzctNDcyNC1iZTc5LWM5NGNjZjQ1ZDYwZg==" public_key: "cHVibGljS2V5LTMyMGQwOWM5LWZiY2EtNDFiMy04OGU0LTFjYzVjMmFmNDY1OQ=="
private_key: "LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBbnFVd3E3ZHdvWjJjcU03WSsrcGRia0Jud0dFc1FEVExQdWxQWklQMm5UcUo3L05aTlQzMU9uM1hRMElsCkNENFNLekxyVE04ZGlIVEJRRlBQZTV6UHB6Q1Uyam82SDcxL0xUTDRnZDZPakxreFkwS2p5SWZwbFJUcHhpUnpldXVJVG9wLzdLZWoKMjMyWVQ4QXowQU03SStQZVFwb0l1RjhQeHBOdlpnOUZvYWlMd09iL2lwSFV0ZlNjUTRzZEhPTHlCU1h3N1RIQ2VkNHowazRpckhpbQpMTlJHRFZJenNpZDM4T0hRYnFna2pPZUJBaFVoUm5oKzAwWmVYb2NER2o3bUZGWGxuYkhzeGNzTGx3NlM0V1NsR0RPalhPRFRvRE5ICkNmMUkycUdtSWM0VXovckR4TSs5Q3JQYlhBMnNHd1RIV0paM1ZENUtzWmFWSEkzTlp2K3ZBUUlEQVFBQkFvSUJBQVJZVyt2b0cxS2gKNFgrU0lzbExrd0dKREE1dDJ1dHJSc0h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ZrbmRXY2xaNlJGcmZIR2kxWG9LL2h6NnJWVmFXSmZFVEwxYmhnRQpacVZveTRnQzVvcE5DQmFjTER5ZTFMQnVySEE0QTcwS1d0UTlMMkhTOU1nZGpqQm1QSmo2eFRtV21iamNkNkRMTlJkdmZRaTBPbzdlCjY3MEkrREZ5L2JieHB0cktFV0hPZWdFQ2dZQmM3a0NDbGlUZ29xNkVUdUhQQXpYMnB0TUNtV2Y4MDlPc0VSY29kWGlMRWRDUWJFMU4KOGVxNHIzK2Z3cDUyMHNXZDJmcFpvNjFCeXJzUGV5N0pGeXhPN3RqdVp2WGlzN3dHeU5oOUlIdnBOaDNQNG9DSUZudkRQa04veUJWbgpwQUJSUlNyZHNEVzRxY2RXeFJlM0k4ZU16d1VzYVM0TUQvUElrYzBrdWU3dGh3S0JnUUNuUjh2NHM0bWVQeEF1MGRiVmxaR3ExUnZnCkJnR3BkZHR6SnN2Sk9qYitmWVp3a2tNU3huZGY5dzdocUVqbEFPckdNVmlBTm13R3ROVWFSMEdkS1h1OGxoRzNSUDFEbnFRdkR0ZDMKajRRTkE0WUFjZ2xFYnpLK1JsVzR1VENOeTN6enBqcC8wOERBazJOZHMvVkhkQ0gyRlBBaW9TdVkrTllESFJhTlE0Tng4QT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0t"
host_name: "vm0" host_name: "vm0"
compute_1: compute_1:
properties: properties:
disk_size: "50000 MB" disk_size: "10000 MB"
mem_size: "6000 MB" mem_size: "1000 MB"
num_cores: 2.0 num_cores: 1.0
os: "Ubuntu 18.04" os: "Ubuntu 18.04"
user_name: "vm_user" user_name: "vm_user"
interfaces: interfaces:
...@@ -42,21 +42,18 @@ topology_template: ...@@ -42,21 +42,18 @@ topology_template:
user_key_pair: user_key_pair:
protocol: "ssh" protocol: "ssh"
keys: keys:
public_key: "c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFBZ1FDV3l6VEoxS1pycDVvVHVBVm15dmxKL2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R5dXAzV0EyZnY1QmRRVWlDYWVXdDdqMlVrCjlmcVNkQi9MVGkzSzB5cmpwQ3RvTk5jNnU0dHpkV0txRk9QRUgyNXhHQ1N6aVpNQWFWcWdFTTNDb0UrVUl1aXIKNW1FaGlQRDJhd2U2SFdZbUQvODQwTUxWR1NUMWp3VUdxTy9wY0dpQW04c0hBeGtDUVFEYW45S1JZL2RiQmNUegpLR3JUL25Xamg2WW0ySnAxNkd5NEMxeDVEZElUYVg5TEtsajIwS2V4ZFQ5NGVNN2o5S1pBZG9uS2xzQ1l1WVBRClRRMGd6U2hQQWtFQW5IcjV2YkFhbWh1Rkw1Uk9zQXF4dWhxdXRVcTRUbnVraHlPNFZQYnoxRE12djgwZzd0V1MKWnNtSWV6ek14YXpncXhiaHV2S0lPWjFoRjROUDNsVCs3UUpBZWRPbDJ5OEJuODlQT05ERTl1MU5VSnMrazFjUQplN1BSSVozekllSDV0cWVMTDYraGM2aENTamt6N1VZa3hCS0lzbE5iNVhDc1VtN09iVDBDbTh5M01RSkFlMzlHCjJTRkNiWHZveWx0SEd3TGxyNVpkYWpGVmNvTjhuemRleEplK2Fpd1h0RTFsZjNsSk9SdzNQZVFIVEwrYTlReHoKRE1OYkpmV0NhamMxY3Fnc0pRSkFkNmhoekxVTmFtYVVycTdoNkdMTUZ4TFdOdDJleGhWZWhZU3IyeTBZZ2RXZwpaUTc1eTV2Rm9zMXFTTDl6dU83cVpKRmpqc2doVVhvRGtVbFNYWk9DMlE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo="
public_ip: "192.122.56.251" public_ip: "3.127.81.250"
role: "worker" role: "worker"
node_type: "t2.medium" node_type: "t2.micro"
root_key_pair: root_key_pair:
protocol: "ssh" protocol: "ssh"
keys: keys:
public_key: "cHVibGljS2V5LTM5NjBjZThjLTA0NzctNDcyNC1iZTc5LWM5NGNjZjQ1ZDYwZg==" public_key: "cHVibGljS2V5LTMyMGQwOWM5LWZiY2EtNDFiMy04OGU0LTF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1MGRiVmxaR3ExUnZnCkJnR3BkZHR6SnN2Sk9qYitmWVp3a2tNU3huZGY5dzdocUVqbEFPckdNVmlBTm13R3ROVWFSMEdkS1h1OGxoRzNSUDFEbnFRdkR0ZDMKajRRTkE0WUFjZ2xFYnpLK1JsVzR1VENOeTN6enBqcC8wOERBazJOZHMvVkhkQ0gyRlBBaW9TdVkrTllESFJhTlE0Tng4QT09Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0t"
host_name: "vm1" host_name: "vm1"
kubernetes: kubernetes:
properties:
min_masters_num: 1
min_workers_num: 1
requirements: requirements:
- host: - host:
capability: "tosca.capabilities.ARTICONF.VM.topology" capability: "tosca.capabilities.ARTICONF.VM.topology"
...@@ -64,6 +61,9 @@ topology_template: ...@@ -64,6 +61,9 @@ topology_template:
relationship: "tosca.relationships.HostedOn" relationship: "tosca.relationships.HostedOn"
interfaces: interfaces:
Kubernetes: Kubernetes:
configure:
inputs:
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/dashboard.yaml"
create: create:
inputs: inputs:
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml" playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"
...@@ -71,48 +71,6 @@ topology_template: ...@@ -71,48 +71,6 @@ topology_template:
inputs: inputs:
playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml" playbook: "https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"
type: "tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes" type: "tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
logspout:
properties:
environment:
publish: "127.0.0.1:8000:80"
ports:
- "8000:80"
volumes:
- "/etc/hostname:/etc/host_hostname:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
requirements:
- host:
capability: "tosca.capabilities.ARTICONF.docker.Orchestrator"
node: "kubernetes"
relationship: "tosca.relationships.HostedOn"
type: "tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts:
image:
file: "gliderlabs/logspout:latest"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
mysql:
properties:
environment:
MYSQL_DATABASE: "wordpress"
MYSQL_PASSWORD: "wordpress"
MYSQL_ROOT_PASSWORD: "somewordpress"
MYSQL_USER: "wordpress"
ports:
- "3306:3306"
volumes:
- "db_data:/var/lib/mysql"
requirements:
- host:
capability: "tosca.capabilities.ARTICONF.docker.Orchestrator"
node: "kubernetes"
relationship: "tosca.relationships.HostedOn"
type: "tosca.nodes.ARTICONF.Container.Application.Docker"
artifacts:
image:
file: "mysql:5.7"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
topology: topology:
properties: properties:
domain: "Frankfurt" domain: "Frankfurt"
...@@ -128,33 +86,51 @@ topology_template: ...@@ -128,33 +86,51 @@ topology_template:
relationship: "tosca.relationships.DependsOn" relationship: "tosca.relationships.DependsOn"
interfaces: interfaces:
CloudsStorm: CloudsStorm:
delete:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
hscale:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
provision: provision:
inputs: inputs:
code_type: "SEQ" code_type: "SEQ"
object_type: "SubTopology" object_type: "SubTopology"
start:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
stop:
inputs:
code_type: "SEQ"
object_type: "SubTopology"
type: "tosca.nodes.ARTICONF.VM.topology" type: "tosca.nodes.ARTICONF.VM.topology"
attributes: attributes:
credential: credential:
cloud_provider_name: "EC2" cloud_provider_name: "EC2"
keys: keys:
aws_access_key_id: "XXXXXXXXXXXXXXXXXXXXXXXX" aws_access_key_id: "XXXXXXXXXXXXXXXXXXX"
token: "XXXXXXXXXXXXXXXXXXXXXX" token: "XXXXXXXXXXXXXXXXXXX"
token_type: "access_key" token_type: "access_key"
desired_state: "PROVISION"
status: "running" status: "running"
policies: ws-pema:
- scalability:
properties: properties:
constraint_name: "cpu_load" ports:
max_value: 90 - "30001:8080"
targets: requirements:
- "mysql" - host:
type: "tosca.policies.ARTICONF.Performance.CPU" capability: "tosca.capabilities.ARTICONF.docker.Orchestrator"
- faultTolerance: node: "kubernetes"
properties: relationship: "tosca.relationships.HostedOn"
level: 1 type: "tosca.nodes.ARTICONF.Container.Application.Docker"
targets: artifacts:
- "mysql" image:
type: "tosca.policies.ARTICONF.FaultTolerance" file: "alogo53/ws-pema-lifewatch"
repository: "docker_hub"
type: "tosca.artifacts.Deployment.Image.Container.Docker"
description: "TOSCA example" description: "TOSCA example"
imports: imports:
- nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml" - nodes: "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
......
...@@ -153,12 +153,7 @@ node_types: ...@@ -153,12 +153,7 @@ node_types:
attributes: attributes:
ssh_keys: ssh_keys:
type: tosca.datatypes.ARTICONF.Credential type: tosca.datatypes.ARTICONF.Credential
required: false required: false
status:
type: string
required: false
constraints:
- valid_values: [ "fresh" , "running" , "deleted", "failed" , "stopped" ]
interfaces: interfaces:
CloudsStorm: CloudsStorm:
type: tosca.interfaces.ARTICONF.CloudsStorm type: tosca.interfaces.ARTICONF.CloudsStorm
......
...@@ -143,7 +143,13 @@ ...@@ -143,7 +143,13 @@
<artifactId>snakeyaml</artifactId> <artifactId>snakeyaml</artifactId>
<version>1.25</version> <version>1.25</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.54</version>
<type>jar</type>
</dependency>
</dependencies> </dependencies>
......
...@@ -60,7 +60,7 @@ public class Converter { ...@@ -60,7 +60,7 @@ public class Converter {
} }
public static String encodeFileToBase64Binary(String fileName) throws IOException { public static String encodeFileToBase64Binary(String fileName) throws IOException {
return encode2Bas64(Files.readAllBytes(Paths.get(fileName))); return encode2Base64(Files.readAllBytes(Paths.get(fileName)));
} }
public static void decodeBase64BToFile(String base64, String fileName) throws IOException { public static void decodeBase64BToFile(String base64, String fileName) throws IOException {
...@@ -82,11 +82,11 @@ public class Converter { ...@@ -82,11 +82,11 @@ public class Converter {
String name = System.currentTimeMillis() + "_" + originalFileName; String name = System.currentTimeMillis() + "_" + originalFileName;
byte[] bytes = file.getBytes(); byte[] bytes = file.getBytes();
return encode2Bas64(bytes); return encode2Base64(bytes);
} }
private static String encode2Bas64(byte[] bytes) { private static String encode2Base64(byte[] bytes) {
byte[] encodedBytes = Base64.getEncoder().encode(bytes); byte[] encodedBytes = Base64.getEncoder().encode(bytes);
return new String(encodedBytes, StandardCharsets.UTF_8); return new String(encodedBytes, StandardCharsets.UTF_8);
......
...@@ -21,11 +21,15 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -21,11 +21,15 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.KeyPair;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -43,6 +47,7 @@ import nl.uva.sne.drip.sure.tosca.client.ApiException; ...@@ -43,6 +47,7 @@ import nl.uva.sne.drip.sure.tosca.client.ApiException;
import nl.uva.sne.drip.sure.tosca.client.Configuration; import nl.uva.sne.drip.sure.tosca.client.Configuration;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import static nl.uva.sne.drip.commons.utils.Constatnts.*; import static nl.uva.sne.drip.commons.utils.Constatnts.*;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology.StatusEnum;
/** /**
* *
...@@ -57,7 +62,7 @@ public class ToscaHelper { ...@@ -57,7 +62,7 @@ public class ToscaHelper {
private Integer id; private Integer id;
public static enum NODE_STATES { public static enum NODE_STATES {
PROVISION, DELETE, START, STOP, H_SCALE, V_SCALE, CONFIGURE DELETED, STARTED, STOPPED, H_SCALED, V_SCALED, CONFIGURED, RUNNING, FAILED
} }
@Autowired @Autowired
...@@ -251,7 +256,7 @@ public class ToscaHelper { ...@@ -251,7 +256,7 @@ public class ToscaHelper {
return toscaCredential; return toscaCredential;
} else { } else {
throw new Exception("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + vmTopology.getType()); throw new TypeExeption("NodeTemplate is not of type: " + VM_TOPOLOGY + " it is of type: " + vmTopology.getType());
} }
} }
...@@ -296,9 +301,12 @@ public class ToscaHelper { ...@@ -296,9 +301,12 @@ public class ToscaHelper {
public NODE_STATES getNodeCurrentState(NodeTemplateMap node) { public NODE_STATES getNodeCurrentState(NodeTemplateMap node) {
return getNodeState(node, "current_state"); return getNodeState(node, "current_state");
} }
public NodeTemplateMap setNodeCurrentState(NodeTemplateMap node, NODE_STATES nodeState) {
return setNodeState(node, "current_state", nodeState);
}
public NodeTemplateMap setNodeDesiredState(NodeTemplateMap node, NODE_STATES nodeState) { public NodeTemplateMap setNodeDesiredState(NodeTemplateMap node, NODE_STATES nodeState) {
return setNodeState(node, "desired_state", nodeState); return setNodeState(node, "desired_state", nodeState);
} }
...@@ -325,4 +333,34 @@ public class ToscaHelper { ...@@ -325,4 +333,34 @@ public class ToscaHelper {
return node; return node;
} }
public static NODE_STATES cloudStormStatus2NodeState(StatusEnum cloudStormStatus) {
if(cloudStormStatus.equals(StatusEnum.FRESH)){
return null;
}
String cloudStormStatusStr = cloudStormStatus.toString().toUpperCase();
return NODE_STATES.valueOf(cloudStormStatusStr);
}
public KeyPair getKeyPairsFromVM(NodeTemplate vmMap) throws ApiException, TypeExeption, JSchException {
if (vmMap.getType().equals(VM_TYPE)) {
Map<String, Object> attributes = vmMap.getAttributes();
if (attributes != null && attributes.containsKey("user_key_pair")) {
Map<String, Object> userKeyPair = (Map<String, Object>) attributes.get("user_key_pair");
if (userKeyPair.containsKey("protocol") && userKeyPair.get("protocol").equals("ssh")) {
Map<String, Object> keysMap = (Map<String, Object>) userKeyPair.get("keys");
JSch jsch = new JSch();
byte[] privatekeyBytes = Base64.getDecoder().decode(((String) keysMap.get("private_key")));
byte[] publicKeyBytes = Base64.getDecoder().decode(((String) keysMap.get("public_key")));
KeyPair keyPair = KeyPair.load(jsch, privatekeyBytes, publicKeyBytes);
keyPair.dispose();
return keyPair;
}
}
} else {
throw new TypeExeption("NodeTemplate is not of type: " + VM_TYPE + " it is of type: " + vmMap.getType());
}
return null;
}
} }
...@@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator; import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
import com.jcraft.jsch.KeyPair;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.nio.file.Files; import java.nio.file.Files;
...@@ -439,4 +440,44 @@ public class ToscaHelperTest { ...@@ -439,4 +440,44 @@ public class ToscaHelperTest {
} }
/**
* Test of getKeyPairsFromVM method, of class ToscaHelper.
*/
@Test
public void testGetKeyPairsFromVM() throws Exception {
System.out.println("getKeyPairsFromVM");
instance.uploadToscaTemplate(provisionedToscaTemplate);
KeyPair keyPair;
List<NodeTemplateMap> vmTopologyTemplatesMap = instance.getVMTopologyTemplates();
assertNotNull(vmTopologyTemplatesMap);
for (NodeTemplateMap nodeTemplateMap : vmTopologyTemplatesMap) {
assertNotNull(nodeTemplateMap);
List<NodeTemplateMap> vmTemplatesMap = instance.getTemplateVMsForVMTopology(nodeTemplateMap);
assertNotNull(vmTemplatesMap);
for (NodeTemplateMap vmMap : vmTemplatesMap) {
assertNotNull(vmMap);
assertNotNull(vmMap.getNodeTemplate());
keyPair = instance.getKeyPairsFromVM(vmMap.getNodeTemplate());
assertNotNull(keyPair);
}
}
}
/**
* Test of cloudStormStatus2NodeState method, of class ToscaHelper.
*/
@Test
public void testCloudStormStatus2NodeState() {
System.out.println("cloudStormStatus2NodeState");
for (CloudsStormSubTopology.StatusEnum value : CloudsStormSubTopology.StatusEnum.values()) {
ToscaHelper.NODE_STATES result = ToscaHelper.cloudStormStatus2NodeState(value);
if (value.equals(CloudsStormSubTopology.StatusEnum.FRESH)) {
assertNull(result);
} else {
assertEquals(value.toString().toUpperCase(), result.toString().toUpperCase());
}
}
}
} }
...@@ -28,10 +28,10 @@ class TestDeployer(unittest.TestCase): ...@@ -28,10 +28,10 @@ class TestDeployer(unittest.TestCase):
def test(self): def test(self):
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
tosca_path = "../../TOSCA/" tosca_path = "../../example_messages/"
input_tosca_file_path = tosca_path + '/message_example_provisioned.json' input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
if not os.path.exists(input_tosca_file_path): if not os.path.exists(input_tosca_file_path):
tosca_path = "../TOSCA/" tosca_path = "../example_messages/"
input_tosca_file_path = tosca_path + '/message_example_provisioned.json' input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
with open(input_tosca_file_path, 'r') as stream: with open(input_tosca_file_path, 'r') as stream:
......
{"owner":"user","creationDate":1584616813246,"toscaTemplate":{"tosca_definitions_version":"tosca_simple_yaml_1_0","tosca_default_namespace":null,"template_name":null,"topology_template":{"description":null,"inputs":null,"node_templates":{"compute":{"properties":{"disk_size":"10000 MB","mem_size":"1000 MB","num_cores":1,"os":"Ubuntu 18.04","user_name":"vm_user"},"interfaces":{"Standard":{"create":"dumy.yaml"}},"type":"tosca.nodes.ARTICONF.VM.Compute"},"compute_1":{"properties":{"disk_size":"10000 MB","mem_size":"1000 MB","num_cores":1,"os":"Ubuntu 18.04","user_name":"vm_user"},"interfaces":{"Standard":{"create":"dumy.yaml"}},"type":"tosca.nodes.ARTICONF.VM.Compute"},"kubernetes":{"requirements":[{"host":{"capability":"tosca.capabilities.ARTICONF.VM.topology","node":"topology","relationship":"tosca.relationships.HostedOn"}}],"interfaces":{"Kubernetes":{"configure":{"inputs":{"playbook":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/dashboard.yaml"}},"create":{"inputs":{"playbook":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"}},"install":{"inputs":{"playbook":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"}}}},"type":"tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"},"topology":{"properties":{"domain":"Frankfurt","provider":"EC2"},"requirements":[{"vm":{"capability":"tosca.capabilities.ARTICONF.VM","node":"compute","relationship":"tosca.relationships.DependsOn"}},{"vm":{"capability":"tosca.capabilities.ARTICONF.VM","node":"compute_1","relationship":"tosca.relationships.DependsOn"}}],"interfaces":{"CloudsStorm":{"delete":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"hscale":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"provision":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"start":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"stop":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}}}},"type":"tosca.nodes.ARTICONF.VM.topology","attributes":{"credential":{"cloud_provider_name":"EC2","keys":{"aws_access_key_id":"XXXXXXXXXXXXXXXXXXX"},"token":"XXXXXXXXXXXXXXX","token_type":"access_key"},"desired_state":"PROVISION"}},"ws-pema":{"properties":{"ports":["30001:8080"]},"requirements":[{"host":{"capability":"tosca.capabilities.ARTICONF.docker.Orchestrator","node":"kubernetes","relationship":"tosca.relationships.HostedOn"}}],"type":"tosca.nodes.ARTICONF.Container.Application.Docker","artifacts":{"image":{"file":"alogo53/ws-pema-lifewatch","repository":"docker_hub","type":"tosca.artifacts.Deployment.Image.Container.Docker"}}}},"relationship_templates":null,"outputs":null,"groups":null,"substitution_mappings":null,"policies":null},"template_author":null,"template_version":null,"description":"TOSCA example","imports":[{"nodes":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"},{"data":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"},{"capabilities":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"},{"policies":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"},{"interfaces":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"}],"dsl_definitions":null,"node_types":null,"relationship_types":null,"relationship_templates":null,"capability_types":null,"artifact_types":null,"data_types":null,"interface_types":null,"policy_types":null,"group_types":null,"repositories":null}}
...@@ -117,7 +117,7 @@ public class DRIPService { ...@@ -117,7 +117,7 @@ public class DRIPService {
if (vmTopologies == null || vmTopologies.isEmpty()) { if (vmTopologies == null || vmTopologies.isEmpty()) {
throw new MissingVMTopologyException("ToscaTemplate: " + toscaTemplate + " has no VM Topologies"); throw new MissingVMTopologyException("ToscaTemplate: " + toscaTemplate + " has no VM Topologies");
} }
toscaTemplate = setDesieredSate(toscaTemplate, vmTopologies, NODE_STATES.PROVISION); toscaTemplate = setDesieredSate(toscaTemplate, vmTopologies, NODE_STATES.RUNNING);
return execute(toscaTemplate, provisionerQueueName); return execute(toscaTemplate, provisionerQueueName);
} }
...@@ -162,7 +162,7 @@ public class DRIPService { ...@@ -162,7 +162,7 @@ public class DRIPService {
for (NodeTemplateMap vmTopology : vmTopologies) { for (NodeTemplateMap vmTopology : vmTopologies) {
CloudsStormSubTopology.StatusEnum status = helper.getVMTopologyTemplateStatus(vmTopology); CloudsStormSubTopology.StatusEnum status = helper.getVMTopologyTemplateStatus(vmTopology);
if (!status.equals(CloudsStormSubTopology.StatusEnum.DELETED)) { if (!status.equals(CloudsStormSubTopology.StatusEnum.DELETED)) {
toscaTemplate = setDesieredSate(toscaTemplate, vmTopologies, NODE_STATES.DELETE); toscaTemplate = setDesieredSate(toscaTemplate, vmTopologies, NODE_STATES.DELETED);
} }
} }
return execute(toscaTemplate, provisionerQueueName); return execute(toscaTemplate, provisionerQueueName);
......
...@@ -434,7 +434,7 @@ public class ServiceTests { ...@@ -434,7 +434,7 @@ public class ServiceTests {
Assert.assertTrue(attributes.containsKey("credential")); Assert.assertTrue(attributes.containsKey("credential"));
assertNotNull(attributes.get("credential")); assertNotNull(attributes.get("credential"));
} }
toscaTemplate = dripService.setDesieredSate(toscaTemplate, vmTopologies, ToscaHelper.NODE_STATES.PROVISION); toscaTemplate = dripService.setDesieredSate(toscaTemplate, vmTopologies, ToscaHelper.NODE_STATES.RUNNING);
Map<String, NodeTemplate> nodes = toscaTemplate.getTopologyTemplate().getNodeTemplates(); Map<String, NodeTemplate> nodes = toscaTemplate.getTopologyTemplate().getNodeTemplates();
Set<String> names = nodes.keySet(); Set<String> names = nodes.keySet();
for (String name : names) { for (String name : names) {
......
...@@ -31,6 +31,8 @@ import java.util.logging.Level; ...@@ -31,6 +31,8 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.commons.utils.ToscaHelper; import nl.uva.sne.drip.commons.utils.ToscaHelper;
import static nl.uva.sne.drip.commons.utils.ToscaHelper.cloudStormStatus2NodeState;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormVM; import nl.uva.sne.drip.model.cloud.storm.CloudsStormVM;
import nl.uva.sne.drip.model.NodeTemplateMap; import nl.uva.sne.drip.model.NodeTemplateMap;
import nl.uva.sne.drip.model.cloud.storm.CloudCred; import nl.uva.sne.drip.model.cloud.storm.CloudCred;
...@@ -64,17 +66,19 @@ class CloudStormService { ...@@ -64,17 +66,19 @@ class CloudStormService {
private final CloudStormDAO cloudStormDAO; private final CloudStormDAO cloudStormDAO;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final String cloudStormDBPath; private final String cloudStormDBPath;
private final String SUB_TOPOLOGY_NAME = "subTopology"; public static final String SUB_TOPOLOGY_NAME = "subTopology";
private final String TOPOLOGY_FOLDER_NAME = "Topology"; public static final String TOPOLOGY_FOLDER_NAME = "Topology";
private final String INFS_FOLDER_NAME = "Infs"; public static final String INFS_FOLDER_NAME = "Infs";
private final String UC_FOLDER_NAME = "UC"; public static final String UC_FOLDER_NAME = "UC";
private final String UD_FOLDER_NAME = "UD"; public static final String UD_FOLDER_NAME = "UD";
private final String APP_FOLDER_NAME = "App"; public static final String APP_FOLDER_NAME = "App";
private final String TOP_TOPOLOGY_FILE_NAME = "_top.yml"; public static final String TOP_TOPOLOGY_FILE_NAME = "_top.yml";
private final String TOPOLOGY_RELATIVE_PATH = File.separator public static final String TOPOLOGY_RELATIVE_PATH = File.separator
+ INFS_FOLDER_NAME + File.separator + TOPOLOGY_FOLDER_NAME + File.separator; + INFS_FOLDER_NAME + File.separator + TOPOLOGY_FOLDER_NAME + File.separator;
private ToscaTemplate toscaTemplate; private ToscaTemplate toscaTemplate;
private String userPublicKeyName;
public static final String INFRASTUCTURE_CODE_FILE_NAME = "infrasCode.yml";
CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException { CloudStormService(Properties properties, ToscaTemplate toscaTemplate) throws IOException, JsonProcessingException, ApiException {
this.toscaTemplate = toscaTemplate; this.toscaTemplate = toscaTemplate;
...@@ -132,34 +136,39 @@ class CloudStormService { ...@@ -132,34 +136,39 @@ class CloudStormService {
List<CloudsStormSubTopology> cloudStormSubtopologies = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies"); List<CloudsStormSubTopology> cloudStormSubtopologies = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
writeCloudStormInfrasCodeFiles(infrasCodeTempInputDirPath, cloudStormSubtopologies); writeCloudStormInfrasCodeFiles(infrasCodeTempInputDirPath, cloudStormSubtopologies);
ToscaTemplate toscaTemplate = runCloudStorm(tempInputDirPath); ToscaTemplate newToscaTemplate = runCloudStorm(tempInputDirPath);
helper.uploadToscaTemplate(toscaTemplate); helper.uploadToscaTemplate(newToscaTemplate);
return toscaTemplate; return newToscaTemplate;
} }
private Map<String, Object> writeCloudStormTopologyFiles(String tempInputDirPath) throws JSchException, IOException, ApiException, Exception { protected Map<String, Object> writeCloudStormTopologyFiles(String topologyTempInputDirPath) throws JSchException, IOException, ApiException, Exception {
CloudsStormTopTopology topTopology = new CloudsStormTopTopology(); CloudsStormTopTopology topTopology = new CloudsStormTopTopology();
String publicKeyPath = buildSSHKeyPair(tempInputDirPath);
KeyPair keyPair = getKeyPair();
String publicKeyPath = buildSSHKeyPair(topologyTempInputDirPath, keyPair);
topTopology.setPublicKeyPath(publicKeyPath); topTopology.setPublicKeyPath(publicKeyPath);
topTopology.setUserName(helper.getVMTopologyUser()); topTopology.setUserName(helper.getVMTopologyUser());
Map<String, Object> subTopologiesAndVMs = getCloudsStormSubTopologiesAndVMs(tempInputDirPath); Map<String, Object> subTopologiesAndVMs = getCloudsStormSubTopologiesAndVMs(topologyTempInputDirPath);
List<CloudsStormSubTopology> cloudsStormSubTopology = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies"); List<CloudsStormSubTopology> cloudsStormSubTopology = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
topTopology.setTopologies(cloudsStormSubTopology); topTopology.setTopologies(cloudsStormSubTopology);
File topTopologyFile = new File(topologyTempInputDirPath + File.separator + TOP_TOPOLOGY_FILE_NAME);
objectMapper.writeValue(new File(tempInputDirPath + File.separator + TOP_TOPOLOGY_FILE_NAME), topTopology); objectMapper.writeValue(topTopologyFile, topTopology);
Logger.getLogger(CloudStormService.class.getName()).log(Level.INFO, "Wrote CloudStorm topology files in: " + TOP_TOPOLOGY_FILE_NAME, new Object[]{tempInputDirPath, File.separator}); Logger.getLogger(CloudStormService.class.getName()).log(Level.INFO, "Wrote CloudStorm topology files in: {0}", topTopologyFile.getAbsolutePath());
return subTopologiesAndVMs; return subTopologiesAndVMs;
} }
private String buildSSHKeyPair(String tempInputDirPath) throws JSchException, IOException { protected String buildSSHKeyPair(String tempInputDirPath, KeyPair kpair) throws JSchException, IOException {
String userPublicKeyName = "id_rsa.pub"; userPublicKeyName = "id_rsa.pub";
String publicKeyPath = "name@" + userPublicKeyName; String publicKeyPath = "name@" + userPublicKeyName;
JSch jsch = new JSch();
KeyPair kpair = KeyPair.genKeyPair(jsch, KeyPair.RSA);
String userPrivateName = FilenameUtils.removeExtension(userPublicKeyName); String userPrivateName = FilenameUtils.removeExtension(userPublicKeyName);
if (kpair == null) {
JSch jsch = new JSch();
kpair = KeyPair.genKeyPair(jsch, KeyPair.RSA);
}
kpair.writePrivateKey(tempInputDirPath + File.separator + userPrivateName); kpair.writePrivateKey(tempInputDirPath + File.separator + userPrivateName);
kpair.writePublicKey(tempInputDirPath + File.separator + userPublicKeyName, "auto generated user accees keys"); kpair.writePublicKey(tempInputDirPath + File.separator + userPublicKeyName, "generated user accees keys");
kpair.dispose(); kpair.dispose();
Set<PosixFilePermission> perms = new HashSet<>(); Set<PosixFilePermission> perms = new HashSet<>();
...@@ -169,7 +178,7 @@ class CloudStormService { ...@@ -169,7 +178,7 @@ class CloudStormService {
return publicKeyPath; return publicKeyPath;
} }
private Map<String, Object> getCloudsStormSubTopologiesAndVMs(String tempInputDirPath) throws ApiException, IOException, Exception { protected Map<String, Object> getCloudsStormSubTopologiesAndVMs(String tempInputDirPath) throws ApiException, IOException, Exception {
List<NodeTemplateMap> vmTopologyTemplatesMap = helper.getVMTopologyTemplates(); List<NodeTemplateMap> vmTopologyTemplatesMap = helper.getVMTopologyTemplates();
List<CloudsStormSubTopology> cloudsStormSubTopologies = new ArrayList<>(); List<CloudsStormSubTopology> cloudsStormSubTopologies = new ArrayList<>();
Map<String, Object> cloudsStormMap = new HashMap<>(); Map<String, Object> cloudsStormMap = new HashMap<>();
...@@ -205,7 +214,7 @@ class CloudStormService { ...@@ -205,7 +214,7 @@ class CloudStormService {
return cloudsStormMap; return cloudsStormMap;
} }
private CloudsStormVM getBestMatchingCloudStormVM(NodeTemplateMap vmMap, String provider) throws IOException, Exception { protected CloudsStormVM getBestMatchingCloudStormVM(NodeTemplateMap vmMap, String provider) throws IOException, Exception {
Double requestedNumOfCores = helper.getVMNumOfCores(vmMap); Double requestedNumOfCores = helper.getVMNumOfCores(vmMap);
Double requestedMemSize = helper.getVMNMemSize(vmMap); Double requestedMemSize = helper.getVMNMemSize(vmMap);
String requestedOs = helper.getVMNOS(vmMap); String requestedOs = helper.getVMNOS(vmMap);
...@@ -247,7 +256,7 @@ class CloudStormService { ...@@ -247,7 +256,7 @@ class CloudStormService {
return bestMatchingVM; return bestMatchingVM;
} }
private void writeCloudStormCredentialsFiles(String credentialsTempInputDirPath) throws ApiException, Exception { protected void writeCloudStormCredentialsFiles(String credentialsTempInputDirPath) throws ApiException, Exception {
List<NodeTemplateMap> vmTopologiesMaps = helper.getVMTopologyTemplates(); List<NodeTemplateMap> vmTopologiesMaps = helper.getVMTopologyTemplates();
List<CloudCred> cloudStormCredentialList = new ArrayList<>(); List<CloudCred> cloudStormCredentialList = new ArrayList<>();
int i = 0; int i = 0;
...@@ -269,7 +278,7 @@ class CloudStormService { ...@@ -269,7 +278,7 @@ class CloudStormService {
Logger.getLogger(CloudStormService.class.getName()).log(Level.INFO, "Wrote cloudStorm credentials at : {0}{1}cred.yml", new Object[]{credentialsTempInputDirPath, File.separator}); Logger.getLogger(CloudStormService.class.getName()).log(Level.INFO, "Wrote cloudStorm credentials at : {0}{1}cred.yml", new Object[]{credentialsTempInputDirPath, File.separator});
} }
private CredentialInfo getCloudStormCredentialInfo(Credential toscaCredentials, String tmpPath) throws FileNotFoundException, IOException { protected CredentialInfo getCloudStormCredentialInfo(Credential toscaCredentials, String tmpPath) throws FileNotFoundException, IOException {
CredentialInfo cloudStormCredentialInfo = new CredentialInfo(); CredentialInfo cloudStormCredentialInfo = new CredentialInfo();
switch (toscaCredentials.getCloudProviderName().toLowerCase()) { switch (toscaCredentials.getCloudProviderName().toLowerCase()) {
case "exogeni": case "exogeni":
...@@ -288,17 +297,18 @@ class CloudStormService { ...@@ -288,17 +297,18 @@ class CloudStormService {
return null; return null;
} }
private void writeCloudStormInfrasCodeFiles(String infrasCodeTempInputDirPath, List<CloudsStormSubTopology> cloudStormSubtopologies) throws ApiException, IOException { protected void writeCloudStormInfrasCodeFiles(String infrasCodeTempInputDirPath, List<CloudsStormSubTopology> cloudStormSubtopologies) throws ApiException, IOException {
List<NodeTemplateMap> vmTopologiesMaps = helper.getVMTopologyTemplates(); List<NodeTemplateMap> vmTopologiesMaps = helper.getVMTopologyTemplates();
int i = 0; int i = 0;
List<InfrasCode> infrasCodes = new ArrayList<>(); List<InfrasCode> infrasCodes = new ArrayList<>();
for (NodeTemplateMap vmTopologyMap : vmTopologiesMaps) { for (NodeTemplateMap vmTopologyMap : vmTopologiesMaps) {
ToscaHelper.NODE_STATES nodeCurrentState = helper.getNodeCurrentState(vmTopologyMap); ToscaHelper.NODE_STATES nodeCurrentState = helper.getNodeCurrentState(vmTopologyMap);
ToscaHelper.NODE_STATES nodeDesiredState = helper.getNodeDesiredState(vmTopologyMap); ToscaHelper.NODE_STATES nodeDesiredState = helper.getNodeDesiredState(vmTopologyMap);
if (nodeCurrentState != null && nodeCurrentState.equals(ToscaHelper.NODE_STATES.PROVISION)) { if (nodeCurrentState != null && nodeCurrentState.equals(ToscaHelper.NODE_STATES.RUNNING)) {
//Already there //Already there
} }
if (nodeCurrentState == null || nodeCurrentState.equals(ToscaHelper.NODE_STATES.DELETE)) { //Can provision
if (nodeCurrentState == null || nodeCurrentState.equals(ToscaHelper.NODE_STATES.DELETED)) {
Map<String, Object> provisionInterface = helper.getProvisionerInterfaceFromVMTopology(vmTopologyMap); Map<String, Object> provisionInterface = helper.getProvisionerInterfaceFromVMTopology(vmTopologyMap);
String operation = nodeDesiredState.toString().toLowerCase(); String operation = nodeDesiredState.toString().toLowerCase();
Map<String, Object> inputs = (Map<String, Object>) provisionInterface.get(operation); Map<String, Object> inputs = (Map<String, Object>) provisionInterface.get(operation);
...@@ -317,17 +327,18 @@ class CloudStormService { ...@@ -317,17 +327,18 @@ class CloudStormService {
CloudsStormInfrasCode cloudsStormInfrasCode = new CloudsStormInfrasCode(); CloudsStormInfrasCode cloudsStormInfrasCode = new CloudsStormInfrasCode();
cloudsStormInfrasCode.setMode(CloudsStormInfrasCode.ModeEnum.LOCAL); cloudsStormInfrasCode.setMode(CloudsStormInfrasCode.ModeEnum.LOCAL);
cloudsStormInfrasCode.setInfrasCodes(infrasCodes); cloudsStormInfrasCode.setInfrasCodes(infrasCodes);
File infrasCodeFile = new File(infrasCodeTempInputDirPath + File.separator + INFRASTUCTURE_CODE_FILE_NAME);
objectMapper.writeValue(new File(infrasCodeTempInputDirPath + File.separator + "infrasCode.yml"), cloudsStormInfrasCode); Logger.getLogger(CloudStormService.class.getName()).log(Level.INFO, "Wrote infrasCode file: {0}", infrasCodeFile.getAbsolutePath());
objectMapper.writeValue(infrasCodeFile, cloudsStormInfrasCode);
} }
private void writeCloudStormProvidersDBFiles(String tempInputDirPath) throws IOException { protected void writeCloudStormProvidersDBFiles(String tempInputDirPath) throws IOException {
File srcDir = new File(cloudStormDBPath); File srcDir = new File(cloudStormDBPath);
File destDir = new File(tempInputDirPath); File destDir = new File(tempInputDirPath);
FileUtils.copyDirectory(srcDir, destDir); FileUtils.copyDirectory(srcDir, destDir);
} }
private ToscaTemplate runCloudStorm(String tempInputDirPath) throws IOException, ApiException { protected ToscaTemplate runCloudStorm(String tempInputDirPath) throws IOException, ApiException {
String[] args = new String[]{"run", tempInputDirPath}; String[] args = new String[]{"run", tempInputDirPath};
standalone.MainAsTool.main(args); standalone.MainAsTool.main(args);
// tempInputDirPath = "/tmp/Input-26386504078656"; // tempInputDirPath = "/tmp/Input-26386504078656";
...@@ -347,8 +358,8 @@ class CloudStormService { ...@@ -347,8 +358,8 @@ class CloudStormService {
if (att == null) { if (att == null) {
att = new HashMap<>(); att = new HashMap<>();
} }
att.put("status", subTopology.getStatus().toString()); helper.setNodeCurrentState(vmTopologyMap, cloudStormStatus2NodeState(subTopology.getStatus()));
String rootKeyPairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH String rootKeyPairFolder = tempInputDirPath + TOPOLOGY_RELATIVE_PATH
+ File.separator + subTopology.getSshKeyPairId(); + File.separator + subTopology.getSshKeyPairId();
...@@ -413,4 +424,17 @@ class CloudStormService { ...@@ -413,4 +424,17 @@ class CloudStormService {
return vector; return vector;
} }
protected KeyPair getKeyPair() throws ApiException, TypeExeption, JSchException {
KeyPair keyPair = null;
List<NodeTemplateMap> vmTopologyTemplatesMap = helper.getVMTopologyTemplates();
for (NodeTemplateMap nodeTemplateMap : vmTopologyTemplatesMap) {
List<NodeTemplateMap> vmTemplatesMap = helper.getTemplateVMsForVMTopology(nodeTemplateMap);
for (NodeTemplateMap vmMap : vmTemplatesMap) {
keyPair = helper.getKeyPairsFromVM(vmMap.getNodeTemplate());
break;
}
}
return keyPair;
}
} }
...@@ -35,46 +35,44 @@ import java.util.logging.Logger; ...@@ -35,46 +35,44 @@ import java.util.logging.Logger;
*/ */
public class RPCServer { public class RPCServer {
/**
* @return the prop
*/
public static Properties getProp() {
return prop;
}
/**
* @param aProp the prop to set
*/
public static void setProp(Properties aProp) {
prop = aProp;
}
private static Properties prop; private static Properties prop;
public static void main(String[] argv) throws MalformedURLException { public static void main(String[] argv) throws MalformedURLException {
prop = new Properties(); init(argv);
if (argv.length >= 1) {
try {
prop.load(new FileInputStream(argv[0]));
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
String resourceName = "application.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try (InputStream resourceStream = loader.getResourceAsStream(resourceName)) {
prop.load(resourceStream);
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
}
start(); start();
} }
private static void start() { private static void start() {
ConnectionFactory factory = new ConnectionFactory(); ConnectionFactory factory = new ConnectionFactory();
factory.setHost(prop.getProperty("message.broker.host")); factory.setHost(getProp().getProperty("message.broker.host"));
factory.setPassword(prop.getProperty("message.broker.username")); factory.setPassword(getProp().getProperty("message.broker.username"));
factory.setUsername(prop.getProperty("message.broker.password")); factory.setUsername(getProp().getProperty("message.broker.password"));
factory.setPort(AMQP.PROTOCOL.PORT); factory.setPort(AMQP.PROTOCOL.PORT);
Logger.getLogger(RPCServer.class.getName()).log(Level.INFO, "Connected to: {0}", prop.getProperty("message.broker.host")); Logger.getLogger(RPCServer.class.getName()).log(Level.INFO, "Connected to: {0}", getProp().getProperty("message.broker.host"));
try (Connection connection = factory.newConnection()) { try (Connection connection = factory.newConnection()) {
Channel channel = connection.createChannel(); Channel channel = connection.createChannel();
//We define the queue name //We define the queue name
channel.queueDeclare(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, false, false, null); channel.queueDeclare(getProp().getProperty("message.broker.queue.provisioner", "provisioner"), false, false, false, null);
DefaultConsumer c; DefaultConsumer c;
c = new nl.uva.sne.drip.provisioner.Consumer(channel,prop); c = new nl.uva.sne.drip.provisioner.Consumer(channel, getProp());
//Start listening for messages //Start listening for messages
channel.basicConsume(prop.getProperty("message.broker.queue.provisioner", "provisioner"), false, c); channel.basicConsume(getProp().getProperty("message.broker.queue.provisioner", "provisioner"), false, c);
//Block so we don't close the channel //Block so we don't close the channel
while (true) { while (true) {
...@@ -92,4 +90,23 @@ public class RPCServer { ...@@ -92,4 +90,23 @@ public class RPCServer {
} }
public static void init(String[] argv) {
setProp(new Properties());
if (argv.length >= 1) {
try {
getProp().load(new FileInputStream(argv[0]));
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
String resourceName = "application.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
try (InputStream resourceStream = loader.getResourceAsStream(resourceName)) {
getProp().load(resourceStream);
} catch (IOException ex) {
Logger.getLogger(RPCServer.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
} }
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.uva.sne.drip.provisioner;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.jcraft.jsch.KeyPair;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import nl.uva.sne.drip.commons.utils.ToscaHelper;
import nl.uva.sne.drip.model.Message;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
import static nl.uva.sne.drip.provisioner.CloudStormService.APP_FOLDER_NAME;
import static nl.uva.sne.drip.provisioner.CloudStormService.INFRASTUCTURE_CODE_FILE_NAME;
import static nl.uva.sne.drip.provisioner.CloudStormService.INFS_FOLDER_NAME;
import static nl.uva.sne.drip.provisioner.CloudStormService.TOPOLOGY_RELATIVE_PATH;
import static nl.uva.sne.drip.provisioner.CloudStormService.TOP_TOPOLOGY_FILE_NAME;
import static nl.uva.sne.drip.provisioner.CloudStormService.UC_FOLDER_NAME;
import static nl.uva.sne.drip.provisioner.CloudStormService.UD_FOLDER_NAME;
import nl.uva.sne.drip.sure.tosca.client.ApiException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author alogo
*/
public class CloudStormServiceTest {
private static final String messageExampleDeleteRequestFilePath = ".." + File.separator + "example_messages" + File.separator + "message_example_provisioned.json";
private static final String messageExampleProvisioneRequestFilePath = ".." + File.separator + "example_messages" + File.separator + "message_provision_request.json";
private final ObjectMapper objectMapper;
private String tempInputDirPath;
private String topologyTempInputDirPath;
private String sureToscaBasePath;
private File tempInputDir;
private File topologyTempInputDir;
private String infrasCodeTempInputDirPath;
private String credentialsTempInputDirPath;
private String providersDBTempInputDirPath;
public CloudStormServiceTest() {
this.objectMapper = new ObjectMapper();
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() throws IOException, JsonProcessingException, ApiException {
String[] argv = new String[0];
RPCServer.init(argv);
sureToscaBasePath = RPCServer.getProp().getProperty("sure-tosca.base.path");
initPaths();
}
@After
public void tearDown() {
}
// /**
// * Test of execute method, of class CloudStormService.
// */
// @Test
// public void testExecute() throws Exception {
// System.out.println("execute");
// CloudStormService instance = null;
// ToscaTemplate expResult = null;
// ToscaTemplate result = instance.execute();
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of writeCloudStormTopologyFiles method, of class CloudStormService.
// */
// @Test
// public void testWriteCloudStormTopologyFiles() throws Exception {
// System.out.println("writeCloudStormTopologyFiles");
// Map<String, Object> result = instance.writeCloudStormTopologyFiles(tempInputDirPath);
// assertNull(result);
// }
//
// /**
// * Test of buildSSHKeyPair method, of class CloudStormService.
// */
// @Test
// public void testBuildSSHKeyPair() throws Exception {
// System.out.println("buildSSHKeyPair");
// String result = instance.buildSSHKeyPair(tempInputDirPath, null);
// assertNotNull(result);
// String userPublicKeyName = "id_rsa.pub";
// String userPrivateName = FilenameUtils.removeExtension(userPublicKeyName);
// assertTrue(new File(tempInputDirPath + File.separator + userPrivateName).exists());
// assertTrue(new File(tempInputDirPath + File.separator + userPublicKeyName).exists());
//
// }
//
// /**
// * Test of getCloudsStormSubTopologiesAndVMs method, of class
// * CloudStormService.
// */
// @Test
// public void testGetCloudsStormSubTopologiesAndVMs() throws Exception {
// System.out.println("getCloudsStormSubTopologiesAndVMs");
// String tempInputDirPath = "";
// CloudStormService instance = null;
// Map<String, Object> expResult = null;
// Map<String, Object> result = instance.getCloudsStormSubTopologiesAndVMs(tempInputDirPath);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getBestMatchingCloudStormVM method, of class CloudStormService.
// */
// @Test
// public void testGetBestMatchingCloudStormVM() throws Exception {
// System.out.println("getBestMatchingCloudStormVM");
// NodeTemplateMap vmMap = null;
// String provider = "";
// CloudStormService instance = null;
// CloudsStormVM expResult = null;
// CloudsStormVM result = instance.getBestMatchingCloudStormVM(vmMap, provider);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of writeCloudStormCredentialsFiles method, of class
// * CloudStormService.
// */
// @Test
// public void testWriteCloudStormCredentialsFiles() throws Exception {
// System.out.println("writeCloudStormCredentialsFiles");
// String credentialsTempInputDirPath = "";
// CloudStormService instance = null;
// instance.writeCloudStormCredentialsFiles(credentialsTempInputDirPath);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
//
// /**
// * Test of getCloudStormCredentialInfo method, of class CloudStormService.
// */
// @Test
// public void testGetCloudStormCredentialInfo() throws Exception {
// System.out.println("getCloudStormCredentialInfo");
// Credential toscaCredentials = null;
// String tmpPath = "";
// CloudStormService instance = null;
// CredentialInfo expResult = null;
// CredentialInfo result = instance.getCloudStormCredentialInfo(toscaCredentials, tmpPath);
// assertEquals(expResult, result);
// // TODO review the generated test code and remove the default call to fail.
// fail("The test case is a prototype.");
// }
/**
* Test of writeCloudStormInfrasCodeFiles method, of class
* CloudStormService.
*/
@Test
public void testWriteCloudStormInfrasCodeFiles() throws Exception {
if (ToscaHelper.isServiceUp(sureToscaBasePath)) {
System.out.println("writeCloudStormInfrasCodeFiles");
CloudStormService instance = getService(messageExampleProvisioneRequestFilePath);
Map<String, Object> subTopologiesAndVMs = instance.writeCloudStormTopologyFiles(topologyTempInputDirPath);
assertNotNull(subTopologiesAndVMs);
assertTrue(new File(topologyTempInputDirPath + File.separator + TOP_TOPOLOGY_FILE_NAME).exists());
List<CloudsStormSubTopology> cloudStormSubtopologies = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
instance.writeCloudStormInfrasCodeFiles(infrasCodeTempInputDirPath, cloudStormSubtopologies);
assertTrue(new File(infrasCodeTempInputDirPath + File.separator + INFRASTUCTURE_CODE_FILE_NAME).exists());
instance = getService(messageExampleDeleteRequestFilePath);
subTopologiesAndVMs = instance.writeCloudStormTopologyFiles(topologyTempInputDirPath);
assertNotNull(subTopologiesAndVMs);
assertTrue(new File(topologyTempInputDirPath + File.separator + TOP_TOPOLOGY_FILE_NAME).exists());
cloudStormSubtopologies = (List<CloudsStormSubTopology>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
instance.writeCloudStormInfrasCodeFiles(infrasCodeTempInputDirPath, cloudStormSubtopologies);
assertTrue(new File(infrasCodeTempInputDirPath + File.separator + INFRASTUCTURE_CODE_FILE_NAME).exists());
}
}
/**
* Test of getKeyPair method, of class CloudStormService.
*/
@Test
public void testGetKeyPair() throws Exception {
if (ToscaHelper.isServiceUp(sureToscaBasePath)) {
System.out.println("getKeyPair");
CloudStormService instance = getService(messageExampleProvisioneRequestFilePath);
KeyPair result = instance.getKeyPair();
assertNull(result);
instance = getService(messageExampleDeleteRequestFilePath);
result = instance.getKeyPair();
assertNotNull(result);
}
}
private void initPaths() throws FileNotFoundException {
tempInputDirPath = System.getProperty("java.io.tmpdir") + File.separator + "Input-" + Long.toString(System.nanoTime()) + File.separator;
tempInputDir = new File(tempInputDirPath);
if (!(tempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
}
topologyTempInputDirPath = tempInputDirPath + TOPOLOGY_RELATIVE_PATH;
topologyTempInputDir = new File(topologyTempInputDirPath);
if (!(topologyTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
credentialsTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + UC_FOLDER_NAME;
File credentialsTempInputDir = new File(credentialsTempInputDirPath);
if (!(credentialsTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + credentialsTempInputDir.getAbsolutePath());
}
providersDBTempInputDirPath = tempInputDirPath + File.separator + INFS_FOLDER_NAME + File.separator + UD_FOLDER_NAME;
File providersDBTempInputDir = new File(providersDBTempInputDirPath);
if (!(providersDBTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + providersDBTempInputDir.getAbsolutePath());
}
infrasCodeTempInputDirPath = tempInputDirPath + File.separator + APP_FOLDER_NAME;
File infrasCodeTempInputDir = new File(infrasCodeTempInputDirPath);
if (!(infrasCodeTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
}
private CloudStormService getService(String messagefilePath) throws IOException, JsonProcessingException, ApiException {
Message message = objectMapper.readValue(new File(messagefilePath), Message.class);
return new CloudStormService(RPCServer.getProp(), message.getToscaTemplate());
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment