summaryrefslogtreecommitdiffstats
path: root/tosca2heat
diff options
context:
space:
mode:
authorjulien zhang <zhang.jun3g@zte.com.cn>2016-07-08 06:06:58 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-08 06:06:58 +0000
commit7fe3011a67a239f7dc04153c54eaff78ef967eaf (patch)
tree029563d117ae964f06db9b05f714ed548d90d2be /tosca2heat
parent870d910efa510e768b19785ec677ddb731c49bb0 (diff)
parent74924a61a1fefe5e4977cd8d9edf7e5bbbb9f966 (diff)
Merge "netsted template validate type error"
Diffstat (limited to 'tosca2heat')
-rw-r--r--tosca2heat/tosca-parser/toscaparser/elements/tosca_type_validation.py5
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/system.yaml3
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py5
-rw-r--r--tosca2heat/tosca-parser/toscaparser/topology_template.py1
-rw-r--r--tosca2heat/tosca-parser/toscaparser/tosca_template.py14
5 files changed, 14 insertions, 14 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/elements/tosca_type_validation.py b/tosca2heat/tosca-parser/toscaparser/elements/tosca_type_validation.py
index 16764bc..82b0b46 100644
--- a/tosca2heat/tosca-parser/toscaparser/elements/tosca_type_validation.py
+++ b/tosca2heat/tosca-parser/toscaparser/elements/tosca_type_validation.py
@@ -22,12 +22,13 @@ class TypeValidation(object):
DSL_DEFINITIONS, NODE_TYPES, REPOSITORIES,
DATA_TYPES, ARTIFACT_TYPES, GROUP_TYPES,
RELATIONSHIP_TYPES, CAPABILITY_TYPES,
- INTERFACE_TYPES, POLICY_TYPES) = \
+ INTERFACE_TYPES, POLICY_TYPES,
+ TOPOLOGY_TEMPLATE) = \
('tosca_definitions_version', 'description', 'imports',
'dsl_definitions', 'node_types', 'repositories',
'data_types', 'artifact_types', 'group_types',
'relationship_types', 'capability_types',
- 'interface_types', 'policy_types')
+ 'interface_types', 'policy_types', 'topology_template')
VALID_TEMPLATE_VERSIONS = ['tosca_simple_yaml_1_0']
exttools = ExtTools()
VALID_TEMPLATE_VERSIONS.extend(exttools.get_versions())
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/system.yaml b/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/system.yaml
index 2d459aa..9996e4f 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/system.yaml
+++ b/tosca2heat/tosca-parser/toscaparser/tests/data/topology_template/system.yaml
@@ -2,6 +2,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0
imports:
- definitions.yaml
+ - subsystem.yaml
topology_template:
description: Template of online transaction processing service.
@@ -54,4 +55,4 @@ topology_template:
# to be updated when substitution_mapping is implemented
# capabilities:
# database_endpoint:
- # to be updated when substitution_mapping is implemented \ No newline at end of file
+ # to be updated when substitution_mapping is implemented
diff --git a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
index cbd4e3b..0f1a33e 100644
--- a/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/tests/test_topology_template.py
@@ -34,11 +34,6 @@ class TopologyTemplateTest(TestCase):
self.topo = TopologyTemplate(self.topo_tpl,
self._get_all_custom_def())
- self.tosca_system_tpl_path = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- "data/topology_template/system.yaml")
- self.system_template = ToscaTemplate(self.tosca_system_tpl_path)
-
def _get_custom_def(self, type_definition):
custom_defs = {}
for definition in self.imports:
diff --git a/tosca2heat/tosca-parser/toscaparser/topology_template.py b/tosca2heat/tosca-parser/toscaparser/topology_template.py
index f8f8875..d51512a 100644
--- a/tosca2heat/tosca-parser/toscaparser/topology_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/topology_template.py
@@ -58,6 +58,7 @@ class TopologyTemplate(object):
self.groups = self._groups()
self.policies = self._policies()
self._process_intrinsic_functions()
+ self.substitution_mappings = self._substitution_mappings()
def _inputs(self):
inputs = []
diff --git a/tosca2heat/tosca-parser/toscaparser/tosca_template.py b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
index 1bad6e9..2ab2581 100644
--- a/tosca2heat/tosca-parser/toscaparser/tosca_template.py
+++ b/tosca2heat/tosca-parser/toscaparser/tosca_template.py
@@ -69,7 +69,7 @@ class ToscaTemplate(object):
self.input_path = None
self.path = None
self.tpl = None
- self.nested_tosca_template = None
+ self.nested_tosca_template = []
if path:
self.input_path = path
self.path = self._get_path(path)
@@ -199,11 +199,13 @@ class ToscaTemplate(object):
def _handle_nested_topo_tpls(self, nested_topo_tpls):
for tpl in nested_topo_tpls:
- if tpl.get(TOPOLOGY_TEMPLATE):
- nested_tosca_template = ToscaTemplate(
- path=self.path, parsed_params=self.parsed_params,
- yaml_dict_tpl=nested_topo_tpls)
- self.nested_tosca_template.apend(nested_tosca_template)
+ filename, tosca_tpl = tpl.items()[0]
+ if tosca_tpl.get(TOPOLOGY_TEMPLATE):
+ nested_template = ToscaTemplate(
+ path=filename, parsed_params=self.parsed_params,
+ yaml_dict_tpl=tosca_tpl)
+ if nested_template.topology_template.substitution_mappings:
+ self.nested_tosca_template.apend(nested_template)
def _validate_field(self):
version = self._tpl_version()