From: ying.yunlong Date: Wed, 16 Aug 2017 07:27:49 +0000 (+0800) Subject: Init parser and convert file X-Git-Tag: v1.0.0~188 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F7693%2F1;p=vfc%2Fnfvo%2Flcm.git 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 --- 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