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
ab6a1a17
Commit
ab6a1a17
authored
Mar 03, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed policies
parent
ae0db377
Changes
17
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
732 additions
and
1867 deletions
+732
-1867
application_example_updated.yaml
TOSCA/application_example_updated.yaml
+1
-1
lifeWatch_vre1.yaml
TOSCA/lifeWatch_vre1.yaml
+35
-16
nodes.yaml
TOSCA/types/nodes.yaml
+1
-1
docker-compose.yml
docker-compose.yml
+20
-20
NodeTemplate.yml
openAPI/schema/TOSCA/NodeTemplate.yml
+1
-1
planner.py
planner/planner/planner.py
+41
-29
requirements.txt
sure_tosca-flask-server/requirements.txt
+11
-7
setup.py
sure_tosca-flask-server/setup.py
+1
-1
__main__.py
sure_tosca-flask-server/sure_tosca/__main__.py
+1
-1
default_controller-1.py
...ask-server/sure_tosca/controllers/default_controller-1.py
+444
-0
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+19
-389
__init__.py
sure_tosca-flask-server/sure_tosca/models/__init__.py
+1
-1
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+3
-297
tosca_type_service.py
...sca-flask-server/sure_tosca/service/tosca_type_service.py
+10
-0
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+106
-750
test_default_controller.py
...a-flask-server/sure_tosca/test/test_default_controller.py
+36
-352
test-requirements.txt
sure_tosca-flask-server/test-requirements.txt
+1
-1
No files found.
TOSCA/application_example_updated.yaml
View file @
ab6a1a17
...
...
@@ -2,7 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0
imports
:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/nodes.yaml
-
data
:
https://raw.githubusercontent.com/skoulouzis/CONF/
DRIP_3.0
/TOSCA/types/data.yml
-
data
:
https://raw.githubusercontent.com/skoulouzis/CONF/
develop
/TOSCA/types/data.yml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/interfaces.yml
...
...
TOSCA/lifeWatch_vre1.yaml
View file @
ab6a1a17
tosca_definitions_version
:
tosca_simple_yaml_1_0
description
:
TOSCA example
imports
:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/nodes.yaml
-
data
:
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/TOSCA/types/data.yml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/interfaces.yml
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/nodes.yaml
-
data
:
https://raw.githubusercontent.com/skoulouzis/CONF/DRIP_3.0/TOSCA/types/data.yml
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/capabilities.yaml
-
policies
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/policies.yaml
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/interfaces.yml
repositories
:
docker_hub
:
https://hub.docker.com/
topology_template
:
node_templates
:
description
:
>
TOSCA example
topology_template
:
#topology:
#interfaces:
#CloudsStorm:
#provision:
#inputs:
#code_type: SEQ
#object_type: SubTopology
#properties:
#domain: UvA (Amsterdam, The Netherlands) XO Rack
#provider: ExoGENI
#type: tosca.nodes.ARTICONF.VM.topology
node_templates
:
ws-pema-lifewatch
:
type
:
tosca.nodes.ARTICONF.Container.Application.Docker
properties
:
...
...
@@ -27,4 +35,15 @@ topology_template:
type
:
tosca.artifacts.Deployment.Image.Container.Docker
file
:
alogo53/ws-pema-lifewatch
repository
:
docker_hub
requirements
:
-
host
:
capability
:
tosca.capabilities.ARTICONF.docker.Orchestrator
node
:
kubernetes
relationship
:
tosca.relationships.HostedOn
kubernetes
:
type
:
tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes
properties
:
min_masters_num
:
1
min_workers_num
:
1
TOSCA/types/nodes.yaml
View file @
ab6a1a17
docker-compose.yml
View file @
ab6a1a17
...
...
@@ -14,13 +14,13 @@ services:
-
"
4369:4369"
-
"
15671:15671"
planner
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/planner:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
#
planner:
#
depends_on:
#
- rabbit
#
- sure-tosca
#
image: alogo53/planner:3.0.0
#
environment:
#
RABBITMQ_HOST: rabbit
provisioner
:
depends_on
:
...
...
@@ -52,17 +52,17 @@ services:
ports
:
-
"
30000:8080"
sure-tosca
:
image
:
alogo53/sure-tosca:3.0.0
ports
:
-
"
8081:8081"
#logspout:
#sure-tosca:
#image: alogo53/sure-tosca:3.0.0
#ports:
#- "30002:80"
#volumes:
#- /etc/hostname:/etc/host_hostname:ro
#- /var/run/docker.sock:/var/run/docker.sock
#environment:
#publish: "127.0.0.1:30002:80"
#image: gliderlabs/logspout:latest
#- "8081:8081"
logspout
:
ports
:
-
"
30002:80"
volumes
:
-
/etc/hostname:/etc/host_hostname:ro
-
/var/run/docker.sock:/var/run/docker.sock
environment
:
publish
:
"
127.0.0.1:30002:80"
image
:
gliderlabs/logspout:latest
openAPI/schema/TOSCA/NodeTemplate.yml
View file @
ab6a1a17
planner/planner/planner.py
View file @
ab6a1a17
...
...
@@ -12,6 +12,33 @@ from service.simple_spec_alayzer import SimpleAnalyzer
from
util
import
tosca_helper
def
add_requirements
(
node
,
missing_requirements
,
capable_node_name
):
"""Add the requirements to the node """
for
req
in
missing_requirements
:
req
[
next
(
iter
(
req
))][
'node'
]
=
capable_node_name
if
isinstance
(
node
,
NodeTemplate
):
contains_requirement
=
False
for
node_requirement
in
node
.
requirements
:
if
node_requirement
==
req
:
contains_requirement
=
True
break
if
not
contains_requirement
:
node
.
requirements
.
append
(
req
)
elif
isinstance
(
node
,
dict
):
type_name
=
next
(
iter
(
node
))
if
'requirements'
not
in
node
[
type_name
]:
node
[
type_name
][
'requirements'
]
=
[]
node_requirements
=
node
[
type_name
][
'requirements'
]
contains_requirement
=
False
for
node_requirement
in
node_requirements
:
if
node_requirement
==
req
:
contains_requirement
=
True
break
if
not
contains_requirement
:
node
[
type_name
][
'requirements'
]
.
append
(
req
)
return
node
class
Planner
:
def
__init__
(
self
,
tosca_path
=
None
,
yaml_dict_tpl
=
None
,
spec_service
=
None
):
...
...
@@ -105,7 +132,7 @@ class Planner:
matching_node_type_name
=
next
(
iter
(
matching_node
))
matching_node_template
=
tosca_helper
.
node_type_2_node_template
(
matching_node
,
self
.
all_custom_def
)
# Add the requirements to the node we analyzed. e.g. docker needed host now we added the type and name of host
node
=
self
.
add_requirements
(
node
,
all_requirements
,
matching_node_template
.
name
)
node
=
add_requirements
(
node
,
all_requirements
,
matching_node_template
.
name
)
if
not
tosca_helper
.
contains_node_type
(
self
.
required_nodes
,
matching_node_type_name
)
and
\
not
tosca_helper
.
contains_node_type
(
self
.
tosca_template
.
nodetemplates
,
matching_node_type_name
):
logging
.
info
(
' Adding: '
+
str
(
matching_node_template
.
name
))
...
...
@@ -179,11 +206,15 @@ class Planner:
def
find_best_node_for_requirements
(
self
,
all_requirements
):
"""Returns the 'best' node for a set of requirements. Here we count the number of requiremets that the node
can cover and return the one which covers the most """
# Check if we have a preference from policies
matching_nodes
=
{}
number_of_matching_requirement
=
{}
for
req
in
all_requirements
:
if
'capability'
in
req
[
next
(
iter
(
req
))]:
capability
=
req
[
next
(
iter
(
req
))][
'capability'
]
logging
.
info
(
' Looking for nodes with capability: '
+
capability
)
# Check if we already cover the requirements within the topology
capable_nodes
=
self
.
get_node_templates_by_capability
(
capability
)
# Loop requirements to find nodes per requirement
for
req
in
all_requirements
:
if
'capability'
in
req
[
next
(
iter
(
req
))]:
...
...
@@ -226,28 +257,9 @@ class Planner:
child_nodes
[
tosca_node_type
]
=
self
.
all_node_types
[
tosca_node_type
]
return
child_nodes
def
add_requirements
(
self
,
node
,
missing_requirements
,
capable_node_name
):
"""Add the requirements to the node """
for
req
in
missing_requirements
:
req
[
next
(
iter
(
req
))][
'node'
]
=
capable_node_name
if
isinstance
(
node
,
NodeTemplate
):
contains_requirement
=
False
for
node_requirement
in
node
.
requirements
:
if
node_requirement
==
req
:
contains_requirement
=
True
break
if
not
contains_requirement
:
node
.
requirements
.
append
(
req
)
elif
isinstance
(
node
,
dict
):
type_name
=
next
(
iter
(
node
))
if
'requirements'
not
in
node
[
type_name
]:
node
[
type_name
][
'requirements'
]
=
[]
node_requirements
=
node
[
type_name
][
'requirements'
]
contains_requirement
=
False
for
node_requirement
in
node_requirements
:
if
node_requirement
==
req
:
contains_requirement
=
True
break
if
not
contains_requirement
:
node
[
type_name
][
'requirements'
]
.
append
(
req
)
return
node
def
get_node_templates_by_capability
(
self
,
capability
):
candidate_nodes
=
{}
for
node
in
self
.
tosca_template
.
nodetemplates
:
if
node
.
type
.
startswith
(
'tosca.nodes'
):
tosca_helper
.
get_all_ancestors_types
()
return
capable_nodes
sure_tosca-flask-server/requirements.txt
View file @
ab6a1a17
werkzeug==1.0.0
PyYAML
wheel==0.33.6
connexion == 2.4.0
python-dateutil == 2.8.0
typing == 3.7.4.1
swagger-ui-bundle == 0.0.5
tinydb == 3.15.1
tosca-parser ==1.6.1
wheel==0.34.2
connexion==2.6.0
python-dateutil==2.8.1
typing==3.7.4.1
swagger-ui-bundle==0.0.6
# tinydb==3.15.1
tosca-parser ==1.7.0
sure_tosca-flask-server/setup.py
View file @
ab6a1a17
...
...
@@ -4,7 +4,7 @@ import sys
from
setuptools
import
setup
,
find_packages
NAME
=
"sure_tosca"
VERSION
=
"1.
0
.0"
VERSION
=
"1.
2
.0"
# To install the library, run the following
#
...
...
sure_tosca-flask-server/sure_tosca/__main__.py
View file @
ab6a1a17
#!/usr/bin/env python
#!/usr/bin/env python
3
import
connexion
...
...
sure_tosca-flask-server/sure_tosca/controllers/default_controller-1.py
0 → 100644
View file @
ab6a1a17
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
ab6a1a17
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/sure_tosca/models/__init__.py
View file @
ab6a1a17
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
ab6a1a17
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/sure_tosca/service/tosca_type_service.py
0 → 100644
View file @
ab6a1a17
from
sure_tosca.models.node_template
import
NodeTemplateModel
# noqa: E501
from
sure_tosca.models.node_template_map
import
NodeTemplateMapModel
# noqa: E501
from
sure_tosca.models.tosca_template
import
ToscaTemplateModel
# noqa: E501
def
add_type_definition
(
definition_map
):
return
None
def
get_types
(
query
):
return
None
\ No newline at end of file
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
ab6a1a17
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/sure_tosca/test/test_default_controller.py
View file @
ab6a1a17
This diff is collapsed.
Click to expand it.
sure_tosca-flask-server/test-requirements.txt
View file @
ab6a1a17
...
...
@@ -4,4 +4,4 @@ coverage==5.0.3
nose>=1.3.7
pluggy>=0.13.1
randomize>=0.14
Werkzeug==0.16.1
\ No newline at end of file
werkzeug==1.0.0
\ 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