diff options
author | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-08-26 13:56:28 +0800 |
---|---|---|
committer | ying.yunlong <ying.yunlong@zte.com.cn> | 2017-08-26 13:56:28 +0800 |
commit | 5a28eee4a8a2af8b6dd40d4e51eec74a3459a031 (patch) | |
tree | eb28805bcb28bf46c73093431b6d32f998865158 | |
parent | 9c3f78942507bfebaca73c9a9c363198d52742e8 (diff) |
Add parser convert vnfd vcloud
After parse the vnfd package, add
_get_all_vcloud function to convert
the vcloud info.
Change-Id: Ifeb6eb85b225b66543f3ef775ae0c23061ef9232
Issue-ID: VFC-176
Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r-- | lcm/pub/utils/toscaparser/vnfdmodel.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py index eac1f0b7..cf29ea68 100644 --- a/lcm/pub/utils/toscaparser/vnfdmodel.py +++ b/lcm/pub/utils/toscaparser/vnfdmodel.py @@ -17,6 +17,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): tosca.nodetemplates) self.services = self._get_all_services(nodeTemplates) + self.vcloud = self._get_all_vcloud(nodeTemplates) def _get_all_services(self, nodeTemplates): @@ -33,4 +34,24 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): service['networks'] = map(lambda x: self.get_requirement_node_name(x), self.getVirtualLinks(node)) ret.append(service) - return ret
\ No newline at end of file + return ret + + def _get_all_vcloud(self, nodeTemplates): + rets = [] + for node in nodeTemplates: + if self._isVcloud(node): + ret = {} + if 'vdc_name' in node['properties']: + ret['vdc_name'] = node['properties']['vdc_name'] + else: + ret['vdc_name'] = "" + if 'storage_clusters' in node['properties']: + ret['storage_clusters'] = node['properties']['storage_clusters'] + else: + ret['storage_clusters'] = [] + + rets.append(ret) + return rets + + def _isVcloud(self, node): + return node['nodeType'].upper().find('.VCLOUD.') >= 0 or node['nodeType'].upper().endswith('.VCLOUD')
\ No newline at end of file |