From 2323c9da55a018b1b1995abd5d05f4cdf2be31d5 Mon Sep 17 00:00:00 2001 From: shangxdy Date: Sun, 10 Jul 2016 01:44:07 +0800 Subject: fix import and vRNC Ctrl_net definition error 1. Currently DM_Port_Ctrl requirement definition requirements: virtualBinding: DM virtualLink: CTRL_Net_Host shall be below: requirements: virtualBinding: DM_Host virtualLink: CTRL_Net 2. In function of _load_import_template when import vRNC definition, it will return "None, None" instead of return Null in case of no value return. Change-Id: I81d2d471eafff8ebd77eef356e6178e1f7701a22 JIRA: PARSER-65 Signed-off-by: shangxdy --- .../extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml | 4 ++-- tosca2heat/tosca-parser/toscaparser/imports.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tosca2heat') diff --git a/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml b/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml index 6517c4a..bdd03c8 100644 --- a/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml +++ b/tosca2heat/tosca-parser/toscaparser/extensions/nfv/tests/data/vRNC/Definitions/vRNC.yaml @@ -441,8 +441,8 @@ topology_template: order: 0 is_default: true requirements: - - virtualBinding: DM - - virtualLink: CTRL_Net_Host + - virtualBinding: DM_Host + - virtualLink: CTRL_Net DM_Port_INTERMEDIA: type: rnc.nodes.CP.DM diff --git a/tosca2heat/tosca-parser/toscaparser/imports.py b/tosca2heat/tosca-parser/toscaparser/imports.py index 58c9300..86c10f0 100644 --- a/tosca2heat/tosca-parser/toscaparser/imports.py +++ b/tosca2heat/tosca-parser/toscaparser/imports.py @@ -184,7 +184,7 @@ class ImportsLoader(object): % {'import_name': import_name}) log.error(msg) ExceptionCollector.appendException(ValidationError(message=msg)) - return + return None, None if toscaparser.utils.urlutils.UrlUtils.validate_url(file_name): return file_name, YAML_LOADER(file_name, False) @@ -199,7 +199,7 @@ class ImportsLoader(object): % {'name': file_name, 'template': self.path}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) - return + return None, None import_template = toscaparser.utils.urlutils.UrlUtils.\ join_url(self.path, file_name) a_file = False @@ -242,7 +242,7 @@ class ImportsLoader(object): % {'name': file_name}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) - return + return None, None if not import_template: log.error(_('Import "%(name)s" is not valid.') % @@ -250,14 +250,14 @@ class ImportsLoader(object): ExceptionCollector.appendException( ImportError(_('Import "%s" is not valid.') % import_uri_def)) - return + return None, None return import_template, YAML_LOADER(import_template, a_file) if short_import_notation: log.error(_('Import "%(name)s" is not valid.') % import_uri_def) ExceptionCollector.appendException( ImportError(_('Import "%s" is not valid.') % import_uri_def)) - return + return None, None full_url = "" if repository: @@ -275,7 +275,7 @@ class ImportsLoader(object): % {'n_uri': repository, 'tpl': import_name}) log.error(msg) ExceptionCollector.appendException(ImportError(msg)) - return + return None, None if toscaparser.utils.urlutils.UrlUtils.validate_url(full_url): return full_url, YAML_LOADER(full_url, False) -- cgit 1.2.3-korg