Commit 2a59a2d7 authored by skoulouzis's avatar skoulouzis

update

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