[Arguments] ${vm_name}
[Documentation] Run these commands to check whether the created vm instance is active or not.
${rc} ${output}= Run And Return Rc And Output openstack server show ${vm_name} | grep OS-EXT-STS:vm_state
- Should Not Be True ${rc}
+ Should Be True '${rc}' == '0'
Should Contain ${output} active
Poll VM Is ACTIVE
- [Arguments] ${vm_name} ${retry}=600s ${retry_interval}=5s
+ [Arguments] ${vm_name} ${retry}=600s ${retry_interval}=30s
[Documentation] Run these commands to check whether the created vm instance is active or not.
Wait Until Keyword Succeeds ${retry} ${retry_interval} Verify VM Is ACTIVE ${vm_name}
${ip_list} Create List @{EMPTY}
: FOR ${vm} IN @{vm_list}
\ ${rc} ${vm_ip_line}= Run And Return Rc And Output openstack console log show ${vm} | grep -i "obtained"
- \ Log ${vm_ip_line}
- \ Log ${rc}
\ @{vm_ip} Get Regexp Matches ${vm_ip_line} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
\ ${vm_ip_length} Get Length ${vm_ip}
\ Run Keyword If ${vm_ip_length}>0 Append To List ${ip_list} @{vm_ip}[0]
\ ... ELSE Append To List ${ip_list} None
\ ${rc} ${dhcp_ip_line}= Run And Return Rc And Output openstack console log show ${vm} | grep "^nameserver"
- \ Log ${dhcp_ip_line}
- \ Log ${rc}
\ ${dhcp_ip} Get Regexp Matches ${dhcp_ip_line} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
\ ${dhcp_ip_length} Get Length ${dhcp_ip}
\ Run Keyword If ${dhcp_ip_length}<=0 Append To List ${dhcp_ip} None
- \ Log ${dhcp_ip}
\ ${vm_console_output}= Run openstack console log show ${vm}
\ Log ${vm_console_output}
${dhcp_length} Get Length ${dhcp_ip}
Return From Keyword If ${dhcp_length}==0 ${ip_list} ${EMPTY}
[Return] ${ip_list} ${dhcp_ip}
+Get Match
+ [Arguments] ${text} ${regexp}
+ [Documentation] Wrapper around Get Regexp Matches to return None if not found or the first match if found.
+ @{matches} = String.Get Regexp Matches ${text} ${regexp}
+ ${matches_length} = Get Length ${matches}
+ BuiltIn.Set Test Variable ${match} None
+ BuiltIn.Run Keyword If ${matches_length} > 0 BuiltIn.Set Test Variable ${match} @{matches}[0]
+ [Return] ${match}
+
+Get VM IP
+ [Arguments] ${fail_on_none} ${vm}
+ [Documentation] Get the vm ip address and nameserver by scraping the vm's console log.
+ ... Get VM IP returns three values: [0] the vm IP, [1] the DHCP IP and [2] the vm console log.
+ ${rc} ${vm_console_output}= Run And Return Rc And Output openstack console log show ${vm}
+ ${vm_ip} = Set Variable None
+ ${dhcp_ip} = Set Variable None
+ ${match} = Get Match ${vm_console_output} ${REGEX_OBTAINED}
+ ${vm_ip} = Get Match ${match} ${REGEX_IPV4}
+ ${match} = Get Match ${vm_console_output} ${REGEX_NAMESERVER}
+ ${dhcp_ip} = Get Match ${match} ${REGEX_IPV4}
+ BuiltIn.Run Keyword If '${fail_on_none}' == 'true' Should Not Contain ${vm_ip} None
+ BuiltIn.Run Keyword If '${fail_on_none}' == 'true' Should Not Contain ${dhcp_ip} None
+ [Return] ${vm_ip} ${dhcp_ip} ${vm_console_output}
+
+Get VM IPs
+ [Arguments] @{vms}
+ [Documentation] Get the instance IP addresses and nameserver address for the list of given vms.
+ ... First poll for the vm instance to be in the active state, then poll for the vm ip address and nameserver.
+ ... Get VM IP returns three values: [0] the vm IP, [1] the DHCP IP and [2] the vm console log.
+ @{vm_ips} BuiltIn.Create List @{EMPTY}
+ : FOR ${vm} IN @{vms}
+ \ Poll VM Is ACTIVE ${vm}
+ \ ${status} ${ips_and_console_log} Run Keyword And Ignore Error Wait Until Keyword Succeeds 60s 15s
+ \ ... Get VM IP true ${vm}
+ \ # If there is trouble with Get VM IP, the status will be FAIL and the return value will be a string of what went
+ \ # wrong. We need to handle both the PASS and FAIL cases. In the FAIL case we know we wont have access to the
+ \ # console log, as it would not be returned; so we need to grab it again to log it. We also can append 'None' to
+ \ # the vm ip list if status is FAIL.
+ \ Run Keyword If "${status}" == "PASS" BuiltIn.Log ${ips_and_console_log[2]}
+ \ BuiltIn.Run Keyword If "${status}" == "PASS" Collections.Append To List ${vm_ips} ${ips_and_console_log[0]}
+ \ BuiltIn.Run Keyword If "${status}" == "FAIL" Collections.Append To List ${vm_ips} None
+ \ ${rc} ${vm_console_output}= BuiltIn.Run Keyword If "${status}" == "FAIL" Run And Return Rc And Output openstack console log show ${vm}
+ \ BuiltIn.Run Keyword If "${status}" == "FAIL" BuiltIn.Log ${vm_console_output}
+ [Return] @{vm_ips} ${ips_and_console_log[1]}
+
Collect VM IPv6 SLAAC Addresses
[Arguments] ${fail_on_none} ${prefix} @{vm_list}
[Documentation] Using the console-log on the provided ${vm_list} to search for the string "inet6" which
Write Commands Until Expected Prompt ip route ${DEFAULT_LINUX_PROMPT_STRICT}
Write Commands Until Expected Prompt arp -an ${DEFAULT_LINUX_PROMPT_STRICT}
${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ${DEFAULT_LINUX_PROMPT_STRICT}
- @{lines} Split To Lines ${nslist}
+ @{lines} Split To Lines ${nslist} end=-1
: FOR ${line} IN @{lines}
\ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
\ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
... ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
${cmd} Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file} | grep '${type}'
${output} Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
- Log ${output}
+ [Return] ${output}
Get Karaf Log Types From Test Start
[Arguments] ${ip} ${test_name} ${types} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
Run Keyword And Ignore Error Get Model Dump ${HA_PROXY_IP} ${netvirt_data_models}
Get Karaf Log Events From Test Start ${test_name}
+Get Test Teardown Debugs For SFC
+ [Arguments] ${test_name}=${TEST_NAME}
+ Run Keyword And Ignore Error Get Model Dump ${HA_PROXY_IP} ${netvirt_sfc_data_models}
+
Show Debugs
[Arguments] @{vm_indices}
[Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node