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
0962d33f
Commit
0962d33f
authored
Oct 25, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added interfaces import
parent
f5f5c03c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
69 additions
and
46 deletions
+69
-46
application_example.yaml
TOSCA/application_example.yaml
+1
-1
application_example_output.yaml
TOSCA/application_example_output.yaml
+1
-0
application_example_provisioned.yml
TOSCA/application_example_provisioned.yml
+1
-0
application_example_updated.yaml
TOSCA/application_example_updated.yaml
+1
-0
NodeTemplateFactory.java
...va/nl/uva/sne/drip/commons/utils/NodeTemplateFactory.java
+0
-34
TOSCAUtils.java
...c/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
+1
-1
Credentials.java
...mons/src/main/java/nl/uva/sne/drip/model/Credentials.java
+16
-2
NodeTemplate.java
...ons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
+1
-1
ToscaTemplate.java
...ns/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
+15
-1
.swagger.yaml.kate-swp
drip-manager/.swagger.yaml.kate-swp
+0
-0
ProvisionerService.java
...main/java/nl/uva/sne/drip/service/ProvisionerService.java
+16
-6
ServiceTests.java
...r/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
+16
-0
No files found.
TOSCA/application_example.yaml
View file @
0962d33f
...
...
@@ -4,7 +4,7 @@ imports:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml
repositories
:
docker_hub
:
https://hub.docker.com/
...
...
TOSCA/application_example_output.yaml
View file @
0962d33f
...
...
@@ -3,6 +3,7 @@ imports:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml
topology_template
:
node_templates
:
compute
:
...
...
TOSCA/application_example_provisioned.yml
View file @
0962d33f
...
...
@@ -4,6 +4,7 @@ imports:
-
{
nodes
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml'
}
-
{
capabilities
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml'
}
-
{
policies
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml'
}
-
{
interfaces
:
'
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml'
}
topology_template
:
node_templates
:
concepcion_topology
:
...
...
TOSCA/application_example_updated.yaml
View file @
0962d33f
...
...
@@ -4,6 +4,7 @@ imports:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/nodes.yaml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/DRIP/DRIP_3.0/TOSCA/types/interfaces.yml
repositories
:
docker_hub
:
https://hub.docker.com/
...
...
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/NodeTemplateFactory.java
deleted
100644 → 0
View file @
f5f5c03c
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
commons
.
utils
;
import
java.util.Map
;
import
nl.uva.sne.drip.model.NodeTemplate
;
/**
*
* @author S. Koulouzis
*/
class
NodeTemplateFactory
{
static
NodeTemplate
create
(
Map
.
Entry
node
)
{
NodeTemplate
nodeTemplate
=
new
NodeTemplate
();
Map
<
String
,
Object
>
nodeMap
=
(
Map
<
String
,
Object
>)
node
.
getValue
();
nodeTemplate
.
setArtifacts
((
Map
<
String
,
Object
>)
nodeMap
.
get
(
"artifacts"
));
return
null
;
}
}
drip-commons/src/main/java/nl/uva/sne/drip/commons/utils/TOSCAUtils.java
View file @
0962d33f
...
...
@@ -31,7 +31,7 @@ import nl.uva.sne.drip.model.ToscaTemplate;
*/
public
class
TOSCAUtils
{
p
ublic
static
List
<
Map
<
String
,
NodeTemplate
>>
getNodes
(
ToscaTemplate
toscaTemplate
,
String
filterType
,
String
filterValue
)
{
p
rivate
static
List
<
Map
<
String
,
NodeTemplate
>>
getNodes
(
ToscaTemplate
toscaTemplate
,
String
filterType
,
String
filterValue
)
{
boolean
byType
=
false
;
boolean
byName
=
false
;
switch
(
filterType
)
{
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/Credentials.java
View file @
0962d33f
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -7,14 +9,19 @@ import java.util.HashMap;
import
java.util.Map
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
org.springframework.data.annotation.Id
;
/**
* Credentials
*/
@Validated
@javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
Credentials
{
@Id
@JsonIgnore
private
String
id
;
@JsonProperty
(
"protocol"
)
private
String
protocol
=
null
;
...
...
@@ -38,7 +45,14 @@ public class Credentials {
this
.
protocol
=
protocol
;
return
this
;
}
@JsonIgnore
public
String
getId
()
{
return
id
;
}
public
void
setID
(
String
id
)
{
this
.
id
=
id
;
}
/**
* Get protocol
* @return protocol
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/NodeTemplate.java
View file @
0962d33f
...
...
@@ -179,7 +179,7 @@ public class NodeTemplate {
public
NodeTemplate
putInterfacesItem
(
String
key
,
Object
interfacesItem
)
{
if
(
this
.
interfaces
==
null
)
{
this
.
interfaces
=
new
HashMap
<
String
,
Object
>();
this
.
interfaces
=
new
HashMap
<>();
}
this
.
interfaces
.
put
(
key
,
interfacesItem
);
return
this
;
...
...
drip-commons/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
View file @
0962d33f
package
nl
.
uva
.
sne
.
drip
.
model
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
java.util.Objects
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -9,14 +11,19 @@ import java.util.List;
import
java.util.Map
;
import
org.springframework.validation.annotation.Validated
;
import
javax.validation.Valid
;
import
org.springframework.data.annotation.Id
;
/**
* ToscaTemplate
*/
@Validated
@
javax
.
annotation
.
Generated
(
value
=
"io.swagger.codegen.languages.SpringCodegen"
,
date
=
"2019-10-25T14:09:25.182Z"
)
@
JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
ToscaTemplate
{
@Id
@JsonIgnore
private
String
id
;
@JsonProperty
(
"tosca_definitions_version"
)
private
String
toscaDefinitionsVersion
=
null
;
...
...
@@ -87,7 +94,14 @@ public class ToscaTemplate {
this
.
toscaDefinitionsVersion
=
toscaDefinitionsVersion
;
return
this
;
}
@JsonIgnore
public
String
getId
()
{
return
id
;
}
public
void
setID
(
String
id
)
{
this
.
id
=
id
;
}
/**
* Get toscaDefinitionsVersion
* @return toscaDefinitionsVersion
...
...
drip-manager/.swagger.yaml.kate-swp
deleted
100644 → 0
View file @
f5f5c03c
File deleted
drip-manager/src/main/java/nl/uva/sne/drip/service/ProvisionerService.java
View file @
0962d33f
...
...
@@ -13,6 +13,7 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.commons.utils.TOSCAUtils
;
import
nl.uva.sne.drip.model.Message
;
import
nl.uva.sne.drip.model.NodeTemplate
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
...
...
@@ -39,16 +40,25 @@ public class ProvisionerService {
String
ymlToscaTemplate
=
toscaTemplateService
.
findByID
(
id
);
ToscaTemplate
toscaTemplate
=
toscaTemplateService
.
getYaml2ToscaTemplate
(
ymlToscaTemplate
);
List
<
Map
.
Entry
>
vmTopologies
=
getVmTopologies
(
toscaTemplate
);
for
(
Map
.
Entry
topology:
vmTopologies
){
topology
.
}
toscaTemplate
=
addProvisionInterface
(
toscaTemplate
);
return
null
;
}
p
ublic
List
<
Map
.
Entry
>
getVmTopologies
(
ToscaTemplate
toscaTemplate
)
{
p
rivate
List
<
Map
<
String
,
NodeTemplate
>
>
getVmTopologies
(
ToscaTemplate
toscaTemplate
)
{
return
TOSCAUtils
.
getNodesByType
(
toscaTemplate
,
"tosca.nodes.ARTICONF.VM.topology"
);
}
protected
ToscaTemplate
addProvisionInterface
(
ToscaTemplate
toscaTemplate
)
{
List
<
Map
<
String
,
NodeTemplate
>>
vmTopologies
=
getVmTopologies
(
toscaTemplate
);
for
(
Map
<
String
,
NodeTemplate
>
vmTopologyMap
:
vmTopologies
)
{
NodeTemplate
vmTopology
=
vmTopologyMap
.
get
(
vmTopologyMap
.
keySet
().
iterator
().
next
());
Map
<
String
,
Object
>
interfaces
=
vmTopology
.
getInterfaces
();
}
return
toscaTemplate
;
}
}
drip-manager/src/test/java/nl/uva/sne/drip/service/ServiceTests.java
View file @
0962d33f
...
...
@@ -61,10 +61,14 @@ public class ServiceTests {
private
String
testApplicationExampleToscaContents
;
private
static
final
String
testApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example.yaml"
;
private
static
final
String
testUpdatedApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_updated.yaml"
;
private
static
final
String
testOutputApplicationExampleToscaFilePath
=
".."
+
File
.
separator
+
"TOSCA"
+
File
.
separator
+
"application_example_updated.yaml"
;
@Autowired
CredentialService
credentialService
;
private
String
credentialID
;
@Autowired
ProvisionerService
provisionService
;
@Autowired
private
WebApplicationContext
wac
;
...
...
@@ -324,4 +328,16 @@ public class ServiceTests {
int
size
=
credentialService
.
getAllIds
().
size
();
assertEquals
(
0
,
size
);
}
@Test
public
void
testProvisionerServiceProvision
()
{
FileInputStream
in
=
new
FileInputStream
(
testApplicationExampleToscaFilePath
);
MultipartFile
file
=
new
MockMultipartFile
(
"file"
,
in
);
toscaTemplateID
=
toscaTemplateService
.
saveFile
(
file
);
provisionService
.
addProvisionInterface
(
toscaTemplate
);
}
}
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