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
0e54d79b
Commit
0e54d79b
authored
Jun 12, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed recursive method returns none
parent
fb075c17
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
__init__.cpython-36.pyc
..._planner2/src/planner/__pycache__/__init__.cpython-36.pyc
+0
-0
winery_planner.py
drip_planner2/src/planner/winery_planner.py
+8
-7
rpc_server.py
drip_planner2/src/rpc_server.py
+2
-2
No files found.
drip_planner2/src/planner/__pycache__/__init__.cpython-36.pyc
View file @
0e54d79b
No preview for this file type
drip_planner2/src/planner/
dum
_planner.py
→
drip_planner2/src/planner/
winery
_planner.py
View file @
0e54d79b
...
...
@@ -6,8 +6,9 @@ from toscaparser.tosca_template import ToscaTemplate
import
toscaparser.utils.yamlparser
import
urllib
import
urllib.parse
import
sys
class
Dump
Planner
:
class
Winery
Planner
:
service_template_names
=
[
'serviceTemplateOrNodeTypeOrNodeTypeImplementation'
]
topology_template_names
=
[
'topologyTemplate'
]
node_template_names
=
[
'nodeTemplates'
]
...
...
@@ -73,11 +74,13 @@ class DumpPlanner:
def
target_meets_requirement
(
self
,
target_relationship_element
,
requirement
):
node
=
self
.
get_node
(
target_relationship_element
)
print
(
node
)
if
'capabilities'
in
node
:
print
(
node
[
'capabilities'
]
)
print
(
'dddddddddddd'
)
else
:
supertypes
=
self
.
get_super_types
(
node
[
'type'
],
None
)
print
(
supertypes
)
# print(supertypes)
def
get_relationship_of_source_node
(
self
,
source_id
,
relationships
):
for
rel
in
relationships
:
...
...
@@ -98,7 +101,6 @@ class DumpPlanner:
for
node_template
in
node_templates
:
node_type
=
node_template
[
'type'
]
all_requirements
=
self
.
get_super_types_requirements
(
node_type
,
None
)
print
(
all_requirements
)
id
=
node_template
[
'id'
]
req
=
self
.
get_requirements
(
node_template
)
if
(
req
):
...
...
@@ -123,7 +125,7 @@ class DumpPlanner:
all_relationships
.
append
(
rel
)
return
all_relationships
def
get_super_types
(
self
,
component_type
,
supertypes
):
def
get_super_types
(
self
,
component_type
,
supertypes
):
if
(
supertypes
==
None
):
supertypes
=
[]
regex
=
r"\{(.*?)\}"
...
...
@@ -140,12 +142,11 @@ class DumpPlanner:
res
=
urllib
.
request
.
urlopen
(
req
,
timeout
=
5
)
res_body
=
res
.
read
()
component
=
json
.
loads
(
res_body
.
decode
(
"utf-8"
))
if
component
:
comp
=
component
[
'serviceTemplateOrNodeTypeOrNodeTypeImplementation'
][
0
]
supertypes
.
append
(
comp
)
if
'derivedFrom'
in
comp
:
supertypes
=
self
.
get_super_types
(
comp
[
'derivedFrom'
][
'typeRef'
],
supertypes
)
return
self
.
get_super_types
(
comp
[
'derivedFrom'
][
'typeRef'
],
supertypes
)
else
:
return
supertypes
...
...
drip_planner2/src/rpc_server.py
View file @
0e54d79b
...
...
@@ -8,7 +8,7 @@ import os
import
os.path
from
os.path
import
expanduser
import
pika
from
planner.
dum
_planner
import
*
from
planner.
winery
_planner
import
*
import
sys
import
tempfile
import
time
...
...
@@ -115,7 +115,7 @@ if __name__ == "__main__":
tosca_reposetory_api_base_url
=
"http://localhost:8080/winery"
namespace
=
"http
%253
A
%252
F
%252
Fsne.uva.nl
%252
Fservicetemplates"
servicetemplate_id
=
"wordpress_w1-wip1"
planner
=
Dump
Planner
(
tosca_reposetory_api_base_url
,
namespace
,
servicetemplate_id
)
planner
=
Winery
Planner
(
tosca_reposetory_api_base_url
,
namespace
,
servicetemplate_id
)
else
:
logger
.
info
(
"Input args: "
+
sys
.
argv
[
0
]
+
' '
+
sys
.
argv
[
1
]
+
' '
+
sys
.
argv
[
2
])
channel
=
init_chanel
(
sys
.
argv
)
...
...
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