From 4de90962337dd5cfdec6735e6a568c6ebc5fa646 Mon Sep 17 00:00:00 2001 From: aguilarherna Date: Tue, 27 Apr 2021 09:44:27 +0000 Subject: [PATCH] Fix bug 1478: JUJU password is replaced in a copy of the NS package Change-Id: Ic8e75d661a8377db8f7e7cf0519fcac95b62739f Signed-off-by: aguilarherna --- .../resources/basic_12-ns_primitives_data.py | 1 + .../testsuite/basic_12-ns_primitives.robot | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/robot-systest/resources/basic_12-ns_primitives_data.py b/robot-systest/resources/basic_12-ns_primitives_data.py index 7a91f2e..1b92b5a 100644 --- a/robot-systest/resources/basic_12-ns_primitives_data.py +++ b/robot-systest/resources/basic_12-ns_primitives_data.py @@ -20,6 +20,7 @@ home = str(Path.home()) vnfd_pkg1 = 'nscharm_policy_vnf' vnfd_pkg2 = 'nscharm_user_vnf' nsd_pkg = 'nscharm_ns' +new_nsd_pkg = 'new_nscharm_ns' # NSD and VNFD names in OSM vnfd_name1 = 'nscharm-policy-vnf' vnfd_name2 = 'nscharm-user-vnf' diff --git a/robot-systest/testsuite/basic_12-ns_primitives.robot b/robot-systest/testsuite/basic_12-ns_primitives.robot index e4113e7..6b94d3a 100644 --- a/robot-systest/testsuite/basic_12-ns_primitives.robot +++ b/robot-systest/testsuite/basic_12-ns_primitives.robot @@ -34,15 +34,18 @@ Suite Teardown Run Keyword And Ignore Error Suite Cleanup *** Variables *** ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } ${publickey} ${EMPTY} +${success_return_code} 0 + *** Test Cases *** Change Juju Password - [Documentation] NS package needs to be updated with the Juju credentials for your OSM installation - ${nsd_yaml}= Get File %{PACKAGES_FOLDER}/${nsd_pkg}/${nsd_file} + ${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} ${changed_nsd_yaml}= Replace String ${nsd_yaml} ${old_juju_password} %{JUJU_PASSWORD} - Create File %{PACKAGES_FOLDER}/${nsd_pkg}/${nsd_file} ${changed_nsd_yaml} + Create File %{PACKAGES_FOLDER}/${new_nsd_pkg}/${nsd_file} ${changed_nsd_yaml} Upload Vnfds @@ -51,7 +54,7 @@ Upload Vnfds Upload Nsd - Create NSD %{PACKAGES_FOLDER}/${nsd_pkg}/ + Create NSD %{PACKAGES_FOLDER}/${new_nsd_pkg}/ Instantiate NS @@ -61,19 +64,17 @@ Instantiate NS # TODO: Check Initial Config Primitives Status Delete NS - [Tags] cleanup 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 Delete VNFD ${vnfd_name1} @@ -88,3 +89,14 @@ Suite Cleanup 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} + + -- 2.25.1