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
95ab9ebe
Commit
95ab9ebe
authored
Dec 26, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Provisioner type
parent
b8838009
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
19 deletions
+130
-19
ToscaHelper.java
.../main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
+8
-6
Provisioner.java
...mons/src/main/java/nl/uva/sne/drip/model/Provisioner.java
+109
-3
DRIPService.java
...er/src/main/java/nl/uva/sne/drip/service/DRIPService.java
+10
-2
ProvisionerService.java
...main/java/nl/uva/sne/drip/service/ProvisionerService.java
+3
-8
No files found.
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/ToscaHelper.java
View file @
95ab9ebe
...
...
@@ -28,6 +28,7 @@ import java.util.List;
import
java.util.Map
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
import
nl.uva.sne.drip.model.Provisioner
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
import
nl.uva.sne.drip.sure.tosca.client.DefaultApi
;
...
...
@@ -84,9 +85,8 @@ public class ToscaHelper {
id
=
Integer
.
valueOf
(
resp
);
}
public
List
<
Map
<
String
,
Object
>>
get
SupportedProvisionInterfaceDefinitions
(
)
throws
ApiException
{
public
List
<
Map
<
String
,
Object
>>
get
ProvisionInterfaceDefinitions
(
List
<
String
>
toscaInterfaceTypes
)
throws
ApiException
{
List
<
Map
<
String
,
Object
>>
interfaceDefinitions
=
new
ArrayList
<>();
List
<
String
>
toscaInterfaceTypes
=
getSuportedProvisionInterfaceTypes
();
for
(
String
type
:
toscaInterfaceTypes
)
{
String
derivedFrom
=
null
;
List
<
Map
<
String
,
Object
>>
interfaces
=
api
.
getTypes
(
String
.
valueOf
(
id
),
"interface_types"
,
null
,
type
,
null
,
null
,
null
,
null
,
null
,
derivedFrom
);
...
...
@@ -223,10 +223,12 @@ public class ToscaHelper {
return
toscaTemplate
;
}
private
List
<
String
>
getSuportedProvisionInterfaceTypes
()
{
List
<
String
>
suportedProvisionInterfaceTypes
=
new
ArrayList
<>();
suportedProvisionInterfaceTypes
.
add
(
"tosca.interfaces.ARTICONF.CloudsStorm"
);
return
suportedProvisionInterfaceTypes
;
public
NodeTemplateMap
setProvisionerInterfaceInVMTopology
(
NodeTemplateMap
vmTopologyMap
,
Provisioner
provisioner
)
throws
ApiException
{
List
<
String
>
toscaInterfaceTypes
=
new
ArrayList
<>();
toscaInterfaceTypes
.
add
(
provisioner
.
getToscaInterfaceType
());
List
<
Map
<
String
,
Object
>>
definitions
=
getProvisionInterfaceDefinitions
(
toscaInterfaceTypes
);
return
null
;
}
}
drip-commons/src/main/java/nl/uva/sne/drip/model/Provisioner.java
View file @
95ab9ebe
package
nl
.
uva
.
sne
.
drip
.
model
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.validation.annotation.Validated
;
/**
* Provisioner
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-26T1
4:52:47.859
Z"
)
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-12-26T1
5:03:16.208
Z"
)
public
class
Provisioner
{
@JsonProperty
(
"name"
)
private
String
name
=
null
;
@JsonProperty
(
"version"
)
private
String
version
=
null
;
@JsonProperty
(
"description"
)
private
String
description
=
null
;
@JsonProperty
(
"tosca_interface_type"
)
private
String
toscaInterfaceType
=
null
;
public
Provisioner
name
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
/**
* Get name
*
* @return name
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Provisioner
version
(
String
version
)
{
this
.
version
=
version
;
return
this
;
}
/**
* Get version
*
* @return version
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getVersion
()
{
return
version
;
}
public
void
setVersion
(
String
version
)
{
this
.
version
=
version
;
}
public
Provisioner
description
(
String
description
)
{
this
.
description
=
description
;
return
this
;
}
/**
* Get description
*
* @return description
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
Provisioner
toscaInterfaceType
(
String
toscaInterfaceType
)
{
this
.
toscaInterfaceType
=
toscaInterfaceType
;
return
this
;
}
/**
* Get toscaInterfaceType
*
* @return toscaInterfaceType
*
*/
@ApiModelProperty
(
value
=
""
)
public
String
getToscaInterfaceType
()
{
return
toscaInterfaceType
;
}
public
void
setToscaInterfaceType
(
String
toscaInterfaceType
)
{
this
.
toscaInterfaceType
=
toscaInterfaceType
;
}
@Override
public
boolean
equals
(
java
.
lang
.
Object
o
)
{
if
(
this
==
o
)
{
...
...
@@ -19,12 +117,16 @@ public class Provisioner {
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
return
true
;
Provisioner
provisioner
=
(
Provisioner
)
o
;
return
Objects
.
equals
(
this
.
name
,
provisioner
.
name
)
&&
Objects
.
equals
(
this
.
version
,
provisioner
.
version
)
&&
Objects
.
equals
(
this
.
description
,
provisioner
.
description
)
&&
Objects
.
equals
(
this
.
toscaInterfaceType
,
provisioner
.
toscaInterfaceType
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
();
return
Objects
.
hash
(
name
,
version
,
description
,
toscaInterfaceType
);
}
@Override
...
...
@@ -32,6 +134,10 @@ public class Provisioner {
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
"class Provisioner {\n"
);
sb
.
append
(
" name: "
).
append
(
toIndentedString
(
name
)).
append
(
"\n"
);
sb
.
append
(
" version: "
).
append
(
toIndentedString
(
version
)).
append
(
"\n"
);
sb
.
append
(
" description: "
).
append
(
toIndentedString
(
description
)).
append
(
"\n"
);
sb
.
append
(
" toscaInterfaceType: "
).
append
(
toIndentedString
(
toscaInterfaceType
)).
append
(
"\n"
);
sb
.
append
(
"}"
);
return
sb
.
toString
();
}
...
...
drip-manager/src/main/java/nl/uva/sne/drip/service/DRIPService.java
View file @
95ab9ebe
...
...
@@ -17,6 +17,7 @@ import nl.uva.sne.drip.commons.utils.ToscaHelper;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.NodeTemplateMap
;
import
nl.uva.sne.drip.model.Provisioner
;
import
nl.uva.sne.drip.model.tosca.Credential
;
import
nl.uva.sne.drip.model.tosca.ToscaTemplate
;
import
nl.uva.sne.drip.rpc.DRIPCaller
;
...
...
@@ -45,6 +46,9 @@ public class DRIPService {
@Autowired
private
ToscaHelper
helper
;
@Autowired
ProvisionerService
provisionerService
;
private
String
execute
(
ToscaTemplate
toscaTemplate
)
throws
JsonProcessingException
,
ApiException
,
Exception
{
try
{
...
...
@@ -125,7 +129,7 @@ public class DRIPService {
List
<
NodeTemplateMap
>
vmTopologies
=
helper
.
getVMTopologyTemplates
();
List
<
Provisioner
>
provisioners
=
null
;
for
(
NodeTemplateMap
vmTopologyMap
:
vmTopologies
)
{
provisioners
=
provisionerService
.
find
ByProvider
(
provider
.
toLowerCase
()
);
provisioners
=
provisionerService
.
find
All
(
);
if
(
provisioners
!=
null
&&
provisioners
.
size
()
>
0
)
{
Provisioner
provisioner
=
getBestProvisioners
(
vmTopologyMap
.
getNodeTemplate
(),
provisioners
);
vmTopologyMap
=
helper
.
setProvisionerInterfaceInVMTopology
(
vmTopologyMap
,
provisioner
);
...
...
@@ -136,4 +140,8 @@ public class DRIPService {
}
private
Provisioner
getBestProvisioners
(
NodeTemplate
nodeTemplate
,
List
<
Provisioner
>
provisioners
)
{
return
provisioners
.
get
(
0
);
}
}
drip-manager/src/main/java/nl/uva/sne/drip/service/ProvisionerService.java
View file @
95ab9ebe
...
...
@@ -5,14 +5,10 @@
*/
package
nl
.
uva
.
sne
.
drip
.
service
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
nl.uva.sne.drip.dao.CredentialDAO
;
import
nl.uva.sne.drip.model.Provisioner
;
import
nl.uva.sne.drip.model.tosca.Credential
;
/**
*
...
...
@@ -21,13 +17,12 @@ import nl.uva.sne.drip.model.tosca.Credential;
@Service
public
class
ProvisionerService
{
public
List
<
Provisioner
>
findAll
()
{
List
<
Provisioner
>
all
=
new
ArrayList
<>();
Provisioner
provisioner
=
new
Provisioner
();
provisioner
.
provisioner
.
setName
(
"CloudsStorm"
);
provisioner
.
setDescription
(
"Interface for VM topology management with CloudsStorm. More at https://cloudsstorm.github.io/"
);
provisioner
.
setToscaInterfaceType
(
"tosca.interfaces.ARTICONF.CloudsStorm"
);
all
.
add
(
provisioner
);
return
all
;
}
...
...
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