diff options
author | shangxdy <shang.xiaodong@zte.com.cn> | 2016-09-14 14:36:33 +0800 |
---|---|---|
committer | shangxdy <shang.xiaodong@zte.com.cn> | 2016-09-14 16:00:06 +0800 |
commit | f977b94e012828cd2a905b9b841aff33c4b732f8 (patch) | |
tree | f175b52c811f48335aeaa82d0c20baab8a99881d /tosca2heat/tosca-parser/toscaparser/elements/entity_type.py | |
parent | ae543033a8c4af9c291261fec55859c2f1191a1a (diff) |
Update the upstream of tosco-parser and heat-translator to stable
release 0.6/0.5
Currently the parser is based on dev branch of upstream projects,
include tosco-parser and heat-translator, for the colorado release of
parser, it should be based on a stable version, so it's necessary to
update the upstream version to 0.6/tosca-parser and 0.5/heat-translator.
JIRA:PARSER-106
Change-Id: I8fb043068d25188c47e5648e1b66184446ac82d6
Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
Diffstat (limited to 'tosca2heat/tosca-parser/toscaparser/elements/entity_type.py')
-rw-r--r-- | tosca2heat/tosca-parser/toscaparser/elements/entity_type.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py b/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py index 9b9787b..d7fcb18 100644 --- a/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py +++ b/tosca2heat/tosca-parser/toscaparser/elements/entity_type.py @@ -29,6 +29,11 @@ class EntityType(object): ('derived_from', 'properties', 'attributes', 'requirements', 'interfaces', 'capabilities', 'type', 'artifacts') + TOSCA_DEF_SECTIONS = ['node_types', 'data_types', 'artifact_types', + 'group_types', 'relationship_types', + 'capability_types', 'interface_types', + 'policy_types'] + '''TOSCA definition file.''' TOSCA_DEF_FILE = os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -36,7 +41,15 @@ class EntityType(object): loader = toscaparser.utils.yamlparser.load_yaml - TOSCA_DEF = loader(TOSCA_DEF_FILE) + TOSCA_DEF_LOAD_AS_IS = loader(TOSCA_DEF_FILE) + + # Map of definition with pre-loaded values of TOSCA_DEF_FILE_SECTIONS + TOSCA_DEF = {} + for section in TOSCA_DEF_SECTIONS: + if section in TOSCA_DEF_LOAD_AS_IS.keys(): + value = TOSCA_DEF_LOAD_AS_IS[section] + for key in value.keys(): + TOSCA_DEF[key] = value[key] RELATIONSHIP_TYPE = (DEPENDSON, HOSTEDON, CONNECTSTO, ATTACHESTO, LINKSTO, BINDSTO) = \ @@ -148,5 +161,11 @@ def update_definitions(version): extension_defs_file = exttools.get_defs_file(version) loader = toscaparser.utils.yamlparser.load_yaml - - EntityType.TOSCA_DEF.update(loader(extension_defs_file)) + nfv_def_file = loader(extension_defs_file) + nfv_def = {} + for section in EntityType.TOSCA_DEF_SECTIONS: + if section in nfv_def_file.keys(): + value = nfv_def_file[section] + for key in value.keys(): + nfv_def[key] = value[key] + EntityType.TOSCA_DEF.update(nfv_def) |