Skip to content
Snippets Groups Projects
Commit bc884059 authored by garciadeblas's avatar garciadeblas
Browse files

Replace prometheus host and port by URL and infer it from OSM_HOSTNAME


Change-Id: Iff647f8c61ad3891ff995f4d458ce93e0a0d9ac6
Signed-off-by: default avatargarciadeblas <gerardo.garciadeblas@telefonica.com>
parent 8103a553
Branches v15.0
Tags v15.0.2
No related merge requests found
Showing with 56 additions and 42 deletions
......@@ -34,13 +34,18 @@ ${PROMETHEUS_PASSWORD} %{PROMETHEUS_PASSWORD=""}
Set Testsuite Prometheus Variables
[Documentation] Set Testsuite Prometheus Variables to be used in subsequent test cases
IF ${PROMETHEUS_HOST} == 'UNKNOWN'
IF '${PROMETHEUS_HOST}' == 'UNKNOWN'
${local_prometheus_host}= Get Environment Variable OSM_HOSTNAME
IF '${local_prometheus_host}'.startswith('nbi.')
${local_prometheus_host}= Replace String ${local_prometheus_host} nbi. prometheus.
END
Set Suite Variable ${PROMETHEUS_HOST} ${local_prometheus_host}
Set Suite Variable ${PROMETHEUS_HOST} 9091
Set Suite Variable ${PROMETHEUS_PORT} 80
END
Set Suite Variable ${PROMETHEUS_URL} http://${PROMETHEUS_HOST}:${PROMETHEUS_PORT}
Log ${PROMETHEUS_PORT}
Log ${PROMETHEUS_HOST}
Log ${PROMETHEUS_URL}
Log ${PROMETHEUS_USER}
Log ${PROMETHEUS_PASSWORD}
......@@ -49,16 +54,22 @@ Get Metric
... The filter parameters are given to this function in key=value format (one argument per key/value pair).
... Fails if the metric is not found or has multiple values.
... Examples of execution:
... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} ${prometheus_password} \${metric}
... \${metric}= Get Metric \${prometheus_ip} \${prometheus_port} ${prometheus_password} \${metric} \${param1}=\${value1} \${param2}=\${value2}
[Arguments] ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} ${metric} @{filter_parameters}
... \${metric}= Get Metric \${prometheus_url} ${prometheus_password} \${metric}
... \${metric}= Get Metric \${prometheus_url} ${prometheus_password} \${metric} \${param1}=\${value1} \${param2}=\${value2}
[Arguments] ${prometheus_url} ${prometheus_user} ${prometheus_password} ${metric} @{filter_parameters}
Log ${prometheus_url}
Log ${prometheus_user}
Log ${prometheus_password}
Log ${metric}
Log ${filter_parameters}
${filter}= Set Variable ${EMPTY}
FOR ${param} IN @{filter_parameters}
${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in filter parameters
Log ${match},${param_name},${param_value}
${filter}= Catenate SEPARATOR= ${filter} ${param_name}="${param_value}",
END
${resp}= Execute Prometheus Instant Query ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}}
${resp}= Execute Prometheus Instant Query ${prometheus_url} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}}
Log ${resp}
${result_list}= Convert To List ${resp["data"]["result"]}
${results}= Get Length ${result_list}
Should Not Be Equal As Numbers 0 ${results} msg=Metric ${metric} not found values=false
......@@ -68,10 +79,14 @@ Get Metric
Execute Prometheus Instant Query
[Documentation] Execute a Prometheus Instant Query using HTTP API.
... Return an inline json with the result of the query.
... The requested URL is the next: http://\${prometheus_ip}:\${prometheus_port}/api/v1/query?\${querystring}
[Arguments] ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} ${querystring}
... The requested URL is the next: \${prometheus_url}/api/v1/query?\${querystring}
[Arguments] ${prometheus_url} ${prometheus_user} ${prometheus_password} ${querystring}
Log ${prometheus_url}
Log ${prometheus_user}
Log ${prometheus_password}
Log ${querystring}
${auth}= IF '${prometheus_password}' != '${EMPTY}' Create List ${prometheus_user} ${prometheus_password} ELSE Set Variable None
Create Session prometheus http://${prometheus_ip}:${prometheus_port} timeout=${TIMEOUT} max_retries=${MAX_RETRIES} verify=false auth=${auth}
Create Session prometheus ${prometheus_url} timeout=${TIMEOUT} max_retries=${MAX_RETRIES} verify=false auth=${auth}
${resp}= GET On Session prometheus /api/v1/query?${querystring} timeout=${TIMEOUT}
Status Should Be 200 ${resp}
RETURN ${resp.json()}
......@@ -79,8 +79,8 @@ Check For SDNC
Check For SDNC Status
[Documentation] Check in a loop if the value of the metric osm_sdnc_status in Prometheus for the SDN controller is 1 (reachable).
[Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
Wait Until Keyword Succeeds ${SDNC_STATUS_MAX_WAIT_TIME} ${SDNC_STATUS_POL_TIME} Check If SDNC Is Available ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
[Arguments] ${sdnc_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
Wait Until Keyword Succeeds ${SDNC_STATUS_MAX_WAIT_TIME} ${SDNC_STATUS_POL_TIME} Check If SDNC Is Available ${sdnc_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
Get SDNC ID
[Documentation] Check if an SDN controller identified by name exists in OSM, and return the id.
......@@ -92,6 +92,6 @@ Get SDNC ID
Check If SDNC Is Available
[Documentation] Check if the value of the metric osm_sdnc_status in Prometheus for the SDN controller is 1 (reachable).
[Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_sdnc_status sdnc_id=${sdnc_id}
[Arguments] ${sdnc_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
${metric}= Get Metric ${prometheus_url} ${prometheus_user} ${prometheus_password} osm_sdnc_status sdnc_id=${sdnc_id}
Should Be Equal As Integers ${metric} 1 msg=SDNC '${sdnc_id}' is not active values=false
......@@ -73,15 +73,15 @@ Check For VIM Target
Check For VIM Target Metric
[Documentation] Check in a loop if the metric of osm_vim_status is present in Prometheus for the VIM account in OSM.
[Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
[Arguments] ${vim_name} ${prometheus_url} ${prometheus_user} ${prometheus_password}
${vim_account_id}= Get VIM Target ID ${vim_name}
Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
Check For VIM Target Status
[Documentation] Check in a loop if the value of the metric osm_vim_status in Prometheus for the VIM account is 1 (reachable).
[Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
[Arguments] ${vim_name} ${prometheus_url} ${prometheus_user} ${prometheus_password}
${vim_account_id}= Get VIM Target ID ${vim_name}
Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
Wait Until Keyword Succeeds ${VIM_STATUS_MAX_WAIT_TIME} ${VIM_STATUS_POL_TIME} Check If VIM Target Is Available ${vim_account_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
Get VIM Target ID
[Documentation] Get from OSM the VIM account id associated to the VIM account name passed as parameter.
......@@ -105,12 +105,16 @@ Check If VIM Target Is Enabled
Check If VIM Target Is Available
[Documentation] Check if the value of the metric osm_vim_status in Prometheus for the VIM account is 1 (reachable).
[Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
[Arguments] ${vim_account_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
Log ${prometheus_url}
Log ${prometheus_user}
Log ${prometheus_password}
Log ${vim_account_id}
${metric}= Get Metric ${prometheus_url} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false
Check If VIM Target Has Metric
[Documentation] Check if the metric of osm_vim_status is present in Prometheus for the VIM account in OSM.
[Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password}
${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
[Arguments] ${vim_account_id} ${prometheus_url} ${prometheus_user} ${prometheus_password}
${metric}= Get Metric ${prometheus_url} ${prometheus_user} ${prometheus_password} osm_vim_status vim_account_id=${vim_account_id}
Should Be True ${metric} <2 msg=VIM Target '${vim_account_id}' has no metric
......@@ -37,7 +37,7 @@ Create VIM Target Basic
${CREATED_VIM_ACCOUNT_ID}= Create VIM Target ${VIM_NAME} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE}
Set Suite Variable ${CREATED_VIM_ACCOUNT_ID}
Check VIM Target Operational State ${VIM_NAME}
${stdout}= Check For VIM Target Metric ${VIM_NAME} ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
${stdout}= Check For VIM Target Metric ${VIM_NAME} ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Log ${stdout}
Delete VIM Target By Name
......@@ -58,7 +58,7 @@ Create VIM Target With Extra Config
${CREATED_VIM_ACCOUNT_ID}= Create VIM Target ${VIM_NAME} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE} config=${VIM_CONFIG}
Set Suite Variable ${CREATED_VIM_ACCOUNT_ID}
Check VIM Target Operational State ${VIM_NAME}
Check For VIM Target Status ${VIM_NAME} ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Check For VIM Target Status ${VIM_NAME} ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Delete VIM Target By ID
[Documentation] Delete the VIM Target created in previous test-case by its ID.
......
......@@ -57,7 +57,7 @@ Create VIM With Port Security Disabled
... (no firewall).
${created_vim_account_id}= Create VIM Target ${VIM_NAME} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE} config=${VIM_CONFIG}
Log ${created_vim_account_id}
Check For VIM Target Status ${VIM_NAME} ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Check For VIM Target Status ${VIM_NAME} ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Create VNF Descriptor
[Documentation] Upload VNF package for the testsuite.
......
......@@ -40,7 +40,7 @@ Create Basic SDNC
Check SDNC Status Is Healthy
[Documentation] Check in Prometheus that the SDN controller is in healthy state.
Check For SDNC Status ${SDNC_ID} ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Check For SDNC Status ${SDNC_ID} ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD}
Delete Basic SDNC
[Documentation] Delete SDN controller from OSM.
......
......@@ -75,14 +75,13 @@ Get VNF VIM-based Metrics
[Documentation] Check that the expected metrics are present in Prometheus (pushed from SA modules).
Variable Should Exist ${PROMETHEUS_POLL_RETRIES} msg=Metric polling retries is not available
Variable Should Exist ${PROMETHEUS_POLL_TIMEOUT} msg=Metric polling timeout is not available
Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
Variable Should Exist ${PROMETHEUS_URL} msg=Prometheus URL is not available
Variable Should Exist ${METRIC_1_NAME} msg=Prometheus first metric name is not available
Variable Should Exist ${METRIC_2_NAME} msg=Prometheus second metric name is not available
${metric_filter}= Set Variable ns_id=${NS_ID}
${metric_1_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_1_NAME} ${metric_filter}
${metric_1_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_1_NAME} ${metric_filter}
IF ${metric_1_value} <= 0 Fail msg=The metric '${METRIC_1_NAME}' value is '${metric_1_value}'
${metric_2_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_2_NAME} ${metric_filter}
${metric_2_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_2_NAME} ${metric_filter}
IF ${metric_2_value} <= 0 Fail msg=The metric '${METRIC_2_NAME}' value is '${metric_2_value}'
Delete NS Instance
......
......@@ -110,11 +110,10 @@ Get VNF VIM-based Metric Before Auto-scaling
[Documentation] Get from Prometheus the VIM metric associated to the VNF auto-scaling group.
Variable Should Exist ${PROMETHEUS_POLL_RETRIES} msg=Metric polling retries is not available
Variable Should Exist ${PROMETHEUS_POLL_TIMEOUT} msg=Metric polling timeout is not available
Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
Variable Should Exist ${PROMETHEUS_URL} msg=Prometheus URL is not available
Variable Should Exist ${METRIC_NAME} msg=Prometheus metric name is not available
${metric_filter}= Set Variable ns_id=${NS_ID}
${metric_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
${metric_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
IF ${metric_value} <= 0
Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}'
END
......@@ -179,11 +178,10 @@ Suite Cleanup
Check VIM-based Metric Exceeds Threshold
[Documentation] Auxiliar keyword to check if metric exceeds threshold
Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
Variable Should Exist ${PROMETHEUS_URL} msg=Prometheus URL is not available
Variable Should Exist ${METRIC_NAME} msg=Prometheus metric name is not available
${metric_filter}= Set Variable ns_id=${NS_ID}
${metric_value}= Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
${metric_value}= Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
IF ${metric_value} <= ${METRIC_THRESHOLD}
Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}' which is lower than '${METRIC_THRESHOLD}'
END
......@@ -128,11 +128,10 @@ Get Alarm Metric
[Documentation] Check that the expected metric is present in Prometheus (pushed from SA modules).
Variable Should Exist ${PROMETHEUS_POLL_RETRIES} msg=Metric polling retries is not available
Variable Should Exist ${PROMETHEUS_POLL_TIMEOUT} msg=Metric polling timeout is not available
Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
Variable Should Exist ${PROMETHEUS_URL} msg=Prometheus URL is not available
Variable Should Exist ${METRIC_NAME} msg=Prometheus metric name is not available
${metric_filter}= Set Variable ns_id=${NS_ID}
${metric_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
${metric_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_NAME} ${metric_filter}
IF ${metric_value} <= 0 Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}'
Check Alarms Were Received
......
......@@ -71,13 +71,12 @@ Instantiate Network Service
Get VNF SNMP Metrics
[Documentation] Check that SNMP metrics from the VNF are stored in Prometheus.
Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
Variable Should Exist ${PROMETHEUS_URL} msg=Prometheus URL is not available
Variable Should Exist ${METRIC_1_NAME} msg=Prometheus first metric name is not available
Variable Should Exist ${METRIC_2_NAME} msg=Prometheus second metric name is not available
${metric_1_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_1_NAME} ${METRIC_1_FILTER}
${metric_1_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_1_NAME} ${METRIC_1_FILTER}
IF ${metric_1_value} <= 0 Fail msg=The metric '${METRIC_1_NAME}' value is '${metric_1_value}'
${metric_2_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_2_NAME} ${METRIC_2_FILTER}
${metric_2_value}= Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Get Metric ${PROMETHEUS_URL} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} ${METRIC_2_NAME} ${METRIC_2_FILTER}
IF ${metric_2_value} <= 0 Fail msg=The metric '${METRIC_2_NAME}' value is '${metric_2_value}'
Delete NS Instance
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment