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
c4e39763
Commit
c4e39763
authored
Oct 31, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lots of stuff
parent
a167ffb1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
337 additions
and
203 deletions
+337
-203
default_controller.py
...flask-server/sure_tosca/controllers/default_controller.py
+46
-49
topology_template.py
...tosca-flask-server/sure_tosca/models/topology_template.py
+5
-5
tosca_template.py
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
+1
-1
tosca_helper.py
sure_tosca-flask-server/sure_tosca/service/tosca_helper.py
+26
-0
tosca_template_service.py
...flask-server/sure_tosca/service/tosca_template_service.py
+211
-93
swagger.yaml
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
+37
-44
test_default_controller.py
...a-flask-server/sure_tosca/test/test_default_controller.py
+11
-11
No files found.
sure_tosca-flask-server/sure_tosca/controllers/default_controller.py
View file @
c4e39763
...
...
@@ -8,49 +8,49 @@ from sure_tosca import util
from
sure_tosca.service
import
tosca_template_service
def
get_all_ancestor_properties
(
id
,
node_
root_key
):
# noqa: E501
def
get_all_ancestor_properties
(
id
,
node_
name
):
# noqa: E501
"""
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: List[Dict[str, object]]
"""
return
tosca_template_service
.
get_all_ancestor_properties
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_all_ancestor_properties
(
id
,
node_
name
)
def
get_all_ancestor_types
(
id
,
node_
root_key
):
# noqa: E501
def
get_all_ancestor_types
(
id
,
node_
name
):
# noqa: E501
"""
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: List[str]
"""
return
tosca_template_service
.
get_all_ancestor_types
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_all_ancestor_types
(
id
,
node_
name
)
def
get_ancestors_requirements
(
id
,
node_
root_key
):
# noqa: E501
def
get_ancestors_requirements
(
id
,
node_
name
):
# noqa: E501
"""
Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: Dict[str, object]
"""
return
tosca_template_service
.
get_all_ancestors_requirements
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_all_ancestors_requirements
(
id
,
node_
name
)
def
get_dsl_definitions
(
id
,
anchors
=
None
,
derived_from
=
None
):
# noqa: E501
...
...
@@ -83,54 +83,52 @@ def get_imports(id): # noqa: E501
return
tosca_template_service
.
get_tosca_template_model_by_id
(
id
)
.
imports
def
get_node_outputs
(
id
,
node_
root_key
):
# noqa: E501
def
get_node_outputs
(
id
,
node_
name
):
# noqa: E501
"""
s # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: Dict[str, object]
"""
return
tosca_template_service
.
get_node_outputs
(
id
,
n
ame_key
=
node_root_key
)
return
tosca_template_service
.
get_node_outputs
(
id
,
n
ode_name
)
def
get_node_properties
(
id
,
node_
root_key
):
# noqa: E501
def
get_node_properties
(
id
,
node_
name
):
# noqa: E501
"""
s # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: Dict[str, object]
"""
return
tosca_template_service
.
get_node_
templates
(
id
,
name_key
=
node_root_key
)[
0
]
.
properties
return
tosca_template_service
.
get_node_
properties
(
id
,
node_name
)
def
get_node_requirements
(
id
,
node_
root_key
):
# noqa: E501
def
get_node_requirements
(
id
,
node_
name
):
# noqa: E501
"""get_node_requirements
Returns the requirements for an input node as described in the template not in the node's definition # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: Dict[str, object]
"""
return
tosca_template_service
.
get_node_
templates
(
id
,
name_key
=
node_root_key
)[
0
]
.
requirements
return
tosca_template_service
.
get_node_
requirements
(
id
,
node_name
)
def
get_node_templates
(
id
,
type_name
=
None
,
name_key
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
# noqa: E501
def
get_node_templates
(
id
,
type_name
=
None
,
node_name
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
# noqa: E501
"""get_node_templates
returns nodes templates in topology # noqa: E501
...
...
@@ -139,8 +137,8 @@ def get_node_templates(id, type_name=None, name_key=None, has_interfaces=None, h
:type id: str
:param type_name: The type
:type type_name: str
:param n
ame_key: the name key
:type n
ame_key
: str
:param n
ode_name: the name
:type n
ode_name
: str
:param has_interfaces: filter if has interfaces
:type has_interfaces: bool
:param has_properties: filter if has properties
...
...
@@ -158,56 +156,56 @@ def get_node_templates(id, type_name=None, name_key=None, has_interfaces=None, h
:rtype: List[NodeTemplate]
"""
return
tosca_template_service
.
get_node_templates
(
id
,
type_name
=
type_name
,
n
ame_key
=
name_key
,
return
tosca_template_service
.
get_node_templates
(
id
,
type_name
=
type_name
,
n
ode_name
=
node_name
,
has_interfaces
=
has_interfaces
,
has_properties
=
has_properties
,
has_attributes
=
has_attributes
,
has_requirements
=
has_requirements
,
has_capabilities
=
has_capabilities
,
has_artifacts
=
has_artifacts
,
derived_from
=
derived_from
)
def
get_node_type_name
(
id
,
node_
root_key
):
# noqa: E501
def
get_node_type_name
(
id
,
node_
name
):
# noqa: E501
"""
# noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: str
"""
return
tosca_template_service
.
get_node_type_name
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_node_type_name
(
id
,
node_
name
)
def
get_parent_type_name
(
id
,
node_
root_key
):
# noqa: E501
def
get_parent_type_name
(
id
,
node_
name
):
# noqa: E501
"""
# noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: str
"""
return
tosca_template_service
.
get_parent_type_name
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_parent_type_name
(
id
,
node_
name
)
def
get_related_nodes
(
id
,
node_
root_key
):
# noqa: E501
def
get_related_nodes
(
id
,
node_
name
):
# noqa: E501
"""
s # noqa: E501
:param id: ID of topolog template uplodaed
:type id: str
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype: List[NodeTemplate]
"""
return
tosca_template_service
.
get_related_nodes
(
id
,
node_
root_key
)
return
tosca_template_service
.
get_related_nodes
(
id
,
node_
name
)
def
get_relationship_templates
(
id
,
type_name
=
None
,
derived_from
=
None
):
# noqa: E501
...
...
@@ -253,8 +251,7 @@ def get_tosca_template(id): # noqa: E501
return
tosca_template_service
.
get_tosca_template_model_by_id
(
id
)
def
get_types
(
id
,
kind_of_type
=
None
,
has_interfaces
=
None
,
type_name
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
# noqa: E501
def
get_types
(
id
,
kind_of_type
=
None
,
has_interfaces
=
None
,
type_name
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
# noqa: E501
"""
returns the interface types # noqa: E501
...
...
@@ -289,7 +286,7 @@ def get_types(id, kind_of_type=None, has_interfaces=None, type_name=None, has_pr
derived_from
=
derived_from
)
def
set_node_properties
(
id
,
properties
,
node_
root_key
):
# noqa: E501
def
set_node_properties
(
id
,
properties
,
node_
name
):
# noqa: E501
"""
s # noqa: E501
...
...
@@ -298,12 +295,12 @@ def set_node_properties(id, properties, node_root_key): # noqa: E501
:type id: str
:param properties:
:type properties:
:param node_
root_key: node_root_key
:type node_
root_key
: str
:param node_
name: node_name
:type node_
name
: str
:rtype:
Dict[str, object]
:rtype:
NodeTemplate
"""
return
tosca_template_service
.
set_node_properties
(
id
,
properties
,
node_
root_key
)
return
tosca_template_service
.
set_node_properties
(
id
,
properties
,
node_
name
)
def
upload_tosca_template
(
file
):
# noqa: E501
...
...
sure_tosca-flask-server/sure_tosca/models/topology_template.py
View file @
c4e39763
...
...
@@ -3,10 +3,10 @@
from
__future__
import
absolute_import
from
datetime
import
date
,
datetime
# noqa: F401
from
toscaparser.nodetemplate
import
NodeTemplate
from
typing
import
List
,
Dict
# noqa: F401
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca.models.node_template
import
NodeTemplate
# noqa: F401,E501
from
sure_tosca
import
util
...
...
@@ -28,7 +28,7 @@ class TopologyTemplate(Model):
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:type relationship_templates: Dict[str, object]
:param outputs: The outputs of this TopologyTemplate. # noqa: E501
:type outputs:
Dict[str, object]
:type outputs:
str
:param groups: The groups of this TopologyTemplate. # noqa: E501
:type groups: Dict[str, object]
:param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501
...
...
@@ -41,7 +41,7 @@ class TopologyTemplate(Model):
'inputs'
:
List
[
Dict
[
str
,
object
]],
'node_templates'
:
Dict
[
str
,
NodeTemplate
],
'relationship_templates'
:
Dict
[
str
,
object
],
'outputs'
:
Dict
[
str
,
object
]
,
'outputs'
:
str
,
'groups'
:
Dict
[
str
,
object
],
'substitution_mappings'
:
Dict
[
str
,
object
],
'policies'
:
List
[
Dict
[
str
,
object
]]
...
...
@@ -168,7 +168,7 @@ class TopologyTemplate(Model):
:return: The outputs of this TopologyTemplate.
:rtype:
Dict[str, object]
:rtype:
str
"""
return
self
.
_outputs
...
...
@@ -178,7 +178,7 @@ class TopologyTemplate(Model):
:param outputs: The outputs of this TopologyTemplate.
:type outputs:
Dict[str, object]
:type outputs:
str
"""
self
.
_outputs
=
outputs
...
...
sure_tosca-flask-server/sure_tosca/models/tosca_template.py
View file @
c4e39763
...
...
@@ -3,10 +3,10 @@
from
__future__
import
absolute_import
from
datetime
import
date
,
datetime
# noqa: F401
from
toscaparser.topology_template
import
TopologyTemplate
from
typing
import
List
,
Dict
# noqa: F401
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca.models.topology_template
import
TopologyTemplate
# noqa: F401,E501
from
sure_tosca
import
util
...
...
sure_tosca-flask-server/sure_tosca/service/tosca_helper.py
View file @
c4e39763
...
...
@@ -106,6 +106,28 @@ def get_node_types_with_interface(nodes):
return
node_types_with_interface
def
node_dict_2_node_template
(
node_dict
,
all_custom_def
):
node_name
=
next
(
iter
(
node_dict
))
node_type
=
node_dict
[
node_name
][
'type'
]
# for name_to_remove in node_type_key_names_to_remove:
# if name_to_remove in node_dict[node_name][node_name]:
# node_dict[node_name].pop(name_to_remove)
node_template
=
NodeTemplate
(
node_name
,
node_templates
=
node_dict
,
custom_def
=
all_custom_def
)
# For some reason the tosca.nodes.ARTICONF.Orchestrator doesn't have all definitions so we need to add them
# manually. We get 'toscaparser.common.exception.InvalidTypeError: Type "tosca.nodes.ARTICONF.Orchestrator"
# is not a valid type.'
if
len
(
node_template
.
custom_def
)
<
len
(
all_custom_def
):
for
def_key
in
all_custom_def
:
if
isinstance
(
def_key
,
dict
):
node_template
.
custom_def
.
update
(
def_key
)
else
:
node_template
.
custom_def
[
def_key
]
=
all_custom_def
[
def_key
]
return
node_template
def
node_type_2_node_template
(
node_type
,
all_custom_def
):
node_template_dict
=
{}
type_name
=
next
(
iter
(
node_type
))
...
...
@@ -166,6 +188,10 @@ def contains_node_type(node_types_list, node_type_name):
def
get_node_properties
(
node
):
node_type_name
=
get_node_type_name
(
node
)
if
'properties'
in
node
[
node_type_name
]:
return
node
[
node_type_name
][
'properties'
]
if
'properties'
in
node
.
entity_tpl
:
return
node
.
entity_tpl
[
'properties'
]
return
node
[
node_type_name
][
'properties'
]
...
...
sure_tosca-flask-server/sure_tosca/service/tosca_template_service.py
View file @
c4e39763
...
...
@@ -3,9 +3,12 @@ import sys
import
uuid
import
yaml
from
tinydb.database
import
Document
from
tinydb.middlewares
import
CachingMiddleware
from
toscaparser.functions
import
GetAttribute
from
typing
import
re
from
sure_tosca.models.base_model_
import
Model
from
sure_tosca.models.node_template
import
NodeTemplate
as
NodeTemplateModel
from
sure_tosca.models.topology_template
import
TopologyTemplate
as
TopologyTemplateModel
from
sure_tosca.models.tosca_template
import
ToscaTemplate
as
ToscaTemplateModel
...
...
@@ -15,6 +18,7 @@ import tempfile
from
toscaparser.nodetemplate
import
NodeTemplate
from
toscaparser.tosca_template
import
ToscaTemplate
from
toscaparser.topology_template
import
TopologyTemplate
from
toscaparser.parameters
import
Output
from
tinydb.storages
import
MemoryStorage
from
functools
import
reduce
from
sure_tosca.service
import
tosca_helper
...
...
@@ -26,24 +30,29 @@ tosca_templates_db_file_path = os.path.join(db_dir_path, "tosca_templates.json")
tosca_templates_db
=
TinyDB
(
tosca_templates_db_file_path
)
# tosca_templates_db = TinyDB(storage=CachingMiddleware(MemoryStorage))
tmp_db
=
TinyDB
(
storage
=
CachingMiddleware
(
MemoryStorage
))
# interface_types_db = TinyDB(storage=CachingMiddleware(MemoryStorage))
node_template_db
=
TinyDB
(
storage
=
CachingMiddleware
(
MemoryStorage
))
dsl_definitions_db
=
TinyDB
(
storage
=
CachingMiddleware
(
MemoryStorage
))
relationship_template_db
=
TinyDB
(
storage
=
CachingMiddleware
(
MemoryStorage
))
interface_types_db
=
TinyDB
(
storage
=
CachingMiddleware
(
MemoryStorage
))
model_id_names
=
[
'id'
]
root_key
=
'root_key'
def
query_
tmp_db
(
queries
):
def
query_
db
(
queries
,
db
=
None
):
if
queries
:
query
=
reduce
(
lambda
a
,
b
:
a
&
b
,
queries
)
results
=
tmp_
db
.
search
(
query
)
results
=
db
.
search
(
query
)
else
:
results
=
tmp_
db
.
all
()
results
=
db
.
all
()
if
results
:
updated_results
=
[]
for
res
in
results
:
key
=
res
.
pop
(
root_key
)
node
=
{
key
:
res
}
if
root_key
in
res
:
key
=
res
.
pop
(
root_key
)
node
=
{
key
:
res
}
else
:
node
=
res
updated_results
.
append
(
node
)
return
updated_results
return
'Not Found'
,
404
...
...
@@ -74,13 +83,29 @@ def get_tosca_template_dict_by_id(id):
return
'Not Found'
,
404
def
deTOSCAfy_topology_template
(
dictionary
):
# outputs out of nowhere is instantiated as GetAttribute
if
'outputs'
in
dictionary
[
'topology_template'
]:
outputs
=
dictionary
[
'topology_template'
][
'outputs'
]
for
output_name
in
outputs
:
output
=
outputs
[
output_name
]
if
isinstance
(
output
[
'value'
],
GetAttribute
):
args
=
output
[
'value'
]
.
args
assert
isinstance
(
args
,
list
)
output
[
'value'
]
=
{
'get_attribute'
:
args
}
return
dictionary
def
save
(
file
):
try
:
# tosca_template_file_path = os.path.join(db_dir_path, file.filename)
tosca_template_dict
=
yaml
.
safe_load
(
file
.
stream
)
tosca_template_model
=
ToscaTemplateModel
.
from_dict
(
tosca_template_dict
)
tosca_template
=
ToscaTemplate
(
yaml_dict_tpl
=
tosca_template_dict
)
dictionary
=
yaml
.
safe_load
(
file
.
stream
)
tosca_template
=
ToscaTemplate
(
yaml_dict_tpl
=
dictionary
)
dictionary
=
deTOSCAfy_topology_template
(
dictionary
)
tosca_template_model
=
ToscaTemplateModel
.
from_dict
(
dictionary
)
doc_id
=
str
(
uuid
.
uuid4
())
tosca_template_dict_with_id
=
{
model_id_names
[
0
]:
doc_id
}
...
...
@@ -94,76 +119,94 @@ def save(file):
def
get_interface_types
(
id
,
interface_type
=
None
):
i
nterface_types
=
get_tosca_template_model_by_id
(
id
)
.
interface_types
tmp_db
.
purge
()
if
interface_types
:
for
interface_type_name
in
interface_types
:
interface
=
{
root_key
:
interface_type_name
}
interface
.
update
(
interface_types
[
interface_type_name
])
i
f
len
(
interface_types_db
)
<=
1
:
interface_types
=
get_tosca_template_model_by_id
(
id
)
.
interface_types
if
interface_types
:
for
interface_type_name
in
interface_types
:
interface
=
{
root_key
:
interface_type_name
}
interface
.
update
(
interface_types
[
interface_type_name
])
queries
=
[]
if
interface_type
:
query
=
Query
()
queries
.
append
(
query
.
_n
ame_key
==
interface_type
)
queries
.
append
(
query
.
_n
ode_nme
==
interface_type
)
return
query_
tmp_db
(
queries
)
return
query_
db
(
queries
,
db
=
interface_types_db
)
def
get_node_templates
(
id
,
type_name
=
None
,
name_key
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
def
get_node_templates
(
id
,
type_name
=
None
,
node_name
=
None
,
has_interfaces
=
None
,
has_properties
=
None
,
has_attributes
=
None
,
has_requirements
=
None
,
has_capabilities
=
None
,
has_artifacts
=
None
,
derived_from
=
None
):
tmp_db
.
purge
()
object_list
=
get_tosca_template_model_by_id
(
id
)
.
topology_template
.
node_templates
if
object_list
:
for
key
in
object_list
:
node
=
{
root_key
:
key
}
node
.
update
(
object_list
[
key
]
.
to_dict
())
tmp_db
.
insert
(
node
)
queries
=
[]
if
name_key
:
query
=
Query
()
queries
.
append
(
query
.
root_key
==
name_key
)
if
type_name
:
query
=
Query
()
queries
.
append
(
query
.
type
==
type_name
)
if
derived_from
:
query
=
Query
()
queries
.
append
(
query
.
derived_from
==
derived_from
)
if
has_properties
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
properties
!=
prop
)
if
has_interfaces
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
interfaces
!=
prop
)
if
has_attributes
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
attributes
!=
prop
)
if
has_requirements
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
requirements
!=
prop
)
if
has_capabilities
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
capabilities
!=
prop
)
if
has_artifacts
:
# tmp_db.purge()
if
len
(
node_template_db
)
<=
1
:
tosca_template_model
=
get_tosca_template_model_by_id
(
id
)
object_list
=
tosca_template_model
.
topology_template
.
node_templates
# tosca_template = get_tosca_template(tosca_template_model.to_dict())
# tosca_node_types = tosca_template.nodetemplates[0].type_definition.TOSCA_DEF
# all_custom_def = tosca_template.nodetemplates[0].custom_def
# object_list.update(tosca_node_types)
# object_list.update(all_custom_def)
if
object_list
:
for
key
in
object_list
:
node
=
{
root_key
:
key
}
if
isinstance
(
object_list
[
key
],
dict
):
node
.
update
(
object_list
[
key
])
elif
isinstance
(
object_list
[
key
],
Model
):
node
.
update
(
object_list
[
key
]
.
to_dict
())
node_template_db
.
insert
(
node
)
queries
=
[]
if
node_name
:
if
isinstance
(
node_name
,
list
):
for
n
in
node_name
:
query
=
Query
()
queries
.
append
(
query
.
root_key
==
n
)
elif
isinstance
(
node_name
,
str
):
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
artifacts
!=
prop
)
queries
.
append
(
query
.
root_key
==
node_name
)
if
type_name
:
query
=
Query
()
queries
.
append
(
query
.
type
==
type_name
)
if
derived_from
:
query
=
Query
()
queries
.
append
(
query
.
derived_from
==
derived_from
)
if
has_properties
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
properties
!=
prop
)
if
has_interfaces
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
interfaces
!=
prop
)
if
has_attributes
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
attributes
!=
prop
)
if
has_requirements
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
requirements
!=
prop
)
if
has_capabilities
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
capabilities
!=
prop
)
if
has_artifacts
:
query
=
Query
()
prop
=
None
queries
.
append
(
query
.
artifacts
!=
prop
)
query_results
=
query_
tmp_db
(
queries
)
query_results
=
query_
db
(
queries
,
db
=
node_template_db
)
return
query_results
def
get_tosca_template_get_dsl_definitions
(
id
,
anchors
,
derived_from
):
tmp_db
.
purge
()
object_list
=
get_tosca_template_model_by_id
(
id
)
.
dsl_definitions
if
object_list
:
for
key
in
object_list
:
node
=
{
key
:
object_list
[
key
]}
tmp_db
.
insert
(
node
)
# interface_types_db.purge()
if
len
(
dsl_definitions_db
)
<=
1
:
object_list
=
get_tosca_template_model_by_id
(
id
)
.
dsl_definitions
if
object_list
:
for
key
in
object_list
:
node
=
{
key
:
object_list
[
key
]}
interface_types_db
.
insert
(
node
)
queries
=
[]
if
derived_from
:
...
...
@@ -172,17 +215,18 @@ def get_tosca_template_get_dsl_definitions(id, anchors, derived_from):
if
anchors
:
for
anchor
in
anchors
:
query
=
Query
()
queries
.
append
(
query
.
anchor
==
anchor
)
return
query_
tmp_db
(
queries
)
return
query_
db
(
queries
,
db
=
dsl_definitions_db
)
def
get_relationship_templates
(
id
,
type_name
,
derived_from
):
tmp_db
.
purge
()
object_list
=
get_tosca_template_model_by_id
(
id
)
.
relationship_templates
if
object_list
:
for
key
in
object_list
:
node
=
{
key
:
object_list
[
key
]}
tmp
_db
.
insert
(
node
)
def
get_relationship_templates
(
id
,
type_name
=
None
,
derived_from
=
None
):
if
len
(
relationship_template_db
)
<=
1
:
object_list
=
get_tosca_template_model_by_id
(
id
)
.
relationship_templates
if
object_list
:
for
key
in
object_list
:
node
=
{
key
:
object_list
[
key
]}
relationship_template
_db
.
insert
(
node
)
queries
=
[]
if
derived_from
:
...
...
@@ -192,10 +236,10 @@ def get_relationship_templates(id, type_name, derived_from):
query
=
Query
()
queries
.
append
(
query
.
type
==
type_name
)
return
query_
tmp_db
(
queries
)
return
query_
db
(
queries
,
db
=
relationship_template_db
)
def
find_node_template
(
id
,
node_root_key
):
def
node_dict_2_node_template
(
id
,
node_name
):
tosca_template_dict
=
get_tosca_template_dict_by_id
(
id
)
tosca_template
=
get_tosca_template
(
tosca_template_dict
)
tosca_node_types
=
tosca_template
.
nodetemplates
[
0
]
.
type_definition
.
TOSCA_DEF
...
...
@@ -204,25 +248,23 @@ def find_node_template(id, node_root_key):
all_node_types
.
update
(
tosca_node_types
.
items
())
all_node_types
.
update
(
all_custom_def
.
items
())
the_node
=
None
for
node
in
tosca_template
.
nodetemplates
:
if
node
.
name
==
node_root_key
:
the_node
=
node
break
if
not
the_node
:
template
=
all_node_types
[
node_root_key
]
the_node
=
tosca_helper
.
node_type_2_node_template
({
node_root_key
:
template
},
all_custom_def
)
return
the_node
,
all_node_types
,
all_custom_def
node_template_dict
=
get_node_templates
(
id
,
node_name
=
node_name
)[
0
]
node_template_dict
=
{
node_name
:
node_template_dict
}
if
isinstance
(
node_template_dict
,
dict
):
the_node
=
tosca_helper
.
node_dict_2_node_template
(
node_template_dict
,
all_node_types
)
return
the_node
,
all_node_types
,
all_custom_def
return
None
def
get_all_ancestors_requirements
(
id
,
node_root_key
):
the_node
,
all_node_types
,
all_custom_def
=
find
_node_template
(
id
,
node_root_key
)
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2
_node_template
(
id
,
node_root_key
)
parent_requirements
=
tosca_helper
.
get_all_ancestors_requirements
(
the_node
,
all_node_types
,
all_custom_def
)
return
parent_requirements
def
get_all_ancestor_properties
(
id
,
node_root_key
):
the_node
,
all_node_types
,
all_custom_def
=
find
_node_template
(
id
,
node_root_key
)
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2
_node_template
(
id
,
node_root_key
)
properties
=
tosca_helper
.
get_all_ancestors_properties
(
the_node
,
all_node_types
,
all_custom_def
)
properties_list
=
[]
for
prop
in
properties
:
...
...
@@ -232,16 +274,92 @@ def get_all_ancestor_properties(id, node_root_key):
def
get_all_ancestor_types
(
id
,
node_root_key
):
the_node
,
all_node_types
,
all_custom_def
=
find_node_template
(
id
,
node_root_key
)
try
:
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2_node_template
(
id
,
node_root_key
)
except
Exception
as
e
:
return
'Not Found'
,
404
all_ancestor_types
=
tosca_helper
.
get_all_ancestors_types
(
the_node
,
all_node_types
,
all_custom_def
)
return
all_ancestor_types
def
get_parent_type_name
(
id
,
node_root_key
):
the_node
,
all_node_types
,
all_custom_def
=
find_node_template
(
id
,
node_root_key
)
try
:
the_node
,
all_node_types
,
all_custom_def
=
node_dict_2_node_template
(
id
,
node_root_key
)
except
Exception
as
e
:
return
'Not Found'
,
404
return
tosca_helper
.
get_parent_type
(
the_node
)
def
get_node_outputs
(
id
,
name_key
):
outputs
=
get_tosca_template_model_by_id
(
id
)
.
topology_template
.
outputs
return
None
def
get_node_outputs
(
id
,
node_nme
):
matching_outputs
=
{}
matching_output_names
=
[]
tosca_template_dict
=
get_tosca_template_dict_by_id
(
id
)
tosca_template
=
get_tosca_template
(
tosca_template_dict
)
outputs
=
tosca_template
.
topology_template
.
outputs
for
output
in
outputs
:
if
node_nme
==
output
.
value
.
node_template_name
:
matching_output_names
.
append
(
output
.
name
)
tosca_template_model
=
ToscaTemplateModel
.
from_dict
(
deTOSCAfy_topology_template
(
tosca_template_dict
))
for
matching_output_name
in
matching_output_names
:
matching_outputs
[
matching_output_name
]
=
tosca_template_model
.
topology_template
.
outputs
[
matching_output_name
]
return
matching_outputs
def
get_node_properties
(
id
,
node_name
):
node_template_dict
=
get_node_templates
(
id
,
node_name
=
node_name
)[
0
]
if
node_name
in
node_template_dict
:
node_template_dict
=
node_template_dict
[
node_name
]
properties
=
NodeTemplateModel
.
from_dict
(
node_template_dict
)
.
properties
if
properties
:
return
properties
return
'Not Found'
,
404
def
get_node_requirements
(
id
,
node_name
):
node_template_dict
=
get_node_templates
(
id
,
node_name
=
node_name
)[
0
]
if
node_name
in
node_template_dict
:
node_template_dict
=
node_template_dict
[
node_name
]
requirements
=
NodeTemplateModel
.
from_dict
(
node_template_dict
)
.
requirements
if
requirements
:
return
requirements
return
'Not Found'
,
404
def
get_related_nodes
(
id
,
node_name
):
tosca_template_dict
=
get_tosca_template_dict_by_id
(
id
)
tosca_template
=
get_tosca_template
(
tosca_template_dict
)
related_node_names
=
[]
for
node_template
in
tosca_template
.
topology_template
.
nodetemplates
:
if
node_template
.
name
==
node_name
:
related_nodes
=
node_template
.
related_nodes
for
related_node
in
related_nodes
:
related_node_names
.
append
(
related_node
.
name
)
related_nodes
=
[]
for
name
in
related_node_names
:
related_node
=
get_node_templates
(
id
,
node_name
=
name
)
related_nodes
.
append
(
related_node
)
return
related_nodes
def
get_node_type_name
(
id
,
node_name
):
node_template_dict
=
get_node_templates
(
id
,
node_name
=
node_name
)[
0
]
if
node_name
in
node_template_dict
:
node_template_dict
=
node_template_dict
[
node_name
]
type_name
=
NodeTemplateModel
.
from_dict
(
node_template_dict
)
.
type
if
type_name
:
return
type_name
return
'Not Found'
,
404
def
set_node_properties
(
id
,
properties
,
node_name
):
node_template_dict
=
get_node_templates
(
id
,
node_name
=
node_name
)[
0
]
if
node_name
in
node_template_dict
:
node_template_dict
=
node_template_dict
[
node_name
]
return
None
\ No newline at end of file
sure_tosca-flask-server/sure_tosca/swagger/swagger.yaml
View file @
c4e39763
...
...
@@ -286,9 +286,9 @@ paths:
description
:
"
The
type"
required
:
false
type
:
"
string"
-
name
:
"
n
ame_key
"
-
name
:
"
n
ode_name
"
in
:
"
query"
description
:
"
the
name
key
"
description
:
"
the
name"
required
:
false
type
:
"
string"
-
name
:
"
has_interfaces"
...
...
@@ -338,7 +338,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/type_name
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/type_name
:
get
:
summary
:
"
"
description
:
"
"
...
...
@@ -351,9 +351,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -366,7 +366,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/requirements
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/requirements
:
get
:
description
:
"
Returns
the
requirements
for
an
input
node
as
described
in
the
\
\
template
not
in
the
node's
definition
"
...
...
@@ -379,9 +379,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -397,7 +397,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/derived_from
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/derived_from
:
get
:
summary
:
"
"
description
:
"
"
...
...
@@ -410,9 +410,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -425,7 +425,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/ancestors_requirements
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/ancestors_requirements
:
get
:
summary
:
"
"
description
:
"
Recursively
get
all
requirements
all
the
way
to
the
ROOT
including
\
...
...
@@ -439,9 +439,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -457,7 +457,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/ancestors_types
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/ancestors_types
:
get
:
summary
:
"
"
description
:
"
Recursively
get
all
requirements
all
the
way
to
the
ROOT
including
\
...
...
@@ -471,9 +471,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -488,7 +488,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/ancestors_properties
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/ancestors_properties
:
get
:
summary
:
"
"
description
:
"
Recursively
get
all
requirements
all
the
way
to
the
ROOT
including
\
...
...
@@ -502,9 +502,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -522,7 +522,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/properties
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/properties
:
get
:
summary
:
"
"
description
:
"
s"
...
...
@@ -535,9 +535,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -571,26 +571,24 @@ paths:
schema
:
type
:
"
object"
additionalProperties
:
type
:
"
string"
-
name
:
"
node_root_key"
type
:
"
object"
properties
:
{}
-
name
:
"
node_name"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
200
:
description
:
"
successful
operation"
schema
:
type
:
"
object"
additionalProperties
:
type
:
"
object"
properties
:
{}
$ref
:
"
#/definitions/NodeTemplate"
404
:
description
:
"
Not
found"
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/outputs
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/outputs
:
get
:
summary
:
"
"
description
:
"
s"
...
...
@@ -603,9 +601,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -621,7 +619,7 @@ paths:
405
:
description
:
"
Invalid
input"
x-swagger-router-controller
:
"
sure_tosca.controllers.default_controller"
/tosca_template/{id}/topology_template/node_templates/{node_
root_key
}/related
:
/tosca_template/{id}/topology_template/node_templates/{node_
name
}/related
:
get
:
summary
:
"
"
description
:
"
s"
...
...
@@ -634,9 +632,9 @@ paths:
description
:
"
ID
of
topolog
template
uplodaed"
required
:
true
type
:
"
string"
-
name
:
"
node_
root_key
"
-
name
:
"
node_
name
"
in
:
"
path"
description
:
"
node_
root_key
"
description
:
"
node_
name
"
required
:
true
type
:
"
string"
responses
:
...
...
@@ -736,8 +734,7 @@ definitions:
policy_types
:
key
:
"
policy_types"
topology_template
:
outputs
:
key
:
"
{}"
outputs
:
"
outputs"
substitution_mappings
:
key
:
"
{}"
inputs
:
...
...
@@ -821,10 +818,7 @@ definitions:
type
:
"
object"
properties
:
{}
outputs
:
type
:
"
object"
additionalProperties
:
type
:
"
object"
properties
:
{}
type
:
"
string"
groups
:
type
:
"
object"
additionalProperties
:
...
...
@@ -843,8 +837,7 @@ definitions:
type
:
"
object"
properties
:
{}
example
:
outputs
:
key
:
"
{}"
outputs
:
"
outputs"
substitution_mappings
:
key
:
"
{}"
inputs
:
...
...
sure_tosca-flask-server/sure_tosca/test/test_default_controller.py
View file @
c4e39763
...
...
@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/ancestors_properties'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/ancestors_properties'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -31,7 +31,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/ancestors_types'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/ancestors_types'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -42,7 +42,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/ancestors_requirements'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/ancestors_requirements'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -78,7 +78,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/outputs'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/outputs'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -89,7 +89,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/properties'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/properties'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -100,7 +100,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/requirements'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/requirements'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -111,7 +111,7 @@ class TestDefaultController(BaseTestCase):
"""
query_string
=
[(
'type_name'
,
'type_name_example'
),
(
'n
ame_key'
,
'name_key
_example'
),
(
'n
ode_name'
,
'node_name
_example'
),
(
'has_interfaces'
,
true
),
(
'has_properties'
,
true
),
(
'has_attributes'
,
true
),
...
...
@@ -132,7 +132,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/type_name'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/type_name'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -143,7 +143,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/derived_from'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/derived_from'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -154,7 +154,7 @@ class TestDefaultController(BaseTestCase):
"""
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/related'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/related'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'GET'
)
self
.
assert200
(
response
,
'Response body is : '
+
response
.
data
.
decode
(
'utf-8'
))
...
...
@@ -223,7 +223,7 @@ class TestDefaultController(BaseTestCase):
"""
properties
=
None
response
=
self
.
client
.
open
(
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
root_key}/properties'
.
format
(
id
=
'id_example'
,
node_root_key
=
'node_root_key
_example'
),
'/tosca-sure/1.0.0/tosca_template/{id}/topology_template/node_templates/{node_
name}/properties'
.
format
(
id
=
'id_example'
,
node_name
=
'node_name
_example'
),
method
=
'PUT'
,
data
=
json
.
dumps
(
properties
),
content_type
=
'application/json'
)
...
...
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