From d20dc40c82fb3fea4a4622c3d3ea3e8222625dd5 Mon Sep 17 00:00:00 2001 From: Suresh Balakrishnan Date: Fri, 30 Sep 2016 03:47:25 -0400 Subject: [PATCH] Bug 69 - Change user keypair to be a list of refs instead of inline list for users in ns-instance-config Signed-off-by: Suresh Balakrishnan --- models/plugins/yang/nsr.yang | 28 ++++++++++--------- .../tasklets/rwnsmtasklet/openmano_nsm.py | 5 ++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/models/plugins/yang/nsr.yang b/models/plugins/yang/nsr.yang index c6bb4ec9..c2b7d06b 100644 --- a/models/plugins/yang/nsr.yang +++ b/models/plugins/yang/nsr.yang @@ -98,7 +98,9 @@ module nsr leaf key-pair-ref { description "A reference to the key pair entry in the global key pair table"; - type string; + type leafref { + path "/nsr:key-pair/nsr:name"; + } } } list user { @@ -113,19 +115,17 @@ module nsr description "The user name's real name"; type string; } - list key-pair { - key "name"; - description "Used to configure the list of public keys to be injected as part - of ns instantiation"; + list ssh-authorized-key { + key "key-pair-ref"; - leaf name { - description "Name of this key pair"; - type string; - } + description "Used to configure the list of public keys to be injected as part + of ns instantiation"; - leaf key { - description "Key associated with this key pair"; - type string; + leaf key-pair-ref { + description "A reference to the key pair entry in the global key pair table"; + type leafref { + path "/nsr:key-pair/nsr:name"; + } } } } @@ -157,7 +157,9 @@ module nsr leaf nsd-ref { description "Reference to NSR ID ref"; mandatory true; - type string; + type leafref { + path "/nsd:nsd-catalog/nsd:nsd/nsd:id"; + } } uses ns-instance-config-params; } diff --git a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py index 5f30493b..1537b3d9 100644 --- a/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py +++ b/rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py @@ -309,8 +309,9 @@ class OpenmanoNsr(object): user = {} user["name"] = user_entry.name user["key-pairs"] = list() - for ssh_key in user_entry.key_pair: - user["key-pairs"].append(ssh_key.key) + for ssh_key in user_entry.ssh_authorized_key: + if ssh_key.key_pair_ref in self._key_pairs: + user["key-pairs"].append(self._key_pairs[ssh_key.key_pair_ref].key) users.append(user) for user_entry in self._nsd_msg.user: -- 2.25.1