From d846e8ffaeddd9ebe59ae126fcb61a814686443f Mon Sep 17 00:00:00 2001 From: kayal2001 Date: Mon, 6 Nov 2023 09:15:51 +0000 Subject: [PATCH] Fix Bug 2303:NS instance name getting truncated in OpenStack Change-Id: Ifcd11c79289d8b792c944f8cb0de46e6d967dc04 Signed-off-by: kayal2001 Signed-off-by: garciadeblas --- NG-RO/osm_ng_ro/ns.py | 12 +++++----- NG-RO/osm_ng_ro/tests/test_ns.py | 4 ++-- .../notes/fix_bug_2303-ce9784503f03a941.yaml | 24 +++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/fix_bug_2303-ce9784503f03a941.yaml diff --git a/NG-RO/osm_ng_ro/ns.py b/NG-RO/osm_ng_ro/ns.py index a1d27364..9678366d 100644 --- a/NG-RO/osm_ng_ro/ns.py +++ b/NG-RO/osm_ng_ro/ns.py @@ -1611,9 +1611,9 @@ class Ns(object): extra_dict["params"] = { "name": "{}-{}-{}-{}".format( - indata["name"][:16], - vnfr["member-vnf-index-ref"][:16], - target_vdu["vdu-name"][:32], + indata["name"], + vnfr["member-vnf-index-ref"], + target_vdu["vdu-name"], target_vdu.get("count-index") or 0, ), "description": target_vdu["vdu-name"], @@ -1844,9 +1844,9 @@ class Ns(object): extra_dict["params"] = { "name": "{}-{}-{}-{}".format( - db_nsr["name"][:16], - vnfr["member-vnf-index-ref"][:16], - existing_vdu["vdu-name"][:32], + db_nsr["name"], + vnfr["member-vnf-index-ref"], + existing_vdu["vdu-name"], existing_vdu.get("count-index") or 0, ), "description": existing_vdu["vdu-name"], diff --git a/NG-RO/osm_ng_ro/tests/test_ns.py b/NG-RO/osm_ng_ro/tests/test_ns.py index c692c51b..b5c81fd9 100644 --- a/NG-RO/osm_ng_ro/tests/test_ns.py +++ b/NG-RO/osm_ng_ro/tests/test_ns.py @@ -181,7 +181,7 @@ expected_extra_dict = { "disk_list": [], "flavor_id": f"TASK-{ns_preffix}:flavor.0", "image_id": f"TASK-{ns_preffix}:image.0", - "name": "sample_name-vnf-several-volu-several_volumes-VM-0", + "name": "sample_name-vnf-several-volumes-several_volumes-VM-0", "net_list": [], "start": True, }, @@ -201,7 +201,7 @@ expected_extra_dict2 = { "disk_list": [], "flavor_id": f"TASK-{ns_preffix}:flavor.0", "image_id": f"TASK-{ns_preffix}:image.0", - "name": "sample_name-vnf-several-volu-without_volumes-VM-0", + "name": "sample_name-vnf-several-volumes-without_volumes-VM-0", "net_list": [], "start": True, }, diff --git a/releasenotes/notes/fix_bug_2303-ce9784503f03a941.yaml b/releasenotes/notes/fix_bug_2303-ce9784503f03a941.yaml new file mode 100644 index 00000000..af477b7c --- /dev/null +++ b/releasenotes/notes/fix_bug_2303-ce9784503f03a941.yaml @@ -0,0 +1,24 @@ +####################################################################################### +# 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 2303: RO Openstack connector was truncating each of the fields used to + build the name of VM instances. This fix removes that truncate in favor of + generating the whole name `---`. In case + the name must be truncated, it should be done from the resulting full name. + -- 2.25.1