From 3149f448e1f439e4ca71dd4c4bf9da2aeb443374 Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Wed, 16 Aug 2017 15:27:49 +0800 Subject: [PATCH] Init parser and convert file In order to call parser to parse tosca package, add the function name to init the code logic. Change-Id: Ide1c0940e40ca665d71f3959ddce80b4d5cc9ba8 Issue-ID: VFC-97 Signed-off-by: ying.yunlong --- lcm/pub/utils/toscaparser/__init__.py | 12 ++++++++++-- lcm/pub/utils/toscaparser/convert.py | 7 +++++++ lcm/pub/utils/toscaparser/parser.py | 21 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lcm/pub/utils/toscaparser/__init__.py b/lcm/pub/utils/toscaparser/__init__.py index a2564f74..d764402c 100644 --- a/lcm/pub/utils/toscaparser/__init__.py +++ b/lcm/pub/utils/toscaparser/__init__.py @@ -12,8 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. +from lcm.pub.utils.toscaparser.convert import convert_nsd, convert_vnfd +from lcm.pub.utils.toscaparser.parser import parse_nsd_model, parse_vnfd_model + + def parse_nsd(path, input_parameters=[]): - pass + nsd_object = parse_nsd_model(path, input_parameters=[]) + nsd_json = convert_nsd(nsd_object) + return nsd_json def parse_vnfd(path, input_parameters=[]): - pass \ No newline at end of file + vnfd_object = parse_vnfd_model(path, input_parameters=[]) + vnfd_json = convert_vnfd(vnfd_object) + return vnfd_json diff --git a/lcm/pub/utils/toscaparser/convert.py b/lcm/pub/utils/toscaparser/convert.py index 5399fe66..d7d7a502 100644 --- a/lcm/pub/utils/toscaparser/convert.py +++ b/lcm/pub/utils/toscaparser/convert.py @@ -11,3 +11,10 @@ # 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/parser.py b/lcm/pub/utils/toscaparser/parser.py index 5399fe66..e1692ed4 100644 --- a/lcm/pub/utils/toscaparser/parser.py +++ b/lcm/pub/utils/toscaparser/parser.py @@ -11,3 +11,24 @@ # 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 parse_nsd_model(path, input_parameters): + check_file_exist(path) + nsd_tpl = parse_nsd_csar(path, input_parameters) + return nsd_tpl + + +def parse_vnfd_model(path, input_parameters): + check_file_exist(path) + vnfd_tpl = parse_vnfd_csar(path, input_parameters) + return vnfd_tpl + +def check_file_exist(path): + pass + +def parse_nsd_csar(path, input_parameters=[], a_file=True): + pass + +def parse_vnfd_csar(path, input_parameters=[], a_file=True): + pass \ No newline at end of file -- 2.16.6