X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fvim_lib.robot;h=8fd7e518aadb0a8f084cd8d2e615967f70f7a33b;hb=f4ebaa88025189ede4f073ab8a1f27c95efff867;hp=a156a9e04ac3892ab5036817e12a75bbc98cc263;hpb=15589053373c07bea08a52a6fc8dbcd6d80603ac;p=osm%2Ftests.git diff --git a/robot-systest/lib/vim_lib.robot b/robot-systest/lib/vim_lib.robot index a156a9e..8fd7e51 100644 --- a/robot-systest/lib/vim_lib.robot +++ b/robot-systest/lib/vim_lib.robot @@ -11,7 +11,7 @@ # limitations under the License. *** Settings *** -Documentation Library to manage VIM Targets. +Documentation Library to manage VIM Targets. Library String Library Collections @@ -24,84 +24,100 @@ Resource %{ROBOT_DEVOPS_FOLDER}/lib/prometheus_lib.robot ${success_return_code} 0 ${delete_max_wait_time} 1min ${delete_pol_time} 15sec -${vim_status_max_wait_time} 2min +${vim_status_max_wait_time} 3min ${vim_status_pol_time} 15sec +${vim_opstate_max_wait_time} 40sec +${vim_opstate_pol_time} 10sec *** Keywords *** Create VIM Target - [Documentation] Create a VIM Target in OSM. + [Documentation] Create a VIM Target in OSM. ... The optional parameters (such as 'config' or 'sdn_controller') are given to this function in name=value format. These parameters will be appended to the 'osm vim-create' command with the next syntax: --param_name=param_value ... Return the ID of the created VIM Target. ... Example of execution: - ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}' + ... \${vim_account_id}= Create VIM Target \${vim_name} \${vim_user} \${vim_password} \${vim_auth_url} \${vim_tenant} \${vim_account_type} config='{...}' - [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters} + [Arguments] ${vim_name} ${vim_user} ${vim_password} ${vim_auth_url} ${vim_tenant} ${vim_account_type} @{optional_parameters} - ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type} - FOR ${param} IN @{optional_parameters} - ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters - ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value} + ${osm_vim_create_command}= Set Variable osm vim-create --name ${vim_name} --user ${vim_user} --password ${vim_password} --auth_url ${vim_auth_url} --tenant ${vim_tenant} --account_type ${vim_account_type} + FOR ${param} IN @{optional_parameters} + ${match} ${param_name} ${param_value} = Should Match Regexp ${param} (.+)=(.+) msg=Syntax error in optional parameters + ${osm_vim_create_command}= Catenate ${osm_vim_create_command} --${param_name}=${param_value} END - ${rc} ${stdout}= Run and Return RC and Output ${osm_vim_create_command} - log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - [Return] ${stdout} + ${rc} ${stdout}= Run and Return RC and Output ${osm_vim_create_command} + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} Delete VIM Target [Arguments] ${vim_name} - ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm vim-delete ${vim_name} - log ${stdout} - Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for VIM Target ${vim_name} + ${rc} ${stdout}= Run Keyword And Continue On Failure Run and Return RC and Output osm vim-delete ${vim_name} + log ${stdout} + Wait Until Keyword Succeeds ${delete_max_wait_time} ${delete_pol_time} Check for VIM Target ${vim_name} Get VIM Targets - ${rc} ${stdout}= Run and Return RC and Output osm vim-list - log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + ${rc} ${stdout}= Run and Return RC and Output osm vim-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} Check for VIM Target - [Arguments] ${vim_name} + [Arguments] ${vim_name} - ${rc} ${stdout}= Run and Return RC and Output osm vim-list | awk '{print $2}' | grep ${vim_name} - Should Not Be Equal As Strings ${stdout} ${vim_name} + ${rc} ${stdout}= Run and Return RC and Output osm vim-list | awk '{print $2}' | grep ${vim_name} + Should Not Be Equal As Strings ${stdout} ${vim_name} Check for VIM Target Metric - [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} + [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} - ${vim_account_id}= Get VIM Target ID ${vim_name} - Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_host} ${prometheus_port} + ${vim_account_id}= Get VIM Target ID ${vim_name} + Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Has Metric ${vim_account_id} ${prometheus_host} ${prometheus_port} Check for VIM Target Status - [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} + [Arguments] ${vim_name} ${prometheus_host} ${prometheus_port} - ${vim_account_id}= Get VIM Target ID ${vim_name} - Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} + ${vim_account_id}= Get VIM Target ID ${vim_name} + Wait Until Keyword Succeeds ${vim_status_max_wait_time} ${vim_status_pol_time} Check If VIM Target Is Available ${vim_account_id} ${prometheus_host} ${prometheus_port} Get VIM Target ID - [Arguments] ${vim_name} + [Arguments] ${vim_name} + + ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $4}' + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false + [Return] ${stdout} + + +Check VIM Target Operational State + [Arguments] ${vim_name} + + Wait Until Keyword Succeeds ${vim_opstate_max_wait_time} ${vim_opstate_pol_time} Check If VIM Target Is Enabled ${vim_name} + + +Check If VIM Target Is Enabled + [Arguments] ${vim_name} - ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $4}' - Should Be Equal As Integers ${rc} ${success_return_code} - Should Not Be Equal As Strings ${stdout} ${EMPTY} msg=VIM Target '${vim_name}' not found values=false - [Return] ${stdout} + ${rc} ${stdout}= Run and Return RC and Output osm vim-list | grep " ${vim_name} " | awk '{print $6}' + Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Strings ${stdout} ENABLED msg=VIM Target '${vim_name}' is not enabled values=false Check If VIM Target Is Available - [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} + [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} - ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_vim_status vim_account_id=${vim_account_id} - Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false + ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_vim_status vim_account_id=${vim_account_id} + Should Be Equal As Integers ${metric} 1 msg=VIM Target '${vim_account_id}' is not active values=false Check If VIM Target Has Metric - [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} + [Arguments] ${vim_account_id} ${prometheus_host} ${prometheus_port} - ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_vim_status vim_account_id=${vim_account_id} + ${metric}= Get Metric ${prometheus_host} ${prometheus_port} osm_vim_status vim_account_id=${vim_account_id} Should Be True ${metric} <2 msg=VIM Target '${vim_account_id}' has no metric