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
b17d26c0
Commit
b17d26c0
authored
5 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change vminfo to array
parent
2d9ace00
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
15 deletions
+170
-15
DB.java
...s/src/main/java/nl/uva/sne/drip/model/cloud/storm/DB.java
+91
-0
CloudStormDAO.java
.../main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
+53
-0
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+15
-13
CONF-3.0.0-swagger.yaml
openAPI/API/CONF-3.0.0-swagger.yaml
+7
-0
DCMetaInfo.yml
openAPI/schema/CloudStorm/DCMetaInfo.yml
+4
-2
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/DB.java
0 → 100644
View file @
b17d26c0
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.List
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
/**
* DB
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-11T15:52:11.688Z"
)
public
class
DB
{
@JsonProperty
(
"cloudDBs"
)
@Valid
private
List
<
CloudDB
>
cloudDBs
=
null
;
public
DB
cloudDBs
(
List
<
CloudDB
>
cloudDBs
)
{
this
.
cloudDBs
=
cloudDBs
;
return
this
;
}
public
DB
addCloudDBsItem
(
CloudDB
cloudDBsItem
)
{
if
(
this
.
cloudDBs
==
null
)
{
this
.
cloudDBs
=
new
ArrayList
<>();
}
this
.
cloudDBs
.
add
(
cloudDBsItem
);
return
this
;
}
/**
* Get cloudDBs
*
* @return cloudDBs
*
*/
@ApiModelProperty
(
value
=
""
)
@Valid
public
List
<
CloudDB
>
getCloudDBs
()
{
return
cloudDBs
;
}
public
void
setCloudDBs
(
List
<
CloudDB
>
cloudDBs
)
{
this
.
cloudDBs
=
cloudDBs
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
DB
DB
=
(
DB
)
o
;
return
Objects
.
equals
(
this
.
cloudDBs
,
DB
.
cloudDBs
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudDBs
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class DB {\n"
);
sb
.
append
(
" cloudDBs: "
).
append
(
toIndentedString
(
cloudDBs
)).
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 "
);
}
}
This diff is collapsed.
Click to expand it.
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormDAO.java
0 → 100644
View file @
b17d26c0
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
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.DBInfo
;
import
nl.uva.sne.drip.model.cloud.storm.VMMetaInfo
;
/**
*
* @author S. Koulouzis
*/
class
CloudStormDAO
{
private
final
String
cloudStormDBPath
;
private
final
ObjectMapper
objectMapper
;
public
CloudStormDAO
(
String
cloudStormDBPath
)
{
this
.
cloudStormDBPath
=
cloudStormDBPath
;
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
}
VMMetaInfo
findVmMetaInfoByProvider
(
String
provider
)
throws
IOException
{
DB
db
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
"db.yml"
),
DB
.
class
);
List
<
CloudDB
>
cloudDBs
=
db
.
getCloudDBs
();
CloudDB
targetCloudDB
=
null
;
for
(
CloudDB
cloudDB
:
cloudDBs
)
{
if
(
cloudDB
.
getCloudProvider
().
toLowerCase
().
equals
(
provider
.
toLowerCase
()))
{
targetCloudDB
=
cloudDB
;
break
;
}
}
if
(
targetCloudDB
!=
null
)
{
DBInfo
dbInfo
=
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
+
File
.
separator
+
targetCloudDB
.
getDbInfoFile
()),
DBInfo
.
class
);
return
dbInfo
.
getDcMetaInfo
().
getVmMetaInfo
();
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
b17d26c0
...
@@ -6,10 +6,6 @@
...
@@ -6,10 +6,6 @@
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
package
nl
.
uva
.
sne
.
drip
.
provisioner
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLGenerator
;
import
com.jcraft.jsch.JSch
;
import
com.jcraft.jsch.JSch
;
import
com.jcraft.jsch.JSchException
;
import
com.jcraft.jsch.JSchException
;
import
com.jcraft.jsch.KeyPair
;
import
com.jcraft.jsch.KeyPair
;
...
@@ -25,6 +21,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormVM;
...
@@ -25,6 +21,7 @@ import nl.uva.sne.drip.model.cloud.storm.CloudsStormVM;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormSubTopology
;
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.VMMetaInfo
;
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
;
...
@@ -39,16 +36,14 @@ class CloudStormService {
...
@@ -39,16 +36,14 @@ class CloudStormService {
private
String
tempInputDirPath
;
private
String
tempInputDirPath
;
private
final
ToscaTemplate
toscaTemplate
;
private
final
ToscaTemplate
toscaTemplate
;
private
final
ToscaHelper
helper
;
private
final
ToscaHelper
helper
;
private
final
String
cloudStormDBPath
;
private
final
CloudStormDAO
cloudStormDAO
;
private
final
ObjectMapper
objectMapper
;
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
this
.
toscaTemplate
=
toscaTemplate
;
this
.
toscaTemplate
=
toscaTemplate
;
this
.
cloudStormDBPath
=
properties
.
getProperty
(
"cloud.storm.db.path"
);
String
cloudStormDBPath
=
properties
.
getProperty
(
"cloud.storm.db.path"
);
cloudStormDAO
=
new
CloudStormDAO
(
cloudStormDBPath
);
String
sureToscaBasePath
=
properties
.
getProperty
(
"sure-tosca.base.path"
);
String
sureToscaBasePath
=
properties
.
getProperty
(
"sure-tosca.base.path"
);
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
this
.
helper
=
new
ToscaHelper
(
toscaTemplate
,
sureToscaBasePath
);
this
.
objectMapper
=
new
ObjectMapper
(
new
YAMLFactory
().
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
objectMapper
.
disable
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
);
}
}
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
ApiException
{
public
ToscaTemplate
execute
()
throws
FileNotFoundException
,
JSchException
,
IOException
,
ApiException
{
...
@@ -91,7 +86,7 @@ class CloudStormService {
...
@@ -91,7 +86,7 @@ class CloudStormService {
return
"vm_user"
;
return
"vm_user"
;
}
}
private
List
<
CloudsStormSubTopology
>
getCloudsStormSubTopologies
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
{
private
List
<
CloudsStormSubTopology
>
getCloudsStormSubTopologies
(
ToscaTemplate
toscaTemplate
)
throws
ApiException
,
IOException
{
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
;
...
@@ -120,9 +115,16 @@ class CloudStormService {
...
@@ -120,9 +115,16 @@ class CloudStormService {
return
cloudsStormSubTopologies
;
return
cloudsStormSubTopologies
;
}
}
private
String
getVMType
(
NodeTemplate
vm
,
String
provider
)
{
private
String
getVMType
(
NodeTemplate
vm
,
String
provider
)
throws
IOException
{
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
.
CloudDB
VMMetaInfo
vmInfo
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
provider
);
objectMapper
.
readValue
(
new
File
(
cloudStormDBPath
),
DB
)
String
cpu
=
vmInfo
.
getCPU
();
String
mem
=
vmInfo
.
getMEM
();
vmInfo
.
get
int
numOfCores
=
helper
.
getVMNumOfCores
(
vm
);
int
memSize
=
helper
.
getVMNMemSize
(
vm
);
return
null
;
}
}
}
}
This diff is collapsed.
Click to expand it.
openAPI/API/CONF-3.0.0-swagger.yaml
View file @
b17d26c0
...
@@ -654,6 +654,13 @@ definitions:
...
@@ -654,6 +654,13 @@ definitions:
type
:
array
type
:
array
items
:
items
:
$ref
:
'
#/definitions/CloudsStormSubnets'
$ref
:
'
#/definitions/CloudsStormSubnets'
DB
:
type
:
object
properties
:
cloudDBs
:
type
:
array
items
:
$ref
:
'
#/definitions/CloudDB'
CloudDB
:
CloudDB
:
type
:
object
type
:
object
properties
:
properties
:
...
...
This diff is collapsed.
Click to expand it.
openAPI/schema/CloudStorm/DCMetaInfo.yml
View file @
b17d26c0
...
@@ -14,8 +14,10 @@
...
@@ -14,8 +14,10 @@
availability
:
availability
:
type
:
"
string"
type
:
"
string"
VMMetaInfo
:
VMMetaInfo
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/VMMetaInfo.yml#/VMMetaInfo"
type
:
"
array"
items
:
$ref
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/openAPI/schema/CloudStorm/VMMetaInfo.yml#/VMMetaInfo"
extraInfo
:
extraInfo
:
type
:
object
type
:
object
additionalProperties
:
additionalProperties
:
type
:
object
type
:
object
This diff is collapsed.
Click to expand it.
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