diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-08-29 15:41:58 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-08-29 15:41:58 +0800 |
commit | 305330dbbb910a7d22aee604b33f9c3f00cc1b95 (patch) | |
tree | 52e84c9053c127a4ac57a6491a3beac22e2e1018 | |
parent | c644bd4beb5f4d18e4268efc5e8105cf5a2e88f6 (diff) |
Add parser convert vnfd image_file
After parse the vnfd package, add
_get_all_image_file function to convert
the image_file info.
Change-Id: Ia6f934e49489da3dd7713402683c60cac29e2b75
Issue-ID: VFC-178
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | lcm/pub/utils/toscaparser/vnfdmodel.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py index 7ac44d1d..a9b61b86 100644 --- a/lcm/pub/utils/toscaparser/vnfdmodel.py +++ b/lcm/pub/utils/toscaparser/vnfdmodel.py @@ -19,6 +19,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): self.services = self._get_all_services(nodeTemplates) self.vcloud = self._get_all_vcloud(nodeTemplates) self.vcenter = self._get_all_vcenter(nodeTemplates) + self.image_files = self._get_all_image_file(nodeTemplates) def _get_all_services(self, nodeTemplates): @@ -80,4 +81,19 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): def _isVcenter(self, node): return node['nodeType'].upper().find('.VCENTER.') >= 0 or node['nodeType'].upper().endswith('.VCENTER') -
\ No newline at end of file + + def _get_all_image_file(self, nodeTemplates): + rets = [] + for node in nodeTemplates: + if self._isImageFile(node): + ret = {} + ret['image_file_id'] = node['name'] + if 'description' in node: + ret['description'] = node['description'] + ret['properties'] = node['properties'] + + rets.append(ret) + 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 |