From: ying.yunlong Date: Wed, 30 Aug 2017 00:59:31 +0000 (+0800) Subject: Add parser convert vnfd all_flavour X-Git-Tag: v1.0.0~126^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6f918ba0a243d524273414296864dbd6fe8cbb72;p=vfc%2Fnfvo%2Flcm.git Add parser convert vnfd all_flavour After parse the vnfd package, add get_all_flavour function to convert the all_flavour info. Change-Id: I487b0ff54bf587871ece6db4cc3a69c2e4e1934b Issue-ID: VFC-188 Signed-off-by: ying.yunlong --- 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