From a131bf078c13b0c63ace7555be0944ac5e2fc588 Mon Sep 17 00:00:00 2001 From: aticig Date: Thu, 25 Aug 2022 13:10:14 +0300 Subject: [PATCH] Adding robot tests to validate Feature 10944 change naming of charms Change-Id: I88c2c38d4be172502858c2fde7f7ef6d87afbd0b Signed-off-by: aticig --- robot-systest/lib/juju_lib.robot | 29 +++++++++++++++ .../testsuite/basic_06-vnf_with_charm.robot | 13 +++++++ .../testsuite/basic_12-ns_primitives.robot | 37 ++++++++++++++++++- 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/robot-systest/lib/juju_lib.robot b/robot-systest/lib/juju_lib.robot index 62f557e..8cc450c 100644 --- a/robot-systest/lib/juju_lib.robot +++ b/robot-systest/lib/juju_lib.robot @@ -32,3 +32,32 @@ Get Model Name ${model_name}= Set Variable ${kdu_name}-${ns_id} Should Be Equal As Strings ${model_name} ${stdout} [Return] ${stdout} + +Get Application Name VDU Level Charm + [Arguments] ${host} ${username} ${password} ${privatekey} ${model_name} ${vdu_profile_id} ${ee_name} + + Should Not Be Empty ${model_name} + ${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} + +Get Application Name NS Level Charm + [Arguments] ${host} ${username} ${password} ${privatekey} ${model_name} ${charm_name} + + Should Not Be Empty ${model_name} + ${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} + +Get Application Name VNF Level Charm + [Arguments] ${host} ${username} ${password} ${privatekey} ${model_name} ${vnf_profile_id} ${ee_name} + + Should Not Be Empty ${model_name} + ${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 diff --git a/robot-systest/testsuite/basic_06-vnf_with_charm.robot b/robot-systest/testsuite/basic_06-vnf_with_charm.robot index b3ae63e..a3bf07e 100644 --- a/robot-systest/testsuite/basic_06-vnf_with_charm.robot +++ b/robot-systest/testsuite/basic_06-vnf_with_charm.robot @@ -20,6 +20,7 @@ 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 Force Tags basic_06 cluster_ee_config daily regression @@ -51,6 +52,10 @@ ${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 + *** Test Cases *** Create Charm VNF Descriptor @@ -67,6 +72,14 @@ 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} + + +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} + ${length}= Get Length ${vnf_charm_app_name} + Should Be True ${length} <50 Get Management Ip Addresses diff --git a/robot-systest/testsuite/basic_12-ns_primitives.robot b/robot-systest/testsuite/basic_12-ns_primitives.robot index 3355691..9a15ddf 100644 --- a/robot-systest/testsuite/basic_12-ns_primitives.robot +++ b/robot-systest/testsuite/basic_12-ns_primitives.robot @@ -18,11 +18,14 @@ Library OperatingSystem Library String 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 Force Tags basic_12 cluster_ee_config daily regression @@ -49,6 +52,18 @@ ${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 + +# # Username and SSH private key for accessing OSM host +${privatekey} %{OSM_RSA_FILE} +${username} ubuntu +${password} ${EMPTY} + +# Charm name to check ns level charm naming structure +${charm_name} ns + *** Test Cases *** Change Juju Password @@ -56,23 +71,41 @@ Change Juju Password ${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}= Get File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} + ${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}' + Upload Nsd 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} + + +Check NS Charm Application Name + + ${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} + ${length}= Get Length ${vdu_charm_app_name} + Should Be True ${length} <50 # TODO: Check Initial Config Primitives Status @@ -81,12 +114,14 @@ Delete NS Delete NS ${ns_name} + Delete NS Descriptor [Tags] cleanup Delete NSD ${nsd_name} Delete Temporary Descriptor Folder '%{PACKAGES_FOLDER}/${new_nsd_pkg}' + Delete VNF Descriptors [Tags] cleanup -- 2.17.1