2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
16 Documentation [SA-08] VNF with VNF-based indicators through SNMP.
18 Library OperatingSystem
22 Resource ../lib/vnfd_lib.resource
23 Resource ../lib/nsd_lib.resource
24 Resource ../lib/ns_lib.resource
25 Resource ../lib/ssh_lib.resource
26 Resource ../lib/prometheus_lib.resource
28 Test Tags sa_08 cluster_k8s daily regression
30 Suite Setup Run Keyword And Ignore Error Suite Preparation
31 Suite Teardown Run Keyword And Ignore Error Suite Cleanup
35 # NS instantiation parameters
36 ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
38 # NS and VNF descriptor package folder and ids
39 ${VNFD_PKG} snmp_ee_vnf
40 ${VNFD_NAME} snmp_ee-vnf
42 ${NSD_NAME} snmp_ee-ns
45 ${NS_NAME} sa_08-vnf_with_vnf_indicators_snmp_test
47 # Prometheus polling interval and retries
48 ${PROMETHEUS_POLL_RETRIES} 10 times
49 ${PROMETHEUS_POLL_TIMEOUT} 1 minute
51 # Prometheus metrics to retrieve
52 ${METRIC_1_NAME} ifInOctets
53 ${METRIC_1_FILTER} ifIndex=1
54 ${METRIC_2_NAME} ifMtu
55 ${METRIC_2_FILTER} ifIndex=2
60 [Documentation] Upload VNF package for the testsuite.
61 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
64 [Documentation] Upload NS package for the testsuite.
65 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
67 Instantiate Network Service
68 [Documentation] Instantiate the NS for the testsuite.
69 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY}
70 Set Suite Variable ${NS_ID} ${id}
73 [Documentation] Check that SNMP metrics from the VNF are stored in Prometheus.
74 Variable Should Exist ${PROMETHEUS_HOST} msg=Prometheus address is not available
75 Variable Should Exist ${PROMETHEUS_PORT} msg=Prometheus port is not available
76 Variable Should Exist ${METRIC_1_NAME} msg=Prometheus first metric name is not available
77 Variable Should Exist ${METRIC_2_NAME} msg=Prometheus second metric name is not available
78 ${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}
79 IF ${metric_1_value} <= 0 Fail msg=The metric '${METRIC_1_NAME}' value is '${metric_1_value}'
80 ${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}
81 IF ${metric_2_value} <= 0 Fail msg=The metric '${METRIC_2_NAME}' value is '${metric_2_value}'
84 [Documentation] Delete NS instance.
89 [Documentation] Delete NS package from OSM.
91 Delete NSD ${NSD_NAME}
94 [Documentation] Delete VNF package from OSM.
96 Delete VNFD ${VNFD_NAME}
101 [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables
102 Set Testsuite Prometheus Variables
105 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
106 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
107 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
108 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}