From e25302c61089a75a8b06dcc5653215f5f89b8ccd Mon Sep 17 00:00:00 2001 From: "ying.yunlong" Date: Thu, 31 Aug 2017 08:57:31 +0800 Subject: Add parser convert vnfd volume_storage After parse the vnfd package, add _get_all_volume_storage function to convert the volume_storage info. Change-Id: I9078bf773f88d6e0a5c8d26775ad720caae143ad Issue-ID: VFC-183 Signed-off-by: ying.yunlong --- lcm/pub/utils/toscaparser/vnfdmodel.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py index 50dc7cff..cdbc15bc 100644 --- a/lcm/pub/utils/toscaparser/vnfdmodel.py +++ b/lcm/pub/utils/toscaparser/vnfdmodel.py @@ -21,6 +21,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): 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) + self.volume_storages = self._get_all_volume_storage(nodeTemplates) def _get_all_services(self, nodeTemplates): @@ -115,3 +116,22 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): def _isLocalStorage(self, node): return node['nodeType'].upper().find('.LOCALSTORAGE.') >= 0 or node['nodeType'].upper().endswith( '.LOCALSTORAGE') + + def _get_all_volume_storage(self, nodeTemplates): + rets = [] + for node in nodeTemplates: + if self._isVolumeStorage(node): + ret = {} + ret['volume_storage_id'] = node['name'] + if 'description' in node: + ret['description'] = node['description'] + ret['properties'] = node['properties'] + ret['image_file'] = map(lambda x: self.get_requirement_node_name(x), + self.getRequirementByName(node, 'image_file')) + + rets.append(ret) + return rets + + def _isVolumeStorage(self, node): + return node['nodeType'].upper().find('.VOLUMESTORAGE.') >= 0 or node['nodeType'].upper().endswith( + '.VOLUMESTORAGE') \ No newline at end of file -- cgit 1.2.3-korg