aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-08-30 08:59:31 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-08-30 08:59:31 +0800
commit6f918ba0a243d524273414296864dbd6fe8cbb72 (patch)
tree8fb5a345ba879f9fbb13ba46461102f0f372eb0b
parent305330dbbb910a7d22aee604b33f9c3f00cc1b95 (diff)
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 <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/utils/toscaparser/nsdmodel.py20
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