Revert "Feature 11001: Robot framework linting for E2E tests"
[osm/tests.git] / robot-systest / lib / prometheus_lib.robot
index 5fdda49..0f4f07c 100644 (file)
@@ -15,15 +15,34 @@ Documentation   Library to obtain metrics from Prometheus.
 
 Library   String
 Library   Collections
+Library   OperatingSystem
 Library   RequestsLibrary
 
 
 *** Variables ***
 ${timeout}   30
 ${max_retries}   1
+${prometheus_host}   %{PROMETHEUS_HOSTNAME=UNKNOWN}
+${prometheus_port}   %{PROMETHEUS_PORT=9090}
+${prometheus_user}   %{PROMETHEUS_USER=""}
+${prometheus_password}   %{PROMETHEUS_PASSWORD=""}
 
 
 *** Keywords ***
+Set Testsuite Prometheus Variables
+    [Documentation]   Set Testsuite Prometheus Variables to be used in subsequent test cases
+
+    IF   '${prometheus_host}' == 'UNKNOWN'
+        ${local_prometheus_host}=   Get Environment Variable   OSM_HOSTNAME
+        Set Suite Variable   ${prometheus_host}   ${local_prometheus_host}
+        Set Suite Variable   ${prometheus_port}   9091
+    END
+    Log   ${prometheus_port}
+    Log   ${prometheus_host}
+    Log   ${prometheus_user}
+    Log   ${prometheus_password}
+
+
 Get Metric
     [Documentation]   Get the instant value of a metric from Prometheus using multiple filter parameters.
     ...                 The filter parameters are given to this function in key=value format (one argument per key/value pair).