diff options
-rw-r--r-- | lcm/pub/utils/toscaparser/nsdmodel.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lcm/pub/utils/toscaparser/nsdmodel.py b/lcm/pub/utils/toscaparser/nsdmodel.py index ce6a8aa5..9d2b5a40 100644 --- a/lcm/pub/utils/toscaparser/nsdmodel.py +++ b/lcm/pub/utils/toscaparser/nsdmodel.py @@ -27,6 +27,7 @@ class EtsiNsdInfoModel(BaseInfoModel): self.server_groups = self.get_all_server_group(tosca.topology_template.groups) self.ns_exposed = self.get_all_endpoint_exposed(tosca.topology_template) self.policies = self._get_policies_scaling(tosca.topology_template.policies) + self.ns_flavours = self.get_all_flavour(tosca.topology_template.groups) def buildInputs(self, top_inputs): @@ -325,4 +326,21 @@ class EtsiNsdInfoModel(BaseInfoModel): return ret def get_scaling_policies(self, top_policies): - return self.get_policies_by_keyword(top_policies, '.SCALING')
\ No newline at end of file + return self.get_policies_by_keyword(top_policies, '.SCALING') + + def get_all_flavour(self, groups): + rets = [] + for group in groups: + if self._isFlavour(group): + ret = {} + ret['flavour_id'] = group.name + ret['description'] = group.description + if 'properties' in group.tpl: + ret['properties'] = group.tpl['properties'] + ret['members'] = group.members + + rets.append(ret) + return rets + + def _isFlavour(self, group): + return group.type.upper().find('FLAVOUR') >= 0
\ No newline at end of file |