From: garciadeblas Date: Mon, 23 Sep 2024 10:33:43 +0000 (+0200) Subject: Fix profile_type used in KSU creation and parse responses in multicreate calls X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f2077446e18d0cb45aa5fe4664e047f685f8aa80;p=osm%2Fosmclient.git Fix profile_type used in KSU creation and parse responses in multicreate calls Change-Id: Iaf29de73ad774c501178bf6ce5429079b4ba97b2 Signed-off-by: garciadeblas --- diff --git a/osmclient/cli_commands/ksu.py b/osmclient/cli_commands/ksu.py index cea9005..27f050d 100755 --- a/osmclient/cli_commands/ksu.py +++ b/osmclient/cli_commands/ksu.py @@ -49,6 +49,13 @@ def verify_and_update_ksu(ctx, ksu): else: raise ClientException("Unexpected failure when reading the profile") + profile_type_mapping = { + "infra-controller-profile": "infra_controller_profiles", + "infra-config-profile": "infra_config_profiles", + "app-profile": "app_profiles", + "resource-profile": "resource_profiles", + } + logger.debug("") if "name" not in ksu: raise ClientException("A name must be provided for each KSU") @@ -64,6 +71,8 @@ def verify_and_update_ksu(ctx, ksu): ) else: raise ClientException("A profile id or name must be provided for each KSU") + # Finally update the profile type to use the string expected by NBI + ksu_profile["profile_type"] = profile_type_mapping[ksu_profile_type] else: raise ClientException("A profile must be provided for each KSU") if "oka" in ksu: diff --git a/osmclient/sol005/osm_api_object.py b/osmclient/sol005/osm_api_object.py index 4dfe4cd..0c1ba1e 100644 --- a/osmclient/sol005/osm_api_object.py +++ b/osmclient/sol005/osm_api_object.py @@ -181,7 +181,9 @@ class GenericOSMAPIObject(ABC): if not resp: raise ClientException(f"unexpected response from server - {resp}") resp = json.loads(resp) - print(resp) + # print(resp) + output = ",".join(resp["id"]) + print(output) elif http_code == 204: print("Received")