Commit 2a59a2d7 authored by skoulouzis's avatar skoulouzis

update

parent 1c43a702
......@@ -16,10 +16,7 @@ do
cd $python_project
rm -rf venv
python3 -m venv venv
venv/bin/pip3 install pip --upgrade
venv/bin/pip3 install setuptools --upgrade
venv/bin/pip3 install -r requirements.txt
if [ "$python_project" == "deployer" ]; then
cd ../semaphore-python-client-generated
../$python_project/venv/bin/python setup.py install
......
#!/bin/bash
docker push qcdis/manager
docker push qcdis/provisioner
docker push qcdis/sure-tosca
docker push qcdis/planner
docker push qcdis/deployer
docker push qcdis/manager:3.0.0
docker push qcdis/provisioner:3.0.0
# docker push qcdis/sure-tosca:3.0.0
# docker push qcdis/planner:3.0.0
# docker push qcdis/deployer:3.0.0
......@@ -4,27 +4,27 @@ echo "----------Building manager Docker--------------"
cd manager && mvn -Dmaven.test.skip=true dockerfile:build
status=$?
[ $status -eq 0 ] && echo "build successful" || exit -1
cd ../
echo "----------Building provisioner Docker--------------"
cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
[ $status -eq 0 ] && echo "build successful" || exit -1
cd ../
echo "----------Building sure_tosca-flask-server Docker--------------"
cd sure_tosca-flask-server && docker build -t sure-tosca .
[ $status -eq 0 ] && echo "build successful" || exit -1
echo "----------Building planner Docker--------------"
cd ../
cd planner && docker build -t planner .
[ $status -eq 0 ] && echo "build successful" || exit -1
echo "----------Building deployer Docker--------------"
cd ../
cd deployer && docker build -t deployer .
[ $status -eq 0 ] && echo "build successful" || exit -1
# cd ../
# echo "----------Building provisioner Docker--------------"
# cd provisioner && mvn -Dmaven.test.skip=true dockerfile:build
# [ $status -eq 0 ] && echo "build successful" || exit -1
# cd ../
# echo "----------Building sure_tosca-flask-server Docker--------------"
# cd sure_tosca-flask-server && docker build -t sure-tosca:3.0.0 .
# [ $status -eq 0 ] && echo "build successful" || exit -1
# echo "----------Building planner Docker--------------"
# cd ../
# cd planner && docker build -t planner:3.0.0 .
# [ $status -eq 0 ] && echo "build successful" || exit -1
# echo "----------Building deployer Docker--------------"
# cd ../
# cd deployer && docker build -t deployer:3.0.0 .
# [ $status -eq 0 ] && echo "build successful" || exit -1
docker tag sure-tosca qcdis/sure-tosca
docker tag planner qcdis/planner
docker tag deployer qcdis/deployer
docker tag manager:3.0.0 qcdis/manager
docker tag provisioner:3.0.0 qcdis/provisioner
# docker tag sure-tosca:3.0.0 qcdis/sure-tosca:3.0.0
# docker tag planner:3.0.0 qcdis/planner:3.0.0
# docker tag deployer:3.0.0 qcdis/deployer:3.0.0
docker tag manager:3.0.0 qcdis/manager:3.0.0
# docker tag provisioner:3.0.0 qcdis/provisioner:3.0.0
#!/bin/bash
cd ../
python3 -m venv venv
cd sure_tosca-flask-server && python3 -m venv venv && venv/bin/pip3 install -r test-requirements.txt && venv/bin/pip3 install -r requirements.txt && venv/bin/python3 -m unittest discover
if [ $? -eq 0 ]
then
echo "------- sure_tosca-flask-server tests successful------"
docker build -t sure-tosca:3.0.0 .
docker tag sure-tosca:3.0.0 qcdis/sure-tosca:3.0.0
else
echo "sure_tosca-flask-server tests Failed"
exit 1
fi
docker stack deploy conf-test -c ../docker-compose/docker-compose-test.yml
docker stack deploy conf-test -c ../docker-compose-test.yml
sure_tosca_url=http://127.0.0.1:8081/tosca-sure/1.0.0/ui
sure_tosca_url=http://localhost:8081
echo "Waiting for $sure_tosca_url"
count=0 && until $(curl --output /dev/null --silent --head --fail "$sure_tosca_url"); do printf '.' && sleep 10 && count=$((count+1)) && if [ $count -gt 5 ]; then break; fi; done
......@@ -31,58 +17,33 @@ fi
cd ../
mvn test
if [ $? -eq 0 ]
then
echo "------- Java tests successful------"
else
echo "Java tests Failed"
docker stack rm conf-test
exit 1
fi
status=$?
[ $status -eq 0 ] && echo "------- Java tests successful------" || exit -1
cd planner && python3 -m venv venv && venv/bin/pip3 install -r test-requirements.txt && venv/bin/pip3 install -r requirements.txt && venv/bin/python3 -m unittest discover
if [ $? -eq 0 ]
then
echo "------- Planner tests successful------"
else
echo "Planner tests Failed"
docker stack rm conf-test
exit 1
fi
cd planner && venv/bin/python3 -m unittest discover
status=$?
[ $status -eq 0 ] && echo "------- Planner tests successful------" || exit -1
cd ../
cd sure_tosca-flask-server && venv/bin/python3 -m unittest discover
status=$?
[ $status -eq 0 ] && echo "------- sure_tosca-flask-server tests successful------" || exit -1
cd ../
cd sure_tosca-client_python_stubs && python3 -m venv venv && venv/bin/pip3 install -r test-requirements.txt && venv/bin/pip3 install -r requirements.txt && venv/bin/python3 -m unittest discover
if [ $? -eq 0 ]
then
echo "------- sure_tosca-client_python_stubs tests successful------"
else
echo "sure_tosca-client_python_stubs tests Failed"
docker stack rm conf-test
exit 1
fi
cd sure_tosca-client_python_stubs && venv/bin/python3 -m unittest discover
status=$?
[ $status -eq 0 ] && echo "------- sure_tosca-client_python_stubs tests successful------" || exit -1
cd ../
cd semaphore-python-client-generated && python3 -m venv venv && venv/bin/pip3 install -r test-requirements.txt && venv/bin/pip3 install -r requirements.txt && venv/bin/python3 -m unittest discover
if [ $? -eq 0 ]
then
echo "------- semaphore-python-client-generated tests successful ------"
else
echo "semaphore-python-client-generated tests Failed"
docker stack rm conf-test
exit 1
fi
cd semaphore-python-client-generated && venv/bin/python3 -m unittest discover
status=$?
[ $status -eq 0 ] && echo "------- semaphore-python-client-generated tests successful------" || exit -1
#cd ../
#cd deployer && python3 -m venv venv && venv/bin/pip3 install -U pip setuptools && venv/bin/pip3 install -r test-requirements.txt && venv/bin/pip3 install -r requirements.txt && venv/bin/python3 -m unittest discover
#if [ $? -eq 0 ]
#then
# echo "------- deployer tests successful ------"
#else
# echo "deployer tests Failed"
# docker stack rm conf-test
# exit 1
#fi
cd ../
cd deployer && venv/bin/python3 -m unittest discover
status=$?
[ $status -eq 0 ] && echo "------- deployer tests successful------" || exit -1
docker stack rm conf-test
......@@ -16,7 +16,6 @@
package nl.uva.sne.drip.commons.utils;
/**
*
* @author S. Koulouzis
*/
public class Constants {
......@@ -33,7 +32,7 @@ public class Constants {
public static final String ENCODED_FILE_DATATYPE = "tosca.datatypes.QC.encodedFile";
public static final String CLOUD_STORM_FILES_ZIP_SUFIX = "cloudStromFiles.zip";
public static enum NODE_STATES {
public enum NODE_STATES {
DELETED, STARTED, STOPPED, H_SCALED, V_SCALED, CONFIGURED, RUNNING, FAILED
}
......
......@@ -15,63 +15,36 @@
*/
package nl.uva.sne.drip.commons.utils;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import org.yaml.snakeyaml.Yaml;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Base64;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.SecretKeySpec;
import nl.uva.sne.drip.model.tosca.Credential;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import org.yaml.snakeyaml.Yaml;
/**
*
* @author S. Koulouzis
*/
public class Converter {
public static String map2YmlString(Map<String, Object> map) throws JSONException {
JSONObject jsonObject = new JSONObject(map);
String yamlStr = json2Yml2(jsonObject.toString());
return yamlStr;
return json2Yml2(jsonObject.toString());
}
public static String json2Yml2(String jsonString) throws JSONException {
Yaml yaml = new Yaml();
String yamlStr = yaml.dump(ymlString2Map(jsonString));
return yamlStr;
return yaml.dump(ymlString2Map(jsonString));
}
public static Map<String, Object> ymlString2Map(String yamlString) {
......@@ -118,7 +91,7 @@ public class Converter {
return new String(encodedBytes, StandardCharsets.UTF_8);
}
public static void zipFolder(String sourceFolder, String zipFolder) throws FileNotFoundException, IOException {
public static void zipFolder(String sourceFolder, String zipFolder) throws IOException {
try (FileOutputStream fos = new FileOutputStream(zipFolder);
ZipOutputStream zos = new ZipOutputStream(fos)) {
Path sourcePath = Paths.get(sourceFolder);
......@@ -126,7 +99,7 @@ public class Converter {
@Override
public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException {
if (!sourcePath.equals(dir)) {
zos.putNextEntry(new ZipEntry(sourcePath.relativize(dir).toString() + "/"));
zos.putNextEntry(new ZipEntry(sourcePath.relativize(dir) + "/"));
zos.closeEntry();
}
return FileVisitResult.CONTINUE;
......@@ -168,62 +141,4 @@ public class Converter {
}
}
public static String decryptString(String contents, String secret) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
SecretKeySpec secretKey = getsecretKey(secret);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
return new String(cipher.doFinal(Base64.getDecoder().decode(contents)));
}
public static String encryptString(String contents, String secret) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
SecretKeySpec secretKey = getsecretKey(secret);
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
return Base64.getEncoder().encodeToString(cipher.doFinal(contents.getBytes("UTF-8")));
}
private static SecretKeySpec getsecretKey(String myKey) throws UnsupportedEncodingException, NoSuchAlgorithmException {
MessageDigest sha;
byte[] key = myKey.getBytes("UTF-8");
sha = MessageDigest.getInstance("SHA-1");
key = sha.digest(key);
key = Arrays.copyOf(key, 16);
return new SecretKeySpec(key, "AES");
}
public static Credential encryptCredential(Credential credential, String credentialSecret) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Map<String, String> credKeys = credential.getKeys();
Set<String> keySet = credKeys.keySet();
for (String key : keySet) {
String credKey = credKeys.get(key);
if (credKey != null) {
credKeys.put(key, encryptString(credKey, credentialSecret));
}
}
String token = credential.getToken();
if (token != null) {
credential.setToken(encryptString(token, credentialSecret));
}
return credential;
}
public static Credential dencryptCredential(Credential credential, String credentialSecret) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
Map<String, String> credKeys = credential.getKeys();
Set<String> keySet = credKeys.keySet();
for (String key : keySet) {
String credKey = credKeys.get(key);
if (credKey != null) {
credKeys.put(key, decryptString(credKey, credentialSecret));
}
}
String token = credential.getToken();
if (token != null) {
credential.setToken(decryptString(token, credentialSecret));
}
return credential;
}
}
......@@ -24,33 +24,30 @@ 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.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.model.Exceptions.TypeExeption;
import nl.uva.sne.drip.model.NodeTemplate;
import nl.uva.sne.drip.model.NodeTemplateMap;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology.StatusEnum;
import nl.uva.sne.drip.model.cloud.storm.OpCode;
import nl.uva.sne.drip.model.tosca.Credential;
import nl.uva.sne.drip.model.tosca.ToscaTemplate;
import nl.uva.sne.drip.sure.tosca.client.DefaultApi;
import org.apache.commons.io.FileUtils;
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.DefaultApi;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static nl.uva.sne.drip.commons.utils.Constants.*;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology.StatusEnum;
import nl.uva.sne.drip.model.cloud.storm.OpCode;
/**
*
* @author S. Koulouzis
*/
public class ToscaHelper {
......@@ -79,6 +76,58 @@ public class ToscaHelper {
return true;
}
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 static OpCode.OperationEnum NodeDesiredState2CloudStormOperation(NODE_STATES nodeDesiredState) {
switch (nodeDesiredState) {
case RUNNING:
return OpCode.OperationEnum.PROVISION;
case DELETED:
return OpCode.OperationEnum.DELETE;
case STARTED:
return OpCode.OperationEnum.START;
case STOPPED:
return OpCode.OperationEnum.STOP;
case H_SCALED:
return OpCode.OperationEnum.HSCALE;
case V_SCALED:
return OpCode.OperationEnum.VSCALE;
default:
return null;
}
}
public static StatusEnum nodeCurrentState2CloudStormStatus(NODE_STATES currentState) {
if (currentState == null) {
return StatusEnum.FRESH;
}
switch (currentState) {
case RUNNING:
return StatusEnum.RUNNING;
case DELETED:
return StatusEnum.DELETED;
case STARTED:
return StatusEnum.RUNNING;
case STOPPED:
return StatusEnum.STOPPED;
case H_SCALED:
return StatusEnum.RUNNING;
case V_SCALED:
return StatusEnum.RUNNING;
case FAILED:
return StatusEnum.FAILED;
default:
return null;
}
}
/**
* @return the id
*/
......@@ -97,7 +146,7 @@ public class ToscaHelper {
}
public void uploadToscaTemplate(ToscaTemplate toscaTemplate) throws JsonProcessingException, IOException, ApiException {
public void uploadToscaTemplate(ToscaTemplate toscaTemplate) throws IOException, ApiException {
String ymlStr = objectMapper.writeValueAsString(toscaTemplate);
File toscaTemplateFile = File.createTempFile("temp-toscaTemplate", ".yml");
FileUtils.writeByteArrayToFile(toscaTemplateFile, ymlStr.getBytes());
......@@ -334,14 +383,6 @@ public class ToscaHelper {
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();
......@@ -364,50 +405,6 @@ public class ToscaHelper {
return null;
}
public static OpCode.OperationEnum NodeDesiredState2CloudStormOperation(NODE_STATES nodeDesiredState) {
switch (nodeDesiredState) {
case RUNNING:
return OpCode.OperationEnum.PROVISION;
case DELETED:
return OpCode.OperationEnum.DELETE;
case STARTED:
return OpCode.OperationEnum.START;
case STOPPED:
return OpCode.OperationEnum.STOP;
case H_SCALED:
return OpCode.OperationEnum.HSCALE;
case V_SCALED:
return OpCode.OperationEnum.VSCALE;
default:
return null;
}
}
public static StatusEnum nodeCurrentState2CloudStormStatus(NODE_STATES currentState) {
if (currentState == null) {
return StatusEnum.FRESH;
}
switch (currentState) {
case RUNNING:
return StatusEnum.RUNNING;
case DELETED:
return StatusEnum.DELETED;
case STARTED:
return StatusEnum.RUNNING;
case STOPPED:
return StatusEnum.STOPPED;
case H_SCALED:
return StatusEnum.RUNNING;
case V_SCALED:
return StatusEnum.RUNNING;
case FAILED:
return StatusEnum.FAILED;
default:
return null;
}
}
public Map<String, Object> getNodeArtifacts(NodeTemplate nodeTemplate) {
return nodeTemplate.getArtifacts();
}
......
......@@ -16,10 +16,9 @@
package nl.uva.sne.drip.model.Exceptions;
/**
*
* @author S. Koulouzis
*/
public class MissingCredentialsException extends Exception{
public class MissingCredentialsException extends Exception {
public MissingCredentialsException(String string) {
super(string);
......
......@@ -16,7 +16,6 @@
package nl.uva.sne.drip.model.Exceptions;
/**
*
* @author S. Koulouzis
*/
public class MissingVMTopologyException extends Exception {
......
......@@ -16,10 +16,9 @@
package nl.uva.sne.drip.model.Exceptions;
/**
*
* @author S. Koulouzis
*/
public class TypeExeption extends Exception{
public class TypeExeption extends Exception {
public TypeExeption(String string) {
super(string);
......
......@@ -16,22 +16,27 @@
package nl.uva.sne.drip.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import nl.uva.sne.drip.model.tosca.ToscaTemplate;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.List;
import nl.uva.sne.drip.model.tosca.ToscaTemplate;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
*
*
*
* @author S. Koulouzis.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Message implements Serializable {
@NotNull
private String owner;
@NotNull
private Long creationDate;
// private List<MessageParameter> parameters;
private ToscaTemplate toscaTemplate;
private Exception exception;
/**
* @return the exception
*/
......@@ -46,17 +51,6 @@ public class Message implements Serializable {
this.exception = exception;
}
@NotNull
private String owner;
@NotNull
private Long creationDate;
// private List<MessageParameter> parameters;
private ToscaTemplate toscaTemplate;
private Exception exception;
public Long getCreationDate() {
return this.creationDate;
}
......
......@@ -16,27 +16,26 @@
package nl.uva.sne.drip.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.Map;
/**
*
* @author S. Koulouzis.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MessageParameter implements Serializable {
private String url;
private String encoding;
private String value;
private String name;
private Map<String, String> attributes;
public static final String NAME = "name";
public static final String URL = "url";
public static final String VALUE = "value";
public static final String ENCODING = "encoding";
public static final String TOSCA_TEMPLATE = "tosca_template";
private String url;
private String encoding;
private String value;
private String name;
private Map<String, String> attributes;
public String getURL() {
return this.url;
......@@ -54,14 +53,14 @@ public class MessageParameter implements Serializable {
this.encoding = encoding;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return this.value;
}
......
package nl.uva.sne.drip.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.*;
/**
* NodeTemplate
......@@ -68,7 +62,6 @@ public class NodeTemplate {
* Get derivedFrom
*
* @return derivedFrom
*
*/
@ApiModelProperty(value = "")
......@@ -97,7 +90,6 @@ public class NodeTemplate {
* Get properties
*
* @return properties
*
*/
@ApiModelProperty(value = "")
......@@ -126,7 +118,6 @@ public class NodeTemplate {
* Get requirements
*
* @return requirements
*
*/
@ApiModelProperty(value = "")
......@@ -157,7 +148,6 @@ public class NodeTemplate {
* Get interfaces
*
* @return interfaces
*
*/
@ApiModelProperty(value = "")
......@@ -186,7 +176,6 @@ public class NodeTemplate {
* Get capabilities
*
* @return capabilities
*
*/
@ApiModelProperty(value = "")
......@@ -207,7 +196,6 @@ public class NodeTemplate {
* Get type
*
* @return type
*
*/
@ApiModelProperty(value = "")
......@@ -228,7 +216,6 @@ public class NodeTemplate {
* Get description
*
* @return description
*
*/
@ApiModelProperty(value = "")
......@@ -257,7 +244,6 @@ public class NodeTemplate {
* Get directives
*
* @return directives
*
*/
@ApiModelProperty(value = "")
......@@ -286,7 +272,6 @@ public class NodeTemplate {
* Get attributes
*
* @return attributes
*
*/
@ApiModelProperty(value = "")
......@@ -315,7 +300,6 @@ public class NodeTemplate {
* Get artifacts
*
* @return artifacts
*
*/
@ApiModelProperty(value = "")
......
......@@ -11,10 +11,11 @@
*/
package nl.uva.sne.drip.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
/**
* NodeTemplateMap
*/
......@@ -36,7 +37,6 @@ public class NodeTemplateMap {
* Get name
*
* @return name
*
*/
@ApiModelProperty(value = "")
public String getName() {
......@@ -56,7 +56,6 @@ public class NodeTemplateMap {
* Get nodeTemplate
*
* @return nodeTemplate
*
*/
@ApiModelProperty(value = "")
public NodeTemplate getNodeTemplate() {
......
package nl.uva.sne.drip.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* Provisioner
*/
......@@ -34,7 +35,6 @@ public class Provisioner {
* Get name
*
* @return name
*
*/
@ApiModelProperty(value = "")
......@@ -55,7 +55,6 @@ public class Provisioner {
* Get version
*
* @return version
*
*/
@ApiModelProperty(value = "")
......@@ -76,7 +75,6 @@ public class Provisioner {
* Get description
*
* @return description
*
*/
@ApiModelProperty(value = "")
......@@ -97,7 +95,6 @@ public class Provisioner {
* Get toscaInterfaceType
*
* @return toscaInterfaceType
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import org.springframework.data.annotation.Id;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* User
......@@ -46,7 +47,6 @@ public class User {
* Get id
*
* @return id
*
*/
@ApiModelProperty(value = "")
......@@ -67,7 +67,6 @@ public class User {
* Get username
*
* @return username
*
*/
@ApiModelProperty(value = "")
......@@ -88,7 +87,6 @@ public class User {
* Get firstName
*
* @return firstName
*
*/
@ApiModelProperty(value = "")
......@@ -109,7 +107,6 @@ public class User {
* Get lastName
*
* @return lastName
*
*/
@ApiModelProperty(value = "")
......@@ -130,7 +127,6 @@ public class User {
* Get email
*
* @return email
*
*/
@ApiModelProperty(value = "")
......@@ -151,7 +147,6 @@ public class User {
* Get password
*
* @return password
*
*/
@ApiModelProperty(value = "")
......@@ -172,7 +167,6 @@ public class User {
* User Status
*
* @return userStatus
*
*/
@ApiModelProperty(value = "User Status")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* CloudCred
*/
......@@ -28,7 +29,6 @@ public class CloudCred {
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty(value = "")
......@@ -49,7 +49,6 @@ public class CloudCred {
* Get credInfoFile
*
* @return credInfoFile
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* CloudCredentialDB
......@@ -37,7 +38,6 @@ public class CloudCredentialDB {
* Get cloudCreds
*
* @return cloudCreds
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* CloudDB
*/
......@@ -15,40 +16,8 @@ import org.springframework.validation.annotation.Validated;
public class CloudDB {
/**
* Gets or Sets cloudProvider
*/
public enum CloudProviderEnum {
EC2("EC2"),
EXOGENI("ExoGENI"),
EGI("EGI");
private String value;
CloudProviderEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static CloudProviderEnum fromValue(String text) {
for (CloudProviderEnum b : CloudProviderEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("cloudProvider")
private CloudProviderEnum cloudProvider = null;
@JsonProperty("dbInfoFile")
private String dbInfoFile = null;
......@@ -61,7 +30,6 @@ public class CloudDB {
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty(value = "")
......@@ -82,7 +50,6 @@ public class CloudDB {
* Get dbInfoFile
*
* @return dbInfoFile
*
*/
@ApiModelProperty(value = "")
......@@ -133,4 +100,35 @@ public class CloudDB {
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets cloudProvider
*/
public enum CloudProviderEnum {
EC2("EC2"),
EXOGENI("ExoGENI"),
EGI("EGI");
private String value;
CloudProviderEnum(String value) {
this.value = value;
}
@JsonCreator
public static CloudProviderEnum fromValue(String text) {
for (CloudProviderEnum b : CloudProviderEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.*;
/**
* CloudStormDCMetaInfo
......@@ -53,7 +50,6 @@ public class CloudStormDCMetaInfo {
* Get domain
*
* @return domain
*
*/
@ApiModelProperty(value = "")
......@@ -74,7 +70,6 @@ public class CloudStormDCMetaInfo {
* Get endpoint
*
* @return endpoint
*
*/
@ApiModelProperty(value = "")
......@@ -95,7 +90,6 @@ public class CloudStormDCMetaInfo {
* Get country
*
* @return country
*
*/
@ApiModelProperty(value = "")
......@@ -116,7 +110,6 @@ public class CloudStormDCMetaInfo {
* Get longitude
*
* @return longitude
*
*/
@ApiModelProperty(value = "")
......@@ -137,7 +130,6 @@ public class CloudStormDCMetaInfo {
* Get latitude
*
* @return latitude
*
*/
@ApiModelProperty(value = "")
......@@ -158,7 +150,6 @@ public class CloudStormDCMetaInfo {
* Get availability
*
* @return availability
*
*/
@ApiModelProperty(value = "")
......@@ -187,7 +178,6 @@ public class CloudStormDCMetaInfo {
* Get vmMetaInfo
*
* @return vmMetaInfo
*
*/
@ApiModelProperty(value = "")
......@@ -218,7 +208,6 @@ public class CloudStormDCMetaInfo {
* Get extraInfo
*
* @return extraInfo
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* CloudsStormInfrasCode
......@@ -18,39 +19,8 @@ import javax.validation.Valid;
public class CloudsStormInfrasCode {
/**
* Gets or Sets mode
*/
public enum ModeEnum {
LOCAL("LOCAL"),
CTRL("CTRL");
private String value;
ModeEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ModeEnum fromValue(String text) {
for (ModeEnum b : ModeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("Mode")
private ModeEnum mode = null;
@JsonProperty("InfrasCodes")
@Valid
private List<InfrasCode> infrasCodes = null;
......@@ -64,7 +34,6 @@ public class CloudsStormInfrasCode {
* Get mode
*
* @return mode
*
*/
@ApiModelProperty(value = "")
......@@ -93,7 +62,6 @@ public class CloudsStormInfrasCode {
* Get infrasCodes
*
* @return infrasCodes
*
*/
@ApiModelProperty(value = "")
......@@ -146,4 +114,34 @@ public class CloudsStormInfrasCode {
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets mode
*/
public enum ModeEnum {
LOCAL("LOCAL"),
CTRL("CTRL");
private String value;
ModeEnum(String value) {
this.value = value;
}
@JsonCreator
public static ModeEnum fromValue(String text) {
for (ModeEnum b : ModeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Objects;
/**
* CloudsStormSubMembers
......@@ -30,6 +27,7 @@ public class CloudsStormSubMembers {
/**
* Get vmName
*
* @return vmName
**/
@ApiModelProperty(value = "")
......@@ -50,6 +48,7 @@ public class CloudsStormSubMembers {
/**
* Get address
*
* @return address
**/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* CloudsStormSubTopology
......@@ -26,53 +27,15 @@ public class CloudsStormSubTopology {
@JsonProperty("domain")
private String domain = null;
/**
* Gets or Sets status
*/
public enum StatusEnum {
FRESH("fresh"),
RUNNING("running"),
DELETED("deleted"),
FAILED("failed"),
STOPPED("stopped");
private String value;
StatusEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static StatusEnum fromValue(String text) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("status")
private StatusEnum status = null;
@JsonProperty("logsInfo")
@Valid
private Map<String, Object> logsInfo = null;
@JsonProperty("subTopologyClass")
private String subTopologyClass = null;
@JsonProperty("sshKeyPairId")
private String sshKeyPairId = null;
@JsonProperty("scaledFrom")
@Valid
private Map<String, Object> scaledFrom = null;
......@@ -81,11 +44,11 @@ public class CloudsStormSubTopology {
this.topology = topology;
return this;
}
/**
* Get topology
*
* @return topology
*
*/
@ApiModelProperty(value = "")
......@@ -106,7 +69,6 @@ public class CloudsStormSubTopology {
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty(value = "")
......@@ -127,7 +89,6 @@ public class CloudsStormSubTopology {
* Get domain
*
* @return domain
*
*/
@ApiModelProperty(value = "")
......@@ -148,7 +109,6 @@ public class CloudsStormSubTopology {
* Get status
*
* @return status
*
*/
@ApiModelProperty(value = "")
......@@ -177,7 +137,6 @@ public class CloudsStormSubTopology {
* Get logsInfo
*
* @return logsInfo
*
*/
@ApiModelProperty(value = "")
......@@ -198,7 +157,6 @@ public class CloudsStormSubTopology {
* Get subTopologyClass
*
* @return subTopologyClass
*
*/
@ApiModelProperty(value = "")
......@@ -219,7 +177,6 @@ public class CloudsStormSubTopology {
* Get sshKeyPairId
*
* @return sshKeyPairId
*
*/
@ApiModelProperty(value = "")
......@@ -248,7 +205,6 @@ public class CloudsStormSubTopology {
* Get scaledFrom
*
* @return scaledFrom
*
*/
@ApiModelProperty(value = "")
......@@ -311,4 +267,37 @@ public class CloudsStormSubTopology {
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets status
*/
public enum StatusEnum {
FRESH("fresh"),
RUNNING("running"),
DELETED("deleted"),
FAILED("failed"),
STOPPED("stopped");
private String value;
StatusEnum(String value) {
this.value = value;
}
@JsonCreator
public static StatusEnum fromValue(String text) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* CloudsStormSubnets
......@@ -36,6 +37,7 @@ public class CloudsStormSubnets {
/**
* Get name
*
* @return name
**/
@ApiModelProperty(value = "")
......@@ -56,6 +58,7 @@ public class CloudsStormSubnets {
/**
* Get subnet
*
* @return subnet
**/
@ApiModelProperty(value = "")
......@@ -76,6 +79,7 @@ public class CloudsStormSubnets {
/**
* Get netmask
*
* @return netmask
**/
@ApiModelProperty(value = "")
......@@ -104,6 +108,7 @@ public class CloudsStormSubnets {
/**
* Get members
*
* @return members
**/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubnets;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.Objects;
/**
* CloudsStormTopTopology
......@@ -23,37 +19,34 @@ import javax.validation.constraints.*;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CloudsStormTopTopology {
/**
* @return the connections
*/
public Map<String, Object> getConnections() {
return connections;
}
/**
* @param connections the connections to set
*/
public void setConnections(Map<String, Object> connections) {
this.connections = connections;
}
@JsonProperty("userName")
private String userName = null;
@JsonProperty("publicKeyPath")
private String publicKeyPath = null;
@JsonProperty("topologies")
@Valid
private List<CloudsStormSubTopology> topologies = null;
@JsonProperty("subnets")
@Valid
private List<CloudsStormSubnets> subnets = null;
@JsonProperty("connections")
@Valid
private Map<String, Object> connections = null;
/**
* @return the connections
*/
public Map<String, Object> getConnections() {
return connections;
}
/**
* @param connections the connections to set
*/
public void setConnections(Map<String, Object> connections) {
this.connections = connections;
}
public CloudsStormTopTopology userName(String userName) {
this.userName = userName;
return this;
......@@ -63,7 +56,6 @@ public class CloudsStormTopTopology {
* Get userName
*
* @return userName
*
*/
@ApiModelProperty(value = "")
......@@ -84,7 +76,6 @@ public class CloudsStormTopTopology {
* Get publicKeyPath
*
* @return publicKeyPath
*
*/
@ApiModelProperty(value = "")
......@@ -113,7 +104,6 @@ public class CloudsStormTopTopology {
* Get topologies
*
* @return topologies
*
*/
@ApiModelProperty(value = "")
......@@ -144,7 +134,6 @@ public class CloudsStormTopTopology {
* Get subnets
*
* @return subnets
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import com.fasterxml.jackson.annotation.JsonAlias;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* CloudsStormVM
......@@ -17,6 +18,73 @@ import javax.validation.Valid;
public class CloudsStormVM {
@JsonProperty("name")
private String name = null;
@JsonProperty("nodeType")
@JsonAlias({"type"})
private String nodeType = null;
@JsonProperty("VEngineClass")
private String VEngineClass = null;
@JsonProperty("OStype")
@JsonAlias({"os", "OS"})
private String ostype = null;
@JsonProperty("script")
private String script = null;
@JsonProperty("publicAddress")
private String publicAddress = null;
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
@JsonProperty("CPU")
@JsonAlias({"cpu"})
private String CPU = null;
@JsonProperty("MEM")
@JsonAlias({"Mem"})
private String MEM = null;
@JsonProperty("VMType")
@JsonAlias({"type"})
private String vmType = null;
@JsonProperty("Price")
private String price = null;
@JsonProperty("DefaultSSHAccount")
@JsonAlias({"defaultSSHAccount"})
private String defaultSSHAccount = null;
@JsonProperty("availability")
private String availability = null;
@JsonProperty("selfEthAddresses")
private String selfEthAddresses = null;
@JsonProperty("VEngineClass")
private String vEngineClass = null;
@JsonProperty("VNFType")
private String vNFType = null;
@JsonProperty("scaledFrom")
private String scaledFrom = null;
@JsonProperty("fake")
private String fake = null;
@JsonProperty("OS_URL")
private String OS_URL = null;
@JsonProperty("OS_GUID")
private String OS_GUID = null;
@JsonProperty("diskSize")
@JsonAlias({"DiskSize"})
private Integer diskSize;
@JsonProperty("IOPS")
private Integer iOPS;
@JsonProperty("vpcId")
private String vpcId;
@JsonProperty("subnetId")
private String subnetId;
@JsonProperty("securityGroupId")
private String securityGroupId;
@JsonProperty("instanceId")
private String instanceId;
@JsonProperty("volumeId")
private Object volumeId;
@JsonProperty("routeTableId")
private String routeTableId;
@JsonProperty("internetGatewayId")
private String internetGatewayId;
/**
* @return the iOPS
*/
......@@ -255,77 +323,6 @@ public class CloudsStormVM {
this.selfEthAddresses = selfEthAddresses;
}
@JsonProperty("name")
private String name = null;
@JsonProperty("nodeType")
@JsonAlias({"type"})
private String nodeType = null;
@JsonProperty("VEngineClass")
private String VEngineClass = null;
@JsonProperty("OStype")
@JsonAlias({"os", "OS"})
private String ostype = null;
@JsonProperty("script")
private String script = null;
@JsonProperty("publicAddress")
private String publicAddress = null;
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
@JsonProperty("CPU")
@JsonAlias({"cpu"})
private String CPU = null;
@JsonProperty("MEM")
@JsonAlias({"Mem"})
private String MEM = null;
@JsonProperty("VMType")
@JsonAlias({"type"})
private String vmType = null;
@JsonProperty("Price")
private String price = null;
@JsonProperty("DefaultSSHAccount")
@JsonAlias({"defaultSSHAccount"})
private String defaultSSHAccount = null;
@JsonProperty("availability")
private String availability = null;
@JsonProperty("selfEthAddresses")
private String selfEthAddresses = null;
@JsonProperty("VEngineClass")
private String vEngineClass = null;
@JsonProperty("VNFType")
private String vNFType = null;
@JsonProperty("scaledFrom")
private String scaledFrom = null;
@JsonProperty("fake")
private String fake = null;
@JsonProperty("OS_URL")
private String OS_URL = null;
@JsonProperty("OS_GUID")
private String OS_GUID = null;
@JsonProperty("diskSize")
@JsonAlias({"DiskSize"})
private Integer diskSize;
public CloudsStormVM name(String name) {
this.name = name;
return this;
......@@ -335,7 +332,6 @@ public class CloudsStormVM {
* Get name
*
* @return name
*
*/
@ApiModelProperty(value = "")
......@@ -356,7 +352,6 @@ public class CloudsStormVM {
* Get nodeType
*
* @return nodeType
*
*/
@ApiModelProperty(value = "")
......@@ -377,7 +372,6 @@ public class CloudsStormVM {
* Get ostype
*
* @return ostype
*
*/
@ApiModelProperty(value = "")
......@@ -398,7 +392,6 @@ public class CloudsStormVM {
* Get script
*
* @return script
*
*/
@ApiModelProperty(value = "")
......@@ -419,7 +412,6 @@ public class CloudsStormVM {
* Get publicAddress
*
* @return publicAddress
*
*/
@ApiModelProperty(value = "")
......@@ -431,7 +423,7 @@ public class CloudsStormVM {
this.publicAddress = publicAddress;
}
// public CloudsStormVM type(String type) {
// public CloudsStormVM type(String type) {
// this.type = type;
// return this;
// }
......@@ -468,7 +460,6 @@ public class CloudsStormVM {
* Get extraInfo
*
* @return extraInfo
*
*/
@ApiModelProperty(value = "")
......@@ -480,7 +471,7 @@ public class CloudsStormVM {
this.extraInfo = extraInfo;
}
// public CloudsStormVM OS(String OS) {
// public CloudsStormVM OS(String OS) {
// this.OS = OS;
// return this;
// }
......@@ -509,7 +500,6 @@ public class CloudsStormVM {
* Get CPU
*
* @return CPU
*
*/
@ApiModelProperty(value = "")
......@@ -530,7 +520,6 @@ public class CloudsStormVM {
* Get MEM
*
* @return MEM
*
*/
@ApiModelProperty(value = "")
......@@ -551,7 +540,6 @@ public class CloudsStormVM {
* Get vmType
*
* @return vmType
*
*/
@ApiModelProperty(value = "")
......@@ -572,7 +560,6 @@ public class CloudsStormVM {
* Get price
*
* @return price
*
*/
@ApiModelProperty(value = "")
......@@ -593,7 +580,6 @@ public class CloudsStormVM {
* Get defaultSSHAccount
*
* @return defaultSSHAccount
*
*/
@ApiModelProperty(value = "")
......@@ -614,7 +600,6 @@ public class CloudsStormVM {
* Get availability
*
* @return availability
*
*/
@ApiModelProperty(value = "")
......@@ -690,21 +675,4 @@ public class CloudsStormVM {
return o.toString().replace("\n", "\n ");
}
@JsonProperty("IOPS")
private Integer iOPS;
@JsonProperty("vpcId")
private String vpcId;
@JsonProperty("subnetId")
private String subnetId;
@JsonProperty("securityGroupId")
private String securityGroupId;
@JsonProperty("instanceId")
private String instanceId;
@JsonProperty("volumeId")
private Object volumeId;
@JsonProperty("routeTableId")
private String routeTableId;
@JsonProperty("internetGatewayId")
private String internetGatewayId;
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.Objects;
/**
* CloudsStormVMs
......@@ -17,6 +18,25 @@ import javax.validation.Valid;
public class CloudsStormVMs {
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
@JsonProperty("VMs")
@Valid
private List<CloudsStormVM> vms = null;
@JsonProperty("WhetherCreateVPC")
@Valid
private Boolean whetherCreateVPC;
@JsonProperty("SEngineClass")
@Valid
private String sEngineClass = null;
@JsonProperty("sliceName")
@Valid
private String sliceName = null;
@JsonProperty("duration")
@Valid
private Float duration = null;
/**
* @return the whetherCreateVPC
*/
......@@ -80,10 +100,6 @@ public class CloudsStormVMs {
return sEngineClass;
}
@JsonProperty("extraInfo")
@Valid
private Map<String, Object> extraInfo = null;
/**
* @param sEngineClass the sEngineClass to set
*/
......@@ -91,26 +107,6 @@ public class CloudsStormVMs {
this.sEngineClass = sEngineClass;
}
@JsonProperty("VMs")
@Valid
private List<CloudsStormVM> vms = null;
@JsonProperty("WhetherCreateVPC")
@Valid
private Boolean whetherCreateVPC;
@JsonProperty("SEngineClass")
@Valid
private String sEngineClass = null;
@JsonProperty("sliceName")
@Valid
private String sliceName = null;
@JsonProperty("duration")
@Valid
private Float duration = null;
public CloudsStormVMs vms(List<CloudsStormVM> vms) {
this.vms = vms;
return this;
......@@ -128,7 +124,6 @@ public class CloudsStormVMs {
* Get vms
*
* @return vms
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Credential
......@@ -44,7 +45,6 @@ public class Credential {
* The optional protocol name. e.g. http,xauth,oauth2,ssh
*
* @return protocol
*
*/
@ApiModelProperty(value = "The optional protocol name. e.g. http,xauth,oauth2,ssh")
......@@ -66,7 +66,6 @@ public class Credential {
* bearer, identifier
*
* @return tokenType
*
*/
@ApiModelProperty(value = "The required token type. default: password. e.g. basic_auth,X-Auth-Token, bearer, identifier")
......@@ -89,7 +88,6 @@ public class Credential {
* 604bbe45ac7143a79e14f3158df67091, keypair_id
*
* @return token
*
*/
@ApiModelProperty(value = "The required token used as a credential for authorization or access to a networked resource. e.g. mypassword, myusername:mypassword, 604bbe45ac7143a79e14f3158df67091, keypair_id")
......@@ -118,7 +116,6 @@ public class Credential {
* The optional list of protocol-specific keys or assertions.
*
* @return keys
*
*/
@ApiModelProperty(value = "The optional list of protocol-specific keys or assertions.")
......@@ -139,7 +136,6 @@ public class Credential {
* The optional user (name or ID) used for non-token based credentials.
*
* @return user
*
*/
@ApiModelProperty(value = "The optional user (name or ID) used for non-token based credentials.")
......@@ -160,7 +156,6 @@ public class Credential {
* The cloud provider name e.g. ec2.
*
* @return cloudProviderName
*
*/
@ApiModelProperty(value = "The cloud provider name e.g. ec2.")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* CredentialInfo
*/
......@@ -43,7 +44,6 @@ public class CredentialInfo {
* Get userKeyName
*
* @return userKeyName
*
*/
@ApiModelProperty(value = "")
......@@ -64,7 +64,6 @@ public class CredentialInfo {
* Get keyAlias
*
* @return keyAlias
*
*/
@ApiModelProperty(value = "")
......@@ -85,7 +84,6 @@ public class CredentialInfo {
* Get keyPassword
*
* @return keyPassword
*
*/
@ApiModelProperty(value = "")
......@@ -106,7 +104,6 @@ public class CredentialInfo {
* Get proxyFileName
*
* @return proxyFileName
*
*/
@ApiModelProperty(value = "")
......@@ -127,7 +124,6 @@ public class CredentialInfo {
* Get trustedCertDirName
*
* @return trustedCertDirName
*
*/
@ApiModelProperty(value = "")
......@@ -148,7 +144,6 @@ public class CredentialInfo {
* Get accessKey
*
* @return accessKey
*
*/
@ApiModelProperty(value = "")
......@@ -169,7 +164,6 @@ public class CredentialInfo {
* Get secretKey
*
* @return secretKey
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* DB
......@@ -38,7 +39,6 @@ public class DB {
* Get cloudDBs
*
* @return cloudDBs
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* DBInfo
......@@ -32,7 +33,6 @@ public class DBInfo {
* Get globalEntry
*
* @return globalEntry
*
*/
@ApiModelProperty(value = "")
......@@ -61,7 +61,6 @@ public class DBInfo {
* Get dcMetaInfo
*
* @return dcMetaInfo
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.Objects;
/**
* InfrasCode
......@@ -18,59 +17,26 @@ import javax.validation.Valid;
public class InfrasCode {
/**
* Gets or Sets codeType
*/
public enum CodeTypeEnum {
SEQ("SEQ"),
LOOP("LOOP");
private String value;
CodeTypeEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static CodeTypeEnum fromValue(String text) {
for (CodeTypeEnum b : CodeTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("CodeType")
private CodeTypeEnum codeType = null;
@JsonProperty("OpCode")
private OpCode opCode = null;
@JsonProperty("Count")
private Integer count = null;
// @JsonProperty("OpCodes")
// @Valid
// private List<OpCode> opCodes = null;
public InfrasCode codeType(CodeTypeEnum codeType) {
this.codeType = codeType;
return this;
}
// @JsonProperty("OpCodes")
// @Valid
// private List<OpCode> opCodes = null;
/**
* Get codeType
*
* @return codeType
*
*/
@ApiModelProperty(value = "")
......@@ -91,7 +57,6 @@ public class InfrasCode {
* Get opCode
*
* @return opCode
*
*/
@ApiModelProperty(value = "")
......@@ -114,7 +79,6 @@ public class InfrasCode {
* Get count
*
* @return count
*
*/
@ApiModelProperty(value = "")
......@@ -126,6 +90,21 @@ public class InfrasCode {
this.count = count;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InfrasCode infrasCode = (InfrasCode) o;
return Objects.equals(this.codeType, infrasCode.codeType)
&& Objects.equals(this.opCode, infrasCode.opCode)
&& Objects.equals(this.count, infrasCode.count);
// && Objects.equals(this.opCodes, infrasCode.opCodes);
}
// public InfrasCode opCodes(List<OpCode> opCodes) {
// this.opCodes = opCodes;
// return this;
......@@ -157,21 +136,6 @@ public class InfrasCode {
// this.opCodes = opCodes;
// }
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
InfrasCode infrasCode = (InfrasCode) o;
return Objects.equals(this.codeType, infrasCode.codeType)
&& Objects.equals(this.opCode, infrasCode.opCode)
&& Objects.equals(this.count, infrasCode.count);
// && Objects.equals(this.opCodes, infrasCode.opCodes);
}
@Override
public int hashCode() {
return Objects.hash(codeType, opCode, count); //, opCodes);
......@@ -200,4 +164,34 @@ public class InfrasCode {
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets codeType
*/
public enum CodeTypeEnum {
SEQ("SEQ"),
LOOP("LOOP");
private String value;
CodeTypeEnum(String value) {
this.value = value;
}
@JsonCreator
public static CodeTypeEnum fromValue(String text) {
for (CodeTypeEnum b : CodeTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import java.util.Objects;
/**
* OpCode
......@@ -16,90 +17,16 @@ import javax.validation.Valid;
public class OpCode {
/**
* Gets or Sets operation
*/
public enum OperationEnum {
PROVISION("provision"),
DELETE("delete"),
EXECUTE("execute"),
PUT("put"),
GET("get"),
VSCALE("vscale"),
HSCALE("hscale"),
RECOVER("recover"),
START("start"),
STOP("stop");
private String value;
OperationEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OperationEnum fromValue(String text) {
for (OperationEnum b : OperationEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("Operation")
private OperationEnum operation = null;
/**
* Gets or Sets objectType
*/
public enum ObjectTypeEnum {
SUBTOPOLOGY("SubTopology"),
VM("VM"),
REQ("REQ");
private String value;
ObjectTypeEnum(String value) {
this.value = value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static ObjectTypeEnum fromValue(String text) {
for (ObjectTypeEnum b : ObjectTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}
@JsonProperty("ObjectType")
private ObjectTypeEnum objectType = null;
@JsonProperty("Objects")
private String objects = null;
@JsonProperty("Command")
private String command = null;
@JsonProperty("Log")
private Boolean log = null;
@JsonProperty("Options")
private Options options = null;
......@@ -112,7 +39,6 @@ public class OpCode {
* Get operation
*
* @return operation
*
*/
@ApiModelProperty(value = "")
......@@ -133,7 +59,6 @@ public class OpCode {
* Get objectType
*
* @return objectType
*
*/
@ApiModelProperty(value = "")
......@@ -154,7 +79,6 @@ public class OpCode {
* Get objects
*
* @return objects
*
*/
@ApiModelProperty(value = "")
......@@ -175,7 +99,6 @@ public class OpCode {
* Get command
*
* @return command
*
*/
@ApiModelProperty(value = "")
......@@ -196,7 +119,6 @@ public class OpCode {
* Get log
*
* @return log
*
*/
@ApiModelProperty(value = "")
......@@ -217,7 +139,6 @@ public class OpCode {
* Get options
*
* @return options
*
*/
@ApiModelProperty(value = "")
......@@ -278,4 +199,73 @@ public class OpCode {
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets operation
*/
public enum OperationEnum {
PROVISION("provision"),
DELETE("delete"),
EXECUTE("execute"),
PUT("put"),
GET("get"),
VSCALE("vscale"),
HSCALE("hscale"),
RECOVER("recover"),
START("start"),
STOP("stop");
private String value;
OperationEnum(String value) {
this.value = value;
}
@JsonCreator
public static OperationEnum fromValue(String text) {
for (OperationEnum b : OperationEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
/**
* Gets or Sets objectType
*/
public enum ObjectTypeEnum {
SUBTOPOLOGY("SubTopology"),
VM("VM"),
REQ("REQ");
private String value;
ObjectTypeEnum(String value) {
this.value = value;
}
@JsonCreator
public static ObjectTypeEnum fromValue(String text) {
for (ObjectTypeEnum b : ObjectTypeEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
}
}
package nl.uva.sne.drip.model.cloud.storm;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
/**
* Options
*/
......@@ -28,7 +29,6 @@ public class Options {
* Get src
*
* @return src
*
*/
@ApiModelProperty(value = "")
......@@ -49,7 +49,6 @@ public class Options {
* Get dst
*
* @return dst
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.tosca;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.Map;
import org.springframework.data.annotation.Id;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import org.springframework.data.annotation.Id;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Credential
......@@ -16,44 +17,37 @@ import org.springframework.data.annotation.Id;
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2019-12-10T15:39:04.296Z")
public class Credential {
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
@Id
@JsonIgnore
private String id;
@JsonProperty("protocol")
private String protocol = null;
@JsonProperty("token_type")
private String tokenType = null;
@JsonProperty("token")
private String token = null;
@JsonProperty("keys")
@Valid
private Map<String, String> keys = null;
@JsonProperty("user")
private String user = null;
@JsonProperty("cloud_provider_name")
private String cloudProviderName = null;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
public Credential protocol(String protocol) {
this.protocol = protocol;
return this;
......@@ -63,7 +57,6 @@ public class Credential {
* Get protocol
*
* @return protocol
*
*/
@ApiModelProperty(value = "")
......@@ -84,7 +77,6 @@ public class Credential {
* Get tokenType
*
* @return tokenType
*
*/
@ApiModelProperty(value = "")
......@@ -105,7 +97,6 @@ public class Credential {
* Get token
*
* @return token
*
*/
@ApiModelProperty(value = "")
......@@ -134,7 +125,6 @@ public class Credential {
* Get keys
*
* @return keys
*
*/
@ApiModelProperty(value = "")
......@@ -155,7 +145,6 @@ public class Credential {
* Get user
*
* @return user
*
*/
@ApiModelProperty(value = "")
......@@ -176,7 +165,6 @@ public class Credential {
* Get cloudProviderName
*
* @return cloudProviderName
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.tosca;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import nl.uva.sne.drip.model.NodeTemplate;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import nl.uva.sne.drip.model.NodeTemplate;
import java.util.*;
/**
* TopologyTemplate
......@@ -59,7 +56,6 @@ public class TopologyTemplate {
* Get description
*
* @return description
*
*/
@ApiModelProperty(value = "")
......@@ -88,7 +84,6 @@ public class TopologyTemplate {
* Get inputs
*
* @return inputs
*
*/
@ApiModelProperty(value = "")
......@@ -117,7 +112,6 @@ public class TopologyTemplate {
* Get nodeTemplates
*
* @return nodeTemplates
*
*/
@ApiModelProperty(value = "")
......@@ -148,7 +142,6 @@ public class TopologyTemplate {
* Get relationshipTemplates
*
* @return relationshipTemplates
*
*/
@ApiModelProperty(value = "")
......@@ -177,7 +170,6 @@ public class TopologyTemplate {
* Get outputs
*
* @return outputs
*
*/
@ApiModelProperty(value = "")
......@@ -206,7 +198,6 @@ public class TopologyTemplate {
* Get groups
*
* @return groups
*
*/
@ApiModelProperty(value = "")
......@@ -235,7 +226,6 @@ public class TopologyTemplate {
* Get substitutionMappings
*
* @return substitutionMappings
*
*/
@ApiModelProperty(value = "")
......@@ -264,7 +254,6 @@ public class TopologyTemplate {
* Get policies
*
* @return policies
*
*/
@ApiModelProperty(value = "")
......
package nl.uva.sne.drip.model.tosca;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.data.annotation.Id;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import org.springframework.data.annotation.Id;
import java.util.*;
/**
* ToscaTemplate
......@@ -20,90 +17,71 @@ import org.springframework.data.annotation.Id;
public class ToscaTemplate {
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
@Id
@JsonIgnore
private String id;
@JsonProperty("tosca_definitions_version")
private String toscaDefinitionsVersion = null;
@JsonProperty("tosca_default_namespace")
private String toscaDefaultNamespace = null;
@JsonProperty("template_name")
private String templateName = null;
@JsonProperty("topology_template")
private TopologyTemplate topologyTemplate = null;
@JsonProperty("template_author")
private String templateAuthor = null;
@JsonProperty("template_version")
private String templateVersion = null;
@JsonProperty("description")
private String description = null;
@JsonProperty("imports")
@Valid
private List<Map<String, Object>> imports = null;
@JsonProperty("dsl_definitions")
@Valid
private Map<String, Object> dslDefinitions = null;
@JsonProperty("node_types")
@Valid
private Map<String, Object> nodeTypes = null;
@JsonProperty("relationship_types")
@Valid
private Map<String, Object> relationshipTypes = null;
@JsonProperty("relationship_templates")
@Valid
private Map<String, Object> relationshipTemplates = null;
@JsonProperty("capability_types")
@Valid
private Map<String, Object> capabilityTypes = null;
@JsonProperty("artifact_types")
@Valid
private Map<String, Object> artifactTypes = null;
@JsonProperty("data_types")
@Valid
private Map<String, Object> dataTypes = null;
@JsonProperty("interface_types")
@Valid
private Map<String, Object> interfaceTypes = null;
@JsonProperty("policy_types")
@Valid
private Map<String, Object> policyTypes = null;
@JsonProperty("group_types")
@Valid
private Map<String, Object> groupTypes = null;
@JsonProperty("repositories")
@Valid
private Map<String, Object> repositories = null;
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
public ToscaTemplate toscaDefinitionsVersion(String toscaDefinitionsVersion) {
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
return this;
......@@ -113,7 +91,6 @@ public class ToscaTemplate {
* Get toscaDefinitionsVersion
*
* @return toscaDefinitionsVersion
*
*/
@ApiModelProperty(value = "")
......@@ -134,7 +111,6 @@ public class ToscaTemplate {
* Get toscaDefaultNamespace
*
* @return toscaDefaultNamespace
*
*/
@ApiModelProperty(value = "")
......@@ -155,7 +131,6 @@ public class ToscaTemplate {
* Get templateName
*
* @return templateName
*
*/
@ApiModelProperty(value = "")
......@@ -176,7 +151,6 @@ public class ToscaTemplate {
* Get topologyTemplate
*
* @return topologyTemplate
*
*/
@ApiModelProperty(value = "")
......@@ -199,7 +173,6 @@ public class ToscaTemplate {
* Get templateAuthor
*
* @return templateAuthor
*
*/
@ApiModelProperty(value = "")
......@@ -220,7 +193,6 @@ public class ToscaTemplate {
* Get templateVersion
*
* @return templateVersion
*
*/
@ApiModelProperty(value = "")
......@@ -241,7 +213,6 @@ public class ToscaTemplate {
* Get description
*
* @return description
*
*/
@ApiModelProperty(value = "")
......@@ -270,7 +241,6 @@ public class ToscaTemplate {
* Get imports
*
* @return imports
*
*/
@ApiModelProperty(value = "")
......@@ -301,7 +271,6 @@ public class ToscaTemplate {
* Get dslDefinitions
*
* @return dslDefinitions
*
*/
@ApiModelProperty(value = "")
......@@ -330,7 +299,6 @@ public class ToscaTemplate {
* Get nodeTypes
*
* @return nodeTypes
*
*/
@ApiModelProperty(value = "")
......@@ -359,7 +327,6 @@ public class ToscaTemplate {
* Get relationshipTypes
*
* @return relationshipTypes
*
*/
@ApiModelProperty(value = "")
......@@ -388,7 +355,6 @@ public class ToscaTemplate {
* Get relationshipTemplates
*
* @return relationshipTemplates
*
*/
@ApiModelProperty(value = "")
......@@ -417,7 +383,6 @@ public class ToscaTemplate {
* Get capabilityTypes
*
* @return capabilityTypes
*
*/
@ApiModelProperty(value = "")
......@@ -446,7 +411,6 @@ public class ToscaTemplate {
* Get artifactTypes
*
* @return artifactTypes
*
*/
@ApiModelProperty(value = "")
......@@ -475,7 +439,6 @@ public class ToscaTemplate {
* Get dataTypes
*
* @return dataTypes
*
*/
@ApiModelProperty(value = "")
......@@ -504,7 +467,6 @@ public class ToscaTemplate {
* Get interfaceTypes
*
* @return interfaceTypes
*
*/
@ApiModelProperty(value = "")
......@@ -533,7 +495,6 @@ public class ToscaTemplate {
* Get policyTypes
*
* @return policyTypes
*
*/
@ApiModelProperty(value = "")
......@@ -562,7 +523,6 @@ public class ToscaTemplate {
* Get groupTypes
*
* @return groupTypes
*
*/
@ApiModelProperty(value = "")
......@@ -591,7 +551,6 @@ public class ToscaTemplate {
* Get repositories
*
* @return repositories
*
*/
@ApiModelProperty(value = "")
......
......@@ -14,10 +14,10 @@
package nl.uva.sne.drip.sure.tosca.auth;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
import java.util.List;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-20T15:53:11.510Z")
public class ApiKeyAuth implements Authentication {
......
......@@ -14,10 +14,10 @@
package nl.uva.sne.drip.sure.tosca.auth;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
import java.util.List;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
public interface Authentication {
/**
......
......@@ -14,14 +14,11 @@
package nl.uva.sne.drip.sure.tosca.auth;
import com.squareup.okhttp.Credentials;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
import java.util.List;
import java.io.UnsupportedEncodingException;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
public class HttpBasicAuth implements Authentication {
private String username;
......
......@@ -14,10 +14,10 @@
package nl.uva.sne.drip.sure.tosca.auth;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
import java.util.List;
import nl.uva.sne.drip.sure.tosca.client.Pair;
import java.util.Map;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-20T15:53:11.510Z")
public class OAuth implements Authentication {
......
......@@ -12,8 +12,8 @@
package nl.uva.sne.drip.sure.tosca.client;
import java.util.Map;
import java.util.List;
import java.util.Map;
/**
* Callback for asynchronous API call.
......
......@@ -15,6 +15,10 @@ import com.squareup.okhttp.*;
import com.squareup.okhttp.internal.http.HttpMethod;
import com.squareup.okhttp.logging.HttpLoggingInterceptor;
import com.squareup.okhttp.logging.HttpLoggingInterceptor.Level;
import nl.uva.sne.drip.sure.tosca.auth.ApiKeyAuth;
import nl.uva.sne.drip.sure.tosca.auth.Authentication;
import nl.uva.sne.drip.sure.tosca.auth.HttpBasicAuth;
import nl.uva.sne.drip.sure.tosca.auth.OAuth;
import okio.BufferedSink;
import okio.Okio;
import org.threeten.bp.LocalDate;
......@@ -42,16 +46,12 @@ import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import nl.uva.sne.drip.sure.tosca.auth.ApiKeyAuth;
import nl.uva.sne.drip.sure.tosca.auth.Authentication;
import nl.uva.sne.drip.sure.tosca.auth.HttpBasicAuth;
import nl.uva.sne.drip.sure.tosca.auth.OAuth;
public class ApiClient {
private String basePath = "https://127.0.0.1/tosca-sure/1.0.0";
private String basePath = "https://localhost/tosca-sure/1.0.0";
private boolean debugging = false;
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private final Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String tempFolderPath = null;
private Map<String, Authentication> authentications;
......@@ -395,9 +395,8 @@ public class ApiClient {
* endpoints with file response. The default value is <code>null</code>,
* i.e. using the system's default tempopary folder.
*
* @see
* <a href="https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile">createTempFile</a>
* @return Temporary folder path
* @see <a href="https://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile">createTempFile</a>
*/
public String getTempFolderPath() {
return tempFolderPath;
......@@ -497,7 +496,7 @@ public class ApiClient {
if (b.length() > 0) {
b.append(",");
}
b.append(String.valueOf(o));
b.append(o);
}
return b.toString();
} else {
......@@ -508,7 +507,7 @@ public class ApiClient {
/**
* Formats the specified query parameter to a list containing a single
* {@code Pair} object.
*
* <p>
* Note that {@code value} must not be a collection.
*
* @param name The name of the parameter.
......@@ -530,7 +529,7 @@ public class ApiClient {
/**
* Formats the specified collection query parameters to a list of
* {@code Pair} objects.
*
* <p>
* Note that the values of each of the returned Pair objects are
* percent-encoded.
*
......@@ -754,9 +753,9 @@ public class ApiClient {
* Download file from the given response.
*
* @param response An instance of the Response object
* @return Downloaded file
* @throws ApiException If fail to read file content from response and write
* to disk
* @return Downloaded file
*/
public File downloadFileFromResponse(Response response) throws ApiException {
try {
......@@ -774,8 +773,8 @@ public class ApiClient {
* Prepare file for download
*
* @param response An instance of the Response object
* @throws IOException If fail to prepare file for download
* @return Prepared file for the download
* @throws IOException If fail to prepare file for download
*/
public File prepareDownloadFile(Response response) throws IOException {
String filename = null;
......@@ -820,8 +819,8 @@ public class ApiClient {
*
* @param <T> Type
* @param call An instance of the Call object
* @throws ApiException If fail to execute the call
* @return ApiResponse&lt;T&gt;
* @throws ApiException If fail to execute the call
*/
public <T> ApiResponse<T> execute(Call call) throws ApiException {
return execute(call, null);
......@@ -863,11 +862,11 @@ public class ApiClient {
/**
* Execute HTTP call asynchronously.
*
* @see #execute(Call, Type)
* @param <T> Type
* @param call The callback to be executed when the API call finishes
* @param returnType Return type
* @param callback ApiCallback
* @see #execute(Call, Type)
*/
@SuppressWarnings("unchecked")
public <T> void executeAsync(Call call, final Type returnType, final ApiCallback<T> callback) {
......@@ -881,7 +880,7 @@ public class ApiClient {
public void onResponse(Response response) throws IOException {
T result;
try {
result = (T) handleResponse(response, returnType);
result = handleResponse(response, returnType);
} catch (ApiException e) {
callback.onFailure(e, response.code(), response.headers().toMultimap());
return;
......@@ -898,9 +897,9 @@ public class ApiClient {
* @param <T> Type
* @param response Response
* @param returnType Return type
* @return Type
* @throws ApiException If the response has a unsuccessful status code or
* fail to deserialize the response body
* @return Type
*/
public <T> T handleResponse(Response response, Type returnType) throws ApiException {
if (response.isSuccessful()) {
......@@ -976,7 +975,7 @@ public class ApiClient {
final Request.Builder reqBuilder = new Request.Builder().url(url);
processHeaderParams(headerParams, reqBuilder);
String contentType = (String) headerParams.get("Content-Type");
String contentType = headerParams.get("Content-Type");
// ensuring a default content type
if (contentType == null) {
contentType = "application/json";
......@@ -1191,7 +1190,7 @@ public class ApiClient {
KeyStore caKeyStore = newEmptyKeyStore(password);
int index = 0;
for (Certificate certificate : certificates) {
String certificateAlias = "ca" + Integer.toString(index++);
String certificateAlias = "ca" + index++;
caKeyStore.setCertificateEntry(certificateAlias, certificate);
}
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
......
......@@ -11,8 +11,8 @@
*/
package nl.uva.sne.drip.sure.tosca.client;
import java.util.Map;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class ApiException extends Exception {
......
......@@ -23,11 +23,12 @@ import java.io.IOException;
/**
* Encodes request bodies using gzip.
*
* <p>
* Taken from https://github.com/square/okhttp/issues/350
*/
class GzipRequestInterceptor implements Interceptor {
@Override public Response intercept(Chain chain) throws IOException {
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
return chain.proceed(originalRequest);
......@@ -63,15 +64,18 @@ class GzipRequestInterceptor implements Interceptor {
private RequestBody gzip(final RequestBody body) {
return new RequestBody() {
@Override public MediaType contentType() {
@Override
public MediaType contentType() {
return body.contentType();
}
@Override public long contentLength() {
@Override
public long contentLength() {
return -1; // We don't know the compressed length in advance!
}
@Override public void writeTo(BufferedSink sink) throws IOException {
@Override
public void writeTo(BufferedSink sink) throws IOException {
BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
body.writeTo(gzipSink);
gzipSink.close();
......
......@@ -13,21 +13,16 @@
package nl.uva.sne.drip.sure.tosca.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.*;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.JsonElement;
import io.gsonfire.GsonFireBuilder;
import okio.ByteString;
import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.format.DateTimeFormatter;
import okio.ByteString;
import java.io.IOException;
import java.io.StringReader;
import java.lang.reflect.Type;
......@@ -40,22 +35,30 @@ import java.util.Map;
public class JSON {
private Gson gson;
private boolean isLenientOnJson = false;
private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
private final DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
private final SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
private final OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter();
private final LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter();
public JSON() {
ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
gson = createGson()
.registerTypeAdapter(Date.class, dateTypeAdapter)
.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
.registerTypeAdapter(LocalDate.class, localDateTypeAdapter)
.registerTypeAdapter(byte[].class, byteArrayAdapter)
.create();
}
public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder()
;
GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder;
GsonFireBuilder fireBuilder = new GsonFireBuilder();
return fireBuilder.createGsonBuilder();
}
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
if(null == element) {
if (null == element) {
throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
}
return element.getAsString();
......@@ -63,22 +66,12 @@ public class JSON {
private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase());
if(null == clazz) {
if (null == clazz) {
throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
}
return clazz;
}
public JSON() {
gson = createGson()
.registerTypeAdapter(Date.class, dateTypeAdapter)
.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
.registerTypeAdapter(LocalDate.class, localDateTypeAdapter)
.registerTypeAdapter(byte[].class, byteArrayAdapter)
.create();
}
/**
* Get Gson.
*
......@@ -142,32 +135,24 @@ public class JSON {
}
}
/**
* Gson TypeAdapter for Byte Array type
*/
public class ByteArrayAdapter extends TypeAdapter<byte[]> {
@Override
public void write(JsonWriter out, byte[] value) throws IOException {
if (value == null) {
out.nullValue();
} else {
out.value(ByteString.of(value).base64());
}
public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
offsetDateTimeTypeAdapter.setFormat(dateFormat);
return this;
}
@Override
public byte[] read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String bytesAsBase64 = in.nextString();
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
return byteString.toByteArray();
public JSON setLocalDateFormat(DateTimeFormatter dateFormat) {
localDateTypeAdapter.setFormat(dateFormat);
return this;
}
public JSON setDateFormat(DateFormat dateFormat) {
dateTypeAdapter.setFormat(dateFormat);
return this;
}
public JSON setSqlDateFormat(DateFormat dateFormat) {
sqlDateTypeAdapter.setFormat(dateFormat);
return this;
}
/**
......@@ -207,64 +192,13 @@ public class JSON {
default:
String date = in.nextString();
if (date.endsWith("+0000")) {
date = date.substring(0, date.length()-5) + "Z";
date = date.substring(0, date.length() - 5) + "Z";
}
return OffsetDateTime.parse(date, formatter);
}
}
}
/**
* Gson TypeAdapter for JSR310 LocalDate type
*/
public class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
private DateTimeFormatter formatter;
public LocalDateTypeAdapter() {
this(DateTimeFormatter.ISO_LOCAL_DATE);
}
public LocalDateTypeAdapter(DateTimeFormatter formatter) {
this.formatter = formatter;
}
public void setFormat(DateTimeFormatter dateFormat) {
this.formatter = dateFormat;
}
@Override
public void write(JsonWriter out, LocalDate date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.format(date));
}
}
@Override
public LocalDate read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
return LocalDate.parse(date, formatter);
}
}
}
public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) {
offsetDateTimeTypeAdapter.setFormat(dateFormat);
return this;
}
public JSON setLocalDateFormat(DateTimeFormatter dateFormat) {
localDateTypeAdapter.setFormat(dateFormat);
return this;
}
/**
* Gson TypeAdapter for java.sql.Date type
* If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
......@@ -378,14 +312,73 @@ public class JSON {
}
}
public JSON setDateFormat(DateFormat dateFormat) {
dateTypeAdapter.setFormat(dateFormat);
return this;
/**
* Gson TypeAdapter for Byte Array type
*/
public class ByteArrayAdapter extends TypeAdapter<byte[]> {
@Override
public void write(JsonWriter out, byte[] value) throws IOException {
if (value == null) {
out.nullValue();
} else {
out.value(ByteString.of(value).base64());
}
}
public JSON setSqlDateFormat(DateFormat dateFormat) {
sqlDateTypeAdapter.setFormat(dateFormat);
return this;
@Override
public byte[] read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String bytesAsBase64 = in.nextString();
ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
return byteString.toByteArray();
}
}
}
/**
* Gson TypeAdapter for JSR310 LocalDate type
*/
public class LocalDateTypeAdapter extends TypeAdapter<LocalDate> {
private DateTimeFormatter formatter;
public LocalDateTypeAdapter() {
this(DateTimeFormatter.ISO_LOCAL_DATE);
}
public LocalDateTypeAdapter(DateTimeFormatter formatter) {
this.formatter = formatter;
}
public void setFormat(DateTimeFormatter dateFormat) {
this.formatter = dateFormat;
}
@Override
public void write(JsonWriter out, LocalDate date) throws IOException {
if (date == null) {
out.nullValue();
} else {
out.value(formatter.format(date));
}
}
@Override
public LocalDate read(JsonReader in) throws IOException {
switch (in.peek()) {
case NULL:
in.nextNull();
return null;
default:
String date = in.nextString();
return LocalDate.parse(date, formatter);
}
}
}
}
......@@ -18,31 +18,31 @@ public class Pair {
private String name = "";
private String value = "";
public Pair (String name, String value) {
public Pair(String name, String value) {
setName(name);
setValue(value);
}
public String getName() {
return this.name;
}
private void setName(String name) {
if (!isValidString(name)) return;
this.name = name;
}
public String getValue() {
return this.value;
}
private void setValue(String value) {
if (!isValidString(value)) return;
this.value = value;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
......
......@@ -15,23 +15,13 @@ package nl.uva.sne.drip.sure.tosca.client;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.RequestBody;
import okio.*;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSink;
import okio.ForwardingSink;
import okio.Okio;
import okio.Sink;
public class ProgressRequestBody extends RequestBody {
public interface ProgressRequestListener {
void onRequestProgress(long bytesWritten, long contentLength, boolean done);
}
private final RequestBody requestBody;
private final ProgressRequestListener progressListener;
public ProgressRequestBody(RequestBody requestBody, ProgressRequestListener progressListener) {
......@@ -74,4 +64,8 @@ public class ProgressRequestBody extends RequestBody {
}
};
}
public interface ProgressRequestListener {
void onRequestProgress(long bytesWritten, long contentLength, boolean done);
}
}
......@@ -15,25 +15,15 @@ package nl.uva.sne.drip.sure.tosca.client;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.ResponseBody;
import okio.*;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
public class ProgressResponseBody extends ResponseBody {
public interface ProgressListener {
void update(long bytesRead, long contentLength, boolean done);
}
private final ResponseBody responseBody;
private final ProgressListener progressListener;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
this.responseBody = responseBody;
this.progressListener = progressListener;
......@@ -71,6 +61,10 @@ public class ProgressResponseBody extends ResponseBody {
}
};
}
public interface ProgressListener {
void update(long bytesRead, long contentLength, boolean done);
}
}
......@@ -28,7 +28,4 @@ RUN pip3 install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
CMD sed -i "s#http://127.0.0.1:8081/tosca-sure/1.0.0#$SURE_TOSCA_BASE_PATH#g" properties.ini && \
sed -i "s#http://127.0.0.1:3000/api#$SEMAPHORE_BASE_PATH#g" properties.ini && \
sed -i "s#host = 127.0.0.1#host = $RABBITMQ_HOST#g" properties.ini && \
python3 __main__.py $RABBITMQ_HOST deployer
CMD python3 __main__.py $RABBITMQ_HOST deployer
......@@ -8,15 +8,13 @@ import os
import sys
import tempfile
import time
import traceback
from threading import Thread
from time import sleep
import pika
import yaml
from service.deploy_service import DeployService
from service.tosca_helper import ToscaHelper
import pika
import sure_tosca_client
import yaml
logger = logging.getLogger(__name__)
......@@ -84,20 +82,12 @@ def handle_delivery(message):
tosca_helper = ToscaHelper(sure_tosca_base_url, tosca_template_path)
# nodes_to_deploy = tosca_helper.get_application_nodes()
nodes = tosca_helper.get_deployment_node_pipeline()
nodes_pairs = tosca_helper.get_deployment_node_pairs()
deployService = DeployService(semaphore_base_url=semaphore_base_url, semaphore_username=semaphore_username,
semaphore_password=semaphore_password, vms=tosca_helper.get_vms())
try:
for node in nodes:
updated_node = deployService.deploy(node)
if isinstance(updated_node, list):
for node in updated_node:
tosca_template_dict = tosca_helper.set_node(node,tosca_template_dict)
# logger.info("tosca_template_dict :" + json.dumps(tosca_template_dict))
else:
tosca_template_dict = tosca_helper.set_node(updated_node, tosca_template_dict)
# logger.info("tosca_template_dict :" + json.dumps(tosca_template_dict))
semaphore_password=semaphore_password)
for node_pair in nodes_pairs:
deployService.deploy(node_pair)
response = {'toscaTemplate': tosca_template_dict}
output_current_milli_time = int(round(time.time() * 1000))
......@@ -105,16 +95,12 @@ def handle_delivery(message):
logger.info("Returning Deployment")
logger.info("Output message:" + json.dumps(response))
return json.dumps(response)
except Exception as e:
track = traceback.format_exc()
print(track)
raise
def threaded_function(args):
while not done:
connection.process_data_events()
sleep(8)
sleep(5)
if __name__ == "__main__":
......
[tosca-sure]
base_url = http://127.0.0.1:8081/tosca-sure/1.0.0
base_url = http://localhost:8081/tosca-sure/1.0.0
[semaphore]
username = admin
password = password
base_url = http://127.0.0.1:3000/api
base_url = http://localhost:3000/api
[message_broker]
host = 127.0.0.1
host = localhost
queue_name = deployer
\ No newline at end of file
pika==1.1.0
names==0.3.0
networkx==2.4
# requests==2.23.0
requests==2.23.0
wheel==0.34.2
pyyaml==5.3.1
matplotlib==3.3.0
ansible==2.9.11
# certifi==2020.4.5.1
matplotlib==3.2.1
# ansible==2.9.6
certifi==2020.4.5.1
six==1.14.0
python_dateutil==2.8.1
# setuptools==46.1.3
# urllib3==1.25.8
setuptools==46.1.3
urllib3==1.25.8
kubernetes==11.0.0
\ No newline at end of file
sure_tosca_client==1.0.0
\ No newline at end of file
This diff is collapsed.
import json
import logging
from service import tosca_helper
from service import tosca_helper, ansible_service
from service.ansible_service import AnsibleService
logger = logging.getLogger(__name__)
if not getattr(logger, 'handler_set', None):
logger.setLevel(logging.INFO)
h = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
h.setFormatter(formatter)
logger.addHandler(h)
logger.handler_set = True
class DeployService:
def __init__(self, polemarch_base_url=None,polemarch_username=None,polemarch_password=None,
semaphore_base_url=None,semaphore_username=None,semaphore_password=None, vms=None):
semaphore_base_url=None,semaphore_username=None,semaphore_password=None):
# self.polemarch_base_url = polemarch_base_url
# self.polemarch_username=polemarch_username
# self.polemarch_password = polemarch_password
self.semaphore_base_url = semaphore_base_url
self.semaphore_username = semaphore_username
self.semaphore_password = semaphore_password
self.vms = vms
for vm in vms:
if vm.node_template.attributes['role'] == 'master':
self.master_ip = vm.node_template.attributes['public_ip']
break
def deploy(self, application):
# target = nodes_pair[0]
# source = nodes_pair[1]
interface_types = tosca_helper.get_interface_types(application)
def deploy(self,nodes_pair):
target = nodes_pair[0]
source = nodes_pair[1]
interface_types = tosca_helper.get_interface_types(source)
if interface_types:
ansible_service = AnsibleService(self.semaphore_base_url, self.semaphore_username, self.semaphore_password)
env_vars = self.get_env_vars(application)
if 'Standard' in interface_types:
task_outputs = ansible_service.execute(application, 'Standard', self.vms, env_vars=env_vars)
application = self.set_attributes(task_outputs, application)
if 'Kubernetes' in interface_types:
task_outputs = ansible_service.execute(application, 'Kubernetes', self.vms, env_vars=env_vars)
application = self.set_attributes(task_outputs, application)
return application
def get_env_vars(self, source):
# target = nodes_pair[0]
# source = nodes_pair[1]
env_vars = {'K8s_NAMESPACE': 'default'}
if source.node_template.type == 'tosca.nodes.QC.Container.Application.Docker':
env_vars['DOCKER_IMAGE'] = source.node_template.artifacts['image']['file']
env_vars['DOCKER_SERVICE_NAME'] = source.name
env_vars['CONTAINER_PORT'] = '80'
if 'ports' in source.node_template.properties:
env_vars['CONTAINER_PORT'] = source.node_template.properties['ports'][0].split(':')[1]
if 'environment' in source.node_template.properties:
env_vars['DOCKER_ENV_VARIABLES'] = source.node_template.properties['environment']
return env_vars
def set_attributes(self, task_outputs,source):
# target = nodes_pair[0]
# source = nodes_pair[1]
if source.node_template.type == 'tosca.nodes.QC.docker.Orchestrator.Kubernetes':
source = self.set_kubernetes_attributes(source=source,task_outputs=task_outputs)
if source.node_template.type == 'tosca.nodes.QC.Container.Application.Docker':
source = self.set_docker_attributes(source=source, task_outputs=task_outputs)
if source.node_template.type == 'tosca.nodes.QC.Application.TIC':
source = self.set_tic_attributes(source=source, task_outputs=task_outputs)
# lst = list(nodes_pair)
# lst[1] = source
# nodes_pair = tuple(lst)
return source
def parse_ansible_var(self,var_name, output_array):
index = 0
start_index = -1
end_index = -1
for out in output_array:
index += 1
if 'TASK' in out.output or 'PLAY RECAP' in out.output:
if start_index > -1:
end_index = index - 1
break
if start_index <=-1 and '"' + var_name + '":' in out.output:
start_index = index - 1
if start_index <= -1:
return None
ansible_var = output_array[start_index:end_index]
json_ansible_var = '{'
for item in ansible_var:
json_ansible_var = json_ansible_var + item.output
logger.info('found '+var_name +': '+ str(json_ansible_var))
return json.loads(json_ansible_var)
def get_dashboard_token(self, k8s_dashboard_token):
k8s_dashboard_token = k8s_dashboard_token['k8s_dashboard_token']
# if 'resources' in k8s_secrets:
# return self.get_secret_from_k8s_info(k8s_secrets)
if 'stdout' in k8s_dashboard_token:
return self.get_secret_from_stdout(k8s_dashboard_token)
def get_service_port(self, k8s_services, service_name,port_type):
resources = k8s_services['k8s_services']['resources']
for resource in resources:
name = resource['metadata']['name']
if name == service_name:
ports = resource['spec']['ports']
for port in ports:
if port_type in port:
return port[port_type]
return None
def get_secret_from_k8s_info(self, k8s_secrets):
resources = k8s_secrets['resources']
for resource in resources:
metadata = resource['metadata']
if 'admin-user-token' in metadata['name']:
dashboard_token = resource['data']['token']
logger.info('found dashboard_token: ' + str(dashboard_token))
return resource['data']['token']
return None
def get_secret_from_stdout(self, k8s_dashboard_token):
return k8s_dashboard_token['stdout'].replace('token: ', '')
def set_kubernetes_attributes(self, source=None,task_outputs=None):
attributes = source.node_template.attributes
if 'tokens' not in attributes:
tokens = []
attributes['tokens'] = tokens
ansible_service = AnsibleService(self.semaphore_base_url,self.semaphore_username,self.semaphore_password)
ansible_service.execute(nodes_pair)
else:
tokens = attributes['tokens']
print(interface_types)
if 'dashboard_url' not in source.node_template.attributes:
dashboard_url = ''
attributes['dashboard_url'] = dashboard_url
else:
dashboard_url = attributes['dashboard_url']
k8s_dashboard_token = None
k8s_services = None
for task_output_key in task_outputs:
task_output = task_outputs[task_output_key]
if not k8s_dashboard_token:
k8s_dashboard_token = self.parse_ansible_var('k8s_dashboard_token', task_output)
if not k8s_services:
k8s_services = self.parse_ansible_var('k8s_services', task_output)
if k8s_services and k8s_dashboard_token:
credential = {'token_type': 'k8s_dashboard_token'}
credential['token'] = self.get_dashboard_token(k8s_dashboard_token)
tokens.append(credential)
service_port = self.get_service_port(k8s_services, 'kubernetes-dashboard', 'nodePort')
dashboard_url = 'https://' + self.master_ip + ':' + str(service_port)
attributes['dashboard_url'] = dashboard_url
logger.info('source.node_template.attributes: ' + str(attributes))
return source
raise Exception(
'Did not find k8s_services and/or k8s_dashboard_token')
return None
def set_docker_attributes(self, source, task_outputs):
attributes = source.node_template.attributes
if 'service_url' not in source.node_template.attributes:
service_url = ''
attributes['service_url'] = service_url
for task_output_key in task_outputs:
task_output = task_outputs[task_output_key]
k8s_services = self.parse_ansible_var('k8s_services', task_output)
service_port = self.get_service_port(k8s_services, source.name, 'nodePort')
if service_port:
service_url = 'http://' + self.master_ip + ':' + str(service_port)
attributes['service_url'] = service_url
logger.info('source.node_template.attributes: ' + str(attributes))
return source
def set_tic_attributes(self, source, task_outputs):
attributes = source.node_template.attributes
if 'service_urls' not in source.node_template.attributes:
service_urls = []
attributes['service_urls'] = service_urls
for port in ['8090','9000','9090']:
service_urls.append('http://' + self.master_ip + ':' + str(port))
attributes['service_urls'] = service_urls
return source
import copy
import os
import sys
import urllib.request
from sure_tosca_client import Configuration, ApiClient, NodeTemplate
from sure_tosca_client import Configuration, ApiClient
from sure_tosca_client.api import default_api
import networkx as nx
import matplotlib.pyplot as plt
class ToscaHelper:
......@@ -31,6 +28,7 @@ class ToscaHelper:
return api
def get_interface_types(target):
print(target.node_template.interfaces)
interface_types = []
for interface in target.node_template.interfaces:
interface_types.append(interface)
......@@ -40,30 +38,22 @@ class ToscaHelper:
def get_application_nodes(self):
return self.tosca_client.get_node_templates(self.doc_id, type_name='tosca.nodes.QC.Application')
def get_deployment_node_pipeline(self):
def get_deployment_node_pairs(self):
nodes_to_deploy = self.get_application_nodes()
G = nx.DiGraph()
sorted_nodes = []
nodes_pairs = []
for node in nodes_to_deploy:
related_nodes = self.tosca_client.get_related_nodes(self.doc_id,node.name)
for related_node in related_nodes:
G.add_edge(node.name, related_node.name)
# # We need to deploy the docker orchestrator on the VMs not the topology.
# # But the topology is directly connected to the orchestrator not the VMs.
# # So we explicitly get the VMs
# # I don't like this solution but I can't think of something better.
# if related_node.node_template.type == 'tosca.nodes.QC.VM.topology':
# vms = self.get_vms()
# related_node = vms
# pair = (related_node, node)
# nodes_pairs.append(pair)
sorted_graph = sorted(G.in_degree, key=lambda x: x[1], reverse=True)
for node_tuple in sorted_graph:
node_name = node_tuple[0]
for node in nodes_to_deploy:
if node.name == node_name:
sorted_nodes.append(node)
return sorted_nodes
# We need to deploy the docker orchestrator on the VMs not the topology.
# But the topology is directly connected to the orchestrator not the VMs.
# So we explicitly get the VMs
# I don't like this solution but I can't think of something better.
if related_node.node_template.type == 'tosca.nodes.QC.VM.topology':
vms = self.tosca_client.get_node_templates(self.doc_id,type_name='tosca.nodes.QC.VM.Compute')
related_node = vms
pair = (related_node, node)
nodes_pairs.append(pair)
return nodes_pairs
@classmethod
def service_is_up(cls, url):
......@@ -80,16 +70,6 @@ class ToscaHelper:
return True
def get_vms(self):
return self.tosca_client.get_node_templates(self.doc_id, type_name='tosca.nodes.QC.VM.Compute')
def set_node(self, updated_node, tosca_template_dict):
node_templates = tosca_template_dict['topology_template']['node_templates']
for node_name in node_templates:
if node_name == updated_node.name:
node_templates[node_name] = updated_node.node_template.to_dict()
return tosca_template_dict
def get_interface_types(node):
interface_type_names = []
......
......@@ -38,8 +38,9 @@ class TestDeployer(unittest.TestCase):
yaml.dump(tosca_template_dict, outfile, default_flow_style=False)
sure_tosca_base_url = 'http://127.0.0.1:8081/tosca-sure/1.0.0'
semaphore_base_url = 'http://127.0.0.1:3000/api'
sure_tosca_base_url = 'http://localhost:8081/tosca-sure/1.0.0'
polemarch_base_url='http://localhost:30001/api/v2'
semaphore_base_url = 'http://localhost:3000/api'
tosca_service_is_up = ToscaHelper.service_is_up(sure_tosca_base_url)
semaphore_is_up = ToscaHelper.service_is_up(semaphore_base_url)
......@@ -48,13 +49,12 @@ class TestDeployer(unittest.TestCase):
self.assertIsNotNone(tosca_helper.doc_id)
nodes_to_deploy = tosca_helper.get_application_nodes()
self.assertIsNotNone(nodes_to_deploy)
nodes_pairs = tosca_helper.get_deployment_node_pipeline()
nodes_pairs = tosca_helper.get_deployment_node_pairs()
self.assertIsNotNone(nodes_pairs)
username = 'admin'
deployService = DeployService(polemarch_username=username,polemarch_password='admin',
semaphore_base_url=semaphore_base_url,semaphore_username=username,
semaphore_password='password')
deployService = DeployService(polemarch_base_url=polemarch_base_url,polemarch_username=username,polemarch_password='admin',
semaphore_base_url=semaphore_base_url,semaphore_username=username,semaphore_password='password')
for node_pair in nodes_pairs:
deployService.deploy(node_pair)
......
version: '3'
services:
#nginx:
#image: nginx
#volumes:
#- ./nginx.conf:/etc/nginx/nginx.conf
#- ./cert.pem:/etc/nginx/cert.pem
#- ./privkey.pem:/etc/nginx/privkey.pem
##- ./www:/data/www
#ports:
#- "80:80"
#- "443:443"
##networks:
##frontend:
##ipv4_address: 172.20.0.2
rabbit:
image: rabbitmq:3.8-management
ports:
- "5671-5672:5671-5672"
- "15672:15672"
- "4369:4369"
- "15671:15671"
#rabbit:
#image: rabbitmq:3.8-management
#ports:
#- "5671-5672:5671-5672"
#- "15672:15672"
#- "4369:4369"
#- "15671:15671"
##networks:
##frontend:
##ipv4_address: 172.20.0.3
mongo:
image: mongo:4
ports:
- "27017:27017"
mysql:
image: mysql:5.7 #works with 5.6 abd emaphore:2.4.1
image: mysql:5.6
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_DATABASE: semaphore
MYSQL_USER: semaphore
MYSQL_PASSWORD: semaphore
#ports:
#- "3306:3306"
#networks:
#frontend:
#ipv4_address: 172.20.0.4
ports:
- "3306:3306"
semaphore:
image: ss
image: qcdis/docker_ansible_semaphore
environment:
SEMAPHORE_DB_USER: semaphore
SEMAPHORE_DB_PASS: semaphore
......@@ -52,57 +37,13 @@ services:
SEMAPHORE_ADMIN_NAME: "Developer"
SEMAPHORE_ADMIN_EMAIL: admin@localhost
SEMAPHORE_ADMIN: admin
SEMAPHORE_WEB_ROOT: http://0.0.0.0:3000
SEMAPHORE_WEB_ROOT: http://0.0.0.0:3000/semaphore
ports:
- "3000:3000"
depends_on:
- mysql
#networks:
#frontend:
#ipv4_address: 172.20.0.5
#mongo:
#image: mongo:4
#ports:
#- "27017:27017"
##networks:
##frontend:
##ipv4_address: 172.20.0.6
#sure-tosca:
#image: qcdis/sure-tosca
#ports:
#- "8081:8081"
##networks:
##frontend:
##ipv4_address: 172.20.0.7
#compute:
#image: ubuntu:18.04
#volumes:
#- "./run.sh:/tmp/run.sh"
#command: "/tmp/run.sh"
##networks:
##frontend:
##ipv4_address: 172.20.0.8
##compute_1:
##image: ubuntu:18.04
##command: "apt update && apt install openssh-server && tail -f /dev/null"
##networks:
##frontend:
##ipv4_address: 172.20.0.9
##networks:
##frontend:
##ipam:
##config:
##- subnet: 172.20.0.0/24
sure-tosca:
image: qcdis/sure-tosca:3.0.0
ports:
- "8081:8081"
This diff is collapsed.
worker_processes auto;
events {
worker_connections 1024;
use epoll;
......@@ -8,17 +7,19 @@ events {
}
http {
proxy_connect_timeout 9200;
proxy_send_timeout 9200;
proxy_read_timeout 9200;
send_timeout 9200;
tcp_nodelay on;
# this is necessary for us to be able to disable request buffering in all cases
proxy_http_version 1.1;
# upstream semaphore {
# server semaphore:3000;
# }
# upstream manager {
# server manager:8080;
# }
server {
listen [::]:80 default_server;
server_name _;
......@@ -60,10 +61,16 @@ http {
proxy_request_buffering off;
}
# location /api/ws {
# proxy_pass http://semaphore:3000/api/ws;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# proxy_set_header Origin "";
# }
location /manager {
add_header 'Access-Control-Allow-Origin' *;
proxy_pass http://manager:8080/manager;
location /manger/ {
proxy_pass http://manager:8080/manger/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......@@ -74,8 +81,8 @@ http {
proxy_request_buffering off;
}
location /swagger-ui.html {
proxy_pass http://manager:8080/swagger-ui.html;
location /manger/swagger-ui.html {
proxy_pass http://manager:8080/swagger-ui.html/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......@@ -86,8 +93,8 @@ http {
proxy_request_buffering off;
}
location /tosca-sure/1.0.0 {
proxy_pass http://sure-tosca:8081/tosca-sure/1.0.0;
location /tosca-sure/1.0.0/ {
proxy_pass http://sure-tosca:8081/tosca-sure/1.0.0/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
......@@ -97,11 +104,5 @@ http {
proxy_buffering off;
proxy_request_buffering off;
}
location /mongo-express {
proxy_pass http://mongo-express:8082/mongo-express;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
}
}
}
This diff is collapsed.
......@@ -33,9 +33,7 @@ spec:
value: rabbit
- name: SURE_TOSCA_BASE_PATH
value: http://sure-tosca:8081/tosca-sure/1.0.0
- name: SEMAPHORE_BASE_PATH
value: http://semaphore:3000/api
image: qcdis/deployer
image: qcdis/deployer:3.0.0
name: deployer
imagePullPolicy: Always
resources: {}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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