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
46ef9c49
Commit
46ef9c49
authored
Dec 11, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to match VM types
parent
b17d26c0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
391 additions
and
297 deletions
+391
-297
application_example_2_topologies.yaml
TOSCA/application_example_2_topologies.yaml
+3
-3
application_example_output.yaml
TOSCA/application_example_output.yaml
+3
-3
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+47
-0
DBInfo.java
...c/main/java/nl/uva/sne/drip/model/cloud/storm/DBInfo.java
+76
-73
DCMetaInfo.java
...in/java/nl/uva/sne/drip/model/cloud/storm/DCMetaInfo.java
+208
-204
VMMetaInfo.java
...in/java/nl/uva/sne/drip/model/cloud/storm/VMMetaInfo.java
+17
-0
CloudStormDAO.java
.../main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
+15
-2
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+17
-11
DBInfo.yml
openAPI/schema/CloudStorm/DBInfo.yml
+3
-1
VMMetaInfo.yml
openAPI/schema/CloudStorm/VMMetaInfo.yml
+2
-0
No files found.
TOSCA/application_example_2_topologies.yaml
View file @
46ef9c49
...
@@ -13,7 +13,7 @@ topology_template:
...
@@ -13,7 +13,7 @@ topology_template:
disk_size
:
50000 MB
disk_size
:
50000 MB
mem_size
:
6000 MB
mem_size
:
6000 MB
num_cores
:
2
num_cores
:
2
os
:
ubuntu 16
os
:
ubuntu 16
.04
type
:
tosca.nodes.ARTICONF.VM.Compute
type
:
tosca.nodes.ARTICONF.VM.Compute
compute_1
:
compute_1
:
interfaces
:
interfaces
:
...
@@ -23,7 +23,7 @@ topology_template:
...
@@ -23,7 +23,7 @@ topology_template:
disk_size
:
50000 MB
disk_size
:
50000 MB
mem_size
:
6000 MB
mem_size
:
6000 MB
num_cores
:
2
num_cores
:
2
os
:
ubuntu 16
os
:
ubuntu 16
.04
type
:
tosca.nodes.ARTICONF.VM.Compute
type
:
tosca.nodes.ARTICONF.VM.Compute
compute_2
:
compute_2
:
interfaces
:
interfaces
:
...
@@ -33,7 +33,7 @@ topology_template:
...
@@ -33,7 +33,7 @@ topology_template:
disk_size
:
50000 MB
disk_size
:
50000 MB
mem_size
:
6000 MB
mem_size
:
6000 MB
num_cores
:
2
num_cores
:
2
os
:
ubuntu 16
os
:
ubuntu 16
.04.04
type
:
tosca.nodes.ARTICONF.VM.Compute
type
:
tosca.nodes.ARTICONF.VM.Compute
kubernetes
:
kubernetes
:
interfaces
:
interfaces
:
...
...
TOSCA/application_example_output.yaml
View file @
46ef9c49
...
@@ -44,7 +44,7 @@ topology_template:
...
@@ -44,7 +44,7 @@ topology_template:
required
:
true
required
:
true
type
:
integer
type
:
integer
os
:
os
:
default
:
ubuntu 16
default
:
ubuntu 16
.04
required
:
true
required
:
true
type
:
string
type
:
string
private_ip
:
private_ip
:
...
@@ -74,7 +74,7 @@ topology_template:
...
@@ -74,7 +74,7 @@ topology_template:
host_name
:
vm
host_name
:
vm
mem_size
:
6000 MB
mem_size
:
6000 MB
num_cores
:
2
num_cores
:
2
os
:
ubuntu 16
os
:
ubuntu 16
.04
role
:
worker
role
:
worker
user_name
:
vm_user
user_name
:
vm_user
type
:
tosca.nodes.ARTICONF.VM.Compute
type
:
tosca.nodes.ARTICONF.VM.Compute
...
@@ -87,7 +87,7 @@ topology_template:
...
@@ -87,7 +87,7 @@ topology_template:
host_name
:
vm
host_name
:
vm
mem_size
:
6000 MB
mem_size
:
6000 MB
num_cores
:
2
num_cores
:
2
os
:
ubuntu 16
os
:
ubuntu 16
.04
role
:
worker
role
:
worker
user_name
:
vm_user
user_name
:
vm_user
type
:
tosca.nodes.ARTICONF.VM.Compute
type
:
tosca.nodes.ARTICONF.VM.Compute
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
46ef9c49
...
@@ -42,6 +42,10 @@ public class ToscaHelper {
...
@@ -42,6 +42,10 @@ public class ToscaHelper {
private
final
ObjectMapper
objectMapper
;
private
final
ObjectMapper
objectMapper
;
public
static
final
String
VM_CAPABILITY
=
"tosca.capabilities.ARTICONF.VM"
;
public
static
final
String
VM_CAPABILITY
=
"tosca.capabilities.ARTICONF.VM"
;
private
static
final
String
VM_TYPE
=
"tosca.nodes.ARTICONF.VM.Compute"
;
private
static
final
String
VM_NUM_OF_CORES
=
"num_cores"
;
private
static
final
String
MEM_SIZE
=
"mem_size"
;
private
static
final
String
VM_OS
=
"os"
;
/**
/**
* @return the id
* @return the id
...
@@ -101,4 +105,47 @@ public class ToscaHelper {
...
@@ -101,4 +105,47 @@ public class ToscaHelper {
}
}
public
Double
getVMNumOfCores
(
NodeTemplate
vm
)
throws
Exception
{
if
(
vm
.
getType
().
equals
(
VM_TYPE
))
{
return
(
Double
)
vm
.
getProperties
().
get
(
VM_NUM_OF_CORES
);
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TYPE
+
" it is of type: "
+
vm
.
getType
());
}
}
public
Double
getVMNMemSize
(
NodeTemplate
vm
)
throws
Exception
{
if
(
vm
.
getType
().
equals
(
VM_TYPE
))
{
String
memScalar
=
(
String
)
vm
.
getProperties
().
get
(
MEM_SIZE
);
String
[]
memScalarArray
=
memScalar
.
split
(
" "
);
String
memSize
=
memScalarArray
[
0
];
String
memUnit
=
memScalarArray
[
1
];
Double
memSizeInGB
=
convertToGB
(
Integer
.
valueOf
(
memSize
),
memUnit
);
return
memSizeInGB
;
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TYPE
+
" it is of type: "
+
vm
.
getType
());
}
}
public
String
getVMNOS
(
NodeTemplate
vm
)
throws
Exception
{
if
(
vm
.
getType
().
equals
(
VM_TYPE
))
{
return
(
String
)
vm
.
getProperties
().
get
(
VM_OS
);
}
else
{
throw
new
Exception
(
"NodeTemplate is not of type: "
+
VM_TYPE
+
" it is of type: "
+
vm
.
getType
());
}
}
private
Double
convertToGB
(
Integer
value
,
String
memUnit
)
{
switch
(
memUnit
)
{
case
"GB"
:
return
Double
.
valueOf
(
value
);
case
"MB"
:
return
value
*
0.001
;
case
"KB"
:
return
value
*
0.000001
;
default
:
return
null
;
}
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/DBInfo.java
View file @
46ef9c49
...
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
...
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.List
;
import
nl.uva.sne.drip.model.cloud.storm.DCMetaInfo
;
import
nl.uva.sne.drip.model.cloud.storm.DCMetaInfo
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
...
@@ -16,93 +17,95 @@ import javax.validation.constraints.*;
...
@@ -16,93 +17,95 @@ import javax.validation.constraints.*;
@Validated
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
public
class
DBInfo
{
public
class
DBInfo
{
@JsonProperty
(
"GlobalEntry"
)
private
String
globalEntry
=
null
;
@JsonProperty
(
"DCMetaInfo
"
)
@JsonProperty
(
"GlobalEntry
"
)
private
DCMetaInfo
dcMetaInfo
=
null
;
private
String
globalEntry
=
null
;
public
DBInfo
globalEntry
(
String
globalEntry
)
{
@JsonProperty
(
"DCMetaInfo"
)
this
.
globalEntry
=
globalEntry
;
private
List
<
DCMetaInfo
>
dcMetaInfo
=
null
;
return
this
;
}
/**
public
DBInfo
globalEntry
(
String
globalEntry
)
{
* Get globalEntry
this
.
globalEntry
=
globalEntry
;
* @return globalEntry
return
this
;
**/
}
@ApiModelProperty
(
value
=
""
)
/**
* Get globalEntry
*
* @return globalEntry
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getGlobalEntry
()
{
public
String
getGlobalEntry
()
{
return
globalEntry
;
return
globalEntry
;
}
}
public
void
setGlobalEntry
(
String
globalEntry
)
{
public
void
setGlobalEntry
(
String
globalEntry
)
{
this
.
globalEntry
=
globalEntry
;
this
.
globalEntry
=
globalEntry
;
}
}
public
DBInfo
dcMetaInfo
(
DCMetaInfo
dcMetaInfo
)
{
public
DBInfo
dcMetaInfo
(
List
<
DCMetaInfo
>
dcMetaInfo
)
{
this
.
dcMetaInfo
=
dcMetaInfo
;
this
.
dcMetaInfo
=
dcMetaInfo
;
return
this
;
return
this
;
}
}
/**
/**
* Get dcMetaInfo
* Get dcMetaInfo
* @return dcMetaInfo
*
**/
* @return dcMetaInfo
@ApiModelProperty
(
value
=
""
)
*
*/
@ApiModelProperty
(
value
=
""
)
@Valid
@Valid
public
DCMetaInfo
getDcMetaInfo
()
{
public
List
<
DCMetaInfo
>
getDcMetaInfo
()
{
return
dcMetaInfo
;
return
dcMetaInfo
;
}
}
public
void
setDcMetaInfo
(
DCMetaInfo
dcMetaInfo
)
{
public
void
setDcMetaInfo
(
List
<
DCMetaInfo
>
dcMetaInfo
)
{
this
.
dcMetaInfo
=
dcMetaInfo
;
this
.
dcMetaInfo
=
dcMetaInfo
;
}
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
DBInfo
dbInfo
=
(
DBInfo
)
o
;
return
Objects
.
equals
(
this
.
globalEntry
,
dbInfo
.
globalEntry
)
&&
Objects
.
equals
(
this
.
dcMetaInfo
,
dbInfo
.
dcMetaInfo
);
}
@Override
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
public
int
hashCode
()
{
if
(
this
==
o
)
{
return
Objects
.
hash
(
globalEntry
,
dcMetaInfo
);
return
true
;
}
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class DBInfo {\n"
);
sb
.
append
(
" globalEntry: "
).
append
(
toIndentedString
(
globalEntry
)).
append
(
"\n"
);
sb
.
append
(
" dcMetaInfo: "
).
append
(
toIndentedString
(
dcMetaInfo
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
}
DBInfo
dbInfo
=
(
DBInfo
)
o
;
return
Objects
.
equals
(
this
.
globalEntry
,
dbInfo
.
globalEntry
)
&&
/**
Objects
.
equals
(
this
.
dcMetaInfo
,
dbInfo
.
dcMetaInfo
);
* Convert the given object to string with each line indented by 4 spaces
}
* (except the first line).
*/
@Override
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
public
int
hashCode
()
{
if
(
o
==
null
)
{
return
Objects
.
hash
(
globalEntry
,
dcMetaInfo
);
return
"null"
;
}
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class DBInfo {\n"
);
sb
.
append
(
" globalEntry: "
).
append
(
toIndentedString
(
globalEntry
)).
append
(
"\n"
);
sb
.
append
(
" dcMetaInfo: "
).
append
(
toIndentedString
(
dcMetaInfo
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/DCMetaInfo.java
View file @
46ef9c49
...
@@ -2,16 +2,12 @@ package nl.uva.sne.drip.model.cloud.storm;
...
@@ -2,16 +2,12 @@ package nl.uva.sne.drip.model.cloud.storm;
import
java.util.Objects
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.annotation.JsonCreator
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
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
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.validation.constraints.*
;
/**
/**
* DCMetaInfo
* DCMetaInfo
...
@@ -19,252 +15,260 @@ import javax.validation.constraints.*;
...
@@ -19,252 +15,260 @@ import javax.validation.constraints.*;
@Validated
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
public
class
DCMetaInfo
{
public
class
DCMetaInfo
{
@JsonProperty
(
"domain"
)
private
String
domain
=
null
;
@JsonProperty
(
"endpoint
"
)
@JsonProperty
(
"domain
"
)
private
String
endpoint
=
null
;
private
String
domain
=
null
;
@JsonProperty
(
"country
"
)
@JsonProperty
(
"endpoint
"
)
private
String
country
=
null
;
private
String
endpoint
=
null
;
@JsonProperty
(
"longitude
"
)
@JsonProperty
(
"country
"
)
private
String
longitude
=
null
;
private
String
country
=
null
;
@JsonProperty
(
"lat
itude"
)
@JsonProperty
(
"long
itude"
)
private
String
lat
itude
=
null
;
private
String
long
itude
=
null
;
@JsonProperty
(
"availability
"
)
@JsonProperty
(
"latitude
"
)
private
String
availability
=
null
;
private
String
latitude
=
null
;
@JsonProperty
(
"VMMetaInfo
"
)
@JsonProperty
(
"availability
"
)
private
VMMetaInfo
vmMetaInfo
=
null
;
private
String
availability
=
null
;
@JsonProperty
(
"extraInfo"
)
@JsonProperty
(
"VMMetaInfo"
)
@Valid
private
List
<
VMMetaInfo
>
vmMetaInfo
=
null
;
private
Map
<
String
,
Object
>
extraInfo
=
null
;
public
DCMetaInfo
domain
(
String
domain
)
{
@JsonProperty
(
"extraInfo"
)
this
.
domain
=
domain
;
@Valid
return
this
;
private
Map
<
String
,
Object
>
extraInfo
=
null
;
}
/**
public
DCMetaInfo
domain
(
String
domain
)
{
* Get domain
this
.
domain
=
domain
;
* @return domain
return
this
;
**/
}
@ApiModelProperty
(
value
=
""
)
public
String
getDomain
()
{
return
domain
;
}
public
void
setDomain
(
String
domain
)
{
/**
this
.
domain
=
domain
;
* Get domain
}
*
* @return domain
*
*/
@ApiModelProperty
(
value
=
""
)
public
DCMetaInfo
endpoint
(
String
endpoint
)
{
public
String
getDomain
()
{
this
.
endpoint
=
endpoint
;
return
domain
;
return
this
;
}
}
/**
public
void
setDomain
(
String
domain
)
{
* Get endpoint
this
.
domain
=
domain
;
* @return endpoint
}
**/
@ApiModelProperty
(
value
=
""
)
public
DCMetaInfo
endpoint
(
String
endpoint
)
{
this
.
endpoint
=
endpoint
;
return
this
;
}
public
String
getEndpoint
()
{
/**
return
endpoint
;
* Get endpoint
}
*
* @return endpoint
*
*/
@ApiModelProperty
(
value
=
""
)
public
void
setEndpoint
(
String
endpoint
)
{
public
String
getEndpoint
(
)
{
this
.
endpoint
=
endpoint
;
return
endpoint
;
}
}
public
DCMetaInfo
country
(
String
country
)
{
public
void
setEndpoint
(
String
endpoint
)
{
this
.
country
=
country
;
this
.
endpoint
=
endpoint
;
return
this
;
}
}
/**
public
DCMetaInfo
country
(
String
country
)
{
* Get country
this
.
country
=
country
;
* @return country
return
this
;
**/
}
@ApiModelProperty
(
value
=
""
)
/**
* Get country
*
* @return country
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCountry
()
{
public
String
getCountry
()
{
return
country
;
return
country
;
}
}
public
void
setCountry
(
String
country
)
{
public
void
setCountry
(
String
country
)
{
this
.
country
=
country
;
this
.
country
=
country
;
}
}
public
DCMetaInfo
longitude
(
String
longitude
)
{
public
DCMetaInfo
longitude
(
String
longitude
)
{
this
.
longitude
=
longitude
;
this
.
longitude
=
longitude
;
return
this
;
return
this
;
}
}
/**
/**
* Get longitude
* Get longitude
* @return longitude
*
**/
* @return longitude
@ApiModelProperty
(
value
=
""
)
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getLongitude
()
{
return
longitude
;
}
public
String
getLongitude
(
)
{
public
void
setLongitude
(
String
longitude
)
{
return
longitude
;
this
.
longitude
=
longitude
;
}
}
public
void
setLongitude
(
String
longitude
)
{
public
DCMetaInfo
latitude
(
String
latitude
)
{
this
.
longitude
=
longitude
;
this
.
latitude
=
latitude
;
}
return
this
;
}
public
DCMetaInfo
latitude
(
String
latitude
)
{
/**
this
.
latitude
=
latitude
;
* Get latitude
return
this
;
*
}
* @return latitude
*
*/
@ApiModelProperty
(
value
=
""
)
/**
public
String
getLatitude
()
{
* Get latitude
return
latitude
;
* @return latitude
}
**/
@ApiModelProperty
(
value
=
""
)
public
void
setLatitude
(
String
latitude
)
{
this
.
latitude
=
latitude
;
}
public
String
getLatitude
()
{
public
DCMetaInfo
availability
(
String
availability
)
{
return
latitude
;
this
.
availability
=
availability
;
}
return
this
;
}
public
void
setLatitude
(
String
latitude
)
{
/**
this
.
latitude
=
latitude
;
* Get availability
}
*
* @return availability
*
*/
@ApiModelProperty
(
value
=
""
)
public
DCMetaInfo
availability
(
String
availability
)
{
public
String
getAvailability
()
{
this
.
availability
=
availability
;
return
availability
;
return
this
;
}
}
/**
public
void
setAvailability
(
String
availability
)
{
* Get availability
this
.
availability
=
availability
;
* @return availability
}
**/
@ApiModelProperty
(
value
=
""
)
public
DCMetaInfo
vmMetaInfo
(
List
<
VMMetaInfo
>
vmMetaInfo
)
{
this
.
vmMetaInfo
=
vmMetaInfo
;
return
this
;
}
public
String
getAvailability
()
{
/**
return
availability
;
* Get vmMetaInfo
}
*
* @return vmMetaInfo
*
*/
@ApiModelProperty
(
value
=
""
)
public
void
setAvailability
(
String
availability
)
{
@Valid
this
.
availability
=
availability
;
}
public
DCMetaInfo
vmMetaInfo
(
VMMetaInfo
vmMetaInfo
)
{
public
List
<
VMMetaInfo
>
getVmMetaInfo
()
{
this
.
vmMetaInfo
=
vmMetaInfo
;
return
vmMetaInfo
;
return
this
;
}
}
/**
public
void
setVmMetaInfo
(
List
<
VMMetaInfo
>
vmMetaInfo
)
{
* Get vmMetaInfo
this
.
vmMetaInfo
=
vmMetaInfo
;
* @return vmMetaInfo
}
**/
@ApiModelProperty
(
value
=
""
)
@Valid
public
DCMetaInfo
extraInfo
(
Map
<
String
,
Object
>
extraInfo
)
{
this
.
extraInfo
=
extraInfo
;
public
VMMetaInfo
getVmMetaInfo
()
{
return
this
;
return
vmMetaInfo
;
}
public
void
setVmMetaInfo
(
VMMetaInfo
vmMetaInfo
)
{
this
.
vmMetaInfo
=
vmMetaInfo
;
}
public
DCMetaInfo
extraInfo
(
Map
<
String
,
Object
>
extraInfo
)
{
this
.
extraInfo
=
extraInfo
;
return
this
;
}
public
DCMetaInfo
putExtraInfoItem
(
String
key
,
Object
extraInfoItem
)
{
if
(
this
.
extraInfo
==
null
)
{
this
.
extraInfo
=
new
HashMap
<
String
,
Object
>();
}
}
this
.
extraInfo
.
put
(
key
,
extraInfoItem
);
return
this
;
}
/**
public
DCMetaInfo
putExtraInfoItem
(
String
key
,
Object
extraInfoItem
)
{
* Get extraInfo
if
(
this
.
extraInfo
==
null
)
{
* @return extraInfo
this
.
extraInfo
=
new
HashMap
<
String
,
Object
>();
**/
}
@ApiModelProperty
(
value
=
""
)
this
.
extraInfo
.
put
(
key
,
extraInfoItem
);
return
this
;
}
/**
* Get extraInfo
*
* @return extraInfo
*
*/
@ApiModelProperty
(
value
=
""
)
public
Map
<
String
,
Object
>
getExtraInfo
()
{
public
Map
<
String
,
Object
>
getExtraInfo
()
{
return
extraInfo
;
return
extraInfo
;
}
}
public
void
setExtraInfo
(
Map
<
String
,
Object
>
extraInfo
)
{
public
void
setExtraInfo
(
Map
<
String
,
Object
>
extraInfo
)
{
this
.
extraInfo
=
extraInfo
;
this
.
extraInfo
=
extraInfo
;
}
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
DCMetaInfo
dcMetaInfo
=
(
DCMetaInfo
)
o
;
return
Objects
.
equals
(
this
.
domain
,
dcMetaInfo
.
domain
)
&&
Objects
.
equals
(
this
.
endpoint
,
dcMetaInfo
.
endpoint
)
&&
Objects
.
equals
(
this
.
country
,
dcMetaInfo
.
country
)
&&
Objects
.
equals
(
this
.
longitude
,
dcMetaInfo
.
longitude
)
&&
Objects
.
equals
(
this
.
latitude
,
dcMetaInfo
.
latitude
)
&&
Objects
.
equals
(
this
.
availability
,
dcMetaInfo
.
availability
)
&&
Objects
.
equals
(
this
.
vmMetaInfo
,
dcMetaInfo
.
vmMetaInfo
)
&&
Objects
.
equals
(
this
.
extraInfo
,
dcMetaInfo
.
extraInfo
);
}
@Override
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
public
int
hashCode
()
{
if
(
this
==
o
)
{
return
Objects
.
hash
(
domain
,
endpoint
,
country
,
longitude
,
latitude
,
availability
,
vmMetaInfo
,
extraInfo
);
return
true
;
}
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class DCMetaInfo {\n"
);
sb
.
append
(
" domain: "
).
append
(
toIndentedString
(
domain
)).
append
(
"\n"
);
sb
.
append
(
" endpoint: "
).
append
(
toIndentedString
(
endpoint
)).
append
(
"\n"
);
sb
.
append
(
" country: "
).
append
(
toIndentedString
(
country
)).
append
(
"\n"
);
sb
.
append
(
" longitude: "
).
append
(
toIndentedString
(
longitude
)).
append
(
"\n"
);
sb
.
append
(
" latitude: "
).
append
(
toIndentedString
(
latitude
)).
append
(
"\n"
);
sb
.
append
(
" availability: "
).
append
(
toIndentedString
(
availability
)).
append
(
"\n"
);
sb
.
append
(
" vmMetaInfo: "
).
append
(
toIndentedString
(
vmMetaInfo
)).
append
(
"\n"
);
sb
.
append
(
" extraInfo: "
).
append
(
toIndentedString
(
extraInfo
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
}
DCMetaInfo
dcMetaInfo
=
(
DCMetaInfo
)
o
;
return
Objects
.
equals
(
this
.
domain
,
dcMetaInfo
.
domain
)
&&
/**
Objects
.
equals
(
this
.
endpoint
,
dcMetaInfo
.
endpoint
)
&&
* Convert the given object to string with each line indented by 4 spaces
Objects
.
equals
(
this
.
country
,
dcMetaInfo
.
country
)
&&
* (except the first line).
Objects
.
equals
(
this
.
longitude
,
dcMetaInfo
.
longitude
)
&&
*/
Objects
.
equals
(
this
.
latitude
,
dcMetaInfo
.
latitude
)
&&
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
Objects
.
equals
(
this
.
availability
,
dcMetaInfo
.
availability
)
&&
if
(
o
==
null
)
{
Objects
.
equals
(
this
.
vmMetaInfo
,
dcMetaInfo
.
vmMetaInfo
)
&&
return
"null"
;
Objects
.
equals
(
this
.
extraInfo
,
dcMetaInfo
.
extraInfo
);
}
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
domain
,
endpoint
,
country
,
longitude
,
latitude
,
availability
,
vmMetaInfo
,
extraInfo
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class DCMetaInfo {\n"
);
sb
.
append
(
" domain: "
).
append
(
toIndentedString
(
domain
)).
append
(
"\n"
);
sb
.
append
(
" endpoint: "
).
append
(
toIndentedString
(
endpoint
)).
append
(
"\n"
);
sb
.
append
(
" country: "
).
append
(
toIndentedString
(
country
)).
append
(
"\n"
);
sb
.
append
(
" longitude: "
).
append
(
toIndentedString
(
longitude
)).
append
(
"\n"
);
sb
.
append
(
" latitude: "
).
append
(
toIndentedString
(
latitude
)).
append
(
"\n"
);
sb
.
append
(
" availability: "
).
append
(
toIndentedString
(
availability
)).
append
(
"\n"
);
sb
.
append
(
" vmMetaInfo: "
).
append
(
toIndentedString
(
vmMetaInfo
)).
append
(
"\n"
);
sb
.
append
(
" extraInfo: "
).
append
(
toIndentedString
(
extraInfo
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private
String
toIndentedString
(
java
.
lang
.
Object
o
)
{
if
(
o
==
null
)
{
return
"null"
;
}
}
return
o
.
toString
().
replace
(
"\n"
,
"\n "
);
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/VMMetaInfo.java
View file @
46ef9c49
...
@@ -19,8 +19,25 @@ import javax.validation.constraints.*;
...
@@ -19,8 +19,25 @@ import javax.validation.constraints.*;
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:13:55.016Z"
)
public
class
VMMetaInfo
{
public
class
VMMetaInfo
{
/**
* @return the vmType
*/
public
String
getVmType
()
{
return
vmType
;
}
/**
* @param vmType the vmType to set
*/
public
void
setVmType
(
String
vmType
)
{
this
.
vmType
=
vmType
;
}
@JsonProperty
(
"OS"
)
@JsonProperty
(
"OS"
)
private
String
OS
=
null
;
private
String
OS
=
null
;
@JsonProperty
(
"VMType"
)
private
String
vmType
=
null
;
@JsonProperty
(
"CPU"
)
@JsonProperty
(
"CPU"
)
private
String
CPU
=
null
;
private
String
CPU
=
null
;
...
...
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
View file @
46ef9c49
...
@@ -11,10 +11,14 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
...
@@ -11,10 +11,14 @@ import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.model.cloud.storm.CloudDB
;
import
nl.uva.sne.drip.model.cloud.storm.CloudDB
;
import
nl.uva.sne.drip.model.cloud.storm.DB
;
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.DBInfo
;
import
nl.uva.sne.drip.model.cloud.storm.DCMetaInfo
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
/**
/**
...
@@ -32,7 +36,8 @@ class CloudStormDAO {
...
@@ -32,7 +36,8 @@ class CloudStormDAO {
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
}
}
VMMetaInfo
findVmMetaInfoByProvider
(
String
provider
)
throws
IOException
{
List
<
VMMetaInfo
>
findVmMetaInfoByProvider
(
String
provider
)
throws
IOException
{
DB
db
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
"db.yml"
),
DB
.
class
);
DB
db
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
"db.yml"
),
DB
.
class
);
List
<
CloudDB
>
cloudDBs
=
db
.
getCloudDBs
();
List
<
CloudDB
>
cloudDBs
=
db
.
getCloudDBs
();
...
@@ -44,10 +49,18 @@ class CloudStormDAO {
...
@@ -44,10 +49,18 @@ class CloudStormDAO {
}
}
}
}
if
(
targetCloudDB
!=
null
)
{
if
(
targetCloudDB
!=
null
)
{
List
<
VMMetaInfo
>
vMMetaInfos
=
new
ArrayList
<>();
DBInfo
dbInfo
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
targetCloudDB
.
getDbInfoFile
()),
DBInfo
.
class
);
DBInfo
dbInfo
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
targetCloudDB
.
getDbInfoFile
()),
DBInfo
.
class
);
return
dbInfo
.
getDcMetaInfo
().
getVmMetaInfo
();
List
<
DCMetaInfo
>
metaInfos
=
dbInfo
.
getDcMetaInfo
();
for
(
DCMetaInfo
metaInfo
:
metaInfos
)
{
vMMetaInfos
.
addAll
(
metaInfo
.
getVmMetaInfo
());
}
return
vMMetaInfos
;
}
}
return
null
;
return
null
;
}
}
}
}
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
46ef9c49
...
@@ -15,6 +15,7 @@ import java.io.IOException;
...
@@ -15,6 +15,7 @@ import java.io.IOException;
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
java.util.Objects
;
import
java.util.Properties
;
import
java.util.Properties
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVM
;
...
@@ -46,7 +47,7 @@ class CloudStormService {
...
@@ -46,7 +47,7 @@ class CloudStormService {
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
}
}
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
ApiException
{
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
ApiException
,
Exception
{
tempInputDirPath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
File
.
separator
+
"Input-"
+
Long
.
toString
(
System
.
nanoTime
())
+
File
.
separator
;
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
()))
{
...
@@ -58,7 +59,7 @@ class CloudStormService {
...
@@ -58,7 +59,7 @@ class CloudStormService {
return
toscaTemplate
;
return
toscaTemplate
;
}
}
private
CloudsStormTopTopology
buildCloudStormTopTopology
(
ToscaTemplate
toscaTemplate
)
throws
JSchException
,
IOException
,
ApiException
{
private
CloudsStormTopTopology
buildCloudStormTopTopology
(
ToscaTemplate
toscaTemplate
)
throws
JSchException
,
IOException
,
ApiException
,
Exception
{
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
String
publicKeyPath
=
buildSSHKeyPair
();
String
publicKeyPath
=
buildSSHKeyPair
();
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
...
@@ -86,7 +87,7 @@ class CloudStormService {
...
@@ -86,7 +87,7 @@ class CloudStormService {
return
"vm_user"
;
return
"vm_user"
;
}
}
private
List
<
CloudsStormSubTopology
>
getCloudsStormSubTopologies
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
,
IOException
{
private
List
<
CloudsStormSubTopology
>
getCloudsStormSubTopologies
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
,
IOException
,
Exception
{
List
<
NodeTemplate
>
vmTopologyTemplates
=
helper
.
getVMTopologyTemplates
();
List
<
NodeTemplate
>
vmTopologyTemplates
=
helper
.
getVMTopologyTemplates
();
List
<
CloudsStormSubTopology
>
cloudsStormSubTopologies
=
new
ArrayList
<>();
List
<
CloudsStormSubTopology
>
cloudsStormSubTopologies
=
new
ArrayList
<>();
int
i
=
0
;
int
i
=
0
;
...
@@ -115,15 +116,20 @@ class CloudStormService {
...
@@ -115,15 +116,20 @@ class CloudStormService {
return
cloudsStormSubTopologies
;
return
cloudsStormSubTopologies
;
}
}
private
String
getVMType
(
NodeTemplate
vm
,
String
provider
)
throws
IOException
{
private
String
getVMType
(
NodeTemplate
vm
,
String
provider
)
throws
IOException
,
Exception
{
VMMetaInfo
vmInfo
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
provider
);
Double
numOfCores
=
helper
.
getVMNumOfCores
(
vm
);
String
cpu
=
vmInfo
.
getCPU
();
Double
memSize
=
helper
.
getVMNMemSize
(
vm
);
String
mem
=
vmInfo
.
getMEM
();
String
os
=
helper
.
getVMNOS
(
vm
);
vmInfo
.
get
List
<
VMMetaInfo
>
vmInfos
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
provider
);
int
numOfCores
=
helper
.
getVMNumOfCores
(
vm
);
for
(
VMMetaInfo
vmInfo
:
vmInfos
)
{
int
memSize
=
helper
.
getVMNMemSize
(
vm
);
System
.
err
.
println
(
"numOfCores: "
+
numOfCores
+
" = "
+
vmInfo
.
getCPU
());
System
.
err
.
println
(
"memSize: "
+
numOfCores
+
" = "
+
vmInfo
.
getMEM
());
System
.
err
.
println
(
"os: "
+
os
+
" = "
+
vmInfo
.
getOS
());
if
(
Objects
.
equals
(
numOfCores
,
Double
.
valueOf
(
vmInfo
.
getCPU
()))
&&
Objects
.
equals
(
memSize
,
Double
.
valueOf
(
vmInfo
.
getMEM
()))
&&
os
.
toLowerCase
().
equals
(
vmInfo
.
getOS
().
toLowerCase
()))
{
return
vmInfo
.
getVmType
();
}
}
return
null
;
return
null
;
}
}
...
...
openAPI/schema/CloudStorm/DBInfo.yml
View file @
46ef9c49
...
@@ -4,4 +4,6 @@
...
@@ -4,4 +4,6 @@
GlobalEntry
:
GlobalEntry
:
type
:
"
string"
type
:
"
string"
DCMetaInfo
:
DCMetaInfo
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/DCMetaInfo.yml#/DCMetaInfo"
type
:
"
array"
items
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/DCMetaInfo.yml#/DCMetaInfo"
openAPI/schema/CloudStorm/VMMetaInfo.yml
View file @
46ef9c49
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
type
:
"
string"
type
:
"
string"
MEM
:
MEM
:
type
:
"
string"
type
:
"
string"
VMType
:
type
:
"
string"
Price
:
Price
:
type
:
"
string"
type
:
"
string"
DefaultSSHAccount
:
DefaultSSHAccount
:
...
...
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