X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fsdnc_lib.robot;h=1089b7cf2675cce3b59c98f50dccedce7f0ecbe8;hb=8c7c4c03bbb44a3299836291380a9f1ff22b9d5a;hp=13cb6dc824d4502aab6c8cdec17b2bf08e291037;hpb=347a779370b29bba7421cdfd9e30048b4ed559a5;p=osm%2Ftests.git diff --git a/robot-systest/lib/sdnc_lib.robot b/robot-systest/lib/sdnc_lib.robot index 13cb6dc..1089b7c 100644 --- a/robot-systest/lib/sdnc_lib.robot +++ b/robot-systest/lib/sdnc_lib.robot @@ -11,7 +11,7 @@ # limitations under the License. *** Settings *** -Documentation Library to manage SDNCs. +Documentation Library to manage SDNCs. Library String Library Collections @@ -30,71 +30,72 @@ ${sdnc_status_pol_time} 1min *** Keywords *** Create SDNC - [Documentation] Creates an SDNC in OSM. + [Documentation] Creates an SDNC 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='{...}' + ... \${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} + [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 - ${osm_sdnc_create_command}= Catenate ${osm_sdnc_create_command} --${param_name}=${param_value} + ${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 + ${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} - log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} + ${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} Check for SDNC To Be Deleted - [Arguments] ${sdnc_name} + [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} Should Not Be Equal As Strings ${stdout} ${sdnc_name} Delete SDNC [Arguments] ${sdnc_name} - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm sdnc-delete ${sdnc_name} - log ${stdout} - Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for SDNC To Be Deleted ${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} Get SDNC List - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list - log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Check for SDNC - [Arguments] ${sdnc_name} + [Arguments] ${sdnc_id} - ${rc} ${stdout}= Run and Return RC and Output osm sdnc-list | awk '{print $2}' | grep ${sdnc_name} - Should Be Equal As Strings ${stdout} ${sdnc_name} + ${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} Check for SDNC Status - [Arguments] ${sdnc_name} ${prometheus_host} ${prometheus_port} + [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_user} ${prometheus_password} - ${sdnc_id}= Get SDNC ID ${sdnc_name} - Wait Until Keyword Succeeds ${sdnc_status_max_wait_time} ${sdnc_status_pol_time} Check If SDNC Is Available ${sdnc_id} ${prometheus_host} ${prometheus_port} + 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 - [Arguments] ${sdnc_name} + [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} - Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=SDNC '${sdnc_name}' not found values=false - [Return] ${stdout} + ${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} Check If SDNC Is Available - [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} + [Arguments] ${sdnc_id} ${prometheus_host} ${prometheus_port} ${prometheus_password} ${prometheus_user} ${prometheus_password} - ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_sdnc_status sdnc_id=${sdnc_id} - Should Be Equal As Integers ${metric} 0 msg=SDNC '${sdnc_id}' is not active values=false + ${metric}= Get Metric ${prometheus_host} ${prometheus_port} ${prometheus_password} ${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