"scope": target_affinity_group["scope"],
}
+ if target_affinity_group.get("vim-affinity-group-id"):
+ affinity_group_data[
+ "vim-affinity-group-id"
+ ] = target_affinity_group["vim-affinity-group-id"]
+
extra_dict["params"] = {
"affinity_group_data": affinity_group_data,
}
try:
affinity_group_vim_id = None
+ affinity_group_data = None
if task.get("params"):
- affinity_group_data = task["params"]["affinity_group_data"]
+ affinity_group_data = task["params"].get("affinity_group_data")
+
+ if affinity_group_data and affinity_group_data.get("vim-affinity-group-id"):
+ try:
+ param_affinity_group_id = task["params"]["affinity_group_data"].get(
+ "vim-affinity-group-id"
+ )
+ affinity_group_vim_id = target_vim.get_affinity_group(
+ param_affinity_group_id
+ ).get("id")
+ except vimconn.VimConnNotFoundException:
+ self.logger.error(
+ "task={} {} new-affinity-or-anti-affinity-group. Provided VIM Affinity Group ID {}"
+ "could not be found at VIM. Creating a new one.".format(
+ task_id, ro_task["target_id"], param_affinity_group_id
+ )
+ )
+
+ if not affinity_group_vim_id and affinity_group_data:
affinity_group_vim_id = target_vim.new_affinity_group(
affinity_group_data
)
--- /dev/null
+#######################################################################################
+# 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:
+ - |
+ This fixes the bug 2013 Anti-affinity group cannot be passed as instantiation
+ parameter. NBI and RO are affected. For RO, if the attribute vim-affinity-group-id
+ is present if the affinity group info, it is checked that it exists at the VIM
+ and then is used. If it does not exist, an error message is shown in the RO logs,
+ the atribute is ignored and a new new server group is created.