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
65d5c5d3
Commit
65d5c5d3
authored
Jan 13, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
returned provisoned tosca
parent
831c481b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
24 deletions
+21
-24
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+3
-11
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+2
-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
+14
-9
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
65d5c5d3
...
...
@@ -209,20 +209,12 @@ public class ToscaHelper {
}
}
public
ToscaTemplate
set
VMTopologyInToscaTemplate
(
ToscaTemplate
toscaTemplate
,
NodeTemplateMap
vmTopologyMap
)
{
public
ToscaTemplate
set
NodeInToscaTemplate
(
ToscaTemplate
toscaTemplate
,
NodeTemplateMap
node
)
{
Map
<
String
,
NodeTemplate
>
nodes
=
toscaTemplate
.
getTopologyTemplate
().
getNodeTemplates
();
nodes
.
put
(
vmTopologyMap
.
getName
(),
vmTopologyMap
.
getNodeTemplate
());
nodes
.
put
(
node
.
getName
(),
node
.
getNodeTemplate
());
return
toscaTemplate
;
}
// public Map<String, Object> getProvisionInterface(Provisioner provisioner, String operation) throws ApiException {
// List<String> toscaInterfaceTypes = new ArrayList<>();
// toscaInterfaceTypes.add(provisioner.getToscaInterfaceType());
// List<Map<String, Object>> definitions = getProvisionInterfaceDefinitions(toscaInterfaceTypes);
// Map<String, Object> definition = getBestProvisionInterfaceDefinition(definitions);
// Map<String, Object> provisionInterface = getProvisionInterfaceInstanceDefaultValues(definition, operation);
// return provisionInterface;
// }
public
Map
<
String
,
Object
>
getProvisionerInterfaceFromVMTopology
(
NodeTemplateMap
vmTopologyMap
)
{
return
(
Map
<
String
,
Object
>)
vmTopologyMap
.
getNodeTemplate
().
getInterfaces
().
get
(
"CloudsStorm"
);
}
...
...
drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
65d5c5d3
...
...
@@ -203,7 +203,7 @@ public class ToscaHelperTest {
credential
.
setTokenType
(
"passwrd"
);
credential
.
setUser
(
"user"
);
vmTopologyMap
=
instance
.
setCredentialsInVMTopology
(
vmTopologyMap
,
credential
);
toscaTemplateWithCredentials
=
instance
.
set
VMTopology
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
toscaTemplateWithCredentials
=
instance
.
set
Node
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
instance
.
uploadToscaTemplate
(
toscaTemplateWithCredentials
);
...
...
@@ -246,7 +246,7 @@ public class ToscaHelperTest {
// }
// }
// vmTopologyMap = instance.setProvisionerInterfaceInVMTopology(vmTopologyMap, provisionInterface);
// toscaTemplateWithInterface = instance.set
VMTopology
InToscaTemplate(toscaTemplate, vmTopologyMap);
// toscaTemplateWithInterface = instance.set
Node
InToscaTemplate(toscaTemplate, vmTopologyMap);
//// }
// instance.uploadToscaTemplate(toscaTemplateWithInterface);
// topology_1 = toscaTemplateWithCredentials.getTopologyTemplate().getNodeTemplates().get("topology_1");
...
...
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
65d5c5d3
...
...
@@ -106,7 +106,7 @@ public class DRIPService {
}
else
{
Credential
credential
=
getBestCredential
(
credentials
);
vmTopologyMap
=
helper
.
setCredentialsInVMTopology
(
vmTopologyMap
,
credential
);
toscaTemplate
=
helper
.
set
VMTopology
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
toscaTemplate
=
helper
.
set
Node
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
}
...
...
@@ -142,7 +142,7 @@ public class DRIPService {
provisionMap
.
put
(
"inputs"
,
inputsMap
);
provisionerInterface
.
put
(
operation
,
caller
);
vmTopologyMap
=
helper
.
setProvisionerInterfaceInVMTopology
(
vmTopologyMap
,
provisionerInterface
);
toscaTemplate
=
helper
.
set
VMTopology
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
toscaTemplate
=
helper
.
set
Node
InToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
}
return
toscaTemplate
;
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
65d5c5d3
...
...
@@ -68,9 +68,10 @@ class CloudStormService {
private
final
String
TOPOLOGY_RELATIVE_PATH
=
File
.
separator
+
INFS_FOLDER_NAME
+
File
.
separator
+
TOPOLOGY_FOLDER_NAME
+
File
.
separator
;
private
ToscaTemplate
toscaTemplate
;
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
//
this.toscaTemplate = toscaTemplate;
this
.
toscaTemplate
=
toscaTemplate
;
cloudStormDBPath
=
properties
.
getProperty
(
"cloud.storm.db.path"
);
cloudStormDAO
=
new
CloudStormDAO
(
cloudStormDBPath
);
String
sureToscaBasePath
=
properties
.
getProperty
(
"sure-tosca.base.path"
);
...
...
@@ -119,7 +120,7 @@ class CloudStormService {
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
ToscaTemplate
toscaTemplate
=
runCloudStorm
(
tempInputDirPath
);
helper
.
uploadToscaTemplate
(
toscaTemplate
);
return
toscaTemplate
;
}
...
...
@@ -296,8 +297,9 @@ class CloudStormService {
List
<
NodeTemplateMap
>
vmTopologiesMaps
=
helper
.
getVMTopologyTemplates
();
int
i
=
0
;
for
(
CloudsStormSubTopology
subTopology
:
subTopologies
)
{
NodeTemplateMap
nodeTemplateMap
=
vmTopologiesMaps
.
get
(
i
);
Map
<
String
,
Object
>
att
=
nodeTemplateMap
.
getNodeTemplate
().
getAttributes
();
NodeTemplateMap
vmTopologyMap
=
vmTopologiesMaps
.
get
(
i
);
Map
<
String
,
Object
>
att
=
vmTopologyMap
.
getNodeTemplate
().
getAttributes
();
if
(
att
==
null
)
{
att
=
new
HashMap
<>();
}
...
...
@@ -320,10 +322,10 @@ class CloudStormService {
keys
.
put
(
"public_key"
,
Converter
.
encodeFileToBase64Binary
(
userKyePairFolder
+
File
.
separator
+
"id_rsa.pub"
));
userKeyPairCredential
.
setKeys
(
keys
);
CloudsStormVMs
cloudsStormVMs
=
objectMapper
.
readValue
(
new
File
(
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
File
.
separator
+
subTopology
.
getTopology
()
+
".yml"
),
CloudsStormVMs
cloudsStormVMs
=
objectMapper
.
readValue
(
new
File
(
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
File
.
separator
+
subTopology
.
getTopology
()
+
".yml"
),
CloudsStormVMs
.
class
);
List
<
CloudsStormVM
>
vms
=
cloudsStormVMs
.
getVms
();
List
<
NodeTemplateMap
>
vmTemplatesMap
=
helper
.
getTemplateVMsForVMTopology
(
nodeTemplate
Map
);
List
<
NodeTemplateMap
>
vmTemplatesMap
=
helper
.
getTemplateVMsForVMTopology
(
vmTopology
Map
);
int
j
=
0
;
for
(
CloudsStormVM
vm
:
vms
)
{
NodeTemplateMap
vmTemplateMap
=
vmTemplatesMap
.
get
(
j
);
...
...
@@ -334,18 +336,21 @@ class CloudStormService {
vmAttributes
.
put
(
"private_ip"
,
vm
.
getSelfEthAddresses
());
vmAttributes
.
put
(
"public_ip"
,
vm
.
getPublicAddress
());
if
(
j
>
0
)
{
vmAttributes
.
put
(
"role"
,
"master"
);
}
else
{
vmAttributes
.
put
(
"role"
,
"worker"
);
}
else
{
vmAttributes
.
put
(
"role"
,
"master"
);
}
vmAttributes
.
put
(
"node_type"
,
vm
.
getNodeType
());
vmAttributes
.
put
(
"host_name"
,
vm
.
getName
());
vmAttributes
.
put
(
"root_key_pair"
,
rootKeyPairCredential
);
vmAttributes
.
put
(
"user_key_pair"
,
userKeyPairCredential
);
vmTemplateMap
.
getNodeTemplate
().
setAttributes
(
vmAttributes
);
toscaTemplate
=
helper
.
setNodeInToscaTemplate
(
toscaTemplate
,
vmTemplateMap
);
}
toscaTemplate
=
helper
.
setNodeInToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
return
null
;
return
toscaTemplate
;
}
}
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