Update nsd config param map 77/977/1
authorPhilip Joseph <philip.joseph@riftio.com>
Wed, 18 Jan 2017 09:30:55 +0000 (09:30 +0000)
committerPhilip Joseph <philip.joseph@riftio.com>
Wed, 18 Jan 2017 09:30:55 +0000 (09:30 +0000)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
examples/ping_pong_ns/rift/mano/examples/ping_pong_nsd.py
models/plugins/yang/nsd.yang

index 3953787..ff706c8 100755 (executable)
@@ -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,
index d56ce55..cbf5f26 100644 (file)
@@ -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";
           }
         }
       }