1 # Copyright 2017 ZTE Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
17 from genericparser.pub.utils.toscaparsers.nsdmodel import NsdInfoModel
18 from genericparser.pub.utils.toscaparsers.pnfmodel import PnfdInfoModel
19 from genericparser.pub.utils.toscaparsers.sdmodel import SdInfoModel
20 from genericparser.pub.utils.toscaparsers.vnfdmodel import EtsiVnfdInfoModel
23 def parse_nsd(path, input_parameters=[]):
24 tosca_obj = NsdInfoModel(path, input_parameters).model
25 strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
26 strResponse = strResponse.replace(': null', ': ""')
30 def parse_sd(path, input_parameters=[]):
31 tosca_obj = SdInfoModel(path, input_parameters)
32 strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
33 strResponse = strResponse.replace(': null', ': ""')
37 def parse_vnfd(path, input_parameters=[], isETSI=True):
39 tosca_obj = EtsiVnfdInfoModel(path, input_parameters)
42 strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
43 strResponse = strResponse.replace(': null', ': ""')
47 def parse_pnfd(path, input_parameters=[], isETSI=True):
49 tosca_obj = PnfdInfoModel(path, input_parameters)
52 strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
53 strResponse = strResponse.replace(': null', ': ""')