Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
b611da67
Commit
b611da67
authored
Dec 13, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added NodeTemplateMap
parent
c95c94cc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
10 deletions
+55
-10
nodes.yaml
TOSCA/types/nodes.yaml
+1
-1
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+31
-2
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+2
-2
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+9
-5
NodeTemplateMap.yml
openAPI/schema/NodeTemplateMap.yml
+12
-0
No files found.
TOSCA/types/nodes.yaml
View file @
b611da67
...
@@ -153,7 +153,7 @@ node_types:
...
@@ -153,7 +153,7 @@ node_types:
os
:
os
:
type
:
string
type
:
string
required
:
true
required
:
true
default
:
"
Ubuntu
1
4
.04"
default
:
"
Ubuntu
1
8
.04"
# outputs for this node
# outputs for this node
attributes
:
attributes
:
private_ip
:
private_ip
:
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
b611da67
...
@@ -26,6 +26,7 @@ import java.util.ArrayList;
...
@@ -26,6 +26,7 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplate
;
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
;
...
@@ -179,6 +180,9 @@ public class ToscaHelper {
...
@@ -179,6 +180,9 @@ public class ToscaHelper {
public
NodeTemplate
setCredentialsInVMTopology
(
NodeTemplate
vmTopology
,
Credential
credential
)
throws
Exception
{
public
NodeTemplate
setCredentialsInVMTopology
(
NodeTemplate
vmTopology
,
Credential
credential
)
throws
Exception
{
if
(
vmTopology
.
getType
().
equals
(
VM_TOPOLOGY
))
{
if
(
vmTopology
.
getType
().
equals
(
VM_TOPOLOGY
))
{
Map
<
String
,
Object
>
att
=
vmTopology
.
getAttributes
();
Map
<
String
,
Object
>
att
=
vmTopology
.
getAttributes
();
if
(
att
==
null
)
{
att
=
new
HashMap
<>();
}
Map
<
String
,
Object
>
toscaCredential
=
new
HashMap
<>();
Map
<
String
,
Object
>
toscaCredential
=
new
HashMap
<>();
toscaCredential
.
put
(
"protocol"
,
credential
.
getProtocol
());
toscaCredential
.
put
(
"protocol"
,
credential
.
getProtocol
());
toscaCredential
.
put
(
"token_type"
,
credential
.
getTokenType
());
toscaCredential
.
put
(
"token_type"
,
credential
.
getTokenType
());
...
@@ -187,14 +191,39 @@ public class ToscaHelper {
...
@@ -187,14 +191,39 @@ public class ToscaHelper {
toscaCredential
.
put
(
"user"
,
credential
.
getUser
());
toscaCredential
.
put
(
"user"
,
credential
.
getUser
());
toscaCredential
.
put
(
"cloud_provider_name"
,
credential
.
getCloudProviderName
());
toscaCredential
.
put
(
"cloud_provider_name"
,
credential
.
getCloudProviderName
());
att
.
put
(
"credential"
,
toscaCredential
);
att
.
put
(
"credential"
,
toscaCredential
);
vmTopology
.
setAttributes
(
att
);
return
vmTopology
;
return
vmTopology
;
}
else
{
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
}
}
}
}
public
ToscaTemplate
setVMTopologyInToscaTemplate
(
NodeTemplate
vmTopology
)
{
public
Credential
getCredentialsFromVMTopology
(
NodeTemplate
vmTopology
)
throws
Exception
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
if
(
vmTopology
.
getType
().
equals
(
VM_TOPOLOGY
))
{
Map
<
String
,
Object
>
att
=
vmTopology
.
getAttributes
();
Object
credentialMap
=
att
.
get
(
"credential"
);
// Map<String, Object> toscaCredential = new HashMap<>();
// toscaCredential.put("protocol", credential.getProtocol());
// toscaCredential.put("token_type", credential.getTokenType());
// toscaCredential.put("token", credential.getToken());
// toscaCredential.put("keys", credential.getKeys());
// toscaCredential.put("user", credential.getUser());
// toscaCredential.put("cloud_provider_name", credential.getCloudProviderName());
// att.put("credential", toscaCredential);
// vmTopology.setAttributes(att);
// return vmTopology;
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TOPOLOGY
+
" it is of type: "
+
vmTopology
.
getType
());
}
return
null
;
}
public
ToscaTemplate
setVMTopologyInToscaTemplate
(
ToscaTemplate
toscaTemplate
,
NodeTemplate
vmTopology
)
{
Map
<
String
,
NodeTemplate
>
nodes
=
toscaTemplate
.
getTopologyTemplate
().
getNodeTemplates
();
Set
<
String
>
keys
=
nodes
.
keySet
();
for
(
String
key
:
keys
){
NodeTemplate
node
=
nodes
.
get
(
key
);
}
}
}
}
}
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
b611da67
...
@@ -102,11 +102,11 @@ public class DRIPService {
...
@@ -102,11 +102,11 @@ public class DRIPService {
if
(
credentials
!=
null
&&
credentials
.
size
()
>
0
)
{
if
(
credentials
!=
null
&&
credentials
.
size
()
>
0
)
{
Credential
credential
=
getBestCredential
(
vmTopology
,
credentials
);
Credential
credential
=
getBestCredential
(
vmTopology
,
credentials
);
vmTopology
=
helper
.
setCredentialsInVMTopology
(
vmTopology
,
credential
);
vmTopology
=
helper
.
setCredentialsInVMTopology
(
vmTopology
,
credential
);
toscaTemplate
=
helper
.
setVMTopologyInToscaTemplate
(
vmTopology
);
toscaTemplate
=
helper
.
setVMTopologyInToscaTemplate
(
toscaTemplate
,
vmTopology
);
return
toscaTemplate
;
return
toscaTemplate
;
}
}
}
}
return
toscaTemplate
;
return
null
;
}
}
}
}
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
b611da67
...
@@ -29,6 +29,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
...
@@ -29,6 +29,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormTopTopology
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
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.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.FilenameUtils
;
...
@@ -64,20 +65,20 @@ class CloudStormService {
...
@@ -64,20 +65,20 @@ class CloudStormService {
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"
;
String
topologyTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"topology"
;
File
topologyTempInputDir
=
new
File
(
topologyTempInputDirPath
);
File
topologyTempInputDir
=
new
File
(
topologyTempInputDirPath
);
if
(!(
topologyTempInputDir
.
mkdirs
()))
{
if
(!(
topologyTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
}
}
writeCloudStormTopologyFiles
(
toscaTemplate
,
topologyTempInputDirPath
);
writeCloudStormTopologyFiles
(
toscaTemplate
,
topologyTempInputDirPath
);
String
credentialsTempInputDirPath
=
File
.
separator
+
"credentials"
;
String
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"credentials"
;
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
}
}
writeCloudStormCredentialsFiles
(
toscaTemplate
,
credentialsTempInputDirPath
);
writeCloudStormCredentialsFiles
(
toscaTemplate
,
credentialsTempInputDirPath
);
String
infrasCodeTempInputDirPath
=
File
.
separator
+
"infrasCodes"
;
String
infrasCodeTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"infrasCodes"
;
File
infrasCodeTempInputDir
=
new
File
(
infrasCodeTempInputDirPath
);
File
infrasCodeTempInputDir
=
new
File
(
infrasCodeTempInputDirPath
);
if
(!(
infrasCodeTempInputDir
.
mkdirs
()))
{
if
(!(
infrasCodeTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topologyTempInputDir
.
getAbsolutePath
());
...
@@ -172,8 +173,11 @@ class CloudStormService {
...
@@ -172,8 +173,11 @@ class CloudStormService {
return
null
;
return
null
;
}
}
private
void
writeCloudStormCredentialsFiles
(
ToscaTemplate
toscaTemplate
,
String
credentialsTempInputDirPath
)
{
private
void
writeCloudStormCredentialsFiles
(
ToscaTemplate
toscaTemplate
,
String
credentialsTempInputDirPath
)
throws
ApiException
,
Exception
{
List
<
NodeTemplate
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
for
(
NodeTemplate
vmTopology
:
vmTopologies
)
{
Credential
credentials
=
helper
.
getCredentialsFromVMTopology
(
vmTopology
);
}
}
}
}
}
openAPI/schema/NodeTemplateMap.yml
0 → 100644
View file @
b611da67
NodeTemplateMap
:
type
:
"
object"
properties
:
name
:
type
:
"
string"
nodeTemplate
:
type
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/TOSCA/NodeTemplate.yml#/NodeTemplate"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment