From 94f99626bae5cc9f032668abd6d7a693a79cb89d Mon Sep 17 00:00:00 2001 From: Guillermo Calvino Date: Tue, 22 Nov 2022 13:34:31 +0100 Subject: [PATCH] Bug 2198 - NBI authentication uses fix username, password and project Change-Id: Ibca350611263fd354365a183dbb16b8c347adfb3 Signed-off-by: Guillermo Calvino (cherry picked from commit b3d11c091bbb6a893bcbac1ef561af632b5a263c) --- robot-systest/lib/sol003_common_lib.robot | 3 ++- robot-systest/resources/common_helpers.py | 7 +++++++ .../sol003_01-vnf_lifecycle_management.py | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 robot-systest/resources/sol003_01-vnf_lifecycle_management.py diff --git a/robot-systest/lib/sol003_common_lib.robot b/robot-systest/lib/sol003_common_lib.robot index 6617e91..5231e92 100644 --- a/robot-systest/lib/sol003_common_lib.robot +++ b/robot-systest/lib/sol003_common_lib.robot @@ -20,6 +20,7 @@ Library JSONLibrary Library String Library OperatingSystem Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot +Variables %{ROBOT_DEVOPS_FOLDER}/resources/sol003_01-vnf_lifecycle_management.py *** Variables *** @{success_status_code_list} 200 201 202 204 @@ -36,7 +37,7 @@ Get Auth Token Get Hostname Create Session osmhit ${HOST} &{headers} Create Dictionary Content-Type=application/json Accept=application/json - &{data} Create Dictionary username=admin password=admin project-id=admin + &{data} Create Dictionary username=${osm_user} password=${osm_password} project-id=${osm_project} ${resp}= Post On Session osmhit ${auth_token_uri} json=${data} headers=${headers} log ${resp} Pass Execution If ${resp.status_code} in ${success_status_code_list} Get Auth Token completed diff --git a/robot-systest/resources/common_helpers.py b/robot-systest/resources/common_helpers.py index 87a3d34..3753555 100644 --- a/robot-systest/resources/common_helpers.py +++ b/robot-systest/resources/common_helpers.py @@ -22,3 +22,10 @@ def get_prometheus_info(): prometheus_user = os.environ.get("PROMETHEUS_USER", "") prometheus_password = os.environ.get("PROMETHEUS_PASSWORD", "") return prometheus_host, prometheus_port, prometheus_user, prometheus_password + + +def get_osm_info(): + osm_user = os.environ.get("OSM_USER", "admin") + osm_password = os.environ.get("OSM_PASSWORD", "admin") + osm_project = os.environ.get("OSM_PROJECT", "admin") + return osm_user, osm_password, osm_project diff --git a/robot-systest/resources/sol003_01-vnf_lifecycle_management.py b/robot-systest/resources/sol003_01-vnf_lifecycle_management.py new file mode 100644 index 0000000..a722445 --- /dev/null +++ b/robot-systest/resources/sol003_01-vnf_lifecycle_management.py @@ -0,0 +1,18 @@ +# 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. + +from pathlib import Path + +from common_helpers import get_osm_info + + +(osm_user, osm_password, osm_project) = get_osm_info() -- 2.25.1