Refactor sol003_01 and sol003_02 tests: suite setup to get resources dir and update... 82/15282/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 16 Jul 2025 14:50:20 +0000 (16:50 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Wed, 16 Jul 2025 15:21:54 +0000 (17:21 +0200)
Change-Id: I4197e8499c43bdbc592f32f97bd38871518a1082
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
README.md
robot-systest/lib/rest_lib.resource
robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot
robot-systest/testsuite/sol003_02-dualstack_ip_vnfm.robot

index 45f7424..751c71c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -201,8 +201,8 @@ The following tags exist for each testsuite:
   - `cluster_sa`: `sa_01`, `sa_02`, `sa_07`
   - `cluster_slices`: `slice_01`, `slice_02`
   - `cluster_heal`: `heal_01`, `heal_02`, `heal_03`, `heal_04`
-  - `cluster_osm_rest`: `sol003_01`
-  - `cluster_gitops`: `gitops_01`
+  - `cluster_sol003`: `sol003_01`, `sol003_02`
+  - `cluster_gitops`: `gitops_01`, `gitops_02`
 - daily: for all testsuites that will run in the daily job
 - regression: for all testsuites that should pass in the current stable branch
 - sanity: for all testsuites that should be passed by each commit in the
index 82c95d2..6bec42d 100644 (file)
@@ -61,10 +61,10 @@ 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
+    Set Suite Variable   ${REST_API_HOST}   https://${env_host}:443
 
-Read Directory
-    [Documentation]   Read Current Directory and return it
+Get Resource Directory
+    [Documentation]   Return Directory corresponding to the resources folder
     ${Directory}=   Replace String   ${CURDIR}   lib   resources
     ${json_path}=   Set Variable   ${Directory}
     RETURN   ${json_path}
index 6e84541..e7d2dcb 100644 (file)
@@ -29,8 +29,9 @@ Resource   ../lib/ns_lib.resource
 Resource   ../lib/vnf_lib.resource
 Resource   ../lib/vim_lib.resource
 
-Test Tags   sol003_01   cluster_osm_rest   daily   regression
+Test Tags   sol003_01   cluster_sol003   daily   regression
 
+Suite Setup   Run Keyword And Ignore Error   Suite Preparation
 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
 
 
@@ -53,8 +54,7 @@ Create VNF Package From JSON File
     ${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}=   Load JSON From File   ${RESOURCE_DIR}/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}
@@ -74,8 +74,7 @@ Instantiate VNF
     Get Ns List
     Get Vnf List
     Get Auth Token
-    ${json_path}=   Read Directory
-    ${json_obj}=   Load JSON From File   ${json_path}/sol003_01-vnf-lifecycle-management.json
+    ${json_obj}=   Load JSON From File   ${RESOURCE_DIR}/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}
@@ -147,8 +146,7 @@ Query VNF LCM Ops ID
 Scale 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}=   Load JSON From File   ${RESOURCE_DIR}/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}
@@ -174,8 +172,7 @@ Scale VNF
 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}=   Load JSON From File   ${RESOURCE_DIR}/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}
@@ -212,6 +209,11 @@ Delete VNF Descriptor Test
 
 
 *** Keywords ***
+Suite Preparation
+    [Documentation]   Test Suite Preparation: Setting Prometheus Testsuite Variables
+    ${RESOURCE_DIR}=   Get Resource Directory
+    Set Suite Variable   ${RESOURCE_DIR}
+
 Suite Cleanup
     [Documentation]   Test Suit Cleanup: Deleting Descriptor
     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}
index 542b7ab..8ebe5fd 100644 (file)
@@ -30,8 +30,9 @@ Resource   ../lib/vnf_lib.resource
 Resource   ../lib/vim_lib.resource
 Resource   ../lib/nsd_lib.resource
 
-Test Tags   sol003_02   cluster_osm_rest   daily
+Test Tags   sol003_02   cluster_sol003   daily
 
+Suite Setup   Run Keyword And Ignore Error   Suite Preparation
 Suite Teardown   Run Keyword And Ignore Error   Suite Cleanup
 
 
@@ -53,8 +54,7 @@ Create VNFD Descriptor
     ${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_02-dualstack_ip_vnfm.json
+    ${json_obj}=   Load JSON From File   ${RESOURCE_DIR}/sol003_02-dualstack_ip_vnfm.json
     ${json_obj}=   Get Variable Value   ${json_obj['data'][0]}
     ${NS_NAME}=   Get Variable Value   ${json_obj['vnfInstanceName']}
     Set Suite Variable   ${NS_NAME}
@@ -76,8 +76,7 @@ Instantiate VNF
     Get Ns List
     Get Vnf List
     Get Auth Token
-    ${json_path}=   Read Directory
-    ${json_obj}=   Load JSON From File   ${json_path}/sol003_02-dualstack_ip_vnfm.json
+    ${json_obj}=   Load JSON From File   ${RESOURCE_DIR}/sol003_02-dualstack_ip_vnfm.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}
@@ -126,8 +125,7 @@ Verify Dual Ip
 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_02-dualstack_ip_vnfm.json
+    ${UPDATED_JSON_OBJ}=   Load JSON From File   ${RESOURCE_DIR}/sol003_02-dualstack_ip_vnfm.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}
@@ -164,6 +162,11 @@ Delete VNF Descriptor Test
 
 
 *** Keywords ***
+Suite Preparation
+    [Documentation]   Test Suite Preparation: Setting Prometheus Testsuite Variables
+    ${RESOURCE_DIR}=   Get Resource Directory
+    Set Suite Variable   ${RESOURCE_DIR}
+
 Suite Cleanup
     [Documentation]   Test Suit Cleanup: Deleting Descriptor
     Run Keyword If Any Tests Failed   Delete VNFD   ${VNFD_NAME}