Commit c4e39763 authored by Spiros Koulouzis's avatar Spiros Koulouzis

lots of stuff

parent a167ffb1
...@@ -8,49 +8,49 @@ from sure_tosca import util ...@@ -8,49 +8,49 @@ from sure_tosca import util
from sure_tosca.service import tosca_template_service 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 Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: List[Dict[str, object]] :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 Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: List[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 Recursively get all requirements all the way to the ROOT including the input node's # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: Dict[str, object] :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 def get_dsl_definitions(id, anchors=None, derived_from=None): # noqa: E501
...@@ -83,54 +83,52 @@ def get_imports(id): # noqa: E501 ...@@ -83,54 +83,52 @@ def get_imports(id): # noqa: E501
return tosca_template_service.get_tosca_template_model_by_id(id).imports 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 s # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: Dict[str, object] :rtype: Dict[str, object]
""" """
return tosca_template_service.get_node_outputs(id, name_key=node_root_key) return tosca_template_service.get_node_outputs(id, node_name)
def get_node_properties(id, node_root_key): # noqa: E501 def get_node_properties(id, node_name): # noqa: E501
""" """
s # noqa: E501 s # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: Dict[str, object] :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 """get_node_requirements
Returns the requirements for an input node as described in the template not in the node's definition # noqa: E501 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 :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: Dict[str, object] :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, 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
has_requirements=None, has_capabilities=None, has_artifacts=None,
derived_from=None): # noqa: E501
"""get_node_templates """get_node_templates
returns nodes templates in topology # noqa: E501 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 ...@@ -139,8 +137,8 @@ def get_node_templates(id, type_name=None, name_key=None, has_interfaces=None, h
:type id: str :type id: str
:param type_name: The type :param type_name: The type
:type type_name: str :type type_name: str
:param name_key: the name key :param node_name: the name
:type name_key: str :type node_name: str
:param has_interfaces: filter if has interfaces :param has_interfaces: filter if has interfaces
:type has_interfaces: bool :type has_interfaces: bool
:param has_properties: filter if has properties :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 ...@@ -158,56 +156,56 @@ def get_node_templates(id, type_name=None, name_key=None, has_interfaces=None, h
:rtype: List[NodeTemplate] :rtype: List[NodeTemplate]
""" """
return tosca_template_service.get_node_templates(id, type_name=type_name, name_key=name_key, return tosca_template_service.get_node_templates(id, type_name=type_name, node_name=node_name,
has_interfaces=has_interfaces, has_properties=has_properties, has_interfaces=has_interfaces, has_properties=has_properties,
has_attributes=has_attributes, has_requirements=has_requirements, has_attributes=has_attributes, has_requirements=has_requirements,
has_capabilities=has_capabilities, has_artifacts=has_artifacts, has_capabilities=has_capabilities, has_artifacts=has_artifacts,
derived_from=derived_from) 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 # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: 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 # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: 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 s # noqa: E501
:param id: ID of topolog template uplodaed :param id: ID of topolog template uplodaed
:type id: str :type id: str
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :type node_name: str
:rtype: List[NodeTemplate] :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 def get_relationship_templates(id, type_name=None, derived_from=None): # noqa: E501
...@@ -253,8 +251,7 @@ def get_tosca_template(id): # noqa: E501 ...@@ -253,8 +251,7 @@ def get_tosca_template(id): # noqa: E501
return tosca_template_service.get_tosca_template_model_by_id(id) 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, 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
has_requirements=None, has_capabilities=None, has_artifacts=None, derived_from=None): # noqa: E501
""" """
returns the interface types # 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 ...@@ -289,7 +286,7 @@ def get_types(id, kind_of_type=None, has_interfaces=None, type_name=None, has_pr
derived_from=derived_from) 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 s # noqa: E501
...@@ -298,12 +295,12 @@ def set_node_properties(id, properties, node_root_key): # noqa: E501 ...@@ -298,12 +295,12 @@ def set_node_properties(id, properties, node_root_key): # noqa: E501
:type id: str :type id: str
:param properties: :param properties:
:type properties: :type properties:
:param node_root_key: node_root_key :param node_name: node_name
:type node_root_key: str :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 def upload_tosca_template(file): # noqa: E501
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from datetime import date, datetime # noqa: F401 from datetime import date, datetime # noqa: F401
from toscaparser.nodetemplate import NodeTemplate
from typing import List, Dict # noqa: F401 from typing import List, Dict # noqa: F401
from sure_tosca.models.base_model_ import Model from sure_tosca.models.base_model_ import Model
from sure_tosca.models.node_template import NodeTemplate # noqa: F401,E501
from sure_tosca import util from sure_tosca import util
...@@ -28,7 +28,7 @@ class TopologyTemplate(Model): ...@@ -28,7 +28,7 @@ class TopologyTemplate(Model):
:param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501 :param relationship_templates: The relationship_templates of this TopologyTemplate. # noqa: E501
:type relationship_templates: Dict[str, object] :type relationship_templates: Dict[str, object]
:param outputs: The outputs of this TopologyTemplate. # noqa: E501 :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 :param groups: The groups of this TopologyTemplate. # noqa: E501
:type groups: Dict[str, object] :type groups: Dict[str, object]
:param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501 :param substitution_mappings: The substitution_mappings of this TopologyTemplate. # noqa: E501
...@@ -41,7 +41,7 @@ class TopologyTemplate(Model): ...@@ -41,7 +41,7 @@ class TopologyTemplate(Model):
'inputs': List[Dict[str, object]], 'inputs': List[Dict[str, object]],
'node_templates': Dict[str, NodeTemplate], 'node_templates': Dict[str, NodeTemplate],
'relationship_templates': Dict[str, object], 'relationship_templates': Dict[str, object],
'outputs': Dict[str, object], 'outputs': str,
'groups': Dict[str, object], 'groups': Dict[str, object],
'substitution_mappings': Dict[str, object], 'substitution_mappings': Dict[str, object],
'policies': List[Dict[str, object]] 'policies': List[Dict[str, object]]
...@@ -168,7 +168,7 @@ class TopologyTemplate(Model): ...@@ -168,7 +168,7 @@ class TopologyTemplate(Model):
:return: The outputs of this TopologyTemplate. :return: The outputs of this TopologyTemplate.
:rtype: Dict[str, object] :rtype: str
""" """
return self._outputs return self._outputs
...@@ -178,7 +178,7 @@ class TopologyTemplate(Model): ...@@ -178,7 +178,7 @@ class TopologyTemplate(Model):
:param outputs: The outputs of this TopologyTemplate. :param outputs: The outputs of this TopologyTemplate.
:type outputs: Dict[str, object] :type outputs: str
""" """
self._outputs = outputs self._outputs = outputs
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
from __future__ import absolute_import from __future__ import absolute_import
from datetime import date, datetime # noqa: F401 from datetime import date, datetime # noqa: F401
from toscaparser.topology_template import TopologyTemplate
from typing import List, Dict # noqa: F401 from typing import List, Dict # noqa: F401
from sure_tosca.models.base_model_ import Model from sure_tosca.models.base_model_ import Model
from sure_tosca.models.topology_template import TopologyTemplate # noqa: F401,E501
from sure_tosca import util from sure_tosca import util
......
...@@ -106,6 +106,28 @@ def get_node_types_with_interface(nodes): ...@@ -106,6 +106,28 @@ def get_node_types_with_interface(nodes):
return node_types_with_interface 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): def node_type_2_node_template(node_type, all_custom_def):
node_template_dict = {} node_template_dict = {}
type_name = next(iter(node_type)) type_name = next(iter(node_type))
...@@ -166,6 +188,10 @@ def contains_node_type(node_types_list, node_type_name): ...@@ -166,6 +188,10 @@ def contains_node_type(node_types_list, node_type_name):
def get_node_properties(node): def get_node_properties(node):
node_type_name = get_node_type_name(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'] return node[node_type_name]['properties']
......
...@@ -286,9 +286,9 @@ paths: ...@@ -286,9 +286,9 @@ paths:
description: "The type" description: "The type"
required: false required: false
type: "string" type: "string"
- name: "name_key" - name: "node_name"
in: "query" in: "query"
description: "the name key" description: "the name"
required: false required: false
type: "string" type: "string"
- name: "has_interfaces" - name: "has_interfaces"
...@@ -338,7 +338,7 @@ paths: ...@@ -338,7 +338,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "" description: ""
...@@ -351,9 +351,9 @@ paths: ...@@ -351,9 +351,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -366,7 +366,7 @@ paths: ...@@ -366,7 +366,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
description: "Returns the requirements for an input node as described in the\ description: "Returns the requirements for an input node as described in the\
\ template not in the node's definition " \ template not in the node's definition "
...@@ -379,9 +379,9 @@ paths: ...@@ -379,9 +379,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -397,7 +397,7 @@ paths: ...@@ -397,7 +397,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "" description: ""
...@@ -410,9 +410,9 @@ paths: ...@@ -410,9 +410,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -425,7 +425,7 @@ paths: ...@@ -425,7 +425,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "Recursively get all requirements all the way to the ROOT including\ description: "Recursively get all requirements all the way to the ROOT including\
...@@ -439,9 +439,9 @@ paths: ...@@ -439,9 +439,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -457,7 +457,7 @@ paths: ...@@ -457,7 +457,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "Recursively get all requirements all the way to the ROOT including\ description: "Recursively get all requirements all the way to the ROOT including\
...@@ -471,9 +471,9 @@ paths: ...@@ -471,9 +471,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -488,7 +488,7 @@ paths: ...@@ -488,7 +488,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "Recursively get all requirements all the way to the ROOT including\ description: "Recursively get all requirements all the way to the ROOT including\
...@@ -502,9 +502,9 @@ paths: ...@@ -502,9 +502,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -522,7 +522,7 @@ paths: ...@@ -522,7 +522,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "s" description: "s"
...@@ -535,9 +535,9 @@ paths: ...@@ -535,9 +535,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -571,26 +571,24 @@ paths: ...@@ -571,26 +571,24 @@ paths:
schema: schema:
type: "object" type: "object"
additionalProperties: additionalProperties:
type: "string" type: "object"
- name: "node_root_key" properties: {}
- name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
200: 200:
description: "successful operation" description: "successful operation"
schema: schema:
type: "object" $ref: "#/definitions/NodeTemplate"
additionalProperties:
type: "object"
properties: {}
404: 404:
description: "Not found" description: "Not found"
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "s" description: "s"
...@@ -603,9 +601,9 @@ paths: ...@@ -603,9 +601,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -621,7 +619,7 @@ paths: ...@@ -621,7 +619,7 @@ paths:
405: 405:
description: "Invalid input" description: "Invalid input"
x-swagger-router-controller: "sure_tosca.controllers.default_controller" 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: get:
summary: "" summary: ""
description: "s" description: "s"
...@@ -634,9 +632,9 @@ paths: ...@@ -634,9 +632,9 @@ paths:
description: "ID of topolog template uplodaed" description: "ID of topolog template uplodaed"
required: true required: true
type: "string" type: "string"
- name: "node_root_key" - name: "node_name"
in: "path" in: "path"
description: "node_root_key" description: "node_name"
required: true required: true
type: "string" type: "string"
responses: responses:
...@@ -736,8 +734,7 @@ definitions: ...@@ -736,8 +734,7 @@ definitions:
policy_types: policy_types:
key: "policy_types" key: "policy_types"
topology_template: topology_template:
outputs: outputs: "outputs"
key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
...@@ -821,10 +818,7 @@ definitions: ...@@ -821,10 +818,7 @@ definitions:
type: "object" type: "object"
properties: {} properties: {}
outputs: outputs:
type: "object" type: "string"
additionalProperties:
type: "object"
properties: {}
groups: groups:
type: "object" type: "object"
additionalProperties: additionalProperties:
...@@ -843,8 +837,7 @@ definitions: ...@@ -843,8 +837,7 @@ definitions:
type: "object" type: "object"
properties: {} properties: {}
example: example:
outputs: outputs: "outputs"
key: "{}"
substitution_mappings: substitution_mappings:
key: "{}" key: "{}"
inputs: inputs:
......
...@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase): ...@@ -20,7 +20,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -31,7 +31,7 @@ class TestDefaultController(BaseTestCase): ...@@ -31,7 +31,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -42,7 +42,7 @@ class TestDefaultController(BaseTestCase): ...@@ -42,7 +42,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -78,7 +78,7 @@ class TestDefaultController(BaseTestCase): ...@@ -78,7 +78,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -89,7 +89,7 @@ class TestDefaultController(BaseTestCase): ...@@ -89,7 +89,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -100,7 +100,7 @@ class TestDefaultController(BaseTestCase): ...@@ -100,7 +100,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -111,7 +111,7 @@ class TestDefaultController(BaseTestCase): ...@@ -111,7 +111,7 @@ class TestDefaultController(BaseTestCase):
""" """
query_string = [('type_name', 'type_name_example'), query_string = [('type_name', 'type_name_example'),
('name_key', 'name_key_example'), ('node_name', 'node_name_example'),
('has_interfaces', true), ('has_interfaces', true),
('has_properties', true), ('has_properties', true),
('has_attributes', true), ('has_attributes', true),
...@@ -132,7 +132,7 @@ class TestDefaultController(BaseTestCase): ...@@ -132,7 +132,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -143,7 +143,7 @@ class TestDefaultController(BaseTestCase): ...@@ -143,7 +143,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -154,7 +154,7 @@ class TestDefaultController(BaseTestCase): ...@@ -154,7 +154,7 @@ class TestDefaultController(BaseTestCase):
""" """
response = self.client.open( 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') method='GET')
self.assert200(response, self.assert200(response,
'Response body is : ' + response.data.decode('utf-8')) 'Response body is : ' + response.data.decode('utf-8'))
...@@ -223,7 +223,7 @@ class TestDefaultController(BaseTestCase): ...@@ -223,7 +223,7 @@ class TestDefaultController(BaseTestCase):
""" """
properties = None properties = None
response = self.client.open( 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', method='PUT',
data=json.dumps(properties), data=json.dumps(properties),
content_type='application/json') content_type='application/json')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment