From ee3b7dc3958a46171085877f0230f25a59819089 Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Thu, 31 Aug 2017 09:03:44 +0800 Subject: [PATCH] Refactor vfc-lcm tosca parser logic Delete the abandoned file. Change-Id: I81008b4e0ef2afcb39326a8c1692ca078795893b Issue-ID: VFC-196 Signed-off-by: ying.yunlong --- lcm/pub/utils/toscaparser/basemodel.py | 3 +- lcm/pub/utils/toscaparser/convert.py | 20 ------------ lcm/pub/utils/toscaparser/dataentityext.py | 3 +- lcm/pub/utils/toscaparser/nsdmodel.py | 2 +- lcm/pub/utils/toscaparser/parser.py | 51 ------------------------------ lcm/pub/utils/toscaparser/vnfdmodel.py | 2 +- 6 files changed, 5 insertions(+), 76 deletions(-) delete mode 100644 lcm/pub/utils/toscaparser/convert.py delete mode 100644 lcm/pub/utils/toscaparser/parser.py diff --git a/lcm/pub/utils/toscaparser/basemodel.py b/lcm/pub/utils/toscaparser/basemodel.py index 452e6e36..7d8389d2 100644 --- a/lcm/pub/utils/toscaparser/basemodel.py +++ b/lcm/pub/utils/toscaparser/basemodel.py @@ -267,4 +267,5 @@ class BaseInfoModel(object): for node in node_templates: if node['name'] == name: return node - return None \ No newline at end of file + return None + \ No newline at end of file diff --git a/lcm/pub/utils/toscaparser/convert.py b/lcm/pub/utils/toscaparser/convert.py deleted file mode 100644 index d7d7a502..00000000 --- a/lcm/pub/utils/toscaparser/convert.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 ZTE Corporation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -def convert_nsd(nsd_object): - pass - -def convert_vnfd(vnfd_object): - pass \ No newline at end of file diff --git a/lcm/pub/utils/toscaparser/dataentityext.py b/lcm/pub/utils/toscaparser/dataentityext.py index 02c11acf..53a1a3ca 100644 --- a/lcm/pub/utils/toscaparser/dataentityext.py +++ b/lcm/pub/utils/toscaparser/dataentityext.py @@ -16,8 +16,8 @@ from toscaparser.elements.constraints import Schema from toscaparser.common.exception import ExceptionCollector class DataEntityExt(object): + '''A complex data value entity ext.''' - @staticmethod def validate_datatype(type, value, entry_schema=None, custom_def=None): if value: @@ -31,4 +31,3 @@ class DataEntityExt(object): return DataEntity.validate_datatype(type, value, entry_schema, custom_def) return value - diff --git a/lcm/pub/utils/toscaparser/nsdmodel.py b/lcm/pub/utils/toscaparser/nsdmodel.py index 9d2b5a40..8d76f225 100644 --- a/lcm/pub/utils/toscaparser/nsdmodel.py +++ b/lcm/pub/utils/toscaparser/nsdmodel.py @@ -343,4 +343,4 @@ class EtsiNsdInfoModel(BaseInfoModel): return rets def _isFlavour(self, group): - return group.type.upper().find('FLAVOUR') >= 0 \ No newline at end of file + return group.type.upper().find('FLAVOUR') >= 0 diff --git a/lcm/pub/utils/toscaparser/parser.py b/lcm/pub/utils/toscaparser/parser.py deleted file mode 100644 index f6605f6b..00000000 --- a/lcm/pub/utils/toscaparser/parser.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2017 ZTE Corporation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from os import R_OK, access - -from lcm.pub.exceptions import NSLCMException -from toscaparser.tosca_template import ToscaTemplate - -def parse_nsd_model(path, input_parameters): - isexist = check_file_exist(path) - if isexist: - nsd_tpl = parse_nsd_csar(path, input_parameters) - else: - raise NSLCMException('%s is not exist.' % path) - return nsd_tpl - - -def parse_vnfd_model(path, input_parameters): - isexist = check_file_exist(path) - if isexist: - vnfd_tpl = parse_vnfd_csar(path, input_parameters) - else: - raise NSLCMException('%s is not exist.' % path) - return vnfd_tpl - -def check_file_exist(path): - if path.exists(path) and path.isfile(path) and access(path, R_OK): - return True - else: - return False - -def parse_nsd_csar(path, input_parameters=[], a_file=True): - nsd_object = None - nsd_object = ToscaTemplate(path, input_parameters) - return nsd_object - - -def parse_vnfd_csar(path, input_parameters=[], a_file=True): - vnfd_object = None - vnfd_object = ToscaTemplate(path, input_parameters) - return vnfd_object \ No newline at end of file diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py index cdbc15bc..cda9b750 100644 --- a/lcm/pub/utils/toscaparser/vnfdmodel.py +++ b/lcm/pub/utils/toscaparser/vnfdmodel.py @@ -134,4 +134,4 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): def _isVolumeStorage(self, node): return node['nodeType'].upper().find('.VOLUMESTORAGE.') >= 0 or node['nodeType'].upper().endswith( - '.VOLUMESTORAGE') \ No newline at end of file + '.VOLUMESTORAGE') -- 2.16.6