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
f00d0c31
Commit
f00d0c31
authored
Jul 08, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added parser to dump yaml
parent
ad239a9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
TOSCA_parser.py
drip_planner2/src/utils/TOSCA_parser.py
+10
-4
No files found.
drip_planner2/src/utils/TOSCA_parser.py
View file @
f00d0c31
...
@@ -22,7 +22,8 @@ SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME,
...
@@ -22,7 +22,8 @@ SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME,
RELATIONSHIP_TYPES
,
RELATIONSHIP_TEMPLATES
,
RELATIONSHIP_TYPES
,
RELATIONSHIP_TEMPLATES
,
CAPABILITY_TYPES
,
ARTIFACT_TYPES
,
DATA_TYPES
,
INTERFACE_TYPES
,
CAPABILITY_TYPES
,
ARTIFACT_TYPES
,
DATA_TYPES
,
INTERFACE_TYPES
,
POLICY_TYPES
,
GROUP_TYPES
,
REPOSITORIES
,
INPUTS
,
NODE_TEMPLATES
,
POLICY_TYPES
,
GROUP_TYPES
,
REPOSITORIES
,
INPUTS
,
NODE_TEMPLATES
,
OUTPUTS
,
GROUPS
,
SUBSTITUION_MAPPINGS
,
POLICIES
,
TYPE
,
REQUIREMENTS
)
=
\
OUTPUTS
,
GROUPS
,
SUBSTITUION_MAPPINGS
,
POLICIES
,
TYPE
,
REQUIREMENTS
,
ARTIFACTS
,
PROPERTIES
)
=
\
(
'tosca_definitions_version'
,
'tosca_default_namespace'
,
(
'tosca_definitions_version'
,
'tosca_default_namespace'
,
'template_name'
,
'tosca_template'
,
'template_author'
,
'template_name'
,
'tosca_template'
,
'template_author'
,
'template_version'
,
'description'
,
'imports'
,
'dsl_definitions'
,
'template_version'
,
'description'
,
'imports'
,
'dsl_definitions'
,
...
@@ -30,7 +31,7 @@ SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME,
...
@@ -30,7 +31,7 @@ SECTIONS = (DEFINITION_VERSION, DEFAULT_NAMESPACE, TEMPLATE_NAME,
'capability_types'
,
'artifact_types'
,
'data_types'
,
'capability_types'
,
'artifact_types'
,
'data_types'
,
'interface_types'
,
'policy_types'
,
'group_types'
,
'repositories'
,
'interface_types'
,
'policy_types'
,
'group_types'
,
'repositories'
,
'inputs'
,
'node_templates'
,
'outputs'
,
'groups'
,
'substitution_mappings'
,
'inputs'
,
'node_templates'
,
'outputs'
,
'groups'
,
'substitution_mappings'
,
'policies'
,
'type'
,
'requirements'
)
'policies'
,
'type'
,
'requirements'
,
'artifacts'
,
'properties'
)
class
TOSCAParser
:
class
TOSCAParser
:
...
@@ -49,6 +50,7 @@ class TOSCAParser:
...
@@ -49,6 +50,7 @@ class TOSCAParser:
for
node_template
in
node_templates
:
for
node_template
in
node_templates
:
node_template_dict
=
self
.
get_node_template_dict
(
node_template
)
node_template_dict
=
self
.
get_node_template_dict
(
node_template
)
topology_dict
[
TOPOLOGY_TEMPLATE
][
NODE_TEMPLATES
][
node_template
.
name
]
=
node_template_dict
topology_dict
[
TOPOLOGY_TEMPLATE
][
NODE_TEMPLATES
][
node_template
.
name
]
=
node_template_dict
break
# If we don't add this then dump uses references for the same dictionary entries i.e. '&id001'
# If we don't add this then dump uses references for the same dictionary entries i.e. '&id001'
yaml
.
Dumper
.
ignore_aliases
=
lambda
*
args
:
True
yaml
.
Dumper
.
ignore_aliases
=
lambda
*
args
:
True
...
@@ -58,8 +60,12 @@ class TOSCAParser:
...
@@ -58,8 +60,12 @@ class TOSCAParser:
def
get_node_template_dict
(
self
,
node_template
):
def
get_node_template_dict
(
self
,
node_template
):
node_template_dict
=
{}
node_template_dict
=
{}
node_template_dict
[
TYPE
]
=
node_template
.
type
node_template_dict
[
TYPE
]
=
node_template
.
type
node_template_dict
[
REQUIREMENTS
]
=
{}
# node_template_dict[REQUIREMENTS] = {}
# requirement_list = []
node_template_dict
[
REQUIREMENTS
]
=
node_template
.
requirements
node_template_dict
[
REQUIREMENTS
]
=
node_template
.
requirements
node_template_dict
[
ARTIFACTS
]
=
node_template
.
templates
[
node_template
.
name
][
ARTIFACTS
]
node_template_dict
[
PROPERTIES
]
=
node_template
.
templates
[
node_template
.
name
][
PROPERTIES
]
print
(
dir
(
node_template
))
# print(node_template.templates)
return
node_template_dict
return
node_template_dict
\ 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