From f81a865f7456d4f84b51fb1c25a5366c09e36230 Mon Sep 17 00:00:00 2001 From: kayal2001 Date: Thu, 27 Jun 2024 11:04:09 +0530 Subject: [PATCH] Feature 11043 Instance name as Instantiation parameters - RO Change-Id: I4bb0c904759faa6f34202e70251ff9ad016cfaec Signed-off-by: kayal2001 --- NG-RO/osm_ng_ro/ns.py | 40 ++++++--- ...antiation_parameters-95d9389b445bf2e3.yaml | 81 +++++++++++++++++++ 2 files changed, 109 insertions(+), 12 deletions(-) create mode 100644 releasenotes/notes/feature_11043_Instance_name_as_Instantiation_parameters-95d9389b445bf2e3.yaml diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index c71e1134..b73cf523 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -1835,13 +1835,21 @@ class Ns(object): target_vdu, extra_dict, ns_preffix ) + instance_name = "{}-{}-{}-{}".format( + indata["name"], + vnfr["member-vnf-index-ref"], + target_vdu["vdu-name"], + target_vdu.get("count-index") or 0, + ) + if additional_params := target_vdu.get("additionalParams"): + if additional_params.get("OSM", {}).get("instance_name"): + instance_name = additional_params.get("OSM", {}).get("instance_name") + if count_index := target_vdu.get("count-index"): + if count_index >= 1: + instance_name = "{}-{}".format(instance_name, count_index) + extra_dict["params"] = { - "name": "{}-{}-{}-{}".format( - indata["name"], - vnfr["member-vnf-index-ref"], - target_vdu["vdu-name"], - target_vdu.get("count-index") or 0, - ), + "name": instance_name, "description": target_vdu["vdu-name"], "start": True, "image_id": "TASK-" + image_text, @@ -2068,13 +2076,21 @@ class Ns(object): ].get("vim_id", None) affinity_group_list.append(affinity_group) + instance_name = "{}-{}-{}-{}".format( + db_nsr["name"], + vnfr["member-vnf-index-ref"], + existing_vdu["vdu-name"], + existing_vdu.get("count-index") or 0, + ) + if additional_params := existing_vdu.get("additionalParams"): + if additional_params.get("OSM", {}).get("instance_name"): + instance_name = additional_params.get("OSM", {}).get("instance_name") + if count_index := existing_vdu.get("count-index"): + if count_index >= 1: + instance_name = "{}-{}".format(instance_name, count_index) + extra_dict["params"] = { - "name": "{}-{}-{}-{}".format( - db_nsr["name"], - vnfr["member-vnf-index-ref"], - existing_vdu["vdu-name"], - existing_vdu.get("count-index") or 0, - ), + "name": instance_name, "description": existing_vdu["vdu-name"], "start": True, "image_id": vim_details["image"]["id"], diff --git a/releasenotes/notes/feature_11043_Instance_name_as_Instantiation_parameters-95d9389b445bf2e3.yaml b/releasenotes/notes/feature_11043_Instance_name_as_Instantiation_parameters-95d9389b445bf2e3.yaml new file mode 100644 index 00000000..20ee4ba0 --- /dev/null +++ b/releasenotes/notes/feature_11043_Instance_name_as_Instantiation_parameters-95d9389b445bf2e3.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