diff options
author | Huang Haibin <haibin.huang@intel.com> | 2018-04-16 18:58:08 +0800 |
---|---|---|
committer | Huang Haibin <haibin.huang@intel.com> | 2018-04-16 21:04:34 +0800 |
commit | 18f39804274b3ad1a3c6def3b106dc5636c45094 (patch) | |
tree | c9faec180b0c3a84f1dcee27b573ea12f7800435 | |
parent | abbc35d1b9a65b833e245279370f34676c4b333a (diff) |
VDU parser storage for new data model
Change-Id: I2c3b6ad8b4a8cd627b67288afc64c81cd3c03344
Issue-ID: VFC-657
Signed-off-by: Huang Haibin <haibin.huang@intel.com>
-rw-r--r-- | catalog/pub/utils/toscaparser/basemodel.py | 6 | ||||
-rw-r--r-- | catalog/pub/utils/toscaparser/vnfdmodel.py | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/catalog/pub/utils/toscaparser/basemodel.py b/catalog/pub/utils/toscaparser/basemodel.py index fd4d35c1..d39a7b70 100644 --- a/catalog/pub/utils/toscaparser/basemodel.py +++ b/catalog/pub/utils/toscaparser/basemodel.py @@ -329,6 +329,12 @@ class BaseInfoModel(object): def get_requirement_node_name(self, req_value): return self.get_prop_from_obj(req_value, 'node') + def getRequirementByNodeName(self, nodeTemplates, storage_name, prop): + for node in nodeTemplates: + if node['name'] == storage_name: + if prop in node: + return node[prop] + def get_prop_from_obj(self, obj, prop): if isinstance(obj, str): return obj diff --git a/catalog/pub/utils/toscaparser/vnfdmodel.py b/catalog/pub/utils/toscaparser/vnfdmodel.py index 385ca3af..524cf85f 100644 --- a/catalog/pub/utils/toscaparser/vnfdmodel.py +++ b/catalog/pub/utils/toscaparser/vnfdmodel.py @@ -13,8 +13,9 @@ # limitations under the License. import functools - +import logging from catalog.pub.utils.toscaparser import EtsiNsdInfoModel +logger = logging.getLogger(__name__) class EtsiVnfdInfoModel(EtsiNsdInfoModel): @@ -178,6 +179,10 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): virtual_compute = self.getCapabilityByName(node, 'virtual_compute') if virtual_compute is not None and 'properties' in virtual_compute: ret['virtual_compute'] = virtual_compute['properties'] + virtual_storage_names = self.getRequirementByName(node, 'virtual_storage') + virtual_storage = self.getRequirementByNodeName(nodeTemplates, virtual_storage_names[0], 'properties') + if virtual_storage is not None: + ret['virtual_compute']['virtual_storage'] = virtual_storage ret['vls'] = self.get_linked_vl_ids(node, nodeTemplates) @@ -189,6 +194,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): ret['artifacts'] = self._build_artifacts(node) rets.append(ret) + logger.debug("rets:%s", rets) return rets def get_node_image_file(self, node): |