aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-09-04 13:15:27 +0800
committeryunlong ying <ying.yunlong@zte.com.cn>2017-09-04 05:41:48 +0000
commit6994eaf5d51c96d824f8521675eaee95903f082d (patch)
tree8d251fa6f9bbdcb30cd50fc0bac73af3c314ab74
parentef65c966e740d5c87a38613e037058174b231ddc (diff)
Add parser convert vnfd plugin1
After parse the vnfd package, add get_all_plugin function to convert the plugin info. Change-Id: I6d28f28ed687b225cec11e9a0601ee99d3b52a7e Issue-ID: VFC-252 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/utils/toscaparser/vnfdmodel.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/lcm/pub/utils/toscaparser/vnfdmodel.py b/lcm/pub/utils/toscaparser/vnfdmodel.py
index 166690b8..2deb87f6 100644
--- a/lcm/pub/utils/toscaparser/vnfdmodel.py
+++ b/lcm/pub/utils/toscaparser/vnfdmodel.py
@@ -39,6 +39,7 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel):
self.vdus = self._get_all_vdu(nodeTemplates)
self.vls = self.get_all_vl(nodeTemplates)
self.cps = self.get_all_cp(nodeTemplates)
+ self.plugins = self.get_all_plugin(nodeTemplates)
def _get_all_services(self, nodeTemplates):
@@ -251,3 +252,20 @@ class EtsiVnfdInfoModel(EtsiNsdInfoModel):
cp['vls'] = vls
cps.append(cp)
return cps
+
+ def get_all_plugin(self, node_templates):
+ plugins = []
+ for node in node_templates:
+ if self._isPlugin(node):
+ plugin = {}
+ plugin['plugin_id'] = node['name']
+ plugin['description'] = node['description']
+ plugin['properties'] = node['properties']
+ if 'interfaces' in node:
+ plugin['interfaces'] = node['interfaces']
+
+ plugins.append(plugin)
+ return plugins
+
+ def _isPlugin(self, node):
+ return node['nodeType'].lower().find('.plugin.') >= 0 or node['nodeType'].lower().endswith('.plugin')