summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2017-08-19 16:30:23 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2017-08-19 16:30:23 +0800
commitf6c7267eebbf9c2aab378a537547577245887789 (patch)
tree55435c2a4436273aecd6defaeda6f2bb33c09eef
parent242c0e339b49be35b69da83fddf91c54d6f185e1 (diff)
Add buildArtifacts and build_interfaces
Implementing buildArtifacts and build_interfaces Methods. Change-Id: I71d39e7b88c219bb2e905893be5eed99ed9a8768 Issue-ID: VFC-119 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--lcm/pub/utils/toscaparser/basemodel.py17
-rw-r--r--lcm/pub/utils/toscaparser/nsdmodel.py6
2 files changed, 19 insertions, 4 deletions
diff --git a/lcm/pub/utils/toscaparser/basemodel.py b/lcm/pub/utils/toscaparser/basemodel.py
index 143120e6..254a326d 100644
--- a/lcm/pub/utils/toscaparser/basemodel.py
+++ b/lcm/pub/utils/toscaparser/basemodel.py
@@ -175,4 +175,19 @@ class BaseInfoModel(object):
if m == input_def.name][0]
capabilities = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), capabilities,1)
if capabilities != 'null':
- ret['capabilities'] = json.loads(capabilities) \ No newline at end of file
+ ret['capabilities'] = json.loads(capabilities)
+
+ def buildArtifacts(self, nodeTemplate, inputs, ret):
+ artifacts = json.dumps(nodeTemplate.entity_tpl.get('artifacts', None))
+ match = re.findall(r'\{"get_input":\s*"([\w|\-]+)"\}',artifacts)
+ for m in match:
+ aa= [input_def for input_def in inputs
+ if m == input_def.name][0]
+ artifacts = re.sub(r'\{"get_input":\s*"([\w|\-]+)"\}', json.dumps(aa.default), artifacts,1)
+ if artifacts != 'null':
+ ret['artifacts'] = json.loads(artifacts)
+
+ def build_interfaces(self, node_template):
+ if 'interfaces' in node_template.entity_tpl:
+ return node_template.entity_tpl['interfaces']
+ return None \ No newline at end of file
diff --git a/lcm/pub/utils/toscaparser/nsdmodel.py b/lcm/pub/utils/toscaparser/nsdmodel.py
index f0512068..c6e49430 100644
--- a/lcm/pub/utils/toscaparser/nsdmodel.py
+++ b/lcm/pub/utils/toscaparser/nsdmodel.py
@@ -53,7 +53,7 @@ class EtsiNsdInfoModel(BaseInfoModel):
ret['properties'] = self.verify_properties(props, inputs, parsed_params)
ret['requirements'] = self.build_requirements(nodeTemplate)
self.buildCapabilities(nodeTemplate, inputs, ret)
- # self.buildArtifacts(nodeTemplate, inputs, ret)
- # interfaces = self.build_interfaces(nodeTemplate)
- # if interfaces: ret['interfaces'] = interfaces
+ self.buildArtifacts(nodeTemplate, inputs, ret)
+ interfaces = self.build_interfaces(nodeTemplate)
+ if interfaces: ret['interfaces'] = interfaces
return ret