From: ying.yunlong Date: Fri, 1 Sep 2017 05:08:48 +0000 (+0800) Subject: Refactor vfc catalog parser file X-Git-Tag: v1.0.0~79 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F9857%2F1;p=vfc%2Fnfvo%2Fcatalog.git Refactor vfc catalog parser file Change-Id: Ie9d5d3a5357e5845161332f93c300ed131fd6f2e Issue-ID: VFC-220 Signed-off-by: ying.yunlong --- diff --git a/catalog/pub/utils/toscaparser/convert.py b/catalog/pub/utils/toscaparser/convert.py deleted file mode 100644 index 46de453c..00000000 --- a/catalog/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/catalog/pub/utils/toscaparser/dataentityext.py b/catalog/pub/utils/toscaparser/dataentityext.py index f78faa34..7db31c74 100644 --- a/catalog/pub/utils/toscaparser/dataentityext.py +++ b/catalog/pub/utils/toscaparser/dataentityext.py @@ -12,14 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. - from toscaparser.dataentity import DataEntity 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: @@ -33,4 +31,3 @@ class DataEntityExt(object): return DataEntity.validate_datatype(type, value, entry_schema, custom_def) return value - diff --git a/catalog/pub/utils/toscaparser/nsdmodel.py b/catalog/pub/utils/toscaparser/nsdmodel.py index fe5d0060..bc6d9219 100644 --- a/catalog/pub/utils/toscaparser/nsdmodel.py +++ b/catalog/pub/utils/toscaparser/nsdmodel.py @@ -16,7 +16,6 @@ import functools from catalog.pub.utils.toscaparser.basemodel import BaseInfoModel - class EtsiNsdInfoModel(BaseInfoModel): def __init__(self, path, params): diff --git a/catalog/pub/utils/toscaparser/parser.py b/catalog/pub/utils/toscaparser/parser.py deleted file mode 100644 index 7ce31b94..00000000 --- a/catalog/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 catalog.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