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
8f218e37
Commit
8f218e37
authored
5 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added lifewatch tosca
parent
632a6a56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
84 deletions
+46
-84
lifeWatch_vre1.yaml
TOSCA/lifeWatch_vre1.yaml
+39
-64
planner.py
planner/planner/planner.py
+3
-14
test_planner.py
planner/test/test_planner.py
+4
-6
No files found.
TOSCA/lifeWatch_vre1.yaml
View file @
8f218e37
tosca_definitions_version
:
"
tosca_simple_yaml_1_0"
tosca_definitions_version
:
tosca_simple_yaml_1_0
description
:
"
TOSCA
example"
imports
:
-
nodes
:
"
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
-
data
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
-
capabilities
:
"
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
-
policies
:
"
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
-
interfaces
:
"
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
topology_template
:
imports
:
node_templates
:
-
nodes
:
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml
-
data
:
https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml
kubernetes
:
-
capabilities
:
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml
properties
:
-
policies
:
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml
min_masters_num
:
1
-
interfaces
:
https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml
min_workers_num
:
1
#requirements:
#- host:
#capability: "tosca.capabilities.ARTICONF.VM.topology"
#node: "topology"
#relationship: "tosca.relationships.HostedOn"
interfaces
:
Kubernetes
:
create
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/create_k8s.yml"
install
:
inputs
:
playbook
:
"
https://raw.githubusercontent.com/skoulouzis/CONF/develop/ansible_playbooks/install_k8s.yml"
type
:
"
tosca.nodes.ARTICONF.Orchestrator.Kubernetes"
#mysql:
#type: "tosca.nodes.ARTICONF.Container.Application.Docker"
#properties:
#environment:
#MYSQL_DATABASE: "wordpress"
#MYSQL_PASSWORD: "wordpress"
#MYSQL_ROOT_PASSWORD: "somewordpress"
#MYSQL_USER: "wordpress"
#ports:
#- "3306:3306"
#volumes:
#- "db_data:/var/lib/mysql"
#requirements:
#- host:
#capability: "tosca.capabilities.ARTICONF.docker.Orchestrator"
#node: "kubernetes"
#relationship: "tosca.relationships.HostedOn"
#artifacts:
#image:
#file: "mysql:5.7"
#repository: "docker_hub"
#type: "tosca.artifacts.Deployment.Image.Container.Docker"
#topology:
#properties:
#domain: "Frankfurt"
#provider: "EC2"
#interfaces:
#CloudsStorm:
#provision:
#inputs:
#code_type: "SEQ"
#object_type: "SubTopology"
#type: "tosca.nodes.ARTICONF.VM.topology"
repositories
:
docker_hub
:
https://hub.docker.com/
description
:
>
TOSCA example
topology_template
:
node_templates
:
ws-pema
:
type
:
tosca.nodes.ARTICONF.Container.Application.Docker
properties
:
ports
:
-
"
30001:8080"
artifacts
:
image
:
type
:
tosca.artifacts.Deployment.Image.Container.Docker
file
:
alogo53/ws-pema-lifewatch
repository
:
docker_hub
topology
:
type
:
tosca.nodes.ARTICONF.VM.topology
interfaces
:
CloudsStorm
:
provision
:
inputs
:
code_type
:
SEQ
object_type
:
SubTopology
properties
:
domain
:
UvA (Amsterdam, The Netherlands) XO Rack
provider
:
ExoGENI
This diff is collapsed.
Click to expand it.
planner/planner/planner.py
View file @
8f218e37
...
@@ -258,13 +258,9 @@ class Planner:
...
@@ -258,13 +258,9 @@ class Planner:
for
req
in
all_requirements
:
for
req
in
all_requirements
:
if
'capability'
in
req
[
next
(
iter
(
req
))]:
if
'capability'
in
req
[
next
(
iter
(
req
))]:
capability
=
req
[
next
(
iter
(
req
))][
'capability'
]
capability
=
req
[
next
(
iter
(
req
))][
'capability'
]
# Find nodes in node_templates that have the capability
# Find all nodes in the definitions that have the capability: capability
logger
.
info
(
' Looking for nodes in node_templates with capability: '
+
capability
)
logger
.
info
(
' Looking for nodes in node types with capability: '
+
capability
)
capable_nodes
=
self
.
get_node_templates_by_capability
(
capability
)
capable_nodes
=
self
.
get_node_types_by_capability
(
capability
)
if
not
capable_nodes
:
# Find all nodes in the definitions that have the capability: capability
logger
.
info
(
' Looking for nodes in node types with capability: '
+
capability
)
capable_nodes
=
self
.
get_node_types_by_capability
(
capability
)
if
capable_nodes
:
if
capable_nodes
:
# Add number of matching capabilities for each node.
# Add number of matching capabilities for each node.
# Try to score matching_nodes to return one. The more requirements a node meets the better
# Try to score matching_nodes to return one. The more requirements a node meets the better
...
@@ -299,10 +295,3 @@ class Planner:
...
@@ -299,10 +295,3 @@ class Planner:
if
parent_node_type_name
==
self
.
all_node_types
[
tosca_node_type
][
'derived_from'
]:
if
parent_node_type_name
==
self
.
all_node_types
[
tosca_node_type
][
'derived_from'
]:
child_nodes
[
tosca_node_type
]
=
self
.
all_node_types
[
tosca_node_type
]
child_nodes
[
tosca_node_type
]
=
self
.
all_node_types
[
tosca_node_type
]
return
child_nodes
return
child_nodes
def
get_node_templates_by_capability
(
self
,
capability
):
# capable_nodes = []
# for node_template in self.tosca_template.nodetemplates:
# for node_capability in node_template.get_capabilities():
# print(node_capability)
return
None
This diff is collapsed.
Click to expand it.
planner/test/test_planner.py
View file @
8f218e37
...
@@ -40,12 +40,10 @@ class MyTestCase(unittest.TestCase):
...
@@ -40,12 +40,10 @@ class MyTestCase(unittest.TestCase):
input_tosca_file_path
=
self
.
get_input_tosca_file_path
(
file_name
)
input_tosca_file_path
=
self
.
get_input_tosca_file_path
(
file_name
)
self
.
run_test
(
input_tosca_file_path
)
self
.
run_test
(
input_tosca_file_path
)
# def test_lifeWatch(self):
def
test_lifeWatch
(
self
):
# file_name = 'lifeWatch_vre1.yaml'
file_name
=
'lifeWatch_vre1.yaml'
# input_tosca_file_path = self.get_input_tosca_file_path(file_name)
input_tosca_file_path
=
self
.
get_input_tosca_file_path
(
file_name
)
# self.run_test(input_tosca_file_path)
self
.
run_test
(
input_tosca_file_path
)
def
get_input_tosca_file_path
(
self
,
file_name
):
def
get_input_tosca_file_path
(
self
,
file_name
):
tosca_path
=
"../../TOSCA/"
tosca_path
=
"../../TOSCA/"
...
...
This diff is collapsed.
Click to expand it.
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