Adding test BASIC24: Testing feature 10906 support of affinity groups
[osm/tests.git] / robot-systest / lib / ns_lib.robot
index a38a69e..49ac445 100644 (file)
@@ -286,4 +286,18 @@ Get Application Names
     ${rc}  ${stdout}=  Run and Return RC and Output  osm ns-show ${ns_name} --literal | yq ._admin.deployed.VCA[].application | tr -d \\"
     Should Be Equal As Integers  ${rc}  ${success_return_code}  msg=${stdout}  values=False
     @{app_names} =  Split String  ${stdout}
-    [Return]  ${app_names}
\ No newline at end of file
+    [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 eval '.vdur[] | select(.id == "${vdur_id}") | .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 eval '.affinity-or-anti-affinity-group[] | select(.id == ${affinity_group_id}) | .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}