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
b1bde641
Commit
b1bde641
authored
Dec 31, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix floder stucture
parent
66d2733a
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
21 deletions
+36
-21
workspace.xml
drip-planner/.idea/workspace.xml
+1
-6
EC2.yml
drip-provisioner/etc/UD/EC2.yml
+0
-0
EGI.yml
drip-provisioner/etc/UD/EGI.yml
+0
-0
ExoGENI.yml
drip-provisioner/etc/UD/ExoGENI.yml
+0
-0
db.yml
drip-provisioner/etc/UD/db.yml
+0
-0
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+34
-14
application.properies
drip-provisioner/src/main/resources/application.properies
+1
-1
No files found.
drip-planner/.idea/workspace.xml
View file @
b1bde641
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"e478ccae-5352-4e8e-9efb-3f5cda44e877"
name=
"Default Changelist"
comment=
""
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-commons/src/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
...
drip-provisioner/etc/EC2.yml
→
drip-provisioner/etc/
UD/
EC2.yml
View file @
b1bde641
File moved
drip-provisioner/etc/EGI.yml
→
drip-provisioner/etc/
UD/
EGI.yml
View file @
b1bde641
File moved
drip-provisioner/etc/ExoGENI.yml
→
drip-provisioner/etc/
UD/
ExoGENI.yml
View file @
b1bde641
File moved
drip-provisioner/etc/db.yml
→
drip-provisioner/etc/
UD/
db.yml
View file @
b1bde641
File moved
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
b1bde641
...
@@ -32,6 +32,7 @@ import nl.uva.sne.drip.model.NodeTemplateMap;
...
@@ -32,6 +32,7 @@ import nl.uva.sne.drip.model.NodeTemplateMap;
import
nl.uva.sne.drip.model.cloud.storm.CloudCred
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCred
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCredentialDB
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCredentialDB
;
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.CloudDB.CloudProviderEnum
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormInfrasCode
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormInfrasCode
;
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
;
...
@@ -43,6 +44,7 @@ import nl.uva.sne.drip.model.cloud.storm.VMMetaInfo;
...
@@ -43,6 +44,7 @@ import nl.uva.sne.drip.model.cloud.storm.VMMetaInfo;
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
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
nl.uva.sne.drip.sure.tosca.client.ApiException
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.commons.io.FilenameUtils
;
/**
/**
...
@@ -57,10 +59,11 @@ class CloudStormService {
...
@@ -57,10 +59,11 @@ class CloudStormService {
private
final
ToscaHelper
helper
;
private
final
ToscaHelper
helper
;
private
final
CloudStormDAO
cloudStormDAO
;
private
final
CloudStormDAO
cloudStormDAO
;
private
final
ObjectMapper
objectMapper
;
private
final
ObjectMapper
objectMapper
;
private
final
String
cloudStormDBPath
;
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
CloudStormService
(
Properties
properties
,
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
{
this
.
toscaTemplate
=
toscaTemplate
;
this
.
toscaTemplate
=
toscaTemplate
;
String
cloudStormDBPath
=
properties
.
getProperty
(
"cloud.storm.db.path"
);
cloudStormDBPath
=
properties
.
getProperty
(
"cloud.storm.db.path"
);
cloudStormDAO
=
new
CloudStormDAO
(
cloudStormDBPath
);
cloudStormDAO
=
new
CloudStormDAO
(
cloudStormDBPath
);
String
sureToscaBasePath
=
properties
.
getProperty
(
"sure-tosca.base.path"
);
String
sureToscaBasePath
=
properties
.
getProperty
(
"sure-tosca.base.path"
);
this
.
helper
=
new
ToscaHelper
(
sureToscaBasePath
);
this
.
helper
=
new
ToscaHelper
(
sureToscaBasePath
);
...
@@ -76,26 +79,35 @@ class CloudStormService {
...
@@ -76,26 +79,35 @@ 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
=
tempInputDirPath
+
File
.
separator
+
"
t
opology"
;
String
topologyTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"
Infs"
+
File
.
separator
+
"T
opology"
;
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
());
}
}
Map
<
String
,
Object
>
subTopologiesAndVMs
=
writeCloudStormTopologyFiles
(
topologyTempInputDirPath
);
Map
<
String
,
Object
>
subTopologiesAndVMs
=
writeCloudStormTopologyFiles
(
topologyTempInputDirPath
);
String
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"
credentials
"
;
String
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"
Infs"
+
File
.
separator
+
"UC
"
;
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
if
(!(
credentialsTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
topology
TempInputDir
.
getAbsolutePath
());
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
credentials
TempInputDir
.
getAbsolutePath
());
}
}
writeCloudStormCredentialsFiles
(
credentialsTempInputDirPath
);
writeCloudStormCredentialsFiles
(
credentialsTempInputDirPath
);
String
infrasCodeTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"infrasCodes"
;
String
providersDBTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"Infs"
+
File
.
separator
+
"UD"
;
File
providersDBTempInputDir
=
new
File
(
providersDBTempInputDirPath
);
if
(!(
providersDBTempInputDir
.
mkdirs
()))
{
throw
new
FileNotFoundException
(
"Could not create input directory: "
+
providersDBTempInputDir
.
getAbsolutePath
());
}
writeCloudStormProvidersDBFiles
(
providersDBTempInputDirPath
);
String
infrasCodeTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"App"
;
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
());
}
}
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
List
<
CloudsStormSubTopology
>
cloudStormSubtopologies
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
,
cloudStormSubtopologies
);
return
toscaTemplate
;
return
toscaTemplate
;
}
}
...
@@ -109,7 +121,7 @@ class CloudStormService {
...
@@ -109,7 +121,7 @@ class CloudStormService {
List
<
CloudsStormSubTopology
>
cloudsStormSubTopology
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
List
<
CloudsStormSubTopology
>
cloudsStormSubTopology
=
(
List
<
CloudsStormSubTopology
>)
subTopologiesAndVMs
.
get
(
"cloud_storm_subtopologies"
);
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
topTopology
.
setTopologies
(
cloudsStormSubTopology
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
"top.yml"
),
topTopology
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
"
_
top.yml"
),
topTopology
);
return
subTopologiesAndVMs
;
return
subTopologiesAndVMs
;
}
}
...
@@ -142,7 +154,7 @@ class CloudStormService {
...
@@ -142,7 +154,7 @@ class CloudStormService {
String
provider
=
helper
.
getTopologyProvider
(
nodeTemplateMap
);
String
provider
=
helper
.
getTopologyProvider
(
nodeTemplateMap
);
cloudsStormSubTopology
.
setDomain
(
domain
);
cloudsStormSubTopology
.
setDomain
(
domain
);
cloudsStormSubTopology
.
setCloudProvider
(
provider
);
cloudsStormSubTopology
.
setCloudProvider
(
provider
);
cloudsStormSubTopology
.
setTopology
(
"
vm_
topology"
+
i
);
cloudsStormSubTopology
.
setTopology
(
"
sub-
topology"
+
i
);
cloudsStormSubTopology
.
setStatus
(
CloudsStormSubTopology
.
StatusEnum
.
FRESH
);
cloudsStormSubTopology
.
setStatus
(
CloudsStormSubTopology
.
StatusEnum
.
FRESH
);
CloudsStormVMs
cloudsStormVMs
=
new
CloudsStormVMs
();
CloudsStormVMs
cloudsStormVMs
=
new
CloudsStormVMs
();
...
@@ -151,8 +163,7 @@ class CloudStormService {
...
@@ -151,8 +163,7 @@ class CloudStormService {
int
j
=
0
;
int
j
=
0
;
for
(
NodeTemplateMap
vmMap
:
vmTemplatesMap
)
{
for
(
NodeTemplateMap
vmMap
:
vmTemplatesMap
)
{
CloudsStormVM
cloudsStormVM
=
new
CloudsStormVM
();
CloudsStormVM
cloudsStormVM
=
new
CloudsStormVM
();
CloudDB
.
CloudProviderEnum
cloudProviderEnum
=
CloudDB
.
CloudProviderEnum
.
valueOf
(
provider
);
String
vmType
=
getVMType
(
vmMap
,
provider
);
String
vmType
=
getVMType
(
vmMap
,
cloudProviderEnum
);
cloudsStormVM
.
setNodeType
(
vmType
);
cloudsStormVM
.
setNodeType
(
vmType
);
cloudsStormVM
.
setName
(
"vm"
+
j
);
cloudsStormVM
.
setName
(
"vm"
+
j
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
...
@@ -161,7 +172,7 @@ class CloudStormService {
...
@@ -161,7 +172,7 @@ class CloudStormService {
j
++;
j
++;
}
}
cloudsStormVMs
.
setVms
(
vms
);
cloudsStormVMs
.
setVms
(
vms
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
"
vm_
topology"
+
i
+
".yml"
),
cloudsStormVMs
);
objectMapper
.
writeValue
(
new
File
(
tempInputDirPath
+
File
.
separator
+
"
sub-
topology"
+
i
+
".yml"
),
cloudsStormVMs
);
cloudsStormVMsList
.
add
(
cloudsStormVMs
);
cloudsStormVMsList
.
add
(
cloudsStormVMs
);
cloudsStormSubTopologies
.
add
(
cloudsStormSubTopology
);
cloudsStormSubTopologies
.
add
(
cloudsStormSubTopology
);
i
++;
i
++;
...
@@ -171,14 +182,15 @@ class CloudStormService {
...
@@ -171,14 +182,15 @@ class CloudStormService {
return
cloudsStormMap
;
return
cloudsStormMap
;
}
}
private
String
getVMType
(
NodeTemplateMap
vmMap
,
CloudDB
.
CloudProviderEnum
provider
)
throws
IOException
,
Exception
{
private
String
getVMType
(
NodeTemplateMap
vmMap
,
String
provider
)
throws
IOException
,
Exception
{
Double
numOfCores
=
helper
.
getVMNumOfCores
(
vmMap
);
Double
numOfCores
=
helper
.
getVMNumOfCores
(
vmMap
);
Double
memSize
=
helper
.
getVMNMemSize
(
vmMap
);
Double
memSize
=
helper
.
getVMNMemSize
(
vmMap
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
String
os
=
helper
.
getVMNOS
(
vmMap
);
List
<
VMMetaInfo
>
vmInfos
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
provider
);
List
<
VMMetaInfo
>
vmInfos
=
cloudStormDAO
.
findVmMetaInfoByProvider
(
CloudProviderEnum
.
fromValue
(
provider
));
for
(
VMMetaInfo
vmInfo
:
vmInfos
)
{
for
(
VMMetaInfo
vmInfo
:
vmInfos
)
{
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"vmInfo: {0}"
,
vmInfo
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
FINE
,
"vmInfo: {0}"
,
vmInfo
);
Logger
.
getLogger
(
CloudStormService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"numOfCores:{0} memSize: {1} os: {2}"
,
new
Object
[]{
numOfCores
,
memSize
,
os
});
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
();
return
vmInfo
.
getVmType
();
}
}
...
@@ -243,9 +255,11 @@ class CloudStormService {
...
@@ -243,9 +255,11 @@ class CloudStormService {
opCode
.
setLog
(
Boolean
.
FALSE
);
opCode
.
setLog
(
Boolean
.
FALSE
);
opCode
.
setObjectType
(
OpCode
.
ObjectTypeEnum
.
SUBTOPOLOGY
);
opCode
.
setObjectType
(
OpCode
.
ObjectTypeEnum
.
SUBTOPOLOGY
);
opCode
.
setObjects
(
cloudStormSubtopologies
.
get
(
i
).
getTopology
());
opCode
.
setObjects
(
cloudStormSubtopologies
.
get
(
i
).
getTopology
());
opCode
.
setOperation
(
OpCode
.
OperationEnum
.
fromValue
(
operation
));
InfrasCode
infrasCode
=
new
InfrasCode
();
InfrasCode
infrasCode
=
new
InfrasCode
();
infrasCode
.
setCodeType
(
InfrasCode
.
CodeTypeEnum
.
SEQ
);
infrasCode
.
setCodeType
(
InfrasCode
.
CodeTypeEnum
.
SEQ
);
infrasCode
.
setOpCode
(
opCode
);
infrasCode
.
setOpCode
(
opCode
);
infrasCodes
.
add
(
infrasCode
);
}
}
CloudsStormInfrasCode
cloudsStormInfrasCode
=
new
CloudsStormInfrasCode
();
CloudsStormInfrasCode
cloudsStormInfrasCode
=
new
CloudsStormInfrasCode
();
cloudsStormInfrasCode
.
setMode
(
CloudsStormInfrasCode
.
ModeEnum
.
LOCAL
);
cloudsStormInfrasCode
.
setMode
(
CloudsStormInfrasCode
.
ModeEnum
.
LOCAL
);
...
@@ -254,4 +268,10 @@ class CloudStormService {
...
@@ -254,4 +268,10 @@ class CloudStormService {
objectMapper
.
writeValue
(
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
"infrasCode.yml"
),
cloudsStormInfrasCode
);
objectMapper
.
writeValue
(
new
File
(
infrasCodeTempInputDirPath
+
File
.
separator
+
"infrasCode.yml"
),
cloudsStormInfrasCode
);
}
}
private
void
writeCloudStormProvidersDBFiles
(
String
tempInputDirPath
)
throws
IOException
{
File
srcDir
=
new
File
(
cloudStormDBPath
);
File
destDir
=
new
File
(
tempInputDirPath
);
FileUtils
.
copyDirectory
(
srcDir
,
destDir
);
}
}
}
drip-provisioner/src/main/resources/application.properies
View file @
b1bde641
...
@@ -5,4 +5,4 @@ message.broker.queue.provisioner=provisioner
...
@@ -5,4 +5,4 @@ message.broker.queue.provisioner=provisioner
message.broker.queue.planner=planner
message.broker.queue.planner=planner
message.broker.queue.deployer=deployer
message.broker.queue.deployer=deployer
sure-tosca.base.path=http://localhost:8081/tosca-sure/1.0.0
sure-tosca.base.path=http://localhost:8081/tosca-sure/1.0.0
cloud.storm.db.path=etc/
cloud.storm.db.path=etc/UD
\ No newline at end of file
\ No newline at end of file
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