From 5e001f506b744021d5ef25999c9da28cf56d8fbc Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 23 Nov 2023 16:02:56 +0100 Subject: [PATCH] Feature 11001: Robot framework linting for E2E tests This change includes robotframework-lint and robocop checks which will improve code maintenance. In addition, all references to ROBOT_DEVOPS_FOLDER have been properly replaced in all testsuites. Change-Id: I844a353bdfc1dde6f068a879002d16429d304e65 Signed-off-by: garciadeblas --- devops-stages/stage-test.sh | 2 - ...ty_lib.robot => connectivity_lib.resource} | 24 +- .../lib/{juju_lib.robot => juju_lib.resource} | 30 +- robot-systest/lib/k8scluster_lib.resource | 90 ++++ robot-systest/lib/k8scluster_lib.robot | 71 --- robot-systest/lib/ns_lib.resource | 221 +++++++++ robot-systest/lib/ns_lib.robot | 427 ------------------ robot-systest/lib/ns_operation_lib.resource | 189 ++++++++ .../lib/{nsd_lib.robot => nsd_lib.resource} | 46 +- .../lib/{nsi_lib.robot => nsi_lib.resource} | 118 ++--- robot-systest/lib/nst_lib.resource | 57 +++ robot-systest/lib/nst_lib.robot | 53 --- ...stack_lib.robot => openstack_lib.resource} | 156 +++---- ...package_lib.robot => package_lib.resource} | 56 +-- ...project_lib.robot => project_lib.resource} | 89 ++-- ...heus_lib.robot => prometheus_lib.resource} | 48 +- robot-systest/lib/repo_lib.resource | 59 +++ robot-systest/lib/repo_lib.robot | 52 --- robot-systest/lib/rest_lib.resource | 109 +++++ robot-systest/lib/rest_lib.robot | 95 ---- .../lib/{role_lib.robot => role_lib.resource} | 46 +- .../lib/{sdnc_lib.robot => sdnc_lib.resource} | 78 ++-- .../lib/{ssh_lib.robot => ssh_lib.resource} | 69 ++- .../lib/{user_lib.robot => user_lib.resource} | 43 +- .../lib/{vim_lib.robot => vim_lib.resource} | 96 ++-- .../lib/{vnf_lib.robot => vnf_lib.resource} | 68 ++- .../lib/{vnfd_lib.robot => vnfd_lib.resource} | 91 ++-- ..._01-crud_operations_on_vim_targets_data.py | 11 +- ...isable_port_security_network_level_data.py | 9 +- .../basic_32-volume_with_different_az.py | 2 +- robot-systest/run_test.sh | 2 +- ...ic_01-crud_operations_on_vim_targets.robot | 57 ++- ...stantiation_parameters_in_cloud_init.robot | 83 ++-- .../testsuite/basic_06-vnf_with_charm.robot | 147 +++--- .../basic_07-secure_key_management.robot | 113 +++-- ...-disable_port_security_network_level.robot | 82 ++-- .../basic_09-manual_vdu_scaling.robot | 122 +++-- .../testsuite/basic_11-native_charms.robot | 115 +++-- .../testsuite/basic_12-ns_primitives.robot | 136 +++--- .../testsuite/basic_13-ns_relations.robot | 105 ++--- .../testsuite/basic_14-vnf_relations.robot | 74 ++- .../basic_15-rbac_configurations.robot | 93 ++-- ...c_16-advanced_onboarding_and_scaling.robot | 131 +++--- .../basic_17-delete_vnf_package.robot | 47 +- .../testsuite/basic_18-ns_ip_profile.robot | 232 +++++----- .../testsuite/basic_19-vnf_ip_profile.robot | 104 ++--- ...c_20-manual_native_charm_vdu_scaling.robot | 161 +++---- .../basic_21-support_of_volumes.robot | 160 +++---- .../basic_22-cross_model_relations.robot | 102 ++--- .../basic_23-sol004_sol007_packages.robot | 47 +- .../testsuite/basic_24-affinity_groups.robot | 96 ++-- ...update_charm_in_running_vnf_instance.robot | 157 +++---- ...26-secure_helm_execution_environment.robot | 133 +++--- ...date_helm_ee_in_running_vnf_instance.robot | 157 +++---- .../basic_28-keep_persistent_volumes.robot | 197 ++++---- .../testsuite/basic_29-vnf_ipv6_profile.robot | 119 +++-- .../testsuite/basic_30-ns_ipv6_profile.robot | 164 ++++--- ...basic_31-multivdu_volume_multiattach.robot | 129 +++--- .../basic_32-volume_with_different_az.robot | 90 ++-- .../testsuite/epa_01-epa_sriov.robot | 91 ++-- .../epa_02-additional_capabilities.robot | 106 ++--- .../epa_03-crud_operations_on_sdnc.robot | 30 +- .../testsuite/epa_04-epa_underlay_sriov.robot | 118 +++-- .../epa_05-epa_underlay_passthrough.robot | 119 +++-- .../fail_01-insufficient_resources.robot | 94 ++-- robot-systest/testsuite/hackfest_basic.robot | 93 ++-- .../testsuite/hackfest_cloudinit.robot | 95 ++-- .../testsuite/hackfest_multivdu.robot | 104 ++--- .../heal_01-volume_vdu_healing.robot | 252 +++++------ .../testsuite/heal_02-scale_vdu_healing.robot | 271 +++++------ .../testsuite/heal_03-multiple_healing.robot | 272 +++++------ .../testsuite/heal_04-autohealing.robot | 181 ++++---- .../testsuite/k8s_01-create_k8s_cluster.robot | 161 +++---- .../k8s_02-k8scluster_creation.robot | 38 +- .../testsuite/k8s_03-simple_k8s.robot | 83 ++-- .../testsuite/k8s_04-openldap_helm.robot | 105 +++-- .../testsuite/k8s_05-k8s_proxy_charms.robot | 132 +++--- .../k8s_06-k8s_secure_key_management.robot | 139 +++--- .../testsuite/k8s_07-dummy_helm.robot | 95 ++-- .../testsuite/k8s_08-simple_k8s_scaling.robot | 115 ++--- .../testsuite/k8s_09-pebble_charm_k8s.robot | 81 ++-- ...-sol004_sol007_with_k8s_proxy_charms.robot | 132 +++--- .../k8s_11-simple_helm_k8s_scaling.robot | 117 ++--- .../k8s_12-openldap_helm_day-2.robot | 131 +++--- .../testsuite/k8s_13-two_helm_kdu.robot | 131 +++--- .../lcmop_01-cancel_operation_basic.robot | 76 ++-- .../quotas_01-quota_enforcement.robot | 181 ++++---- .../sa_01-vnf_with_vim_metrics.robot | 105 ++--- ...vnf_with_vim_metrics_and_autoscaling.robot | 196 ++++---- .../sa_07-alarms_from_sa-related_vnfs.robot | 200 ++++---- .../sa_08-vnf_with_vnf_indicators_snmp.robot | 97 ++-- .../testsuite/slice_01-network_slicing.robot | 153 +++---- .../slice_02-shared_network_slicing.robot | 193 +++----- .../sol003_01-vnf-lifecycle-management.robot | 188 ++++---- .../sol003_02-dualstack_ip_vnfm.robot | 174 +++---- tox.ini | 19 +- 96 files changed, 5190 insertions(+), 5538 deletions(-) rename robot-systest/lib/{connectivity_lib.robot => connectivity_lib.resource} (60%) rename robot-systest/lib/{juju_lib.robot => juju_lib.resource} (78%) create mode 100644 robot-systest/lib/k8scluster_lib.resource delete mode 100644 robot-systest/lib/k8scluster_lib.robot create mode 100644 robot-systest/lib/ns_lib.resource delete mode 100644 robot-systest/lib/ns_lib.robot create mode 100644 robot-systest/lib/ns_operation_lib.resource rename robot-systest/lib/{nsd_lib.robot => nsd_lib.resource} (52%) rename robot-systest/lib/{nsi_lib.robot => nsi_lib.resource} (76%) create mode 100644 robot-systest/lib/nst_lib.resource delete mode 100644 robot-systest/lib/nst_lib.robot rename robot-systest/lib/{openstack_lib.robot => openstack_lib.resource} (62%) rename robot-systest/lib/{package_lib.robot => package_lib.resource} (57%) rename robot-systest/lib/{project_lib.robot => project_lib.resource} (59%) rename robot-systest/lib/{prometheus_lib.robot => prometheus_lib.resource} (71%) create mode 100644 robot-systest/lib/repo_lib.resource delete mode 100644 robot-systest/lib/repo_lib.robot create mode 100644 robot-systest/lib/rest_lib.resource delete mode 100644 robot-systest/lib/rest_lib.robot rename robot-systest/lib/{role_lib.robot => role_lib.resource} (63%) rename robot-systest/lib/{sdnc_lib.robot => sdnc_lib.resource} (56%) rename robot-systest/lib/{ssh_lib.robot => ssh_lib.resource} (55%) rename robot-systest/lib/{user_lib.robot => user_lib.resource} (60%) rename robot-systest/lib/{vim_lib.robot => vim_lib.resource} (58%) rename robot-systest/lib/{vnf_lib.robot => vnf_lib.resource} (57%) rename robot-systest/lib/{vnfd_lib.robot => vnfd_lib.resource} (72%) diff --git a/devops-stages/stage-test.sh b/devops-stages/stage-test.sh index 335f9de..4be5aaa 100755 --- a/devops-stages/stage-test.sh +++ b/devops-stages/stage-test.sh @@ -12,8 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# python3 -m rflint testsuites - check_tabs () { folder="$1" tabs="y" diff --git a/robot-systest/lib/connectivity_lib.robot b/robot-systest/lib/connectivity_lib.resource similarity index 60% rename from robot-systest/lib/connectivity_lib.robot rename to robot-systest/lib/connectivity_lib.resource index 79381e4..e91aedd 100644 --- a/robot-systest/lib/connectivity_lib.robot +++ b/robot-systest/lib/connectivity_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,10 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords for testing connectivity to hosts via ping. +Library OperatingSystem + + *** Variables *** -${success_return_code} 0 -${connectivity_pol_time} 5sec -${connectivity_max_wait_time} 30sec +${SUCCESS_RETURN_CODE} 0 +${CONNECTIVITY_POL_TIME} 5sec +${CONNECTIVITY_MAX_WAIT_TIME} 30sec + *** Keywords *** Test Ping Host @@ -22,14 +30,12 @@ Test Ping Host ... host: IP or name of the host ... Execution example: ... Ping Test \${host} - [Arguments] ${host} - - ${rc} ${stdout}= Run and Return RC and Output ping -c 2 -W 1 ${host} + ${rc} ${stdout}= Run And Return Rc And Output ping -c 2 -W 1 ${host} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Test Connectivity + [Documentation] Ping a host several times during ${CONNECTIVITY_MAX_WAIT_TIME} until it succeeds or raises a timeout. [Arguments] ${host} - - WAIT UNTIL KEYWORD SUCCEEDS ${connectivity_max_wait_time} ${connectivity_pol_time} Test Ping Host ${host} + Wait Until Keyword Succeeds ${CONNECTIVITY_MAX_WAIT_TIME} ${CONNECTIVITY_POL_TIME} Test Ping Host ${host} diff --git a/robot-systest/lib/juju_lib.robot b/robot-systest/lib/juju_lib.resource similarity index 78% rename from robot-systest/lib/juju_lib.robot rename to robot-systest/lib/juju_lib.resource index 45208a8..3d02901 100644 --- a/robot-systest/lib/juju_lib.robot +++ b/robot-systest/lib/juju_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,59 +11,66 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords to read objects from Juju using juju client. +Library String +Resource ssh_lib.resource + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Get Scale Number + [Documentation] Get from Juju the number of units (scale) of a juju application and return it. [Arguments] ${endpoint} ${username} ${password} ${privatekey} ${application_name} ${model_name} - Should Not Be Empty ${application_name} ${model_name} ${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$ ${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju show-status ${application_name} --format yaml -m ${model_name} | grep scale | awk -F ': ' '{print $2}' Log ${stdout} - [Return] ${stdout} + RETURN ${stdout} Get Model Name + [Documentation] Get from Juju the model from a KDU name and a NS id. [Arguments] ${endpoint} ${username} ${password} ${privatekey} ${ns_id} ${kdu_name} - Should Not Be Empty ${ns_id} ${kdu_name} ${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$ ${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju models | grep -i ${kdu_name} | grep -i ${ns_id} | cut -f1 -d " " Log ${stdout} ${model_name}= Set Variable ${kdu_name}-${ns_id} Should Be Equal As Strings ${model_name} ${stdout} - [Return] ${stdout} + RETURN ${stdout} Get Application Name VDU Level Charm + [Documentation] Get from Juju the application name matching a model and a VDU profile id passed as arguments. The application name must contain the EE passed as argument. [Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${vdu_profile_id} ${ee_name} - Should Not Be Empty ${model_name} ${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$ ${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-vdu" | grep -v "*" | grep -i ${vdu_profile_id} | cut -f1 -d " " Log ${stdout} Should Not Be Empty ${stdout} Should Contain ${stdout} ${ee_name} - [Return] ${stdout} + RETURN ${stdout} Get Application Name NS Level Charm + [Documentation] Get from Juju the application name matching a model and a NS charm passed as arguments. [Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${charm_name} - Should Not Be Empty ${model_name} ${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$ ${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-ns" | grep -v "*" | grep -i ${charm_name} | cut -f1 -d " " Log ${stdout} Should Not Be Empty ${stdout} - [Return] ${stdout} + RETURN ${stdout} Get Application Name VNF Level Charm + [Documentation] Get from Juju the application name matching a model and a VNF profile id passed as arguments. The application name must contain the EE passed as argument. [Arguments] ${endpoint} ${username} ${password} ${privatekey} ${model_name} ${vnf_profile_id} ${ee_name} - Should Not Be Empty ${model_name} ${host}= Remove String Using Regexp ${endpoint} :([0-9]+)$ ${stdout}= Execute Remote Command Check Rc Return Output ${host} ${username} ${password} ${privatekey} juju status -m ${model_name} | grep "\\-vnf" | grep -v "*" | grep -i ${vnf_profile_id} | cut -f1 -d " " Log ${stdout} Should Not Be Empty ${stdout} Should Contain ${stdout} ${ee_name} - [Return] ${stdout} \ No newline at end of file + RETURN ${stdout} diff --git a/robot-systest/lib/k8scluster_lib.resource b/robot-systest/lib/k8scluster_lib.resource new file mode 100644 index 0000000..0895da7 --- /dev/null +++ b/robot-systest/lib/k8scluster_lib.resource @@ -0,0 +1,90 @@ +*** Comments *** +# Copyright 2020 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +*** Settings *** +Documentation Library providing keywords for CRUD operations over Kubernetes clusters with OSM client. +Library OperatingSystem + + +*** Variables *** +${SUCCESS_RETURN_CODE} 0 +${K8SCLUSTER_LAUNCH_MAX_WAIT_TIME} 6min +${K8SCLUSTER_LAUNCH_POL_TIME} 30sec +${K8SCLUSTER_DELETE_MAX_WAIT_TIME} 2min +${K8SCLUSTER_DELETE_POL_TIME} 15sec + + +*** Keywords *** +Create K8s Cluster + [Documentation] Register a Kubernetes cluster in OSM using the name, version and credentials passed as arguments. + [Arguments] ${k8scluster_creds} ${k8scluster_version} ${k8scluster_vim} ${k8scluster_net} ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-add --creds ${k8scluster_creds} --version ${k8scluster_version} --vim ${k8scluster_vim} --k8s-nets '{"net1": "${k8scluster_net}"}' ${k8scluster_name} --description "Robot cluster" + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Wait Until Keyword Succeeds ${K8SCLUSTER_LAUNCH_MAX_WAIT_TIME} ${K8SCLUSTER_LAUNCH_POL_TIME} Check For K8s Cluster To Be Ready ${k8scluster_name} + Check For K8s Cluster To Be Enabled ${k8scluster_name} + RETURN ${stdout} + +Delete K8s Cluster + [Documentation] Unregister/delete a Kubernetes cluster from OSM. + [Arguments] ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-delete ${k8scluster_name} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Wait Until Keyword Succeeds ${K8SCLUSTER_DELETE_MAX_WAIT_TIME} ${K8SCLUSTER_DELETE_POL_TIME} Check For K8s Cluster To Be Deleted ${k8scluster_name} + +Get K8s Cluster + [Documentation] Get the list of Kubernetes clusters in OSM, and return it. + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Log ${stdout} + RETURN ${stdout} + +Check For K8s Cluster + [Documentation] Check if a Kubernetes cluster identified by name exists in OSM, and return it. + [Arguments] ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Check For K8s Cluster To Be Deleted + [Documentation] Check if a Kubernetes cluster identified by name is not present in OSM. + [Arguments] ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" | awk '{print $2}' | grep ${k8scluster_name} + Log ${rc},${stdout} + Should Be Empty ${stdout} + +Check For K8s Cluster To Be Ready + [Documentation] Check if a Kubernetes cluster registered in OSM is ready (the state must be ENABLED or DEGRADED). + [Arguments] ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED,DEGRADED" + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Be Equal As Strings ${stdout} ${k8scluster_name} + +Check For K8s Cluster To Be Enabled + [Documentation] Check if the state of Kubernetes cluster registered in OSM is ENABLED. + [Arguments] ${k8scluster_name} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-show ${k8scluster_name} + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED" + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Be Equal As Strings ${stdout} ${k8scluster_name} diff --git a/robot-systest/lib/k8scluster_lib.robot b/robot-systest/lib/k8scluster_lib.robot deleted file mode 100644 index 8f642a3..0000000 --- a/robot-systest/lib/k8scluster_lib.robot +++ /dev/null @@ -1,71 +0,0 @@ -# Copyright 2020 Canonical Ltd. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Variables *** -${success_return_code} 0 -${k8scluster_launch_max_wait_time} 6min -${k8scluster_launch_pol_time} 30sec -${k8scluster_delete_max_wait_time} 2min -${k8scluster_delete_pol_time} 15sec - -*** Keywords *** -Create K8s Cluster - [Arguments] ${k8scluster_creds} ${k8scluster_version} ${k8scluster_vim} ${k8scluster_net} ${k8scluster_name} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-add --creds ${k8scluster_creds} --version ${k8scluster_version} --vim ${k8scluster_vim} --k8s-nets '{"net1": "${k8scluster_net}"}' ${k8scluster_name} --description "Robot cluster" - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_launch_max_wait_time} ${k8scluster_launch_pol_time} Check For K8s Cluster To Be Ready ${k8scluster_name} - Check For K8s Cluster To Be Enabled ${k8scluster_name} - [Return] ${stdout} - -Delete K8s Cluster - [Arguments] ${k8scluster_name} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-delete ${k8scluster_name} - Should Be Equal As Integers ${rc} ${success_return_code} - WAIT UNTIL KEYWORD SUCCEEDS ${k8scluster_delete_max_wait_time} ${k8scluster_delete_pol_time} Check For K8s Cluster To Be Deleted ${k8scluster_name} - -Get K8s Cluster - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list - Should Be Equal As Integers ${rc} ${success_return_code} - Log ${stdout} - [Return] ${stdout} - -Check for K8s Cluster - [Arguments] ${k8scluster_name} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - -Check For K8s Cluster To Be Deleted - [Arguments] ${k8scluster_name} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" | awk '{print $2}' | grep ${k8scluster_name} - Should Be Empty ${stdout} - -Check For K8s Cluster To Be Ready - [Arguments] ${k8scluster_name} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED,DEGRADED" - Log ${stdout} - ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Be Equal As Strings ${stdout} ${k8scluster_name} - -Check For K8s Cluster To Be Enabled - [Arguments] ${k8scluster_name} - ${rc2} ${stdout2}= Run and Return RC and Output osm k8scluster-show ${k8scluster_name} - Log ${stdout2} - ${rc} ${stdout}= Run and Return RC and Output osm k8scluster-list --filter name="${k8scluster_name}" --filter _admin.operationalState="ENABLED" - Log ${stdout} - ${rc} ${stdout}= Run and Return RC and Output echo "${stdout}" | awk '{print $2}' | grep ${k8scluster_name} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Be Equal As Strings ${stdout} ${k8scluster_name} diff --git a/robot-systest/lib/ns_lib.resource b/robot-systest/lib/ns_lib.resource new file mode 100644 index 0000000..9d7276f --- /dev/null +++ b/robot-systest/lib/ns_lib.resource @@ -0,0 +1,221 @@ +*** Comments *** +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +*** Settings *** +Documentation Library to deploy and delete NS, and run operations on them. + +Library Collections +Library DateTime +Library OperatingSystem +Library String + + +*** Variables *** +${SUCCESS_RETURN_CODE} 0 +${NS_LAUNCH_POL_TIME} 30sec +${NS_DELETE_POL_TIME} 15sec +${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} + + +*** Keywords *** +Create Network Service + [Documentation] Launch the instantation of a NS and verify in a loop that the NS instance is successfully created in a given time, and return the NS instance id. + [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY} + ${ns_launch_max_wait_time}= Convert Time ${ns_launch_max_wait_time} result_format=number + ${ns_launch_max_wait_time}= Evaluate ${ns_launch_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + Log ${ns_launch_max_wait_time} + ${config_attr}= Set Variable If "${ns_config}" != "${EMPTY}" --config '${ns_config}' ${EMPTY} + ${sshkeys_attr}= Set Variable If "${publickey}" != "${EMPTY}" --ssh_keys ${publickey} ${EMPTY} + ${config_file_attr}= Set Variable If "${config_file}" != "${EMPTY}" --config_file '${config_file}' ${EMPTY} + ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr} + Log ${ns_id} + Wait Until Keyword Succeeds ${ns_launch_max_wait_time} ${NS_LAUNCH_POL_TIME} Check For NS Instance To Configured ${ns_name} + Check For NS Instance For Failure ${ns_name} + RETURN ${ns_id} + +Instantiate Network Service + [Documentation] Launch the instantation of a NS, and return the NS instance id. + [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Get Vnf Management Ip Address + [Documentation] Get the mgmt IP address of a member VNF in a NS instance, and return it. + [Arguments] ${ns_id} ${vnf_member_index} + Should Not Be Empty ${ns_id} + Should Not Be Empty ${vnf_member_index} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Get Vnf Id + [Documentation] Get the VNF instance ID of a member VNF in a NS instance, and return it. + [Arguments] ${ns_id} ${vnf_member_index} + Should Not Be Empty ${ns_id} + Should Not Be Empty ${vnf_member_index} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $2}' 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Get Ns Id + [Documentation] Get the NS instance ID from a NS instance name passed as argument, and return it. + [Arguments] ${ns_name} + Should Not Be Empty ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | grep ${ns_name} | awk '{print $4}' 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Not Be Empty ${stdout} + RETURN ${stdout} + +Get Ns List + [Documentation] Get the list of NS instances and return it. + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Get Ns Vnf List + [Documentation] Get the list of VNF instances of a given NS instance id, and return it. + [Arguments] ${ns_id} + Should Not Be Empty ${ns_id} + @{vnf_list_string}= Run And Return Rc And Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1 + # Returns a String of vnf_id and needs to be converted into a list + @{vnf_list}= Split String ${vnf_list_string}[1] + Log List ${vnf_list} + RETURN @{vnf_list} + +Get Ns Ip List + [Documentation] Obtain the list of IP addresses of all VM in a NS, and return it. + [Arguments] @{vnf_list} + Should Not Be Empty @{vnf_list} + @{temp_list}= Create List + FOR ${vnf_id} IN @{vnf_list} + Log ${vnf_id} + @{vnf_ip_list}= Get Vnf Ip List ${vnf_id} + @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list} + END + Should Not Be Empty ${temp_list} + RETURN @{temp_list} + +Get Vnf Ip List + [Documentation] Obtain the list of IP addresses of all VM in a VNF, and return it. + [Arguments] ${vnf_id} + Should Not Be Empty ${vnf_id} + @{vnf_ip_list_string}= Run And Return Rc And Output osm vnf-list --filter id=${vnf_id} | grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' | sort -t: -u -k1,1 2>&1 + # returns a string of ip addresses and needs to be converted into a list + Should Not Be Empty ${vnf_ip_list_string}[1] + @{vnf_ip_list}= Split String ${vnf_ip_list_string}[1] + Log Many ${vnf_ip_list} + Should Not Be Empty ${vnf_ip_list} + RETURN @{vnf_ip_list} + +Check For Ns Instance To Configured + [Documentation] Check if a given NS instance has completed the instantiation, no matter if it succeeded (the status should be READY or BROKEN). + [Arguments] ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output openstack server list + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list --filter name="${ns_name}" + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Contain Any ${stdout} READY BROKEN + +Check For NS Instance For Failure + [Documentation] Check if a given NS instance has not failed in the instantiation (the status should not be BROKEN). + [Arguments] ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output openstack server list + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list --filter name="${ns_name}" + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Not Contain ${stdout} BROKEN + +Check For NS Instance To Be Deleted + [Documentation] Check if a given NS instance is not present in OSM. + [Arguments] ${ns} + ${rc} ${stdout}= Run And Return Rc And Output openstack server list + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | awk '{print $2}' | grep ${ns} + Log ${rc},${stdout} + Should Not Be Equal As Strings ${stdout} ${ns} + +Delete NS + [Documentation] Delete a NS instance. + [Arguments] ${ns} ${ns_delete_max_wait_time}=4min + ${ns_delete_max_wait_time}= Convert Time ${ns_delete_max_wait_time} result_format=number + ${ns_delete_max_wait_time}= Evaluate ${ns_delete_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + Log ${ns_delete_max_wait_time} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-delete ${ns} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Wait Until Keyword Succeeds ${ns_delete_max_wait_time} ${NS_DELETE_POL_TIME} Check For NS Instance To Be Deleted ${ns} + +Get Ns Vnfr Ids + [Documentation] Return a list with the IDs of the VNF records of a NS instance. + [Arguments] ${ns_id} + Should Not Be Empty ${ns_id} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1 + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + @{vdur}= Split String ${stdout} + RETURN @{vdur} + +Get Vnf Vdur Names + [Documentation] Return a list with the names of the VDU records of a VNF instance. + [Arguments] ${vnf_id} + Should Not Be Empty ${vnf_id} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r .vdur[].name + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + @{vdur}= Split String ${stdout} + RETURN @{vdur} + +Get Vnf Kdu Replica Count + [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance. + [Arguments] ${vnf_id} ${kdu_name} + Should Not Be Empty ${vnf_id} + Should Not Be Empty ${kdu_name} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq -r .config.replicaCount + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + ${return}= Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} + RETURN ${return} + +Get Application Names + [Documentation] Return the list of the application of a VNF instance. + [Arguments] ${ns_name} + Should Not Be Empty ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-show ${ns_name} --literal | yq -r ._admin.deployed.VCA[].application + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + @{app_names}= Split String ${stdout} + RETURN ${app_names} + +Get VDU Affinity Group Name + [Documentation] Return the affinity group name for a NF + [Arguments] ${ns_name} ${vnf_id} ${vdur_id} + ${rc} ${affinity_group_id}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."affinity-or-anti-affinity-group-id"[0]' 2>&1 + Log ${affinity_group_id} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${affinity_group_id} values=False + ${rc} ${affinity_group_name}= Run And Return Rc And Output osm ns-show ${ns_name} --literal | yq '."affinity-or-anti-affinity-group"[] | select(.id == "'${affinity_group_id}'")' | yq -r '.name' 2>&1 + Log ${affinity_group_name} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${affinity_group_name} values=False + RETURN ${affinity_group_name} + +GET Dual Ip + [Documentation] Get dual ip from the ns list + [Arguments] ${ns_id} + Should Not Be Empty ${ns_id} + ${rc} ${stdout}= Run And Return RC And Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | awk '{print $2}' | paste -sd ',' | sed 's/^,//; s/,/, /g' | sed 's/^/[/; s/$/]/' + Log ${rc},${stdout} + RETURN ${stdout} diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot deleted file mode 100644 index c8da271..0000000 --- a/robot-systest/lib/ns_lib.robot +++ /dev/null @@ -1,427 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -Documentation Library to deploy and delete NS, and run operations on them. - -Library DateTime - - -*** Variables *** -${success_return_code} 0 -${ns_launch_pol_time} 30sec -${ns_delete_pol_time} 15sec -${ns_action_max_wait_time} 1min -${ns_action_pol_time} 15sec -${vnf_scale_pol_time} 15sec -${healing_pol_time} 15sec -${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} - - -*** Keywords *** -Create Network Service - [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} ${publickey} ${ns_launch_max_wait_time}=5min ${config_file}=${EMPTY} - - ${ns_launch_max_wait_time}= Convert Time ${ns_launch_max_wait_time} result_format=number - ${ns_launch_max_wait_time}= Evaluate ${ns_launch_max_wait_time} * ${vim_timeout_multiplier} - Log ${ns_launch_max_wait_time} - ${config_attr} Set Variable If '${ns_config}'!='${EMPTY}' --config '${ns_config}' \ - ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \ - ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \ - - ${ns_id}= Instantiate Network Service ${ns_name} ${nsd} ${vim_name} ${config_attr} ${sshkeys_attr} ${config_file_attr} - Log ${ns_id} - - WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For NS Instance To Configured ${ns_name} - Check For NS Instance For Failure ${ns_name} - [Return] ${ns_id} - - -Instantiate Network Service - [Arguments] ${ns_name} ${nsd} ${vim_name} ${ns_extra_args} - - ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} ${ns_extra_args} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Update Network Service - [Arguments] ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout} - - ${rc} ${stdout}= Run and Return RC and Output osm ns-update ${ns_id} --updatetype ${update_type} --config ${ns_update_config} --timeout ${ns_update_timeout} --wait - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Get Vnf Management Ip Address - [Arguments] ${ns_id} ${vnf_member_index} - - Should Not Be Empty ${ns_id} - Should Not Be Empty ${vnf_member_index} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $14}' 2>&1 - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Get Vnf Id - [Arguments] ${ns_id} ${vnf_member_index} - - Should Not Be Empty ${ns_id} - Should Not Be Empty ${vnf_member_index} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --filter member-vnf-index-ref=${vnf_member_index} | grep ${ns_id} | awk '{print $2}' 2>&1 - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Get Ns Id - [Arguments] ${ns_name} - - Should Not Be Empty ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${ns_name} | awk '{print $4}' 2>&1 - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Not Be Empty ${stdout} - [Return] ${stdout} - - -Get Ns List - ${rc} ${stdout}= Run and Return RC and Output osm ns-list 2>&1 - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Get Ns Vnf List - [Arguments] ${ns_id} - - Should Not Be Empty ${ns_id} - @{vnf_list_string}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1 - # Returns a String of vnf_id and needs to be converted into a list - @{vnf_list} = Split String ${vnf_list_string}[1] - Log List ${vnf_list} - [Return] @{vnf_list} - - -Get Ns Ip List - [Arguments] @{vnf_list} - - should not be empty @{vnf_list} - @{temp_list}= Create List - FOR ${vnf_id} IN @{vnf_list} - Log ${vnf_id} - @{vnf_ip_list} Get Vnf Ip List ${vnf_id} - @{temp_list}= Combine Lists ${temp_list} ${vnf_ip_list} - END - should not be empty ${temp_list} - [return] @{temp_list} - - -Get Vnf Ip List - [arguments] ${vnf_id} - - should not be empty ${vnf_id} - @{vnf_ip_list_string}= run and return rc and output osm vnf-list --filter id=${vnf_id} | grep -o '[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}' | sort -t: -u -k1,1 2>&1 - # returns a string of ip addresses and needs to be converted into a list - should not be empty ${vnf_ip_list_string}[1] - @{vnf_ip_list} = split string ${vnf_ip_list_string}[1] - Log Many ${vnf_ip_list} - should not be empty ${vnf_ip_list} - [return] @{vnf_ip_list} - - -Check For Ns Instance To Configured - [arguments] ${ns_name} - - ${rc} ${stdout}= Run and Return RC and Output openstack server list - Log ${stdout} - ${rc} ${stdout}= run and return rc and output osm ns-list --filter name="${ns_name}" - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain Any ${stdout} READY BROKEN - -Check For NS Instance For Failure - [Arguments] ${ns_name} - - ${rc} ${stdout}= Run and Return RC and Output openstack server list - Log ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Not Contain ${stdout} BROKEN - -Check For NS Instance To Be Deleted - [Arguments] ${ns} - - ${rc} ${stdout}= Run and Return RC and Output openstack server list - Log ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list | awk '{print $2}' | grep ${ns} - Should Not Be Equal As Strings ${stdout} ${ns} - -Delete NS - [Documentation] Delete ns - [Arguments] ${ns} ${ns_delete_max_wait_time}=4min - - ${ns_delete_max_wait_time}= Convert Time ${ns_delete_max_wait_time} result_format=number - ${ns_delete_max_wait_time}= Evaluate ${ns_delete_max_wait_time} * ${vim_timeout_multiplier} - Log ${ns_delete_max_wait_time} - ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - - WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Deleted ${ns} - -Execute NS Action - [Documentation] Execute an action over the desired NS. - ... Parameters are given to this function in key=value format (one argument per key/value pair). - ... Return the ID of the operation associated to the executed action. - ... Examples of execution: - ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} - ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2} - - [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} @{action_params} - - ${params}= Set Variable ${EMPTY} - FOR ${param} IN @{action_params} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters - ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}", - END - ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} - ${osm_ns_action_command}= Run Keyword If '${params}'!='${EMPTY}' Catenate ${osm_ns_action_command} --params '{${params}}' - ... ELSE Set Variable ${osm_ns_action_command} - ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout} - Check For NS Operation Completed ${stdout} - [Return] ${stdout} - - -Execute NS K8s Action - [Documentation] Execute an action over the desired K8s NS. - ... Parameters are given to this function in key=value format (one argument per key/value pair). - ... Return the ID of the operation associated to the executed action. - ... Examples of execution: - ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} - ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2} - - [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} ${kdu_name} @{action_params} - - ${params}= Set Variable ${EMPTY} - FOR ${param} IN @{action_params} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters - ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}", - END - ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} --kdu_name ${kdu_name} - ${osm_ns_action_command}= Run Keyword If '${params}'!='${EMPTY}' Catenate ${osm_ns_action_command} --params '{${params}}' - ... ELSE Set Variable ${osm_ns_action_command} - ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output ${osm_ns_action_command} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${ns_action_max_wait_time} ${ns_action_pol_time} Check For NS Operation Ended ${stdout} - Check For NS Operation Completed ${stdout} - [Return] ${stdout} - - -Execute Manual VNF Scale - [Documentation] Execute a manual VNF Scale action. - ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT. - ... Return the ID of the operation associated to the executed scale action. - - [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} ${vnf_scale_max_wait_time}=2min - - ${vnf_scale_max_wait_time}= Convert Time ${vnf_scale_max_wait_time} result_format=number - ${vnf_scale_max_wait_time}= Evaluate ${vnf_scale_max_wait_time} * ${vim_timeout_multiplier} - Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False - ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group} - ${osm_vnf_scale_command}= Run Keyword If '${scale_type}'=='SCALE_IN' Catenate ${osm_vnf_scale_command} --scale-in - ... ELSE Catenate ${osm_vnf_scale_command} --scale-out - ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index} - ${rc} ${stdout}= Run and Return RC and Output ${osm_vnf_scale_command} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${vnf_scale_pol_time} Check For NS Operation Ended ${stdout} - Check For NS Operation Completed ${stdout} - [Return] ${stdout} - - -Heal Network Service - [Documentation] Execute healing operation over one NS. - ... Return the ID of the operation associated to the executed healing action. - - [Arguments] ${ns_name} ${params} ${healing_max_wait_time}=10m - - Should Not Be Empty ${ns_name} - Should Not Be Empty ${params} - ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number - ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${vim_timeout_multiplier} - ${rc} ${stdout}= Run and Return RC and Output osm ns-heal ${ns_name} ${params} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout} - Check For NS Operation Completed ${stdout} - [Return] ${stdout} - - -Get Operations List - [Arguments] ${ns_name} - - Should Not Be Empty ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_name} - Log ${stdout} - Log ${rc} - Should Be Equal As Integers ${rc} ${success_return_code} - - -Check For NS Operation Completed - [Documentation] Check whether the status of the desired operation is "COMPLETED" or not. - - [Arguments] ${ns_operation_id} - - Should Not Be Empty ${ns_operation_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False - - -Check For NS Operation Failed - [Documentation] Check whether the status of the desired operation is "FAILED" or not. - - [Arguments] ${ns_operation_id} - - Should Not Be Empty ${ns_operation_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain ${stdout} FAILED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False - - -Check For NS Operation Ended - [Documentation] Check whether the status of the desired operation is "FAILED" or "COMPLETED". - - [Arguments] ${ns_operation_id} - - Should Not Be Empty ${ns_operation_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain Any ${stdout} FAILED COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False - - -Check For NS Operation Cancelled - [Documentation] Check whether the operation was cancelled or not. - - [Arguments] ${ns_operation_id} - - Should Not Be Empty ${ns_operation_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-show ${ns_operation_id} --literal | yq -r '.operationState, .isCancelPending' - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain ${stdout} FAILED_TEMP\nfalse msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False - - -Get Ns Vnfr Ids - [Documentation] Return a list with the IDs of the VNF records of a NS instance. - - [Arguments] ${ns_id} - - Should Not Be Empty ${ns_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-list --ns ${ns_id} | grep ${ns_id} | awk '{print $2}' 2>&1 - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - @{vdur} = Split String ${stdout} - [Return] @{vdur} - - -Get Vnf Vdur Names - [Documentation] Return a list with the names of the VDU records of a VNF instance. - - [Arguments] ${vnf_id} - - Should Not Be Empty ${vnf_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r .vdur[].name - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - @{vdur} = Split String ${stdout} - [Return] @{vdur} - - -Get Vnf Kdu Replica Count - [Documentation] Return the number of KDU replicas (empty if none) of a VNF instance. - - [Arguments] ${vnf_id} ${kdu_name} - - Should Not Be Empty ${vnf_id} - Should Not Be Empty ${kdu_name} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --kdu ${kdu_name} | yq -r .config.replicaCount - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - ${return} = Set Variable If '${stdout}' == 'null' ${EMPTY} ${stdout} - [Return] ${return} - - -Get Application Names - [Documentation] Return the list of the application of a VNF instance. - - [Arguments] ${ns_name} - - Should Not Be Empty ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq -r ._admin.deployed.VCA[].application - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - @{app_names} = Split String ${stdout} - [Return] ${app_names} - - -Get VDU Affinity Group Name - [Documentation] Return the affinity group name for a NF - - [Arguments] ${ns_name} ${vnf_id} ${vdur_id} - - ${rc} ${affinity_group_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."affinity-or-anti-affinity-group-id"[0]' 2>&1 - Log ${affinity_group_id} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_id} values=False - ${rc} ${affinity_group_name}= Run and Return RC and Output osm ns-show ${ns_name} --literal | yq '."affinity-or-anti-affinity-group"[] | select(.id == "'${affinity_group_id}'")' | yq -r '.name' 2>&1 - Log ${affinity_group_name} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${affinity_group_name} values=False - [Return] ${affinity_group_name} - -Get Operations By Type - [Documentation] Keyword to get the operation by type - - [Arguments] ${ns_id} ${type} - - Should Not Be Empty ${ns_id} - Should Not Be Empty ${type} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-list ${ns_id} | grep ${type} | awk '{print $2}' 2>&1 - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Not Be Empty ${stdout} - [Return] ${stdout} - -Cancel operation By Id - [Documentation] Cancels an ongoing operation by operation ID - - [Arguments] ${op_id} ${cancel_mode}=GRACEFUL - - Should Not Be Empty ${op_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-op-cancel ${op_id} --cancel_mode ${cancel_mode} --wait - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - -GET Dual Ip - [Documentation] Get dual ip from the ns list - [Arguments] ${ns_id} - Should Not Be Empty ${ns_id} - ${rc} ${stdout}= Run and Return RC and Output osm ns-show ${ns_id} --literal | grep -A2 ip-address | awk '{print $2}' | paste -sd ',' | sed 's/^,//; s/,/, /g' | sed 's/^/[/; s/$/]/' - Log ${stdout} - [Return] ${stdout} - diff --git a/robot-systest/lib/ns_operation_lib.resource b/robot-systest/lib/ns_operation_lib.resource new file mode 100644 index 0000000..968fdd9 --- /dev/null +++ b/robot-systest/lib/ns_operation_lib.resource @@ -0,0 +1,189 @@ +*** Comments *** +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +*** Settings *** +Documentation Library to deploy and delete NS, and run operations on them. + +Library Collections +Library DateTime +Library OperatingSystem +Library String + + +*** Variables *** +${SUCCESS_RETURN_CODE} 0 +${NS_ACTION_MAX_WAIT_TIME} 1min +${NS_ACTION_POL_TIME} 15sec +${VNF_SCALE_POL_TIME} 15sec +${HEALING_POL_TIME} 15sec +${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} + + +*** Keywords *** +Update Network Service + [Documentation] Run an update operation over a NS instance, and return the operation id. + [Arguments] ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-update ${ns_id} --updatetype ${update_type} --config ${ns_update_config} --timeout ${ns_update_timeout} --wait + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Execute NS Action + [Documentation] Execute an action over the desired NS. + ... Parameters are given to this function in key=value format (one argument per key/value pair). + ... Return the ID of the operation associated to the executed action. + ... Examples of execution: + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2} + + [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} @{action_params} + ${params}= Set Variable ${EMPTY} + FOR ${param} IN @{action_params} + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters + Log ${match},${param_name},${param_value} + ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}", + END + ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} + IF '${params}' != '${EMPTY}' + ${osm_ns_action_command}= Catenate ${osm_ns_action_command} --params '{${params}}' + ELSE + ${osm_ns_action_command}= Set Variable ${osm_ns_action_command} + END + ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_ns_action_command} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Wait Until Keyword Succeeds ${NS_ACTION_MAX_WAIT_TIME} ${NS_ACTION_POL_TIME} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + RETURN ${stdout} + +Execute NS K8s Action + [Documentation] Execute an action over the desired K8s NS. + ... Parameters are given to this function in key=value format (one argument per key/value pair). + ... Return the ID of the operation associated to the executed action. + ... Examples of execution: + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} + ... \${ns_op_id}= Execute NS Action \${ns_name} \${ns_action} \${vnf_member_index} \${param1}=\${value1} \${param2}=\${value2} + + [Arguments] ${ns_name} ${ns_action} ${vnf_member_index} ${kdu_name} @{action_params} + + ${params}= Set Variable ${EMPTY} + FOR ${param} IN @{action_params} + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in parameters + Log ${match},${param_name},${param_value} + ${params}= Catenate SEPARATOR= ${params} "${param_name}":"${param_value}", + END + ${osm_ns_action_command}= Set Variable osm ns-action --action_name ${ns_action} --vnf_name ${vnf_member_index} --kdu_name ${kdu_name} + IF '${params}' != '${EMPTY}' + ${osm_ns_action_command}= Catenate ${osm_ns_action_command} --params '{${params}}' + ELSE + ${osm_ns_action_command}= Set Variable ${osm_ns_action_command} + END + ${osm_ns_action_command}= Catenate ${osm_ns_action_command} ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_ns_action_command} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Wait Until Keyword Succeeds ${NS_ACTION_MAX_WAIT_TIME} ${NS_ACTION_POL_TIME} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + RETURN ${stdout} + +Execute Manual VNF Scale + [Documentation] Execute a manual VNF Scale action. + ... The parameter 'scale_type' must be SCALE_IN or SCALE_OUT. + ... Return the ID of the operation associated to the executed scale action. + [Arguments] ${ns_name} ${vnf_member_index} ${scaling_group} ${scale_type} ${vnf_scale_max_wait_time}=2min + ${vnf_scale_max_wait_time}= Convert Time ${vnf_scale_max_wait_time} result_format=number + ${vnf_scale_max_wait_time}= Evaluate ${vnf_scale_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + Should Contain Any ${scale_type} SCALE_IN SCALE_OUT msg=Unknown scale type: ${scale_type} values=False + ${osm_vnf_scale_command}= Set Variable osm vnf-scale --scaling-group ${scaling_group} + IF ${scale_type}=='SCALE_IN' + ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} --scale-in + ELSE + ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} --scale-out + END + ${osm_vnf_scale_command}= Catenate ${osm_vnf_scale_command} ${ns_name} ${vnf_member_index} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_vnf_scale_command} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Wait Until Keyword Succeeds ${vnf_scale_max_wait_time} ${VNF_SCALE_POL_TIME} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + RETURN ${stdout} + +Heal Network Service + [Documentation] Execute healing operation over one NS. + ... Return the ID of the operation associated to the executed healing action. + [Arguments] ${ns_name} ${params} ${healing_max_wait_time}=10m + Should Not Be Empty ${ns_name} + Should Not Be Empty ${params} + ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number + ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-heal ${ns_name} ${params} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Wait Until Keyword Succeeds ${healing_max_wait_time} ${HEALING_POL_TIME} Check For NS Operation Ended ${stdout} + Check For NS Operation Completed ${stdout} + RETURN ${stdout} + +Get Operations List + [Documentation] Get the list of operations of a given NS instance. + [Arguments] ${ns_name} + Should Not Be Empty ${ns_name} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-list ${ns_name} + Log ${stdout} + Log ${rc} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + +Check For NS Operation Completed + [Documentation] Check wheter the status of the desired operation is "COMPLETED" or not. + [Arguments] ${ns_operation_id} + Should Not Be Empty ${ns_operation_id} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Contain ${stdout} COMPLETED msg=The ns-action with id ${ns_operation_id} was not completed values=False + +Check For NS Operation Failed + [Documentation] Check wheter the status of the desired operation is "FAILED" or not. + [Arguments] ${ns_operation_id} + Should Not Be Empty ${ns_operation_id} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Contain ${stdout} FAILED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False + +Check For NS Operation Ended + [Documentation] Check wheter the status of the desired operation is "FAILED" or "COMPLETED". + [Arguments] ${ns_operation_id} + Should Not Be Empty ${ns_operation_id} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-show ${ns_operation_id} --literal | yq -r .operationState + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Contain Any ${stdout} FAILED COMPLETED msg=Timeout waiting for ns-action with id ${ns_operation_id} values=False + +Get Operations By Type + [Documentation] Keyword to get the operation by type + [Arguments] ${ns_id} ${type} + Should Not Be Empty ${ns_id} + Should Not Be Empty ${type} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-op-list ${ns_id} | grep ${type} | awk '{print $2}' 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Should Not Be Empty ${stdout} + RETURN ${stdout} + +Cancel Operation By Id + [Documentation] Cancels an ongoing operation by operation ID + [Arguments] ${op_id} ${cancel_mode}=GRACEFUL + + Should Not Be Empty ${op_id} + ${rc} ${stdout}= Run And Return RC And Output osm ns-op-cancel ${op_id} --cancel_mode ${cancel_mode} --wait + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + RETURN ${stdout} diff --git a/robot-systest/lib/nsd_lib.robot b/robot-systest/lib/nsd_lib.resource similarity index 52% rename from robot-systest/lib/nsd_lib.robot rename to robot-systest/lib/nsd_lib.resource index 40132d7..175322b 100644 --- a/robot-systest/lib/nsd_lib.robot +++ b/robot-systest/lib/nsd_lib.resource @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- - -## +*** Comments *** # Copyright 2019 Tech Mahindra Limited # # All Rights Reserved. @@ -16,52 +14,50 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -## -## Change log: -# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019 -## *** Settings *** +Documentation Library providing keywords for CRUD operations over NSD/NSpkg with OSM client. + +Library OperatingSystem Library String *** Variables *** -${success_return_code} 0 -${delete_max_wait_time} 1min -${delete_pol_time} 15sec +${SUCCESS_RETURN_CODE} 0 +${NSD_DELETE_MAX_WAIT_TIME} 1min +${NSD_DELETE_POL_TIME} 15sec *** Keywords *** Get NSDs List - ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list + [Documentation] Get the list of NS packages and log it. + ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-list Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Create NSD + [Documentation] Upload a NS package to OSM and return the id. [Arguments] ${nsd_pkg} - - ${rc} ${stdout}= Run and Return RC and Output osm nspkg-create ${nsd_pkg} + ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-create ${nsd_pkg} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} ${lines}= Get Line Count ${stdout} ${last}= Evaluate ${lines} - 1 ${id}= Get Line ${stdout} ${last} - [Return] ${id} - + RETURN ${id} Delete NSD + [Documentation] Delete a NS package from OSM. [Arguments] ${nsd_id} - - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm nspkg-delete ${nsd_id} - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm nspkg-delete ${nsd_id} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Log ${stdout} - WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${nsd_id} - + Wait Until Keyword Succeeds ${NSD_DELETE_MAX_WAIT_TIME} ${NSD_DELETE_POL_TIME} Check For NSD ${nsd_id} Check For NSD + [Documentation] Check that a NS package exists in OSM. [Arguments] ${nsd_id} - - ${rc} ${stdout}= Run and Return RC and Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id} + ${rc} ${stdout}= Run And Return Rc And Output osm nspkg-list | awk '{print $2}' | grep ${nsd_id} + Log ${rc},${stdout} Should Not Be Equal As Strings ${stdout} ${nsd_id} diff --git a/robot-systest/lib/nsi_lib.robot b/robot-systest/lib/nsi_lib.resource similarity index 76% rename from robot-systest/lib/nsi_lib.robot rename to robot-systest/lib/nsi_lib.resource index 1b88396..74c67a6 100644 --- a/robot-systest/lib/nsi_lib.robot +++ b/robot-systest/lib/nsi_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Atos # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,19 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** +Documentation Library providing keywords for CRUD operations over Network Slice Instances with OSM client. + Library Collections +Library OperatingSystem +Library DateTime +Library String + +Resource ns_lib.resource *** Variables *** -${success_return_code} 0 -${slice_launch_pol_time} 30sec -${slice_delete_pol_time} 15sec -${vim_timeout_multiplier} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} +${SUCCESS_RETURN_CODE} 0 +${SLICE_LAUNCH_POL_TIME} 30sec +${SLICE_DELETE_POL_TIME} 15sec +${VIM_TIMEOUT_MULTIPLIER} %{OSM_VIM_MULTIPLIER_TIMEOUT=1.0} *** Keywords *** - Create Network Slice [Documentation] Instantiates a NST and returns an instantiation id (nsi), verifying the slice is successfully instantiated ... Parameters: @@ -35,22 +43,17 @@ Create Network Slice ... publickey: SSH public key of the local machine ... Execution example: ... \${nsi}= Create Network Slice \${nst} \${vim_name} \${slice_name} \${slice_config} \${publickey} - [Arguments] ${nst} ${vim_name} ${slice_name} ${slice_config} ${publickey} ${slice_launch_max_wait_time}=6min ${config_file}=${EMPTY} - ${slice_launch_max_wait_time}= Convert Time ${slice_launch_max_wait_time} result_format=number - ${slice_launch_max_wait_time}= Evaluate ${slice_launch_max_wait_time} * ${vim_timeout_multiplier} - ${config_attr} Set Variable If '${slice_config}'!='${EMPTY}' --config '${slice_config}' \ - ${sshkeys_attr} Set Variable If '${publickey}'!='${EMPTY}' --ssh_keys ${publickey} \ - ${config_file_attr} Set Variable If '${config_file}'!='${EMPTY}' --config_file '${config_file}' \ - + ${slice_launch_max_wait_time}= Evaluate ${slice_launch_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + ${config_attr}= Set Variable If "${slice_config}" != "${EMPTY}" --config '${slice_config}' ${EMPTY} + ${sshkeys_attr}= Set Variable If "${publickey}" != "${EMPTY}" --ssh_keys ${publickey} ${EMPTY} + ${config_file_attr}= Set Variable If "${config_file}" != "${EMPTY}" --config_file '${config_file}' ${EMPTY} ${nsi_id}= Instantiate Network Slice ${slice_name} ${nst} ${vim_name} ${config_attr} ${config_file_attr} ${sshkeys_attr} Log ${nsi_id} - - WAIT UNTIL KEYWORD SUCCEEDS ${slice_launch_max_wait_time} ${slice_launch_pol_time} Check For Network Slice Instance To Configured ${slice_name} + Wait Until Keyword Succeeds ${slice_launch_max_wait_time} ${SLICE_LAUNCH_POL_TIME} Check For Network Slice Instance To Configured ${slice_name} Check For Network Slice Instance For Failure ${slice_name} - [Return] ${nsi_id} - + RETURN ${nsi_id} Instantiate Network Slice [Documentation] Instantiates a NST and returns an instantiation id (nsi) @@ -61,14 +64,11 @@ Instantiate Network Slice ... slice_extra_args: Extra parameters that might require the slice instantiation i.e. configuration attributes ... Execution example: ... \${nsi}= Instantiate Network Slice \${slice_name} \${nst} \${vim_name} \${config_attr} - [Arguments] ${slice_name} ${nst} ${vim_name} ${slice_extra_args} ${sshkeys_attr} - - ${rc} ${stdout}= Run and Return RC and Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + ${rc} ${stdout}= Run And Return Rc And Output osm nsi-create --nsi_name ${slice_name} --nst_name ${nst} --vim_account ${vim_name} ${sshkeys_attr} ${slice_extra_args} + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Slice Ns List [Documentation] Retrieves the list of NS in a slice @@ -76,16 +76,13 @@ Get Slice Ns List ... slice_name: Name of the slice instance ... Execution example: ... \@{slice_ns_list}= Get Slice Ns List \${slice_name} - [Arguments] ${slice_name} - Should Not Be Empty ${slice_name} - @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1 + @{ns_list_string}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | awk '{print $4}' 2>&1 # Returns a String of ns_id and needs to be converted into a list - @{ns_list} = Split String ${ns_list_string}[1] + @{ns_list}= Split String ${ns_list_string}[1] Log List ${ns_list} - [Return] @{ns_list} - + RETURN @{ns_list} Get Slice Ns List Except One [Documentation] Retrieves the list of NS in a slice removing one from the list. This is done to save time in the tests, avoiding one VNF to ping itself. @@ -94,18 +91,14 @@ Get Slice Ns List Except One ... exception_ns: Name of the ns that will not appear in the final list ... Execution example: ... \@{slice_ns_list}= Get Slice Ns List Except One \${slice_name} \${exception_ns} - [Arguments] ${slice_name} ${exception_ns} - Should Not Be Empty ${slice_name} Should Not Be Empty ${exception_ns} - - @{ns_list_string}= Run and Return RC and Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1 + @{ns_list_string}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | awk '!/${exception_ns}/' | awk '{print $4}' 2>&1 # Returns a String of ns_id and needs to be converted into a list - @{ns_list} = Split String ${ns_list_string}[1] + @{ns_list}= Split String ${ns_list_string}[1] Log List ${ns_list} - [Return] @{ns_list} - + RETURN @{ns_list} Get Slice Ns Count [Documentation] Returns the count of all the NS in a slice @@ -113,15 +106,12 @@ Get Slice Ns Count ... slice_name: Name of the slice instance ... Execution example: ... \${slice_ns_count}= Get Slice Ns Count \${slice_name} - [Arguments] ${slice_name} - Should Not Be Empty ${slice_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list | grep ${slice_name} | wc -l 2>&1 + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list | grep ${slice_name} | wc -l 2>&1 Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Slice Vnf Ip Addresses [Documentation] Retrieves the list of IP addresses that belong to each of the VNFs in the slice @@ -129,24 +119,21 @@ Get Slice Vnf Ip Addresses ... slice_name: Name of the slice instance ... Execution example: ... \@{slice_ip_address_list}= Get Slice Vnf Ip Addresses \${slice_name} - [Arguments] ${slice_name} - # Get all the ns_id in the slice - @{slice_ns_list} Get Slice Ns List ${slice_name} + @{slice_ns_list}= Get Slice Ns List ${slice_name} Log Many @{slice_ns_list} @{temp_list}= Create List # For each ns_id in the list, get all the vnf_id and their IP addresses FOR ${ns_id} IN @{slice_ns_list} Log ${ns_id} - @{vnf_id_list} Get Ns Vnf List ${ns_id} + @{vnf_id_list}= Get Ns Vnf List ${ns_id} # For each vnf_id in the list, get all its IP addresses - @{ns_ip_list} Get Ns Ip List @{vnf_id_list} + @{ns_ip_list}= Get Ns Ip List @{vnf_id_list} @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list} END Log List ${temp_list} - [Return] @{temp_list} - + RETURN @{temp_list} Check For Network Slice Instance To Configured [Documentation] Verify the slice has been instantiated @@ -154,30 +141,24 @@ Check For Network Slice Instance To Configured ... slice_name: Name of the slice instance ... Execution example: ... Check For Network Slice Instance To Configured \${slice_name} - [Arguments] ${slice_name} - - ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}" + ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list --filter name="${slice_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Contain Any ${stdout} READY BROKEN configured - Check For Network Slice Instance For Failure [Documentation] Verify the slice instance is not in failure ... Parameters: ... slice_name: Name of the slice instance ... Execution example: ... Check For Network Slice Instance For Failure \${slice_name} - [Arguments] ${slice_name} - - ${rc} ${stdout}= Run and Return RC and Output osm nsi-list --filter name="${slice_name}" + ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list --filter name="${slice_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Not Contain ${stdout} failed - Delete NSI [Documentation] Delete Network Slice Instance (NSI) ... Parameters: @@ -185,17 +166,13 @@ Delete NSI ... slice_delete_max_wait_time: Delete operation timeout ... Execution example: ... Delete NST \${slice_name} - [Arguments] ${slice_name} ${slice_delete_max_wait_time}=4min - - ${rc} ${stdout}= Run and Return RC and Output osm nsi-delete ${slice_name} + ${rc} ${stdout}= Run And Return Rc And Output osm nsi-delete ${slice_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} ${slice_delete_max_wait_time}= Convert Time ${slice_delete_max_wait_time} result_format=number - ${slice_delete_max_wait_time}= Evaluate ${slice_delete_max_wait_time} * ${vim_timeout_multiplier} - WAIT UNTIL KEYWORD SUCCEEDS ${slice_delete_max_wait_time} ${slice_delete_pol_time} Check For Network Slice Instance To Be Deleted ${slice_name} - + ${slice_delete_max_wait_time}= Evaluate ${slice_delete_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + Wait Until Keyword Succeeds ${slice_delete_max_wait_time} ${SLICE_DELETE_POL_TIME} Check For Network Slice Instance To Be Deleted ${slice_name} Check For Network Slice Instance To Be Deleted [Documentation] Verify the slice instance is not present @@ -203,10 +180,7 @@ Check For Network Slice Instance To Be Deleted ... slice_name: Name of the slice instance ... Execution example: ... Check For Network Slice Instance \${slice_name} - [Arguments] ${slice_name} - - ${rc} ${stdout}= Run and Return RC and Output osm nsi-list | awk '{print $2}' | grep ${slice_name} + ${rc} ${stdout}= Run And Return Rc And Output osm nsi-list | awk '{print $2}' | grep ${slice_name} + Log ${rc},${stdout} Should Not Be Equal As Strings ${stdout} ${slice_name} - - diff --git a/robot-systest/lib/nst_lib.resource b/robot-systest/lib/nst_lib.resource new file mode 100644 index 0000000..0bb2e1b --- /dev/null +++ b/robot-systest/lib/nst_lib.resource @@ -0,0 +1,57 @@ +*** Comments *** +# Copyright 2020 Atos +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +*** Settings *** +Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client. +Library OperatingSystem + + +*** Variables *** +${SUCCESS_RETURN_CODE} 0 +${NST_DELETE_MAX_WAIT_TIME} 1min +${NST_DELETE_POL_TIME} 15sec + + +*** Keywords *** +Get NST List + [Documentation] Get the list of Network Slice Templates (NST) and log it. + ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-list + Log ${stdout} + Log ${rc} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + +Create NST + [Documentation] Upload a Network Slice Template (NST) to OSM and return the id. + [Arguments] ${nst} + ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-create ${nst} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Delete NST + [Documentation] Delete a Network Slice Template (NST) from OSM. + [Arguments] ${nst_id} + ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-delete ${nst_id} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Wait Until Keyword Succeeds ${NST_DELETE_MAX_WAIT_TIME} ${NST_DELETE_POL_TIME} Check For NST ${nst_id} + +Check For NST + [Documentation] Check that a Network Slice Template (NST) exists in OSM. + [Arguments] ${nst_id} + ${rc} ${stdout}= Run And Return Rc And Output osm netslice-template-list | awk '{print $2}' | grep ${nst_id} + Log ${rc},${stdout} + Should Not Be Equal As Strings ${stdout} ${nst_id} diff --git a/robot-systest/lib/nst_lib.robot b/robot-systest/lib/nst_lib.robot deleted file mode 100644 index 6fac729..0000000 --- a/robot-systest/lib/nst_lib.robot +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2020 Atos -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Variables *** -${success_return_code} 0 -${ns_launch_max_wait_time} 5min -${ns_launch_pol_time} 30sec -${ns_delete_max_wait_time} 1min -${ns_delete_pol_time} 15sec - -*** Keywords *** -Get NST List - ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list - Log ${stdout} - Log ${rc} - Should Be Equal As Integers ${rc} ${success_return_code} - - -Create NST - [Arguments] ${nst} - - ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-create ${nst} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Delete NST - [Arguments] ${nst_id} - - ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-delete ${nst_id} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NST ${nst_id} - - -Check For NST - [Arguments] ${nst_id} - - ${rc} ${stdout}= Run and Return RC and Output osm netslice-template-list | awk '{print $2}' | grep ${nst_id} - Should Not Be Equal As Strings ${stdout} ${nst_id} - diff --git a/robot-systest/lib/openstack_lib.robot b/robot-systest/lib/openstack_lib.resource similarity index 62% rename from robot-systest/lib/openstack_lib.robot rename to robot-systest/lib/openstack_lib.resource index b654cfd..385362b 100644 --- a/robot-systest/lib/openstack_lib.robot +++ b/robot-systest/lib/openstack_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,204 +11,183 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords to interact with Openstack with openstack client. + +Library OperatingSystem +Library String + +Resource ns_lib.resource +Resource vnf_lib.resource + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Get Server Flavor ID + [Documentation] Get from Openstack the flavor id of a server/VM passed as argument. [Arguments] ${server_id} - Should Not Be Empty ${server_id} - ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} | grep flavor | awk 'NR>1{print $1}' RS='(' FS=')' + ${rc} ${stdout}= Run And Return Rc And Output openstack server show ${server_id} | grep flavor | awk 'NR>1{print $1}' RS='(' FS=')' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Flavor Properties + [Documentation] Get from Openstack the properties of a flavor passed as argument. [Arguments] ${flavor_id} - Should Not Be Empty ${flavor_id} - ${rc} ${stdout}= Run and Return RC and Output openstack flavor show ${flavor_id} | grep properties | awk -F '|' '{print $3}' + ${rc} ${stdout}= Run And Return Rc And Output openstack flavor show ${flavor_id} | grep properties | awk -F '|' '{print $3}' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Check NS Servers In VIM [Documentation] Check if the number of servers in Openstack by filtering by NS name is as expected. [Arguments] ${ns_name} ${number} - Should Not Be Empty ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output openstack server list | grep ${ns_name} | awk '{print $4}' + ${rc} ${stdout}= Run And Return Rc And Output openstack server list | grep ${ns_name} | awk '{print $4}' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - @{servers} = Split String ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + @{servers}= Split String ${stdout} ${n_servers}= Get Length ${servers} Should Be Equal As Integers ${number} ${n_servers} - Check If Volume Bootable [Documentation] Check the volume properties and return whether it is bootable or not. [Arguments] ${volume_id} - Should Not Be Empty ${volume_id} - ${rc} ${stdout}= Run and Return RC and Output openstack volume show ${volume_id} | grep bootable | awk '{print $4}' - log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + ${rc} ${stdout}= Run And Return Rc And Output openstack volume show ${volume_id} | grep bootable | awk '{print $4}' + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Project Quota [Documentation] Get a field (ram, cores, ports, etc.) from quota in current project. [Arguments] ${field} - Should Not Be Empty ${field} - ${rc} ${stdout}= Run and Return RC and Output openstack quota show -f yaml | yq '.[] | select(.Resource=="${field}") | .Limit' + ${rc} ${stdout}= Run And Return Rc And Output openstack quota show -f yaml | yq '.[] | select(.Resource=="${field}") | .Limit' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Server Property [Documentation] Get a field (flavor, image, volumes_attached, etc.) from a server. [Arguments] ${server_id} ${field} - Should Not Be Empty ${server_id} Should Not Be Empty ${field} - ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} -c ${field} -f value + ${rc} ${stdout}= Run And Return Rc And Output openstack server show ${server_id} -c ${field} -f value Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Check VM In Server Group [Documentation] Check if a given server is included in an Openstack server group [Arguments] ${server_id} ${server_group_name} - Should Not Be Empty ${server_group_name} Should Not Be Empty ${server_id} - ${rc} ${stdout}= Run and Return RC and Output openstack server group show ${server_group_name} -c members -f value + ${rc} ${stdout}= Run And Return Rc And Output openstack server group show ${server_group_name} -c members -f value Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Contain ${stdout} ${server_id} - Set Volume Id [Documentation] Sets the root volume ID and ordinary volume ID by checking bootable property of volumes [Arguments] ${volume_match} ${index} - Should Not Be Empty ${volume_match} ${index} ${bootable}= Check If Volume Bootable ${volume_match}[${index}] - Set Suite Variable ${bootable} - IF '${bootable}'=='true' - Set Suite Variable ${root_vol_id} ${volume_match}[${index}] - IF ${index}==0 - Set Suite Variable ${ordinary_vol_id} ${volume_match}[1] + IF ${bootable}=='true' + Set Suite Variable ${ROOT_VOL_ID} ${volume_match}[${index}] + IF not ${index} + Set Suite Variable ${ORDINARY_VOL_ID} ${volume_match}[1] ELSE - Set Suite Variable ${ordinary_vol_id} ${volume_match}[0] + Set Suite Variable ${ORDINARY_VOL_ID} ${volume_match}[0] END END - Get Persistent Volumes Attached To Vm [Documentation] Sets the root volume ID and ordinary volume ID by checking bootable property of volumes [Arguments] ${ns_id} - Variable Should Exist ${ns_id} msg=NS is not available ${vnfs_list}= Get Ns Vnf List ${ns_id} ${vim_id}= Get VNF VIM ID ${vnfs_list}[0] ${volumes_attached}= Get Server Property ${vim_id} volumes_attached - log ${volumes_attached} + Log ${volumes_attached} ${stdout}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 - log ${stdout} - [Return] ${stdout} - + Log ${stdout} + RETURN ${stdout} Check If Volume Exists [Documentation] Checks if a volume id exists [Arguments] ${volume_id} - Should Not Be Empty ${volume_id} - ${rc} ${stdout}= Run and Return RC and Output openstack volume list | grep ${volume_id} | wc -l + ${rc} ${stdout}= Run And Return Rc And Output openstack volume list | grep ${volume_id} | wc -l Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Delete Volume [Documentation] Delete a volume by its identifier [Arguments] ${volume_id} - Should Not Be Empty ${volume_id} - ${rc} ${stdout}= Run and Return RC and Output openstack volume delete ${volume_id} + ${rc} ${stdout}= Run And Return Rc And Output openstack volume delete ${volume_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Subnet [Documentation] Get subnet information in JSON format [Arguments] ${subnet_id} - Should Not Be Empty ${subnet_id} - ${rc} ${stdout}= Run and Return RC and Output openstack subnet show ${subnet_id} -f json + ${rc} ${stdout}= Run And Return Rc And Output openstack subnet show ${subnet_id} -f json Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Stop Server [Documentation] Stop a server [Arguments] ${server_id} - Should Not Be Empty ${server_id} - ${rc} ${stdout}= Run and Return RC and Output openstack server stop ${server_id} + ${rc} ${stdout}= Run And Return Rc And Output openstack server stop ${server_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Halt Server [Documentation] Reset a server [Arguments] ${server_id} - Should Not Be Empty ${server_id} - ${rc} ${stdout}= Run and Return RC and Output openstack server set --state error ${server_id} + ${rc} ${stdout}= Run And Return Rc And Output openstack server set --state error ${server_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Delete Server [Documentation] Delete a server [Arguments] ${server_id} - Should Not Be Empty ${server_id} - ${rc} ${stdout}= Run and Return RC and Output openstack server delete ${server_id} + ${rc} ${stdout}= Run And Return Rc And Output openstack server delete ${server_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Create Flavor [Documentation] Create a Flavor [Arguments] ${flavor_name} ${cpu}=1 ${ram}=1024 ${disk}=10 - Should Not Be Empty ${flavor_name} - ${rc} ${flavor_id}= Run and Return RC and Output openstack flavor create ${flavor_name} --ram ${ram} --disk ${disk} --vcpus ${cpu} -c id -f value + ${rc} ${flavor_id}= Run And Return Rc And Output openstack flavor create ${flavor_name} --ram ${ram} --disk ${disk} --vcpus ${cpu} -c id -f value Log ${flavor_id} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${flavor_id} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${flavor_id} Delete Flavor [Documentation] Delete a Flavor [Arguments] ${flavor_id} - Should Not Be Empty ${flavor_id} - ${rc} ${stdout}= Run and Return RC and Output openstack flavor delete ${flavor_id} + ${rc} ${stdout}= Run And Return Rc And Output openstack flavor delete ${flavor_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} diff --git a/robot-systest/lib/package_lib.robot b/robot-systest/lib/package_lib.resource similarity index 57% rename from robot-systest/lib/package_lib.robot rename to robot-systest/lib/package_lib.resource index a9d3804..b563463 100644 --- a/robot-systest/lib/package_lib.robot +++ b/robot-systest/lib/package_lib.resource @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- - -## +*** Comments *** # Copyright ETSI Contributors and Others. # # All Rights Reserved. @@ -16,17 +14,16 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -## + *** Settings *** +Documentation Library providing keywords for building, validating and uploading tar.gz NS and VNF package files with OSM client. Library String Library OperatingSystem *** Variables *** -${success_return_code} 0 -${delete_max_wait_time} 1min -${delete_pol_time} 15sec +${SUCCESS_RETURN_CODE} 0 *** Keywords *** @@ -34,46 +31,37 @@ Upload Package [Documentation] Onboards ("creates") a NF Package into OSM. ... - Parameters: ... - pkg: Name (and location) of the NF Package - [Arguments] ${pkg} - - # Proceedes with the onboarding with the appropriate arguments - ${rc} ${stdout}= Run and Return RC and Output tar -czf ${pkg}.tar.gz -C ${pkg} . - ${rc} ${stdout}= Run and Return RC and Output osm upload-package ${pkg}.tar.gz - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + # Proceeds with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run And Return Rc And Output tar -czf ${pkg}.tar.gz -C ${pkg} . + Log ${rc},${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm upload-package ${pkg}.tar.gz + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Delete Package + [Documentation] Delete a tar.gz package passed as argument from the filesystem. [Arguments] ${pkg} - - # Proceedes with the onboarding with the appropriate arguments - ${rc} ${stdout}= Run and Return RC and Output rm ${pkg}.tar.gz - + # Proceeds with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run And Return Rc And Output rm ${pkg}.tar.gz + Log ${rc},${stdout} Package Build [Documentation] Build the package NS, VNF given the package_folder - [Arguments] ${pkg_folder} ${skip_charm_build}=${EMPTY} - - ${skip_charm} Set Variable If '${skip_charm_build}'!='${EMPTY}' --skip-charm-build \ - ${rc} ${stdout}= Run and Return RC and Output osm package-build ${pkg_folder} ${skip_charm} - Should Be Equal As Integers ${rc} ${success_return_code} + ${skip_charm}= Set Variable If "${skip_charm_build}" != "${EMPTY}" "--skip-charm-build" ${EMPTY} + ${rc} ${stdout}= Run And Return Rc And Output osm package-build ${pkg_folder} ${skip_charm} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Contain ${stdout} Package created ${package}= Get Line ${stdout} -1 - - [Return] ${package} - + RETURN ${package} Package Validate [Documentation] Validate descriptors given a base directory - [Arguments] ${pkg_folder} - ${rc} ${stdout}= Run and Return RC and Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}' - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run And Return Rc And Output osm package-validate ${pkg_folder} | awk -F\| '$2 !~ /-/ && $4 ~ /OK|ERROR/ {print $4}' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Contain ${stdout} 'OK' ${package}= Get Line ${stdout} -1 - - [Return] ${package} - + RETURN ${package} diff --git a/robot-systest/lib/project_lib.robot b/robot-systest/lib/project_lib.resource similarity index 59% rename from robot-systest/lib/project_lib.robot rename to robot-systest/lib/project_lib.resource index 35366e2..a46ee61 100644 --- a/robot-systest/lib/project_lib.robot +++ b/robot-systest/lib/project_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,121 +11,115 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords for CRUD operations over projects with OSM client. +Library OperatingSystem + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Create Project + [Documentation] Create a project in OSM with the name passed as argument, and return the project id. [Arguments] ${project_name} - Should Not Be Empty ${project_name} - ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} + ${rc} ${stdout}= Run And Return Rc And Output osm project-create ${project_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Create Project With Quotas + [Documentation] Create a project in OSM with the name and quotas passed as arguments, and return the project id. [Arguments] ${project_name} ${project_quotas} - Should Not Be Empty ${project_name} Should Not Be Empty ${project_quotas} - ${rc} ${stdout}= Run and Return RC and Output osm project-create ${project_name} --quotas ${project_quotas} + ${rc} ${stdout}= Run And Return Rc And Output osm project-create ${project_name} --quotas ${project_quotas} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get Project Quotas + [Documentation] Get from OSM a specific quota parameter from the project passed as argument. [Arguments] ${project_name} ${quotas_name} - Should Not Be Empty ${project_name} Should Not Be Empty ${quotas_name} - ${rc} ${stdout}= Run and Return RC and Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}' + ${rc} ${stdout}= Run And Return Rc And Output osm project-show ${project_name} | grep '${quotas_name}' | awk -F ',|: ' '{print $2}' | awk '{print $1}' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Update Project Quotas + [Documentation] Update in OSM the quotas of a project with the new quotas passed as arguments. [Arguments] ${project_name} ${project_quotas} - Should Not Be Empty ${project_name} Should Not Be Empty ${project_quotas} - ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --quotas ${project_quotas} + ${rc} ${stdout}= Run And Return Rc And Output osm project-update ${project_name} --quotas ${project_quotas} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Update Project Name + [Documentation] Update in OSM the name of a project with the new name passed as argument. [Arguments] ${project_name} ${new_name} - Should Not Be Empty ${project_name} Should Not Be Empty ${new_name} - ${rc} ${stdout}= Run and Return RC and Output osm project-update ${project_name} --name ${new_name} + ${rc} ${stdout}= Run And Return Rc And Output osm project-update ${project_name} --name ${new_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Check If User Is Assigned To Project + [Documentation] Check in OSM if a user exists in a project passed as argument. [Arguments] ${user_name} ${project_name} - Should Not Be Empty ${user_name} Should Not Be Empty ${project_name} ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep "project_name" | grep "${project_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Create VNFD In Project - [Documentation] Onboards a VNFD package into an OSM project. + [Documentation] Onboards a VNF package into an OSM project. ... Extra parameters (such as 'override') are given to this function in name=value format. These parameters will be appended to the 'osm vnfpkg-create' command with the next syntax: --param_name=param_value - [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} @{optional_parameters} - Should Not Be Empty ${project_name} Should Not Be Empty ${vnfd_pkg} Should Not Be Empty ${project_user} Should Not Be Empty ${user_password} - ${osm_pkg_create_command}= Set Variable osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-create ${vnfd_pkg} FOR ${param} IN @{optional_parameters} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + Log ${match},${param_name},${param_value} ${osm_pkg_create_command}= Catenate ${osm_pkg_create_command} --${param_name}=${param_value} END - - ${rc} ${stdout}= Run and Return RC and Output ${osm_pkg_create_command} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_pkg_create_command} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Delete VNFD In Project + [Documentation] Deletes a VNF package from an OSM project. [Arguments] ${project_name} ${vnfd_pkg} ${project_user} ${user_password} - Should Not Be Empty ${project_name} Should Not Be Empty ${vnfd_pkg} Should Not Be Empty ${project_user} Should Not Be Empty ${user_password} - ${rc} ${stdout}= Run and Return RC and Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg} + ${rc} ${stdout}= Run And Return Rc And Output osm --project ${project_name} --user ${project_user} --password ${user_password} vnfpkg-delete ${vnfd_pkg} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Remove User From Project + [Documentation] Remove a specific user from a specific project in OSM. [Arguments] ${user_name} ${project_name} - Should Not Be Empty ${user_name} Should Not Be Empty ${project_name} ${rc} ${stdout}= Run And Return RC And Output osm user-update ${user_name} --remove-project ${project_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Delete Project + [Documentation] Delete from OSM the project passed as argument. [Arguments] ${project_name} - - ${rc} ${stdout}= Run and Return RC and Output osm project-delete ${project_name} + ${rc} ${stdout}= Run And Return Rc And Output osm project-delete ${project_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} diff --git a/robot-systest/lib/prometheus_lib.robot b/robot-systest/lib/prometheus_lib.resource similarity index 71% rename from robot-systest/lib/prometheus_lib.robot rename to robot-systest/lib/prometheus_lib.resource index 0f4f07c..be3c120 100644 --- a/robot-systest/lib/prometheus_lib.robot +++ b/robot-systest/lib/prometheus_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation Library to obtain metrics from Prometheus. @@ -20,28 +22,27 @@ 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=""} +${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' + 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 + Set Suite Variable ${PROMETHEUS_HOST} ${local_prometheus_host} + Set Suite Variable ${PROMETHEUS_HOST} 9091 END - Log ${prometheus_port} - Log ${prometheus_host} - Log ${prometheus_user} - Log ${prometheus_password} - + 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. @@ -50,30 +51,27 @@ Get Metric ... 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} - ${filter}= Set Variable ${EMPTY} FOR ${param} IN @{filter_parameters} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error 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_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}} + ${resp}= Execute Prometheus Instant Query ${prometheus_ip} ${prometheus_port} ${prometheus_user} ${prometheus_password} query=${metric}{${filter}} ${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 Should Be Equal As Integers 1 ${results} msg=Metric ${metric} with multiple values values=false - [Return] ${result_list[0]["value"][1]} - + RETURN ${result_list[0]["value"][1]} 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} - ${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} - ${resp}= GET On Session prometheus /api/v1/query?${querystring} timeout=${timeout} + ${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} + ${resp}= GET On Session prometheus /api/v1/query?${querystring} timeout=${TIMEOUT} Status Should Be 200 ${resp} - [Return] ${resp.json()} + RETURN ${resp.json()} diff --git a/robot-systest/lib/repo_lib.resource b/robot-systest/lib/repo_lib.resource new file mode 100644 index 0000000..a339255 --- /dev/null +++ b/robot-systest/lib/repo_lib.resource @@ -0,0 +1,59 @@ +*** Comments *** +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +*** Settings *** +Documentation Library to deploy and delete OSM repos. + +Library OperatingSystem + +Resource ../lib/nsd_lib.resource + + +*** Variables *** +${SUCCESS_RETURN_CODE} 0 +${REPO_DELETE_MAX_WAIT_TIME} 1min +${REPO_DELETE_POL_TIME} 15sec + + +*** Keywords *** +Get Repos List + [Documentation] Get the list of repos and log it. + ${rc} ${stdout}= Run And Return RC And Output osm repo-list + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + +Create Repo + [Documentation] Create a repository in OSM with the name and options passed as arguments, and return the repo id. + [Arguments] ${repo_name} ${repo_uri} ${repo_type} ${user} ${password} ${additional_options}="" + ${user_attr}= Set Variable If '${user}'!='${EMPTY}' --user ${user} \ + ${password_attr}= Set Variable If '${password}'!='${EMPTY}' --password ${password} \ + ${rc} ${stdout}= Run And Return RC And Output osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri} + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} + +Delete Repo + [Documentation] Delete from OSM the repo passed as argument. + [Arguments] ${repo_id} + ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return RC And Output osm repo-delete ${repo_id} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Log ${stdout} + WAIT UNTIL KEYWORD SUCCEEDS ${REPO_DELETE_MAX_WAIT_TIME} ${REPO_DELETE_POL_TIME} Check For NSD ${repo_id} + +Check For Repo + [Documentation] Check that a repository exists in OSM. + [Arguments] ${repo_id} + ${rc} ${stdout}= Run And Return RC And Output osm repo-list | awk '{print $2}' | grep ${repo_id} + Log ${rc},${stdout} + Should Not Be Equal As Strings ${stdout} ${repo_id} diff --git a/robot-systest/lib/repo_lib.robot b/robot-systest/lib/repo_lib.robot deleted file mode 100644 index 8237b18..0000000 --- a/robot-systest/lib/repo_lib.robot +++ /dev/null @@ -1,52 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -*** Settings *** -Documentation Library to deploy and delete OSM repos. - - -*** Variables *** -${success_return_code} 0 - -*** Keywords *** -Get Repos List - ${rc} ${stdout}= Run and Return RC and Output osm repo-list - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - - -Create Repo - [Arguments] ${repo_name} ${repo_uri} ${repo_type} ${user} ${password} ${additional_options}="" - - ${user_attr} Set Variable If '${user}'!='${EMPTY}' --user ${user} \ - ${password_attr} Set Variable If '${password}'!='${EMPTY}' --password ${password} \ - - ${rc} ${stdout}= Run and Return RC and Output osm repo-add --type ${repo_type} ${user_attr} ${password_attr} ${additional_options} ${repo_name} ${repo_uri} - Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Delete Repo - [Arguments] ${repo_id} - - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm repo-delete ${repo_id} - Should Be Equal As Integers ${rc} ${success_return_code} - Log ${stdout} - WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For NSD ${repo_id} - - -Check For Repo - [Arguments] ${repo_id} - - ${rc} ${stdout}= Run and Return RC and Output osm repo-list | awk '{print $2}' | grep ${repo_id} - Should Not Be Equal As Strings ${stdout} ${repo_id} diff --git a/robot-systest/lib/rest_lib.resource b/robot-systest/lib/rest_lib.resource new file mode 100644 index 0000000..74e97e9 --- /dev/null +++ b/robot-systest/lib/rest_lib.resource @@ -0,0 +1,109 @@ +*** Comments *** +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License + + +*** Settings *** +Documentation Library with sol003 keywords and variables . + +Library String +Library OperatingSystem +Library RequestsLibrary +Library JsonValidator +Library yaml +Library JSONLibrary + +Resource ../lib/vim_lib.resource + + +*** Variables *** +@{SUCCESS_STATUS_CODE_LIST} 200 201 202 204 +${AUTH_TOKEN_URI} /osm/admin/v1/tokens +${REST_API_HOST} ${EMPTY} +${OSM_USER} %{OSM_USER=admin} +${OSM_PASSWORD} %{OSM_PASSWORD=admin} +${OSM_PROJECT} %{OSM_PROJECT=admin} + + +*** Keywords *** +Get Auth Token + [Documentation] Send a REST POST message to OSM to get an authentication token, + ... and store the authentication token in a suite variable to be used later on. + Set REST API Host + Create Session osmhit ${REST_API_HOST} disable_warnings=1 + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + &{data}= Create Dictionary username=${OSM_USER} password=${OSM_PASSWORD} project-id=${OSM_PROJECT} + ${resp}= Post On Session osmhit ${AUTH_TOKEN_URI} json=${data} headers=${headers} + Log ${resp} + Pass Execution If ${resp.status_code} in ${SUCCESS_STATUS_CODE_LIST} Get Auth Token completed + Set Suite Variable ${TOKEN_STATUS_CODE} ${resp.status_code} + ${access_token}= Get Value From Json ${resp.json()} $..id + Set Test Variable ${ACCESS_TOKEN} ${access_token[0]} + Set Test Variable ${TOKEN_RESPONSE} ${resp} + Sleep 2s + +Set Dockerized Host + [Documentation] Set the suite variable REST_API_HOST to be used in this library and the testsuites using it. + ... This method must be used if the tests are run from a container in the same K8s cluster where OSM is running. + [Arguments] ${env_host} + Set Suite Variable ${REST_API_HOST} https://${env_host} + +Set Standalone Host + [Documentation] Set a suite variable REST_API_HOST to be used in this library and the testsuites using it. + ... This method must be used if the tests are run from any place outside the K8s cluster where OSM is running. + [Arguments] ${env_host} + Set Suite Variable ${REST_API_HOST} https://${env_host}:9999 + +Read Directory + [Documentation] Read Current Directory and return it + ${Directory}= Replace String ${CURDIR} lib resources/ + ${json_path}= Set Variable ${Directory} + RETURN ${json_path} + +Post Api Request + [Documentation] Send to OSM a POST API message to OSM to the given uri with the given json data, + ... and save response and status code in suite variables to be used later on. + [Arguments] ${PostApi} ${json_data} + Create Session APISession ${REST_API_HOST} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${ACCESS_TOKEN} + ${request_response}= Post On Session APISession ${PostApi} json=${json_data} headers=${headers} + Set Suite Variable ${REQUEST_RESPONSE} ${request_response} + ${response_statuscode}= Convert To String ${request_response.status_code} + Set Suite Variable ${RESPONSE_STATUSCODE} ${response_statuscode} + +Set REST API Host + [Documentation] Set the REST_API_HOST suite variable from OSM_HOSTNAME env variable + ${nbi_host}= Get Environment Variable OSM_HOSTNAME + ${passed}= Run Keyword And Return Status Should Contain ${nbi_host} : + IF ${passed} + Set Dockerized Host ${nbi_host} + ELSE + Set Standalone Host ${nbi_host} + END + +Get ID + [Documentation] Examine a REQUEST_RESPONSE dictionary as JSON and return the requested key passed as argument. + [Arguments] ${Key} + Pass Execution If ${REQUEST_RESPONSE.status_code} in ${SUCCESS_STATUS_CODE_LIST} Get Auth Token completed + ${id}= Get Value From Json ${REQUEST_RESPONSE.json()} $..${Key} + RETURN ${id[0]} + +Get Api Request + [Documentation] Send to OSM a GET API message to OSM to the given uri, + ... and save response and status code in suite variables to be used later on. + [Arguments] ${uri} + Create Session Session ${REST_API_HOST} + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${ACCESS_TOKEN} + ${request_response}= Get On Session Session ${uri} headers=${headers} + Set Suite Variable ${REQUEST_RESPONSE} ${request_response} + ${response_statuscode}= Convert To String ${request_response.status_code} + Set Suite Variable ${RESPONSE_STATUSCODE} ${response_statuscode} diff --git a/robot-systest/lib/rest_lib.robot b/robot-systest/lib/rest_lib.robot deleted file mode 100644 index ced8a21..0000000 --- a/robot-systest/lib/rest_lib.robot +++ /dev/null @@ -1,95 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License - -*** Settings *** -Documentation Library with sol003 keywords and variables . - -Library RequestsLibrary -Library JsonValidator -Library yaml -Library JSONLibrary -Library String -Library OperatingSystem - -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot - -*** Variables *** -@{success_status_code_list} 200 201 202 204 -${auth_token_uri} /osm/admin/v1/tokens -${HOST} ${EMPTY} -${osm_user} %{OSM_USER=admin} -${osm_password} %{OSM_PASSWORD=admin} -${osm_project} %{OSM_PROJECT=admin} - -*** Keywords *** -Get Auth Token - [Tags] auth_token - Get Hostname - Create Session osmhit ${HOST} disable_warnings=1 - &{headers} Create Dictionary Content-Type=application/json Accept=application/json - &{data} Create Dictionary username=${osm_user} password=${osm_password} project-id=${osm_project} - ${resp}= Post On Session osmhit ${auth_token_uri} json=${data} headers=${headers} - Log ${resp} - Pass Execution If ${resp.status_code} in ${success_status_code_list} Get Auth Token completed - Set Suite Variable ${token_status_code} ${resp.status_code} - ${access_token}= Get Value From Json ${resp.json()} $..id - Set Test Variable ${access_token} ${access_token[0]} - Set Test Variable ${token_response} ${resp} - sleep 2s - -Set Dockerized Host - [Arguments] ${env_host} - Set Suite Variable ${HOST} https://${env_host} - -Set Standalone Host - [Arguments] ${env_host} - Set Suite Variable ${HOST} https://${env_host}:9999 - -Read Directory - [Documentation] To Read Current Direct ory - ${Directory}= Replace String ${CURDIR} lib resources/ - ${json_path}= Set Variable ${Directory} - [Return] ${JsonPath} - -Post Api Request - [Arguments] ${PostApi} - [Documentation] Keword to Post API Request - Create Session APISession ${HOST} - &{headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${access_token} - ${request_response}= Post On Session APISession ${PostApi} json=${updated_json_obj} headers=${headers} - Set Suite Variable ${request_response} - ${response_statuscode} Convert To String ${request_response.status_code} - Set Suite Variable ${response_statuscode} - -Get Hostname - [Documentation] Keyword to get the default osm Hostname - ${nbi_host}= Get Environment Variable OSM_HOSTNAME - ${passed}= Run Keyword And Return Status Should Contain ${nbi_host} : - Run Keyword If ${passed} Set Dockerized Host ${nbi_host} - ... ELSE Set Standalone Host ${nbi_host} - -Get ID - [Arguments] ${Key} - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Get Auth Token completed - ${id}= Get Value From Json ${request_response.json()} $..${Key} - Set Suite Variable ${value} ${id[0]} - [Return] ${value} - -Get Api Request - [Arguments] ${uri} - [Documentation] Keyword to Get API Request - Create Session Session ${HOST} - &{headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${access_token} - ${request_response}= Get On Session Session ${uri} headers=${Headers} - Set Suite Variable ${request_response} - ${response_statuscode} Convert To String ${request_response.status_code} - Set Suite Variable ${response_statuscode} diff --git a/robot-systest/lib/role_lib.robot b/robot-systest/lib/role_lib.resource similarity index 63% rename from robot-systest/lib/role_lib.robot rename to robot-systest/lib/role_lib.resource index 984b69a..1ba3a2d 100644 --- a/robot-systest/lib/role_lib.robot +++ b/robot-systest/lib/role_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,62 +11,63 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords for CRUD operations over roles with OSM client. +Library OperatingSystem + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Create Role + [Documentation] Create a role in OSM with the name passed as argument, and return the role id. [Arguments] ${role_name} - Should Not Be Empty ${role_name} - ${rc} ${stdout}= Run and Return RC and Output osm role-create ${role_name} + ${rc} ${stdout}= Run And Return Rc And Output osm role-create ${role_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Update Role - [Documentation] Updates a role in OSM. + [Documentation] Update a role in OSM. ... The extra parameters (like '--add') are given to this function in name=value format. These parameters will be appended to the 'osm role-update' command with the next syntax: --param_name=param_value ... Example of execution: ... Update Role \${role_name} add='vims: true' - [Arguments] ${role_name} @{optional_parameters} - ${osm_update_command}= Set Variable osm role-update ${role_name} FOR ${param} IN @{optional_parameters} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + Log ${match},${param_name},${param_value} ${osm_update_command}= Catenate ${osm_update_command} --${param_name}=${param_value} END - ${rc} ${stdout}= Run and Return RC and Output ${osm_update_command} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_update_command} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Check If Role Exists + [Documentation] Check if a role exists in OSM. [Arguments] ${role_name} - Should Not Be Empty ${role_name} ${rc} ${stdout}= Run And Return RC And Output osm role-list | awk 'NR>3 {print $2}' | grep "${role_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Check If User Has Role + [Documentation] Check if a user has a role in a specific project in OSM. [Arguments] ${user_name} ${role_name} ${project_name} - Should Not Be Empty ${user_name} Should Not Be Empty ${role_name} Should Not Be Empty ${project_name} ${rc} ${stdout}= Run And Return RC And Output osm user-show ${user_name} | grep -B1 "role_name" | grep -B1 "${role_name}" | grep "project_name" | grep "${project_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Delete Role + [Documentation] Delete from OSM the role passed as argument. [Arguments] ${role_name} - - ${rc} ${stdout}= Run and Return RC and Output osm role-delete ${role_name} + ${rc} ${stdout}= Run And Return Rc And Output osm role-delete ${role_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} diff --git a/robot-systest/lib/sdnc_lib.robot b/robot-systest/lib/sdnc_lib.resource similarity index 56% rename from robot-systest/lib/sdnc_lib.robot rename to robot-systest/lib/sdnc_lib.resource index a897675..c9cd8c7 100644 --- a/robot-systest/lib/sdnc_lib.robot +++ b/robot-systest/lib/sdnc_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation Library to manage SDNCs. @@ -17,85 +19,79 @@ Library String Library Collections Library OperatingSystem -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/prometheus_lib.resource *** Variables *** -${success_return_code} 0 -${delete_max_wait_time} 1min -${delete_pol_time} 15sec -${sdnc_status_max_wait_time} 6min -${sdnc_status_pol_time} 1min +${SUCCESS_RETURN_CODE} 0 +${SDNC_DELETE_MAX_WAIT_TIME} 1min +${SDNC_DELETE_POL_TIME} 15sec +${SDNC_STATUS_MAX_WAIT_TIME} 6min +${SDNC_STATUS_POL_TIME} 1min *** Keywords *** Create SDNC - [Documentation] Creates an SDNC in OSM. + [Documentation] Register an SDN Controller in OSM. ... The optional parameters (such as 'switch_dpid' or 'ip-address') are given to this function in name=value format. These parameters will be appended to the 'osm sdnc-create' command with the next syntax: --param_name=param_value ... Returns the ID of the created SDNC Target. ... Example of execution: ... \${sdnc_id}= Create SDNC \${sdnc_name} \${sdnc_user} \${sdnc_password} \${sdnc_url} \${sdnc_type} switch_dpid='{...}' - [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} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + Log ${match},${param_name},${param_value} ${osm_sdnc_create_command}= Catenate ${osm_sdnc_create_command} --${param_name}=${param_value} END - ${rc} ${stdout}= Run and Return RC and Output ${osm_sdnc_create_command} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_sdnc_create_command} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} -Check for SDNC To Be Deleted +Check For SDNC To Be Deleted + [Documentation] Check if an SDN controller identified by name is not present in OSM. [Arguments] ${sdnc_name} - - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name} + ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name} + Log ${rc},${stdout} Should Not Be Equal As Strings ${stdout} ${sdnc_name} - Delete SDNC + [Documentation] Unregister/delete from OSM an SDN controller identified by name. [Arguments] ${sdnc_name} - - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm sdnc-delete ${sdnc_name} + ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm sdnc-delete ${sdnc_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for SDNC To Be Deleted ${sdnc_name} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Wait Until Keyword Succeeds ${SDNC_DELETE_MAX_WAIT_TIME} ${SDNC_DELETE_POL_TIME} Check For SDNC To Be Deleted ${sdnc_name} Get SDNC List - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list + [Documentation] Get the list of SDN controllers from OSM and log it. + ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} - -Check for SDNC +Check For SDNC + [Documentation] Check if an SDN Controller identified by name or id exists in OSM and is enabled. [Arguments] ${sdnc_id} - - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-show ${sdnc_id} | grep -io ENABLED + ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-show ${sdnc_id} | grep -io ENABLED Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} - -Check for SDNC Status +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} - + 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} Get SDNC ID + [Documentation] Check if an SDN controller identified by name exists in OSM, and return the id. [Arguments] ${sdnc_name} - - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | grep " ${sdnc_name} " | awk '{print $4}' - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run And Return Rc And Output osm sdnc-list | grep " ${sdnc_name} " | awk '{print $4}' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=SDNC '${sdnc_name}' not found values=false - [Return] ${stdout} - + RETURN ${stdout} 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} Should Be Equal As Integers ${metric} 1 msg=SDNC '${sdnc_id}' is not active values=false diff --git a/robot-systest/lib/ssh_lib.robot b/robot-systest/lib/ssh_lib.resource similarity index 55% rename from robot-systest/lib/ssh_lib.robot rename to robot-systest/lib/ssh_lib.resource index 3e3c00b..15d48a6 100644 --- a/robot-systest/lib/ssh_lib.robot +++ b/robot-systest/lib/ssh_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,52 +11,73 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords to interact with NF via SSH. +Library SSHLibrary + + *** Keywords *** Test SSH Connection + [Documentation] Test the SSH connection to the host with the user and credentials passed as arguments. [Arguments] ${host} ${username} ${password} ${privatekey} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END Execute Command hostname Close All Connections -Check If remote File Exists +Check If Remote File Exists + [Documentation] Check via SSH if a file exists in in the remote host, using the user and credentials passed as arguments. [Arguments] ${host} ${username} ${password} ${privatekey} ${file} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END ${rc}= Execute Command ls ${file} >& /dev/null return_stdout=False return_rc=True Close All Connections Should Be Equal As Integers ${rc} 0 Check If Remote Folder Exists + [Documentation] Check via SSH if a folder exists in in the remote host, using the user and credentials passed as arguments. [Arguments] ${host} ${username} ${password} ${privatekey} ${folder} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END ${output}= Execute Command ls -d ${folder} Close All Connections Should Be Equal As Strings ${output} ${folder} Get Remote File Content + [Documentation] Get via SSH the content of a remote file and return it. [Arguments] ${host} ${username} ${password} ${privatekey} ${file} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END ${output}= Execute Command cat ${file} Close All Connections - [Return] ${output} + RETURN ${output} Ping Many + [Documentation] Connect via SSH to a remote host and test ping to a list of IP addresses, passed as argument. [Arguments] ${host} ${username} ${password} ${privatekey} @{ip_list} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END FOR ${ip} IN @{ip_list} ${result}= Execute Command ping -c 5 -W 1 ${ip} > /dev/null && echo OK shell=True Log ${result} @@ -63,17 +85,18 @@ Ping Many END Close All Connections - Execute Remote Command Check Rc Return Output + [Documentation] Execute via SSH a command in a remote host and, if the command succeeds, return the output. [Arguments] ${host} ${username} ${password} ${privatekey} ${command} - Open Connection ${host} - Run Keyword If '${password}'!='${EMPTY}' Login ${username} ${password} - ... ELSE Login With Public Key ${username} ${privatekey} + IF "${password}" != "${EMPTY}" + Login ${username} ${password} + ELSE + Login With Public Key ${username} ${privatekey} + END ${stdout} ${rc}= Execute Command ${command} return_rc=True return_stdout=True Log ${rc} Log ${stdout} Close All Connections Should Be Equal As Integers ${rc} 0 - [Return] ${stdout} - + RETURN ${stdout} diff --git a/robot-systest/lib/user_lib.robot b/robot-systest/lib/user_lib.resource similarity index 60% rename from robot-systest/lib/user_lib.robot rename to robot-systest/lib/user_lib.resource index 4e5893c..8dd7601 100644 --- a/robot-systest/lib/user_lib.robot +++ b/robot-systest/lib/user_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,56 +11,58 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords for CRUD operations over Network Slice Templates with OSM client. +Library OperatingSystem + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Create User + [Documentation] Create a user in OSM with the name and password passed as arguments, and return the user id. [Arguments] ${user_name} ${user_password} - Should Not Be Empty ${user_name} Should Not Be Empty ${user_password} - ${rc} ${stdout}= Run and Return RC and Output osm user-create ${user_name} --password ${user_password} + ${rc} ${stdout}= Run And Return Rc And Output osm user-create ${user_name} --password ${user_password} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Update User Password + [Documentation] Update the password of a user in OSM. [Arguments] ${user_name} ${user_password} ${user_new_password} - Should Not Be Empty ${user_name} Should Not Be Empty ${user_password} Should Not Be Empty ${user_new_password} - ${rc} ${stdout}= Run and Return RC and Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password} + ${rc} ${stdout}= Run And Return Rc And Output osm user-update ${user_name} --current-password ${user_password} --new-password ${user_new_password} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Update User Role + [Documentation] Update the role of a user in a project in OSM. [Arguments] ${user_name} ${project_name} ${role_name} - Should Not Be Empty ${user_name} Should Not Be Empty ${project_name} Should Not Be Empty ${role_name} - ${rc} ${stdout}= Run and Return RC and Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name} + ${rc} ${stdout}= Run And Return Rc And Output osm user-update --add-project-role '${project_name},${role_name}' ${user_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Check If User Exists + [Documentation] Check if a user exists in OSM. [Arguments] ${user_name} - Should Not Be Empty ${user_name} ${rc} ${stdout}= Run And Return RC And Output osm user-list | awk 'NR>3 {print $2}' | grep "${user_name}" Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Delete User + [Documentation] Delete from OSM the user passed as argument. [Arguments] ${user_name} - - ${rc} ${stdout}= Run and Return RC and Output osm user-delete ${user_name} + ${rc} ${stdout}= Run And Return Rc And Output osm user-delete ${user_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} diff --git a/robot-systest/lib/vim_lib.robot b/robot-systest/lib/vim_lib.resource similarity index 58% rename from robot-systest/lib/vim_lib.robot rename to robot-systest/lib/vim_lib.resource index 2c96802..e46f632 100644 --- a/robot-systest/lib/vim_lib.robot +++ b/robot-systest/lib/vim_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation Library to manage VIM Targets. @@ -17,108 +19,98 @@ Library String Library Collections Library OperatingSystem -# Gerardo -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/prometheus_lib.resource *** Variables *** -${success_return_code} 0 -${delete_max_wait_time} 1min -${delete_pol_time} 15sec -${vim_status_max_wait_time} 3min -${vim_status_pol_time} 15sec -${vim_opstate_max_wait_time} 40sec -${vim_opstate_pol_time} 10sec +${SUCCESS_RETURN_CODE} 0 +${VIM_DELETE_MAX_WAIT_TIME} 1min +${VIM_DELETE_POL_TIME} 15sec +${VIM_STATUS_MAX_WAIT_TIME} 3min +${VIM_STATUS_POL_TIME} 15sec +${VIM_OPSTATE_MAX_WAIT_TIME} 40sec +${VIM_OPSTATE_POL_TIME} 10sec *** Keywords *** Create VIM Target - [Documentation] Create a VIM Target in OSM. + [Documentation] Register a VIM account in OSM and return the id. ... The optional parameters (such as 'config' or 'sdn_controller') are given to this function in name=value format. These parameters will be appended to the 'osm vim-create' command with the next syntax: --param_name=param_value ... Return the ID of the created VIM Target. ... Example of execution: ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}' - [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters} - ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type} FOR ${param} IN @{optional_parameters} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${match} ${param_name} ${param_value}= Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + Log ${match},${param_name},${param_value} ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value} END - ${rc} ${stdout}= Run and Return RC and Output ${osm_vim_create_command} + ${rc} ${stdout}= Run And Return Rc And Output ${osm_vim_create_command} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Delete VIM Target + [Documentation] Unregister/delete a VIM account from OSM. [Arguments] ${vim_name} - - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm vim-delete ${vim_name} - Log ${stdout} - Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for VIM Target ${vim_name} - + ${rc} ${stdout}= Run Keyword And Continue On Failure Run And Return Rc And Output osm vim-delete ${vim_name} + Log ${rc},${stdout} + Wait Until Keyword Succeeds ${VIM_DELETE_MAX_WAIT_TIME} ${VIM_DELETE_POL_TIME} Check For VIM Target ${vim_name} Get VIM Targets - ${rc} ${stdout}= Run and Return RC and Output osm vim-list + [Documentation] Get the list of VIM accounts in OSM. + ${rc} ${stdout}= Run And Return Rc And Output osm vim-list Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} -Check for VIM Target +Check For VIM Target + [Documentation] Check if a VIM account has been registered in OSM. [Arguments] ${vim_name} - - ${rc} ${stdout}= Run and Return RC and Output osm vim-list | awk '{print $2}' | grep ${vim_name} + ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | awk '{print $2}' | grep ${vim_name} + Log ${rc},${stdout} Should Not Be Equal As Strings ${stdout} ${vim_name} - -Check for VIM Target Metric +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} - ${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_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} -Check for VIM Target Status +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} - ${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_host} ${prometheus_port} ${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. [Arguments] ${vim_name} - - ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $4}' - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | grep " ${vim_name} " | awk '{print $4}' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false - [Return] ${stdout} - + RETURN ${stdout} Check VIM Target Operational State + [Documentation] Check if the VIM account in OSM is enabled. [Arguments] ${vim_name} - - Wait Until Keyword Succeeds ${vim_opstate_max_wait_time} ${vim_opstate_pol_time} Check If VIM Target Is Enabled ${vim_name} - + Wait Until Keyword Succeeds ${VIM_OPSTATE_MAX_WAIT_TIME} ${VIM_OPSTATE_POL_TIME} Check If VIM Target Is Enabled ${vim_name} Check If VIM Target Is Enabled + [Documentation] Check if the VIM account passed as argument is enabled in OSM (meaning that the RO could reach the VIM account). [Arguments] ${vim_name} - - ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $6}' - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run And Return Rc And Output osm vim-list | grep " ${vim_name} " | awk '{print $6}' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Should Be Equal As Strings ${stdout} ENABLED msg=VIM Target '${vim_name}' is not enabled values=false - 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} 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} Should Be True ${metric} <2 msg=VIM Target '${vim_account_id}' has no metric diff --git a/robot-systest/lib/vnf_lib.robot b/robot-systest/lib/vnf_lib.resource similarity index 57% rename from robot-systest/lib/vnf_lib.robot rename to robot-systest/lib/vnf_lib.resource index b7d6cc3..2700135 100644 --- a/robot-systest/lib/vnf_lib.robot +++ b/robot-systest/lib/vnf_lib.resource @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,72 +11,67 @@ # See the License for the specific language governing permissions and # limitations under the License. + +*** Settings *** +Documentation Library providing keywords for CRUD operations over VNF instances with OSM client. +Library OperatingSystem +Library String + + *** Variables *** -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Keywords *** Get Vnf List - ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1 + [Documentation] Get the list of VNF instances and return it. + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-list 2>&1 Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} Get VNF VIM ID + [Documentation] Get the identifier of the first VDU of a VNF instance. Useful to get the id when a VNF has a single VDU. [Arguments] ${vnf_id} - Should Not Be Empty ${vnf_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"' + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[]."vim-id"' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} - - -Get VDU list from VNF - [Documentation] Return a list of the VDUr ids for a VNF + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + RETURN ${stdout} +Get VDU List From VNF + [Documentation] Return a list of the VDU instance ids of a VNF instance [Arguments] ${vnf_id} - Should Not Be Empty ${vnf_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[].id' + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[].id' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False @{vdur_ids}= Split String ${stdout} - [Return] @{vdur_ids} - + RETURN @{vdur_ids} Get VDU VIM Id [Documentation] Return the VIM VM ID for a VDU - [Arguments] ${vnf_id} ${vdur_id} - Should Not Be Empty ${vnf_id} - ${rc} ${vm_vim_id}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."vim-id"' + ${rc} ${vm_vim_id}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(.id == "'${vdur_id}'")' | yq -r '."vim-id"' Log ${vm_vim_id} - Should Be Equal As Integers ${rc} ${success_return_code} msg=${vm_vim_id} values=False - [Return] ${vm_vim_id} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${vm_vim_id} values=False + RETURN ${vm_vim_id} Get Vnf Vdur IPs [Documentation] Return a list with the IP addresses of the VDU records of a VNF instance. - [Arguments] ${vnf_id} - Should Not Be Empty ${vnf_id} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - @{ip} = Split String ${stdout} - [Return] @{ip} - + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[].interfaces[]."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + @{ip}= Split String ${stdout} + RETURN @{ip} Get Vdu Attribute [Documentation] Return an attribute from VDU records selected by count_index of a VNF instance. - [Arguments] ${vnf_id} ${attribute} ${count_index}=0 - Should Not Be Empty ${vnf_id} Should Not Be Empty ${attribute} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - [Return] ${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == ${count_index})' | yq -r '."${attribute}"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + RETURN ${stdout} diff --git a/robot-systest/lib/vnfd_lib.robot b/robot-systest/lib/vnfd_lib.resource similarity index 72% rename from robot-systest/lib/vnfd_lib.robot rename to robot-systest/lib/vnfd_lib.resource index 4433a48..2e4e2a6 100644 --- a/robot-systest/lib/vnfd_lib.robot +++ b/robot-systest/lib/vnfd_lib.resource @@ -1,6 +1,4 @@ -# -*- coding: utf-8 -*- - -## +*** Comments *** # Copyright 2019 Tech Mahindra Limited # # All Rights Reserved. @@ -16,30 +14,28 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -## -## Change log: -# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-sep-2019 -## *** Settings *** +Documentation Library providing keywords for CRUD operations over VNFD / VNF packages with OSM client. +Library OperatingSystem Library String *** Variables *** -${success_return_code} 0 -${failure_return_code} 1 -${delete_max_wait_time} 1min -${delete_pol_time} 15sec +${SUCCESS_RETURN_CODE} 0 +${FAILURE_RETURN_CODE} 1 +${VNFD_DELETE_MAX_WAIT_TIME} 1min +${VNFD_DELETE_POL_TIME} 15sec *** Keywords *** Get VNFDs List - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list + [Documentation] Get the list of VNF packages and log it. + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-list Log ${stdout} Log ${rc} - Should Be Equal As Integers ${rc} ${success_return_code} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Create VNFD [Documentation] Onboards ("creates") a NF Package into OSM. @@ -55,39 +51,32 @@ Create VNFD ... - Relevant environment variables: ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. - [Arguments] ${vnfd_pkg} ${overrides}=${EMPTY} - # If env variable "OVERRIDES" exists, it prevails over the value in the argument ${overrides}= Get Environment Variable OVERRIDES default=${overrides} - - # Proceedes with the onboarding with the appropriate arguments - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} + # Proceeds with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-create ${overrides} ${vnfd_pkg} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} ${lines}= Get Line Count ${stdout} ${last}= Evaluate ${lines} - 1 ${id}= Get Line ${stdout} ${last} - [Return] ${id} - + RETURN ${id} Update VNFD - [Documentation] Onboards ("Updates") a NF Package into OSM. + [Documentation] Onboard ("Update") a NF Package into OSM. ... - Parameters: ... - vnfd_pkg: Name (and location) of the NF Package ... - vnfd_name: Name of the existing NF Package - [Arguments] ${vnfd_pkg} ${vnfd_name} - - # Proceedes with the onboarding with the appropriate arguments - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name} + # Proceeds with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-update --content ${vnfd_pkg} ${vnfd_name} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} ${lines}= Get Line Count ${stdout} ${last}= Evaluate ${lines} - 1 ${id}= Get Line ${stdout} ${last} - [Return] ${id} - + RETURN ${id} Create VNFD Overriding Fields [Documentation] Onboards ("creates") a NF Package into OSM. @@ -104,46 +93,42 @@ Create VNFD Overriding Fields ... - Relevant environment variables: ... - OVERRIDES: If the environment variable "OVERRIDES" exists, it prevails over the value in the argument. ... This is often more convenient to enforce the same behaviour for every test run in a given VIM. - [Arguments] ${vnfd_pkg} ${override_fields} ${overrides}=${EMPTY} - # If env variable "OVERRIDES" exists, it prevails over the value in the argument ${overrides}= Get Environment Variable OVERRIDES default=${overrides} - - # Proceedes with the onboarding with the appropriate arguments - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}' + # Proceeds with the onboarding with the appropriate arguments + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-create ${overrides} ${vnfd_pkg} --override '${override_fields}' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} ${lines}= Get Line Count ${stdout} ${last}= Evaluate ${lines} - 1 ${id}= Get Line ${stdout} ${last} - [Return] ${id} - + RETURN ${id} Delete VNFD + [Documentation] Delete a VNF package from OSM. [Arguments] ${vnfd_id} - - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id} + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-delete ${vnfd_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Wait Until Keyword Succeeds ${VNFD_DELETE_MAX_WAIT_TIME} ${VNFD_DELETE_POL_TIME} Check For VNFD ${vnfd_id} Assert Failure Delete VNFD [Documentation] Deletes a NF Package that cannot be deleted and asserts the failure [Arguments] ${vnfd_id} - - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-delete ${vnfd_id} + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-delete ${vnfd_id} Log ${stdout} - Should Be Equal As Integers ${rc} ${failure_return_code} + Should Be Equal As Integers ${rc} ${FAILURE_RETURN_CODE} Should Contain ${stdout} 409 msg=Expected Conflict values=False - WAIT UNTIL KEYWORD SUCCEEDS ${delete_max_wait_time} ${delete_pol_time} Check For VNFD ${vnfd_id} True - + Wait Until Keyword Succeeds ${VNFD_DELETE_MAX_WAIT_TIME} ${VNFD_DELETE_POL_TIME} Check For VNFD ${vnfd_id} True Check For VNFD + [Documentation] Check that a VNF package exists in OSM. [Arguments] ${vnfd_id} ${exists}=False - - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id} - Run Keyword If ${exists} Should Be Equal As Strings ${stdout} ${vnfd_id} - ... ELSE Should Not Be Equal As Strings ${stdout} ${vnfd_id} - + ${rc} ${stdout}= Run And Return Rc And Output osm vnfpkg-list | awk '{print $2}' | grep ${vnfd_id} + Log ${rc},${stdout} + IF ${exists} + Should Be Equal As Strings ${stdout} ${vnfd_id} + ELSE + Should Not Be Equal As Strings ${stdout} ${vnfd_id} + END diff --git a/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py index ea31ace..0a2e1e2 100644 --- a/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py +++ b/robot-systest/resources/basic_01-crud_operations_on_vim_targets_data.py @@ -12,9 +12,18 @@ import os import yaml -from get_clouds_yaml_info import get_values_from_cloud, get_vim_values +from .get_clouds_yaml_info import get_values_from_cloud, get_vim_values +# Variables to be used by the testsuite +vim_account_type = "" +vim_name_prefix = "" +vim_user = "" +vim_password = "" +vim_auth_url = "" +vim_tenant = "" +vim_config = "" + # VIM configuration cloud_type = os.environ.get("CLOUD_TYPE", "openstack") if cloud_type == "openstack": diff --git a/robot-systest/resources/basic_08-disable_port_security_network_level_data.py b/robot-systest/resources/basic_08-disable_port_security_network_level_data.py index 7fd16ba..97d3112 100644 --- a/robot-systest/resources/basic_08-disable_port_security_network_level_data.py +++ b/robot-systest/resources/basic_08-disable_port_security_network_level_data.py @@ -13,12 +13,17 @@ import os from pathlib import Path import yaml -from get_clouds_yaml_info import get_values_from_cloud, get_vim_values +from .get_clouds_yaml_info import get_values_from_cloud, get_vim_values -# VIM Configuration +# Variables to be used by the testsuite vim_account_type = "openstack" vim_name = "basic_08_vim_test" +vim_user = "" +vim_password = "" +vim_auth_url = "" +vim_tenant = "" +vim_config = "" # Get credentials from Openstack clouds file cloud, os_cloud = get_values_from_cloud() diff --git a/robot-systest/resources/basic_32-volume_with_different_az.py b/robot-systest/resources/basic_32-volume_with_different_az.py index 2a78e11..ee2ba6a 100644 --- a/robot-systest/resources/basic_32-volume_with_different_az.py +++ b/robot-systest/resources/basic_32-volume_with_different_az.py @@ -12,7 +12,7 @@ import os import yaml -from get_clouds_yaml_info import get_values_from_cloud, get_vim_values +from .get_clouds_yaml_info import get_values_from_cloud, get_vim_values # VIM configuration diff --git a/robot-systest/run_test.sh b/robot-systest/run_test.sh index 1ebe21f..e96e17a 100755 --- a/robot-systest/run_test.sh +++ b/robot-systest/run_test.sh @@ -228,7 +228,7 @@ if [ "$RUN_CONFORMANCE_TESTS" = true ] ; then fi if [[ -n "${TEST}" ]]; then - robot -d ${ROBOT_DEVOPS_FOLDER}/reports --tagstatinclude "cluster-*" -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/ + robot -d ${ROBOT_DEVOPS_FOLDER}/reports --tagstatinclude "cluster_*" -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/ else echo "No test was provided. Exiting..." fi diff --git a/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot b/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot index cdfe0bd..542292a 100644 --- a/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot +++ b/robot-systest/testsuite/basic_01-crud_operations_on_vim_targets.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,16 +11,17 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-01] CRUD operations on VIM targets. ... All tests will be performed over an Openstack VIM, and the credentials will be loaded from clouds.yaml file. -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vim_lib.resource +Resource ../lib/prometheus_lib.resource -Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_01-crud_operations_on_vim_targets_data.py +Variables ../resources/basic_01-crud_operations_on_vim_targets_data.py -Force Tags basic_01 cluster_main daily regression +Test Tags basic_01 cluster_main daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation @@ -28,53 +30,46 @@ Suite Setup Run Keyword And Ignore Error Suite Preparation Create VIM Target Basic [Documentation] Create a VIM Target only with the mandatory parameters. ... Checks the status of the VIM in Prometheus after it creation. - - Pass Execution If '${vim_account_type}' != 'openstack' Not applicable for ${vim_account_type} VIM + Pass Execution If ${VIM_ACCOUNT_TYPE} != 'openstack' Not applicable for ${VIM_ACCOUNT_TYPE} VIM ${rand}= Generate Random String 6 [NUMBERS] - ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} - Set Suite Variable ${vim_name} - ${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} - + ${VIM_NAME}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} + Set Suite Variable ${VIM_NAME} + ${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} + Log ${stdout} Delete VIM Target By Name [Documentation] Delete the VIM Target created in previous test-case by its name. ... Checks whether the VIM Target was created or not before perform the deletion. [Tags] cleanup - - Pass Execution If '${vim_account_type}' != 'openstack' Not applicable for ${vim_account_type} VIM - ${vim_account_id}= Get VIM Target ID ${vim_name} - Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} - Delete VIM Target ${vim_name} - + Pass Execution If ${VIM_ACCOUNT_TYPE} != 'openstack' Not applicable for ${VIM_ACCOUNT_TYPE} VIM + ${vim_account_id}= Get VIM Target ID ${VIM_NAME} + Should Be Equal As Strings ${vim_account_id} ${CREATED_VIM_ACCOUNT_ID} + Delete VIM Target ${VIM_NAME} Create VIM Target With Extra Config [Documentation] Create a VIM Target using the extra parameter 'config'. ... Checks the status of the VIM in Prometheus after it creation. - ${rand}= Generate Random String 6 [NUMBERS] - ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} - Set Suite Variable ${vim_name} - ${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} - + ${VIM_NAME}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} + Set Suite Variable ${VIM_NAME} + ${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} Delete VIM Target By ID [Documentation] Delete the VIM Target created in previous test-case by its ID. ... Checks whether the VIM Target was created or not before perform the deletion. [Tags] cleanup - - ${vim_account_id}= Get VIM Target ID ${vim_name} - Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} + ${vim_account_id}= Get VIM Target ID ${VIM_NAME} + Should Be Equal As Strings ${vim_account_id} ${CREATED_VIM_ACCOUNT_ID} Delete VIM Target ${vim_account_id} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables diff --git a/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot b/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot index 82b3ba0..da8bfb7 100644 --- a/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot +++ b/robot-systest/testsuite/basic_05-instantiation_parameters_in_cloud_init.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,97 +11,85 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-05] Instantiation parameters in cloud-init. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_05 cluster_main daily regression azure +Test Tags basic_05 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} ubuntu_cloudinit_vnf -${vnfd_name} ubuntu_cloudinit-vnf -${nsd_pkg} ubuntu_cloudinit_ns -${nsd_name} ubuntu_cloudinit-ns +${VNFD_PKG} ubuntu_cloudinit_vnf +${VNFD_NAME} ubuntu_cloudinit-vnf +${NSD_PKG} ubuntu_cloudinit_ns +${NSD_NAME} ubuntu_cloudinit-ns # NS instance name and configuration -${ns_name} basic_05_instantiation_params_cloud_init -${vnf_member_index} vnf -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [ { member-vnf-index: "${vnf_member_index}", additionalParams: { password: "${new_password}" } } ] } +${NS_NAME} basic_05_instantiation_params_cloud_init +${VNF_MEMBER_INDEX} vnf +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [ { member-vnf-index: "${VNF_MEMBER_INDEX}", additionalParams: { password: "${NEW_PASSWORD}" } } ] } # SSH user and password -${username} ubuntu -${new_password} newpassword +${USERNAME} ubuntu +${NEW_PASSWORD} newpassword *** Test Cases *** Create Cloudinit VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Cloudinit NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Cloudinit Network Service Using Instantiation Parameters [Documentation] Instantiates the NS using the instantiation parameter 'additionalParamsForVnf' to change the password of the default user. - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} - Set Suite Variable ${ns_id} ${id} - + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Retrieve VNF mgmt IP address from OSM. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access With The New Password [Documentation] Test SSH access with the new password configured via cloud-init. - - Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF is not available + Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${new_password} ${EMPTY} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${NEW_PASSWORD} ${EMPTY} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_06-vnf_with_charm.robot b/robot-systest/testsuite/basic_06-vnf_with_charm.robot index 024fb1b..109046e 100644 --- a/robot-systest/testsuite/basic_06-vnf_with_charm.robot +++ b/robot-systest/testsuite/basic_06-vnf_with_charm.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,145 +11,131 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-06] VNF with Charm. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/juju_lib.resource -Force Tags basic_06 cluster_ee_config regression azure +Test Tags basic_06 cluster_ee_config regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/ha_proxy_charm_vnf -${vnfd_name} ha_proxy_charm-vnf -${nsd_pkg} charm-packages/ha_proxy_charm_ns -${nsd_name} ha_proxy_charm-ns +${VNFD_PKG} charm-packages/ha_proxy_charm_vnf +${VNFD_NAME} ha_proxy_charm-vnf +${NSD_PKG} charm-packages/ha_proxy_charm_ns +${NSD_NAME} ha_proxy_charm-ns # NS instance name and configuration -${ns_name} basic_06_charm_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_06_charm_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} - -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 -${ns_timeout} 15min +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} + +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 +${NS_TIMEOUT} 15min # VNF profile id, execution environment name to check VNF level charm naming -${vnf_profile_id} vnf1 -${ee_name} simple-ee +${VNF_PROFILE_ID} vnf1 +${EE_NAME} simple-ee *** Test Cases *** Create Charm VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - Set Suite Variable ${model_name} ${id} - + [Documentation] Instantiates the NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} + Set Suite Variable ${MODEL_NAME} ${id} Check VNF Charm Application Name - - ${vnf_charm_app_name}= Get Application Name VNF Level Charm %{OSM_HOSTNAME} ${username} ${password} %{OSM_RSA_FILE} ${model_name} ${vnf_profile_id} ${ee_name} + [Documentation] Checks that the charm application name meets the expected length + ${vnf_charm_app_name}= Get Application Name VNF Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} %{OSM_RSA_FILE} ${MODEL_NAME} ${VNF_PROFILE_ID} ${EE_NAME} ${length}= Get Length ${vnf_charm_app_name} Should Be True ${length} <50 - Get Management Ip Addresses - - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + [Documentation] Get the mgmt IP addresses of both VNF of the NS. + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} Test SSH Access - - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + [Documentation] Check that both VNF are accessible via SSH in their mgmt IP addresses. + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operations [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operations [Documentation] Performs one Day 2 operation per VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1} - ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_1} filename=${DAY_2_FILE_NAME_1} + Log ${ns_op_id_1} + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_2} filename=${DAY_2_FILE_NAME_2} + Log ${ns_op_id_2} Check Remote Files Created Via Day 2 Operations [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_1} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_2} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_07-secure_key_management.robot b/robot-systest/testsuite/basic_07-secure_key_management.robot index de65d38..506e2a3 100644 --- a/robot-systest/testsuite/basic_07-secure_key_management.robot +++ b/robot-systest/testsuite/basic_07-secure_key_management.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,126 +11,120 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-07] Secure key management. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_07 cluster_ee_config regression azure +Test Tags basic_07 cluster_ee_config regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/nopasswd_proxy_charm_vnf -${vnfd_name} nopasswd_proxy_charm-vnf -${nsd_pkg} charm-packages/nopasswd_proxy_charm_ns -${nsd_name} nopasswd_proxy_charm-ns +${VNFD_PKG} charm-packages/nopasswd_proxy_charm_vnf +${VNFD_NAME} nopasswd_proxy_charm-vnf +${NSD_PKG} charm-packages/nopasswd_proxy_charm_ns +${NSD_NAME} nopasswd_proxy_charm-ns # NS instance name and configuration -${ns_name} basic_07_secure_key_management -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} basic_07_secure_key_management +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH username and passwod -${username} ubuntu -${password} osm4u +${USERNAME} ubuntu +${PASSWORD} osm4u -${action_name} touch -${vnf_member_index} vnf1 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name} /home/ubuntu/mytouch1 +${ACTION_NAME} touch +${VNF_MEMBER_INDEX} vnf1 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME} /home/ubuntu/mytouch1 *** Test Cases *** Create Nopasswd Charm VNF Descriptor + [Documentation] Upload VNF package for the testsuite. [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Nopasswd Charm NS Descriptor + [Documentation] Upload NS package for the testsuite. [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Nopasswd Charm Network Service + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} ${ns_timeout} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} ${NS_TIMEOUT} + Log ${id} Get Ns Id + [Documentation] Get NS instance id. [Tags] verify - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses + [Documentation] Get the mgmt IP address of the VNF of the NS. [Tags] verify - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. [Tags] verify - Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF is not available + Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${EMPTY} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} Check Remote Files Created Via Day 1 Operations - [Tags] verify [Documentation] The Nopasswd VNF has a Day 1 operation that creates a file named ${day_1_file_name} and performs it without password. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${EMPTY} ${day_1_file_name} - + [Tags] verify + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_1_FILE_NAME} Execute Day 2 Operations - [Tags] verify [Documentation] Performs one Day 2 operation that creates a new file, this action is executed without password too. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index} filename=${day_2_file_name} - + [Tags] verify + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} filename=${DAY_2_FILE_NAME} + Log ${ns_op_id} Check Remote Files Created Via Day 2 Operations - [Tags] verify [Documentation] Check whether the file created in the previous test via Day 2 operation exists or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${EMPTY} ${day_2_file_name} - + [Tags] verify + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} ${DAY_2_FILE_NAME} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_08-disable_port_security_network_level.robot b/robot-systest/testsuite/basic_08-disable_port_security_network_level.robot index 11effd9..371ddde 100644 --- a/robot-systest/testsuite/basic_08-disable_port_security_network_level.robot +++ b/robot-systest/testsuite/basic_08-disable_port_security_network_level.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-08] Disable port security at network level. @@ -17,87 +19,81 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vim_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/prometheus_lib.resource -Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_08-disable_port_security_network_level_data.py +Variables ../resources/basic_08-disable_port_security_network_level_data.py -Force Tags basic_08 cluster_main daily regression +Test Tags basic_08 cluster_main daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${port_disabled_msg} port_security_enabled: false +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${PORT_DISABLED_MSG} port_security_enabled: false + *** Test Cases *** Create VIM With Port Security Disabled - + [Documentation] Register an Opentack VIM with port security disabled, so that all ports created from OSM have 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} - Check for VIM Target Status ${vim_name} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} + Log ${created_vim_account_id} + Check For VIM Target Status ${VIM_NAME} ${PROMETHEUS_HOST} ${PROMETHEUS_PORT} ${PROMETHEUS_USER} ${PROMETHEUS_PASSWORD} Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} ${vim_name} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} ${VIM_NAME} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Check Port Security Is Disabled - - ${rc} ${disabled_ports}= Run and Return RC and Output osm ns-show ${ns_name} --literal | grep -c '${port_disabled_msg}' - Run Keyword If ${disabled_ports} <= 0 Fail msg=Found '${disabled_ports}' matches for '${port_disabled_msg}' - + [Documentation] Check that there are ports/interfaces in the VDU of the VNF of the NS whose port security was disabled. + ${rc} ${disabled_ports}= Run And Return RC And Output osm ns-show ${NS_NAME} --literal | grep -c '${PORT_DISABLED_MSG}' + Log ${rc},${disabled_ports} + IF ${disabled_ports} <= 0 Fail msg=Found '${disabled_ports}' matches for '${PORT_DISABLED_MSG}' Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} - + Delete VNFD ${VNFD_NAME} Delete VIM + [Documentation] Delete VIM from OSM. [Tags] cleanup - - Delete VIM Target ${vim_name} + Delete VIM Target ${VIM_NAME} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables - Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - Run Keyword If Any Tests Failed Delete VIM Target ${vim_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Delete VIM Target ${VIM_NAME} diff --git a/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot b/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot index 06b5924..1f76c71 100644 --- a/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot +++ b/robot-systest/testsuite/basic_09-manual_vdu_scaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-09] Manual VNF/VDU Scaling. @@ -17,130 +19,124 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_09 cluster_main daily regression azure +Test Tags basic_09 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_metrics_vnf -${vnfd_name} hackfest_basic_metrics-vnf -${nsd_pkg} hackfest_basic_metrics_ns -${nsd_name} hackfest_basic-ns-metrics +${VNFD_PKG} hackfest_basic_metrics_vnf +${VNFD_NAME} hackfest_basic_metrics-vnf +${NSD_PKG} hackfest_basic_metrics_ns +${NSD_NAME} hackfest_basic-ns-metrics # NS instance name and configuration -${ns_name} basic_09_manual_scaling_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${scaling_group} vdu_autoscale -${vnf_member_index} vnf +${NS_NAME} basic_09_manual_scaling_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${SCALING_GROUP} vdu_autoscale +${VNF_MEMBER_INDEX} vnf # SSH public key file -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub *** Test Cases *** Create Scaling VNF Descriptor + [Documentation] Upload VNF package for the testsuite. [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Scaling NS Descriptor + [Documentation] Upload NS package for the testsuite. [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Scaling Network Service + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Log ${id} Get Ns Id + [Documentation] Retrieve NS instance id to be used later on. [Tags] verify - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id + [Documentation] Retrieve VNF instance id to be used later on. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Get Vdus Before Scale Out + [Documentation] Check the number of VDUs instances before the manual scaling. [Tags] verify - [Documentation] Get the number of VDU records before the manual scaling. - - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Set Suite Variable ${initial_vdur_count} ${vdurs} - + Set Suite Variable ${INITIAL_VDUR_COUNT} ${vdurs} Perform Manual Vdu Scale Out + [Documentation] Perform a manual scale-out operation of the VNF. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT + Log ${ns_op_id} Check Vdus After Scale Out + [Documentation] Check whether there is one more VDU after scaling out. [Tags] verify - [Documentation] Check whether there is one more VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out Perform Manual Vdu Scale In + [Documentation] Perform a manual scale-in operation of the VNF. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN + Log ${ns_op_id} Check Vdus After Scaling In + [Documentation] Check whether there is one less VDU after scaling in. [Tags] verify - [Documentation] Check whether there is one less VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} Fail msg=There is the same number of VDU records in the VNF after Scale In Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_11-native_charms.robot b/robot-systest/testsuite/basic_11-native_charms.robot index fe8d3be..0704323 100644 --- a/robot-systest/testsuite/basic_11-native_charms.robot +++ b/robot-systest/testsuite/basic_11-native_charms.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,117 +11,105 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-11] Native Charms Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_11 cluster_ee_config cluster_relations regression azure +Test Tags basic_11 cluster_ee_config cluster_relations regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/native_charm_vnf -${vnfd_name} native_charm-vnf -${nsd_pkg} charm-packages/native_charm_ns -${nsd_name} native_charm-ns +${VNFD_PKG} charm-packages/native_charm_vnf +${VNFD_NAME} native_charm-vnf +${NSD_PKG} charm-packages/native_charm_ns +${NSD_NAME} native_charm-ns # NS instance name and configuration -${ns_name} basic_11_native_charms -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} basic_11_native_charms +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 *** Test Cases *** Create Charm VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + [Documentation] Get the mgmt IP address of the two VNF of the NS. + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} Test SSH Access - - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + [Documentation] Check that both VNF are accessible via SSH in their respective mgmt IP address. + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operations [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_12-ns_primitives.robot b/robot-systest/testsuite/basic_12-ns_primitives.robot index c4b4a37..ee1cb31 100644 --- a/robot-systest/testsuite/basic_12-ns_primitives.robot +++ b/robot-systest/testsuite/basic_12-ns_primitives.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-12] NS Primitives @@ -20,131 +22,119 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/package_lib.resource +Resource ../lib/juju_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_12 cluster_ee_config regression azure +Test Tags basic_12 cluster_ee_config regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg1} nscharm_policy_vnf -${vnfd_pkg2} nscharm_user_vnf -${vnfd_name1} nscharm-policy-vnf -${vnfd_name2} nscharm-user-vnf -${nsd_pkg} nscharm_ns -${new_nsd_pkg} new_nscharm_ns -${nsd_name} nscharm-ns -${nsd_file} nscharm_nsd.yaml +${VNFD_PKG1} nscharm_policy_vnf +${VNFD_PKG2} nscharm_user_vnf +${VNFD_NAME1} nscharm-policy-vnf +${VNFD_NAME2} nscharm-user-vnf +${NSD_PKG} nscharm_ns +${NEW_NSD_PKG} new_nscharm_ns +${NSD_NAME} nscharm-ns +${NSD_FILE} nscharm_nsd.yaml # NS instance name and configuration -${ns_name} test_nscharm -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} test_nscharm +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min -${old_juju_password} a5611fc6452349cc6e45705d34c501d4 -${publickey} ${EMPTY} -${success_return_code} 0 +${OLD_JUJU_PASSWORD} a5611fc6452349cc6e45705d34c501d4 +${PUBLICKEY} ${EMPTY} +${SUCCESS_RETURN_CODE} 0 # VDU profile id, execution environment name to check vdu level charm naming structure -${vdu_profile_id} PolicyVM -${ee_name} vnf-policy +${VDU_PROFILE_ID} PolicyVM +${EE_NAME} vnf-policy # # Username and SSH private key for accessing OSM host -${privatekey} %{OSM_RSA_FILE} -${username} ubuntu -${password} ${EMPTY} +${PRIVATEKEY} %{OSM_RSA_FILE} +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} # Charm name to check ns level charm naming structure -${charm_name} ns +${CHARM_NAME} ns *** Test Cases *** Change Juju Password [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation - - ${rc} ${stdout}= Run and Return RC and Output cp -r '%{PACKAGES_FOLDER}/${nsd_pkg}' '%{PACKAGES_FOLDER}/${new_nsd_pkg}' - Should Be Equal As Integers ${rc} ${success_return_code} - ${nsd_yaml}= OperatingSystem.Get File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} - ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${old_juju_password} %{JUJU_PASSWORD} - Create File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} ${changed_nsd_yaml} - + ${rc} ${stdout}= Run And Return RC And Output cp -r '%{PACKAGES_FOLDER}/${NSD_PKG}' '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + ${nsd_yaml}= OperatingSystem.Get File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE} + ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${OLD_JUJU_PASSWORD} %{JUJU_PASSWORD} + Create File %{PACKAGES_FOLDER}/${NEW_NSD_PKG}/${NSD_FILE} ${changed_nsd_yaml} Upload Vnfds - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' - + [Documentation] Upload VNF packages for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' Upload Nsd - - Create NSD %{PACKAGES_FOLDER}/${new_nsd_pkg}/ - + [Documentation] Upload NS package for the testsuite. + Create NSD %{PACKAGES_FOLDER}/${NEW_NSD_PKG} Instantiate NS - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ns_launch_max_wait_time=${ns_timeout} - Set Suite Variable ${ns_id} ${id} - Set Suite Variable ${model_name} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ns_launch_max_wait_time=${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} + Set Suite Variable ${MODEL_NAME} ${id} Check NS Charm Application Name - - ${ns_charm_app_name}= Get Application Name NS Level Charm %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${model_name} ${charm_name} + [Documentation] Check that the NS charm has the right length. + ${ns_charm_app_name}= Get Application Name NS Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${CHARM_NAME} ${length}= Get Length ${ns_charm_app_name} Should Be True ${length} <50 - Check VDU Charm Application Name - - ${vdu_charm_app_name}= Get Application Name VDU Level Charm %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${model_name} ${vdu_profile_id} ${ee_name} + [Documentation] Check that the VDU charm has the right length. + ${vdu_charm_app_name}= Get Application Name VDU Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${MODEL_NAME} ${VDU_PROFILE_ID} ${EE_NAME} ${length}= Get Length ${vdu_charm_app_name} Should Be True ${length} <50 # TODO: Check Initial Config Primitives Status Delete NS + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' - + Delete NSD ${NSD_NAME} + Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' Delete VNF Descriptors + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name1} - Delete VNFD ${vnfd_name2} + Delete VNFD ${VNFD_NAME1} + Delete VNFD ${VNFD_NAME2} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor and instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name1} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name2} - Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2} + Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_NSD_PKG}' Delete Temporary Descriptor Folder [Documentation] Removes the temporary package folder created for the test [Arguments] ${folder_name} - - ${rc} ${stdout}= Run and Return RC and Output rm -rf '${folder_name}' - Log ${stdout} - - + ${rc} ${stdout}= Run And Return RC And Output rm -rf '${folder_name}' + Log ${rc},${stdout} diff --git a/robot-systest/testsuite/basic_13-ns_relations.robot b/robot-systest/testsuite/basic_13-ns_relations.robot index e339446..a405c64 100644 --- a/robot-systest/testsuite/basic_13-ns_relations.robot +++ b/robot-systest/testsuite/basic_13-ns_relations.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,106 +11,96 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-13] NS Relations Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_13 cluster_ee_config cluster_relations regression azure +Test Tags basic_13 cluster_ee_config cluster_relations regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg1} charm-packages/ns_relations_provides_vnf -${vnfd_pkg2} charm-packages/ns_relations_requires_vnf -${vnfd_name1} ns_relations_provides-vnf -${vnfd_name2} ns_relations_requires-vnf -${nsd_pkg} charm-packages/ns_relations_ns -${nsd_name} ns_relations-ns +${VNFD_PKG1} charm-packages/ns_relations_provides_vnf +${VNFD_PKG2} charm-packages/ns_relations_requires_vnf +${VNFD_NAME1} ns_relations_provides-vnf +${VNFD_NAME2} ns_relations_requires-vnf +${NSD_PKG} charm-packages/ns_relations_ns +${NSD_NAME} ns_relations-ns # NS instance name and configuration -${ns_name} basic_13_ns_relations_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} basic_13_ns_relations_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 *** Test Cases *** Create Charm VNF Descriptor Provides - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' - + [Documentation] Upload VNF package for the testsuite with a charm providing a relation. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' Create Charm VNF Descriptor Requires - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' - + [Documentation] Upload VNF package for the testsuite with a charm requiring a relation. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - - -# TODO Check juju status for relations - +# TODO: Check juju status for relations Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Provides + [Documentation] Delete first VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name1} - + Delete VNFD ${VNFD_NAME1} Delete VNF Descriptor Requires + [Documentation] Delete second VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name2} + Delete VNFD ${VNFD_NAME2} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2} diff --git a/robot-systest/testsuite/basic_14-vnf_relations.robot b/robot-systest/testsuite/basic_14-vnf_relations.robot index dbe232d..ed4b167 100644 --- a/robot-systest/testsuite/basic_14-vnf_relations.robot +++ b/robot-systest/testsuite/basic_14-vnf_relations.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,83 +11,74 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-14] VNF Relations Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_14 cluster_ee_config cluster_relations regression azure +Test Tags basic_14 cluster_ee_config cluster_relations regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/vnf_relations_vnf -${vnfd_name} vnf_relations-vnf -${nsd_pkg} charm-packages/vnf_relations_ns -${nsd_name} vnf_relations-ns +${VNFD_PKG} charm-packages/vnf_relations_vnf +${VNFD_NAME} vnf_relations-vnf +${NSD_PKG} charm-packages/vnf_relations_ns +${NSD_NAME} vnf_relations-ns # NS instance name and configuration -${ns_name} basic_14_vnf_relations_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} basic_14_vnf_relations_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH public keys file -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub *** Test Cases *** Create Charm VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - - -# TODO Check juju status for relations - +# TODO: Check juju status for relations Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup + Delete NSD ${NSD_NAME} - Delete NSD ${nsd_name} - - -Delete VNF Descriptor Provides +Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_15-rbac_configurations.robot b/robot-systest/testsuite/basic_15-rbac_configurations.robot index c57b11c..4d45c77 100644 --- a/robot-systest/testsuite/basic_15-rbac_configurations.robot +++ b/robot-systest/testsuite/basic_15-rbac_configurations.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-15] RBAC Configurations. @@ -17,78 +19,75 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/user_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/project_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/role_lib.robot +Resource ../lib/user_lib.resource +Resource ../lib/project_lib.resource +Resource ../lib/role_lib.resource -Force Tags basic_15 cluster_main daily regression azure +Test Tags basic_15 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # User, project and roles to use -${user_name} basic_15_test_user -${user_password} Basic_15_user_pass -${user_new_password} Basic_15_new_pass -${user_role} project_user -${user_project} admin -${project_name} basic_15_test_project -${new_project_name} basic_15_project_test -${role_name} test_role -${success_return_code} 0 +${USERNAME} basic_15_test_user +${USER_PASSWORD} Basic_15_user_pass +${USER_NEW_PASSWORD} Basic_15_new_pass +${USER_ROLE} project_user +${USER_PROJECT} admin +${PROJECT_NAME} basic_15_test_project +${NEW_PROJECT_NAME} basic_15_project_test +${ROLE_NAME} test_role +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create And Validate User - - Create User ${user_name} ${user_password} - Check If User Exists ${user_name} - + [Documentation] Create a user in OSM. + Create User ${USERNAME} ${USER_PASSWORD} + Check If User Exists ${USERNAME} Assign Role To User - - Update User Role ${user_name} ${user_project} ${user_role} - Check If User Is Assigned To Project ${user_name} ${user_project} - Check If User Has Role ${user_name} ${user_role} ${user_project} - + [Documentation] Assign a user to a project with a role + Update User Role ${USERNAME} ${USER_PROJECT} ${USER_ROLE} + Check If User Is Assigned To Project ${USERNAME} ${USER_PROJECT} + Check If User Has Role ${USERNAME} ${USER_ROLE} ${USER_PROJECT} Run Action As User - - Update User Password ${user_name} ${user_password} ${user_new_password} - ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${user_name} OSM_PROJECT=${user_project} OSM_PASSWORD=${user_new_password} osm ns-list - Should Be Equal As Integers ${rc} ${success_return_code} - + [Documentation] Update the password of the user. + Update User Password ${USERNAME} ${USER_PASSWORD} ${USER_NEW_PASSWORD} + ${rc} ${stdout}= Run And Return RC And Output OSM_USER=${USERNAME} OSM_PROJECT=${USER_PROJECT} OSM_PASSWORD=${USER_NEW_PASSWORD} osm ns-list + Log ${rc} + Log ${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Create And Update Project - - Create Project ${project_name} - Update Project Name ${project_name} ${new_project_name} - + [Documentation] Create a project and update its name. + Create Project ${PROJECT_NAME} + Update Project Name ${PROJECT_NAME} ${NEW_PROJECT_NAME} Create And Validate Role - - Create Role ${role_name} - Check If Role Exists ${role_name} - + [Documentation] Create a role and check that exists in OSM. + Create Role ${ROLE_NAME} + Check If Role Exists ${ROLE_NAME} Update Role Information - - Update Role ${role_name} add='vims: true' - Check If Role Exists ${role_name} - + [Documentation] Update a role with a capability. + Update Role ${ROLE_NAME} add='vims: true' + Check If Role Exists ${ROLE_NAME} Delete Allocated Resources + [Documentation] Delete user, project and role. [Tags] cleanup - - Delete User ${user_name} - Delete Project ${new_project_name} - Delete Role ${role_name} + Delete User ${USERNAME} + Delete Project ${NEW_PROJECT_NAME} + Delete Role ${ROLE_NAME} *** Keywords *** Suite Cleanup - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${user_name} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${role_name} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_name} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${new_project_name} + [Documentation] Test Suite Cleanup: Deleting users, roles and projects. + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete User ${USERNAME} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Role ${ROLE_NAME} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${PROJECT_NAME} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${NEW_PROJECT_NAME} diff --git a/robot-systest/testsuite/basic_16-advanced_onboarding_and_scaling.robot b/robot-systest/testsuite/basic_16-advanced_onboarding_and_scaling.robot index 0263552..7cd462e 100644 --- a/robot-systest/testsuite/basic_16-advanced_onboarding_and_scaling.robot +++ b/robot-systest/testsuite/basic_16-advanced_onboarding_and_scaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-16] Advanced onboarding with override and complex scaling (3 initial instances, scaled by two). @@ -17,129 +19,116 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_16 cluster_main daily regression azure +Test Tags basic_16 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_metrics_vnf -${vnfd_name} hackfest_basic_metrics-vnf -${nsd_pkg} hackfest_basic_metrics_ns -${nsd_name} hackfest_basic-ns-metrics +${VNFD_PKG} hackfest_basic_metrics_vnf +${VNFD_NAME} hackfest_basic_metrics-vnf +${NSD_PKG} hackfest_basic_metrics_ns +${NSD_NAME} hackfest_basic-ns-metrics # NS instance name and configuration -${ns_name} basic_16 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_16 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH public keys file -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub # Initial, delta, min and max number of VDU instances -${init_instances} 3 -${min_instances} 3 -${max_instances} 5 -${delta_instances} 2 -${scaling_group} vdu_autoscale -${vnf_member_index} vnf +${INIT_INSTANCES} 3 +${MIN_INSTANCES} 3 +${MAX_INSTANCES} 5 +${DELTA_INSTANCES} 2 +${SCALING_GROUP} vdu_autoscale +${VNF_MEMBER_INDEX} vnf *** Test Cases *** Create Scaling VNF Descriptor - - Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${vnfd_pkg}' df.0.instantiation-level.0.vdu-level.0.number-of-instances=${init_instances};df.0.vdu-profile.0.min-number-of-instances=${min_instances};df.0.vdu-profile.0.max-number-of-instances=${max_instances};df.0.scaling-aspect.0.aspect-delta-details.deltas.0.vdu-delta.0.number-of-instances=${delta_instances} - + [Documentation] Upload VNF package for the testsuite. + Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${VNFD_PKG}' df.0.instantiation-level.0.vdu-level.0.number-of-instances=${INIT_INSTANCES};df.0.vdu-profile.0.min-number-of-instances=${MIN_INSTANCES};df.0.vdu-profile.0.max-number-of-instances=${MAX_INSTANCES};df.0.scaling-aspect.0.aspect-delta-details.deltas.0.vdu-delta.0.number-of-instances=${DELTA_INSTANCES} Create Scaling NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Scaling Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Retrieve VNF instance id to be used later on. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Check Vdus Before Scale Out [Documentation] Check the number of VDUs instances before the manual scaling. - - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Set Suite Variable ${initial_vdur_count} ${vdurs} - Run Keyword If ${init_instances} != ${initial_vdur_count} Fail msg=Instantiated VDUs (${initial_vdur_count}) don't match specified number in descriptor (${init_instances}) - + Set Suite Variable ${INITIAL_VDUR_COUNT} ${vdurs} + IF ${INIT_INSTANCES} != ${INITIAL_VDUR_COUNT} Fail msg=Instantiated VDUs (${INITIAL_VDUR_COUNT}) don't match specified number in descriptor (${INIT_INSTANCES}) Perform Manual Vdu Scale Out - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT - + [Documentation] Perform a manual scale-out operation of the VNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT + Log ${ns_op_id} Check Vdus After Scale Out - [Documentation] Check whether there is one more VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + [Documentation] Check whether there is one extra VDU after scaling out. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} + ${delta_instances} Fail msg=VDU instances in the VNF (${vdurs}) don't match after Scale Out (${initial_vdur_count} + ${delta_instances}) - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} + ${DELTA_INSTANCES} Fail msg=VDU instances in the VNF (${vdurs}) don't match after Scale Out (${INITIAL_VDUR_COUNT} + ${DELTA_INSTANCES}) Perform Manual Vdu Scale In - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN - + [Documentation] Perform a manual scale-in operation of the VNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN + Log ${ns_op_id} Check Vdus After Scaling In - [Documentation] Check whether there is one less VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + [Documentation] Check whether there is one less VDU after scaling in. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} Fail msg=There is the same number of VDU records in the VNF after Scale In Delete NS Instance + [Documentation] Delete NS intance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_17-delete_vnf_package.robot b/robot-systest/testsuite/basic_17-delete_vnf_package.robot index b162bcd..253665c 100644 --- a/robot-systest/testsuite/basic_17-delete_vnf_package.robot +++ b/robot-systest/testsuite/basic_17-delete_vnf_package.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-17] Delete VNF Package Before NS Package. @@ -19,55 +21,48 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource -Force Tags basic_17 cluster_main daily regression azure +Test Tags basic_17 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_vnf -${vnfd_name} hackfest_basic-vnf -${nsd_pkg} hackfest_basic_ns -${nsd_name} hackfest_basic-ns +${VNFD_PKG} hackfest_basic_vnf +${VNFD_NAME} hackfest_basic-vnf +${NSD_PKG} hackfest_basic_ns +${NSD_NAME} hackfest_basic-ns *** Test Cases *** Create VNF Package - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Package - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Cannot Delete VNF Package - - Assert Failure Delete VNFD ${vnfd_name} - + [Documentation] Assert that the VNF package cannot be deleted without deleting the corresponding NS package using it. + Assert Failure Delete VNFD ${VNFD_NAME} Delete NS Package + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Package + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting NS and VNF packages - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_18-ns_ip_profile.robot b/robot-systest/testsuite/basic_18-ns_ip_profile.robot index 96d7a4d..41be581 100644 --- a/robot-systest/testsuite/basic_18-ns_ip_profile.robot +++ b/robot-systest/testsuite/basic_18-ns_ip_profile.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-18] NS with a VLD with a virtual link profile. @@ -18,187 +20,173 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_18 cluster_main daily regression +Test Tags basic_18 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} ubuntu_4ifaces_vnf -${vnfd_name} ubuntu_4ifaces-vnf -${nsd_pkg} ubuntu_4ifaces_ns -${nsd_name} ubuntu_4ifaces-ns +${VNFD_PKG} ubuntu_4ifaces_vnf +${VNFD_NAME} ubuntu_4ifaces-vnf +${NSD_PKG} ubuntu_4ifaces_ns +${NSD_NAME} ubuntu_4ifaces-ns # NS instance name and configuration -${ns_name} basic_18 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_18 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu # VNFs data -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${iface1_name} eth1 -${iface2_name} eth2 -${iface3_name} eth3 -${datanet1_prefix} ^192.168.10.* -${datanet2_prefix} ^192.168.20.* -${datanet3_prefix} ^192.168.30.* +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${IFACE1_NAME} eth1 +${IFACE2_NAME} eth2 +${IFACE3_NAME} eth3 +${DATANET1_PREFIX} ^192.168.10.* +${DATANET2_PREFIX} ^192.168.20.* +${DATANET3_PREFIX} ^192.168.30.* -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnfs Info - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get information from the two VNF of the Ns, specifically the VNF instance id and the mgmt IP address. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id1} ${vnfr_list}[0] - Set Suite Variable ${vnf_id2} ${vnfr_list}[1] - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${vnf1_ipmgmt} ${ip} - Log ${vnf1_ipmgmt} - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} - Set Suite Variable ${vnf2_ipmgmt} ${ip} - Log ${vnf2_ipmgmt} - + Set Suite Variable ${VNF_ID1} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID2} ${vnfr_list}[1] + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${VNF1_IPMGMT} ${ip} + Log ${VNF1_IPMGMT} + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} + Set Suite Variable ${VNF2_IPMGMT} ${ip} + Log ${VNF2_IPMGMT} Check Vnf1 IPs - - Variable Should Exist ${vnf_id1} msg=VNF1 is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} - Set Suite Variable ${vnf1_ip1} ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix} - Set Suite Variable ${vnf1_ip2} ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix} - Set Suite Variable ${vnf1_ip3} ${stdout} - - + [Documentation] Check whether IP addresses of the first VNF in the VNF record meet the expected CIDR. + Variable Should Exist ${VNF_ID1} msg=VNF1 is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} + Set Suite Variable ${VNF1_IP1} ${stdout} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX} + Set Suite Variable ${VNF1_IP2} ${stdout} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX} + Set Suite Variable ${VNF1_IP3} ${stdout} Check Vnf2 IPs - - Variable Should Exist ${vnf_id1} msg=VNF2 is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} - Set Suite Variable ${vnf2_ip1} ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface2_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix} - Set Suite Variable ${vnf2_ip2} ${stdout} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface3_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix} - Set Suite Variable ${vnf2_ip3} ${stdout} - + [Documentation] Check whether IP addresses of the second VNF in the VNF record meet the expected CIDR. + Variable Should Exist ${VNF_ID1} msg=VNF2 is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} + Set Suite Variable ${VNF2_IP1} ${stdout} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX} + Set Suite Variable ${VNF2_IP2} ${stdout} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX} + Set Suite Variable ${VNF2_IP3} ${stdout} Verify Vnf1 Interfaces - - Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available + [Documentation] Check whether IP addresses of the first VNF configured inside the VM meet the expected CIDR. + Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available Sleep 10 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' Log ${stdout} - @{ip} = Split String ${stdout} - Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} - Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix} - Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix} - + @{ip}= Split String ${stdout} + Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} + Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX} + Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX} Verify Vnf2 Interfaces - - Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + [Documentation] Check whether IP addresses of the second VNF configured inside the VM meet the expected CIDR. + Variable Should Exist ${VNF2_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' Log ${stdout} - @{ip} = Split String ${stdout} - Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} - Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix} - Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix} - + @{ip}= Split String ${stdout} + Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} + Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX} + Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX} Ping from Vnf1 to Vnf2 - - Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf2_ipmgmt} + [Documentation] Check connectivity from the first VNF to the second VNF using ping. + Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF2_IPMGMT} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip1} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP1} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip2} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP2} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} ping -c 5 ${vnf2_ip3} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP3} Log ${stdout} - Ping from Vnf2 to Vnf1 - - Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ipmgmt} + [Documentation] Check connectivity from the second VNF to the first VNF using ping. + Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IPMGMT} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip1} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP1} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip2} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP2} Log ${stdout} - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} ip addr ; ping -c 5 ${vnf1_ip3} + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP3} Log ${stdout} - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_19-vnf_ip_profile.robot b/robot-systest/testsuite/basic_19-vnf_ip_profile.robot index 6701096..6d5a557 100644 --- a/robot-systest/testsuite/basic_19-vnf_ip_profile.robot +++ b/robot-systest/testsuite/basic_19-vnf_ip_profile.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-19] NS with a single VNF and two VDU linked by a VLD with ip-profile. @@ -18,99 +20,91 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_19 cluster_main daily regression +Test Tags basic_19 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} ipprofile_2vm_vnf -${vnfd_name} ipprofile_2vm-vnf -${nsd_pkg} ipprofile_2vm_ns -${nsd_name} ipprofile_2vm-ns +${VNFD_PKG} ipprofile_2vm_vnf +${VNFD_NAME} ipprofile_2vm-vnf +${NSD_PKG} ipprofile_2vm_ns +${NSD_NAME} ipprofile_2vm-ns # NS instance name and configuration -${ns_name} basic_19 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_19 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${username} ubuntu +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${USERNAME} ubuntu # VNFs data -${vnf_member_index_1} vnf -${internal_prefix} ^192.168.200.* +${VNF_MEMBER_INDEX_1} vnf +${INTERNAL_PREFIX} ^192.168.200.* -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Info - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get VNF information, specifically the VNF instance id and the mgmt IP address. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${vnf_ipmgmt} ${ip} - Log ${vnf_ipmgmt} - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${VNF_IPMGMT} ${ip} + Log ${VNF_IPMGMT} Check Vnf IPs - - Variable Should Exist ${vnf_id} msg=VNF is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} - + [Documentation] Check whether IP addresses are syntactically valid. + Variable Should Exist ${VNF_ID} msg=VNF is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_20-manual_native_charm_vdu_scaling.robot b/robot-systest/testsuite/basic_20-manual_native_charm_vdu_scaling.robot index 48b8624..a901d1e 100644 --- a/robot-systest/testsuite/basic_20-manual_native_charm_vdu_scaling.robot +++ b/robot-systest/testsuite/basic_20-manual_native_charm_vdu_scaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-20] Manual VDU Scaling to test juju applications are scaling for native charms (testing Bug-1609). @@ -17,171 +19,146 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_20 cluster_main daily regression azure +Test Tags basic_20 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/native_manual_scale_charm_vnf -${vnfd_name} native_manual_scale_charm-vnf -${nsd_pkg} charm-packages/native_manual_scale_charm_ns -${nsd_name} native_manual_scale_charm-ns +${VNFD_PKG} charm-packages/native_manual_scale_charm_vnf +${VNFD_NAME} native_manual_scale_charm-vnf +${NSD_PKG} charm-packages/native_manual_scale_charm_ns +${NSD_NAME} native_manual_scale_charm-ns # NS instance name and configuration -${ns_name} basic_20_manual_vdu_scaling_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${vnf_member_index} vnf +${NS_NAME} basic_20_manual_vdu_scaling_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${VNF_MEMBER_INDEX} vnf # SSH public key file -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub # Scaling group name of VDU instances -${scaling_group} manual-scaling_mgmtVM +${SCALING_GROUP} manual-scaling_mgmtVM + +${SCALE_WAIT_TIME} 4min -${scale_wait_time} 4min *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Retrieve VNF instance id to be used later on + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Get Vdus Before Scale Out [Documentation] Get the number of VDU records before the manual scaling. - - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Set Suite Variable ${initial_vdur_count} ${vdurs} - + Set Suite Variable ${INITIAL_VDUR_COUNT} ${vdurs} Get Application Name Before Scale Out [Documentation] Get the application names. - - @{name_list}= Get Application Names ${ns_name} + @{name_list}= Get Application Names ${NS_NAME} Log List ${name_list} - Set Suite Variable ${application_list} ${name_list} - + Set Suite Variable ${APPLICATION_LIST} ${name_list} Check Number of Duplicated Application Name Before Scale Out [Documentation] Check the application names if there are 2 application name in the application list. - - ${count_duplicated}= Get Length ${application_list} - Run Keyword If ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list before Scale Out - + ${count_duplicated}= Get Length ${APPLICATION_LIST} + IF ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list before Scale Out Perform Manual Vdu Scale Out - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT ${scale_wait_time} - + [Documentation] Perform a manual scale-out operation of the VNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT ${SCALE_WAIT_TIME} + Log ${ns_op_id} Check Vdus After Scale Out - [Documentation] Check whether there is one more VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + [Documentation] Check whether there is one more VDU after scaling out. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out Get Application Name After Scale Out [Documentation] Get the application names. - - @{name_list}= Get Application Names ${ns_name} + @{name_list}= Get Application Names ${NS_NAME} Log List ${name_list} - Set Suite Variable ${application_list} ${name_list} - + Set Suite Variable ${APPLICATION_LIST} ${name_list} Check Number of Duplicated Application Name After Scale Out [Documentation] Check the application names if there are 3 application name in the application list. - - ${count_duplicated}= Get Length ${application_list} - Run Keyword If ${count_duplicated} != 3 Fail msg=There are not 2 application name in the application list after Scale Out - + ${count_duplicated}= Get Length ${APPLICATION_LIST} + IF ${count_duplicated} != 3 Fail msg=There are not 2 application name in the application list after Scale Out Perform Manual Vdu Scale In - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN - + [Documentation] Perform a manual scale-in operation of the VNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN + Log ${ns_op_id} Check Vdus After Scaling In - [Documentation] Check whether there is one less VDU after scaling or not. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + [Documentation] Check whether there is one less VDU after scaling in. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} Fail msg=There is the same number of VDU records in the VNF after Scale In - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} Fail msg=There is the same number of VDU records in the VNF after Scale In Get Application Name After Scale In [Documentation] Get the application names. - - @{name_list}= Get Application Names ${ns_name} + @{name_list}= Get Application Names ${NS_NAME} Log List ${name_list} - Set Suite Variable ${application_list} ${name_list} - + Set Suite Variable ${APPLICATION_LIST} ${name_list} Check Number of Duplicated Application Name After Scale In [Documentation] Check the application names if there are 2 application name in the application list. - - ${count_duplicated}= Get Length ${application_list} - Run Keyword If ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list after Scale In - + ${count_duplicated}= Get Length ${APPLICATION_LIST} + IF ${count_duplicated} != 2 Fail msg=There are not 2 application name in the application list after Scale In Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_21-support_of_volumes.robot b/robot-systest/testsuite/basic_21-support_of_volumes.robot index 4dbea4a..c8918a6 100644 --- a/robot-systest/testsuite/basic_21-support_of_volumes.robot +++ b/robot-systest/testsuite/basic_21-support_of_volumes.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-21] NS with only one VDU and several volumes @@ -19,140 +21,138 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags basic_21 cluster_main daily regression +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags basic_21 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} several_volumes_vnf -${vnfd_name} several_volumes-vnf -${nsd_pkg} several_volumes_ns -${nsd_name} several_volumes-ns +${VNFD_PKG} several_volumes_vnf +${VNFD_NAME} several_volumes-vnf +${NSD_PKG} several_volumes_ns +${NSD_NAME} several_volumes-ns # NS instance name and configuration -${ns_name} basic_21 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_21 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${vnf_member_index} vnf-several-volumes -${success_return_code} 0 +${VNF_MEMBER_INDEX} vnf-several-volumes +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor + [Documentation] Upload VNF package for the testsuite. [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor + [Documentation] Upload NS package for the testsuite. [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get NS Id + [Documentation] Get NS identifier and stores as suite variable to be used later on. [Tags] verify cleanup - ${variables} Get Variables - IF not "\${ns_id}" in "${variables}" - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${variables}= Get Variables + IF not "\${ns_id}" in ${variables} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} END Get Volumes From VNFD + [Documentation] Get from VNF descriptor the expected number of volumes in the VNF. [Tags] verify - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_name} --literal | yq '.vdu[0]."virtual-storage-desc" | length' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + ${rc} ${stdout}= Run And Return RC And Output osm vnfpkg-show ${VNFD_NAME} --literal | yq '.vdu[0]."virtual-storage-desc" | length' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False ${num_virtual_storage}= Convert To Integer ${stdout} - Set Suite Variable ${vnf_num_volumes} ${num_virtual_storage} - Log ${vnf_num_volumes} - + Set Suite Variable ${VNF_NUM_VOLUMES} ${num_virtual_storage} + Log ${VNF_NUM_VOLUMES} Get VNF IP Address + [Documentation] Get the mgmt IP address of the VNF. [Tags] verify - Variable Should Exist ${ns_id} msg=NS is not available - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + Variable Should Exist ${NS_ID} msg=NS is not available + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - - -#Get Persistent Volume Id -# [Tags] cleanup -# Variable Should Exist ${ns_id} msg=NS is not available -# ${vnfs_list}= Get Ns Vnf List ${ns_id} -# ${vim_id}= Get VNF VIM ID ${vnfs_list}[0] -# ${volumes_attached}= Get Server Property ${vim_id} volumes_attached -# ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 -# Set Suite Variable ${volume_id} ${match}[0] - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} + +# Get Persistent Volume Id +# [Documentation] Get VIM volume identifier of the persistent volume of the VNF. +# [Tags] cleanup +# Variable Should Exist ${ns_id} msg=NS is not available +# ${vnfs_list}= Get Ns Vnf List ${ns_id} +# ${vim_id}= Get VNF VIM ID ${vnfs_list}[0] +# ${volumes_attached}= Get Server Property ${vim_id} volumes_attached +# ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 +# Set Suite Variable ${PERSISTENT_VOLUME_ID} ${match}[0] Check VDU disks + [Documentation] Check that the number of volumes is the expected one. [Tags] verify - Variable Should Exist ${vnf_ip_addr} msg=VNF is not available + Variable Should Exist ${VNF_IP_ADDR} msg=VNF is not available Sleep 30 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf_ip_addr} ${username} ${password} ${privatekey} sudo lsblk -l + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} sudo lsblk -l Log ${stdout} ${lines}= Get Lines Containing String ${stdout} disk ${num_lines}= Get Line Count ${lines} - Run Keyword If ${num_lines} < ${vnf_num_volumes} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${vnf_num_volumes}) - + IF ${num_lines} < ${VNF_NUM_VOLUMES} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${VNF_NUM_VOLUMES}) Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - - -#Check Persistent Volume Was Deleted -# [Tags] cleanup -# Variable Should Exist ${volume_id} msg=Volume is not available -# ${exists}= Check If Volume Exists ${volume_id} -# Log ${exists} -# IF ${exists}==0 -# Fail msg=Persistent volume was deleted -# Set Suite Variable ${volume_id} ${EMPTY}} -# ELSE -# Log Persistent volume still exists, deleting... -# Delete Volume ${volume_id} -# Set Suite Variable ${volume_id} ${EMPTY}} -# END - + Delete NS ${NS_NAME} + +# Check Persistent Volume Was Deleted +# [Documentation] Check that the persistent volume was deleted. +# [Tags] cleanup +# Variable Should Exist ${PERSISTENT_VOLUME_ID} msg=Volume is not available +# ${exists}= Check If Volume Exists ${PERSISTENT_VOLUME_ID} +# Log ${exists} +# IF ${exists}==0 +# Fail msg=Persistent volume was deleted +# Set Suite Variable ${PERSISTENT_VOLUME_ID} ${EMPTY}} +# ELSE +# Log Persistent volume still exists, deleting... +# Delete Volume ${PERSISTENT_VOLUME_ID} +# Set Suite Variable ${PERSISTENT_VOLUME_ID} ${EMPTY}} +# END Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} # Run Keyword If Any Tests Failed Check Volume Was Deleted diff --git a/robot-systest/testsuite/basic_22-cross_model_relations.robot b/robot-systest/testsuite/basic_22-cross_model_relations.robot index cd38e7d..c19f16d 100644 --- a/robot-systest/testsuite/basic_22-cross_model_relations.robot +++ b/robot-systest/testsuite/basic_22-cross_model_relations.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,108 +11,103 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-22] Cross-model relations Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags basic_22 cluster_ee_config cluster_relations regression +Test Tags basic_22 cluster_ee_config cluster_relations regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # K8s cluster name and version -${k8scluster_name} k8sbasic_22 -${k8scluster_version} v1 +${K8SCLUSTER_NAME} k8sbasic_22 +${K8SCLUSTER_VERSION} v1 # NS and VNF descriptor package folder and ids -${vnfd_pkg_1} charm-packages/cmr_relation_vnf -${vnfd_pkg_2} charm-packages/cmr_no_relation_vnf -${nsd_pkg} charm-packages/cmr_relation_ns -${vnfd_name_1} cross_model_relation-vnf -${vnfd_name_2} cross_model_no_relation-vnf -${nsd_name} cross_model_relation-ns +${VNFD_PKG1} charm-packages/cmr_relation_vnf +${VNFD_PKG2} charm-packages/cmr_no_relation_vnf +${NSD_PKG} charm-packages/cmr_relation_ns +${VNFD_NAME1} cross_model_relation-vnf +${VNFD_NAME2} cross_model_no_relation-vnf +${NSD_NAME} cross_model_relation-ns # NS instance name and configuration -${ns_name} basic_22 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} basic_22 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} *** Test Cases *** Create Charm VNF Descriptor 1 - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg_1}' + [Documentation] Upload first VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' Create Charm VNF Descriptor 2 - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg_2}' + [Documentation] Upload second VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Add K8s Cluster To OSM - Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name} + [Documentation] Register K8s cluster in OSM. + Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} %{VIM_TARGET} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME} Instantiate Charm Network Service + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - - -# TODO Check juju status for relations - +# TODO: Check juju status for relations Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} + Delete NS ${NS_NAME} Remove K8s Cluster from OSM + [Documentation] Unregister K8s cluster from OSM. [Tags] cleanup - Delete K8s Cluster ${k8scluster_name} + Delete K8s Cluster ${K8SCLUSTER_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor 1 + [Documentation] Delete first VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name_1} + Delete VNFD ${VNFD_NAME1} Delete VNF Descriptor 2 + [Documentation] Delete second VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name_2} + Delete VNFD ${VNFD_NAME2} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD 1 ${vnfd_name_1} - - Run Keyword If Any Tests Failed Delete VNFD 2 ${vnfd_name_2} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD 1 ${VNFD_NAME1} + Run Keyword If Any Tests Failed Delete VNFD 2 ${VNFD_NAME2} diff --git a/robot-systest/testsuite/basic_23-sol004_sol007_packages.robot b/robot-systest/testsuite/basic_23-sol004_sol007_packages.robot index cb7ad65..a45159a 100644 --- a/robot-systest/testsuite/basic_23-sol004_sol007_packages.robot +++ b/robot-systest/testsuite/basic_23-sol004_sol007_packages.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-23] Creation and deletion of SOL004 and SOL007 packages. @@ -19,55 +21,48 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource -Force Tags basic_23 cluster_main daily regression azure +Test Tags basic_23 cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} sol004_hackfest_basic_vnf -${vnfd_name} sol004_hackfest_basic-vnf -${nsd_pkg} sol007_hackfest_basic_ns -${nsd_name} sol007_hackfest_basic-ns +${VNFD_PKG} sol004_hackfest_basic_vnf +${VNFD_NAME} sol004_hackfest_basic-vnf +${NSD_PKG} sol007_hackfest_basic_ns +${NSD_NAME} sol007_hackfest_basic-ns *** Test Cases *** Create VNF Package - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Package - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Cannot Delete VNF Package - - Assert Failure Delete VNFD ${vnfd_name} - + [Documentation] Assert that the VNF package cannot be deleted before the NS package is deleted. + Assert Failure Delete VNFD ${VNFD_NAME} Delete NS Package + [Documentation] Delete NS package. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Package + [Documentation] Delete VNF package. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting NS and VNF packages - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_24-affinity_groups.robot b/robot-systest/testsuite/basic_24-affinity_groups.robot index b3b51eb..46860fb 100644 --- a/robot-systest/testsuite/basic_24-affinity_groups.robot +++ b/robot-systest/testsuite/basic_24-affinity_groups.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-24] VNF with two VDUs belonging to an Openstack server group @@ -18,93 +20,83 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags basic_24 cluster_main daily regression +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags basic_24 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} affinity_basic_vnf -${vnfd_name} affinity_basic-vnf -${nsd_pkg} affinity_basic_ns -${nsd_name} affinity_basic-ns +${VNFD_PKG} affinity_basic_vnf +${VNFD_NAME} affinity_basic-vnf +${NSD_PKG} affinity_basic_ns +${NSD_NAME} affinity_basic-ns # NS instance name and configuration -${ns_name} basic_24 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_24 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} + +${NS_ID} ${EMPTY} +${VNF_MEMBER_INDEX} affinity-basic-1 +${SUCCESS_RETURN_CODE} 0 -${ns_id} ${EMPTY} -${vnf_member_index} affinity-basic-1 -${success_return_code} 0 *** Test Cases *** Create VNF Package - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Package - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Check Vnf Affinity Groups - - Variable Should Exist ${ns_id} msg=NS is not available - ${vnf_id} Get Vnf Id ${ns_id} ${vnf_member_index} - @{vdur_id_list} Get VDU list from VNF ${vnf_id} + [Documentation] Check that all VDUs of the VNF belong to the expected affinity group. + Variable Should Exist ${NS_ID} msg=NS is not available + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX} + @{vdur_id_list}= Get VDU List From VNF ${vnf_id} FOR ${vdur_id} IN @{vdur_id_list} - ${server_group_name} Get VDU Affinity Group Name ${ns_name} ${vnf_id} ${vdur_id} - ${vm_vim_id} Get VDU VIM Id ${vnf_id} ${vdur_id} + ${server_group_name}= Get VDU Affinity Group Name ${NS_NAME} ${vnf_id} ${vdur_id} + ${vm_vim_id}= Get VDU VIM Id ${vnf_id} ${vdur_id} Check VM In Server Group ${vm_vim_id} ${server_group_name} END - Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_25-update_charm_in_running_vnf_instance.robot b/robot-systest/testsuite/basic_25-update_charm_in_running_vnf_instance.robot index a0b368c..9ae13be 100644 --- a/robot-systest/testsuite/basic_25-update_charm_in_running_vnf_instance.robot +++ b/robot-systest/testsuite/basic_25-update_charm_in_running_vnf_instance.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,167 +11,145 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-25] Update Charms in Running VNF Instance. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_25 cluster_ee_config regression +Test Tags basic_25 cluster_ee_config regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/ha_proxy_charm_vnf -${updated_vnfd_pkg} charm-packages/updated_vnfds/ha_proxy_charm_vnf -${vnfd_name} ha_proxy_charm-vnf -${nsd_pkg} charm-packages/ha_proxy_charm_ns -${nsd_name} ha_proxy_charm-ns +${VNFD_PKG} charm-packages/ha_proxy_charm_vnf +${UPDATED_VNFD_PKG} charm-packages/updated_vnfds/ha_proxy_charm_vnf +${VNFD_NAME} ha_proxy_charm-vnf +${NSD_PKG} charm-packages/ha_proxy_charm_ns +${NSD_NAME} ha_proxy_charm-ns # NS instance name and configuration -${ns_name} basic_25_charm_update_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_25_charm_update_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} - -${action_name} touch -${new_action_name} mkdir -${vnf_member_index} vnf1 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name} /home/ubuntu/mytouch1 -${day_2_folder_name} /home/ubuntu/myfolder1 -${ns_timeout} 15min +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} + +${ACTION_NAME} touch +${NEW_ACTION_NAME} mkdir +${VNF_MEMBER_INDEX} vnf1 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME} /home/ubuntu/mytouch1 +${DAY_2_FOLDER_NAME} /home/ubuntu/myfolder1 +${NS_TIMEOUT} 15min # NS update operation configuration -${update_type} CHANGE_VNFPKG -${ns_update_timeout} 500 +${UPDATE_TYPE} CHANGE_VNFPKG +${NS_UPDATE_TIMEOUT} 500 *** Test Cases *** Create Charm VNF Descriptor - - ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Set Suite Variable ${vnfd_id} ${id} - + [Documentation] Upload VNF package for the testsuite. + ${id}= Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Set Suite Variable ${VNFD_ID} ${id} Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiates the NS for the test suite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Set NS Update Config - - Variable Should Exist ${ns_id} msg=NS is not available - ${id} Get Vnf Id ${ns_id} ${vnf_member_index} + [Documentation] Prepare data for NS Update + Variable Should Exist ${NS_ID} msg=NS is not available + ${id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX} Log ${id} - Set Suite Variable ${vnf_id} ${id} - Set Suite Variable ${ns_update_config} '{changeVnfPackageData: [{vnfInstanceId: "${vnf_id}", vnfdId: "${vnfd_id}"}]}' - + Set Suite Variable ${VNF_ID} ${id} + Set Suite Variable ${NS_UPDATE_CONFIG} '{changeVnfPackageData: [{vnfInstanceId: "${VNF_ID}", vnfdId: "${VNFD_ID}"}]}' Get Management Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access - - Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF '${vnf_member_index}' is not available + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. + Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operation [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operation [Documentation] Performs one Day 2 operation on the VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index} filename=${day_2_file_name} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} filename=${DAY_2_FILE_NAME} + Log ${ns_op_id_1} Check Remote File Created Via Day 2 Operation [Documentation] Check whether the file created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name} - + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME} Update VNFD Package [Documentation] Updates the VNFD by using new VNFD package which includes the Charm ... which has new day2 operation. - - Update VNFD '%{PACKAGES_FOLDER}/${updated_vnfd_pkg}' ${vnfd_name} - + Update VNFD '%{PACKAGES_FOLDER}/${UPDATED_VNFD_PKG}' ${VNFD_NAME} Update Running VNF Instance [Documentation] Updates the running VNF instance by using new VNFD package. ... As the VNFD has an updated charm, this operation will trigger the upgrade of existing charm ... for the specific VNF. - - Update Network Service ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout} - + Update Network Service ${NS_ID} ${UPDATE_TYPE} ${NS_UPDATE_CONFIG} ${NS_UPDATE_TIMEOUT} Execute Day 2 Operation on Upgraded Charm [Documentation] Performs one Day 2 operation on the updated VNF that creates a new folder. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_2}= Execute NS Action ${ns_name} ${new_action_name} ${vnf_member_index} foldername=${day_2_folder_name} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${NEW_ACTION_NAME} ${VNF_MEMBER_INDEX} foldername=${DAY_2_FOLDER_NAME} + Log ${ns_op_id_2} Check Remote Folder Created Via Day 2 Operation [Documentation] Check whether the folder created in the previous test via Day 2 operations exist or not. - - Check If remote Folder Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_2_folder_name} - + Check If Remote Folder Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FOLDER_NAME} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_26-secure_helm_execution_environment.robot b/robot-systest/testsuite/basic_26-secure_helm_execution_environment.robot index 10b3f24..1a6f94f 100644 --- a/robot-systest/testsuite/basic_26-secure_helm_execution_environment.robot +++ b/robot-systest/testsuite/basic_26-secure_helm_execution_environment.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,133 +11,119 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-26] Secure connection to helm execution environments. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_26 cluster_ee_config regression +Test Tags basic_26 cluster_ee_config regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} simple_ee_vnf -${vnfd_name} simple_ee-vnf -${nsd_pkg} simple_ee_ns -${nsd_name} simple_ee-ns +${VNFD_PKG} simple_ee_vnf +${VNFD_NAME} simple_ee-vnf +${NSD_PKG} simple_ee_ns +${NSD_NAME} simple_ee-ns # NS instance name and configuration -${ns_name} basic_26_secure_helm_ee_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 5min +${NS_NAME} basic_26_secure_helm_ee_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 5min # SSH keys and username to be used to connect to the VNF -${username} ubuntu -${password} ${EMPTY} -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa # SSH keys and username to be used to connect to OSM VM -${osm_host} %{OSM_HOSTNAME} -${osm_username} ubuntu -${osm_password} ${EMPTY} -${osm_privatekey} %{OSM_RSA_FILE} +${OSM_HOST} %{OSM_HOSTNAME} +${OSM_USERNAME} ubuntu +${OSM_PASSWORD} ${EMPTY} +${OSM_PRIVATEKEY} %{OSM_RSA_FILE} # Variables related to day1 and day2 -${action_name} touch -${new_action_name} mkdir -${vnf_member_index} simple -${day_1_file_name} /home/ubuntu/first-touch +${ACTION_NAME} touch +${NEW_ACTION_NAME} mkdir +${VNF_MEMBER_INDEX} simple +${DAY_1_FILE_NAME} /home/ubuntu/first-touch *** Test Cases *** Create VNF Descriptor - - ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Set Suite Variable ${vnfd_id} ${id} - + [Documentation] Upload VNF package for the testsuite. + ${id}= Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Set Suite Variable ${VNFD_ID} ${id} Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF of the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access - - Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF '${vnf_member_index}' is not available + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. + Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote File Created Via Day 1 Operation [Documentation] Check whether the file created in the previous test via Day 1 operations exist or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Get data from EE pod - - Open Connection ${osm_host} - Login With Public Key ${osm_username} keyfile=${osm_privatekey} - ${pod}= Execute Remote Command Check Rc Return Output ${osm_host} ${osm_username} ${osm_password} ${osm_privatekey} kubectl get pod -n ${ns_id} --no-headers -o custom-columns=":metadata.name" - ${svc}= Execute Remote Command Check Rc Return Output ${osm_host} ${osm_username} ${osm_password} ${osm_privatekey} kubectl get svc -n ${ns_id} -l app.kubernetes.io/name=eechart -o jsonpath='{.items[0].spec.clusterIP}' - Set Suite Variable ${pod_name} ${pod} - Set Suite Variable ${svc_ip} ${svc} - + [Documentation] Retrieve pod name and service IP address of the helm-based EE running in OSM cluster and store as suite variables to be used later on. + Open Connection ${OSM_HOST} + Login With Public Key ${OSM_USERNAME} keyfile=${OSM_PRIVATEKEY} + ${pod}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl get pod -n ${NS_ID} --no-headers -o custom-columns=":metadata.name" + ${svc}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl get svc -n ${NS_ID} -l app.kubernetes.io/name=eechart -o jsonpath='{.items[0].spec.clusterIP}' + Set Suite Variable ${POD_NAME} ${pod} + Set Suite Variable ${SVC_IP} ${svc} Fail when trying to access gRPC server without TLS - - ${command} = Catenate python3 osm_ee/frontend_client.py ${svc_ip} 50050 sleep - ${result}= Execute Remote Command Check Rc Return Output ${osm_host} ${osm_username} ${osm_password} ${osm_privatekey} kubectl exec -it -n ${ns_id} ${pod_name} -- ${command} + [Documentation] Assert failure when accessing the EE without TLS. + ${command}= Catenate python3 osm_ee/frontend_client.py ${SVC_IP} 50050 sleep + ${result}= Execute Remote Command Check Rc Return Output ${OSM_HOST} ${OSM_USERNAME} ${OSM_PASSWORD} ${OSM_PRIVATEKEY} kubectl exec -it -n ${NS_ID} ${POD_NAME} -- ${command} Should Contain ${result} Connection lost - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_27-update_helm_ee_in_running_vnf_instance.robot b/robot-systest/testsuite/basic_27-update_helm_ee_in_running_vnf_instance.robot index ba0b5e2..2acb2cb 100644 --- a/robot-systest/testsuite/basic_27-update_helm_ee_in_running_vnf_instance.robot +++ b/robot-systest/testsuite/basic_27-update_helm_ee_in_running_vnf_instance.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,167 +11,145 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-27] Update Helm EE in Running VNF Instance. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_27 cluster_ee_config daily regression +Test Tags basic_27 cluster_ee_config daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} simple_ee_vnf -${updated_vnfd_pkg} updated_simple_ee_vnf -${vnfd_name} simple_ee-vnf -${nsd_pkg} simple_ee_ns -${nsd_name} simple_ee-ns +${VNFD_PKG} simple_ee_vnf +${UPDATED_VNFD_PKG} updated_simple_ee_vnf +${VNFD_NAME} simple_ee-vnf +${NSD_PKG} simple_ee_ns +${NSD_NAME} simple_ee-ns # NS instance name and configuration -${ns_name} basic_27_helm_ee_update_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_27_helm_ee_update_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} - -${action_name} touch -${new_action_name} mkdir -${vnf_member_index} simple -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name} /home/ubuntu/mytouch1 -${day_2_folder_name} /home/ubuntu/myfolder1 -${ns_timeout} 15min +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} + +${ACTION_NAME} touch +${NEW_ACTION_NAME} mkdir +${VNF_MEMBER_INDEX} simple +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME} /home/ubuntu/mytouch1 +${DAY_2_FOLDER_NAME} /home/ubuntu/myfolder1 +${NS_TIMEOUT} 15min # NS update operation configuration -${update_type} CHANGE_VNFPKG -${ns_update_timeout} 500 +${UPDATE_TYPE} CHANGE_VNFPKG +${NS_UPDATE_TIMEOUT} 500 *** Test Cases *** Create VNF Descriptor - - ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Set Suite Variable ${vnfd_id} ${id} - + [Documentation] Upload VNF package for the testsuite. + ${id}= Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Set Suite Variable ${VNFD_ID} ${id} Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Set NS Update Config - - Variable Should Exist ${ns_id} msg=NS is not available - ${id} Get Vnf Id ${ns_id} ${vnf_member_index} + [Documentation] Prepare NS update config dictionary to update the NS. + Variable Should Exist ${NS_ID} msg=NS is not available + ${id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX} Log ${id} - Set Suite Variable ${vnf_id} ${id} - Set Suite Variable ${ns_update_config} '{changeVnfPackageData: [{vnfInstanceId: "${vnf_id}", vnfdId: "${vnfd_id}"}]}' - + Set Suite Variable ${VNF_ID} ${id} + Set Suite Variable ${NS_UPDATE_CONFIG} '{changeVnfPackageData: [{vnfInstanceId: "${VNF_ID}", vnfdId: "${VNFD_ID}"}]}' Get Management Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get VNF mgmt IP address from the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access - - Variable Should Exist ${vnf_ip_addr} msg=IP address of the management VNF '${vnf_member_index}' is not available + [Documentation] Test SSH access to the VNF mgmt IP address. + Variable Should Exist ${VNF_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operation [Documentation] The VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operation [Documentation] Performs one Day 2 operation on the VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index} file-path=${day_2_file_name} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} file-path=${DAY_2_FILE_NAME} + Log ${ns_op_id_1} Check Remote File Created Via Day 2 Operation [Documentation] Check whether the file created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name} - + Check If Remote File Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME} Update VNFD Package [Documentation] Updates the VNFD by using new VNFD package which includes the EE ... which has new day2 operation. - - Update VNFD '%{PACKAGES_FOLDER}/${updated_vnfd_pkg}' ${vnfd_name} - + Update VNFD '%{PACKAGES_FOLDER}/${UPDATED_VNFD_PKG}' ${VNFD_NAME} Update Running VNF Instance [Documentation] Updates the running VNF instance by using new VNFD package. ... As the VNFD has an updated Helm EE, this operation will trigger the upgrade of existing Helm EE ... for the specific VNF. - - Update Network Service ${ns_id} ${update_type} ${ns_update_config} ${ns_update_timeout} - + Update Network Service ${NS_ID} ${UPDATE_TYPE} ${NS_UPDATE_CONFIG} ${NS_UPDATE_TIMEOUT} Execute Day 2 Operation on Upgraded Helm EE [Documentation] Performs one Day 2 operation on the updated VNF that creates a new folder. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_2}= Execute NS Action ${ns_name} ${new_action_name} ${vnf_member_index} foldername=${day_2_folder_name} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${NEW_ACTION_NAME} ${VNF_MEMBER_INDEX} foldername=${DAY_2_FOLDER_NAME} + Log ${ns_op_id_2} Check Remote Folder Created Via Day 2 Operation [Documentation] Check whether the folder created in the previous test via Day 2 operations exist or not. - - Check If remote Folder Exists ${vnf_ip_addr} ${username} ${password} ${privatekey} ${day_2_folder_name} - + Check If Remote Folder Exists ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FOLDER_NAME} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot b/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot index 0391ac7..dd92a49 100644 --- a/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot +++ b/robot-systest/testsuite/basic_28-keep_persistent_volumes.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-28] NS with one VDU which has 2 persistent volumes with keep flag @@ -19,159 +21,160 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags basic_28 cluster_main daily +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags basic_28 cluster_main daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} keep_persistent_volume_vnf -${vnfd_name} keep_persistent-volumes-vnf -${nsd_pkg} keep_persistent_volume_ns -${nsd_name} persistent_volumes-ns +${VNFD_PKG} keep_persistent_volume_vnf +${VNFD_NAME} keep_persistent-volumes-vnf +${NSD_PKG} keep_persistent_volume_ns +${NSD_NAME} persistent_volumes-ns # NS instance name and configuration -${ns_name} basic_28 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_28 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${vnf_member_index} vnf-persistent-volumes -${vdu_id} keep-persistent-vol-VM -${root_disk} root-volume -${ordinary_disk} persistent-volume -${success_return_code} 0 +${VNF_MEMBER_INDEX} vnf-persistent-volumes +${VDU_ID} keep-persistent-vol-VM +${ROOT_DISK} root-volume +${ORDINARY_DISK} persistent-volume +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Check Persistent Volume Counts - Variable Should Exist ${ns_id} msg=NS is not available - ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id} - Set Suite Variable ${volume_match} - ${volume_counts}= Get Length ${volume_match} - Set Suite Variable ${volume_counts} - Run Keyword If ${volume_counts} != 2 Fail msg=There were not 2 volumes attached to VM - + [Documentation] Check that the number of persistent volumes attached to VM in the NS meet the expected number (2). + Variable Should Exist ${NS_ID} msg=NS is not available + ${VOLUME_MATCH}= Get Persistent Volumes Attached To Vm ${NS_ID} + Set Suite Variable ${VOLUME_MATCH} + ${VOLUME_COUNTS}= Get Length ${VOLUME_MATCH} + Set Suite Variable ${VOLUME_COUNTS} + IF ${VOLUME_COUNTS} != 2 Fail msg=There were not 2 volumes attached to VM Set Persistent Volume Ids - Variable Should Exist ${volume_match} msg=NS is not available - Set Volume Id ${volume_match} 0 - Set Volume Id ${volume_match} 1 - + [Documentation] Get the identifiers of the persistent volumes attached to VM in the NS and store in suite variables ROOT_VOL_ID and ORDINARY_VOL_ID. + Variable Should Exist ${VOLUME_MATCH} msg=NS is not available + Set Volume Id ${VOLUME_MATCH} 0 + Set Volume Id ${VOLUME_MATCH} 1 Delete NS Instance Test - [Tags] cleanup - Delete NS ${ns_name} - + [Documentation] Delete NS instance. + Delete NS ${NS_NAME} Check Persistent Root Volume in VIM after NS Deleted - Variable Should Exist ${root_vol_id} msg=Root volume is not available - ${root_vol_exists}= Check If Volume Exists ${root_vol_id} - log ${root_vol_exists} - IF ${root_vol_exists}==0 - Fail msg=Persistent root volume was deleted - Set Suite Variable ${root_vol_id} ${EMPTY} + [Documentation] Check that the persistent root volume requested to be kept is present after deleting NS instance. + Variable Should Exist ${ROOT_VOL_ID} msg=Root volume is not available + ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} + Log ${root_vol_exists} + IF ${root_vol_exists} + Log Persistent root volume still exists ELSE - log Persistent root volume still exists + Fail msg=Persistent root volume was deleted + Set Suite Variable ${ROOT_VOL_ID} ${EMPTY} END - Check Persistent Ordinary Volume in VIM after NS Deleted - Variable Should Exist ${ordinary_vol_id} msg=Ordinary persistent volume is not available - ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id} - log ${ordinary_vol_exists} - IF ${ordinary_vol_exists}==0 - Fail msg=Persistent ordinary volume was deleted - Set Suite Variable ${ordinary_vol_id} ${EMPTY} + [Documentation] Check that the persistent ordinary volume requested to be kept is present after deleting NS instance. + Variable Should Exist ${ORDINARY_VOL_ID} msg=Ordinary persistent volume is not available + ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} + Log ${ordinary_vol_exists} + IF ${ordinary_vol_exists} + Log Persistent ordinary volume still exists ELSE - log Persistent ordinary volume still exists + Fail msg=Persistent ordinary volume was deleted + Set Suite Variable ${ORDINARY_VOL_ID} ${EMPTY} END - Prepare Ns Config With Volume Id - Set Suite Variable ${ns_config_with_vim_id} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], vnf: [ {member-vnf-index: ${vnf_member_index}, vdu: [ {id: ${vdu_id}, volume: [{"name": ${root_disk}, vim-volume-id: ${root_vol_id}}, {"name": ${ordinary_disk}, vim-volume-id: ${ordinary_vol_id}}] } ] } ] } - + [Documentation] Generate NS instantiation parameters to be used in next NS instance, + ... using the persistent volumes that were kept previously. + Set Suite Variable ${NS_CONFIG_WITH_VIM_ID} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], vnf: [ {member-vnf-index: ${VNF_MEMBER_INDEX}, vdu: [ {id: ${VDU_ID}, volume: [{"name": ${ROOT_DISK}, vim-volume-id: ${ROOT_VOL_ID}}, {"name": ${ORDINARY_DISK}, vim-volume-id: ${ORDINARY_VOL_ID}}] } ] } ] } Network Service Instance With Existing Volumes Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config_with_vim_id} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite again. The persistent volumes passed as instantiation parameters should be used. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG_WITH_VIM_ID} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Verify the Attachment Of Existing Persistent Volumes - Set Suite Variable ${prev_root_vol_id} ${root_vol_id} - Set Suite Variable ${prev_ordinary_vol_id} ${ordinary_vol_id} - ${volume_match}= Get Persistent Volumes Attached To Vm ${ns_id} - Set Suite Variable ${volume_match} - Set Volume Id ${volume_match} 0 - Set Volume Id ${volume_match} 1 - Should Be Equal As Strings ${root_vol_id} ${prev_root_vol_id} msg=Existing root volume is not attached to server - Should Be Equal As Strings ${ordinary_vol_id} ${prev_ordinary_vol_id} msg=Existing ordinary volume is not attached to server - + [Documentation] Get the identifiers of the persistent volumes attached to VM in the second NS instance and verify that they are the same + ... of the first NS instance. + Set Suite Variable ${PREV_ROOT_VOL_ID} ${ROOT_VOL_ID} + Set Suite Variable ${PREV_ORDINARY_VOL_ID} ${ORDINARY_VOL_ID} + ${volume_match}= Get Persistent Volumes Attached To Vm ${NS_ID} + Set Suite Variable ${VOLUME_MATCH} + Set Volume Id ${VOLUME_MATCH} 0 + Set Volume Id ${VOLUME_MATCH} 1 + Should Be Equal As Strings ${ROOT_VOL_ID} ${PREV_ROOT_VOL_ID} msg=Existing root volume is not attached to server + Should Be Equal As Strings ${ORDINARY_VOL_ID} ${PREV_ORDINARY_VOL_ID} msg=Existing ordinary volume is not attached to server Delete NS Instance With Existing Volumes Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Check Existence of Persistent Volumes - Variable Should Exist ${root_vol_id} msg=Volume is not available - Variable Should Exist ${ordinary_vol_id} msg=Volume is not available - ${root_vol_exists}= Check If Volume Exists ${root_vol_id} - Run Keyword If ${root_vol_exists} == 0 Fail msg=Existing root volume is deleted - ${ordinary_vol_exists}= Check If Volume Exists ${ordinary_vol_id} - Run Keyword If ${ordinary_vol_exists} == 0 Fail msg=Existing ordinary volume is deleted - + [Documentation] Check that the persistent volumes exist after deleting the NS. + Variable Should Exist ${ROOT_VOL_ID} msg=Volume is not available + Variable Should Exist ${ORDINARY_VOL_ID} msg=Volume is not available + ${root_vol_exists}= Check If Volume Exists ${ROOT_VOL_ID} + IF not ${root_vol_exists} Fail msg=Existing root volume is deleted + ${ordinary_vol_exists}= Check If Volume Exists ${ORDINARY_VOL_ID} + IF not ${ordinary_vol_exists} Fail msg=Existing ordinary volume is deleted Delete Persistent Volumes - [Tags] cleanup - Delete Volume ${root_vol_id} - Delete Volume ${ordinary_vol_id} - + [Documentation] Delete persistent volumes. + Clean Persistent Volumes Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Clean Persistent Volumes - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - Run Keyword If Any Tests Failed Delete Persistent Volumes +Clean Persistent Volumes + [Documentation] Delete root and ordinary volumes. + [Tags] cleanup + Delete Volume ${ROOT_VOL_ID} + Delete Volume ${ORDINARY_VOL_ID} diff --git a/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot b/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot index 2d1ab31..cf943ca 100644 --- a/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot +++ b/robot-systest/testsuite/basic_29-vnf_ipv6_profile.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-29] NS with a single VNF and two VDU linked by a VLD with ipv6-profile. @@ -19,112 +21,105 @@ Library Collections Library SSHLibrary Library JSONLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnf_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags basic_29 cluster_main daily +Test Tags basic_29 cluster_main daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} ipv6profile_2vm_vnf -${vnfd_name} ipv6profile_2vm-vnf -${nsd_pkg} ipv6profile_2vm_ns -${nsd_name} ipv6profile_2vm-ns +${VNFD_PKG} ipv6profile_2vm_vnf +${VNFD_NAME} ipv6profile_2vm-vnf +${NSD_PKG} ipv6profile_2vm_ns +${NSD_NAME} ipv6profile_2vm-ns # NS instance name and configuration -${ns_name} basic_29 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_29 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${username} ubuntu +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${USERNAME} ubuntu # VNFs data -${vnf_member_index_1} vnf -${internal_prefix} ^2001:db8::* +${VNF_MEMBER_INDEX_1} vnf +${INTERNAL_PREFIX} ^2001:db8::* -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Info - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get VNF information, specifically VNF instance id and mgmt IP address. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${vnf_ipmgmt} ${ip} - Log ${vnf_ipmgmt} - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${VNF_IPMGMT} ${ip} + Log ${VNF_IPMGMT} Check Vnf IPs - - Variable Should Exist ${vnf_id} msg=VNF is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${internal_prefix} msg=${stdout} doesn't match subnet's regexp ${internal_prefix} - -Check that ipv6 address_mode and ra_mode are set - - ${rc} ${vim_info}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' + [Documentation] Check whether IP addresses are syntactically valid. + Variable Should Exist ${VNF_ID} msg=VNF is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} + +Check That Ipv6 Address_mode And Ra_mode Are Set + [Documentation] Check that IPv6 address mode and RA mode are set and equal to dhcpv6-stateful. + ${rc} ${vim_info}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' + Log ${rc},${vim_info} ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1 ${subnet_info}= Get Subnet ${subnet_id}[0] - ${json_object}= Convert String to JSON ${subnet_info} + ${json_object}= Convert String To JSON ${subnet_info} ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equals to dhcpv6-stateful Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equals to dhcpv6-stateful - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot b/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot index 1246ed5..ca1cbe7 100644 --- a/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot +++ b/robot-systest/testsuite/basic_30-ns_ipv6_profile.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-30] NS with a single VNF and two VDU linked by a VLD with ipv6-profile. @@ -19,148 +21,138 @@ Library Collections Library SSHLibrary Library JSONLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnf_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags basic_30 cluster_main daily +Test Tags basic_30 cluster_main daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} ubuntu_4ifaces_vnf -${vnfd_name} ubuntu_4ifaces-vnf -${nsd_pkg} ubuntu_4ifaces_ipv6_ns -${nsd_name} ubuntu_4ifaces-ipv6-ns +${VNFD_PKG} ubuntu_4ifaces_vnf +${VNFD_NAME} ubuntu_4ifaces-vnf +${NSD_PKG} ubuntu_4ifaces_ipv6_ns +${NSD_NAME} ubuntu_4ifaces-ipv6-ns # NS instance name and configuration -${ns_name} basic_30 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_30 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu # VNFs data -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${iface1_name} eth1 -${datanet1_prefix} ^2001:db8::* +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${IFACE1_NAME} eth1 +${DATANET1_PREFIX} ^2001:db8::* -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnfs Info - - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get information from the two VNF of the NS, specifically VNF instance id and mgmt IP address. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id1} ${vnfr_list}[0] - Set Suite Variable ${vnf_id2} ${vnfr_list}[1] - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${vnf1_ipmgmt} ${ip} - Log ${vnf1_ipmgmt} - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} - Set Suite Variable ${vnf2_ipmgmt} ${ip} - Log ${vnf2_ipmgmt} - + Set Suite Variable ${VNF_ID1} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID2} ${vnfr_list}[1] + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${VNF1_IPMGMT} ${ip} + Log ${VNF1_IPMGMT} + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} + Set Suite Variable ${VNF2_IPMGMT} ${ip} + Log ${VNF2_IPMGMT} Check Vnf1 IPs - - Variable Should Exist ${vnf_id1} msg=VNF1 is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} - Set Suite Variable ${vnf1_ip1} ${stdout} - + [Documentation] Check whether IP addresses of the first VNF in the VNF record meet the expected CIDR. + Variable Should Exist ${VNF_ID1} msg=VNF1 is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} + Set Suite Variable ${VNF1_IP1} ${stdout} Check Vnf2 IPs - - Variable Should Exist ${vnf_id2} msg=VNF2 is not available - ${rc} ${stdout}= Run and Return RC and Output osm vnf-show ${vnf_id2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${iface1_name}")' | yq -r '."ip-address"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False - Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} - Set Suite Variable ${vnf2_ip1} ${stdout} - + [Documentation] Check whether IP addresses of the second VNF in the VNF record meet the expected CIDR. + Variable Should Exist ${VNF_ID2} msg=VNF2 is not available + ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False + Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} + Set Suite Variable ${VNF2_IP1} ${stdout} Verify Vnf1 Interfaces - - Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available + [Documentation] Check whether IP addresses of the first VNF configured inside the VM meet the expected CIDR. + Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available Sleep 120 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf1_ipmgmt} ${username} ${EMPTY} ${privatekey} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' Log ${stdout} - @{ip} = Split String ${stdout} - Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} - + @{ip}= Split String ${stdout} + Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} Verify Vnf2 Interfaces - - Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available - Variable Should Exist ${privatekey} msg=SSH private key not available - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf2_ipmgmt} ${username} ${EMPTY} ${privatekey} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' + [Documentation] Check whether IP addresses of the second VNF configured inside the VM meet the expected CIDR. + Variable Should Exist ${VNF2_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} sudo dhclient -6 ens4 ; ip --brief addr show up | grep -v "^lo" | awk '{print $3}' Log ${stdout} - @{ip} = Split String ${stdout} - Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} - + @{ip}= Split String ${stdout} + Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} Check that ipv6 address_mode and ra_mode are set - - ${rc} ${vim_info}= Run and Return RC and Output osm vnf-show ${vnf_id1} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' + [Documentation] Check that IPv6 address mode and RA mode are set and equal to dhcpv6-stateful. + ${rc} ${vim_info}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' + Log ${rc},${vim_info} ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1 ${subnet_info}= Get Subnet ${subnet_id}[0] - ${json_object}= Convert String to JSON ${subnet_info} + ${json_object}= Convert String To JSON ${subnet_info} ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equal dhcpv6-stateful Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equal dhcpv6-stateful - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot b/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot index c610447..6e2e164 100644 --- a/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot +++ b/robot-systest/testsuite/basic_31-multivdu_volume_multiattach.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-31] Basic NS with two multi-VDU VNF @@ -19,113 +21,106 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags basic_31 cluster_main daily +Test Tags basic_31 cluster_main daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} multivdu_multiattach_vnf -${vnfd_name} multivdu_multiattach-vnf -${nsd_pkg} multivdu_multiattach_ns -${nsd_name} multivdu_multiattach-ns +${VNFD_PKG} multivdu_multiattach_vnf +${VNFD_NAME} multivdu_multiattach-vnf +${NSD_PKG} multivdu_multiattach_ns +${NSD_NAME} multivdu_multiattach-ns # NS instance name and configuration -${ns_name} multivdu_multiattach -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} multivdu_multiattach +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${vdu0_username} ubuntu -${vdu0_password} ${EMPTY} -${vdu0_publickey} %{HOME}/.ssh/id_rsa.pub -${vdu0_privatekey} %{HOME}/.ssh/id_rsa -${vdu1_username} ubuntu -${vdu1_password} osmpass -${vdu1_publickey} ${EMPTY} -${vdu1_privatekey} ${EMPTY} +${VDU0_USERNAME} ubuntu +${VDU0_PASSWORD} ${EMPTY} +${VDU0_PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${VDU0_PRIVATEKEY} %{HOME}/.ssh/id_rsa +${VDU1_USERNAME} ubuntu +${VDU1_PASSWORD} osmpass +${VDU1_PUBLICKEY} ${EMPTY} +${VDU1_PRIVATEKEY} ${EMPTY} -${ns_id} ${EMPTY} -${vnf_member_index} vnf -${vnf_ip_addr} ${EMPTY} -${wait_guard_for_vm_boot} 50s +${NS_ID} ${EMPTY} +${VNF_MEMBER_INDEX} vnf +${VNF_IP_ADDR} ${EMPTY} +${WAIT_GUARD_FOR_VM_BOOT} 50s *** Test Cases *** Create Multiattach VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Multiattach NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - - ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${vdu0_publickey} - Run Keyword If "${status}" == "FAIL" Set Global Variable ${vdu0_publickey} ${EMPTY} - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${vdu0_publickey} - Set Suite Variable ${ns_id} ${id} - Sleep ${wait_guard_for_vm_boot} Waiting for VM's daemons to be up and running - + [Documentation] Instantiate NS for the testsuite. + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${VDU0_PUBLICKEY} + Log ${status} + Log ${message} + IF ${status} == "FAIL" Set Global Variable ${VDU0_PUBLICKEY} ${EMPTY} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${VDU0_PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} + Sleep ${WAIT_GUARD_FOR_VM_BOOT} Waiting for VM's daemons to be up and running Get Vnf ID - - ${_vnf_id}= Get Vnf Id ${ns_id} ${vnf_member_index} - Set Suite Variable ${vnf_id} ${_vnf_id} - + [Documentation] Get the VNF instance id from OSM. + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX} + Set Suite Variable ${VNF_ID} ${vnf_id} Get Vnf Management Ip Addresses - - ${rc} ${vdu0_ip}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[0].interfaces[]."ip-address"' - ${rc} ${vdu1_ip}= Run and Return RC and Output osm vnf-show ${vnf_id} --literal | yq -r '.vdur[1].interfaces[]."ip-address"' - Set Suite Variable ${mgmnt_ip_addr_0} ${vdu0_ip} - Set Suite Variable ${mgmnt_ip_addr_1} ${vdu1_ip} - + [Documentation] Get the IP addresses of the two VDU of the VNF. + ${rc} ${vdu0_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[0].interfaces[]."ip-address"' + Log ${rc},${vdu0_ip} + ${rc} ${vdu1_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[1].interfaces[]."ip-address"' + Log ${rc},${vdu1_ip} + Set Suite Variable ${MGMT_IP_ADDR_0} ${vdu0_ip} + Set Suite Variable ${MGMT_IP_ADDR_1} ${vdu1_ip} Ensure that VDUs can share data - - Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_0} ${vdu0_username} ${vdu0_password} ${vdu0_privatekey} sudo mkfs.ext3 -F /dev/vdb && sudo mkdir /shared && sudo mount /dev/vdb /shared && sudo chown ubuntu:ubuntu /shared && echo "osmtest" > /shared/test_file + [Documentation] Connect via SSH to the two VDUs of the VNF and check that the volume is shared as expected. + Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} sudo mkfs.ext3 -F /dev/vdb && sudo mkdir /shared && sudo mount /dev/vdb /shared && sudo chown ubuntu:ubuntu /shared && echo "osmtest" > /shared/test_file Sleep 10s - Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_1} ${vdu1_username} ${vdu1_password} ${vdu1_privatekey} sudo mkdir /shared && sudo mount /dev/vdb /shared && ls /shared - Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_1} ${vdu1_username} ${vdu1_password} ${vdu1_privatekey} cat /shared/test_file - ${stdout}= Execute Remote Command Check Rc Return Output ${mgmnt_ip_addr_0} ${vdu0_username} ${vdu0_password} ${vdu0_privatekey} cat /shared/test_file + Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} sudo mkdir /shared && sudo mount /dev/vdb /shared && ls /shared + Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} cat /shared/test_file + ${stdout}= Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} cat /shared/test_file Log ${stdout} Should Be Equal ${stdout} osmtest Shared data can't be read - Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/basic_32-volume_with_different_az.robot b/robot-systest/testsuite/basic_32-volume_with_different_az.robot index 2b41c78..6ea3e92 100644 --- a/robot-systest/testsuite/basic_32-volume_with_different_az.robot +++ b/robot-systest/testsuite/basic_32-volume_with_different_az.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [BASIC-32] Basic NS with a volume in different availability zone @@ -19,32 +21,32 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource ../lib/vim_lib.resource +Resource ../lib/prometheus_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource -Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_32-volume_with_different_az.py +Variables ../resources/basic_32-volume_with_different_az.py -Force Tags basic_32 +Test Tags basic_32 Suite Setup Run Keyword And Ignore Error Suite Preparation + *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} several_volumes_vnf -${vnfd_name} several_volumes-vnf -${nsd_pkg} several_volumes_ns -${nsd_name} several_volumes-ns +${VNFD_PKG} several_volumes_vnf +${VNFD_NAME} several_volumes-vnf +${NSD_PKG} several_volumes_ns +${NSD_NAME} several_volumes-ns # NS instance name and configuration -${ns_name} basic_32 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} basic_32 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub *** Test Cases *** @@ -52,64 +54,60 @@ Create VIM Target Basic [Documentation] Create a VIM Target only with the az parameters. ... Checks the status of the VIM in Prometheus after it creation. - Pass Execution If '${vim_account_type}' != 'openstack' Not applicable for ${vim_account_type} VIM + Pass Execution If '${VIM_ACCOUNT_TYPE}' != 'openstack' Not applicable for ${VIM_ACCOUNT_TYPE} VIM ${rand}= Generate Random String 6 [NUMBERS] - ${vim_name_az}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} - Set Suite Variable ${vim_name_az} - ${created_vim_account_id}= Create VIM Target ${vim_name_az} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} config=${vim_config} - Set Suite Variable ${created_vim_account_id} - + ${VIM_NAME_AZ}= Catenate SEPARATOR=_ ${VIM_NAME_PREFIX} ${rand} + Set Suite Variable ${VIM_NAME_AZ} + ${CREATED_VIM_ACCOUNT_ID}= Create VIM Target ${VIM_NAME_AZ} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE} config=${VIM_CONFIG} + Set Suite Variable ${CREATED_VIM_ACCOUNT_ID} Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} ${vim_name_az} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + ${id}= Create Network Service ${NSD_NAME} ${VIM_NAME_AZ} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} - + Delete VNFD ${VNFD_NAME} Delete VIM Target By ID [Documentation] Delete the VIM Target created in previous test-case by its ID. ... Checks whether the VIM Target was created or not before perform the deletion. [Tags] cleanup - ${vim_account_id}= Get VIM Target ID ${vim_name_az} - Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} + ${vim_account_id}= Get VIM Target ID ${VIM_NAME_AZ} + Should Be Equal As Strings ${vim_account_id} ${CREATED_VIM_ACCOUNT_ID} Delete VIM Target ${vim_account_id} *** Keywords *** +Suite Preparation + [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables + Set Testsuite Prometheus Variables + Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} \ No newline at end of file + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/epa_01-epa_sriov.robot b/robot-systest/testsuite/epa_01-epa_sriov.robot index 981ed58..7b838bc 100644 --- a/robot-systest/testsuite/epa_01-epa_sriov.robot +++ b/robot-systest/testsuite/epa_01-epa_sriov.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [EPA-01] EPA+SRIOV without underlay. @@ -18,92 +20,81 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags epa_01 cluster_epa daily regression +Test Tags epa_01 cluster_epa daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_sriov_vnf -${vnfd_name} hackfest_basic_sriov-vnf -${nsd_pkg} hackfest_basic_sriov_ns -${nsd_name} hackfest_basic_sriov-ns +${VNFD_PKG} hackfest_basic_sriov_vnf +${VNFD_NAME} hackfest_basic_sriov-vnf +${NSD_PKG} hackfest_basic_sriov_ns +${NSD_NAME} hackfest_basic_sriov-ns # NS instance name and configuration -${ns_name} epa_01-epa_sriov_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_id} ${EMPTY} +${NS_NAME} epa_01-epa_sriov_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_ID} ${EMPTY} # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} osm4u -${vnf_member_index} vnf -${vnf_ip_addr} ${EMPTY} - +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} osm4u +${VNF_MEMBER_INDEX} vnf +${VNF_IP_ADDR} ${EMPTY} *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get VNF IP Address - - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF of the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Check SR-IOV Interface - + [Documentation] Connect via SSH to the mgmt IP address of the VNF and check that the interface is not based in VirtIO. Sleep 30 seconds Waiting for SSH daemon to be up - Execute Remote Command Check Rc Return Output ${vnf_ip_addr} ${username} ${password} ${privatekey} lspci | grep "Ethernet controller" | grep -v "Virtio" + Execute Remote Command Check Rc Return Output ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} lspci | grep "Ethernet controller" | grep -v "Virtio" Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/epa_02-additional_capabilities.robot b/robot-systest/testsuite/epa_02-additional_capabilities.robot index 86b0e97..d278e63 100644 --- a/robot-systest/testsuite/epa_02-additional_capabilities.robot +++ b/robot-systest/testsuite/epa_02-additional_capabilities.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [EPA-02] Support for additional EPA capabilities. @@ -18,106 +20,94 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags epa_02 cluster_epa daily regression +Test Tags epa_02 cluster_epa daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} epa_quota_vnf -${vnfd_name} epa_quota-vnf -${nsd_pkg} epa_quota_ns -${nsd_name} epa_quota-ns +${VNFD_PKG} epa_quota_vnf +${VNFD_NAME} epa_quota-vnf +${NSD_PKG} epa_quota_ns +${NSD_NAME} epa_quota-ns # NS instance name and configuration -${ns_name} epa_02-epa_quota_test -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} epa_02-epa_quota_test +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH public keys file -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub -${ns_id} ${EMPTY} -${vnf_server_id} ${EMPTY} -${flavor_properties} ${EMPTY} -${success_return_code} 0 +${NS_ID} ${EMPTY} +${VNF_SERVER_ID} ${EMPTY} +${FLAVOR_PROPERTIES} ${EMPTY} +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - + [Documentation] Upload VNF package for the testsuite. Remove Environment Variable OVERRIDES - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate the NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get VNF Server ID - - ${vnfs_list}= Get Ns Vnf List ${ns_id} + [Documentation] Get the id of the VM at the VIM and store in VNF_SERVER_ID suite variable to be used later on. + ${vnfs_list}= Get Ns Vnf List ${NS_ID} ${vim_id}= Get VNF VIM ID ${vnfs_list}[0] Log ${vim_id} - Set Suite Variable ${vnf_server_id} ${vim_id} - + Set Suite Variable ${VNF_SERVER_ID} ${vim_id} Get Server Flavor Properties - - ${flavor_id}= Get Server Flavor ID ${vnf_server_id} + [Documentation] Get from the VIM the flavor properties of the VM with id VNF_SERVER_ID. + ${flavor_id}= Get Server Flavor ID ${VNF_SERVER_ID} ${properties}= Get Flavor Properties ${flavor_id} Log ${properties} - Set Suite Variable ${flavor_properties} ${properties} - + Set Suite Variable ${FLAVOR_PROPERTIES} ${properties} Check Flavor Quota Properties - - ${rc}= Run and Return RC echo ${flavor_properties} | grep "cpu_shares_level=custom" - Should Be Equal As Integers ${rc} ${success_return_code} - ${rc}= Run and Return RC echo ${flavor_properties} | grep "disk_io_shares_level=custom" - Should Be Equal As Integers ${rc} ${success_return_code} - ${rc}= Run and Return RC echo ${flavor_properties} | grep "memory_shares_level=custom" - Should Be Equal As Integers ${rc} ${success_return_code} - + [Documentation] Assert that the flavor properties include the expected EPA parameters included in the descriptor. + ${rc}= Run And Return Rc echo ${FLAVOR_PROPERTIES} | grep "cpu_shares_level=custom" + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + ${rc}= Run And Return Rc echo ${FLAVOR_PROPERTIES} | grep "disk_io_shares_level=custom" + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + ${rc}= Run And Return Rc echo ${FLAVOR_PROPERTIES} | grep "memory_shares_level=custom" + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} 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 48c9e90..1312328 100644 --- a/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot +++ b/robot-systest/testsuite/epa_03-crud_operations_on_sdnc.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,45 +11,44 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [EPA-03] CRUD operations on SDNC accounts. -Resource %{ROBOT_DEVOPS_FOLDER}/lib/sdnc_lib.robot +Resource ../lib/prometheus_lib.resource +Resource ../lib/sdnc_lib.resource -Variables %{ROBOT_DEVOPS_FOLDER}/resources/epa_03-crud_operations_on_sdnc_data.py +Variables ../resources/epa_03-crud_operations_on_sdnc_data.py -Force Tags epa_03 cluster_epa daily regression +Test Tags epa_03 cluster_epa daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Delete Basic SDNC *** Variables *** -${sdnc_enabled_max_wait_time} 1min -${sdnc_enabled_pol_time} 10 +${SDNC_ENABLED_MAX_WAIT_TIME} 1min +${SDNC_ENABLED_POL_TIME} 10 *** Test Cases *** Create Basic SDNC - + [Documentation] Register SDN controller in OSM. ${created_sdnc_id}= Create SDNC ${sdnc_name} ${sdnc_user} ${sdnc_password} ${sdnc_url} ${sdnc_type} - Set Suite Variable ${sdnc_id} ${created_sdnc_id} - Wait Until Keyword Succeeds ${sdnc_enabled_max_wait_time} ${sdnc_enabled_pol_time} Check for SDNC ${sdnc_id} - + Set Suite Variable ${SDNC_ID} ${created_sdnc_id} + Wait Until Keyword Succeeds ${SDNC_ENABLED_MAX_WAIT_TIME} ${SDNC_ENABLED_POL_TIME} Check For SDNC ${SDNC_ID} Check SDNC Status Is Healthy - - Check for SDNC Status ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} - + [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} Delete Basic SDNC + [Documentation] Delete SDN controller from OSM. [Tags] cleanup - Delete SDNC ${sdnc_name} *** Keywords *** Suite Preparation - [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - + [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables. Set Testsuite Prometheus Variables diff --git a/robot-systest/testsuite/epa_04-epa_underlay_sriov.robot b/robot-systest/testsuite/epa_04-epa_underlay_sriov.robot index 38a7023..437e138 100644 --- a/robot-systest/testsuite/epa_04-epa_underlay_sriov.robot +++ b/robot-systest/testsuite/epa_04-epa_underlay_sriov.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [EPA-04] EPA underlay SR-IOV. @@ -18,110 +20,96 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags epa_04 cluster_epa daily regression +Test Tags epa_04 cluster_epa daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} epa_1vm_sriov_vnf -${vnfd_name} epa_1vm_sriov-vnf -${nsd_pkg} epa_1vm_sriov_ns -${nsd_name} epa_1vm_sriov-ns -${ns_name} epa_04 +${VNFD_PKG} epa_1vm_sriov_vnf +${VNFD_NAME} epa_1vm_sriov-vnf +${NSD_PKG} epa_1vm_sriov_ns +${NSD_NAME} epa_1vm_sriov-ns +${NS_NAME} epa_04 # Fixed IPs and subnet for datanet VL -${datanet_subnet} 192.168.100.0/24 -${datanet_ip1} 192.168.100.11 -${datanet_ip2} 192.168.100.22 +${DATANET_SUBNET} 192.168.100.0/24 +${DATANET_IP1} 192.168.100.11 +${DATANET_IP2} 192.168.100.22 -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${username} ubuntu -${password} osm4u -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} , {name: datanet, ip-profile: {ip-version: ipv4, subnet-address: "${datanet_subnet}"}, vnfd-connection-point-ref: [ {member-vnf-index-ref: "${vnf_member_index_1}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip1}"}, {member-vnf-index-ref: "${vnf_member_index_2}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip2}"}]} ] } -${success_return_code} 0 +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${USERNAME} ubuntu +${PASSWORD} osm4u +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} , {name: datanet, ip-profile: {ip-version: ipv4, subnet-address: "${DATANET_SUBNET}"}, vnfd-connection-point-ref: [ {member-vnf-index-ref: "${VNF_MEMBER_INDEX_1}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${DATANET_IP1}"}, {member-vnf-index-ref: "${VNF_MEMBER_INDEX_2}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${DATANET_IP2}"}]} ] } +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - + [Documentation] Upload VNF package for the testsuite. Remove Environment Variable OVERRIDES - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${ip_mgmt_1} ${ip} - Log ${ip_mgmt_1} - - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} - Set Suite Variable ${ip_mgmt_2} ${ip} - Log ${ip_mgmt_2} - + [Documentation] Get the mgmt IP addresses of both VNF of the NS. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${IP_MGMT_1} ${ip} + Log ${IP_MGMT_1} + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} + Set Suite Variable ${IP_MGMT_2} ${ip} + Log ${IP_MGMT_2} Ping from Vnf1 to Vnf2 - - Variable Should Exist ${ip_mgmt_1} msg=IP address of the data VNF '${vnf_member_index_1}' is not available + [Documentation] Check connectivity from the first VNF to the second VNF using ping. + Variable Should Exist ${IP_MGMT_1} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available Sleep 30 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${ip_mgmt_1} ${username} ${password} ${EMPTY} ip addr ; ping -c 5 ${datanet_ip2} + ${stdout}= Execute Remote Command Check Rc Return Output ${IP_MGMT_1} ${USERNAME} ${PASSWORD} ${EMPTY} ip addr ; ping -c 5 ${DATANET_IP2} Log ${stdout} - Ping from Vnf2 to Vnf1 - - Variable Should Exist ${ip_mgmt_2} msg=IP address of the data VNF '${vnf_member_index_2}' is not available - ${stdout}= Execute Remote Command Check Rc Return Output ${ip_mgmt_2} ${username} ${password} ${EMPTY} ip addr ; ping -c 5 ${datanet_ip1} + [Documentation] Check connectivity from the second VNF to the first VNF using ping. + Variable Should Exist ${IP_MGMT_2} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available + ${stdout}= Execute Remote Command Check Rc Return Output ${IP_MGMT_2} ${USERNAME} ${PASSWORD} ${EMPTY} ip addr ; ping -c 5 ${DATANET_IP1} Log ${stdout} - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} - + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/epa_05-epa_underlay_passthrough.robot b/robot-systest/testsuite/epa_05-epa_underlay_passthrough.robot index 0e6dd50..a81de08 100644 --- a/robot-systest/testsuite/epa_05-epa_underlay_passthrough.robot +++ b/robot-systest/testsuite/epa_05-epa_underlay_passthrough.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [EPA-05] EPA underlay PASSTHROUGH. @@ -18,111 +20,96 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags epa_05 cluster_epa +Test Tags epa_05 cluster_epa Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} epa_1vm_passthrough_vnf -${vnfd_name} epa_1vm_passthrough-vnf -${nsd_pkg} epa_1vm_passthrough_ns -${nsd_name} epa_1vm_passthrough-ns -${ns_name} epa_05 +${VNFD_PKG} epa_1vm_passthrough_vnf +${VNFD_NAME} epa_1vm_passthrough-vnf +${NSD_PKG} epa_1vm_passthrough_ns +${NSD_NAME} epa_1vm_passthrough-ns +${NS_NAME} epa_05 # Fixed IPs and subnet for datanet VL -${datanet_subnet} 192.168.110.0/24 -${datanet_ip1} 192.168.110.11 -${datanet_ip2} 192.168.110.22 +${DATANET_SUBNET} 192.168.110.0/24 +${DATANET_IP1} 192.168.110.11 +${DATANET_IP2} 192.168.110.22 -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${username} ubuntu -${password} osm4u -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} , {name: datanet, ip-profile: {ip-version: ipv4, subnet-address: "${datanet_subnet}"}, vnfd-connection-point-ref: [ {member-vnf-index-ref: "${vnf_member_index_1}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip1}"}, {member-vnf-index-ref: "${vnf_member_index_2}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${datanet_ip2}"}]} ] } -${success_return_code} 0 +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${USERNAME} ubuntu +${PASSWORD} osm4u +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} , {name: datanet, ip-profile: {ip-version: ipv4, subnet-address: "${DATANET_SUBNET}"}, vnfd-connection-point-ref: [ {member-vnf-index-ref: "${VNF_MEMBER_INDEX_1}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${DATANET_IP1}"}, {member-vnf-index-ref: "${VNF_MEMBER_INDEX_2}", vnfd-connection-point-ref: vnf-data-ext, ip-address: "${DATANET_IP2}"}]} ] } +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - + [Documentation] Upload VNF package for the testsuite. Remove Environment Variable OVERRIDES - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} - Set Suite Variable ${ip_mgmt_1} ${ip} - Log ${ip_mgmt_1} - - ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} - Set Suite Variable ${ip_mgmt_2} ${ip} - Log ${ip_mgmt_2} - + [Documentation] Get the mgmt IP addresses of both VNF of the NS. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} + Set Suite Variable ${IP_MGMT_1} ${ip} + Log ${IP_MGMT_1} + ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} + Set Suite Variable ${IP_MGMT_2} ${ip} + Log ${IP_MGMT_2} Ping from Vnf1 to Vnf2 - - Variable Should Exist ${ip_mgmt_1} msg=IP address of the data VNF '${vnf_member_index_1}' is not available + [Documentation] Check connectivity from the first VNF to the second VNF using ping. + Variable Should Exist ${IP_MGMT_1} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available Sleep 30 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${ip_mgmt_1} ${username} ${password} ${EMPTY} ip addr ; ping -c 5 ${datanet_ip2} + ${stdout}= Execute Remote Command Check Rc Return Output ${IP_MGMT_1} ${USERNAME} ${PASSWORD} ${EMPTY} ip addr ; ping -c 5 ${DATANET_IP2} Log ${stdout} - Ping from Vnf2 to Vnf1 - - Variable Should Exist ${ip_mgmt_2} msg=IP address of the data VNF '${vnf_member_index_2}' is not available - ${stdout}= Execute Remote Command Check Rc Return Output ${ip_mgmt_2} ${username} ${password} ${EMPTY} ip addr ; ping -c 5 ${datanet_ip1} + [Documentation] Check connectivity from the second VNF to the first VNF using ping. + Variable Should Exist ${IP_MGMT_2} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available + ${stdout}= Execute Remote Command Check Rc Return Output ${IP_MGMT_2} ${USERNAME} ${PASSWORD} ${EMPTY} ip addr ; ping -c 5 ${DATANET_IP1} Log ${stdout} - Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} - + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/fail_01-insufficient_resources.robot b/robot-systest/testsuite/fail_01-insufficient_resources.robot index 022ae5a..6c14e57 100644 --- a/robot-systest/testsuite/fail_01-insufficient_resources.robot +++ b/robot-systest/testsuite/fail_01-insufficient_resources.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [FAIL-01] A single VNF with 2 VDUs, one of them unallocatable because of resources. @@ -18,102 +20,96 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags fail_01 cluster_main daily regression +Test Tags fail_01 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} simple_2vm_vnf -${vnfd_name} simple_2vm-vnf -${nsd_pkg} simple_2vm_ns -${nsd_name} simple_2vm-ns +${VNFD_PKG} simple_2vm_vnf +${VNFD_NAME} simple_2vm-vnf +${NSD_PKG} simple_2vm_ns +${NSD_NAME} simple_2vm-ns # NS instance name and configuration -${ns_name_prefix} fail_01 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME_PREFIX} fail_01 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys to be used -${publickey} %{HOME}/.ssh/id_rsa.pub +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub # Default memory in GB for dataVM VDU (can be overwritten by VM_MEMORY_OVERRIDE environment variable) # Only used if no quota is defined in Openstack's project (VDU tries to allocate the full memory of the quota) -${default_memory} 250 +${DEFAULT_MEMORY} 250 # NS launch timeout and polling time -${ns_launch_max_wait_time} 5min -${ns_launch_pol_time} 15 +${NS_LAUNCH_MAX_WAIT_TIME} 5min +${NS_LAUNCH_POL_TIME} 15 # Openstack delete operation timeout and polling time -${os_delete_max_wait_time} 6min -${os_delete_pol_time} 20 +${OS_DELETE_MAX_WAIT_TIME} 6min +${OS_DELETE_POL_TIME} 20 *** Test Cases *** Create VNF Descriptor - + [Documentation] Upload VNF package for the testsuite. ${ram_quota}= Get Project Quota ram IF ${ram_quota} == -1 - ${memory}= Get Environment Variable VM_MEMORY_OVERRIDE default=${default_memory} + ${memory}= Get Environment Variable VM_MEMORY_OVERRIDE default=${DEFAULT_MEMORY} ELSE ${memory}= Evaluate ${ram_quota} / 1000 END Log ${memory} - Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${vnfd_pkg}' virtual-compute-desc.1.virtual-memory.size=${memory} - + Create VNFD Overriding Fields '%{PACKAGES_FOLDER}/${VNFD_PKG}' virtual-compute-desc.1.virtual-memory.size=${memory} Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Cannot Instantiate Network Service - + [Documentation] Assert failure when trying to instantiate the NS instance and there are not enough resources in the VIM. ${rand}= Generate Random String 4 [NUMBERS] - ${ns_name}= Catenate SEPARATOR=_ ${ns_name_prefix} ${rand} - Set Suite Variable ${ns_name} - Log ${ns_name} - ${id}= Instantiate Network Service ${ns_name} ${nsd_name} %{VIM_TARGET} --config '${ns_config}' --ssh_keys ${publickey} + ${ns_name}= Catenate SEPARATOR=_ ${NS_NAME_PREFIX} ${rand} + Set Suite Variable ${NS_NAME} + Log ${NS_NAME} + ${id}= Instantiate Network Service ${NS_NAME} ${NSD_NAME} %{VIM_TARGET} --config '${NS_CONFIG}' --ssh_keys ${PUBLICKEY} Log ${id} - Set Suite Variable ${ns_id} ${id} - WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For Ns Instance To Configured ${ns_name} - ${rc} ${stdout}= run and return rc and output osm ns-list --filter id="${ns_id}" | grep ${ns_id} | awk '{print $8}' - Log ${stdout} + Set Suite Variable ${NS_ID} ${id} + WAIT UNTIL KEYWORD SUCCEEDS ${NS_LAUNCH_MAX_WAIT_TIME} ${NS_LAUNCH_POL_TIME} Check For Ns Instance To Configured ${NS_NAME} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-list --filter id="${NS_ID}" | grep ${NS_ID} | awk '{print $8}' + Log ${rc},${stdout} Should Contain ${stdout} BROKEN - ${rc} ${stdout}= run and return rc and output osm ns-show ${ns_id} --literal | yq .errorDetail - Log ${stdout} + ${rc} ${stdout}= Run And Return Rc And Output osm ns-show ${NS_ID} --literal | yq .errorDetail + Log ${rc},${stdout} Should Contain ${stdout} Deploying at VIM: Error at create vdu - Delete NS Instance And Check VIM + [Documentation] Delete NS instance and check that the VMs have been deleted. [Tags] cleanup - - Delete NS ${ns_name} - WAIT UNTIL KEYWORD SUCCEEDS ${os_delete_max_wait_time} ${os_delete_pol_time} Check NS Servers In VIM ${ns_name} 0 - + Delete NS ${NS_NAME} + WAIT UNTIL KEYWORD SUCCEEDS ${OS_DELETE_MAX_WAIT_TIME} ${OS_DELETE_POL_TIME} Check NS Servers In VIM ${NS_NAME} 0 Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/hackfest_basic.robot b/robot-systest/testsuite/hackfest_basic.robot index 1c9d7c9..09d8aa5 100644 --- a/robot-systest/testsuite/hackfest_basic.robot +++ b/robot-systest/testsuite/hackfest_basic.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HACKFEST-BASIC] Basic NS with a single-VDU VNF @@ -19,94 +21,87 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags hackfest_basic cluster_main daily regression sanity azure +Test Tags hackfest_basic cluster_main daily regression sanity azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_vnf -${vnfd_name} hackfest_basic-vnf -${nsd_pkg} hackfest_basic_ns -${nsd_name} hackfest_basic-ns +${VNFD_PKG} hackfest_basic_vnf +${VNFD_NAME} hackfest_basic-vnf +${NSD_PKG} hackfest_basic_ns +${NSD_NAME} hackfest_basic-ns # NS instance name and configuration -${ns_name} hfbasic -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} hfbasic +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${ns_id} ${EMPTY} -${vnf_member_index} vnf -${vnf_ip_addr} ${EMPTY} +${NS_ID} ${EMPTY} +${VNF_MEMBER_INDEX} vnf +${VNF_IP_ADDR} ${EMPTY} *** Test Cases *** Create Hackfest Basic VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Hackfest Basic NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF of the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test Ping - Test Connectivity ${vnf_ip_addr} + [Documentation] Test that the mgmt IP address of the VNF is reachable with ping. + Test Connectivity ${VNF_IP_ADDR} Test SSH Access + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/hackfest_cloudinit.robot b/robot-systest/testsuite/hackfest_cloudinit.robot index cd695ad..89aeb22 100644 --- a/robot-systest/testsuite/hackfest_cloudinit.robot +++ b/robot-systest/testsuite/hackfest_cloudinit.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HACKFEST-CLOUDINIT] Basic NS with two multi-VDU VNF with cloudinit @@ -19,99 +21,86 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags hackfest_cloudinit cluster_main daily regression sanity azure +Test Tags hackfest_cloudinit cluster_main daily regression sanity azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_cloudinit_vnf -${vnfd_name} hackfest_cloudinit-vnf -${nsd_pkg} hackfest_cloudinit_ns -${nsd_name} hackfest_cloudinit-ns +${VNFD_PKG} hackfest_cloudinit_vnf +${VNFD_NAME} hackfest_cloudinit-vnf +${NSD_PKG} hackfest_cloudinit_ns +${NSD_NAME} hackfest_cloudinit-ns # NS instance name and configuration -${ns_name} hfcloudinit -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} hfcloudinit +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH user and password -${username} ubuntu -${password} osm4u +${USERNAME} ubuntu +${PASSWORD} osm4u -${ns_id} ${EMPTY} -${vnf_member_index} vnf1 -${vnf_ip_addr} ${EMPTY} +${NS_ID} ${EMPTY} +${VNF_MEMBER_INDEX} vnf1 +${VNF_IP_ADDR} ${EMPTY} *** Test Cases *** Create Hackfest Cloudinit VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Hackfest Cloudinit NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF of the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test SSH Access - + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${EMPTY} - + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} Check Remote File Injected Via Cloud-init - - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf_ip_addr} ${username} ${password} ${EMPTY} sudo cat /root/helloworld.txt + [Documentation] Check that the day-0 configuration via cloudinit worked as expected in the VNF. A file should exist in the VM. + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} sudo cat /root/helloworld.txt Log ${stdout} - Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/hackfest_multivdu.robot b/robot-systest/testsuite/hackfest_multivdu.robot index 14fe175..325cd9d 100644 --- a/robot-systest/testsuite/hackfest_multivdu.robot +++ b/robot-systest/testsuite/hackfest_multivdu.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HACKFEST-MULTIVDU] Basic NS with two multi-VDU VNF @@ -19,96 +21,94 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags hackfest_multivdu cluster_main daily regression azure +Test Tags hackfest_multivdu cluster_main daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_multivdu_vnf -${vnfd_name} hackfest_multivdu-vnf -${nsd_pkg} hackfest_multivdu_ns -${nsd_name} hackfest_multivdu-ns +${VNFD_PKG} hackfest_multivdu_vnf +${VNFD_NAME} hackfest_multivdu-vnf +${NSD_PKG} hackfest_multivdu_ns +${NSD_NAME} hackfest_multivdu-ns # NS instance name and configuration -${ns_name} hfmultivdu -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} hfmultivdu +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${ns_id} ${EMPTY} -${vnf_member_index} vnf1 -${vnf_ip_addr} ${EMPTY} -${wait_guard_for_vm_boot} 50s +${NS_ID} ${EMPTY} +${VNF_MEMBER_INDEX} vnf1 +${VNF_IP_ADDR} ${EMPTY} +${WAIT_GUARD_FOR_VM_BOOT} 50s *** Test Cases *** Create Hackfest multivdu VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Hackfest Multivdu NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - - ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${publickey} - Run Keyword If "${status}" == "FAIL" Set Global Variable ${publickey} ${EMPTY} - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - Sleep ${wait_guard_for_vm_boot} Waiting for VM's daemons to be up and running + [Documentation] Instantiate NS for the testsuite. + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${PUBLICKEY} + Log ${status},${message} + IF ${status} == "FAIL" Set Global Variable ${PUBLICKEY} ${EMPTY} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} + Sleep ${WAIT_GUARD_FOR_VM_BOOT} Waiting for VM's daemons to be up and running Get Vnf Ip Address - - ${ip_addr} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF of the NS. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Test Ping - Test Connectivity ${vnf_ip_addr} + [Documentation] Test that the mgmt IP address of the VNF is reachable with ping. + Test Connectivity ${VNF_IP_ADDR} Test SSH Access - ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${privatekey} - Run Keyword If "${status}" == "FAIL" Set Global Variable ${privatekey} ${EMPTY} - Test SSH Connection ${vnf_ip_addr} ${username} ${password} ${privatekey} + [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address. + ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${PRIVATEKEY} + Log ${status},${message} + IF ${status} == "FAIL" Set Global Variable ${PRIVATEKEY} ${EMPTY} + Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Delete NS Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete VNF package. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/heal_01-volume_vdu_healing.robot b/robot-systest/testsuite/heal_01-volume_vdu_healing.robot index dfade05..de2467a 100644 --- a/robot-systest/testsuite/heal_01-volume_vdu_healing.robot +++ b/robot-systest/testsuite/heal_01-volume_vdu_healing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HEAL-01] Healing of a multi-volume VDU @@ -19,177 +21,174 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags heal_01 cluster_heal daily +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags heal_01 cluster_heal daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_volumes_pkg} several_volumes_vnf -${vnfd_volumes_name} several_volumes-vnf -${vdu_volumes_name} several_volumes-VM -${vnf_several_index} several_volumes_vnf -${vnfd_charm_pkg} charm-packages/native_manual_scale_charm_vnf -${vnfd_charm_name} native_manual_scale_charm-vnf -${nsd_pkg} volumes_nativecharm_ns -${nsd_name} volumes_nativecharm-ns +${VNFD_VOLUMES_PKG} several_volumes_vnf +${VNFD_VOLUMES_NAME} several_volumes-vnf +${VDU_VOLUMES_NAME} several_volumes-VM +${VNF_SEVERAL_INDEX} several_volumes_vnf +${VNFD_CHARM_PKG} charm-packages/native_manual_scale_charm_vnf +${VNFD_CHARM_NAME} native_manual_scale_charm-vnf +${NSD_PKG} volumes_nativecharm_ns +${NSD_NAME} volumes_nativecharm-ns # NS instance name and configuration -${ns_name} heal_01 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 6min +${NS_NAME} heal_01 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 6min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 -@{vim_vdus} @{EMPTY} -@{vim_volumes} @{EMPTY} +@{VIM_VDUS} @{EMPTY} +@{VIM_VOLUMES} @{EMPTY} *** Test Cases *** Create VNF Descriptors - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_charm_pkg}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_volumes_pkg}' - + [Documentation] Upload VNF packages for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_CHARM_PKG}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_VOLUMES_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get NS Id + [Documentation] Get NS identifier. [Tags] cleanup - ${variables} Get Variables - IF not "\${ns_id}" in "${variables}" - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${variables}= Get Variables + IF not "\${ns_id}" in ${variables} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} END - Get VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + Variable Should Exist ${NS_ID} msg=NS is not available + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} Log ${vnf_id_list} FOR ${vnf_id} IN @{vnf_id_list} Log ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} - Append To List ${vim_vdus} @{vdu_ids} + Append To List ${VIM_VDUS} @{vdu_ids} END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Get Volume VNF Info - Variable Should Exist ${ns_id} msg=NS is not available - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_several_index} + [Documentation] Get VDU ID, IP addresses and volumes of the VNF and stores them in suite variables to be used later on. + Variable Should Exist ${NS_ID} msg=NS is not available + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_SEVERAL_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_volumes_ip_addr} ${ip_addr} - - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_several_index} - Set Suite Variable ${vnf_volumes_id} ${vnf_id} + Set Suite Variable ${VNF_VOLUMES_IP_ADDR} ${ip_addr} + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_SEVERAL_INDEX} + Set Suite Variable ${VNF_VOLUMES_ID} ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} - Set Suite Variable ${vdu_volumes_id} ${id} - Log ${vdu_volumes_id} - - @{volumes_ip_list}= Get Vnf Vdur IPs ${vnf_volumes_id} - Set Suite Variable @{volumes_ip_list} @{volumes_ip_list} - Log @{volumes_ip_list} - + Set Suite Variable ${VDU_VOLUMES_ID} ${id} + Log ${VDU_VOLUMES_ID} + @{VOLUMES_IP_LIST}= Get Vnf Vdur IPs ${VNF_VOLUMES_ID} + Set Suite Variable @{VOLUMES_IP_LIST} @{VOLUMES_IP_LIST} + Log @{VOLUMES_IP_LIST} Get Volumes Info - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_volumes_name} --literal | yq '.vdu[0]."virtual-storage-desc" | length' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + [Documentation] Get number of volumes from the VNF descriptor and get the attached volumes from the VDU instance. + ${rc} ${stdout}= Run And Return RC And Output osm vnfpkg-show ${VNFD_VOLUMES_NAME} --literal | yq '.vdu[0]."virtual-storage-desc" | length' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False ${num_virtual_storage}= Convert To Integer ${stdout} - Set Suite Variable ${vnf_num_volumes} ${num_virtual_storage} - Log ${vnf_num_volumes} - ${volumes_attached}= Get Server Property ${vdu_volumes_id} volumes_attached + Set Suite Variable ${VNF_NUM_VOLUMES} ${num_virtual_storage} + Log ${VNF_NUM_VOLUMES} + ${volumes_attached}= Get Server Property ${VDU_VOLUMES_ID} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 - Set Suite Variable ${volume_id} ${match}[0] - + Set Suite Variable ${VOLUME_ID} ${match}[0] Check VDU Disks - Variable Should Exist ${vnf_volumes_ip_addr} msg=VNF is not available + [Documentation] Check that the number of disks in the VDU meets the expected one. + Variable Should Exist ${VNF_VOLUMES_IP_ADDR} msg=VNF is not available Sleep 20 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf_volumes_ip_addr} ${username} ${password} ${privatekey} sudo lsblk -l + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF_VOLUMES_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} sudo lsblk -l Log ${stdout} ${lines}= Get Lines Containing String ${stdout} disk ${num_lines}= Get Line Count ${lines} - Run Keyword If ${num_lines} < ${vnf_num_volumes} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${vnf_num_volumes}) - + IF ${num_lines} < ${VNF_NUM_VOLUMES} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${VNF_NUM_VOLUMES}) Delete Persistent Volume VDU - Variable Should Exist ${vdu_volumes_id} msg=VDU is not available - Delete Server ${vdu_volumes_id} + [Documentation] Manually delete the VM in Openstack. + Variable Should Exist ${VDU_VOLUMES_ID} msg=VDU is not available + Delete Server ${VDU_VOLUMES_ID} Sleep 20 - Heal Persistent Volume VDU - Variable Should Exist ${vnf_volumes_id} msg=VNF is not available - Heal Network Service ${ns_id} --vnf ${vnf_volumes_id} --cause "Heal VM of volumes_vnf" --vdu ${vdu_volumes_name} - + [Documentation] Manually heal the VNF in order to re-create the deleted VM. + Variable Should Exist ${VNF_VOLUMES_ID} msg=VNF is not available + Heal Network Service ${NS_ID} --vnf ${VNF_VOLUMES_ID} --cause "Heal VM of volumes_vnf" --vdu ${VDU_VOLUMES_NAME} Check VNF After Healing - Variable Should Exist ${vnf_volumes_id} msg=VNF is not available - - @{ip_list}= Get Vnf Vdur IPs ${vnf_volumes_id} + [Documentation] Check that the IDs of the VM and volumes have not changed after healing. + Variable Should Exist ${VNF_VOLUMES_ID} msg=VNF is not available + @{ip_list}= Get Vnf Vdur IPs ${VNF_VOLUMES_ID} Log @{ip_list} - Should Be Equal ${ip_list} ${volumes_ip_list} IP addresses have changed after healing - - ${id}= Get VNF VIM ID ${vnf_volumes_id} + Should Be Equal ${ip_list} ${VOLUMES_IP_LIST} IP addresses have changed after healing + ${id}= Get VNF VIM ID ${VNF_VOLUMES_ID} Log ${id} - Should Not Be Equal ${id} ${vdu_volumes_id} VDU id has not changed after healing - + Should Not Be Equal ${id} ${VDU_VOLUMES_ID} VDU id has not changed after healing ${volumes_attached}= Get Server Property ${id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 - Should Be Equal ${match}[0] ${volume_id} Volume id has changed after healing - + Should Be Equal ${match}[0] ${VOLUME_ID} Volume id has changed after healing Sleep 30 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${vnf_volumes_ip_addr} ${username} ${password} ${privatekey} sudo lsblk -l + ${stdout}= Execute Remote Command Check Rc Return Output ${VNF_VOLUMES_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} sudo lsblk -l Log ${stdout} ${lines}= Get Lines Containing String ${stdout} disk ${num_lines}= Get Line Count ${lines} - Run Keyword If ${num_lines} < ${vnf_num_volumes} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${vnf_num_volumes}) - + IF ${num_lines} < ${VNF_NUM_VOLUMES} Fail msg=Number of disks (${num_lines}) is less than specified in VDU (${VNF_NUM_VOLUMES}) Update VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + ... This is done again to guarantee that all objects are cleaned in the VIM in case the heal operation + ... added new objects. + Variable Should Exist ${NS_ID} msg=NS is not available @{vdu_updated}= Create List - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} FOR ${vnf_id} IN @{vnf_id_list} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} Append To List ${vdu_updated} @{vdu_ids} FOR ${id} IN @{vdu_ids} - IF not "${id}" in "@{vim_vdus}" - Append To List ${vim_vdus} ${id} + IF not ${id} in @{VIM_VDUS} + Append To List ${VIM_VDUS} ${id} END END END @@ -197,64 +196,65 @@ Update VIM Objects ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptors + [Documentation] Delete VNF packages from OSM. [Tags] cleanup - Delete VNFD ${vnfd_volumes_name} - Delete VNFD ${vnfd_charm_name} - + Delete VNFD ${VNFD_VOLUMES_NAME} + Delete VNFD ${VNFD_CHARM_NAME} -Delete Objects in VIM +Delete Remaining Objects in VIM + [Documentation] Delete any remaining objects (volumes, VMs, etc.) in the VIM. [Tags] cleanup + Delete Objects In VIM + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suite Cleanup: Deleting Descriptor, instance and vim + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_VOLUMES_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_CHARM_NAME} + Run Keyword If Any Tests Failed Delete Objects In VIM + +Delete Objects In VIM + [Documentation] Clean up remaining VMs and volumes directly from the VIM. ${error}= Set Variable 0 - FOR ${vol_id} IN @{vim_volumes} + FOR ${vol_id} IN @{VIM_VOLUMES} Log Checking if volume ${vol_id} is still in VIM ${exists}= Check If Volume Exists ${vol_id} - IF ${exists}!=0 + IF ${exists} ${error}= Set Variable 1 Log Deleting volume ${vol_id} Run Keyword And Ignore Error Delete Volume ${vol_id} END END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} Log Checking if server ${vdu_id} is still in VIM ${status}= Run Keyword And Ignore Error Get Server Property ${vdu_id} id Log ${status}[0] - IF '${status}[0]' == 'PASS' + IF ${status}[0] == 'PASS' ${error}= Set Variable 1 Log Deleting server ${vdu_id} Run Keyword And Ignore Error Delete Server ${vdu_id} END END - IF ${error}==1 - Fail Some objects created by test were not deleted in VIM - END - - -*** Keywords *** -Suite Cleanup - [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name} - Run Keyword If Any Tests Failed Delete Objects in VIM + IF ${error}==1 Fail Some objects created by test were not deleted in VIM diff --git a/robot-systest/testsuite/heal_02-scale_vdu_healing.robot b/robot-systest/testsuite/heal_02-scale_vdu_healing.robot index 86886ef..dec7572 100644 --- a/robot-systest/testsuite/heal_02-scale_vdu_healing.robot +++ b/robot-systest/testsuite/heal_02-scale_vdu_healing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HEAL-02] Healing of scaled charm VDUs @@ -19,177 +21,177 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags heal_02 cluster_heal daily +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags heal_02 cluster_heal daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_volumes_pkg} several_volumes_vnf -${vnfd_volumes_name} several_volumes-vnf -${vdu_volumes_name} several_volumes-VM -${vnf_several_index} several_volumes_vnf -${vnfd_charm_pkg} charm-packages/native_manual_scale_charm_vnf -${vnfd_charm_name} native_manual_scale_charm-vnf -${vdu_charm_name} mgmtVM -${vnf_charm_index} charm_vnf -${vnf_charm_scaling_group} manual-scaling_mgmtVM -${vnf_charm_cloudinit_file} /root/helloworld.txt -${vnf_charm_day1_file} /home/ubuntu/first-touch -${nsd_pkg} volumes_nativecharm_ns -${nsd_name} volumes_nativecharm-ns +${VNFD_VOLUMES_PKG} several_volumes_vnf +${VNFD_VOLUMES_NAME} several_volumes-vnf +${VDU_VOLUMES_NAME} several_volumes-VM +${VNF_SEVERAL_INDEX} several_volumes_vnf +${VNFD_CHARM_PKG} charm-packages/native_manual_scale_charm_vnf +${VNFD_CHARM_NAME} native_manual_scale_charm-vnf +${VDU_CHARM_NAME} mgmtVM +${VNF_CHARM_INDEX} charm_vnf +${VNF_CHARM_SCALING_GROUP} manual-scaling_mgmtVM +${VNF_CHARM_CLOUDINIT_FILE} /root/helloworld.txt +${VNF_CHARM_DAY1_FILE} /home/ubuntu/first-touch +${NSD_PKG} volumes_nativecharm_ns +${NSD_NAME} volumes_nativecharm-ns # NS instance name and configuration -${flavor_name_prefix} osm.heal02 -${ns_name} heal_02 -${ns_timeout} 6min -${scale_wait_time} 5min +${FLAVOR_NAME_PREFIX} osm.heal02 +${NS_NAME} heal_02 +${NS_TIMEOUT} 6min +${SCALE_WAIT_TIME} 5min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 -@{vim_vdus} @{EMPTY} -@{vim_volumes} @{EMPTY} +@{VIM_VDUS} @{EMPTY} +@{VIM_VOLUMES} @{EMPTY} *** Test Cases *** Create VNF Descriptors - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_charm_pkg}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_volumes_pkg}' - + [Documentation] Upload VNF packages for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_CHARM_PKG}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_VOLUMES_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Create Test Flavor + [Documentation] Create a flavor that will be used at NS instantiation time and save it as FLAVOR_ID. ${rand}= Generate Random String 6 [NUMBERS] - ${flavor_name}= Catenate SEPARATOR=_ ${flavor_name_prefix} ${rand} + ${flavor_name}= Catenate SEPARATOR=_ ${FLAVOR_NAME_PREFIX} ${rand} ${id}= Create Flavor ${flavor_name} 1 1024 10 - Set Suite Variable ${flavor_id} ${id} - + Set Suite Variable ${FLAVOR_ID} ${id} Network Service Instance Test - ${ns_config}= Set Variable {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}],vnf: [ {member-vnf-index: charm_vnf, vdu: [{ id: mgmtVM, vim-flavor-id: ${flavor_id}}]}] } - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite using the previously created flavor. + ${ns_config}= Set Variable {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}],vnf: [ {member-vnf-index: charm_vnf, vdu: [{ id: mgmtVM, vim-flavor-id: ${FLAVOR_ID}}]}] } + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${ns_config} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get NS Id + [Documentation] Get NS identifier. [Tags] cleanup - ${variables} Get Variables - IF not "\${ns_id}" in "${variables}" - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${variables}= Get Variables + IF not "\${ns_id}" in ${variables} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} END - Scale Out Charm VNF - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index} - Set Suite Variable ${vnf_charm_id} ${vnf_id} - @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id} + [Documentation] Perform a manual scale-out operation of the charm VNF. + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_CHARM_INDEX} + Set Suite Variable ${VNF_CHARM_ID} ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_CHARM_ID} ${vdurs}= Get Length ${vdur_list} - Set Suite Variable ${initial_vdur_count} ${vdurs} - Execute Manual VNF Scale ${ns_name} ${vnf_charm_index} ${vnf_charm_scaling_group} SCALE_OUT ${scale_wait_time} - @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id} + Set Suite Variable ${INITIAL_VDUR_COUNT} ${vdurs} + Execute Manual VNF Scale ${NS_NAME} ${VNF_CHARM_INDEX} ${VNF_CHARM_SCALING_GROUP} SCALE_OUT ${SCALE_WAIT_TIME} + @{vdur_list}= Get Vnf Vdur Names ${VNF_CHARM_ID} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out Get VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + Variable Should Exist ${NS_ID} msg=NS is not available + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} Log ${vnf_id_list} FOR ${vnf_id} IN @{vnf_id_list} Log ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} - Append To List ${vim_vdus} @{vdu_ids} + Append To List ${VIM_VDUS} @{vdu_ids} END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Get Charm VNF Info - Variable Should Exist ${ns_id} msg=NS is not available - ${variables} Get Variables - IF not "\${vnf_charm_id}" in "${variables}" - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index} - Set Suite Variable ${vnf_charm_id} ${vnf_id} + [Documentation] Get VDU ID and IP addresses of the charm VNF and stores them in VDU_CHARM_IDS and CHARM_IP_LIST. + Variable Should Exist ${NS_ID} msg=NS is not available + ${variables}= Get Variables + IF not "\${vnf_charm_id}" in ${variables} + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_CHARM_INDEX} + Set Suite Variable ${VNF_CHARM_ID} ${vnf_id} END - ${id}= Get VNF VIM ID ${vnf_charm_id} - @{vdu_charm_ids}= Split String ${id} - Set Suite Variable @{vdu_charm_ids} @{vdu_charm_ids} - Log ${vdu_charm_ids}[1] - @{charm_ip_list}= Get Vnf Vdur IPs ${vnf_charm_id} - Set Suite Variable @{charm_ip_list} @{charm_ip_list} - + ${id}= Get VNF VIM ID ${VNF_CHARM_ID} + @{VDU_CHARM_IDS}= Split String ${id} + Set Suite Variable @{VDU_CHARM_IDS} @{VDU_CHARM_IDS} + Log ${VDU_CHARM_IDS}[1] + @{CHARM_IP_LIST}= Get Vnf Vdur IPs ${VNF_CHARM_ID} + Set Suite Variable @{CHARM_IP_LIST} @{CHARM_IP_LIST} Halt Charm VDU - Variable Should Exist @{vdu_charm_ids} msg=VDU is not available - Halt Server ${vdu_charm_ids}[1] + [Documentation] Halt one of the VM of the charm VNF. + Variable Should Exist @{VDU_CHARM_IDS} msg=VDU is not available + Halt Server ${VDU_CHARM_IDS}[1] Sleep 15 - Heal Charm VDU - Variable Should Exist ${vnf_charm_id} msg=VNF is not available - Heal Network Service ${ns_id} --vnf ${vnf_charm_id} --cause "Heal VM of charm_vnf" --vdu ${vdu_charm_name} --count-index 1 --run-day1 - + [Documentation] Heal manually via OSM commands all stopped VMs . They should be started again. + Variable Should Exist ${VNF_CHARM_ID} msg=VNF is not available + Heal Network Service ${NS_ID} --vnf ${VNF_CHARM_ID} --cause "Heal VM of charm_vnf" --vdu ${VDU_CHARM_NAME} --count-index 1 --run-day1 Check VNF After Healing - Variable Should Exist ${vnf_charm_id} msg=VNF is not available - - @{ip_list}= Get Vnf Vdur IPs ${vnf_charm_id} - Should Be Equal ${ip_list} ${charm_ip_list} IP addresses have changed after healing - - ${id}= Get VNF VIM ID ${vnf_charm_id} + [Documentation] Check that the IDs of the VM and volumes have not changed after healing. + Variable Should Exist ${VNF_CHARM_ID} msg=VNF is not available + @{ip_list}= Get Vnf Vdur IPs ${VNF_CHARM_ID} + Should Be Equal ${ip_list} ${CHARM_IP_LIST} IP addresses have changed after healing + ${id}= Get VNF VIM ID ${VNF_CHARM_ID} @{ids}= Split String ${id} - Should Be Equal ${vdu_charm_ids}[0] ${ids}[0] VDU[0] id has changed after healing - Should Not Be Equal ${vdu_charm_ids}[1] ${ids}[1] VDU[1] id has not changed after healing - Should Be Equal ${vdu_charm_ids}[2] ${ids}[2] VDU[2] id has changed after healing - - ${ip}= Get Vdu Attribute ${vnf_charm_id} ip-address 1 - ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${username} ${password} ${privatekey} sudo ls ${vnf_charm_cloudinit_file} + Should Be Equal ${VDU_CHARM_IDS}[0] ${ids}[0] VDU[0] id has changed after healing + Should Not Be Equal ${VDU_CHARM_IDS}[1] ${ids}[1] VDU[1] id has not changed after healing + Should Be Equal ${VDU_CHARM_IDS}[2] ${ids}[2] VDU[2] id has changed after healing + ${ip}= Get Vdu Attribute ${VNF_CHARM_ID} ip-address 1 + ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} sudo ls ${VNF_CHARM_CLOUDINIT_FILE} Log ${stdout} - Check If remote File Exists ${ip} ${username} ${password} ${privatekey} ${vnf_charm_day1_file} - ${vim_info}= Get Vdu Attribute ${vnf_charm_id} vim_info 1 - Should Contain ${vim_info} id: ${flavor_id} msg=Flavor ID is incorrect - + Check If Remote File Exists ${ip} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${VNF_CHARM_DAY1_FILE} + ${vim_info}= Get Vdu Attribute ${VNF_CHARM_ID} vim_info 1 + Should Contain ${vim_info} id: ${FLAVOR_ID} msg=Flavor ID is incorrect Update VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + ... This is done again to guarantee that all objects are cleaned in the VIM in case the heal operation + ... added new objects. + Variable Should Exist ${NS_ID} msg=NS is not available @{vdu_updated}= Create List - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} FOR ${vnf_id} IN @{vnf_id_list} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} Append To List ${vdu_updated} @{vdu_ids} FOR ${id} IN @{vdu_ids} - IF not "${id}" in "@{vim_vdus}" - Append To List ${vim_vdus} ${id} + IF not ${id} in @{VIM_VDUS} + Append To List ${VIM_VDUS} ${id} END END END @@ -197,49 +199,63 @@ Update VIM Objects ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptors + [Documentation] Delete VNF packages from OSM. [Tags] cleanup - Delete VNFD ${vnfd_volumes_name} - Delete VNFD ${vnfd_charm_name} - + Delete VNFD ${VNFD_VOLUMES_NAME} + Delete VNFD ${VNFD_CHARM_NAME} -Delete Objects in VIM +Delete Remaining Objects In VIM + [Documentation] Delete any remaining objects (volumes, VMs, etc.) in the VIM. [Tags] cleanup - Delete Flavor ${flavor_id} + Delete Objects In VIM + + +*** Keywords *** +Suite Cleanup + [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_VOLUMES_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_CHARM_NAME} + Run Keyword If Any Tests Failed Delete Objects In VIM + +Delete Objects In VIM + [Documentation] Clean up remaining VMs and volumes directly from the VIM. + Delete Flavor ${FLAVOR_ID} ${error}= Set Variable 0 - FOR ${vol_id} IN @{vim_volumes} + FOR ${vol_id} IN @{VIM_VOLUMES} Log Checking if volume ${vol_id} is still in VIM ${exists}= Check If Volume Exists ${vol_id} - IF ${exists}!=0 + IF ${exists} ${error}= Set Variable 1 Log Deleting volume ${vol_id} Run Keyword And Ignore Error Delete Volume ${vol_id} END END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} Log Checking if server ${vdu_id} is still in VIM ${status}= Run Keyword And Ignore Error Get Server Property ${vdu_id} id Log ${status}[0] - IF '${status}[0]' == 'PASS' + IF ${status}[0] == 'PASS' ${error}= Set Variable 1 Log Deleting server ${vdu_id} Run Keyword And Ignore Error Delete Server ${vdu_id} @@ -248,14 +264,3 @@ Delete Objects in VIM IF ${error}==1 Fail Some objects created by test were not deleted in VIM END - - -*** Keywords *** -Suite Cleanup - [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name} - Run Keyword If Any Tests Failed Delete Objects in VIM diff --git a/robot-systest/testsuite/heal_03-multiple_healing.robot b/robot-systest/testsuite/heal_03-multiple_healing.robot index f52bb95..93b3851 100644 --- a/robot-systest/testsuite/heal_03-multiple_healing.robot +++ b/robot-systest/testsuite/heal_03-multiple_healing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HEAL-03] Healing of multiple VDUs @@ -19,188 +21,187 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot - -Force Tags heal_03 cluster_heal daily +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource +Test Tags heal_03 cluster_heal daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_volumes_pkg} several_volumes_vnf -${vnfd_volumes_name} several_volumes-vnf -${vdu_volumes_name} several_volumes-VM -${vnf_several_index} several_volumes_vnf -${vnfd_charm_pkg} charm-packages/native_manual_scale_charm_vnf -${vnfd_charm_name} native_manual_scale_charm-vnf -${vdu_charm_name} mgmtVM -${vnf_charm_index} charm_vnf -${vnf_charm_scaling_group} manual-scaling_mgmtVM -${vnf_charm_cloudinit_file} /root/helloworld.txt -${vnf_charm_day1_file} /home/ubuntu/first-touch -${nsd_pkg} volumes_nativecharm_ns -${nsd_name} volumes_nativecharm-ns +${VNFD_VOLUMES_PKG} several_volumes_vnf +${VNFD_VOLUMES_NAME} several_volumes-vnf +${VDU_VOLUMES_NAME} several_volumes-VM +${VNF_SEVERAL_INDEX} several_volumes_vnf +${VNFD_CHARM_PKG} charm-packages/native_manual_scale_charm_vnf +${VNFD_CHARM_NAME} native_manual_scale_charm-vnf +${VDU_CHARM_NAME} mgmtVM +${VNF_CHARM_INDEX} charm_vnf +${VNF_CHARM_SCALING_GROUP} manual-scaling_mgmtVM +${VNF_CHARM_CLOUDINIT_FILE} /root/helloworld.txt +${VNF_CHARM_DAY1_FILE} /home/ubuntu/first-touch +${NSD_PKG} volumes_nativecharm_ns +${NSD_NAME} volumes_nativecharm-ns # NS instance name and configuration -${ns_name} heal_03 -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 6min -${scale_wait_time} 5min +${NS_NAME} heal_03 +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 6min +${SCALE_WAIT_TIME} 5min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 -@{vim_vdus} @{EMPTY} -@{vim_volumes} @{EMPTY} +@{VIM_VDUS} @{EMPTY} +@{VIM_VOLUMES} @{EMPTY} *** Test Cases *** Create VNF Descriptors - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_charm_pkg}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_volumes_pkg}' - + [Documentation] Upload VNF packages for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_CHARM_PKG}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_VOLUMES_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get NS Id + [Documentation] Get NS identifier and stores as suite variable to be used later on. [Tags] cleanup - ${variables} Get Variables - IF not "\${ns_id}" in "${variables}" - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${variables}= Get Variables + IF not "\${ns_id}" in ${variables} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} END - Scale Out Charm VNF - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index} - Set Suite Variable ${vnf_charm_id} ${vnf_id} - @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id} + [Documentation] Perform a manual scale-out operation of the charm VNF. + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_CHARM_INDEX} + Set Suite Variable ${VNF_CHARM_ID} ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_CHARM_ID} ${vdurs}= Get Length ${vdur_list} - Set Suite Variable ${initial_vdur_count} ${vdurs} - Execute Manual VNF Scale ${ns_name} ${vnf_charm_index} ${vnf_charm_scaling_group} SCALE_OUT ${scale_wait_time} - @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id} + Set Suite Variable ${INITIAL_VDUR_COUNT} ${vdurs} + Execute Manual VNF Scale ${NS_NAME} ${VNF_CHARM_INDEX} ${VNF_CHARM_SCALING_GROUP} SCALE_OUT ${SCALE_WAIT_TIME} + @{vdur_list}= Get Vnf Vdur Names ${VNF_CHARM_ID} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} != ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out - + IF ${vdurs} != ${INITIAL_VDUR_COUNT} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out Get VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + Variable Should Exist ${NS_ID} msg=NS is not available + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} Log ${vnf_id_list} FOR ${vnf_id} IN @{vnf_id_list} Log ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} - Append To List ${vim_vdus} @{vdu_ids} + Append To List ${VIM_VDUS} @{vdu_ids} END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Get Charm VNF Info - Variable Should Exist ${ns_id} msg=NS is not available - ${variables} Get Variables - IF not "\${vnf_charm_id}" in "${variables}" - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index} - Set Suite Variable ${vnf_charm_id} ${vnf_id} + [Documentation] Get VDU ID and IP addresses of the charm VNF and stores them in VDU_CHARM_IDS and CHARM_IP_LIST. + Variable Should Exist ${NS_ID} msg=NS is not available + ${variables}= Get Variables + IF not "\${vnf_charm_id}" in ${variables} + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_CHARM_INDEX} + Set Suite Variable ${VNF_CHARM_ID} ${vnf_id} END - ${id}= Get VNF VIM ID ${vnf_charm_id} + ${id}= Get VNF VIM ID ${VNF_CHARM_ID} @{vdu_charm_ids}= Split String ${id} - Set Suite Variable @{vdu_charm_ids} @{vdu_charm_ids} - Log ${vdu_charm_ids}[1] - @{charm_ip_list}= Get Vnf Vdur IPs ${vnf_charm_id} - Set Suite Variable @{charm_ip_list} @{charm_ip_list} - + Set Suite Variable @{VDU_CHARM_IDS} @{vdu_charm_ids} + Log ${VDU_CHARM_IDS}[1] + @{charm_ip_list}= Get Vnf Vdur IPs ${VNF_CHARM_ID} + Set Suite Variable @{CHARM_IP_LIST} @{charm_ip_list} Get Volume VNF Info - Variable Should Exist ${ns_id} msg=NS is not available - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_several_index} + [Documentation] Get info about volumes and VM of the VNF with several volumes and stores them in suite variables. + Variable Should Exist ${NS_ID} msg=NS is not available + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_SEVERAL_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_volumes_ip_addr} ${ip_addr} - - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_several_index} - Set Suite Variable ${vnf_volumes_id} ${vnf_id} + Set Suite Variable ${VNF_VOLUMES_IP_ADDR} ${ip_addr} + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_SEVERAL_INDEX} + Set Suite Variable ${VNF_VOLUMES_ID} ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} - Set Suite Variable ${vdu_volumes_id} ${id} - Log ${vdu_volumes_id} - - @{volumes_ip_list}= Get Vnf Vdur IPs ${vnf_volumes_id} - Set Suite Variable @{volumes_ip_list} @{volumes_ip_list} - Log @{volumes_ip_list} - + Set Suite Variable ${VDU_VOLUMES_ID} ${id} + Log ${VDU_VOLUMES_ID} + @{volumes_ip_list}= Get Vnf Vdur IPs ${VNF_VOLUMES_ID} + Set Suite Variable @{VOLUMES_IP_LIST} @{volumes_ip_list} + Log @{VOLUMES_IP_LIST} Stop VDUs - Variable Should Exist @{vdu_charm_ids} msg=Charm VDUs are not available - Variable Should Exist ${vdu_volumes_id} msg=Volume VDU is not available - Stop Server ${vdu_charm_ids}[1] - Stop Server ${vdu_charm_ids}[2] - Stop Server ${vdu_volumes_id} + [Documentation] Stop all VMs. + Variable Should Exist @{VDU_CHARM_IDS} msg=Charm VDUs are not available + Variable Should Exist ${VDU_VOLUMES_ID} msg=Volume VDU is not available + Stop Server ${VDU_CHARM_IDS}[1] + Stop Server ${VDU_CHARM_IDS}[2] + Stop Server ${VDU_VOLUMES_ID} Sleep 30 - Heal VDUs - Variable Should Exist ${vnf_charm_id} msg=Charm VNF is not available - Variable Should Exist ${vnf_volumes_id} msg=Volume VNF is not available - Heal Network Service ${ns_id} --vnf ${vnf_volumes_id} --cause "Heal myvdu1 of several_volumes_vnf" --vdu several_volumes-VM --vnf ${vnf_charm_id} --cause "Heal two VMs of native_manual_scale_charm_vnf" --vdu mgmtVM --count-index 1 --run-day1 --vdu mgmtVM --count-index 2 - + [Documentation] Heal manually via OSM commands all stopped VMs . They should be started again. + Variable Should Exist ${VNF_CHARM_ID} msg=Charm VNF is not available + Variable Should Exist ${VNF_VOLUMES_ID} msg=Volume VNF is not available + Heal Network Service ${NS_ID} --vnf ${VNF_VOLUMES_ID} --cause "Heal myvdu1 of several_volumes_vnf" --vdu several_volumes-VM --vnf ${VNF_CHARM_ID} --cause "Heal two VMs of native_manual_scale_charm_vnf" --vdu mgmtVM --count-index 1 --run-day1 --vdu mgmtVM --count-index 2 Check VNFs After Healing - Variable Should Exist ${vnf_charm_id} msg=Charm VNF is not available - Variable Should Exist ${vnf_volumes_id} msg=Volume VNF is not available - ${id}= Get VNF VIM ID ${vnf_charm_id} + [Documentation] Check that the IDs of the VM and volumes have not changed after healing. + Variable Should Exist ${VNF_CHARM_ID} msg=Charm VNF is not available + Variable Should Exist ${VNF_VOLUMES_ID} msg=Volume VNF is not available + ${id}= Get VNF VIM ID ${VNF_CHARM_ID} @{ids}= Split String ${id} - Should Be Equal ${vdu_charm_ids}[0] ${ids}[0] VDU[0] id has changed after healing - Should Not Be Equal ${vdu_charm_ids}[1] ${ids}[1] VDU[1] id has not changed after healing - Should Not Be Equal ${vdu_charm_ids}[2] ${ids}[2] VDU[2] id has not changed after healing - - ${id}= Get VNF VIM ID ${vnf_volumes_id} - Should Not Be Equal ${id} ${vdu_volumes_id} VDU id has not changed after healing - - ${ip}= Get Vdu Attribute ${vnf_charm_id} ip-address 1 - ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${username} ${password} ${privatekey} sudo ls ${vnf_charm_cloudinit_file} + Should Be Equal ${VDU_CHARM_IDS}[0] ${ids}[0] VDU[0] id has changed after healing + Should Not Be Equal ${VDU_CHARM_IDS}[1] ${ids}[1] VDU[1] id has not changed after healing + Should Not Be Equal ${VDU_CHARM_IDS}[2] ${ids}[2] VDU[2] id has not changed after healing + ${id}= Get VNF VIM ID ${VNF_VOLUMES_ID} + Should Not Be Equal ${id} ${VDU_VOLUMES_ID} VDU id has not changed after healing + ${ip}= Get Vdu Attribute ${VNF_CHARM_ID} ip-address 1 + ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} sudo ls ${VNF_CHARM_CLOUDINIT_FILE} Log ${stdout} - Check If remote File Exists ${ip} ${username} ${password} ${privatekey} ${vnf_charm_day1_file} - + Check If Remote File Exists ${ip} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${VNF_CHARM_DAY1_FILE} Update VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + ... This is done again to guarantee that all objects are cleaned in the VIM in case the heal operation + ... added new objects. + Variable Should Exist ${NS_ID} msg=NS is not available @{vdu_updated}= Create List - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} FOR ${vnf_id} IN @{vnf_id_list} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} Append To List ${vdu_updated} @{vdu_ids} FOR ${id} IN @{vdu_ids} - IF not "${id}" in "@{vim_vdus}" - Append To List ${vim_vdus} ${id} + IF not ${id} in @{VIM_VDUS} + Append To List ${VIM_VDUS} ${id} END END END @@ -208,48 +209,48 @@ Update VIM Objects ${volumes_attached}= Get Server Property ${vdu_id} volumes_attached ${match}= Get Regexp Matches ${volumes_attached} '([0-9a-f\-]+)' 1 IF ${match} != @{EMPTY} - IF not "${match}[0]" in "@{vim_volumes}" - Append To List ${vim_volumes} ${match}[0] + IF not ${match}[0] in @{VIM_VOLUMES} + Append To List ${VIM_VOLUMES} ${match}[0] END END END - Log Many @{vim_vdus} - Log Many @{vim_volumes} - + Log Many @{VIM_VDUS} + Log Many @{VIM_VOLUMES} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptors + [Documentation] Delete VNF packages from OSM. [Tags] cleanup - Delete VNFD ${vnfd_volumes_name} - Delete VNFD ${vnfd_charm_name} + Delete VNFD ${VNFD_VOLUMES_NAME} + Delete VNFD ${VNFD_CHARM_NAME} - -Delete Objects in VIM +Delete Objects In VIM + [Documentation] Delete any remaining objects (volumes, VMs, etc.) in the VIM. [Tags] cleanup ${error}= Set Variable 0 - FOR ${vol_id} IN @{vim_volumes} + FOR ${vol_id} IN @{VIM_VOLUMES} Log Checking if volume ${vol_id} is still in VIM ${exists}= Check If Volume Exists ${vol_id} - IF ${exists}!=0 + IF ${exists} ${error}= Set Variable 1 Log Deleting volume ${vol_id} Run Keyword And Ignore Error Delete Volume ${vol_id} END END - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} Log Checking if server ${vdu_id} is still in VIM ${status}= Run Keyword And Ignore Error Get Server Property ${vdu_id} id Log ${status}[0] - IF '${status}[0]' == 'PASS' + IF ${status}[0] == 'PASS' ${error}= Set Variable 1 Log Deleting server ${vdu_id} Run Keyword And Ignore Error Delete Server ${vdu_id} @@ -263,8 +264,7 @@ Delete Objects in VIM *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_VOLUMES_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_CHARM_NAME} diff --git a/robot-systest/testsuite/heal_04-autohealing.robot b/robot-systest/testsuite/heal_04-autohealing.robot index ada204a..c560194 100644 --- a/robot-systest/testsuite/heal_04-autohealing.robot +++ b/robot-systest/testsuite/heal_04-autohealing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [HEAL-04] Autohealing of NS @@ -19,163 +21,163 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/openstack_lib.resource -Force Tags heal_04 cluster_heal daily +Test Tags heal_04 cluster_heal daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} autoheal_vnf -${vnfd_name} autoheal_vnfd -${vdu_name} autoheal_vnfd-VM -${vnf_index} autoheal-basic-1 -${nsd_pkg} autoheal_ns -${nsd_name} autoheal_nsd +${VNFD_PKG} autoheal_vnf +${VNFD_NAME} autoheal_vnfd +${VDU_NAME} autoheal_vnfd-VM +${VNF_INDEX} autoheal-basic-1 +${NSD_PKG} autoheal_ns +${NSD_NAME} autoheal_nsd # NS instance name and configuration -${ns_name} heal_04 -${ns_config} {vld: [ {name: mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} heal_04 +${NS_CONFIG} {vld: [ {name: mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 -#Healing wait time -${healing_pol_time} 15sec -${healing_max_wait_time} 10m +# Healing wait time +${HEALING_POL_TIME} 15sec +${HEALING_MAX_WAIT_TIME} 10m -@{vim_vdus} @{EMPTY} +@{VIM_VDUS} @{EMPTY} *** Test Cases *** Create VNF Descriptors - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get NS Id + [Documentation] Get NS identifier and stores as suite variable to be used later on. [Tags] cleanup - ${variables} Get Variables - IF not "\${ns_id}" in "${variables}" - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${variables}= Get Variables + IF not "\${ns_id}" in ${variables} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} END - Get VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + [Documentation] Retrieve all VMs and volumes from the NS and stores them in VIM_VDUS and VIM_VOLUMES lists. + Variable Should Exist ${NS_ID} msg=NS is not available + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} Log ${vnf_id_list} FOR ${vnf_id} IN @{vnf_id_list} Log ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} - Append To List ${vim_vdus} @{vdu_ids} + Append To List ${VIM_VDUS} @{vdu_ids} END - Log Many @{vim_vdus} - + Log Many @{VIM_VDUS} Get VNF Info - Variable Should Exist ${ns_id} msg=NS is not available - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_index} + [Documentation] Get VDU ID and IP addresses of the VNF and stores them to be used later on. + Variable Should Exist ${NS_ID} msg=NS is not available + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - - ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_index} - Set Suite Variable ${vnf_autoheal_id} ${vnf_id} + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} + ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_INDEX} + Set Suite Variable ${VNF_AUTOHEAL_ID} ${vnf_id} ${id}= Get VNF VIM ID ${vnf_id} - Set Suite Variable ${vdu_autoheal_id} ${id} - Log ${vdu_autoheal_id} - - @{autoheal_ip_list}= Get Vnf Vdur IPs ${vnf_autoheal_id} - Set Suite Variable @{autoheal_ip_list} @{autoheal_ip_list} - Log @{autoheal_ip_list} - + Set Suite Variable ${VDU_AUTOHEAL_ID} ${id} + Log ${VDU_AUTOHEAL_ID} + @{AUTOHEAL_IP_LIST}= Get Vnf Vdur IPs ${VNF_AUTOHEAL_ID} + Set Suite Variable @{AUTOHEAL_IP_LIST} @{AUTOHEAL_IP_LIST} + Log @{AUTOHEAL_IP_LIST} Stop Autoheal VDU - Variable Should Exist ${vdu_autoheal_id} msg=VDU is not available - Halt Server ${vdu_autoheal_id} + [Documentation] Stop one VM of the VNF. + Variable Should Exist ${VDU_AUTOHEAL_ID} msg=VDU is not available + Halt Server ${VDU_AUTOHEAL_ID} Sleep 30 - Wait For Autohealing To Be Completed - ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number - ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${vim_timeout_multiplier} - Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Get Operations By Type ${ns_id} heal - ${stdout}= Get Operations By Type ${ns_id} heal - Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout} + [Documentation] Wait for auto-healing to be completed. OSM will detect that the VM is down and will re-create it. + ${healing_max_wait_time}= Convert Time ${HEALING_MAX_WAIT_TIME} result_format=number + ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${VIM_TIMEOUT_MULTIPLIER} + Wait Until Keyword Succeeds ${healing_max_wait_time} ${HEALING_POL_TIME} Get Operations By Type ${NS_ID} heal + ${stdout}= Get Operations By Type ${NS_ID} heal + Wait Until Keyword Succeeds ${healing_max_wait_time} ${HEALING_POL_TIME} Check For NS Operation Ended ${stdout} Check For NS Operation Completed ${stdout} - Check VNF After Healing - Variable Should Exist ${vnf_autoheal_id} msg=VNF is not available - - @{ip_list}= Get Vnf Vdur IPs ${vnf_autoheal_id} + [Documentation] Check that the ID of the VM and the IP addresses have not changed after healing. + Variable Should Exist ${VNF_AUTOHEAL_ID} msg=VNF is not available + @{ip_list}= Get Vnf Vdur IPs ${VNF_AUTOHEAL_ID} Log @{ip_list} - Should Be Equal ${ip_list} ${autoheal_ip_list} IP addresses have changed after healing - - ${id}= Get VNF VIM ID ${vnf_autoheal_id} + Should Be Equal ${ip_list} ${AUTOHEAL_IP_LIST} IP addresses have changed after healing + ${id}= Get VNF VIM ID ${VNF_AUTOHEAL_ID} Log ${id} - Should Not Be Equal ${id} ${vdu_autoheal_id} VDU id has not changed after healing - + Should Not Be Equal ${id} ${VDU_AUTOHEAL_ID} VDU id has not changed after healing Update VIM Objects - Variable Should Exist ${ns_id} msg=NS is not available - @{vnf_id_list}= Get Ns Vnf List ${ns_id} + [Documentation] Retrieve all VMs from the NS and stores them in VIM_VDUS. + ... This is done again to guarantee that all objects are cleaned in the VIM in case the heal operation + ... added new objects. + Variable Should Exist ${NS_ID} msg=NS is not available + @{vnf_id_list}= Get Ns Vnf List ${NS_ID} FOR ${vnf_id} IN @{vnf_id_list} ${id}= Get VNF VIM ID ${vnf_id} @{vdu_ids}= Split String ${id} FOR ${id} IN @{vdu_ids} - IF not "${id}" in "@{vim_vdus}" - Append To List ${vim_vdus} ${id} + IF not ${id} in @{VIM_VDUS} + Append To List ${VIM_VDUS} ${id} END END END - Log Many @{vim_vdus} - + Log Many @{VIM_VDUS} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptors + [Documentation] Delete VNF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} - -Delete Objects in VIM +Delete Objects In VIM + [Documentation] Delete any remaining objects (volumes, VMs, etc.) in the VIM. [Tags] cleanup ${error}= Set Variable 0 - FOR ${vdu_id} IN @{vim_vdus} + FOR ${vdu_id} IN @{VIM_VDUS} Log Checking if server ${vdu_id} is still in VIM ${status}= Run Keyword And Ignore Error Get Server Property ${vdu_id} id Log ${status}[0] - IF '${status}[0]' == 'PASS' + IF ${status}[0] == 'PASS' ${error}= Set Variable 1 Log Deleting server ${vdu_id} Run Keyword And Ignore Error Delete Server ${vdu_id} @@ -189,7 +191,6 @@ Delete Objects in VIM *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot index 899aed4..b87a174 100644 --- a/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot +++ b/robot-systest/testsuite/k8s_01-create_k8s_cluster.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-01] Create K8s cluster. @@ -20,148 +22,135 @@ Library String Library Collections Library Process Library SSHLibrary -Library %{ROBOT_DEVOPS_FOLDER}/lib/renderTemplate.py +Library ../lib/renderTemplate.py -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags k8s_01 cluster_k8s +Test Tags k8s_01 cluster_k8s Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package files -${vnfd_pkg1} k8s_jujucontroller_vnf.tar.gz -${vnfd_pkg2} k8s_jujumachine_vnf.tar.gz -${nsd_pkg} k8s_juju_ns.tar.gz -${vnfd_name1} k8s_jujucontroller_vnf -${vnfd_name2} k8s_jujumachine_vnf -${nsd_name} k8s_juju +${VNFD_PKG1} k8s_jujucontroller_vnf.tar.gz +${VNFD_PKG2} k8s_jujumachine_vnf.tar.gz +${NSD_PKG} k8s_juju_ns.tar.gz +${VNFD_NAME1} k8s_jujucontroller_vnf +${VNFD_NAME2} k8s_jujumachine_vnf +${NSD_NAME} k8s_juju # VNF Member indexes -${vnf_member_index_1} k8s_vnf1 -${vnf_member_index_2} k8s_vnf2 -${vnf_member_index_3} k8s_vnf3 -${vnf_member_index_4} k8s_vnf4 -${vnf_member_index_5} k8s_juju - -# Username -${username} ubuntu +${VNF_MEMBER_INDEX_1} k8s_vnf1 +${VNF_MEMBER_INDEX_2} k8s_vnf2 +${VNF_MEMBER_INDEX_3} k8s_vnf3 +${VNF_MEMBER_INDEX_4} k8s_vnf4 +${VNF_MEMBER_INDEX_5} k8s_juju # Kubeconfig file -${kubeconfig_file} /home/ubuntu/.kube/config +${KUBECONFIG_FILE} /home/ubuntu/.kube/config # NS instance name -${ns_name} k8s-cluster +${NS_NAME} k8s-cluster # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} # Template and config file to use -${template} k8s_juju_template.yaml -${config_file} config.yaml +${TEMPLATE} k8s_juju_template.yaml +${CONFIG_FILE} config.yaml *** Test Cases *** Render a template - - ${stdout}= Render template %{ROBOT_DEVOPS_FOLDER}/resources/${template} %{ROBOT_DEVOPS_FOLDER}/resources/${config_file} IP_VM1=%{IP_VM1} IP_VM2=%{IP_VM2} IP_VM3=%{IP_VM3} IP_VM4=%{IP_VM4} IP_JUJU=%{IP_JUJU} NETWORK=%{VIM_MGMT_NET} + [Documentation] Generate from a template the instantiation parameters that will be used for the NS instance. + ${stdout}= Render Template ../resources/${TEMPLATE} ../resources/${CONFIG_FILE} IP_VM1=%{IP_VM1} IP_VM2=%{IP_VM2} IP_VM3=%{IP_VM3} IP_VM4=%{IP_VM4} IP_JUJU=%{IP_JUJU} NETWORK=%{VIM_MGMT_NET} Log To Console \n${stdout} - Create Controller VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg1}' - + [Documentation] Upload first VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG1}' Create Machines VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg2}' - + [Documentation] Upload second VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG2}' Create K8s Cluster NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate K8s Cluster Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ns_config=${EMPTY} publickey=${publickey} ns_launch_max_wait_time=70min config_file=%{ROBOT_DEVOPS_FOLDER}/resources/${config_file} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ns_config=${EMPTY} publickey=${PUBLICKEY} ns_launch_max_wait_time=70min config_file=%{ROBOT_DEVOPS_FOLDER}/resources/${CONFIG_FILE} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + [Documentation] Get the mgmt IP addresses of the five VNF of the NS. + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - ${ip_addr_3} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_3} + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} + ${ip_addr_3}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_3} Log ${ip_addr_3} - Set Suite Variable ${vnf_3_ip_addr} ${ip_addr_3} - ${ip_addr_4} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_4} + Set Suite Variable ${VNF_3_IP_ADDR} ${ip_addr_3} + ${ip_addr_4}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_4} Log ${ip_addr_4} - Set Suite Variable ${vnf_4_ip_addr} ${ip_addr_4} - ${ip_addr_5} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_5} + Set Suite Variable ${VNF_4_IP_ADDR} ${ip_addr_4} + ${ip_addr_5}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_5} Log ${ip_addr_5} - Set Suite Variable ${vnf_5_ip_addr} ${ip_addr_5} - + Set Suite Variable ${VNF_5_IP_ADDR} ${ip_addr_5} Test SSH Access - - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available - Variable Should Exist ${vnf_3_ip_addr} msg=IP address of the management VNF '${vnf_member_index_3}' is not available - Variable Should Exist ${vnf_4_ip_addr} msg=IP address of the management VNF '${vnf_member_index_4}' is not available - Variable Should Exist ${vnf_5_ip_addr} msg=IP address of the management VNF '${vnf_member_index_5}' is not available + [Documentation] Check that the five VNF are accessible via SSH in their respective mgmt IP address. + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available + Variable Should Exist ${VNF_3_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_3}' is not available + Variable Should Exist ${VNF_4_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_4}' is not available + Variable Should Exist ${VNF_5_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_5}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_3_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_4_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_5_ip_addr} ${username} ${password} ${privatekey} - - -Check kubeconfig file - - Check If remote File Exists ${vnf_5_ip_addr} ${username} ${password} ${privatekey} ${kubeconfig_file} + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_3_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_4_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_5_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} +Check Kubeconfig File + [Documentation] Check that the Kubeconfig file of the provisioned cluster is present in the VNF. + Check If Remote File Exists ${VNF_5_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${KUBECONFIG_FILE} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete Controller VNF Descriptor + [Documentation] Delete first VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name1} + Delete VNFD ${VNFD_NAME1} Delete Machines VNF Descriptor + [Documentation] Delete second VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name2} + Delete VNFD ${VNFD_NAME2} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME1} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME2} diff --git a/robot-systest/testsuite/k8s_02-k8scluster_creation.robot b/robot-systest/testsuite/k8s_02-k8scluster_creation.robot index b3b9c86..cb86e37 100644 --- a/robot-systest/testsuite/k8s_02-k8scluster_creation.robot +++ b/robot-systest/testsuite/k8s_02-k8scluster_creation.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-02] K8s cluster addition. @@ -20,47 +22,47 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot +Resource ../lib/k8scluster_lib.resource +Resource ../lib/vim_lib.resource -Variables %{ROBOT_DEVOPS_FOLDER}/resources/basic_01-crud_operations_on_vim_targets_data.py +Variables ../resources/basic_01-crud_operations_on_vim_targets_data.py -Force Tags k8s_02 cluster_k8s daily regression azure +Test Tags k8s_02 cluster_k8s daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # K8s cluster name and version -${k8scluster_name} k8s02 -${k8scluster_version} v1 +${K8SCLUSTER_NAME} k8s02 +${K8SCLUSTER_VERSION} v1 + *** Test Cases *** Create VIM Target Basic [Documentation] Creates a VIM for the K8s cluster to be anchored against - ${rand}= Generate Random String 6 [NUMBERS] - ${vim_name}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} - Set Suite Variable ${vim_name} - ${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} + ${VIM_NAME}= Catenate SEPARATOR=_ ${vim_name_prefix} ${rand} + Set Suite Variable ${VIM_NAME} + ${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} Add K8s Cluster To OSM - - Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} ${vim_name} %{VIM_MGMT_NET} ${k8scluster_name} + [Documentation] Creates a VIM for the K8s cluster to be anchored against + Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} ${VIM_NAME} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME} Remove K8s Cluster from OSM + [Documentation] Delete K8s cluster. [Tags] cleanup - - Delete K8s Cluster ${k8scluster_name} + Delete K8s Cluster ${K8SCLUSTER_NAME} Delete VIM Target By ID [Documentation] Delete the VIM Target created in previous test-case by its ID. ... Checks whether the VIM Target was created or not before perform the deletion. [Tags] cleanup - ${vim_account_id}= Get VIM Target ID ${vim_name} - Should Be Equal As Strings ${vim_account_id} ${created_vim_account_id} + ${vim_account_id}= Get VIM Target ID ${VIM_NAME} + Should Be Equal As Strings ${vim_account_id} ${CREATED_VIM_ACCOUNT_ID} Delete VIM Target ${vim_account_id} @@ -68,4 +70,4 @@ Delete VIM Target By ID Suite Cleanup [Documentation] Test Suit Cleanup: Deleting K8s Cluster - Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name} + Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME} diff --git a/robot-systest/testsuite/k8s_03-simple_k8s.robot b/robot-systest/testsuite/k8s_03-simple_k8s.robot index 99991f9..a6838ea 100644 --- a/robot-systest/testsuite/k8s_03-simple_k8s.robot +++ b/robot-systest/testsuite/k8s_03-simple_k8s.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-03] Simple K8s. @@ -20,76 +22,85 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/package_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_03 cluster_k8s regression azure +Test Tags k8s_03 cluster_k8s regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/native_k8s_charm_vnf -${vnfd_name} native_k8s_charm-vnf -${nsd_pkg} charm-packages/native_k8s_charm_ns -${nsd_name} native_k8s_charm-ns +${VNFD_PKG} charm-packages/native_k8s_charm_vnf +${VNFD_NAME} native_k8s_charm-vnf +${NSD_PKG} charm-packages/native_k8s_charm_ns +${NSD_NAME} native_k8s_charm-ns # NS instance name and configuration -${ns_name} native-k8s -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} native-k8s +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +${NS_ID} ${EMPTY} +${PUBLICKEY} ${EMPTY} +${VNF_MEMBER_INDEX} native_k8s_charm-vnf +${ACTION_NAME} changecontent +${KDU_NAME} native-kdu +${APPLICATION_NAME} nginx +${CUSTOMTITLE} Day 2 Action -${ns_id} ${EMPTY} -${publickey} ${EMPTY} -${vnf_member_index} native_k8s_charm-vnf -${action_name} changecontent -${kdu_name} native-kdu -${application_name} nginx -${customtitle} Day 2 Action *** Test Cases *** Create Simple K8s VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload NF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Simple K8s Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service K8s Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Execute Day 2 Operations [Documentation] Performs one Day 2 operation per VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${action_name} ${vnf_member_index} ${kdu_name} application-name=${application_name} customtitle=${customtitle} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} ${KDU_NAME} application-name=${APPLICATION_NAME} customtitle=${CUSTOMTITLE} + Log ${ns_op_id} Delete NS K8s Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} Delete VNF NS Packages + [Documentation] Delete tar.gz NF and NS package files. [Tags] cleanup - Delete Package '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Delete Package '%{PACKAGES_FOLDER}/${nsd_pkg}' + Delete Package '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Delete Package '%{PACKAGES_FOLDER}/${NSD_PKG}' *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_04-openldap_helm.robot b/robot-systest/testsuite/k8s_04-openldap_helm.robot index 41baac8..74cd4d5 100644 --- a/robot-systest/testsuite/k8s_04-openldap_helm.robot +++ b/robot-systest/testsuite/k8s_04-openldap_helm.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-04] Openldap Helm chart. @@ -18,102 +20,119 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_04 cluster_k8s daily regression sanity azure +Test Tags k8s_04 cluster_k8s daily regression sanity azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} openldap_knf -${vnfd_name} openldap_knf -${nsd_pkg} openldap_ns -${nsd_name} openldap_ns +${VNFD_PKG} openldap_knf +${VNFD_NAME} openldap_knf +${NSD_PKG} openldap_ns +${NSD_NAME} openldap_ns # NS instance name and configuration -${ns_name} ldap -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } +${NS_NAME} ldap +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } + +${NS_ID} ${EMPTY} +${PUBLICKEY} ${EMPTY} +${VNF_MEMBER_INDEX} openldap +${KDU_NAME} ldap +${UPGRADE_ACTION} upgrade +${ROLLBACK_ACTION} rollback +${REPLICA_COUNT} 3 -${ns_id} ${EMPTY} -${publickey} ${EMPTY} -${vnf_member_index} openldap -${kdu_name} ldap -${upgrade_action} upgrade -${rollback_action} rollback -${replica_count} 3 *** Test Cases *** Create Package For OpenLDAP CNF + [Documentation] Upload NF package for the testsuite. [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Package For OpenLDAP NS + [Documentation] Upload NS package for the testsuite. [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Create Network Service Instance + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Log ${id} Get Ns Id + [Documentation] Retrieve NS instance id to be used later on. [Tags] verify - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id + [Documentation] Retrieve NF instance id to be used later on. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Execute Upgrade Operation + [Documentation] Perform OSM action to upgrade the number of replicas of a deployment in the CNF. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${upgrade_action} ${vnf_member_index} ${kdu_name} replicaCount=${replica_count} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} replicaCount=${REPLICA_COUNT} + Log ${ns_op_id} Check Replicas After Upgrade Operation + [Documentation] Check that the number of replicas after the upgrade is the expected one. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${count} - Should Be Equal As Integers ${count} ${replica_count} + Should Be Equal As Integers ${count} ${REPLICA_COUNT} Execute Rollback Operation + [Documentation] Perform OSM action to rollback the previous upgrade of the CNF. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${rollback_action} ${vnf_member_index} ${kdu_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} + Log ${ns_op_id} Check Replicas After Rollback Operation + [Documentation] Check that the number of replcias after the rollback is the expected one. [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${count} Should Be Empty ${count} Delete Network Service Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_05-k8s_proxy_charms.robot b/robot-systest/testsuite/k8s_05-k8s_proxy_charms.robot index f2175fd..be3bb31 100644 --- a/robot-systest/testsuite/k8s_05-k8s_proxy_charms.robot +++ b/robot-systest/testsuite/k8s_05-k8s_proxy_charms.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,132 +11,119 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-05] K8s Proxy Charm. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags k8s_05 cluster_ee_config cluster_k8s_charms regression azure +Test Tags k8s_05 cluster_ee_config cluster_k8s_charms regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/k8s_proxy_charm_vnf -${vnfd_name} k8s_proxy_charm-vnf -${nsd_pkg} charm-packages/k8s_proxy_charm_ns -${nsd_name} k8s_proxy_charm-ns +${VNFD_PKG} charm-packages/k8s_proxy_charm_vnf +${VNFD_NAME} k8s_proxy_charm-vnf +${NSD_PKG} charm-packages/k8s_proxy_charm_ns +${NSD_NAME} k8s_proxy_charm-ns # NS instance name and configuration -${ns_name} k8s_05-k8s_proxy_charm -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} k8s_05-k8s_proxy_charm +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 *** Test Cases *** Create Charm VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + [Documentation] Get the mgmt IP address of the two VNF of the NS. + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} Test SSH Access - - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + [Documentation] Check that both VNF are accessible via SSH in their respective mgmt IP address. + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operations [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operations [Documentation] Performs one Day 2 operation per VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1} - ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_1} filename=${DAY_2_FILE_NAME_1} + Log ${ns_op_id_1} + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_2} filename=${DAY_2_FILE_NAME_2} + Log ${ns_op_id_2} Check Remote Files Created Via Day 2 Operations [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_1} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_2} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete NF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_06-k8s_secure_key_management.robot b/robot-systest/testsuite/k8s_06-k8s_secure_key_management.robot index efec243..d422d32 100644 --- a/robot-systest/testsuite/k8s_06-k8s_secure_key_management.robot +++ b/robot-systest/testsuite/k8s_06-k8s_secure_key_management.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,139 +11,133 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-06] K8s Secure Key Management. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags k8s_06 cluster_ee_config cluster_k8s_charms regression azure +Test Tags k8s_06 cluster_ee_config cluster_k8s_charms regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/nopasswd_k8s_proxy_charm_vnf -${vnfd_name} nopasswd_k8s_proxy_charm-vnf -${nsd_pkg} charm-packages/nopasswd_k8s_proxy_charm_ns -${nsd_name} nopasswd_k8s_proxy_charm-ns +${VNFD_PKG} charm-packages/nopasswd_k8s_proxy_charm_vnf +${VNFD_NAME} nopasswd_k8s_proxy_charm-vnf +${NSD_PKG} charm-packages/nopasswd_k8s_proxy_charm_ns +${NSD_NAME} nopasswd_k8s_proxy_charm-ns # NS instance name and configuration -${ns_name} k8s_06-nopasswd_k8s_proxy_charm -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} k8s_06-nopasswd_k8s_proxy_charm +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 -${ns_timeout} 15min +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 *** Test Cases *** Create Charm VNF Descriptor + [Documentation] Upload VNF package for the testsuite. [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor + [Documentation] Upload NS package for the testsuite. [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service + [Documentation] Instantiate NS for the testsuite. [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Log ${id} Get Ns Id + [Documentation] Get the NS id and save it NS_ID suite variable to use it later on. [Tags] verify - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses + [Documentation] Get the mgmt IP address of the two VNF of the NS. [Tags] verify - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} Test SSH Access + [Documentation] Check that both VNF are accessible via SSH in their respective mgmt IP address. [Tags] verify - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operations - [Tags] verify - [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. + [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${DAY_1_FILE_NAME}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + [Tags] verify + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operations - [Tags] verify [Documentation] Performs one Day 2 operation per VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1} - ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2} - + [Tags] verify + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_1} filename=${DAY_2_FILE_NAME_1} + Log ${ns_op_id_1} + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_2} filename=${DAY_2_FILE_NAME_2} + Log ${ns_op_id_2} Check Remote Files Created Via Day 2 Operations - [Tags] verify [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2} - + [Tags] verify + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_1} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_2} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete NF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_07-dummy_helm.robot b/robot-systest/testsuite/k8s_07-dummy_helm.robot index c37fe4e..59c73ba 100644 --- a/robot-systest/testsuite/k8s_07-dummy_helm.robot +++ b/robot-systest/testsuite/k8s_07-dummy_helm.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-07] Openldap Helm in isolated cluster with dummy VIM. @@ -18,90 +20,101 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vim_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_07 cluster_k8s daily regression azure +Test Tags k8s_07 cluster_k8s daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # VIM Configuration -${vim_name} k8s07_dummy -${vim_user} user -${vim_password} pass -${vim_auth_url} http://localhost/dummy -${vim_tenant} tenant -${vim_account_type} dummy +${VIM_NAME} k8s07_dummy +${VIM_USER} user +${VIM_PASSWORD} pass +${VIM_AUTH_URL} http://localhost/dummy +${VIM_TENANT} tenant +${VIM_ACCOUNT_TYPE} dummy # K8s cluster data -${k8scluster_name} k8s07 -${k8scluster_version} v1 -${k8scluster_net} null +${K8SCLUSTER_NAME} k8s07 +${K8SCLUSTER_VERSION} v1 +${K8SCLUSTER_NET} null # NS and VNF descriptor package files -${vnfd_pkg} openldap_knf -${nsd_pkg} openldap_ns -${vnfd_name} openldap_knf -${nsd_name} openldap_ns +${VNFD_PKG} openldap_knf +${NSD_PKG} openldap_ns +${VNFD_NAME} openldap_knf +${NSD_NAME} openldap_ns # NS instance name -${ns_name} ldap +${NS_NAME} ldap -${ns_id} ${EMPTY} -${ns_config} ${EMPTY} -${publickey} ${EMPTY} +${NS_ID} ${EMPTY} +${NS_CONFIG} ${EMPTY} +${PUBLICKEY} ${EMPTY} *** Test Cases *** Create Package For OpenLDAP CNF - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload NF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Package For OpenLDAP NS - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Create Dummy VIM - ${created_vim_account_id}= Create VIM Target ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} + [Documentation] Register a VIM of type dummy in OSM. + ${created_vim_account_id}= Create VIM Target ${VIM_NAME} ${VIM_USER} ${VIM_PASSWORD} ${VIM_AUTH_URL} ${VIM_TENANT} ${VIM_ACCOUNT_TYPE} + Log ${created_vim_account_id} Add K8s Cluster To OSM - Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} ${vim_name} ${k8scluster_net} ${k8scluster_name} + [Documentation] Register a K8s cluster associated to the dummy VIM. + Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} ${VIM_NAME} ${K8SCLUSTER_NET} ${K8SCLUSTER_NAME} Create Network Service Instance - ${id}= Create Network Service ${nsd_name} ${vim_name} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} ${VIM_NAME} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Delete Network Service Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Remove K8s Cluster from OSM + [Documentation] Remove K8s cluster from OSM. [Tags] cleanup - Delete K8s Cluster ${k8scluster_name} + Delete K8s Cluster ${K8SCLUSTER_NAME} Delete VIM + [Documentation] Remove VIM from OSM. [Tags] cleanup - Delete VIM Target ${vim_name} + Delete VIM Target ${VIM_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance, cluster and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name} - Run Keyword If Any Tests Failed Delete VIM Target ${vim_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME} + Run Keyword If Any Tests Failed Delete VIM Target ${VIM_NAME} diff --git a/robot-systest/testsuite/k8s_08-simple_k8s_scaling.robot b/robot-systest/testsuite/k8s_08-simple_k8s_scaling.robot index f0d87b4..034a702 100644 --- a/robot-systest/testsuite/k8s_08-simple_k8s_scaling.robot +++ b/robot-systest/testsuite/k8s_08-simple_k8s_scaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-08] Simple K8s Scale. @@ -19,110 +21,115 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource +Resource ../lib/juju_lib.resource -Force Tags k8s_08 cluster_k8s regression azure +Test Tags k8s_08 cluster_k8s regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/native_k8s_scale_charm_vnf -${vnfd_name} native_k8s_scale_charm-vnf -${nsd_pkg} charm-packages/native_k8s_scale_charm_ns -${nsd_name} native_k8s_scale_charm-ns +${VNFD_PKG} charm-packages/native_k8s_scale_charm_vnf +${VNFD_NAME} native_k8s_scale_charm-vnf +${NSD_PKG} charm-packages/native_k8s_scale_charm_ns +${NSD_NAME} native_k8s_scale_charm-ns -${kdu_name} native-kdu -${application_name} nginx -${vnf_member_index} native_k8s_scale_charm-vnf -${instantiation_count} 2 +${KDU_NAME} native-kdu +${APPLICATION_NAME} nginx +${VNF_MEMBER_INDEX} native_k8s_scale_charm-vnf +${INSTANTIATION_COUNT} 2 # NS instance name and configuration -${ns_name} native-k8s-scale -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [{member-vnf-index: ${vnf_member_index}, additionalParamsForKdu: [{ kdu_name: ${kdu_name}, additionalParams: { overlay: { applications: { ${application_name}: { scale: ${instantiation_count} } }}}}]}]} -${ns_id} ${EMPTY} -${publickey} %{HOME}/.ssh/id_rsa.pub +${NS_NAME} native-k8s-scale +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ], additionalParamsForVnf: [{member-vnf-index: ${VNF_MEMBER_INDEX}, additionalParamsForKdu: [{ kdu_name: ${KDU_NAME}, additionalParams: { overlay: { applications: { ${APPLICATION_NAME}: { scale: ${INSTANTIATION_COUNT} } }}}}]}]} +${NS_ID} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub # Username and SSH private key for accessing OSM host -${username} ubuntu -${password} ${EMPTY} -${privatekey} %{OSM_RSA_FILE} +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} +${PRIVATEKEY} %{OSM_RSA_FILE} + +${MODEL_NAME} ${EMPTY} +${ACTION_NAME} changecontent +${SCALING_GROUP} scale-kdu -${model_name} ${EMPTY} -${action_name} changecontent -${scaling_group} scale-kdu *** Test Cases *** Create Simple K8s Scale VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Simple K8s Scale NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service K8s Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get KDU Model Name [Documentation] Get the model name of the network service k8s instance - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${name}= Get Model Name %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${ns_id} ${kdu_name} - Set Suite Variable ${model_name} ${name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${name}= Get Model Name %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${NS_ID} ${KDU_NAME} + Set Suite Variable ${MODEL_NAME} ${name} Get Scale Count Before Scale Out [Documentation] Get the scale count of the application of network service k8s instance - - Variable Should Exist ${model_name} msg=Model name is not available - ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name} - Set Suite Variable ${initial_kdu_count} ${kdu_count} - Run Keyword If ${initial_kdu_count} != ${instantiation_count} Fail msg=Instantiation parameters were not applied. + Variable Should Exist ${MODEL_NAME} msg=Model name is not available + ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME} + Set Suite Variable ${INITIAL_KDU_COUNT} ${kdu_count} + IF ${INITIAL_KDU_COUNT} != ${INSTANTIATION_COUNT} Fail msg=Instantiation parameters were not applied. Perform Manual KDU Scale Out [Documentation] Scale out the application of network service k8s instance. - - ${ns_op_id_2}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT + ${ns_op_id_2}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT + Log ${ns_op_id_2} Check Scale Count After Scale Out [Documentation] Check whether the scale count is more than one. - Variable Should Exist ${initial_kdu_count} msg=Initial KDU count is not available - ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name} - Run Keyword If ${kdu_count} != ${initial_kdu_count} + 1 Fail msg=There is no new KDU in the model after Scale Out + Variable Should Exist ${INITIAL_KDU_COUNT} msg=Initial KDU count is not available + ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME} + IF ${kdu_count} != ${INITIAL_KDU_COUNT} + 1 Fail msg=There is no new KDU in the model after Scale Out Perform Manual KDU Scale In [Documentation] Scale in the application of network service k8s instance. - - ${ns_op_id_3}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN + ${ns_op_id_3}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN + Log ${ns_op_id_3} Check Scale Count After Scale In [Documentation] Check whether the scale count is one less. - - ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${username} ${password} ${privatekey} ${application_name} ${model_name} - Run Keyword If ${kdu_count} != ${initial_kdu_count} Fail msg=There is the same number of KDU in the model after Scale In + ${kdu_count}= Get Scale Number %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${APPLICATION_NAME} ${MODEL_NAME} + IF ${kdu_count} != ${INITIAL_KDU_COUNT} Fail msg=There is the same number of KDU in the model after Scale In Delete NS K8s Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_09-pebble_charm_k8s.robot b/robot-systest/testsuite/k8s_09-pebble_charm_k8s.robot index 63dbff3..40c4ddb 100644 --- a/robot-systest/testsuite/k8s_09-pebble_charm_k8s.robot +++ b/robot-systest/testsuite/k8s_09-pebble_charm_k8s.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Canonical Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-09] Pebble Charm. @@ -20,76 +22,85 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/package_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/package_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_09 cluster_k8s regression azure +Test Tags k8s_09 cluster_k8s regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/pebble_charm_vnf -${vnfd_name} pebble_charm-vnf -${nsd_pkg} charm-packages/pebble_charm_ns -${nsd_name} pebble_charm-ns +${VNFD_PKG} charm-packages/pebble_charm_vnf +${VNFD_NAME} pebble_charm-vnf +${NSD_PKG} charm-packages/pebble_charm_ns +${NSD_NAME} pebble_charm-ns # NS instance name and configuration -${ns_name} pebble-charm-k8s -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} pebble-charm-k8s +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } + +${NS_ID} ${EMPTY} +${PUBLICKEY} ${EMPTY} +${VNF_MEMBER_INDEX} pebble_charm-vnf +${ACTION_NAME} list-available-apps +${KDU_NAME} onos-kdu +${APPLICATION_NAME} onos -${ns_id} ${EMPTY} -${publickey} ${EMPTY} -${vnf_member_index} pebble_charm-vnf -${action_name} list-available-apps -${kdu_name} onos-kdu -${application_name} onos -${customtitle} Day 2 Action *** Test Cases *** Create Simple K8s VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Simple K8s Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Network Service K8s Instance Test - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Execute Day 2 Operations [Documentation] Performs one Day 2 operation per VNF that creates a new file. - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${action_name} ${vnf_member_index} ${kdu_name} application-name=${application_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} ${KDU_NAME} application-name=${APPLICATION_NAME} + Log ${ns_op_id} Delete NS K8s Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Delete NS Descriptor Test + [Documentation] Delete the NS package. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete the VNF package. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} Delete VNF NS Packages + [Documentation] Delete the tar.gz files associated to the VNF and NS packages. [Tags] cleanup - Delete Package '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Delete Package '%{PACKAGES_FOLDER}/${nsd_pkg}' + Delete Package '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Delete Package '%{PACKAGES_FOLDER}/${NSD_PKG}' *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_10-sol004_sol007_with_k8s_proxy_charms.robot b/robot-systest/testsuite/k8s_10-sol004_sol007_with_k8s_proxy_charms.robot index 1c7d3de..b5d1ba2 100644 --- a/robot-systest/testsuite/k8s_10-sol004_sol007_with_k8s_proxy_charms.robot +++ b/robot-systest/testsuite/k8s_10-sol004_sol007_with_k8s_proxy_charms.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,132 +11,119 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-10] K8s Proxy Charm using SOL004 and SOL007 packages. Library OperatingSystem Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags k8s_10 cluster_ee_config cluster_k8s_charms daily regression azure +Test Tags k8s_10 cluster_ee_config cluster_k8s_charms daily regression azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} charm-packages/sol004_k8s_proxy_charm_vnf -${vnfd_name} sol004_k8s_proxy_charm-vnf -${nsd_pkg} charm-packages/sol007_k8s_proxy_charm_ns -${nsd_name} sol007_k8s_proxy_charm-ns +${VNFD_PKG} charm-packages/sol004_k8s_proxy_charm_vnf +${VNFD_NAME} sol004_k8s_proxy_charm-vnf +${NSD_PKG} charm-packages/sol007_k8s_proxy_charm_ns +${NSD_NAME} sol007_k8s_proxy_charm-ns # NS instance name and configuration -${ns_name} k8s_10-k8s_proxy_charm -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } -${ns_timeout} 15min +${NS_NAME} k8s_10-k8s_proxy_charm +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_TIMEOUT} 15min # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${action_name} touch -${vnf_member_index_1} vnf1 -${vnf_member_index_2} vnf2 -${day_1_file_name} /home/ubuntu/first-touch -${day_2_file_name_1} /home/ubuntu/mytouch1 -${day_2_file_name_2} /home/ubuntu/mytouch2 +${ACTION_NAME} touch +${VNF_MEMBER_INDEX_1} vnf1 +${VNF_MEMBER_INDEX_2} vnf2 +${DAY_1_FILE_NAME} /home/ubuntu/first-touch +${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1 +${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2 *** Test Cases *** Create Charm VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Charm NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Charm Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT} + Set Suite Variable ${NS_ID} ${id} Get Management Ip Addresses - - ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} + [Documentation] Get the mgmt IP addresses of both VNF of the NS. + ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} Log ${ip_addr_1} - Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1} - ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} + Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1} + ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} Log ${ip_addr_2} - Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2} - + Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2} Test SSH Access - - Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available - Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available + [Documentation] Check that both VNF are accessible via SSH in their mgmt IP addresses. + Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available + Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey} - Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey} - + Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} + Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Check Remote Files Created Via Day 1 Operations [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}. ... This test checks whether that files have been created or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME} Execute Day 2 Operations [Documentation] Performs one Day 2 operation per VNF that creates a new file. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1} - ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2} - + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_1} filename=${DAY_2_FILE_NAME_1} + Log ${ns_op_id_1} + ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_2} filename=${DAY_2_FILE_NAME_2} + Log ${ns_op_id_2} Check Remote Files Created Via Day 2 Operations [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not. - - Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1} - Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2} - + Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_1} + Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_2} Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/k8s_11-simple_helm_k8s_scaling.robot b/robot-systest/testsuite/k8s_11-simple_helm_k8s_scaling.robot index f5a73a7..14cda79 100644 --- a/robot-systest/testsuite/k8s_11-simple_helm_k8s_scaling.robot +++ b/robot-systest/testsuite/k8s_11-simple_helm_k8s_scaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-11] Simple Helm K8s Scale. @@ -19,117 +21,126 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_11 cluster_k8s +Test Tags k8s_11 cluster_k8s Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # K8s cluster name and version -${k8scluster_name} k8s11 -${k8scluster_version} v1 +${K8SCLUSTER_NAME} k8s11 +${K8SCLUSTER_VERSION} v1 # NS and VNF descriptor package folder and ids -${vnfd_pkg} openldap_scale_knf -${vnfd_name} openldap_scale_knf -${nsd_pkg} openldap_scale_ns -${nsd_name} openldap_scale_ns +${VNFD_PKG} openldap_scale_knf +${VNFD_NAME} openldap_scale_knf +${NSD_PKG} openldap_scale_ns +${NSD_NAME} openldap_scale_ns # NS instance name and configuration -${ns_name} openldap-scale -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} openldap-scale +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # Username and SSH private key for accessing OSM host -${username} ubuntu -${password} ${EMPTY} -${privatekey} %{OSM_RSA_FILE} +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} +${PRIVATEKEY} %{OSM_RSA_FILE} + +${NS_ID} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${VNF_MEMBER_INDEX} openldap +${KDU_NAME} native-kdu +${SCALING_GROUP} scale-kdu -${ns_id} ${EMPTY} -${publickey} %{HOME}/.ssh/id_rsa.pub -${vnf_member_index} openldap -${kdu_name} native-kdu -${scaling_group} scale-kdu *** Test Cases *** Create Simple K8s Scale VNF Descriptor - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Simple K8s Scale NS Descriptor - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Add K8s Cluster To OSM - Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name} + [Documentation] Register K8s cluster in OSM. + Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} %{VIM_TARGET} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME} Create Network Service Instance - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get VNF identifier from OSM. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Get Scale Count Before Scale Out [Documentation] Get the scale count of the application of network service k8s instance - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${kdu_count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${kdu_count} - Set Suite Variable ${initial_kdu_count} ${kdu_count} + Set Suite Variable ${INITIAL_KDU_COUNT} ${kdu_count} Perform Manual KDU Scale Out [Documentation] Scale out the application of network service k8s instance. - - ${ns_op_id_1}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_OUT + ${ns_op_id_1}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_OUT + Log ${ns_op_id_1} Check Scale Count After Scale Out [Documentation] Check whether the scale count is more than one. - Variable Should Exist ${initial_kdu_count} msg=Initial KDU count is not available - ${kdu_count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + Variable Should Exist ${INITIAL_KDU_COUNT} msg=Initial KDU count is not available + ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${kdu_count} - Run Keyword If ${kdu_count} != ${initial_kdu_count} + 2 Fail msg=There is no new KDU in the model after Scale Out + IF ${kdu_count} != ${INITIAL_KDU_COUNT} + 2 Fail msg=There is no new KDU in the model after Scale Out Perform Manual KDU Scale In [Documentation] Scale in the application of network service k8s instance. - - ${ns_op_id_2}= Execute Manual VNF Scale ${ns_name} ${vnf_member_index} ${scaling_group} SCALE_IN + ${ns_op_id_2}= Execute Manual VNF Scale ${NS_NAME} ${VNF_MEMBER_INDEX} ${SCALING_GROUP} SCALE_IN + Log ${ns_op_id_2} Check Scale Count After Scale In [Documentation] Check whether the scale count is one less. - - ${kdu_count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} - Run Keyword If ${kdu_count} != ${initial_kdu_count} Fail msg=There is the same number of KDU in the model after Scale In + ${kdu_count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} + IF ${kdu_count} != ${INITIAL_KDU_COUNT} Fail msg=There is the same number of KDU in the model after Scale In Delete NS K8s Instance Test + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Remove K8s Cluster from OSM + [Documentation] Unregister K8s cluster from OSM. [Tags] cleanup - Delete K8s Cluster ${k8scluster_name} + Delete K8s Cluster ${K8SCLUSTER_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME} diff --git a/robot-systest/testsuite/k8s_12-openldap_helm_day-2.robot b/robot-systest/testsuite/k8s_12-openldap_helm_day-2.robot index 0abc535..19e45c0 100644 --- a/robot-systest/testsuite/k8s_12-openldap_helm_day-2.robot +++ b/robot-systest/testsuite/k8s_12-openldap_helm_day-2.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-12] Openldap Helm chart. @@ -18,114 +20,133 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource -Force Tags k8s_12 cluster_k8s daily azure +Test Tags k8s_12 cluster_k8s daily azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # K8s cluster name and version -${k8scluster_name} k8s12 -${k8scluster_version} v1 +${K8SCLUSTER_NAME} k8s12 +${K8SCLUSTER_VERSION} v1 # NS and VNF descriptor package folder and ids -${vnfd_pkg} openldap_primitives_knf -${vnfd_name} openldap_knf -${nsd_pkg} openldap_primitives_ns -${nsd_name} openldap_ns +${VNFD_PKG} openldap_primitives_knf +${VNFD_NAME} openldap_knf +${NSD_PKG} openldap_primitives_ns +${NSD_NAME} openldap_ns # NS instance name and configuration -${ns_name} ldap -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } - -${ns_id} ${EMPTY} -${publickey} ${EMPTY} -${vnf_member_index} openldap -${kdu_name} ldap -${upgrade_action} upgrade -${rollback_action} rollback -${replica_count} 3 -${action_name} get-user-info -${action_param_cn} admin -${action_param_dc} example.org +${NS_NAME} ldap +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: openldap, additionalParamsForKdu: [ {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } + +${NS_ID} ${EMPTY} +${PUBLICKEY} ${EMPTY} +${VNF_MEMBER_INDEX} openldap +${KDU_NAME} ldap +${UPGRADE_ACTION} upgrade +${ROLLBACK_ACTION} rollback +${REPLICA_COUNT} 3 +${ACTION_NAME} get-user-info +${ACTION_PARAM_CN} admin +${ACTION_PARAM_DC} example.org + *** Test Cases *** Create Package For OpenLDAP CNF - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Package For OpenLDAP NS - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Add K8s Cluster To OSM - Create K8s Cluster %{K8S_CREDENTIALS} ${k8scluster_version} %{VIM_TARGET} %{VIM_MGMT_NET} ${k8scluster_name} + [Documentation] Register K8s cluster in OSM. + Create K8s Cluster %{K8S_CREDENTIALS} ${K8SCLUSTER_VERSION} %{VIM_TARGET} %{VIM_MGMT_NET} ${K8SCLUSTER_NAME} Create Network Service Instance - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Log ${id} Get Ns Id - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + [Documentation] Get NS instance id from OSM. + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Get VNF instance id from OSM. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Execute Day 2 Operations [Documentation] Performs one Day 2 operation. - - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${action_name} ${vnf_member_index} ${kdu_name} cn=${action_param_cn} dc=${action_param_dc} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX} ${KDU_NAME} cn=${ACTION_PARAM_CN} dc=${ACTION_PARAM_DC} + Log ${ns_op_id} Execute Upgrade Operation - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${upgrade_action} ${vnf_member_index} ${kdu_name} replicaCount=${replica_count} + [Documentation] Perform OSM action to upgrade the number of replicas of a deployment in the CNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} replicaCount=${REPLICA_COUNT} + Log ${ns_op_id} Check Replicas After Upgrade Operation - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + [Documentation] Check that the number of replicas after the upgrade is the expected one. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${count} - Should Be Equal As Integers ${count} ${replica_count} + Should Be Equal As Integers ${count} ${REPLICA_COUNT} Execute Rollback Operation - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${rollback_action} ${vnf_member_index} ${kdu_name} + [Documentation] Perform OSM action to rollback the previous upgrade of the CNF. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU_NAME} + Log ${ns_op_id} Check Replicas After Rollback Operation - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu_name} + [Documentation] Check that the number of replcias after the rollback is the expected one. + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU_NAME} Log ${count} Should Be Empty ${count} Delete Network Service Instance + [Documentation] Delete NS instance. [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Remove K8s Cluster from OSM + [Documentation] Delete K8s cluster from OSM. [Tags] cleanup - Delete K8s Cluster ${k8scluster_name} + Delete K8s Cluster ${K8SCLUSTER_NAME} Delete NS Descriptor Test + [Documentation] Delete NS package from OSM. [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test + [Documentation] Delete NF package from OSM. [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - Run Keyword If Any Tests Failed Delete K8s Cluster ${k8scluster_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Delete K8s Cluster ${K8SCLUSTER_NAME} diff --git a/robot-systest/testsuite/k8s_13-two_helm_kdu.robot b/robot-systest/testsuite/k8s_13-two_helm_kdu.robot index b57e635..763488b 100644 --- a/robot-systest/testsuite/k8s_13-two_helm_kdu.robot +++ b/robot-systest/testsuite/k8s_13-two_helm_kdu.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [K8s-13] Two Helm-based KDU stored in public and private OCI repositories. @@ -18,160 +20,167 @@ Library String Library Collections Library Process -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/k8scluster_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/repo_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/k8scluster_lib.resource +Resource ../lib/repo_lib.resource -Force Tags k8s_13 cluster_k8s daily azure +Test Tags k8s_13 cluster_k8s daily azure Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} two_helm_oci_knf -${vnfd_name} two_helm_oci_knf -${nsd_pkg} two_helm_oci_ns -${nsd_name} two_helm_oci_ns +${VNFD_PKG} two_helm_oci_knf +${VNFD_NAME} two_helm_oci_knf +${NSD_PKG} two_helm_oci_ns +${NSD_NAME} two_helm_oci_ns # NS instance name and configuration -${ns_name} ldap -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: two_helm_oci, additionalParamsForKdu: [ {kdu_name: haproxy, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}}, {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } - -${ns_id} ${EMPTY} -${publickey} ${EMPTY} -${vnf_member_index} two_helm_oci -${kdu1_name} haproxy -${kdu2_name} ldap -${upgrade_action} upgrade -${rollback_action} rollback -${replica_count} 3 +${NS_NAME} ldap +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}}], additionalParamsForVnf: [ {member-vnf-index: two_helm_oci, additionalParamsForKdu: [ {kdu_name: haproxy, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}}, {kdu_name: ldap, additionalParams: {service: {type: LoadBalancer }, adminPassword: admin}} ] } ] } + +${NS_ID} ${EMPTY} +${PUBLICKEY} ${EMPTY} +${VNF_MEMBER_INDEX} two_helm_oci +${KDU1_NAME} haproxy +${KDU2_NAME} ldap +${UPGRADE_ACTION} upgrade +${ROLLBACK_ACTION} rollback +${REPLICA_COUNT} 3 # OCI helm repo configuration -${repo_name} osm-gitlab -${repo_uri} %{OCI_REGISTRY_URL} -${repo_user} %{OCI_REGISTRY_USER} -${repo_password} %{OCI_REGISTRY_PASSWORD} +${REPO_NAME} osm-gitlab +${REPO_URI} %{OCI_REGISTRY_URL} +${REPO_USER} %{OCI_REGISTRY_USER} +${REPO_PASSWORD} %{OCI_REGISTRY_PASSWORD} + *** Test Cases *** Create Package For CNF [Documentation] Create Package For CNF [Tags] prepare - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create Package For NS [Documentation] Create Package For NS [Tags] prepare - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Create Helm OCI Repo [Documentation] Create Helm OCI Repo for openldap kdu [Tags] prepare - Create Repo ${repo_name} ${repo_uri} helm-chart ${repo_user} ${repo_password} --oci + Create Repo ${REPO_NAME} ${REPO_URI} helm-chart ${REPO_USER} ${REPO_PASSWORD} --oci Create Network Service Instance [Documentation] Create Network Service Instance [Tags] prepare - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Log ${id} Get Ns Id [Documentation] Get ID of NS instance [Tags] verify - ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + ${id}= Get Ns Id ${NS_NAME} + Set Suite Variable ${NS_ID} ${id} Get Vnf Id [Documentation] Get ID of VNF [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Execute Upgrade Operation over first KDU [Documentation] Execute Upgrade Operation over first KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${upgrade_action} ${vnf_member_index} ${kdu1_name} replicaCount=${replica_count} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU1_NAME} replicaCount=${REPLICA_COUNT} + Log ${ns_op_id} Check Replicas After Upgrade Operation over first KDU [Documentation] Check Replicas After Upgrade Operation over first KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu1_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU1_NAME} Log ${count} - Should Be Equal As Integers ${count} ${replica_count} + Should Be Equal As Integers ${count} ${REPLICA_COUNT} Execute Rollback Operation over first KDU [Documentation] Execute Rollback Operation over first KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${rollback_action} ${vnf_member_index} ${kdu1_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU1_NAME} + Log ${ns_op_id} Check Replicas After Rollback Operation over first KDU [Documentation] Check Replicas After Rollback Operation over first KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu1_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU1_NAME} Log ${count} Should Be Empty ${count} Execute Upgrade Operation over second KDU [Documentation] Execute Upgrade Operation over second KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${upgrade_action} ${vnf_member_index} ${kdu2_name} replicaCount=${replica_count} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${UPGRADE_ACTION} ${VNF_MEMBER_INDEX} ${KDU2_NAME} replicaCount=${REPLICA_COUNT} + Log ${ns_op_id} Check Replicas After Upgrade Operation over second KDU [Documentation] Check Replicas After Upgrade Operation over second KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu2_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU2_NAME} Log ${count} - Should Be Equal As Integers ${count} ${replica_count} + Should Be Equal As Integers ${count} ${REPLICA_COUNT} Execute Rollback Operation over second KDU [Documentation] Execute Rollback Operation over second KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${ns_op_id}= Execute NS K8s Action ${ns_name} ${rollback_action} ${vnf_member_index} ${kdu2_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${ns_op_id}= Execute NS K8s Action ${NS_NAME} ${ROLLBACK_ACTION} ${VNF_MEMBER_INDEX} ${KDU2_NAME} + Log ${ns_op_id} Check Replicas After Rollback Operation over second KDU [Documentation] Check Replicas After Rollback Operation over second KDU [Tags] verify - Variable Should Exist ${ns_id} msg=Network service instance is not available - ${count}= Get Vnf Kdu Replica Count ${vnf_id} ${kdu2_name} + Variable Should Exist ${NS_ID} msg=Network service instance is not available + ${count}= Get Vnf Kdu Replica Count ${VNF_ID} ${KDU2_NAME} Log ${count} Should Be Empty ${count} Delete Network Service Instance [Documentation] Delete Network Service Instance [Tags] cleanup - Delete NS ${ns_name} + Delete NS ${NS_NAME} Delete Helm OCI Repo [Documentation] Delete Helm OCI Repo [Tags] prepare - Delete Repo ${repo_name} + Delete Repo ${REPO_NAME} Delete NS Descriptor Test [Documentation] Delete NS Descriptor Test [Tags] cleanup - Delete NSD ${nsd_name} + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test [Documentation] Delete VNF Descriptor Test [Tags] cleanup - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/lcmop_01-cancel_operation_basic.robot b/robot-systest/testsuite/lcmop_01-cancel_operation_basic.robot index 3b9d215..01c0e7e 100644 --- a/robot-systest/testsuite/lcmop_01-cancel_operation_basic.robot +++ b/robot-systest/testsuite/lcmop_01-cancel_operation_basic.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [LCMOP_01] Cancel an ongoing NS operation @@ -19,97 +21,77 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ns_operation_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags lcmop_01 cluster_lcmop daily +Test Tags lcmop_01 cluster_lcmop daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package folder and ids -${vnfd_pkg} simple_ee_vnf -${vnfd_name} simple_ee-vnf -${nsd_pkg} simple_ee_ns -${nsd_name} simple_ee-ns +${VNFD_PKG} simple_ee_vnf +${VNFD_NAME} simple_ee-vnf +${NSD_PKG} simple_ee_ns +${NSD_NAME} simple_ee-ns # NS instance name and configuration -${ns_name} lcmop_01_cancel_operation_basic -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_NAME} lcmop_01_cancel_operation_basic +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } *** Test Cases *** Create VNF Descriptor [Documentation] Create the VNF descriptor - - ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Set Suite Variable ${vnfd_id} ${id} - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor [Documentation] Create the NS descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service [Documentation] Instantiate the Network service - - ${id}= Instantiate Network Service ${ns_name} ${nsd_name} %{VIM_TARGET} --config '${ns_config}' - Set Suite Variable ${ns_id} ${id} - + ${id}= Instantiate Network Service ${NS_NAME} ${NSD_NAME} %{VIM_TARGET} --config '${NS_CONFIG}' + Set Suite Variable ${NS_ID} ${id} Get operation ID [Documentation] Obtain the operation ID of the NS instantiation - - ${id}= Get Operations By Type ${ns_id} instantiate - Set Suite Variable ${op_id} ${id} - + ${id}= Get Operations By Type ${NS_ID} instantiate + Set Suite Variable ${OP_ID} ${id} Cancel operation [Documentation] Cancel the ongoing NS instantiation - Sleep 5s Waiting before cancelling the operation - Cancel operation By Id ${op_id} - + Cancel Operation By Id ${OP_ID} Check that operation is cancelled [Documentation] Check that the operation is succesfully cancelled - - Check For NS Operation Cancelled ${op_id} - + Check For NS Operation Cancelled ${OP_ID} Delete NS Instance Test [Documentation] Delete the cancelled NS instance [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor Test [Documentation] Delete the NS descriptor [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor Test [Documentation] Delete the VNF descriptor [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/quotas_01-quota_enforcement.robot b/robot-systest/testsuite/quotas_01-quota_enforcement.robot index f37412d..6558c17 100644 --- a/robot-systest/testsuite/quotas_01-quota_enforcement.robot +++ b/robot-systest/testsuite/quotas_01-quota_enforcement.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [QUOTAS-01] Quota enforcement. @@ -17,160 +19,151 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/project_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/user_lib.robot +Resource ../lib/project_lib.resource +Resource ../lib/user_lib.resource -Force Tags quotas_01 cluster_main daily regression +Test Tags quotas_01 cluster_main daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # VNFD package to use during test -${vnfd_pkg} hackfest_basic_vnf +${VNFD_PKG} hackfest_basic_vnf # Project names and quotas to use -${project_1_name} quotas_01_proj_1 -${project_2_name} quotas_01_proj_2 -${project_3_name} quotas_01_proj_3 -${project_1_quotas} vnfds=1,nsds=2,ns_instances=3 -${project_2_quotas} vnfds=1,nsds=1,ns_instances=1 -${project_3_quotas} vnfds=5,nsds=,ns_instances= +${PROJECT_1_NAME} quotas_01_proj_1 +${PROJECT_2_NAME} quotas_01_proj_2 +${PROJECT_3_NAME} quotas_01_proj_3 +${PROJECT_1_QUOTAS} vnfds=1,nsds=2,ns_instances=3 +${PROJECT_2_QUOTAS} vnfds=1,nsds=1,ns_instances=1 +${PROJECT_3_QUOTAS} vnfds=5,nsds=,ns_instances= # User name and password for project -${user_name} quotas_01_user -${user_password} Quotas_01_pass -${user_new_password} Quotas_01_new_pass +${USERNAME} quotas_01_user +${USER_PASSWORD} Quotas_01_pass +${USER_NEW_PASSWORD} Quotas_01_new_pass -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create First Project With Quotas - - Create Project With Quotas ${project_1_name} ${project_1_quotas} - ${project_1_vnfds}= Get Project Quotas ${project_1_name} vnfds + [Documentation] Create a first project with quotas, then get the project quotas and check that they are correct. + Create Project With Quotas ${PROJECT_1_NAME} ${PROJECT_1_QUOTAS} + ${project_1_vnfds}= Get Project Quotas ${PROJECT_1_NAME} vnfds Should Be Equal As Integers 1 ${project_1_vnfds} - ${project_1_nsds}= Get Project Quotas ${project_1_name} nsds + ${project_1_nsds}= Get Project Quotas ${PROJECT_1_NAME} nsds Should Be Equal As Integers 2 ${project_1_nsds} - ${project_1_ns_instances}= Get Project Quotas ${project_1_name} ns_instances + ${project_1_ns_instances}= Get Project Quotas ${PROJECT_1_NAME} ns_instances Should Be Equal As Integers 3 ${project_1_ns_instances} - Create Second Project With Quotas - - Create Project With Quotas ${project_2_name} ${project_2_quotas} - ${project_2_vnfds}= Get Project Quotas ${project_2_name} vnfds + [Documentation] Create a second project with quotas, then get the project quotas and check that they are correct. + Create Project With Quotas ${PROJECT_2_NAME} ${PROJECT_2_QUOTAS} + ${project_2_vnfds}= Get Project Quotas ${PROJECT_2_NAME} vnfds Should Be Equal As Integers 1 ${project_2_vnfds} - ${project_2_nsds}= Get Project Quotas ${project_2_name} nsds + ${project_2_nsds}= Get Project Quotas ${PROJECT_2_NAME} nsds Should Be Equal As Integers 1 ${project_2_nsds} - ${project_2_ns_instances}= Get Project Quotas ${project_2_name} ns_instances + ${project_2_ns_instances}= Get Project Quotas ${PROJECT_2_NAME} ns_instances Should Be Equal As Integers 1 ${project_2_ns_instances} Create User In Projects - - ${rc} ${stdout}= Run And Return RC And Output osm user-create ${user_name} --password ${user_password} --project-role-mappings ${project_1_name},project_admin --project-role-mappings ${project_2_name},project_admin - Should Be Equal As Integers ${rc} ${success_return_code} - Check If User Is Assigned To Project ${user_name} ${project_1_name} - Check If User Is Assigned To Project ${user_name} ${project_2_name} - Update User Password ${user_name} ${user_password} ${user_new_password} - + [Documentation] Create a user with role project_admin in both projects. + ${rc} ${stdout}= Run And Return RC And Output osm user-create ${USERNAME} --password ${USER_PASSWORD} --project-role-mappings ${PROJECT_1_NAME},project_admin --project-role-mappings ${PROJECT_2_NAME},project_admin + Log ${rc},${stdout} + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Check If User Is Assigned To Project ${USERNAME} ${PROJECT_1_NAME} + Check If User Is Assigned To Project ${USERNAME} ${PROJECT_2_NAME} + Update User Password ${USERNAME} ${USER_PASSWORD} ${USER_NEW_PASSWORD} Change First Project Name to Third Project Name - - Update Project Name ${project_1_name} ${project_3_name} - ${project_3_vnfds}= Get Project Quotas ${project_3_name} vnfds + [Documentation] Rename first project. From now on, the project will be considered for the tests a third project. + Update Project Name ${PROJECT_1_NAME} ${PROJECT_3_NAME} + ${project_3_vnfds}= Get Project Quotas ${PROJECT_3_NAME} vnfds Should Be Equal As Integers 1 ${project_3_vnfds} - ${project_3_nsds}= Get Project Quotas ${project_3_name} nsds + ${project_3_nsds}= Get Project Quotas ${PROJECT_3_NAME} nsds Should Be Equal As Integers 2 ${project_3_nsds} - ${project_3_ns_instances}= Get Project Quotas ${project_3_name} ns_instances + ${project_3_ns_instances}= Get Project Quotas ${PROJECT_3_NAME} ns_instances Should Be Equal As Integers 3 ${project_3_ns_instances} - Check If User Is Assigned To Project ${user_name} ${project_3_name} - + Check If User Is Assigned To Project ${USERNAME} ${PROJECT_3_NAME} Create VNFDs On Third Project Until Exceed Quota - - Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v1;product-name=v1' - Run Keyword And Expect Error * Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v2;product-name=v2' - + [Documentation] Upload VNF packages in the third project. + Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v1;product-name=v1' + Run Keyword And Expect Error * Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v2;product-name=v2' Increase Third Project Quotas - - Update Project Quotas ${project_3_name} ${project_3_quotas} - ${project_3_vnfds}= Get Project Quotas ${project_3_name} vnfds + [Documentation] Update the quotas of the third project. + Update Project Quotas ${PROJECT_3_NAME} ${PROJECT_3_QUOTAS} + ${project_3_vnfds}= Get Project Quotas ${PROJECT_3_NAME} vnfds Should Be Equal As Integers 5 ${project_3_vnfds} - Create More VNFDs On Third Project Until Exceed Quota - - Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v2;product-name=v2' - Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v3;product-name=v3' - Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v4;product-name=v4' - Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v5;product-name=v5' - Run Keyword And Expect Error * Create VNFD In Project ${project_3_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=v6;product-name=v6' - + [Documentation] Upload VNF packages in the third project until the quota is reached, so that an error is obtained. + Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v2;product-name=v2' + Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v3;product-name=v3' + Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v4;product-name=v4' + Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v5;product-name=v5' + Run Keyword And Expect Error * Create VNFD In Project ${PROJECT_3_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=v6;product-name=v6' Create VNFDs On Second Project Until Exceed Quota - - Create VNFD In Project ${project_2_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=vp2_1;product-name=vp2_1' - Run Keyword And Expect Error * Create VNFD In Project ${project_2_name} '%{PACKAGES_FOLDER}/${vnfd_pkg}' ${user_name} ${user_new_password} override='id=vp2_2;product-name=vp2_2' - + [Documentation] Upload VNF packages in the second project until the quota is reached, so that an error is obtained. + Create VNFD In Project ${PROJECT_2_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=vp2_1;product-name=vp2_1' + Run Keyword And Expect Error * Create VNFD In Project ${PROJECT_2_NAME} '%{PACKAGES_FOLDER}/${VNFD_PKG}' ${USERNAME} ${USER_NEW_PASSWORD} override='id=vp2_2;product-name=vp2_2' Check Project Scopes - - ${rc} ${stdout}= Run And Return RC And Output osm --project ${project_3_name} --password ${user_new_password} --user ${user_name} vnfpkg-show vp2_1 + [Documentation] Check that the user can see a VNF package in both projects. + ${rc} ${stdout}= Run And Return RC And Output osm --project ${PROJECT_3_NAME} --password ${USER_NEW_PASSWORD} --user ${USERNAME} vnfpkg-show vp2_1 Log ${stdout} - Should Not Be Equal As Integers ${rc} ${success_return_code} - ${rc} ${stdout}= Run And Return RC And Output osm --project ${project_2_name} --password ${user_new_password} --user ${user_name} vnfpkg-show v1 + Should Not Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + ${rc} ${stdout}= Run And Return RC And Output osm --project ${PROJECT_2_NAME} --password ${USER_NEW_PASSWORD} --user ${USERNAME} vnfpkg-show v1 Log ${stdout} - Should Not Be Equal As Integers ${rc} ${success_return_code} - + Should Not Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} Delete Second Project VNFD + [Documentation] Delete VNF packages from second project. [Tags] cleanup - - Delete VNFD In Project ${project_2_name} vp2_1 ${user_name} ${user_new_password} - + Delete VNFD In Project ${PROJECT_2_NAME} vp2_1 ${USERNAME} ${USER_NEW_PASSWORD} Delete Third Project VNFDs + [Documentation] Delete VNF packages from third project. [Tags] cleanup - - Delete VNFD In Project ${project_3_name} v1 ${user_name} ${user_new_password} - Delete VNFD In Project ${project_3_name} v2 ${user_name} ${user_new_password} - Delete VNFD In Project ${project_3_name} v3 ${user_name} ${user_new_password} - Delete VNFD In Project ${project_3_name} v4 ${user_name} ${user_new_password} - Delete VNFD In Project ${project_3_name} v5 ${user_name} ${user_new_password} - + Delete VNFD In Project ${PROJECT_3_NAME} v1 ${USERNAME} ${USER_NEW_PASSWORD} + Delete VNFD In Project ${PROJECT_3_NAME} v2 ${USERNAME} ${USER_NEW_PASSWORD} + Delete VNFD In Project ${PROJECT_3_NAME} v3 ${USERNAME} ${USER_NEW_PASSWORD} + Delete VNFD In Project ${PROJECT_3_NAME} v4 ${USERNAME} ${USER_NEW_PASSWORD} + Delete VNFD In Project ${PROJECT_3_NAME} v5 ${USERNAME} ${USER_NEW_PASSWORD} Delete Second Project After Removing User From It + [Documentation] Delete user from second project, then delete the second project. [Tags] cleanup - - Run Keyword And Expect Error * Delete Project ${project_2_name} - Remove User From Project ${user_name} ${project_2_name} - Delete Project ${project_2_name} - + Run Keyword And Expect Error * Delete Project ${PROJECT_2_NAME} + Remove User From Project ${USERNAME} ${PROJECT_2_NAME} + Delete Project ${PROJECT_2_NAME} Delete Projects User + [Documentation] Delete user. [Tags] cleanup - - ${rc}= Run And Return RC osm user-delete ${user_name} - + ${rc}= Run And Return RC osm user-delete ${USERNAME} + Log ${rc} Delete Third Project + [Documentation] Delete third project. [Tags] cleanup - - Delete Project ${project_3_name} + Delete Project ${PROJECT_3_NAME} *** Keywords *** Suite Cleanup - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_2_name} vp2_1 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_3_name} v1 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_3_name} v2 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_3_name} v3 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_3_name} v4 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${project_3_name} v5 ${user_name} ${user_new_password} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_1_name} - Run Keyword If Any Tests Failed Delete Project ${project_2_name} - Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${project_3_name} - Run And Return RC osm user-delete ${user_name} + [Documentation] Test Suite Cleanup: Deleting VNF packages, projects and users. + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_2_NAME} vp2_1 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_3_NAME} v1 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_3_NAME} v2 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_3_NAME} v3 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_3_NAME} v4 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete VNFD In Project ${PROJECT_3_NAME} v5 ${USERNAME} ${USER_NEW_PASSWORD} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${PROJECT_1_NAME} + Run Keyword If Any Tests Failed Delete Project ${PROJECT_2_NAME} + Run Keyword If Any Tests Failed Run Keyword And Ignore Error Delete Project ${PROJECT_3_NAME} + Run And Return RC osm user-delete ${USERNAME} diff --git a/robot-systest/testsuite/sa_01-vnf_with_vim_metrics.robot b/robot-systest/testsuite/sa_01-vnf_with_vim_metrics.robot index 2a98e13..871972e 100644 --- a/robot-systest/testsuite/sa_01-vnf_with_vim_metrics.robot +++ b/robot-systest/testsuite/sa_01-vnf_with_vim_metrics.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SA-01] VNF with VIM-based metrics. @@ -17,13 +19,13 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/prometheus_lib.resource -Force Tags sa_01 cluster_sa daily regression +Test Tags sa_01 cluster_sa daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Suite Cleanup @@ -31,92 +33,81 @@ Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS instantiation parameters -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_metrics_vnf -${vnfd_name} hackfest_basic_metrics-vnf -${nsd_pkg} hackfest_basic_metrics_ns -${nsd_name} hackfest_basic-ns-metrics +${VNFD_PKG} hackfest_basic_metrics_vnf +${VNFD_NAME} hackfest_basic_metrics-vnf +${NSD_PKG} hackfest_basic_metrics_ns +${NSD_NAME} hackfest_basic-ns-metrics # NS instance name -${ns_name} sa_01-vnf_with_vim_metrics_test +${NS_NAME} sa_01-vnf_with_vim_metrics_test # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa # Prometheus polling interval and retries -${prometheus_poll_retries} 15 times -${prometheus_poll_timeout} 1 minute +${PROMETHEUS_POLL_RETRIES} 15 times +${PROMETHEUS_POLL_TIMEOUT} 1 minute # Prometheus metrics to retrieve -${metric_1_name} osm_cpu_utilization -${metric_2_name} osm_average_memory_utilization +${METRIC_1_NAME} osm_cpu_utilization +${METRIC_2_NAME} osm_average_memory_utilization *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get VNF VIM-based Metrics - - 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 ${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} - Run Keyword 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} - Run Keyword If ${metric_2_value} <= 0 Fail msg=The metric '${metric_2_name}' value is '${metric_2_value}' - + [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 ${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} + 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} + IF ${metric_2_value} <= 0 Fail msg=The metric '${METRIC_2_NAME}' value is '${metric_2_value}' Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables - Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot b/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot index b5910f5..f760871 100644 --- a/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot +++ b/robot-systest/testsuite/sa_02-vnf_with_vim_metrics_and_autoscaling.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SA-02] VNF with VIM-based metrics and auto-scaling. @@ -18,13 +20,13 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/prometheus_lib.resource -Force Tags sa_02 cluster_sa daily regression sanity azure +Test Tags sa_02 cluster_sa daily regression sanity azure Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Suite Cleanup @@ -32,170 +34,156 @@ Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS instantiation parameters -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_metrics_vnf -${vnfd_name} hackfest_basic_metrics-vnf -${nsd_pkg} hackfest_basic_metrics_ns -${nsd_name} hackfest_basic-ns-metrics +${VNFD_PKG} hackfest_basic_metrics_vnf +${VNFD_NAME} hackfest_basic_metrics-vnf +${NSD_PKG} hackfest_basic_metrics_ns +${NSD_NAME} hackfest_basic-ns-metrics # NS instance name and id -${ns_id} ${EMPTY} -${ns_name} sa_02 +${NS_ID} ${EMPTY} +${NS_NAME} sa_02 # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} osm4u +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} osm4u # Prometheus polling interval and retries -${prometheus_poll_retries} 15 times -${prometheus_poll_timeout} 1 minute +${PROMETHEUS_POLL_RETRIES} 15 times +${PROMETHEUS_POLL_TIMEOUT} 1 minute # Prometheus metrics to retrieve -${metric_name} osm_cpu_utilization +${METRIC_NAME} osm_cpu_utilization # VNF Variables -${vnf_member_index} vnf -${vnf_ip_addr} ${EMPTY} -${vnf_id} ${EMPTY} +${VNF_MEMBER_INDEX} vnf +${VNF_IP_ADDR} ${EMPTY} +${VNF_ID} ${EMPTY} -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Get Thresholds From VNF - - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_name} --literal | yq -r '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."scaling-criteria"[0]."scale-out-threshold"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + [Documentation] Read metric threshold and threshold time from VNF descriptor. + ${rc} ${stdout}= Run And Return RC And Output osm vnfpkg-show ${VNFD_NAME} --literal | yq -r '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."scaling-criteria"[0]."scale-out-threshold"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False ${scaleout_threshold}= Convert To Number ${stdout} - Set Suite Variable ${metric_threshold} ${scaleout_threshold} - Log ${metric_threshold} - - ${rc} ${stdout}= Run and Return RC and Output osm vnfpkg-show ${vnfd_name} --literal | yq -r '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."threshold-time"' - Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False + Set Suite Variable ${METRIC_THRESHOLD} ${scaleout_threshold} + Log ${METRIC_THRESHOLD} + ${rc} ${stdout}= Run And Return RC And Output osm vnfpkg-show ${VNFD_NAME} --literal | yq -r '.df[0]."scaling-aspect"[0]."scaling-policy"[0]."threshold-time"' + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False ${threshold_time_value}= Convert To Number ${stdout} - Set Suite Variable ${threshold_time} ${threshold_time_value} - Log ${threshold_time} - + Set Suite Variable ${THRESHOLD_TIME} ${threshold_time_value} + Log ${THRESHOLD_TIME} Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate the NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get VNF Id - - @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} + [Documentation] Retrieve VNF instance id to be used later on. + @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} Log List ${vnfr_list} - Set Suite Variable ${vnf_id} ${vnfr_list}[0] - + Set Suite Variable ${VNF_ID} ${vnfr_list}[0] Get VNF IP Address - - ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF to be used in later tests. + ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${VNF_IP_ADDR} ${ip_addr} Get VNF VIM-based Metric Before Auto-scaling - - 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 ${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} - Run Keyword If ${metric_value} <= 0 Fail msg=The metric '${metric_name}' value is '${metric_value}' - Run Keyword If ${metric_value} >= ${metric_threshold} Fail msg=The metric '${metric_name}' value is higher than '${metric_threshold}' before 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 ${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} + IF ${metric_value} <= 0 + Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}' + END + IF ${metric_value} >= ${METRIC_THRESHOLD} + Fail msg=The metric '${METRIC_NAME}' value is higher than '${METRIC_THRESHOLD}' before scaling + END Increase VIM-based Metric To Force Auto-scaling - - Variable Should Exist ${privatekey} msg=SSH private key not available - Execute Remote Command Check Rc Return Output ${vnf_ip_addr} ${username} ${password} ${privatekey} for i in {1..9}; do yes &> /dev/null & done - + [Documentation] Connect to the VNF via SSH and force VIM metric to increase. + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available + Execute Remote Command Check Rc Return Output ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} for i in {1..9}; do yes &> /dev/null & done Wait VIM-based Metric To Exceed Threshold - - 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 - Wait Until Keyword Succeeds ${prometheus_poll_retries} ${prometheus_poll_timeout} Check VIM-based Metric Exceeds Threshold - + [Documentation] Wait until the VIM metric exceeds threshold, which should lead to a scale up. + 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 + Wait Until Keyword Succeeds ${PROMETHEUS_POLL_RETRIES} ${PROMETHEUS_POLL_TIMEOUT} Check VIM-based Metric Exceeds Threshold Wait Threshold Time - - ${threshold_time_sleep}= Evaluate ${threshold_time} + 1 + [Documentation] Wait until the VIM metric has exceeded threshold for the defined period in the descriptor. + ${threshold_time_sleep}= Evaluate ${THRESHOLD_TIME} + 1 Sleep ${threshold_time_sleep} minutes Wait scale-out threshold time plus 1 minute - Check VIM-based Metric Exceeds Threshold After Threshold-time - + [Documentation] Check that the VIM metric has exceeded the threshold. Check VIM-based Metric Exceeds Threshold - Get VDUs After Auto-scaling - + [Documentation] Check that the VNF has scaled up and the humber of VDUs has increased. Sleep 2 minutes Wait for auto-scale to take place - @{vdur_list}= Get Vnf Vdur Names ${vnf_id} + @{vdur_list}= Get Vnf Vdur Names ${VNF_ID} Log List ${vdur_list} ${vdurs}= Get Length ${vdur_list} - Run Keyword If ${vdurs} <= 1 Fail msg=There is no new VDU after auto-scaling - + IF ${vdurs} <= 1 Fail msg=There is no new VDU after auto-scaling Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables - Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} 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 ${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} - Run Keyword If ${metric_value} <= ${metric_threshold} Fail msg=The metric '${metric_name}' value is '${metric_value}' which is lower than '${metric_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 ${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} + IF ${metric_value} <= ${METRIC_THRESHOLD} + Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}' which is lower than '${METRIC_THRESHOLD}' + END diff --git a/robot-systest/testsuite/sa_07-alarms_from_sa-related_vnfs.robot b/robot-systest/testsuite/sa_07-alarms_from_sa-related_vnfs.robot index d79a762..a26ca11 100644 --- a/robot-systest/testsuite/sa_07-alarms_from_sa-related_vnfs.robot +++ b/robot-systest/testsuite/sa_07-alarms_from_sa-related_vnfs.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SA-07] Events or alarms coming from SA-related VNFs in the NS. @@ -18,13 +20,13 @@ Library String Library Collections Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/prometheus_lib.resource -Force Tags sa_07 cluster_sa daily regression +Test Tags sa_07 cluster_sa daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Suite Cleanup @@ -32,179 +34,159 @@ Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS instantiation parameters -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # NS and VNF descriptor package folder and ids -${vnfd_pkg} cirros_alarm_vnf -${vnfd_name} cirros_alarm-vnf -${vnfd_file} cirros_alarm_vnfd.yaml -${new_vnfd_pkg} new_cirros_alarm_vnf -${nsd_pkg} cirros_alarm_ns -${nsd_name} cirros_alarm-ns +${VNFD_PKG} cirros_alarm_vnf +${VNFD_NAME} cirros_alarm-vnf +${VNFD_FILE} cirros_alarm_vnfd.yaml +${NEW_VNFD_PKG} new_cirros_alarm_vnf +${NSD_PKG} cirros_alarm_ns +${NSD_NAME} cirros_alarm-ns # NS instance name and id -${ns_id} ${EMPTY} -${ns_name} sa_07-alarm_test +${NS_ID} ${EMPTY} +${NS_NAME} sa_07-alarm_test # Webhook NS and VNF descriptor package folder and ids -${ws_vnfd_pkg} hackfest_basic_vnf -${ws_nsd_pkg} hackfest_basic_ns -${ws_vnfd_name} hackfest_basic-vnf -${ws_nsd_name} hackfest_basic-ns +${WS_VNFD_PKG} hackfest_basic_vnf +${WS_NSD_PKG} hackfest_basic_ns +${WS_VNFD_NAME} hackfest_basic-vnf +${WS_NSD_NAME} hackfest_basic-ns # Webhook NS instance name and id -${ws_ns_id} ${EMPTY} -${ws_ns_name} sa_07-webhook_service_test +${WS_NS_ID} ${EMPTY} +${WS_NS_NAME} sa_07-webhook_service_test # Webhook NS Variables -${ws_vnf_member_index} vnf -${ws_vnf_ip_addr} ${EMPTY} -${ws_log_file} webhook.log -${ws_port} 5212 -${ws_alarm_msg} notify_alarm +${WS_VNF_MEMBER_INDEX} vnf +${WS_VNF_IP_ADDR} ${EMPTY} +${WS_LOG_FILE} webhook.log +${WS_PORT} 5212 +${WS_ALARM_MSG} notify_alarm # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} # Prometheus polling interval and retries -${prometheus_poll_retries} 15 times -${prometheus_poll_timeout} 1 minute +${PROMETHEUS_POLL_RETRIES} 15 times +${PROMETHEUS_POLL_TIMEOUT} 1 minute # Prometheus metrics to retrieve -${metric_name} osm_cpu_utilization +${METRIC_NAME} osm_cpu_utilization -${success_return_code} 0 +${SUCCESS_RETURN_CODE} 0 *** Test Cases *** Create Webhook Service VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${ws_vnfd_pkg}' - + [Documentation] Upload VNF package with a webhook service for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${WS_VNFD_PKG}' Create Webhook Service NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${ws_nsd_pkg}' - + [Documentation] Upload NS package with a webhook service for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${WS_NSD_PKG}' Instantiate Webhook Service Network Service - - ${id}= Create Network Service ${ws_nsd_name} %{VIM_TARGET} ${ws_ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ws_ns_id} ${id} - + [Documentation] Instantiate NS with the webhook for the testsuite. + ${id}= Create Network Service ${WS_NSD_NAME} %{VIM_TARGET} ${WS_NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${WS_NS_ID} ${id} Get Webhook Service VNF IP Address - - ${ip_addr}= Get Vnf Management Ip Address ${ws_ns_id} ${ws_vnf_member_index} + [Documentation] Get the mgmt IP address of the VNF offering the webhook service. + ${ip_addr}= Get Vnf Management Ip Address ${WS_NS_ID} ${WS_VNF_MEMBER_INDEX} Log ${ip_addr} - Set Suite Variable ${ws_vnf_ip_addr} ${ip_addr} - + Set Suite Variable ${WS_VNF_IP_ADDR} ${ip_addr} Start Webhook Service - - Variable Should Exist ${privatekey} msg=SSH private key not available + [Documentation] Launch simple command in webhook VNF to listen to notifications. + Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available Sleep 40 seconds Wait for SSH daemon to be up - ${stdout}= Execute Remote Command Check Rc Return Output ${ws_vnf_ip_addr} ${username} ${password} ${privatekey} while true; do { echo -e 'HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n'; test; } | nc -l '${ws_port}'; done > '${ws_log_file}' 2>&1 & - + ${stdout}= Execute Remote Command Check Rc Return Output ${WS_VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} while true; do { echo -e 'HTTP/1.0 200 OK\r\nContent-Length: 0\r\n\r\n'; test; } | nc -l '${WS_PORT}'; done > '${WS_LOG_FILE}' 2>&1 & + Log ${stdout} Create VNF Descriptor - - ${rc} ${stdout}= Run and Return RC and Output mkdir '%{PACKAGES_FOLDER}/${new_vnfd_pkg}' && WEBHOOK_URL="http://${ws_vnf_ip_addr}:${ws_port}" envsubst < '%{PACKAGES_FOLDER}/${vnfd_pkg}'/'${vnfd_file}' > '%{PACKAGES_FOLDER}/${new_vnfd_pkg}'/'${vnfd_file}' + [Documentation] Upload VNF package for the testsuite. + ${rc} ${stdout}= Run And Return RC And Output mkdir '%{PACKAGES_FOLDER}/${NEW_VNFD_PKG}' && WEBHOOK_URL="http://${WS_VNF_IP_ADDR}:${WS_PORT}" envsubst < '%{PACKAGES_FOLDER}/${VNFD_PKG}'/'${VNFD_FILE}' > '%{PACKAGES_FOLDER}/${NEW_VNFD_PKG}'/'${VNFD_FILE}' Log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Create VNFD '%{PACKAGES_FOLDER}/${new_vnfd_pkg}' - + Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} + Create VNFD '%{PACKAGES_FOLDER}/${NEW_VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate the main NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NS_ID} ${id} Get Alarm Metric - - 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 ${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} - Run Keyword If ${metric_value} <= 0 Fail msg=The metric '${metric_name}' value is '${metric_value}' - + [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 ${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} + IF ${metric_value} <= 0 Fail msg=The metric '${METRIC_NAME}' value is '${metric_value}' Check Alarms Were Received - - Wait Until Keyword Succeeds 6 times 40 seconds Execute Remote Command Check Rc Return Output ${ws_vnf_ip_addr} ${username} ${password} ${privatekey} cat '${ws_log_file}' | grep '${ws_alarm_msg}' | grep '${ns_name}' - + [Documentation] Check in the webhook VNF that the notification is received. + Wait Until Keyword Succeeds 6 times 40 seconds Execute Remote Command Check Rc Return Output ${WS_VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} cat '${WS_LOG_FILE}' | grep '${WS_ALARM_MSG}' | grep '${NS_NAME}' Delete NS Instance + [Documentation] Delete main NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete main NS package. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete main VNF package. [Tags] cleanup - - Delete VNFD ${vnfd_name} - + Delete VNFD ${VNFD_NAME} Delete Webhook Service NS Instance + [Documentation] Delete NS instance for the webhook. [Tags] cleanup - - Delete NS ${ws_ns_name} - + Delete NS ${WS_NS_NAME} Delete Webhook Service NS Descriptor + [Documentation] Delete NS package for the webhook. [Tags] cleanup - - Delete NSD ${ws_nsd_name} - + Delete NSD ${WS_NSD_NAME} Delete Webhook Service VNF Descriptor + [Documentation] Delete VNF package for the webhook. [Tags] cleanup - - Delete VNFD ${ws_vnfd_name} + Delete VNFD ${WS_VNFD_NAME} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables - Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - Run Keyword If Any Tests Failed Delete NS ${ws_ns_name} - Run Keyword If Any Tests Failed Delete NSD ${ws_nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${ws_vnfd_name} - Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_vnfd_pkg}' - + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} + Run Keyword If Any Tests Failed Delete NS ${WS_NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${WS_NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${WS_VNFD_NAME} + Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${NEW_VNFD_PKG}' Delete Temporary Descriptor Folder [Documentation] Removes the temporary package folder created for the test [Arguments] ${folder_name} - ${rc} ${stdout}= Run and Return RC and Output rm -rf '${folder_name}' - Log ${stdout} - - + ${rc} ${stdout}= Run And Return RC And Output rm -rf '${folder_name}' + Log ${rc},${stdout} diff --git a/robot-systest/testsuite/sa_08-vnf_with_vnf_indicators_snmp.robot b/robot-systest/testsuite/sa_08-vnf_with_vnf_indicators_snmp.robot index ea8873c..7ba0818 100644 --- a/robot-systest/testsuite/sa_08-vnf_with_vnf_indicators_snmp.robot +++ b/robot-systest/testsuite/sa_08-vnf_with_vnf_indicators_snmp.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SA-08] VNF with VNF-based indicators through SNMP. @@ -17,13 +19,13 @@ Library OperatingSystem Library String Library Collections -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/ssh_lib.resource +Resource ../lib/prometheus_lib.resource -Force Tags sa_08 cluster_k8s daily regression +Test Tags sa_08 cluster_k8s daily regression Suite Setup Run Keyword And Ignore Error Suite Preparation Suite Teardown Run Keyword And Ignore Error Suite Cleanup @@ -31,85 +33,76 @@ Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS instantiation parameters -${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } +${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } # NS and VNF descriptor package folder and ids -${vnfd_pkg} snmp_ee_vnf -${vnfd_name} snmp_ee-vnf -${nsd_pkg} snmp_ee_ns -${nsd_name} snmp_ee-ns +${VNFD_PKG} snmp_ee_vnf +${VNFD_NAME} snmp_ee-vnf +${NSD_PKG} snmp_ee_ns +${NSD_NAME} snmp_ee-ns # NS instance name -${ns_name} sa_08-vnf_with_vnf_indicators_snmp_test +${NS_NAME} sa_08-vnf_with_vnf_indicators_snmp_test # Prometheus polling interval and retries -${prometheus_poll_retries} 10 times -${prometheus_poll_timeout} 1 minute +${PROMETHEUS_POLL_RETRIES} 10 times +${PROMETHEUS_POLL_TIMEOUT} 1 minute # Prometheus metrics to retrieve -${metric_1_name} ifInOctets -${metric_1_filter} ifIndex=1 -${metric_2_name} ifMtu -${metric_2_filter} ifIndex=2 +${METRIC_1_NAME} ifInOctets +${METRIC_1_FILTER} ifIndex=1 +${METRIC_2_NAME} ifMtu +${METRIC_2_FILTER} ifIndex=2 *** Test Cases *** Create VNF Descriptor - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - + [Documentation] Upload VNF package for the testsuite. + Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' Create NS Descriptor - - Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' - + [Documentation] Upload NS package for the testsuite. + Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' Instantiate Network Service - - ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${EMPTY} - Set Suite Variable ${ns_id} ${id} - + [Documentation] Instantiate the NS for the testsuite. + ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY} + Set Suite Variable ${NS_ID} ${id} Get VNF SNMP Metrics - - 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 ${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} - Run Keyword 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} - Run Keyword If ${metric_2_value} <= 0 Fail msg=The metric '${metric_2_name}' value is '${metric_2_value}' - + [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 ${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} + 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} + IF ${metric_2_value} <= 0 Fail msg=The metric '${METRIC_2_NAME}' value is '${metric_2_value}' Delete NS Instance + [Documentation] Delete NS instance. [Tags] cleanup - - Delete NS ${ns_name} - + Delete NS ${NS_NAME} Delete NS Descriptor + [Documentation] Delete NS package from OSM. [Tags] cleanup - - Delete NSD ${nsd_name} - + Delete NSD ${NSD_NAME} Delete VNF Descriptor + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Preparation [Documentation] Test Suite Preparation: Setting Prometheus Testsuite Variables - Set Testsuite Prometheus Variables - Suite Cleanup [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance - - Run Keyword If Any Tests Failed Delete NS ${ns_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} + Run Keyword If Any Tests Failed Delete NS ${NS_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/slice_01-network_slicing.robot b/robot-systest/testsuite/slice_01-network_slicing.robot index a910524..ee19f39 100644 --- a/robot-systest/testsuite/slice_01-network_slicing.robot +++ b/robot-systest/testsuite/slice_01-network_slicing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Atos # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SLICE-01] Network Slicing. @@ -22,171 +24,140 @@ Library Process Library SSHLibrary Library yaml -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/nst_lib.resource +Resource ../lib/nsi_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags slice_01 cluster_slices daily regression +Test Tags slice_01 cluster_slices daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # NS and VNF descriptor package files -${vnfd1_pkg} slice_basic_vnf -${vnfd2_pkg} slice_basic_middle_vnf -${nsd1_pkg} slice_basic_ns -${nsd2_pkg} slice_basic_middle_ns -${nst} slice_basic_nst/slice_basic_nst.yaml +${VNFD1_PKG} slice_basic_vnf +${VNFD2_PKG} slice_basic_middle_vnf +${NSD1_PKG} slice_basic_ns +${NSD2_PKG} slice_basic_middle_ns +${NST} slice_basic_nst/slice_basic_nst.yaml # Descriptor names -${nst_name} slice_basic_nst -${vnfd1_name} slice_basic_vnf -${vnfd2_name} slice_basic_middle_vnf -${nsd1_name} slice_basic_ns -${nsd2_name} slice_basic_middle_ns +${NST_NAME} slice_basic_nst +${VNFD1_NAME} slice_basic_vnf +${VNFD2_NAME} slice_basic_middle_vnf +${NSD1_NAME} slice_basic_ns +${NSD2_NAME} slice_basic_middle_ns # Instance names -${slice_name} slicebasic -${middle_ns_name} slicebasic.slice_basic_nsd_2 +${SLICE_NAME} slicebasic +${MIDDLE_NS_NAME} slicebasic.slice_basic_nsd_2 # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${ns_id} ${EMPTY} -${vnf_member_index} middle -${vnf_ip_addr} ${EMPTY} -${mgmt_vnf_ip} ${EMPTY} -${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } +${VNF_MEMBER_INDEX} middle +${VNF_IP_ADDR} ${EMPTY} +${MGMT_VNF_IP} ${EMPTY} +${NST_CONFIG} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } *** Test Cases *** Create Slice VNF Descriptors [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD1_PKG}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD2_PKG}' Create Slice NS Descriptors [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) - - Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' - Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${NSD1_PKG}' + Create NSD '%{PACKAGES_FOLDER}/${NSD2_PKG}' Create Slice Template [Documentation] Onboards the Network Slice Template: nst (in the variables file) - - Create NST '%{PACKAGES_FOLDER}/${nst}' + Create NST '%{PACKAGES_FOLDER}/${NST}' Network Slice Instance Test [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id) - - ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} - Set Suite Variable ${nsi_id} ${id} - + ${id}= Create Network Slice ${NST_NAME} %{VIM_TARGET} ${SLICE_NAME} ${NST_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NSI_ID} ${id} Get Middle Vnf Management Ip [Documentation] Obtains the management IP of the slice middle VNF (name in the reources file) and sets the ip as a suite variable (mgmt_vnf_ip) - - ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 - ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} - Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty - Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} - + ${middle_ns_id}= Run And Return RC And Output osm ns-list | grep ${MIDDLE_NS_NAME} | awk '{print $4}' 2>&1 + ${vnf_ip}= Get Vnf Management Ip Address ${middle_ns_id}[1] ${VNF_MEMBER_INDEX} + IF ${vnf_ip} == ${EMPTY} Fatal Error Variable \$\{ vnf_ip\} Empty + Set Suite Variable ${MGMT_VNF_IP} ${vnf_ip} Get Slice Vnf Ip Addresses [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips) - # Get all the ns_id in the slice except the middle one to avoid self ping - @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name} - Log many @{slice_ns_list} + @{slice_ns_list}= Get Slice Ns List Except One ${SLICE_NAME} ${MIDDLE_NS_NAME} + Log Many @{slice_ns_list} @{temp_list}= Create List # For each ns_id in the list, get all the vnf_id and their IP addresses FOR ${ns_id} IN @{slice_ns_list} Log ${ns_id} - @{vnf_id_list} Get Ns Vnf List ${ns_id} + @{vnf_id_list}= Get Ns Vnf List ${ns_id} # For each vnf_id in the list, get all its IP addresses - @{ns_ip_list} Get Ns Ip List @{vnf_id_list} + @{ns_ip_list}= Get Ns Ip List @{vnf_id_list} @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list} END Log List ${temp_list} - Set Suite Variable ${slice_vnfs_ips} ${temp_list} - + Set Suite Variable ${SLICE_VNFS_IPS} ${temp_list} Test Middle Ns Ping [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) - Sleep 60s Waiting for the network to be up # Ping to the middle VNF - Log ${mgmt_vnf_ip} - Test Connectivity ${mgmt_vnf_ip} - + Log ${MGMT_VNF_IP} + Test Connectivity ${MGMT_VNF_IP} Test Middle Vnf SSH Access [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file - Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} - + Test SSH Connection ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Test Slice Connectivity [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file ... and pings all the IP addresses in the list (slice_vnfs_ips) - - Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips} - + Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE_VNFS_IPS} Delete Slice Instance [Documentation] Stops the slice instance (slice_name) [Tags] cleanup - - Delete NSI ${slice_name} - + Delete NSI ${SLICE_NAME} Delete Slice Template [Documentation] Deletes the NST (nst_name) from OSM [Tags] cleanup - - Delete NST ${nst_name} - + Delete NST ${NST_NAME} Delete NS Descriptors [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name [Tags] cleanup - - Delete NSD ${nsd1_name} - Delete NSD ${nsd2_name} - + Delete NSD ${NSD1_NAME} + Delete NSD ${NSD2_NAME} Delete VNF Descriptors [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name [Tags] cleanup - - Delete VNFD ${vnfd1_name} - Delete VNFD ${vnfd2_name} + Delete VNFD ${VNFD1_NAME} + Delete VNFD ${VNFD2_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template - - Run Keyword If Any Tests Failed Delete NSI ${slice_name} - - Run Keyword If Any Tests Failed Delete NST ${nst_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd1_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd2_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name} - - - + Run Keyword If Any Tests Failed Delete NSI ${SLICE_NAME} + Run Keyword If Any Tests Failed Delete NST ${NST_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD1_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD2_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD1_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD2_NAME} diff --git a/robot-systest/testsuite/slice_02-shared_network_slicing.robot b/robot-systest/testsuite/slice_02-shared_network_slicing.robot index 869eb45..d5a376a 100644 --- a/robot-systest/testsuite/slice_02-shared_network_slicing.robot +++ b/robot-systest/testsuite/slice_02-shared_network_slicing.robot @@ -1,3 +1,4 @@ +*** Comments *** # Copyright 2020 Atos # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + *** Settings *** Documentation [SLICE-02] Shared Network Slicing. @@ -21,227 +23,180 @@ Library Collections Library Process Library SSHLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot +Resource ../lib/vnfd_lib.resource +Resource ../lib/nsd_lib.resource +Resource ../lib/nst_lib.resource +Resource ../lib/nsi_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/connectivity_lib.resource +Resource ../lib/ssh_lib.resource -Force Tags slice_02 cluster_slices daily regression +Test Tags slice_02 cluster_slices daily regression Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** - # NS and VNF descriptor package files -${vnfd1_pkg} slice_basic_vnf -${vnfd2_pkg} slice_basic_middle_vnf -${nsd1_pkg} slice_basic_ns -${nsd2_pkg} slice_basic_middle_ns -${nst} slice_basic_nst/slice_basic_nst.yaml -${nst2} slice_basic_nst/slice_basic_2nd_nst.yaml +${VNFD1_PKG} slice_basic_vnf +${VNFD2_PKG} slice_basic_middle_vnf +${NSD1_PKG} slice_basic_ns +${NSD2_PKG} slice_basic_middle_ns +${NST} slice_basic_nst/slice_basic_nst.yaml +${NST2} slice_basic_nst/slice_basic_2nd_nst.yaml # Instance names -${slice_name} slicebasic -${slice2_name} sliceshared -${middle_ns_name} slicebasic.slice_basic_nsd_2 +${SLICE_NAME} slicebasic +${SLICE2_NAME} sliceshared +${MIDDLE_NS_NAME} slicebasic.slice_basic_nsd_2 # Descriptor names -${nst_name} slice_basic_nst -${nst2_name} slice_basic_nst2 -${vnfd1_name} slice_basic_vnf -${vnfd2_name} slice_basic_middle_vnf -${nsd1_name} slice_basic_ns -${nsd2_name} slice_basic_middle_ns +${NST_NAME} slice_basic_nst +${NST2_NAME} slice_basic_nst2 +${VNFD1_NAME} slice_basic_vnf +${VNFD2_NAME} slice_basic_middle_vnf +${NSD1_NAME} slice_basic_ns +${NSD2_NAME} slice_basic_middle_ns # SSH keys and username to be used -${publickey} %{HOME}/.ssh/id_rsa.pub -${privatekey} %{HOME}/.ssh/id_rsa -${username} ubuntu -${password} ${EMPTY} +${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub +${PRIVATEKEY} %{HOME}/.ssh/id_rsa +${USERNAME} ubuntu +${PASSWORD} ${EMPTY} -${ns_id} ${EMPTY} -${vnf_member_index} middle -${vnf_ip_addr} ${EMPTY} -${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } +${VNF_MEMBER_INDEX} middle +${VNF_IP_ADDR} ${EMPTY} +${NST_CONFIG} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } *** Test Cases *** Create Slice VNF Descriptors [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) - - Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' - Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' - + Create VNFD '%{PACKAGES_FOLDER}/${VNFD1_PKG}' + Create VNFD '%{PACKAGES_FOLDER}/${VNFD2_PKG}' Create Slice NS Descriptors [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) - - Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' - Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' + Create NSD '%{PACKAGES_FOLDER}/${NSD1_PKG}' + Create NSD '%{PACKAGES_FOLDER}/${NSD2_PKG}' Create Slice Templates [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file) - - Create NST '%{PACKAGES_FOLDER}/${nst}' - Create NST '%{PACKAGES_FOLDER}/${nst2}' + Create NST '%{PACKAGES_FOLDER}/${NST}' + Create NST '%{PACKAGES_FOLDER}/${NST2}' Network Slice First Instance [Documentation] Instantiates the First NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id) ... The slice contains 3 NS (1 shared) - - ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} - Set Suite Variable ${nsi_id} ${id} - + ${id}= Create Network Slice ${NST_NAME} %{VIM_TARGET} ${SLICE_NAME} ${NST_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NSI_ID} ${id} Network Slice Second Instance [Documentation] Instantiates the Second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id) ... The slice contains 2 NS (1 shared) - - ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey} - Set Suite Variable ${nsi2_id} ${id} - + ${id}= Create Network Slice ${NST2_NAME} %{VIM_TARGET} ${SLICE2_NAME} ${NST_CONFIG} ${PUBLICKEY} + Set Suite Variable ${NSI2_ID} ${id} First Network Slice Ns Count [Documentation] Counts the NS in both slice instances and shoul be equal to 4 - - ${slice1_count}= Get Slice Ns Count ${slice_name} - ${slice2_count}= Get Slice Ns Count ${slice2_name} + ${slice1_count}= Get Slice Ns Count ${SLICE_NAME} + ${slice2_count}= Get Slice Ns Count ${SLICE2_NAME} ${together}= Evaluate ${slice1_count} + ${slice2_count} Should Be Equal As Integers ${together} 4 - Get Middle Vnf Management Ip [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip) - - ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 - ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} - Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty - Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} - + ${middle_ns_id}= Run And Return RC And Output osm ns-list | grep ${MIDDLE_NS_NAME} | awk '{print $4}' 2>&1 + ${vnf_ip}= Get Vnf Management Ip Address ${middle_ns_id}[1] ${VNF_MEMBER_INDEX} + IF ${vnf_ip} == ${EMPTY} Fatal Error Variable \$\{ vnf_ip\} Empty + Set Suite Variable ${MGMT_VNF_IP} ${vnf_ip} Get First Slice Vnf IPs [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips) - # Get all the ns_id in the slice except the middle one - @{ip_list} Get Slice Vnf Ip Addresses ${slice_name} + @{ip_list}= Get Slice Vnf Ip Addresses ${SLICE_NAME} Should Be True ${ip_list} is not None - Set Suite Variable ${slice1_vnfs_ips} ${ip_list} - + Set Suite Variable ${SLICE1_VNFS_IPS} ${ip_list} Test Middle Ns Ping [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) - Sleep 60s Waiting for the network to be up # Ping to the middle VNF - Test Connectivity ${mgmt_vnf_ip} - + Test Connectivity ${MGMT_VNF_IP} Test Middle Vnf SSH Access [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file - Sleep 30s Waiting ssh daemon to be up - Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} - + Test SSH Connection ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} Test First Slice Connectivity [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file ... and pings all the IP addresses in the list (slice1_vnfs_ips) - - Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips} - + Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE1_VNFS_IPS} Delete Slice One Instance [Documentation] Stops the slice instance (slice_name) - [Tags] cleanup - - Delete NSI ${slice_name} - + Delete NSI ${SLICE_NAME} Second Network Slice Ns Count [Documentation] Counts the NS in both slice instances and should be equal to 2 - - ${slice1_count}= Get Slice Ns Count ${slice_name} - ${slice2_count}= Get Slice Ns Count ${slice2_name} + ${slice1_count}= Get Slice Ns Count ${SLICE_NAME} + ${slice2_count}= Get Slice Ns Count ${SLICE2_NAME} ${together}= Evaluate ${slice1_count} + ${slice2_count} Should Be Equal As Integers ${together} 2 Get Second Slice Vnf IPs [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips) - # Get all the ns_id in the slice - @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name} + @{ip_list}= Get Slice Vnf Ip Addresses ${SLICE2_NAME} Should Be True ${ip_list} is not None - Set Suite Variable ${slice2_vnfs_ips} ${ip_list} - + Set Suite Variable ${SLICE2_VNFS_IPS} ${ip_list} Test Second Slice Connectivity [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file ... and pings all the IP addresses in the list (slice2_vnfs_ips) - - Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips} - + Ping Many ${MGMT_VNF_IP} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} @{SLICE2_VNFS_IPS} Delete Slice Two Instance [Documentation] Stops the slice instance (slice2_name) - [Tags] cleanup - - Delete NSI ${slice2_name} - + Delete NSI ${SLICE2_NAME} Delete Slice One Template [Documentation] Deletes the NST (nst_name) from OSM - [Tags] cleanup - - Delete NST ${nst_name} - + Delete NST ${NST_NAME} Delete Slice Two Template [Documentation] Deletes the NST (nst2_name) from OSM - [Tags] cleanup - - Delete NST ${nst2_name} - + Delete NST ${NST2_NAME} Delete NS Descriptors [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name - [Tags] cleanup - - Delete NSD ${nsd1_name} - Delete NSD ${nsd2_name} - + Delete NSD ${NSD1_NAME} + Delete NSD ${NSD2_NAME} Delete VNF Descriptors [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name - [Tags] cleanup - - Delete VNFD ${vnfd1_name} - Delete VNFD ${vnfd2_name} + Delete VNFD ${VNFD1_NAME} + Delete VNFD ${VNFD2_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates + Run Keyword If Any Tests Failed Delete NSI ${SLICE_NAME} + Run Keyword If Any Tests Failed Delete NSI ${SLICE2_NAME} - Run Keyword If Any Tests Failed Delete NSI ${slice_name} - Run Keyword If Any Tests Failed Delete NSI ${slice2_name} - - Run Keyword If Any Tests Failed Delete NST ${nst_name} - Run Keyword If Any Tests Failed Delete NST ${nst2_name} - - Run Keyword If Any Tests Failed Delete NSD ${nsd1_name} - Run Keyword If Any Tests Failed Delete NSD ${nsd2_name} - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name} - Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name} + Run Keyword If Any Tests Failed Delete NST ${NST_NAME} + Run Keyword If Any Tests Failed Delete NST ${NST2_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD1_NAME} + Run Keyword If Any Tests Failed Delete NSD ${NSD2_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD1_NAME} + Run Keyword If Any Tests Failed Delete VNFD ${VNFD2_NAME} diff --git a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot index a238fb1..3d4bf90 100644 --- a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot +++ b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License + *** Settings *** Documentation [SOL003-01] Sol003 Api testing @@ -21,51 +23,50 @@ Library yaml Library JsonValidator Library JSONLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/rest_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot +Resource ../lib/rest_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/vim_lib.resource -Force Tags sol003_01 cluster_osm_rest daily +Test Tags sol003_01 cluster_osm_rest daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # SOL003 API URI paths -${vnf_instance_uri} /osm/vnflcm/v1/vnf_instances -${vnf_instantiate_uri} /osm/vnflcm/v1/vnf_instances -${vnf_instance_lcm_ops} /osm/vnflcm/v1/vnf_lcm_op_occs +${VNF_INSTANCE_URI} /osm/vnflcm/v1/vnf_instances +${VNF_INSTANCE_LCM_OPS} /osm/vnflcm/v1/vnf_lcm_op_occs # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_metrics_vnf -${vnfd_name} hackfest_basic_metrics-vnf +${VNFD_PKG} hackfest_basic_metrics_vnf +${VNFD_NAME} hackfest_basic_metrics-vnf *** Test Cases *** -Create VNF package from JSON file descriptor - [Documentation] Test case to create a VNF Identifier +Create VNF Package From JSON File + [Documentation] Create a VNF package and update it via SOL003 interface using a JSON file Get VNFDs List - ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' - Set Suite Variable ${vnfid} ${id} - ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} - Set Suite Variable ${created_vim_account_id} + ${id}= Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' + Log ${id} + ${CREATED_VIM_ACCOUNT_ID}= Get VIM Target ID %{VIM_TARGET} + Set Suite Variable ${CREATED_VIM_ACCOUNT_ID} Get Auth Token ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][0]} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - Log ${updated_json_obj} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} - Log ${updated_json_obj} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} - Log ${updated_json_obj} - Set Test Variable ${updated_json_obj} - Post API Request ${vnf_instance_uri} - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} + Log ${UPDATED_JSON_OBJ} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} + Log ${UPDATED_JSON_OBJ} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + Log ${UPDATED_JSON_OBJ} + Set Test Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI} ${UPDATED_JSON_OBJ} + Pass Execution If ${request_response.status_code} in ${SUCCESS_STATUS_CODE_LIST} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${createid} ${id[0]} + Set Suite Variable ${CREATEID} ${id[0]} Get VNFDs List Instantiate VNF @@ -76,13 +77,13 @@ Instantiate VNF ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][1]} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} - Set Test Variable ${updated_json_obj} - Post API Request ${vnf_instantiate_uri}/${createid}/instantiate - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..vnfId ${CREATEID} + Set Test Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/instantiate ${UPDATED_JSON_OBJ} + Pass Execution If ${request_response.status_code} in ${SUCCESS_STATUS_CODE_LIST} Instantiate VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${instantiateid} ${id[0]} + Set Suite Variable ${INSTANTIATEID} ${id[0]} Sleep 12s Get Ns List Get Vnf List @@ -90,112 +91,127 @@ Instantiate VNF Query VNF Instances [Documentation] Test case to query VNF Instance Get Auth Token - Get Api Request ${vnf_instance_uri} + Get Api Request ${VNF_INSTANCE_URI} ${value}= Get ID nsState Should Be Equal ${value} INSTANTIATED - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed + Pass Execution If ${request_response.status_code} in ${SUCCESS_STATUS_CODE_LIST} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${Queryid} ${id[0]} + Set Suite Variable ${QUERYID} ${id[0]} Query VNF Instance ID [Documentation] Test case to query Vnf instance ID Get Auth Token - Get Api Request ${vnf_instance_uri}/${Queryid} + Get Api Request ${VNF_INSTANCE_URI}/${QUERYID} ${value}= Get ID nsState Should Be Equal ${value} INSTANTIATED Should Be Equal As Strings ${RequestResponse.status_code} 200 ${id}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${Instanceid} ${id[0]} + Set Suite Variable ${INSTANCEID} ${id[0]} Query VNF LCM Ops [Documentation] Test case to Query VNF LCM operation Get Auth Token - Get Api Request ${vnf_instance_lcm_ops} - ${ID1}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmops} ${ID1[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops} + Get Api Request ${VNF_INSTANCE_LCM_OPS} + ${id1}= Get Value From Json ${request_response.json()} $.._id + Set Suite Variable ${LCMOPS} ${id1[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END Query VNF LCM Ops ID + [Documentation] Check if the operation has completed. Get Auth Token - Get Api Request ${vnf_instance_lcm_ops}/${lcmops} - ${ID1}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmopsid} ${ID1[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops}/${lcmops} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCMOPS} + ${id1}= Get Value From Json ${request_response.json()} $.._id + Set Suite Variable ${LCMOPSID} ${id1[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCMOPS} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END Scale VNF - [Documentation] Test case to Scale out VNF + [Documentation] Scale out VNF Get Auth Token ${json_path}= Read Directory ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json - ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][2]} - Set Test Variable ${updated_json_obj} - Post API Request ${vnf_instance_uri}/${createid}/scale + ${updated_json_obj}= Get Variable Value ${UPDATED_JSON_OBJ['data'][2]} + Set Test Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/scale ${UPDATED_JSON_OBJ} ${value}= Get ID id - ${ID1}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${scaleoutid} ${ID1[0]} - Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} + ${id1}= Get Value From Json ${request_response.json()} $..id + Set Suite Variable ${SCALEOUTID} ${id1[0]} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${SCALEOUTID} ${LcmopsScale}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmopsscaleid} ${LcmopsScale[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} + Set Suite Variable ${LCMOPSSCALEID} ${LcmopsScale[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${SCALEOUTID} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Scale VNF instance completed + Pass Execution If ${request_response.status_code} in ${SUCCESS_STATUS_CODE_LIST} Scale VNF instance completed Terminate VNF [Documentation] Test case to terminate the VNF Get Auth Token ${json_path}= Read Directory ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json - ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][3]} - Set Suite Variable ${updated_json_obj} - Post API Request ${vnf_instance_uri}/${createid}/terminate + ${updated_json_obj}= Get Variable Value ${UPDATED_JSON_OBJ['data'][3]} + Set Suite Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/terminate ${UPDATED_JSON_OBJ} ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${terminateid} ${id[0]} - Get Api Request ${vnf_instance_lcm_ops}/${terminateid} + Set Suite Variable ${TERMINATEID} ${id[0]} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${TERMINATEID} ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmopsscaleid} ${LcmopsTerminate[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops}/${terminateid} + Set Suite Variable ${LCMOPSSCALEID} ${LcmopsTerminate[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${TERMINATEID} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END - Pass Execution If ${request_response.status_code} in ${success_status_code_list} Terminate VNF instance completed + Pass Execution If ${request_response.status_code} in ${SUCCESS_STATUS_CODE_LIST} Terminate VNF instance completed Delete VNF - [Documentation] Test case to delete VNF + [Documentation] Delete VNF instance. Get Auth Token - Create Session APISession ${HOST} - &{Headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} - ${resp}= DELETE On Session APISession ${vnf_instance_uri}/${createid} headers=${Headers} - Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed + Create Session APISession ${REST_API_HOST} + &{Headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${ACCESS_TOKEN} + ${resp}= DELETE On Session APISession ${VNF_INSTANCE_URI}/${CREATEID} headers=${Headers} + Pass Execution If ${resp.status_code} in ${SUCCESS_STATUS_CODE_LIST} Delete VNF Instance completed Delete VNF Descriptor Test + [Documentation] Delete VNF package from OSM. [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot b/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot index 4c16dd8..6a2ae7a 100644 --- a/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot +++ b/robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot @@ -1,3 +1,4 @@ +*** Comments *** # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License + *** Settings *** -Documentation Sol003-02 Sol003 This script launches dual-stack IP addresses NS in VIM and verify the dualstack ip +Documentation [Sol003-02] Sol003 Dual Stack IP in VNFM NB interface Library OperatingSystem Library String @@ -21,55 +23,53 @@ Library yaml Library JsonValidator Library JSONLibrary -Resource %{ROBOT_DEVOPS_FOLDER}/lib/rest_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot -Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot +Resource ../lib/rest_lib.resource +Resource ../lib/vnfd_lib.resource +Resource ../lib/ns_lib.resource +Resource ../lib/vnf_lib.resource +Resource ../lib/vim_lib.resource -Force Tags sol003_02 cluster_osm_rest daily +Test Tags sol003_02 cluster_osm_rest daily Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** # SOL003 API URI paths -${vnf_instance_uri} /osm/vnflcm/v1/vnf_instances -${vnf_instantiate_uri} /osm/vnflcm/v1/vnf_instances -${vnf_instance_lcm_ops} /osm/vnflcm/v1/vnf_lcm_op_occs +${VNF_INSTANCE_URI} /osm/vnflcm/v1/vnf_instances +${VNF_INSTANCE_LCM_OPS} /osm/vnflcm/v1/vnf_lcm_op_occs # NS and VNF descriptor package folder and ids -${vnfd_pkg} hackfest_basic_vnf -${vnfd_name} hackfest_basic-vnf +${VNFD_PKG} hackfest_basic_vnf +${VNFD_NAME} hackfest_basic-vnf *** Test Cases *** - Create VNFD Descriptor [Documentation] Test case to create a VNF Identifier - ${vnfd_id}= Create VNFD %{PACKAGES_FOLDER}/${vnfd_pkg} - Set Suite Variable ${vnfd_id} - ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} - Set Suite Variable ${created_vim_account_id} + ${VNFD_ID}= Create VNFD %{PACKAGES_FOLDER}/${VNFD_PKG} + Set Suite Variable ${VNFD_ID} + ${CREATED_VIM_ACCOUNT_ID}= Get VIM Target ID %{VIM_TARGET} + Set Suite Variable ${CREATED_VIM_ACCOUNT_ID} Get Auth Token ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_DualStackip.json ${json_obj}= Get Variable Value ${json_obj['data'][0]} - ${ns_name}= Get Variable Value ${json_obj['vnfInstanceName']} - Set Suite Variable ${ns_name} - ${Value1}= Get Variable Value ${json_obj['additionalParams']['ip-address']} - Set Suite Variable ${Value1} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - Log ${updated_json_obj} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} - Log ${updated_json_obj} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} - Log ${updated_json_obj} - Set Test Variable ${updated_json_obj} - Post API Request ${vnf_instance_uri} + ${NS_NAME}= Get Variable Value ${json_obj['vnfInstanceName']} + Set Suite Variable ${NS_NAME} + ${VALUE1}= Get Variable Value ${json_obj['additionalParams']['ip-address']} + Set Suite Variable ${VALUE1} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} + Log ${UPDATED_JSON_OBJ} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} + Log ${UPDATED_JSON_OBJ} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + Log ${UPDATED_JSON_OBJ} + Set Test Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI} ${UPDATED_JSON_OBJ} Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${createid} ${id[0]} + Set Suite Variable ${CREATEID} ${id[0]} Get VNFDs List Instantiate VNF @@ -80,122 +80,128 @@ Instantiate VNF ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_DualStackip.json ${json_obj}= Get Variable Value ${json_obj['data'][1]} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} - Set Test Variable ${updated_json_obj} - Post API Request ${vnf_instantiate_uri}/${createid}/instantiate + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} + ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..vnfId ${CREATEID} + Set Test Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/instantiate ${UPDATED_JSON_OBJ} Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${instantiateid} ${id[0]} + Set Suite Variable ${VNF_INSTANCE_ID} ${id[0]} Sleep 12s Get Ns List Get Vnf List Get Ns Id - [Documentation] Get the ns id from the ns list + [Documentation] Get the NS identifier ${id}= Get Ns Id ${ns_name} - Set Suite Variable ${ns_id} ${id} + Set Suite Variable ${NS_ID} ${id} Get Dual Ip - [Documentation] Get the ip from the ns list - ${id}= Get Dual Ip ${ns_id} - Set Suite Variable ${ip} ${id} + [Documentation] Get the IP address from the NS + ${id}= Get Dual Ip ${NS_ID} + Set Suite Variable ${DUAL_IP} ${id} Query VNF Instances [Documentation] Test case to query VNF Instance Get Auth Token - Get Api Request ${vnf_instance_uri} + Get Api Request ${VNF_INSTANCE_URI} ${value}= Get ID nsState Should Be Equal ${value} INSTANTIATED Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${Queryid} ${id[0]} + Set Suite Variable ${QUERY_ID} ${id[0]} Query VNF Instance ID [Documentation] Test case to query Vnf instance ID Get Auth Token - Get Api Request ${vnf_instance_uri}/${Queryid} + Get Api Request ${VNF_INSTANCE_URI}/${QUERY_ID} ${value}= Get ID nsState Should Be Equal ${value} INSTANTIATED Should Be Equal As Strings ${RequestResponse.status_code} 200 ${id}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${Instanceid} ${id[0]} + Log ${id[0]} Query VNF LCM Ops [Documentation] Test case to Query VNF LCM operation Get Auth Token - Get Api Request ${vnf_instance_lcm_ops} - ${ID1}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmops} ${ID1[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops} - ${value}= Get ID operationState - ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + Get Api Request ${VNF_INSTANCE_LCM_OPS} + ${id1}= Get Value From Json ${request_response.json()} $.._id + Set Suite Variable ${LCM_OP_ID} ${id1[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS} + ${value}= Get ID operationState + ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED + IF ${status} + BREAK + ELSE + Sleep 10s + END END Query VNF LCM Ops ID [Documentation] Test case to Query VNF LCM operation id Get Auth Token - Get Api Request ${vnf_instance_lcm_ops}/${lcmops} - ${ID1}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmopsid} ${ID1[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops}/${lcmops} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} + ${id1}= Get Value From Json ${request_response.json()} $.._id + Log ${id1[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END Verify Dual Ip - Should Be Equal ${ip} ${Value1} - + [Documentation] Test case to terminate the VNF + Should Be Equal ${DUAL_IP} ${VALUE1} Terminate VNF [Documentation] Test case to terminate the VNF Get Auth Token ${json_path}= Read Directory - ${updated_json_obj}= Load JSON From File ${json_path}/sol003_DualStackip.json - ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][3]} - Set Suite Variable ${updated_json_obj} - Post API Request ${vnf_instance_uri}/${createid}/terminate + ${UPDATED_JSON_OBJ}= Load JSON From File ${json_path}/sol003_DualStackip.json + ${UPDATED_JSON_OBJ}= Get Variable Value ${UPDATED_JSON_OBJ['data'][3]} + Set Suite Variable ${UPDATED_JSON_OBJ} + Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/terminate ${UPDATED_JSON_OBJ} ${id}= Get Value From Json ${request_response.json()} $..id - Set Suite Variable ${terminateid} ${id[0]} - Get Api Request ${vnf_instance_lcm_ops}/${terminateid} + ${terminateid}= Set Variable ${id[0]} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id - Set Suite Variable ${lcmopsscaleid} ${LcmopsTerminate[0]} - FOR ${Index} IN RANGE 0 15 - Get Api Request ${vnf_instance_lcm_ops}/${terminateid} + Log ${LcmopsTerminate[0]} + FOR ${index} IN RANGE 0 15 + Log ${index} + Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} ${value}= Get ID operationState ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED - Run Keyword If ${status} Exit For Loop - ... ELSE Sleep 10s + IF ${status} + BREAK + ELSE + Sleep 10s + END END Pass Execution If ${request_response.status_code} in ${success_status_code_list} Terminate VNF instance completed Delete VNF [Documentation] Test case to delete VNF Get Auth Token - Create Session APISession ${HOST} - &{Headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} - ${resp}= DELETE On Session APISession ${vnf_instance_uri}/${createid} headers=${Headers} + Create Session APISession ${REST_API_HOST} + &{Headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} + ${resp}= DELETE On Session APISession ${VNF_INSTANCE_URI}/${CREATEID} headers=${Headers} Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed Delete VNF Descriptor Test [Documentation] Test case to delete the VNF descriptor test [Tags] cleanup - - Delete VNFD ${vnfd_name} + Delete VNFD ${VNFD_NAME} *** Keywords *** Suite Cleanup [Documentation] Test Suit Cleanup: Deleting Descriptor - - Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} - - - - + Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} diff --git a/tox.ini b/tox.ini index 729a3e0..58889d1 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ ####################################################################################### [tox] -envlist = black, cover, flake8, pylint, safety +envlist = black, cover, flake8, pylint, rflint, safety [tox:jenkins] toxworkdir = /tmp/.tox @@ -53,11 +53,26 @@ commands = ####################################################################################### [testenv:pylint] +changedir = {toxinidir}/robot-systest deps = {[testenv]deps} -r{toxinidir}/requirements-dev.txt pylint commands = - - pylint -E robot-systest/resources + pylint -E . + + +####################################################################################### +[testenv:rflint] +changedir = {toxinidir}/robot-systest +deps = {[testenv]deps} + -r{toxinidir}/requirements-dev.txt + robotframework-lint + robotframework-robocop +commands = + rflint --ignore LineTooLong --ignore TooFewTestSteps --ignore TooManyTestCases \ + --ignore TooManyTestSteps --ignore TooFewKeywordSteps \ + testsuite lib resources + robocop --configure return_status:quality_gate:E=0:W=0:I=0 --exclude 050*,0701,0923 . ####################################################################################### -- 2.25.1