From 297fabfc5644e0499963ff283b68587dca3d16f7 Mon Sep 17 00:00:00 2001 From: Philip Joseph Date: Wed, 18 Jan 2017 09:30:55 +0000 Subject: [PATCH] Update nsd config param map Signed-off-by: Philip Joseph --- .../rift/mano/examples/ping_pong_nsd.py | 9 +++++ models/plugins/yang/nsd.yang | 40 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py index 39537870..ff706c88 100755 --- a/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py +++ b/examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py @@ -1208,21 +1208,30 @@ exit 0 self.nsd.monitoring_param.append(nsd_monp) param_id += 1 + def get_vnfd_id(self, index): + for cv in self.nsd.constituent_vnfd: + if cv.member_vnf_index == index: + return cv.vnfd_id_ref + def add_conf_param_map(self): nsd = self.nsd confparam_map = nsd.config_parameter_map.add() confparam_map.id = '1' confparam_map.config_parameter_source.member_vnf_index_ref = 2 + confparam_map.config_parameter_source.vnfd_id_ref = self.get_vnfd_id(2) confparam_map.config_parameter_source.config_parameter_source_ref = 'service_ip' confparam_map.config_parameter_request.member_vnf_index_ref = 1 + confparam_map.config_parameter_request.vnfd_id_ref = self.get_vnfd_id(1) confparam_map.config_parameter_request.config_parameter_request_ref = 'pong_ip' confparam_map = nsd.config_parameter_map.add() confparam_map.id = '2' confparam_map.config_parameter_source.member_vnf_index_ref = 2 + confparam_map.config_parameter_source.vnfd_id_ref = self.get_vnfd_id(2) confparam_map.config_parameter_source.config_parameter_source_ref = 'service_port' confparam_map.config_parameter_request.member_vnf_index_ref = 1 + confparam_map.config_parameter_request.vnfd_id_ref = self.get_vnfd_id(1) confparam_map.config_parameter_request.config_parameter_request_ref = 'pong_port' def compose(self, vnfd_list, cpgroup_list, mano_ut, diff --git a/models/plugins/yang/nsd.yang b/models/plugins/yang/nsd.yang index d56ce553..cbf5f26f 100644 --- a/models/plugins/yang/nsd.yang +++ b/models/plugins/yang/nsd.yang @@ -362,11 +362,29 @@ module nsd path "../../../constituent-vnfd/member-vnf-index"; } } + leaf vnfd-id-ref { + description + "A reference to a vnfd. This is a + leafref to path: + ../../nsd:constituent-vnfd + + [nsd:id = current()/../nsd:id-ref] + + /nsd:vnfd-id-ref + NOTE: An issue with confd is preventing the + use of xpath. Seems to be an issue with leafref + to leafref, whose target is in a different module. + Once that is resovled this will switched to use + leafref"; + type leafref { + path "../../../constituent-vnfd[member-vnf-index = current()/../member-vnf-index-ref]/vnfd-id-ref"; + } + } leaf config-parameter-request-ref { description "Reference to the request in the VNF with the specified member-vnf-index"; type leafref { - path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:config-parameter/vnfd:config-parameter-request/vnfd:name"; + path + "/vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = current()/../vnfd-id-ref]" + + "/vnfd:config-parameter/vnfd:config-parameter-request/vnfd:name"; } } } @@ -377,11 +395,29 @@ module nsd path "../../../constituent-vnfd/member-vnf-index"; } } + leaf vnfd-id-ref { + description + "A reference to a vnfd. This is a + leafref to path: + ../../nsd:constituent-vnfd + + [nsd:id = current()/../nsd:id-ref] + + /nsd:vnfd-id-ref + NOTE: An issue with confd is preventing the + use of xpath. Seems to be an issue with leafref + to leafref, whose target is in a different module. + Once that is resovled this will switched to use + leafref"; + type leafref { + path "../../../constituent-vnfd[member-vnf-index = current()/../member-vnf-index-ref]/vnfd-id-ref"; + } + } leaf config-parameter-source-ref { description "Reference to the source in the VNF with the specified member-vnf-index"; type leafref { - path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:config-parameter/vnfd:config-parameter-source/vnfd:name"; + path + "/vnfd:vnfd-catalog/vnfd:vnfd[vnfd:id = current()/../vnfd-id-ref]" + + "/vnfd:config-parameter/vnfd:config-parameter-source/vnfd:name"; } } } -- 2.25.1