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
5e5868ec
Commit
5e5868ec
authored
Dec 26, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Provisioner type
parent
67f74d65
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
360 additions
and
27 deletions
+360
-27
interfaces.yml
TOSCA/types/interfaces.yml
+1
-1
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+8
-2
CloudCred.java
...ain/java/nl/uva/sne/drip/model/cloud/storm/CloudCred.java
+103
-0
CloudCredentialDB.java
.../nl/uva/sne/drip/model/cloud/storm/CloudCredentialDB.java
+91
-0
CloudDB.java
.../main/java/nl/uva/sne/drip/model/cloud/storm/CloudDB.java
+103
-0
ToscaHelperTest.java
...t/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
+3
-5
PlannerApiController.java
...c/main/java/nl/uva/sne/drip/api/PlannerApiController.java
+1
-2
ProvisionerApiController.java
...in/java/nl/uva/sne/drip/api/ProvisionerApiController.java
+1
-1
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+38
-7
CloudStormService.java
...n/java/nl/uva/sne/drip/provisioner/CloudStormService.java
+10
-8
Provisioner.yml
openAPI/schema/Provisioner.yml
+1
-1
No files found.
TOSCA/types/interfaces.yml
View file @
5e5868ec
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
5e5868ec
...
@@ -84,14 +84,14 @@ public class ToscaHelper {
...
@@ -84,14 +84,14 @@ public class ToscaHelper {
id
=
Integer
.
valueOf
(
resp
);
id
=
Integer
.
valueOf
(
resp
);
}
}
public
List
<
Map
<
String
,
Object
>>
get
ProvisionInterfaceDefinitions
(
List
<
String
>
toscaInterfaceTypes
)
throws
ApiException
{
public
List
<
Map
<
String
,
Object
>>
get
SupportedProvisionInterfaceDefinitions
(
)
throws
ApiException
{
List
<
Map
<
String
,
Object
>>
interfaceDefinitions
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
interfaceDefinitions
=
new
ArrayList
<>();
List
<
String
>
toscaInterfaceTypes
=
getSuportedProvisionInterfaceTypes
();
for
(
String
type
:
toscaInterfaceTypes
)
{
for
(
String
type
:
toscaInterfaceTypes
)
{
String
derivedFrom
=
null
;
String
derivedFrom
=
null
;
List
<
Map
<
String
,
Object
>>
interfaces
=
api
.
getTypes
(
String
.
valueOf
(
id
),
"interface_types"
,
null
,
type
,
null
,
null
,
null
,
null
,
null
,
derivedFrom
);
List
<
Map
<
String
,
Object
>>
interfaces
=
api
.
getTypes
(
String
.
valueOf
(
id
),
"interface_types"
,
null
,
type
,
null
,
null
,
null
,
null
,
null
,
derivedFrom
);
interfaceDefinitions
.
addAll
(
interfaces
);
interfaceDefinitions
.
addAll
(
interfaces
);
}
}
return
interfaceDefinitions
;
return
interfaceDefinitions
;
}
}
...
@@ -223,4 +223,10 @@ public class ToscaHelper {
...
@@ -223,4 +223,10 @@ public class ToscaHelper {
return
toscaTemplate
;
return
toscaTemplate
;
}
}
private
List
<
String
>
getSuportedProvisionInterfaceTypes
()
{
List
<
String
>
suportedProvisionInterfaceTypes
=
new
ArrayList
<>();
suportedProvisionInterfaceTypes
.
add
(
"tosca.interfaces.ARTICONF.CloudsStorm"
);
return
suportedProvisionInterfaceTypes
;
}
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/cloud/storm/CloudCred.java
0 → 100644
View file @
5e5868ec
package
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
/**
* CloudCred
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-26T13:19:20.152Z"
)
public
class
CloudCred
{
@JsonProperty
(
"cloudProvider"
)
private
String
cloudProvider
=
null
;
@JsonProperty
(
"credInfoFile"
)
private
String
credInfoFile
=
null
;
public
CloudCred
cloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
return
this
;
}
/**
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCloudProvider
()
{
return
cloudProvider
;
}
public
void
setCloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
}
public
CloudCred
credInfoFile
(
String
credInfoFile
)
{
this
.
credInfoFile
=
credInfoFile
;
return
this
;
}
/**
* Get credInfoFile
*
* @return credInfoFile
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCredInfoFile
()
{
return
credInfoFile
;
}
public
void
setCredInfoFile
(
String
credInfoFile
)
{
this
.
credInfoFile
=
credInfoFile
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CloudCred
cloudCred
=
(
CloudCred
)
o
;
return
Objects
.
equals
(
this
.
cloudProvider
,
cloudCred
.
cloudProvider
)
&&
Objects
.
equals
(
this
.
credInfoFile
,
cloudCred
.
credInfoFile
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudProvider
,
credInfoFile
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CloudCred {\n"
);
sb
.
append
(
" cloudProvider: "
).
append
(
toIndentedString
(
cloudProvider
)).
append
(
"\n"
);
sb
.
append
(
" credInfoFile: "
).
append
(
toIndentedString
(
credInfoFile
)).
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/CloudCredentialDB.java
0 → 100644
View file @
5e5868ec
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
;
/**
* CloudCredentialDB
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-26T13:19:20.152Z"
)
public
class
CloudCredentialDB
{
@JsonProperty
(
"cloudCreds"
)
@Valid
private
List
<
CloudCred
>
cloudCreds
=
null
;
public
CloudCredentialDB
cloudCreds
(
List
<
CloudCred
>
cloudCreds
)
{
this
.
cloudCreds
=
cloudCreds
;
return
this
;
}
public
CloudCredentialDB
addCloudCredsItem
(
CloudCred
cloudCredsItem
)
{
if
(
this
.
cloudCreds
==
null
)
{
this
.
cloudCreds
=
new
ArrayList
<
CloudCred
>();
}
this
.
cloudCreds
.
add
(
cloudCredsItem
);
return
this
;
}
/**
* Get cloudCreds
*
* @return cloudCreds
*
*/
@ApiModelProperty
(
value
=
""
)
@Valid
public
List
<
CloudCred
>
getCloudCreds
()
{
return
cloudCreds
;
}
public
void
setCloudCreds
(
List
<
CloudCred
>
cloudCreds
)
{
this
.
cloudCreds
=
cloudCreds
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CloudCredentialDB
cloudCredentialDB
=
(
CloudCredentialDB
)
o
;
return
Objects
.
equals
(
this
.
cloudCreds
,
cloudCredentialDB
.
cloudCreds
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudCreds
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CloudCredentialDB {\n"
);
sb
.
append
(
" cloudCreds: "
).
append
(
toIndentedString
(
cloudCreds
)).
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/CloudDB.java
0 → 100644
View file @
5e5868ec
package
nl
.
uva
.
sne
.
drip
.
model
.
cloud
.
storm
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
/**
* CloudDB
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-26T13:19:20.152Z"
)
public
class
CloudDB
{
@JsonProperty
(
"cloudProvider"
)
private
String
cloudProvider
=
null
;
@JsonProperty
(
"dbInfoFile"
)
private
String
dbInfoFile
=
null
;
public
CloudDB
cloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
return
this
;
}
/**
* Get cloudProvider
*
* @return cloudProvider
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getCloudProvider
()
{
return
cloudProvider
;
}
public
void
setCloudProvider
(
String
cloudProvider
)
{
this
.
cloudProvider
=
cloudProvider
;
}
public
CloudDB
dbInfoFile
(
String
dbInfoFile
)
{
this
.
dbInfoFile
=
dbInfoFile
;
return
this
;
}
/**
* Get dbInfoFile
*
* @return dbInfoFile
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getDbInfoFile
()
{
return
dbInfoFile
;
}
public
void
setDbInfoFile
(
String
dbInfoFile
)
{
this
.
dbInfoFile
=
dbInfoFile
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
CloudDB
cloudDB
=
(
CloudDB
)
o
;
return
Objects
.
equals
(
this
.
cloudProvider
,
cloudDB
.
cloudProvider
)
&&
Objects
.
equals
(
this
.
dbInfoFile
,
cloudDB
.
dbInfoFile
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
cloudProvider
,
dbInfoFile
);
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class CloudDB {\n"
);
sb
.
append
(
" cloudProvider: "
).
append
(
toIndentedString
(
cloudProvider
)).
append
(
"\n"
);
sb
.
append
(
" dbInfoFile: "
).
append
(
toIndentedString
(
dbInfoFile
)).
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/test/java/nl/uva/sne/drip/commons/utils/ToscaHelperTest.java
View file @
5e5868ec
...
@@ -100,7 +100,7 @@ public class ToscaHelperTest {
...
@@ -100,7 +100,7 @@ public class ToscaHelperTest {
}
}
/**
/**
* Test of getProvisionInterfaceDefinitions method, of class ToscaHelper.
* Test of get
Supported
ProvisionInterfaceDefinitions method, of class ToscaHelper.
*
*
* @throws nl.uva.sne.drip.sure.tosca.client.ApiException
* @throws nl.uva.sne.drip.sure.tosca.client.ApiException
*/
*/
...
@@ -108,13 +108,11 @@ public class ToscaHelperTest {
...
@@ -108,13 +108,11 @@ public class ToscaHelperTest {
public
void
testGetProvisionInterfaceDefinitions
()
throws
ApiException
{
public
void
testGetProvisionInterfaceDefinitions
()
throws
ApiException
{
if
(
serviceUp
)
{
if
(
serviceUp
)
{
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
System
.
out
.
println
(
"getProvisionInterfaceDefinitions"
);
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
String
expected
=
"tosca.interfaces.ARTICONF.CloudsStorm"
;
toscaInterfaceTypes
.
add
(
expected
);
List
<
Map
<
String
,
Object
>>
result
=
instance
.
getSupportedProvisionInterfaceDefinitions
();
List
<
Map
<
String
,
Object
>>
result
=
instance
.
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
assertNotNull
(
result
);
assertNotNull
(
result
);
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
String
key
=
result
.
get
(
0
).
keySet
().
iterator
().
next
();
assertEquals
(
expected
,
key
);
//
assertEquals(expected, key);
}
}
}
}
...
...
drip-manager/src/main/java/nl/uva/sne/drip/api/PlannerApiController.java
View file @
5e5868ec
...
@@ -2,7 +2,6 @@ package nl.uva.sne.drip.api;
...
@@ -2,7 +2,6 @@ package nl.uva.sne.drip.api;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.*
;
import
java.util.logging.Level
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -43,7 +42,7 @@ public class PlannerApiController implements PlannerApi {
...
@@ -43,7 +42,7 @@ public class PlannerApiController implements PlannerApi {
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
try
{
try
{
dripService
.
setRequestQeueName
(
queueName
);
dripService
.
setRequestQeueName
(
queueName
);
String
planedYemplateId
=
dripService
.
execute
(
id
);
String
planedYemplateId
=
dripService
.
plan
(
id
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
}
catch
(
ApiException
ex
)
{
}
catch
(
ApiException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
...
...
drip-manager/src/main/java/nl/uva/sne/drip/api/ProvisionerApiController.java
View file @
5e5868ec
...
@@ -46,7 +46,7 @@ public class ProvisionerApiController implements ProvisionerApi {
...
@@ -46,7 +46,7 @@ public class ProvisionerApiController implements ProvisionerApi {
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
if
(
accept
!=
null
&&
accept
.
contains
(
"text/plain"
))
{
try
{
try
{
dripService
.
setRequestQeueName
(
queueName
);
dripService
.
setRequestQeueName
(
queueName
);
String
planedYemplateId
=
dripService
.
execute
(
id
);
String
planedYemplateId
=
dripService
.
provision
(
id
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
planedYemplateId
,
HttpStatus
.
OK
);
}
catch
(
ApiException
ex
)
{
}
catch
(
ApiException
ex
)
{
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
new
ResponseEntity
<>(
HttpStatus
.
INTERNAL_SERVER_ERROR
);
...
...
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
5e5868ec
...
@@ -8,9 +8,11 @@ package nl.uva.sne.drip.service;
...
@@ -8,9 +8,11 @@ package nl.uva.sne.drip.service;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.TimeoutException
;
import
java.util.logging.Level
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.api.NotFoundException
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.commons.utils.ToscaHelper
;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplate
;
...
@@ -43,16 +45,11 @@ public class DRIPService {
...
@@ -43,16 +45,11 @@ public class DRIPService {
@Autowired
@Autowired
private
ToscaHelper
helper
;
private
ToscaHelper
helper
;
p
ublic
String
execute
(
String
id
)
throws
JsonProcessingException
,
ApiException
,
Exception
{
p
rivate
String
execute
(
ToscaTemplate
toscaTemplate
)
throws
JsonProcessingException
,
ApiException
,
Exception
{
try
{
try
{
caller
.
init
();
caller
.
init
();
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
Logger
.
getLogger
(
DRIPService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"toscaTemplate:\n{0}"
,
toscaTemplate
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
if
(
requestQeueName
.
equals
(
"provisioner"
))
{
toscaTemplate
=
addCredentials
(
toscaTemplate
);
}
Logger
.
getLogger
(
DRIPService
.
class
.
getName
()).
log
(
Level
.
INFO
,
"toscaTemplate:\n"
+
toscaTemplate
);
Message
message
=
new
Message
();
Message
message
=
new
Message
();
message
.
setOwner
(
"user"
);
message
.
setOwner
(
"user"
);
message
.
setCreationDate
(
System
.
currentTimeMillis
());
message
.
setCreationDate
(
System
.
currentTimeMillis
());
...
@@ -109,4 +106,38 @@ public class DRIPService {
...
@@ -109,4 +106,38 @@ public class DRIPService {
return
toscaTemplate
;
return
toscaTemplate
;
}
}
public
String
plan
(
String
id
)
throws
ApiException
,
Exception
{
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
return
execute
(
toscaTemplate
);
}
public
String
provision
(
String
id
)
throws
JsonProcessingException
,
NotFoundException
,
IOException
,
Exception
{
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
toscaTemplate
=
addCredentials
(
toscaTemplate
);
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
);
return
execute
(
toscaTemplate
);
}
private
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
)
throws
IOException
,
JsonProcessingException
,
ApiException
,
Exception
{
helper
.
uploadToscaTemplate
(
toscaTemplate
);
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
Provisioner
>
provisioners
=
null
;
for
(
NodeTemplateMap
vmTopologyMap
:
vmTopologies
)
{
provisioners
=
provisionerService
.
findByProvider
(
provider
.
toLowerCase
());
if
(
provisioners
!=
null
&&
provisioners
.
size
()
>
0
)
{
Provisioner
provisioner
=
getBestProvisioners
(
vmTopologyMap
.
getNodeTemplate
(),
provisioners
);
vmTopologyMap
=
helper
.
setProvisionerInterfaceInVMTopology
(
vmTopologyMap
,
provisioner
);
toscaTemplate
=
helper
.
setVMTopologyInToscaTemplate
(
toscaTemplate
,
vmTopologyMap
);
}
}
return
toscaTemplate
;
}
private
Map
<
String
,
Object
>
getBestProvisionInterfaceDefinitions
(
List
<
Map
<
String
,
Object
>>
result
)
{
return
result
.
get
(
0
);
}
}
}
drip-provisioner/src/main/java/nl/uva/sne/drip/provisioner/CloudStormService.java
View file @
5e5868ec
...
@@ -28,7 +28,7 @@ import nl.uva.sne.drip.commons.utils.ToscaHelper;
...
@@ -28,7 +28,7 @@ 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
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
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.CloudCredential
s
;
import
nl.uva.sne.drip.model.cloud.storm.CloudCredential
DB
;
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.CloudsStormVMs
;
import
nl.uva.sne.drip.model.cloud.storm.CloudsStormVMs
;
...
@@ -75,7 +75,7 @@ class CloudStormService {
...
@@ -75,7 +75,7 @@ class CloudStormService {
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
());
}
}
writeCloudStormTopologyFiles
(
to
scaTemplate
,
to
pologyTempInputDirPath
);
writeCloudStormTopologyFiles
(
topologyTempInputDirPath
);
String
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"credentials"
;
String
credentialsTempInputDirPath
=
tempInputDirPath
+
File
.
separator
+
"credentials"
;
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
File
credentialsTempInputDir
=
new
File
(
credentialsTempInputDirPath
);
...
@@ -88,11 +88,11 @@ class CloudStormService {
...
@@ -88,11 +88,11 @@ class CloudStormService {
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
());
}
}
writeCloudStormInfrasCodeFiles
(
infrasCodeTempInputDirPath
);
return
toscaTemplate
;
return
toscaTemplate
;
}
}
private
void
writeCloudStormTopologyFiles
(
ToscaTemplate
toscaTemplate
,
String
tempInputDirPath
)
throws
JSchException
,
IOException
,
ApiException
,
Exception
{
private
void
writeCloudStormTopologyFiles
(
String
tempInputDirPath
)
throws
JSchException
,
IOException
,
ApiException
,
Exception
{
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
CloudsStormTopTopology
topTopology
=
new
CloudsStormTopTopology
();
String
publicKeyPath
=
buildSSHKeyPair
(
tempInputDirPath
);
String
publicKeyPath
=
buildSSHKeyPair
(
tempInputDirPath
);
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
topTopology
.
setPublicKeyPath
(
publicKeyPath
);
...
@@ -103,8 +103,6 @@ class CloudStormService {
...
@@ -103,8 +103,6 @@ class CloudStormService {
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
);
// <CloudsStormVMs > cloudsStormVMsList = (List<CloudsStormVMs>) subTopologiesAndVMs.get("cloud_storm_subtopologies");
}
}
private
String
buildSSHKeyPair
(
String
tempInputDirPath
)
throws
JSchException
,
IOException
{
private
String
buildSSHKeyPair
(
String
tempInputDirPath
)
throws
JSchException
,
IOException
{
...
@@ -187,7 +185,7 @@ class CloudStormService {
...
@@ -187,7 +185,7 @@ class CloudStormService {
CloudCred
cloudStormCredential
=
new
CloudCred
();
CloudCred
cloudStormCredential
=
new
CloudCred
();
cloudStormCredential
.
setCloudProvider
(
toscaCredentials
.
getCloudProviderName
());
cloudStormCredential
.
setCloudProvider
(
toscaCredentials
.
getCloudProviderName
());
String
credInfoFile
=
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
;
String
credInfoFile
=
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
;
cloudStormCredential
.
setCredInfoFile
(
credInfoFile
);
cloudStormCredential
.
setCredInfoFile
(
credInfoFile
);
cloudStormCredentialList
.
add
(
cloudStormCredential
);
cloudStormCredentialList
.
add
(
cloudStormCredential
);
...
@@ -195,7 +193,7 @@ class CloudStormService {
...
@@ -195,7 +193,7 @@ class CloudStormService {
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
),
cloudStormCredentialInfo
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
toscaCredentials
.
getCloudProviderName
()
+
i
+
".yml"
),
cloudStormCredentialInfo
);
i
++;
i
++;
}
}
CloudCredential
s
cloudStormCredentials
=
new
CloudCredentials
();
CloudCredential
DB
cloudStormCredentials
=
new
CloudCredentialDB
();
cloudStormCredentials
.
setCloudCreds
(
cloudStormCredentialList
);
cloudStormCredentials
.
setCloudCreds
(
cloudStormCredentialList
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"CloudStormCredentials.yml"
),
cloudStormCredentials
);
objectMapper
.
writeValue
(
new
File
(
credentialsTempInputDirPath
+
File
.
separator
+
"CloudStormCredentials.yml"
),
cloudStormCredentials
);
}
}
...
@@ -222,4 +220,8 @@ class CloudStormService {
...
@@ -222,4 +220,8 @@ class CloudStormService {
return
null
;
return
null
;
}
}
private
void
writeCloudStormInfrasCodeFiles
(
String
infrasCodeTempInputDirPath
)
{
}
}
}
openAPI/schema/Provisioner.yml
View file @
5e5868ec
...
@@ -7,5 +7,5 @@ Provisioner:
...
@@ -7,5 +7,5 @@ Provisioner:
type
:
"
string"
type
:
"
string"
description
:
description
:
type
:
"
string"
type
:
"
string"
tosca_interface_type
s
:
tosca_interface_type
:
type
:
"
string"
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