diff options
Diffstat (limited to 'lcm/pub/utils/toscaparser/vnfdmodel.py')
-rw-r--r-- | lcm/pub/utils/toscaparser/vnfdmodel.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py index 39e9a18b..eac1f0b7 100644 --- a/lcm/pub/utils/toscaparser/vnfdmodel.py +++ b/lcm/pub/utils/toscaparser/vnfdmodel.py @@ -1,3 +1,5 @@ +import functools + from lcm.pub.utils.toscaparser import EtsiNsdInfoModel @@ -5,3 +7,30 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel): def __init__(self, path, params): super(EtsiVnfdInfoModel, self).__init__(path, params) + + def parseModel(self, tosca): + self.buidMetadata(tosca) + if hasattr(tosca, 'topology_template') and hasattr(tosca.topology_template, 'inputs'): + self.inputs = self.buildInputs(tosca.topology_template.inputs) + + nodeTemplates = map(functools.partial(self.buildNode, inputs=tosca.inputs, parsed_params=tosca.parsed_params), + tosca.nodetemplates) + + self.services = self._get_all_services(nodeTemplates) + + + def _get_all_services(self, nodeTemplates): + ret = [] + for node in nodeTemplates: + if self.isService(node): + service = {} + service['serviceId'] = node['name'] + if 'description' in node: + service['description'] = node['description'] + service['properties'] = node['properties'] + service['dependencies'] = map(lambda x: self.get_requirement_node_name(x), + self.getNodeDependencys(node)) + 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 |