Provided support for TOSCA qualified name.

Provided partial fix with the current given fix.

Implementation for all deeper hierarchy TOSCA qualified names
is in progress and will be delivered in the next patch.

Co-Author: manoj6030 <manoj.nagasuri@tcs.com>

Partial-Bug: #1452546

Change-Id: I28ec064f28156ca0e165fee6d216d1f898fe80be
This commit is contained in:
sreelakshmi-penta
2016-08-29 15:14:41 +05:30
committed by manoj6030
parent 55a80b0ef7
commit 4753986cba
2 changed files with 34 additions and 0 deletions

View File

@@ -35,6 +35,9 @@ class StatefulEntityType(EntityType):
if UnsupportedType.validate_type(entire_entitytype):
self.defs = None
else:
if entitytype.startswith(self.TOSCA + ":"):
entitytype = entitytype[(len(self.TOSCA) + 1):]
entire_entitytype = prefix + entitytype
if not entitytype.startswith(self.TOSCA):
entire_entitytype = prefix + entitytype
if entire_entitytype in list(self.TOSCA_DEF.keys()):

View File

@@ -1541,3 +1541,34 @@ heat-translator/master/translator/tests/data/custom_types/wordpress.yaml
'unknown field "oss". Refer to the definition '
'to verify valid values.')
self.assertEqual(expectedmessage, err.__str__())
def test_qualified_name(self):
tpl_snippet_full_name = '''
node_templates:
supported_type:
type: tosca.nodes.Compute
'''
tpl = (
toscaparser.utils.yamlparser.simple_parse(
tpl_snippet_full_name))
TopologyTemplate(tpl, None)
tpl_snippet_short_name = '''
node_templates:
supported_type:
type: Compute
'''
tpl = (
toscaparser.utils.yamlparser.simple_parse(
tpl_snippet_short_name))
TopologyTemplate(tpl, None)
tpl_snippet_qualified_name = '''
node_templates:
supported_type:
type: tosca:Compute
'''
tpl = (
toscaparser.utils.yamlparser.simple_parse(
tpl_snippet_qualified_name))
TopologyTemplate(tpl, None)