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
321fbae0
Commit
321fbae0
authored
Jan 12, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set tosca template attributes
parent
2a9b1fb1
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
320 additions
and
85 deletions
+320
-85
CloudsStormVM.java
...java/nl/uva/sne/drip/model/cloud/storm/CloudsStormVM.java
+251
-42
CloudsStormVMs.java
...ava/nl/uva/sne/drip/model/cloud/storm/CloudsStormVMs.java
+1
-6
DBInfo.java
...c/main/java/nl/uva/sne/drip/model/cloud/storm/DBInfo.java
+13
-7
DCMetaInfo.java
...in/java/nl/uva/sne/drip/model/cloud/storm/DCMetaInfo.java
+19
-9
CloudStormDAO.java
.../main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
+3
-2
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+29
-19
CloudsStormVM.yml
openAPI/schema/CloudStorm/CloudsStormVM.yml
+4
-0
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CloudsStormVM.java
View file @
321fbae0
This diff is collapsed.
Click to expand it.
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CloudsStormVMs.java
View file @
321fbae0
...
...
@@ -12,14 +12,9 @@ import javax.validation.Valid;
* CloudsStormVMs
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
19-12-30T16:13:55.433
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
20-01-12T18:26:54.530
Z"
)
public
class
CloudsStormVMs
{
@JsonProperty
(
"SEngineClass"
)
private
String
sEngineClass
;
@JsonProperty
(
"VMs"
)
@Valid
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/DBInfo.java
View file @
321fbae0
...
...
@@ -2,20 +2,17 @@ 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
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.ArrayList
;
import
java.util.List
;
import
nl.uva.sne.drip.model.cloud.storm.DCMetaInfo
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.constraints.*
;
/**
* DBInfo
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
19-12-11T15:13:55.016
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
20-01-12T18:26:54.530
Z"
)
public
class
DBInfo
{
...
...
@@ -23,6 +20,7 @@ public class DBInfo {
private
String
globalEntry
=
null
;
@JsonProperty
(
"DCMetaInfo"
)
@Valid
private
List
<
DCMetaInfo
>
dcMetaInfo
=
null
;
public
DBInfo
globalEntry
(
String
globalEntry
)
{
...
...
@@ -34,7 +32,7 @@ public class DBInfo {
* Get globalEntry
*
* @return globalEntry
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -51,11 +49,19 @@ public class DBInfo {
return
this
;
}
public
DBInfo
addDcMetaInfoItem
(
DCMetaInfo
dcMetaInfoItem
)
{
if
(
this
.
dcMetaInfo
==
null
)
{
this
.
dcMetaInfo
=
new
ArrayList
<
DCMetaInfo
>();
}
this
.
dcMetaInfo
.
add
(
dcMetaInfoItem
);
return
this
;
}
/**
* Get dcMetaInfo
*
* @return dcMetaInfo
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/DCMetaInfo.java
View file @
321fbae0
...
...
@@ -3,6 +3,7 @@ package nl.uva.sne.drip.model.cloud.storm;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -13,7 +14,7 @@ import javax.validation.Valid;
* DCMetaInfo
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
19-12-11T15:13:55.016
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"20
20-01-12T18:26:54.530
Z"
)
public
class
DCMetaInfo
{
...
...
@@ -36,6 +37,7 @@ public class DCMetaInfo {
private
String
availability
=
null
;
@JsonProperty
(
"VMMetaInfo"
)
@Valid
private
List
<
CloudsStormVM
>
vmMetaInfo
=
null
;
@JsonProperty
(
"extraInfo"
)
...
...
@@ -51,7 +53,7 @@ public class DCMetaInfo {
* Get domain
*
* @return domain
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -72,7 +74,7 @@ public class DCMetaInfo {
* Get endpoint
*
* @return endpoint
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -93,7 +95,7 @@ public class DCMetaInfo {
* Get country
*
* @return country
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -114,7 +116,7 @@ public class DCMetaInfo {
* Get longitude
*
* @return longitude
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -135,7 +137,7 @@ public class DCMetaInfo {
* Get latitude
*
* @return latitude
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -156,7 +158,7 @@ public class DCMetaInfo {
* Get availability
*
* @return availability
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -173,11 +175,19 @@ public class DCMetaInfo {
return
this
;
}
public
DCMetaInfo
addVmMetaInfoItem
(
CloudsStormVM
vmMetaInfoItem
)
{
if
(
this
.
vmMetaInfo
==
null
)
{
this
.
vmMetaInfo
=
new
ArrayList
<
CloudsStormVM
>();
}
this
.
vmMetaInfo
.
add
(
vmMetaInfoItem
);
return
this
;
}
/**
* Get vmMetaInfo
*
* @return vmMetaInfo
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
@@ -208,7 +218,7 @@ public class DCMetaInfo {
* Get extraInfo
*
* @return extraInfo
*
*
*/
@ApiModelProperty
(
value
=
""
)
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
View file @
321fbae0
...
...
@@ -18,6 +18,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudDB;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.cloud.storm.DB
;
import
nl.uva.sne.drip.model.cloud.storm.DBInfo
;
import
nl.uva.sne.drip.model.cloud.storm.DCMetaInfo
;
/**
*
...
...
@@ -51,8 +52,8 @@ class CloudStormDAO {
List
<
CloudsStormVM
>
vMMetaInfos
=
new
ArrayList
<>();
DBInfo
dbInfo
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
targetCloudDB
.
getDbInfoFile
()),
DBInfo
.
class
);
List
<
CloudsStormVM
>
metaInfos
=
dbInfo
.
getDcMetaInfo
();
for
(
CloudsStormVM
metaInfo
:
metaInfos
)
{
List
<
DCMetaInfo
>
metaInfos
=
dbInfo
.
getDcMetaInfo
();
for
(
DCMetaInfo
metaInfo
:
metaInfos
)
{
vMMetaInfos
.
addAll
(
metaInfo
.
getVmMetaInfo
());
}
return
vMMetaInfos
;
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
321fbae0
...
...
@@ -23,7 +23,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.commons.utils.Converter
;
...
...
@@ -176,7 +175,8 @@ class CloudStormService {
cloudsStormVM
.
setNodeType
(
vmType
);
cloudsStormVM
.
setName
(
"vm"
+
j
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
cloudsStormVM
.
setOsType
(
os
);
cloudsStormVM
.
setOS
(
os
);
cloudsStormVM
.
setOstype
(
os
);
vms
.
add
(
cloudsStormVM
);
j
++;
}
...
...
@@ -200,8 +200,8 @@ class CloudStormService {
for
(
CloudsStormVM
vmInfo
:
vmInfos
)
{
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
FINE
,
"vmInfo: {0}"
,
vmInfo
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
FINE
,
"numOfCores:{0} memSize: {1} os: {2}"
,
new
Object
[]{
numOfCores
,
memSize
,
os
});
if
(
Objects
.
equals
(
numOfCores
,
Double
.
valueOf
(
vmInfo
.
getCPU
()))
&&
Objects
.
equals
(
memSize
,
Double
.
valueOf
(
vmInfo
.
getMEM
()))
&&
os
.
toLowerCase
().
equals
(
vmInfo
.
getOS
().
toLowerCase
()))
{
if
(
Objects
.
equals
(
numOfCores
,
Double
.
valueOf
(
vmInfo
.
getCPU
()))
&&
Objects
.
equals
(
memSize
,
Double
.
valueOf
(
vmInfo
.
getMEM
()))
&&
os
.
toLowerCase
().
equals
(
vmInfo
.
getOS
().
toLowerCase
()))
{
return
vmInfo
.
getVmType
();
}
}
...
...
@@ -303,20 +303,6 @@ class CloudStormService {
}
att
.
put
(
"status"
,
subTopology
.
getStatus
().
toString
());
CloudsStormVMs
cloudsStormVMs
=
objectMapper
.
readValue
(
new
File
(
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
File
.
separator
+
subTopology
.
getTopology
()),
CloudsStormVMs
.
class
);
List
<
CloudsStormVM
>
vms
=
cloudsStormVMs
.
getVms
();
List
<
NodeTemplateMap
>
vmTemplatesMap
=
helper
.
getTemplateVMsForVMTopology
(
nodeTemplateMap
);
int
j
=
0
;
for
(
CloudsStormVM
vm
:
vms
)
{
NodeTemplateMap
vmTemplateMap
=
vmTemplatesMap
.
get
(
j
);
Map
<
String
,
Object
>
vmAttributes
=
vmTemplateMap
.
getNodeTemplate
().
getAttributes
();
if
(
vmAttributes
==
null
){
vmAttributes
=
new
HashMap
<>();
}
vmAttributes
.
put
(
"private_ip"
,
vm
.
get
);
}
String
rootKeyPairFolder
=
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
TOP_TOPOLOGY_FILE_NAME
+
File
.
separator
+
subTopology
.
getSshKeyPairId
();
Credential
rootKeyPairCredential
=
new
Credential
();
...
...
@@ -329,12 +315,36 @@ class CloudStormService {
String
userKyePairFolder
=
tempInputDirPath
+
TOPOLOGY_RELATIVE_PATH
+
TOP_TOPOLOGY_FILE_NAME
;
Credential
userKeyPairCredential
=
new
Credential
();
root
KeyPairCredential
.
setProtocol
(
"ssh"
);
user
KeyPairCredential
.
setProtocol
(
"ssh"
);
keys
=
new
HashMap
<>();
keys
.
put
(
"private_key"
,
Converter
.
encodeFileToBase64Binary
(
userKyePairFolder
+
File
.
separator
+
"id_rsa"
));
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
()),
CloudsStormVMs
.
class
);
List
<
CloudsStormVM
>
vms
=
cloudsStormVMs
.
getVms
();
List
<
NodeTemplateMap
>
vmTemplatesMap
=
helper
.
getTemplateVMsForVMTopology
(
nodeTemplateMap
);
int
j
=
0
;
for
(
CloudsStormVM
vm
:
vms
)
{
NodeTemplateMap
vmTemplateMap
=
vmTemplatesMap
.
get
(
j
);
Map
<
String
,
Object
>
vmAttributes
=
vmTemplateMap
.
getNodeTemplate
().
getAttributes
();
if
(
vmAttributes
==
null
)
{
vmAttributes
=
new
HashMap
<>();
}
vmAttributes
.
put
(
"private_ip"
,
vm
.
getSelfEthAddresses
());
vmAttributes
.
put
(
"public_ip"
,
vm
.
getPublicAddress
());
if
(
j
>
0
)
{
vmAttributes
.
put
(
"role"
,
"master"
);
}
else
{
vmAttributes
.
put
(
"role"
,
"worker"
);
}
vmAttributes
.
put
(
"node_type"
,
vm
.
getNodeType
());
vmAttributes
.
put
(
"host_name"
,
vm
.
getName
());
vmAttributes
.
put
(
"root_key_pair"
,
rootKeyPairCredential
);
vmAttributes
.
put
(
"user_key_pair"
,
userKeyPairCredential
);
}
}
return
null
;
}
...
...
openAPI/schema/CloudStorm/CloudsStormVM.yml
View file @
321fbae0
...
...
@@ -31,5 +31,9 @@
type
:
"
string"
availability
:
type
:
"
string"
selfEthAddresses
:
type
:
"
string"
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