From 347a779370b29bba7421cdfd9e30048b4ed559a5 Mon Sep 17 00:00:00 2001 From: aguilarherna Date: Mon, 16 Nov 2020 18:18:25 +0100 Subject: [PATCH] Fix bugs in test [epa-03], ignored environment variable OVERRIDES in test [epa-02] and increased wait time in delete NS operation Change-Id: Iea93ca2f58beded55aa7d437a05db86e94f86b6d Signed-off-by: aguilarherna --- robot-systest/lib/ns_lib.robot | 2 +- robot-systest/lib/nsi_lib.robot | 2 +- robot-systest/lib/sdnc_lib.robot | 11 +++- .../epa_03-crud_operations_on_sdnc_data.py | 50 ++++++++----------- .../epa_02-additional_capabilities.robot | 1 + .../epa_03-crud_operations_on_sdnc.robot | 2 +- 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index b3c912f..125ad14 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -13,7 +13,7 @@ *** Variables *** ${success_return_code} 0 ${ns_launch_pol_time} 30sec -${ns_delete_max_wait_time} 3min +${ns_delete_max_wait_time} 4min ${ns_delete_pol_time} 15sec ${ns_action_max_wait_time} 1min ${ns_action_pol_time} 15sec diff --git a/robot-systest/lib/nsi_lib.robot b/robot-systest/lib/nsi_lib.robot index 5152833..7d61dd5 100644 --- a/robot-systest/lib/nsi_lib.robot +++ b/robot-systest/lib/nsi_lib.robot @@ -20,7 +20,7 @@ Library Collections ${success_return_code} 0 ${slice_launch_max_wait_time} 5min ${slice_launch_pol_time} 30sec -${slice_delete_max_wait_time} 1min +${slice_delete_max_wait_time} 4min ${slice_delete_pol_time} 15sec *** Keywords *** diff --git a/robot-systest/lib/sdnc_lib.robot b/robot-systest/lib/sdnc_lib.robot index f1744b0..13cb6dc 100644 --- a/robot-systest/lib/sdnc_lib.robot +++ b/robot-systest/lib/sdnc_lib.robot @@ -36,7 +36,7 @@ Create SDNC ... Example of execution: ... \${sdnc_id}= Create SDNC \${sdnc_name} \${sdnc_user} \${sdnc_password} \${sdnc_url} \${sdnc_type} switch_dpid='{...}' - [Arguments] ${sdcn_name} ${sdnc_user} ${sdnc_password} ${sdnc_url} ${sdnc_type} @{optional_parameters} + [Arguments] ${sdnc_name} ${sdnc_user} ${sdnc_password} ${sdnc_url} ${sdnc_type} @{optional_parameters} ${osm_sdnc_create_command}= Set Variable osm sdnc-create --name ${sdnc_name} --user ${sdnc_user} --password ${sdnc_password} --url ${sdnc_url} --type ${sdnc_type} FOR ${param} IN @{optional_parameters} @@ -49,12 +49,19 @@ Create SDNC [Return] ${stdout} +Check for SDNC To Be Deleted + [Arguments] ${sdnc_name} + + ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name} + Should Not Be Equal As Strings ${stdout} ${sdnc_name} + + Delete SDNC [Arguments] ${sdnc_name} ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm sdnc-delete ${sdnc_name} log ${stdout} - Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for SDNC ${sdnc_name} + Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for SDNC To Be Deleted ${sdnc_name} Get SDNC List diff --git a/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py b/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py index 9a2b201..d195cde 100644 --- a/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py +++ b/robot-systest/resources/epa_03-crud_operations_on_sdnc_data.py @@ -11,38 +11,28 @@ # limitations under the License. import os -from pathlib import Path import yaml - -from common_helpers import get_prometheus_info - +from pathlib import Path # Prometheus host and port -(prometheus_host, prometheus_port) = get_prometheus_info() +if os.environ.get("PROMETHEUS_HOSTNAME", False): + prometheus_host = os.environ.get("PROMETHEUS_HOSTNAME") + prometheus_port = "9090" +else: + prometheus_host = os.environ.get("OSM_HOSTNAME") + prometheus_port = "9091" -# VIM Configuration -sdnc_type = "onos" +# SDNC Configuration sdnc_name = "epa_03_crud_operations_on_sdnc_test" -# Get credentials from ONOS SDNCs file -os_sdnc = os.environ.get("OS_SDNC") -sdncs_file_paths = ["./sdncs.yaml", str(Path.home()) + "/.config/onos/sdncs.yaml"] -for path in sdncs_file_paths: - sdncs_file_path = Path(path) - if sdncs_file_path.exists(): - break -if not sdncs_file_path.exists(): - raise Exception("ONOS sdncs file not found") -with sdncs_file_path.open() as sdncs_file: - sdncs = yaml.safe_load(sdncs_file) - if not os_sdnc in sdncs["sdncs"]: - raise Exception("SDN controller '" + os_sdnc + "' not found") - sdnc = sdncs["sdncs"][os_sdnc] - if not "username" in sdnc["auth"]: - raise Exception("Username not found in SDN controller '" + os_sdnc + "'") - sdnc_user = sdnc["auth"]["username"] - if not "password" in sdnc["auth"]: - raise Exception("Password not found in SDN controller '" + os_sdnc + "'") - sdnc_password = sdnc["auth"]["password"] - if not "url" in sdnc["auth"]: - raise Exception("URL not found in SDN controller '" + os_sdnc + "'") - sdnc_url = sdnc["auth"]["url"] +sdnc_user = os.environ.get("SDNC_USER") +if not sdnc_user: + raise Exception("'SDNC_USER' environment variable not found") +sdnc_password = os.environ.get("SDNC_PASSWORD") +if not sdnc_password: + raise Exception("'SDNC_PASSWORD' environment variable not found") +sdnc_url = os.environ.get("SDNC_URL") +if not sdnc_url: + raise Exception("'SDNC_URL' environment variable not found") +sdnc_type = os.environ.get("SDNC_TYPE") +if not sdnc_type: + raise Exception("'SDNC_TYPE' environment variable not found") diff --git a/robot-systest/testsuite/epa_02-additional_capabilities.robot b/robot-systest/testsuite/epa_02-additional_capabilities.robot index 98d686c..c9db674 100644 --- a/robot-systest/testsuite/epa_02-additional_capabilities.robot +++ b/robot-systest/testsuite/epa_02-additional_capabilities.robot @@ -41,6 +41,7 @@ ${success_return_code} 0 Create VNF Descriptor [Tags] epa_capabilities sanity regression + Remove Environment Variable OVERRIDES Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' diff --git a/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot b/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot index c0e27da..335d619 100644 --- a/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot +++ b/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot @@ -28,7 +28,7 @@ Create Basic SDNC Check for SDNC ${sdnc_name} -Check SDNC Status Is Healthy + Check SDNC Status Is Healthy [Tags] sdnc_crud sanity regression Check for SDNC Status ${sdnc_name} ${prometheus_host} ${prometheus_port} -- 2.17.1