Bug_Fix-2347 Facing inconsistencies while launching NS with Affinity/Anti-Affinity policy
Change-Id: I8a67023efebbca9a40cecc29bd2b432d9cf8ce83
Signed-off-by: kayal2001 <kayalvizhi.v@tataelxsi.co.in>
diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py
index 3afa396..e7082d0 100644
--- a/NG-RO/osm_ng_ro/ns.py
+++ b/NG-RO/osm_ng_ro/ns.py
@@ -2734,6 +2734,7 @@
"""
+ task_id_list = []
for change in changes_list:
task = Ns._create_task(
deployment_info=change["deployment_info"],
@@ -2744,6 +2745,15 @@
target_record_id=change["target_record_id"],
extra_dict=change.get("extra_dict", None),
)
+ if task.get("item") == "vdu" and task.get("params", {}).get(
+ "affinity_group_list"
+ ):
+ task_id_list.append(task["task_id"])
+ target_record_data = task["target_record"].split(":")
+ vdur_index = target_record_data[2].split(".")[1]
+ if vdur_index != "0":
+ self.insert_task_id(task_id_list, task)
+ del task_id_list[0]
self.logger.debug("ns.define_all_tasks task={}".format(task))
tasks_by_target_record_id[change["target_record_id"]] = task
@@ -2752,6 +2762,15 @@
if change.get("common_id"):
task["common_id"] = change["common_id"]
+ def insert_task_id(self, task_id_list, task):
+ for index, value in enumerate(task_id_list):
+ if index != 0:
+ task_id = task_id_list[index - 1]
+ vdur_text = "{}".format(task_id)
+ task.get("depends_on").append(vdur_text)
+ break
+ return task
+
def upload_all_tasks(
self,
db_new_tasks,
diff --git a/releasenotes/notes/fix_bug_2347-94334eb22cc3bd3d.yaml b/releasenotes/notes/fix_bug_2347-94334eb22cc3bd3d.yaml
new file mode 100644
index 0000000..20ee4ba
--- /dev/null
+++ b/releasenotes/notes/fix_bug_2347-94334eb22cc3bd3d.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.