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
80d57fd6
Commit
80d57fd6
authored
Jul 01, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
look for capable nodes
parent
d40869d5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
nodes.yaml
TOSCA/types/nodes.yaml
+1
-2
basic_planner.py
drip_planner2/src/planner/basic_planner.py
+21
-5
No files found.
TOSCA/types/nodes.yaml
View file @
80d57fd6
...
...
@@ -33,7 +33,7 @@ node_types:
-
host
:
capability
:
tosca.capabilities.ARTICONF.Orchestrator
node
:
tosca.nodes.ARTICONF.Orchestrator
relationship
:
tosca.relationships.HostedOn
relationship
:
tosca.relationships.HostedOn
tosca.nodes.ARTICONF.Orchestrator
:
derived_from
:
tosca.nodes.SoftwareComponent
...
...
@@ -58,4 +58,3 @@ node_types:
relationship
:
tosca.relationships.HostedOn
drip_planner2/src/planner/basic_planner.py
View file @
80d57fd6
...
...
@@ -19,14 +19,21 @@ class BasicPlanner:
def
__init__
(
self
,
path
):
self
.
template
=
ToscaTemplate
(
path
)
self
.
tosca_node_types
=
self
.
template
.
nodetemplates
[
0
]
.
type_definition
.
TOSCA_DEF
self
.
all_custom_def
=
self
.
template
.
nodetemplates
[
0
]
.
custom_def
self
.
all_nodes
=
{}
self
.
all_nodes
.
update
(
self
.
tosca_node_types
.
items
())
self
.
all_nodes
.
update
(
self
.
all_custom_def
.
items
())
for
node
in
self
.
template
.
nodetemplates
:
capable_nodes
=
[]
missing_requirements
=
self
.
get_missing_requirements
(
node
)
print
(
missing_requirements
)
for
req
in
missing_requirements
:
for
key
in
req
:
capable_nodes
.
append
(
self
.
get_node_types_by_capability
(
req
[
key
][
'capability'
]))
node
.
requirements
.
append
(
req
)
# print(node.get_properties().keys()
)
# print((node.type_definition._get_node_type_by_cap('tosca.capabilities.ARTICONF.Orchestrator')))
print
(
'------------------'
)
# print(node.get_capabilities().keys)
...
...
@@ -49,4 +56,13 @@ class BasicPlanner:
if
node
.
parent_type
:
missing_requirements
=
missing_requirements
+
node
.
parent_type
.
requirements
return
missing_requirements
\ No newline at end of file
def
get_node_types_by_capability
(
self
,
cap
):
capable_nodes
=
[]
for
tosca_node
in
self
.
all_nodes
:
if
'capabilities'
in
self
.
all_nodes
[
tosca_node
]:
for
caps
in
self
.
all_nodes
[
tosca_node
][
'capabilities'
]:
if
self
.
all_nodes
[
tosca_node
][
'capabilities'
][
caps
][
'type'
]
==
cap
:
capable_nodes
.
append
(
tosca_node
)
return
capable_nodes
\ 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