Fix Bug 2098: Get VDUs from VNFR when Heal op has no additionalPrameters 73/12473/7 v12.0.3 v12.0.4
authorGabriel Cuba <gcuba@whitestack.com>
Fri, 19 Aug 2022 23:23:00 +0000 (18:23 -0500)
committeraticig <gulsum.atici@canonical.com>
Wed, 7 Sep 2022 20:48:43 +0000 (22:48 +0200)
When Heal is requested without vdu or count-index parameters, RO will recreate all VDUs from VNFR

Change-Id: Idf2cf158bcb33e7b0c307298c14504cc7aa77e2a
Signed-off-by: Gabriel Cuba <gcuba@whitestack.com>
NG-RO/osm_ng_ro/ns.py
releasenotes/notes/Fix-Bug-2098-495699c552c8f34b.yaml [new file with mode: 0644]

index e914dfd..b71f1b4 100644 (file)
@@ -2054,15 +2054,23 @@ class Ns(object):
 
         # Check each VNF of the target
         for target_vnf in target_list:
-            # Find this VNF in the list from DB
-            vnfr_id = target_vnf.get("vnfInstanceId", None)
-            if vnfr_id:
-                existing_vnf = db_vnfrs.get(vnfr_id)
-                db_record = "vnfrs:{}:{}".format(vnfr_id, db_path)
-                # vim_account_id = existing_vnf.get("vim-account-id", "")
+            # Find this VNF in the list from DB, raise exception if vnfInstanceId is not found
+            vnfr_id = target_vnf["vnfInstanceId"]
+            existing_vnf = db_vnfrs.get(vnfr_id)
+            db_record = "vnfrs:{}:{}".format(vnfr_id, db_path)
+            # vim_account_id = existing_vnf.get("vim-account-id", "")
 
+            target_vdus = target_vnf.get("additionalParams", {}).get("vdu", [])
             # Check each VDU of this VNF
-            for target_vdu in target_vnf["additionalParams"].get("vdu", None):
+            if not target_vdus:
+                # Create target_vdu_list from DB, if VDUs are not specified
+                target_vdus = []
+                for existing_vdu in existing_vnf.get("vdur"):
+                    vdu_name = existing_vdu.get("vdu-name", None)
+                    vdu_index = existing_vdu.get("count-index", 0)
+                    vdu_to_be_healed = {"vdu-id": vdu_name, "count-index": vdu_index}
+                    target_vdus.append(vdu_to_be_healed)
+            for target_vdu in target_vdus:
                 vdu_name = target_vdu.get("vdu-id", None)
                 # For multi instance VDU count-index is mandatory
                 # For single session VDU count-indes is 0
diff --git a/releasenotes/notes/Fix-Bug-2098-495699c552c8f34b.yaml b/releasenotes/notes/Fix-Bug-2098-495699c552c8f34b.yaml
new file mode 100644 (file)
index 0000000..ad0ea35
--- /dev/null
@@ -0,0 +1,22 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+fixes:
+  - |
+    Fix Bug 2098 - Get VDUs from VNFR when Heal op has no additionalPrameters.
+    With this fix, when Heal is requested without vdu or count-index parameters 
+    RO will recreate all VDUs from VNFR