From 5305e3036274ee84be9eb3a66d0ac0aed24a2517 Mon Sep 17 00:00:00 2001 From: Adurti Date: Fri, 29 Mar 2024 07:13:06 +0000 Subject: [PATCH] Bug 2359 fixed: Mongo db is not getting updated while launching Ns with vim-flavor-id Change-Id: I1f670d32962dfc9c6da79a70972a00c9c6fa8c38 Signed-off-by: Adurti --- NG-RO/osm_ng_ro/ns_thread.py | 22 +++++ .../notes/fix_bug_2359-8be2d8604b12af95.yaml | 81 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 releasenotes/notes/fix_bug_2359-8be2d8604b12af95.yaml diff --git a/NG-RO/osm_ng_ro/ns_thread.py b/NG-RO/osm_ng_ro/ns_thread.py index 08edcd10..49379648 100644 --- a/NG-RO/osm_ng_ro/ns_thread.py +++ b/NG-RO/osm_ng_ro/ns_thread.py @@ -1248,6 +1248,28 @@ class VimInteractionFlavor(VimInteractionBase): if task.get("find_params", {}).get("vim_flavor_id"): vim_flavor_id = task["find_params"]["vim_flavor_id"] + db_nsr = self.db.get_one("nsrs", {"_id": task["nsr_id"]}) + for vnfr_id in db_nsr.get("constituent-vnfr-ref"): + db_vnfr = self.db.get_one("vnfrs", {"_id": vnfr_id}) + for each_flavor in db_nsr["flavor"]: + nsd_flavor_id = each_flavor["id"] + for vdur in db_vnfr["vdur"]: + if ( + vdur.get("ns-flavor-id") + and vdur.get("ns-flavor-id") == nsd_flavor_id + ): + if vdur["additionalParams"]["OSM"].get("vim_flavor_id"): + flavor_id = vdur["additionalParams"]["OSM"][ + "vim_flavor_id" + ] + flavor_details = target_vim.get_flavor(flavor_id) + flavor_dict = { + "memory-mb": flavor_details["ram"], + "storage-gb": flavor_details["disk"], + "vcpu-count": flavor_details["vcpus"], + } + each_flavor.update(flavor_dict) + self.db.set_one("nsrs", {"_id": task["nsr_id"]}, db_nsr) elif task.get("find_params", {}).get("flavor_data"): try: flavor_data = task["find_params"]["flavor_data"] diff --git a/releasenotes/notes/fix_bug_2359-8be2d8604b12af95.yaml b/releasenotes/notes/fix_bug_2359-8be2d8604b12af95.yaml new file mode 100644 index 00000000..20ee4ba0 --- /dev/null +++ b/releasenotes/notes/fix_bug_2359-8be2d8604b12af95.yaml @@ -0,0 +1,81 @@ +####################################################################################### +# 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. +####################################################################################### +--- +prelude: > + Replace this text with content to appear at the top of the section for this + release. All of the prelude content is merged together and then rendered + separately from the items listed in other parts of the file, so the text + needs to be worded so that both the prelude and the other items make sense + when read independently. This may mean repeating some details. Not every + release note requires a prelude. Usually only notes describing major + features or adding release theme details should have a prelude. +features: + - | + List new features here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +issues: + - | + List known issues here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +upgrade: + - | + List upgrade notes here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +deprecations: + - | + List deprecations notes here, or remove this section. All of the list + items in this section are combined when the release notes are rendered, so + the text needs to be worded so that it does not depend on any information + only available in another section, such as the prelude. This may mean + repeating some details. +critical: + - | + Add critical notes here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +security: + - | + Add security notes here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +fixes: + - | + Add normal bug fixes here, or remove this section. All of the list items + in this section are combined when the release notes are rendered, so the + text needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. +other: + - | + Add other notes here, or remove this section. All of the list items in + this section are combined when the release notes are rendered, so the text + needs to be worded so that it does not depend on any information only + available in another section, such as the prelude. This may mean repeating + some details. -- 2.25.1