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
ad703cc7
Commit
ad703cc7
authored
Oct 11, 2017
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split to methods
parent
3b41ac2a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
rpc_server.py
drip_parser/src/rpc_server.py
+2
-0
docker_compose_transformer.py
drip_parser/src/transformer/docker_compose_transformer.py
+16
-8
docker_compose_transformer.pyc
drip_parser/src/transformer/docker_compose_transformer.pyc
+0
-0
No files found.
drip_parser/src/rpc_server.py
View file @
ad703cc7
...
@@ -73,6 +73,8 @@ if __name__ == "__main__":
...
@@ -73,6 +73,8 @@ if __name__ == "__main__":
home
=
expanduser
(
"~"
)
home
=
expanduser
(
"~"
)
transformer
=
DockerComposeTransformer
(
home
+
"/workspace/DRIP/docs/input_tosca_files/MOG_cardif.yml"
)
transformer
=
DockerComposeTransformer
(
home
+
"/workspace/DRIP/docs/input_tosca_files/MOG_cardif.yml"
)
transformer
.
getnerate_compose
()
transformer
.
getnerate_compose
()
# print sys.argv
# print sys.argv
# channel = init_chanel(sys.argv)
# channel = init_chanel(sys.argv)
# global queue_name
# global queue_name
...
...
drip_parser/src/transformer/docker_compose_transformer.py
View file @
ad703cc7
...
@@ -8,12 +8,12 @@ class DockerComposeTransformer:
...
@@ -8,12 +8,12 @@ class DockerComposeTransformer:
def
__init__
(
self
,
tosca_file_path
):
def
__init__
(
self
,
tosca_file_path
):
self
.
yaml_dict_tpl
=
toscaparser
.
utils
.
yamlparser
.
load_yaml
(
tosca_file_path
)
self
.
yaml_dict_tpl
=
toscaparser
.
utils
.
yamlparser
.
load_yaml
(
tosca_file_path
)
self
.
errors
=
[]
self
.
errors
=
[]
self
.
w
o
rnings
=
[]
self
.
w
a
rnings
=
[]
self
.
tt
=
None
self
.
tt
=
None
try
:
try
:
self
.
tt
=
ToscaTemplate
(
path
=
None
,
yaml_dict_tpl
=
self
.
yaml_dict_tpl
)
self
.
tt
=
ToscaTemplate
(
path
=
None
,
yaml_dict_tpl
=
self
.
yaml_dict_tpl
)
except
:
except
:
self
.
w
o
rnings
.
append
(
"Not a valid tosca file"
)
self
.
w
a
rnings
.
append
(
"Not a valid tosca file"
)
self
.
DOCKER_TYPE
=
'Switch.nodes.Application.Container.Docker'
self
.
DOCKER_TYPE
=
'Switch.nodes.Application.Container.Docker'
...
@@ -23,19 +23,27 @@ class DockerComposeTransformer:
...
@@ -23,19 +23,27 @@ class DockerComposeTransformer:
else
:
else
:
self
.
analyze_yaml
()
self
.
analyze_yaml
()
def
get_node_types
(
self
):
return
self
.
yaml_dict_tpl
[
'node_types'
]
def
analyze_yaml
(
self
):
def
get_docker_types
(
self
):
node_types
=
self
.
yaml_dict_tpl
[
'node_types'
]
docker_types
=
[]
docker_types
=
[]
node_types
=
self
.
get_node_types
()
for
node_type_key
in
node_types
:
for
node_type_key
in
node_types
:
if
node_types
[
node_type_key
]
and
'derived_from'
in
node_types
[
node_type_key
]
.
keys
():
if
node_types
[
node_type_key
]
and
'derived_from'
in
node_types
[
node_type_key
]
.
keys
():
if
node_types
[
node_type_key
][
'derived_from'
]
==
self
.
DOCKER_TYPE
:
if
node_types
[
node_type_key
][
'derived_from'
]
==
self
.
DOCKER_TYPE
:
docker_types
.
append
(
node_type_key
)
docker_types
.
append
(
node_type_key
)
node_templates
=
self
.
yaml_dict_tpl
[
'topology_template'
][
'node_templates'
]
return
docker_types
def
get_node_templates
(
self
):
return
self
.
yaml_dict_tpl
[
'topology_template'
][
'node_templates'
]
def
analyze_yaml
(
self
):
docker_types
=
self
.
get_docker_types
()
node_templates
=
self
.
get_node_templates
()
services
=
{}
services
=
{}
for
node_template_key
in
node_templates
:
for
node_template_key
in
node_templates
:
# print node_templates[node_template_key]
for
docker_type
in
docker_types
:
for
docker_type
in
docker_types
:
if
docker_type
in
node_templates
[
node_template_key
][
'type'
]:
if
docker_type
in
node_templates
[
node_template_key
][
'type'
]:
if
'artifacts'
in
node_templates
[
node_template_key
]:
if
'artifacts'
in
node_templates
[
node_template_key
]:
...
...
drip_parser/src/transformer/docker_compose_transformer.pyc
View file @
ad703cc7
No preview for this file type
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