X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Ftests.git;a=blobdiff_plain;f=robot-systest%2Fresources%2Fepa_03-crud_operations_on_sdnc_data.py;h=9a2b201ec6bcf89d45ebfad3e8da0d575ef56386;hp=72eb986bc0f0b825c8a6b50a1c04e5652ae436d1;hb=a5704d6a060b5329e10488a351c50495be69d680;hpb=02454daa68b47818fc9fc7d479b8ef85b51c1603 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 72eb986..9a2b201 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,16 +11,14 @@ # limitations under the License. import os -import yaml from pathlib import Path +import yaml + +from common_helpers import get_prometheus_info + # Prometheus host and port -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" +(prometheus_host, prometheus_port) = get_prometheus_info() # VIM Configuration sdnc_type = "onos" @@ -30,15 +28,21 @@ 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") + 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") + 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 + "'") + 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 + "'") + 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 + "'") + if not "url" in sdnc["auth"]: + raise Exception("URL not found in SDN controller '" + os_sdnc + "'") sdnc_url = sdnc["auth"]["url"]