Commit 959f4a83 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added cloud storm credentials

parent c10f0682
...@@ -58,9 +58,15 @@ ...@@ -58,9 +58,15 @@
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>nl.uva.sne.zh</groupId>
<artifactId>CloudsStorm</artifactId>
<version>1.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
...@@ -92,5 +98,13 @@ ...@@ -92,5 +98,13 @@
</build> </build>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>zh-releases</id>
<url>https://raw.githubusercontent.com/CloudsStorm/mvn-repo/master/releases</url>
</repository>
</repositories>
</project> </project>
\ No newline at end of file
...@@ -57,18 +57,37 @@ class CloudStormService { ...@@ -57,18 +57,37 @@ class CloudStormService {
} }
public ToscaTemplate execute() throws FileNotFoundException, JSchException, IOException, ApiException, Exception { public ToscaTemplate execute() throws FileNotFoundException, JSchException, IOException, ApiException, Exception {
String tempInputDirPath = System.getProperty("java.io.tmpdir") + File.separator + "Input-" + Long.toString(System.nanoTime()) + File.separator; String tempInputDirPath = System.getProperty("java.io.tmpdir") + File.separator + "Input-" + Long.toString(System.nanoTime()) + File.separator;
File tempInputDir = new File(tempInputDirPath); File tempInputDir = new File(tempInputDirPath);
if (!(tempInputDir.mkdirs())) { if (!(tempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath()); throw new FileNotFoundException("Could not create input directory: " + tempInputDir.getAbsolutePath());
} }
String topologyTempInputDirPath = File.separator + "topology";
File topologyTempInputDir = new File(topologyTempInputDirPath);
if (!(topologyTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
writeCloudStormTopologyFiles(toscaTemplate, topologyTempInputDirPath);
writeCloudStormTopology(toscaTemplate, tempInputDirPath); String credentialsTempInputDirPath = File.separator + "credentials";
File credentialsTempInputDir = new File(credentialsTempInputDirPath);
if (!(credentialsTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
writeCloudcredentialsTopologyFiles(toscaTemplate, credentialsTempInputDirPath);
String infrasCodeTempInputDirPath = File.separator + "infrasCodes";
File infrasCodeTempInputDir = new File(infrasCodeTempInputDirPath);
if (!(infrasCodeTempInputDir.mkdirs())) {
throw new FileNotFoundException("Could not create input directory: " + topologyTempInputDir.getAbsolutePath());
}
return toscaTemplate; return toscaTemplate;
} }
private void writeCloudStormTopology(ToscaTemplate toscaTemplate, String tempInputDirPath) throws JSchException, IOException, ApiException, Exception { private void writeCloudStormTopologyFiles(ToscaTemplate toscaTemplate, String tempInputDirPath) throws JSchException, IOException, ApiException, Exception {
CloudsStormTopTopology topTopology = new CloudsStormTopTopology(); CloudsStormTopTopology topTopology = new CloudsStormTopTopology();
String publicKeyPath = buildSSHKeyPair(tempInputDirPath); String publicKeyPath = buildSSHKeyPair(tempInputDirPath);
topTopology.setPublicKeyPath(publicKeyPath); topTopology.setPublicKeyPath(publicKeyPath);
...@@ -154,4 +173,8 @@ class CloudStormService { ...@@ -154,4 +173,8 @@ class CloudStormService {
return null; return null;
} }
private void writeCloudcredentialsTopologyFiles(ToscaTemplate toscaTemplate, String credentialsTempInputDirPath) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }
...@@ -90,6 +90,8 @@ public class Consumer extends DefaultConsumer { ...@@ -90,6 +90,8 @@ public class Consumer extends DefaultConsumer {
channel.basicAck(envelope.getDeliveryTag(), false); channel.basicAck(envelope.getDeliveryTag(), false);
} catch (JSchException | ApiException ex) { } catch (JSchException | ApiException ex) {
Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(Consumer.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
......
CloudCred:
type: "object"
properties:
cloudProvider:
type: "string"
credInfoFile:
type: "string"
cloudCreds:
type: "object"
properties:
CloudCred:
type: "array"
items:
$ref: "https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/CloudCred.yml#/CloudCred"
credInfo:
type: "object"
properties:
userKeyName:
type: "string"
keyAlias:
type: "string"
keyPassword:
type: "string"
proxyFileName:
type: "string"
trustedCertDirName:
type: "string"
accessKey:
type: "string"
secretKey:
type: "string"
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