X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=robot-systest%2Flib%2Fcli%2Fns_lib.robot;h=e0eb0c2bd0fca215b9e6cfe677fe7900a889db70;hb=f3ec8f4cfb29ba0605f2b9263dcac169b4849593;hp=e3e3a0215046b206f9cd552f9bf4b85b7f3bcfcf;hpb=58af6b1f5c118080954f0b00ecd270bebd8491d0;p=osm%2Fdevops.git diff --git a/robot-systest/lib/cli/ns_lib.robot b/robot-systest/lib/cli/ns_lib.robot index e3e3a021..e0eb0c2b 100644 --- a/robot-systest/lib/cli/ns_lib.robot +++ b/robot-systest/lib/cli/ns_lib.robot @@ -29,65 +29,99 @@ ${ns_launch_max_wait_time} 5min ${ns_launch_pol_time} 30sec ${ns_delete_max_wait_time} 1min ${ns_delete_pol_time} 15sec - +${nsconfig} *** Keywords *** Get NS List [Documentation] Get ns instance list - ${rc} ${stdout}= Run and Return RC and Output osm ns-list + ${rc} ${stdout}= Run and Return RC and Output osm ns-list + log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + + +Get NS Instance ID + [Arguments] ${ns_name} + + ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" | awk 'NR==4{print $4}' log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + +Verify All JUJU Applications Status + [Arguments] ${ns} ${api_ip} ${api_port} ${username} ${password} ${api_cert_path} + + ${juju_model}= Get NS Instance ID ${ns} + + Import Library robot_juju.JujuLibrary ${api_ip} ${api_port} ${juju_model} ${username} ${password} ${api_cert_path} + Assert status of applications is ${status_active} Launch Network Services and Return - [Arguments] ${vim_name} - - Should Not Be Empty ${nsd_ids} There are no NS descriptors to launch the NS + [Arguments] ${vim_name} ${ns_config}='' + [Documentation] Get Configuration parameter to create Newtork service + + Run Keyword If ${ns_config}=='' Get NS Config + ... ELSE Set NS Config ${ns_config} + Log To Console \n${nsconfig} + Should Not Be Empty ${nsd_ids} There are no NS descriptors to launch the NS :FOR ${nsd} IN @{nsd_ids} \ ${ns_name}= GENERATE NAME \ Append To List ${ns_ids} ${ns_name} - \ Create Network Service ${nsd} ${vim_name} ${ns_name} - \ Delete NS ${ns_name} + \ Create Network Service ${nsd} ${vim_name} ${ns_name} ${nsconfig} + + +Set NS Config + [Arguments] ${ns_config} + [Documentation] Set NS Configuration variable + + ${nsconfig}= Get Variable Value ${ns_config} '' + Set Test Variable ${nsconfig} + + +Get NS Config + [Documentation] Get NS Configuration from Environment Variable + + ${nsconfig}= Get Environment Variable NS_CONFIG '' + Set Test Variable ${nsconfig} + - Create Network Service [Documentation] Create ns at osm - [Arguments] ${nsd} ${vim_name} ${ns_name} + [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} + + Run Keyword If ${ns_config}!='' Create Network Service With Config ${nsd} ${vim_name} ${ns_name} ${ns_config} + ... ELSE Create Network Service Without Config ${nsd} ${vim_name} ${ns_name} - ${ns_config}= Get Environment Variable NS_CONFIG ${EMPTY} - Run Keyword If ${ns_config}!='${EMPTY}' Create Network Service With Config ${nsd} ${vim_name} ${ns_name} ${ns_config} - ... ELSE Create Network Service Without Config ${nsd} ${vim_name} ${ns_name} - WAIT UNTIL KEYWORD SUCCEEDS ${ns_launch_max_wait_time} ${ns_launch_pol_time} Check For NS Instance To Configured ${ns_name} Check For NS Instance For Failure ${ns_name} - + Create Network Service Without Config [Documentation] Create ns at osm [Arguments] ${nsd} ${vim_name} ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} + ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${success_return_code} Create Network Service With Config [Documentation] Create ns at osm [Arguments] ${nsd} ${vim_name} ${ns_name} ${ns_config} - ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} --config ${ns_config} + ${rc} ${stdout}= Run and Return RC and Output osm ns-create --ns_name ${ns_name} --nsd_name ${nsd} --vim_account ${vim_name} --config ${ns_config} log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${success_return_code} + - Delete NS [Documentation] Delete ns [Arguments] ${ns} - ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} + ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Delete ${ns} @@ -95,27 +129,27 @@ Delete NS Check For NS Instance To Configured [Arguments] ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" + ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Contain Any ${stdout} configured failed + Should Be Equal As Integers ${rc} ${success_return_code} + Should Contain Any ${stdout} READY BROKEN Check For NS Instance For Failure [Arguments] ${ns_name} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" + ${rc} ${stdout}= Run and Return RC and Output osm ns-list --filter name="${ns_name}" log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} - Should Not Contain ${stdout} failed + Should Be Equal As Integers ${rc} ${success_return_code} + Should Not Contain ${stdout} BROKEN Check For NS Instance To Be Delete [Arguments] ${ns} - ${rc} ${stdout}= Run and Return RC and Output osm ns-list + ${rc} ${stdout}= Run and Return RC and Output osm ns-list log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${success_return_code} Should Not Contain ${stdout} ${ns} @@ -123,7 +157,37 @@ Force Delete NS [Documentation] Forcely Delete ns [Arguments] ${ns} - ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} + ${rc} ${stdout}= Run and Return RC and Output osm ns-delete ${ns} log ${stdout} - Should Be Equal As Integers ${rc} ${success_return_code} + Should Be Equal As Integers ${rc} ${success_return_code} WAIT UNTIL KEYWORD SUCCEEDS ${ns_delete_max_wait_time} ${ns_delete_pol_time} Check For NS Instance To Be Delete ${ns} + + +Perform VNF Scale-in Operation + [Arguments] ${ns} ${vnf_member} ${scaling_group} + + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-in operation is ${scaled_vnf} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-scale --scale-in --scaling-group ${scaling_group} ${ns} ${vnf_member} + Should Be Equal As Integers ${rc} ${success_return_code} + log ${stdout} + Sleep 1m Waiting for scale-in operation to complete + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF after scale-in operation is ${scaled_vnf} + + +Perform VNF Scale-out Operation + [Arguments] ${ns} ${vnf_member} ${scaling_group} + + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-out operation is ${scaled_vnf} + ${rc} ${stdout}= Run and Return RC and Output osm vnf-scale --scale-out --scaling-group ${scaling_group} ${ns} ${vnf_member} + Should Be Equal As Integers ${rc} ${success_return_code} + log ${stdout} + Sleep 1m Waiting for scale-out operation to complete + ${rc} ${nsr}= Run and Return RC and Output osm ns-show ${ns} --literal + ${scaled_vnf}= Get Scaled Vnf ${nsr} + log to console Scaled VNF befor scale-out operation is ${scaled_vnf}