From b9317cf8db6ede10ee63a1e648a2ed066ee05892 Mon Sep 17 00:00:00 2001 From: 36970 Date: Mon, 1 Apr 2024 11:32:30 +0000 Subject: [PATCH 1/4] Bug 2364 fixed: Performing NS-Heal when there are two NS with same member-vnf-index Change-Id: Iecdf20402467342b079a933dc284a338e93191ea Signed-off-by: 36970 --- osmclient/sol005/vnf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osmclient/sol005/vnf.py b/osmclient/sol005/vnf.py index f7c20d9..12e789f 100644 --- a/osmclient/sol005/vnf.py +++ b/osmclient/sol005/vnf.py @@ -46,7 +46,7 @@ class Vnf(object): if ns: ns_instance = self._client.ns.get(ns) if filter_string: - filter_string += ",nsr-id-ref={}".format(ns_instance["_id"]) + filter_string += "&nsr-id-ref={}".format(ns_instance["_id"]) else: filter_string = "?nsr-id-ref={}".format(ns_instance["_id"]) _, resp = self._http.get2_cmd("{}{}".format(self._apiBase, filter_string)) -- 2.25.1 From 7488e41c44830201ba6e79530067b662b7efc4be Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 23 Apr 2024 10:07:42 +0200 Subject: [PATCH 2/4] Feature 11037 Changes to work with ingress controller Change-Id: I75657d047fd528f5a960bdc42281d0b370bf5c0d Signed-off-by: garciadeblas --- osmclient/sol005/client.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index 5146fe2..fadd377 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -63,17 +63,19 @@ class Client(object): self._auth_endpoint = "/admin/v1/tokens" self._headers = {} self._token = None - if len(host.split(":")) > 1: - # backwards compatible, port provided as part of host - self._host = host.split(":")[0] - self._so_port = host.split(":")[1] + self._url = None + if host.startswith("http://") or host.startswith("https://"): + self._url = self._host else: - self._host = host - self._so_port = so_port - - self._http_client = http.Http( - "https://{}:{}/osm".format(self._host, self._so_port), **kwargs - ) + if len(host.split(":")) > 1: + # backwards compatible, port provided as part of host + self._host = host.split(":")[0] + self._so_port = host.split(":")[1] + else: + self._host = host + self._so_port = so_port + self._url = "https://{}:{}/osm".format(self._host, self._so_port) + self._http_client = http.Http(self._url, **kwargs) self._headers["Accept"] = "application/json" self._headers["Content-Type"] = "application/yaml" self._http_client.set_http_header(self._headers) -- 2.25.1 From 933b0ab9033b1144db57948bf8517ce7b5303421 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Wed, 22 May 2024 23:47:28 +0200 Subject: [PATCH 3/4] Fix pylint issues appeared with version 3.2.2 of pylint Change-Id: Iae943e2a3b26b8eed616509ec9a3a4cbc493aa6e Signed-off-by: garciadeblas --- osmclient/cli_commands/utils.py | 2 ++ osmclient/common/package_tool.py | 2 ++ osmclient/sol005/ns.py | 2 +- tox.ini | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osmclient/cli_commands/utils.py b/osmclient/cli_commands/utils.py index 9ec03f6..25fc21a 100755 --- a/osmclient/cli_commands/utils.py +++ b/osmclient/cli_commands/utils.py @@ -48,6 +48,8 @@ def check_client_version(obj, what, version="sol005"): message = f"The following commands or options are only supported with the version v1 of OSM SOL005': {what}" elif version == "sol005_v2": message = f"The following commands or options are only supported with the version v2 of OSM SOL005': {what}" + else: + message = f"The following commands or options are only supported with the version {version} of OSM SOL005': {what}" fullclassname = obj.__module__ + "." + obj.__class__.__name__ if fullclassname != "osmclient.{}.client.Client".format(version): raise ClientException(message) diff --git a/osmclient/common/package_tool.py b/osmclient/common/package_tool.py index a2cbd87..b1565ea 100644 --- a/osmclient/common/package_tool.py +++ b/osmclient/common/package_tool.py @@ -708,6 +708,8 @@ class PackageTool(object): or package_handling.SOL004_TOSCA == package_type ): the_package = SOL004Package(package_folder) + else: + raise ClientException(f"Unknown package type: {package_type}") the_package.create_or_update_metadata_file() diff --git a/osmclient/sol005/ns.py b/osmclient/sol005/ns.py index e8442f9..8328dba 100644 --- a/osmclient/sol005/ns.py +++ b/osmclient/sol005/ns.py @@ -613,7 +613,7 @@ class Ns(object): http_code, resp = self._http.get2_cmd( "{}/{}".format(self._apiBase, uuid) ) - if not uuid: + else: # if not uuid http_code, resp = self._http.get2_cmd( "{}/{}/{}/{}".format(self._apiBase, uuid, project_name, ns_id) ) diff --git a/tox.ini b/tox.ini index f822051..8c89a9d 100644 --- a/tox.ini +++ b/tox.ini @@ -64,7 +64,7 @@ commands = deps = {[testenv]deps} -r{toxinidir}/requirements-dev.txt -r{toxinidir}/requirements-test.txt - pylint==3.0.3 + pylint==3.2.2 commands = pylint -E osmclient/ -- 2.25.1 From f5b188e14053b2246be507a23d9eef5ff7e42123 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Wed, 22 May 2024 18:51:48 +0200 Subject: [PATCH 4/4] Feature 11037 Change default NBI port Change-Id: I6061cef2ca869eb8286cd03522e3508e327517dd Signed-off-by: garciadeblas --- osmclient/sol005/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osmclient/sol005/client.py b/osmclient/sol005/client.py index fadd377..fe72850 100644 --- a/osmclient/sol005/client.py +++ b/osmclient/sol005/client.py @@ -48,7 +48,7 @@ class Client(object): def __init__( self, host=None, - so_port=9999, + so_port=443, user="admin", password="admin", project="admin", -- 2.25.1