Add parse nsd package logic 89/7989/1
authorying.yunlong <ying.yunlong@zte.com.cn>
Fri, 18 Aug 2017 07:43:29 +0000 (15:43 +0800)
committerying.yunlong <ying.yunlong@zte.com.cn>
Fri, 18 Aug 2017 07:43:29 +0000 (15:43 +0800)
In vfc lcm project ,add parse nsd package logic.

Change-Id: Id2ee1482cdf8caf99ebd2a85e766c9011f49a4ad
Issue-ID: VFC-110
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
lcm/pub/utils/toscaparser/__init__.py
lcm/pub/utils/toscaparser/baseinfomodel.py [new file with mode: 0644]
lcm/pub/utils/toscaparser/etsinsdinfomodel.py [new file with mode: 0644]

index d764402..48b1b30 100644 (file)
 # 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.
+import json
 
 from lcm.pub.utils.toscaparser.convert import convert_nsd, convert_vnfd
+from lcm.pub.utils.toscaparser.etsinsdinfomodel import EtsiNsdInfoModel
 from lcm.pub.utils.toscaparser.parser import parse_nsd_model, parse_vnfd_model
 
 
 def parse_nsd(path, input_parameters=[]):
+    '''
     nsd_object = parse_nsd_model(path, input_parameters=[])
     nsd_json = convert_nsd(nsd_object)
     return nsd_json
+    '''
+    tosca_obj = EtsiNsdInfoModel(path, input_parameters)
+    strResponse = json.dumps(tosca_obj, default=lambda obj: obj.__dict__)
+    strResponse = strResponse.replace(': null', ': ""')
+    return strResponse
+
 
 def parse_vnfd(path, input_parameters=[]):
     vnfd_object = parse_vnfd_model(path, input_parameters=[])
     vnfd_json = convert_vnfd(vnfd_object)
     return vnfd_json
+
diff --git a/lcm/pub/utils/toscaparser/baseinfomodel.py b/lcm/pub/utils/toscaparser/baseinfomodel.py
new file mode 100644 (file)
index 0000000..a40383f
--- /dev/null
@@ -0,0 +1,3 @@
+class BaseInfoModel(object):
+    def __init__(self, path, params):
+        pass
\ No newline at end of file
diff --git a/lcm/pub/utils/toscaparser/etsinsdinfomodel.py b/lcm/pub/utils/toscaparser/etsinsdinfomodel.py
new file mode 100644 (file)
index 0000000..3a9cee0
--- /dev/null
@@ -0,0 +1,7 @@
+from lcm.pub.utils.toscaparser.baseinfomodel import BaseInfoModel
+
+
+class EtsiNsdInfoModel(BaseInfoModel):
+
+    def __init__(self, path, params):
+        pass