summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-08-30 10:35:02 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-08-30 10:35:02 +0800
commitf251f68d2ef5c5359a37342a1bfa6920b7e17ca3 (patch)
tree084fc8ebd047e1f72f6b9433b37622666079e8e7
parentd2086fc36b906ef6c0782f27cba479c2c18446d5 (diff)
Add parser convert vnfd local_storage
After parse the vnfd package, add _get_all_local_storage function to convert the local_storage info. Change-Id: I56d617974e2fa710074ee254951f8fabf5224db1 Issue-ID: VFC-179 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/utils/toscaparser/vnfdmodel.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py
index a9b61b86..50dc7cff 100644
--- a/lcm/pub/utils/toscaparser/vnfdmodel.py
+++ b/lcm/pub/utils/toscaparser/vnfdmodel.py
@@ -20,6 +20,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel):
self.vcloud = self._get_all_vcloud(nodeTemplates)
self.vcenter = self._get_all_vcenter(nodeTemplates)
self.image_files = self._get_all_image_file(nodeTemplates)
+ self.local_storages = self._get_all_local_storage(nodeTemplates)
def _get_all_services(self, nodeTemplates):
@@ -96,4 +97,21 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel):
return rets
def _isImageFile(self, node):
- return node['nodeType'].upper().find('.IMAGEFILE.') >= 0 or node['nodeType'].upper().endswith('.IMAGEFILE') \ No newline at end of file
+ return node['nodeType'].upper().find('.IMAGEFILE.') >= 0 or node['nodeType'].upper().endswith('.IMAGEFILE')
+
+ def _get_all_local_storage(self, nodeTemplates):
+ rets = []
+ for node in nodeTemplates:
+ if self._isLocalStorage(node):
+ ret = {}
+ ret['local_storage_id'] = node['name']
+ if 'description' in node:
+ ret['description'] = node['description']
+ ret['properties'] = node['properties']
+
+ rets.append(ret)
+ return rets
+
+ def _isLocalStorage(self, node):
+ return node['nodeType'].upper().find('.LOCALSTORAGE.') >= 0 or node['nodeType'].upper().endswith(
+ '.LOCALSTORAGE')