[Arguments] ${network_uuid}
[Documentation] Returns tenant ID by reading it from existing network.
${resp} = TemplatedRequests.Get_From_Uri uri=${CONFIG_API}/neutron:neutron/networks/network/${network_uuid}/ accept=${ACCEPT_EMPTY} session=session
- ${tenant_id} = Utils.Extract Value From Content ${resp} /network/0/tenant-id strip
+ ${temp_vars} = BuiltIn.Set Variable ['network'][0]['tenant-id']
+ ${tenant_id} = Utils.Extract Value From Content ${resp} ${temp_vars}
[Return] ${tenant_id}
Create Network
[Arguments] @{name_of_networks}
[Documentation] Create required number of networks and return a list of the resulting network ids
${net_list_ids} = BuiltIn.Create List @{EMPTY}
- : FOR ${net} IN @{name_of_networks}
- \ ${output} = OpenStackOperations.Create Network ${net}
- \ ${net_id} = Get Regexp Matches ${output} ${REGEX_UUID}
- \ Collections.Append To List ${net_list_ids} ${net_id}
+ FOR ${net} IN @{name_of_networks}
+ ${output} = OpenStackOperations.Create Network ${net}
+ ${net_id} = Get Regexp Matches ${output} ${REGEX_UUID}
+ Collections.Append To List ${net_list_ids} ${net_id}
+ END
[Return] @{net_list_ids}
Update Network
[Documentation] Create required number of subnets for previously created networks and return subnet id
${number_of_networks} = BuiltIn.Get Length ${network_names}
@{subnet_id_list} = BuiltIn.Create List @{EMPTY}
- : FOR ${index} IN RANGE ${number_of_networks}
- \ OpenStackOperations.Create SubNet ${network_names[${index}]} ${subnet_names[${index}]} ${subnet_cidr[${index}]}
+ FOR ${index} IN RANGE ${number_of_networks}
+ OpenStackOperations.Create SubNet ${network_names[${index}]} ${subnet_names[${index}]} ${subnet_cidr[${index}]}
+ END
${sub_list} = OpenStackOperations.List Subnets
- : FOR ${index} IN RANGE ${number_of_networks}
- \ BuiltIn.Should Contain ${sub_list} ${subnet_names[${index}]}
- \ ${subnet_id} = OpenStackOperations.Get Subnet Id ${subnet_names[${index}]}
- \ Collections.Append To List ${subnet_id_list} ${subnet_id}
+ FOR ${index} IN RANGE ${number_of_networks}
+ BuiltIn.Should Contain ${sub_list} ${subnet_names[${index}]}
+ ${subnet_id} = OpenStackOperations.Get Subnet Id ${subnet_names[${index}]}
+ Collections.Append To List ${subnet_id_list} ${subnet_id}
+ END
[Return] @{subnet_id_list}
Update SubNet
# in a different format with the neutron vs openstack cli.
${address_pair_length} = BuiltIn.Get Length ${allowed_address_pairs}
${allowed_pairs_argv} = BuiltIn.Set Variable ${EMPTY}
- ${allowed_pairs_argv} = BuiltIn.Set Variable If '${address_pair_length}'=='2' --allowed-address ip-address=@{allowed_address_pairs}[0] --allowed-address ip-address=@{allowed_address_pairs}[1] ${allowed_pairs_argv}
+ ${allowed_pairs_argv} = BuiltIn.Set Variable If '${address_pair_length}'=='2' --allowed-address ip-address=${allowed_address_pairs}[0] --allowed-address ip-address=${allowed_address_pairs}[1] ${allowed_pairs_argv}
${output} = OpenStack CLI openstack port create --network ${network_name} ${port_name} --security-group ${sg} ${additional_args} ${allowed_pairs_argv}
Update Port
[Arguments] ${external_net} @{vm_list}
[Documentation] Create and associate floating IPs to VMs with nova request
${ip_list} = BuiltIn.Create List @{EMPTY}
- : FOR ${vm} IN @{vm_list}
- \ ${output} = OpenStack CLI openstack floating ip create ${external_net}
- \ @{ip} = String.Get Regexp Matches ${output} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
- \ ${ip_length} = BuiltIn.Get Length ${ip}
- \ BuiltIn.Run Keyword If ${ip_length}>0 Collections.Append To List ${ip_list} @{ip}[0]
- \ ... ELSE Collections.Append To List ${ip_list} None
- \ ${vm_ip} = OpenStack CLI openstack server show ${vm} | grep "addresses" | awk '{print $4}' | cut -d"=" -f 2
- \ ${port_id} = OpenStack CLI openstack port list | grep "ip_address='${vm_ip}'" | awk '{print $2}' | cut -d"=" -f 2
- \ ${output} = BuiltIn.Run Keyword If '${OPENSTACK_BRANCH}' == 'stable/rocky' OpenStack CLI openstack floating ip set --port ${port_id} @{ip}[0]
- \ ... ELSE OpenStack CLI openstack server add floating ip ${vm} @{ip}[0]
+ FOR ${vm} IN @{vm_list}
+ ${output} = OpenStack CLI openstack floating ip create ${external_net}
+ @{ip} = String.Get Regexp Matches ${output} [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
+ ${ip_length} = BuiltIn.Get Length ${ip}
+ BuiltIn.Run Keyword If ${ip_length}>0 Collections.Append To List ${ip_list} ${ip}[0]
+ ... ELSE Collections.Append To List ${ip_list} None
+ ${vm_ip} = OpenStack CLI openstack server show ${vm} | grep "addresses" | awk '{print $4}' | cut -d"=" -f 2
+ ${port_id} = OpenStack CLI openstack port list | grep "ip_address='${vm_ip}'" | awk '{print $2}' | cut -d"=" -f 2
+ ${output} = BuiltIn.Run Keyword If '${OPENSTACK_BRANCH}' == 'stable/rocky' OpenStack CLI openstack floating ip set --port ${port_id} ${ip}[0]
+ ... ELSE OpenStack CLI openstack server add floating ip ${vm} ${ip}[0]
+ END
[Return] ${ip_list}
Remove Floating Ip From Vm
.. ${max}=1
${image} BuiltIn.Set Variable If "${image}"=="${EMPTY}" ${CIRROS_${OPENSTACK_BRANCH}} ${image}
${net_id} = OpenStackOperations.Get Net Id ${net_name}
- : FOR ${vm} IN @{vm_instance_names}
- \ ${output} = OpenStack CLI openstack server create --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${vm} --security-group ${sg} --min ${min} --max ${max}
+ FOR ${vm} IN @{vm_instance_names}
+ ${output} = OpenStack CLI openstack server create --image ${image} --flavor ${flavor} --nic net-id=${net_id} ${vm} --security-group ${sg} --min ${min} --max ${max}
+ END
Create Vm Instance On Compute Node
[Arguments] ${net_name} ${vm_name} ${node_hostname} ${image}=${EMPTY} ${flavor}=m1.nano ${sg}=default
Verify VM Is ACTIVE
[Arguments] ${vm_name}
[Documentation] Run these commands to check whether the created vm instance is active or not.
+ OpenStack CLI openstack server show ${vm_name}
${output} = OpenStack CLI openstack server show ${vm_name} | grep OS-EXT-STS:vm_state
BuiltIn.Should Contain ${output} active
@{matches} = String.Get Regexp Matches ${text} ${regexp}
${matches_length} = BuiltIn.Get Length ${matches}
BuiltIn.Set Suite Variable ${OS_MATCH} None
- BuiltIn.Run Keyword If ${matches_length} > ${index} BuiltIn.Set Suite Variable ${OS_MATCH} @{matches}[${index}]
+ BuiltIn.Run Keyword If ${matches_length} > ${index} BuiltIn.Set Suite Variable ${OS_MATCH} ${matches}[${index}]
[Return] ${OS_MATCH}
Get VM IP
BuiltIn.Should Contain ${output} ${vm_ip}
Check If Instance Is Ready For Ssh Login Using Password
- [Arguments] ${net_name} ${vm_ip} ${user}=cirros ${password}=cubswin:) ${console}=cirros
+ [Arguments] ${net_name} ${vm_ip} ${user}=cirros ${password}=${EMPTY} ${console}=cirros
[Documentation] Ensure the VM is reachable from ssh as tests would require. This keyword will use password authentication
+ ${password} BuiltIn.Set Variable If "${password}"=="${EMPTY}" ${PASSWORD_CIRROS_${OPENSTACK_BRANCH}}
${output} = Execute Command on VM Instance ${net_name} ${vm_ip} ifconfig ${user} ${password}
... console=${console}
BuiltIn.Should Contain ${output} ${vm_ip}
... TODO: there is a potential issue for a caller that passes in VMs belonging to different networks that
... may have different dhcp server addresses. Not sure what TODO about that, but noting it here for reference.
@{vm_ips} BuiltIn.Create List @{EMPTY}
- : FOR ${vm} IN @{vms}
- \ OpenStackOperations.Poll VM Is ACTIVE ${vm}
- \ ${status} ${ips_and_console_log} BuiltIn.Run Keyword And Ignore Error BuiltIn.Wait Until Keyword Succeeds 180s 15s
- \ ... OpenStackOperations.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.
- \ BuiltIn.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
- \ ${vm_console_output} = BuiltIn.Run Keyword If "${status}" == "FAIL" OpenStack CLI openstack console log show ${vm}
- \ BuiltIn.Run Keyword If "${status}" == "FAIL" BuiltIn.Log ${vm_console_output}
+ FOR ${vm} IN @{vms}
+ OpenStackOperations.Poll VM Is ACTIVE ${vm}
+ ${status} ${ips_and_console_log} BuiltIn.Run Keyword And Ignore Error BuiltIn.Wait Until Keyword Succeeds 180s 15s
+ ... OpenStackOperations.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.
+ BuiltIn.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
+ ${vm_console_output} = BuiltIn.Run Keyword If "${status}" == "FAIL" OpenStack CLI openstack console log show ${vm}
+ BuiltIn.Run Keyword If "${status}" == "FAIL" BuiltIn.Log ${vm_console_output}
+ END
OpenStackOperations.Copy DHCP Files From Control Node
[Return] @{vm_ips} ${ips_and_console_log[1]}
... Returns an empty list if no IPv6 addresses found or if SSH connection fails.
... Otherwise, returns a list of IPv6 addresses.
${ipv6_list} = BuiltIn.Create List @{EMPTY}
- : FOR ${vm} IN @{vm_list}
- \ ${output} = OpenStack CLI openstack server show ${vm} -f shell
- \ ${pattern} = String.Replace String ${subnet} ::/64 (:[a-f0-9]{,4}){,4}
- \ @{vm_ipv6} = String.Get Regexp Matches ${output} ${pattern}
- \ ${vm_ip_length} = BuiltIn.Get Length ${vm_ipv6}[0]
- \ ${ipv6_data_from_vm} = BuiltIn.Run Keyword If ${vm_ip_length}>0 OpenStackOperations.Execute Command on VM Instance ${network} ${vm_ipv6[0]}
- \ ... ip -6 a
- \ @{ipv6} = String.Get Regexp Matches ${ipv6_data_from_vm} ${pattern}
- \ ${ipv6_addr_list_length} BuiltIn.Get Length @{ipv6}
- \ BuiltIn.Run Keyword If ${ipv6_addr_list_length}>0 Collections.Append To List ${ipv6_list} ${ipv6[0]}
- \ ... ELSE Collections.Append To List ${ipv6_list} None
+ FOR ${vm} IN @{vm_list}
+ ${output} = OpenStack CLI openstack server show ${vm} -f shell
+ ${pattern} = String.Replace String ${subnet} ::/64 (:[a-f0-9]{,4}){,4}
+ @{vm_ipv6} = String.Get Regexp Matches ${output} ${pattern}
+ ${vm_ip_length} = BuiltIn.Get Length ${vm_ipv6}[0]
+ ${ipv6_data_from_vm} = BuiltIn.Run Keyword If ${vm_ip_length}>0 OpenStackOperations.Execute Command on VM Instance ${network} ${vm_ipv6[0]}
+ ... ip -6 a
+ @{ipv6} = String.Get Regexp Matches ${ipv6_data_from_vm} ${pattern}
+ ${ipv6_addr_list_length} BuiltIn.Get Length @{ipv6}
+ BuiltIn.Run Keyword If ${ipv6_addr_list_length}>0 Collections.Append To List ${ipv6_list} ${ipv6[0]}
+ ... ELSE Collections.Append To List ${ipv6_list} None
+ END
[Return] ${ipv6_list}
View Vm Console
[Arguments] ${vm_instance_names}
[Documentation] View Console log of the created vm instances using nova show.
- : FOR ${vm} IN @{vm_instance_names}
- \ ${output} = OpenStack CLI openstack server show ${vm}
- \ ${output} = OpenStack CLI openstack console log show ${vm}
+ FOR ${vm} IN @{vm_instance_names}
+ ${output} = OpenStack CLI openstack server show ${vm}
+ ${output} = OpenStack CLI openstack console log show ${vm}
+ END
Ping Vm From DHCP Namespace
[Arguments] ${net_name} ${vm_ip}
[Documentation] Run Ping command on the IP available as argument
${ethertype} = String.Get Regexp Matches ${ip_address} ${IP_REGEX}
${ping} = BuiltIn.Set Variable If ${ethertype} ping ping6
- ${cmd} = BuiltIn.Set Variable rc=0; for count in `seq 1 ${ping_tries}`; do ${ping} -W1 -t${ttl} -c1 ${ip_address}; rc=$?; if [ $rc -eq 0 ]; then break; fi; done; echo ping_rc=$rc
+ ${cmd} = BuiltIn.Set Variable rc=0; for count in `seq 1 ${ping_tries}`; do ${ping} -W1 -t${ttl} -c5 ${ip_address}; rc=$?; if [ $rc -eq 0 ]; then break; fi; done; echo ping_rc=$rc
${output} = Utils.Write Commands Until Expected Regexp ${cmd} ping_rc=\\d+ 120
BuiltIn.Log output: ${output}
BuiltIn.Should Contain ${output} 64 bytes
BuiltIn.Should Contain ${output} 200
Execute Command on VM Instance
- [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=cirros ${password}=cubswin:) ${cmd_timeout}=30s
+ [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=cirros ${password}=${EMPTY} ${cmd_timeout}=30s
... ${console}=cirros
[Documentation] Login to the vm instance using ssh in the network, executes a command inside the VM and returns the ouput.
+ ${password} BuiltIn.Set Variable If "${password}"=="${EMPTY}" ${PASSWORD_CIRROS_${OPENSTACK_BRANCH}}
OpenStackOperations.Get ControlNode Connection
${net_id} = OpenStackOperations.Get Net Id ${net_name}
${output} = Utils.Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh ${user}@${vm_ip} -o MACs=hmac-sha1 -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=password password:
BuiltIn.Should Be True '${rc}' == '0'
Test Operations From Vm Instance
- [Arguments] ${net_name} ${src_ip} ${dest_ips} ${user}=cirros ${password}=cubswin:) ${ttl}=64
+ [Arguments] ${net_name} ${src_ip} ${dest_ips} ${user}=cirros ${password}=${EMPTY} ${ttl}=64
... ${ping_should_succeed}=True ${check_metadata}=True ${console}=cirros ${ping_tries}=3
[Documentation] Login to the vm instance using ssh in the network.
+ ${password} BuiltIn.Set Variable If "${password}"=="${EMPTY}" ${PASSWORD_CIRROS_${OPENSTACK_BRANCH}}
OpenStackOperations.Get ControlNode Connection
${net_id} = OpenStackOperations.Get Net Id ${net_name}
${output} = Utils.Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ssh -o MACs=hmac-sha1 -o ConnectTimeout=5 -o StrictHostKeyChecking=no ${user}@${src_ip} -o UserKnownHostsFile=/dev/null password: 10s
BuiltIn.Run Keyword If ${rcode} Utils.Write Commands Until Expected Prompt route -A inet6 ${OS_SYSTEM_PROMPT}
BuiltIn.Run Keyword If ${rcode} Utils.Write Commands Until Expected Prompt arp -an ${OS_SYSTEM_PROMPT}
BuiltIn.Run Keyword If ${rcode} Utils.Write Commands Until Expected Prompt ip -f inet6 neigh show ${OS_SYSTEM_PROMPT}
- : FOR ${dest_ip} IN @{dest_ips}
- \ ${string_empty} = BuiltIn.Run Keyword And Return Status Should Be Empty ${dest_ip}
- \ BuiltIn.Run Keyword If ${string_empty} Continue For Loop
- \ BuiltIn.Run Keyword If ${rcode} and "${ping_should_succeed}" == "True" OpenStackOperations.Check Ping ${dest_ip} ttl=${ttl} ping_tries=${ping_tries}
- \ ... ELSE OpenStackOperations.Check No Ping ${dest_ip} ttl=${ttl}
+ FOR ${dest_ip} IN @{dest_ips}
+ ${string_empty} = BuiltIn.Run Keyword And Return Status Should Be Empty ${dest_ip}
+ BuiltIn.Run Keyword If ${string_empty} Continue For Loop
+ BuiltIn.Run Keyword If ${rcode} and "${ping_should_succeed}" == "True" OpenStackOperations.Check Ping ${dest_ip} ttl=${ttl} ping_tries=${ping_tries}
+ ... ELSE OpenStackOperations.Check No Ping ${dest_ip} ttl=${ttl}
+ END
${ethertype} = String.Get Regexp Matches ${src_ip} ${IP_REGEX}
BuiltIn.Run Keyword If ${rcode} and "${check_metadata}" and ${ethertype} == "True" OpenStackOperations.Check Metadata Access
[Teardown] Exit From Vm Console ${console}
Test Netcat Operations From Vm Instance
[Arguments] ${net_name} ${vm_ip} ${dest_ip} ${additional_args}=${EMPTY} ${port}=12345 ${user}=cirros
- ... ${password}=cubswin:)
+ ... ${password}=${EMPTY}
[Documentation] Use Netcat to test TCP/UDP connections to the controller
+ ${password} BuiltIn.Set Variable If "${password}"=="${EMPTY}" ${PASSWORD_CIRROS_${OPENSTACK_BRANCH}}
${client_data} BuiltIn.Set Variable Test Client Data
${server_data} BuiltIn.Set Variable Test Server Data
OpenStackOperations.Get ControlNode Connection
[Arguments] ${list_of_external_dst_ips} ${console}=cirros
[Documentation] Check reachability with other network's instances.
${rcode} = BuiltIn.Run Keyword And Return Status OpenStackOperations.Check If Console Is VmInstance ${console}
- : FOR ${dest_ip} IN @{list_of_external_dst_ips}
- \ OpenStackOperations.Check Ping ${dest_ip}
+ FOR ${dest_ip} IN @{list_of_external_dst_ips}
+ OpenStackOperations.Check Ping ${dest_ip}
+ END
Create Router
[Arguments] ${router_name}
Utils.Write Commands Until Expected Prompt arp -an ${DEFAULT_LINUX_PROMPT_STRICT}
${nslist} = Utils.Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ${DEFAULT_LINUX_PROMPT_STRICT}
@{lines} Split To Lines ${nslist} end=-1
- : FOR ${line} IN @{lines}
- \ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
- \ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
- \ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ${DEFAULT_LINUX_PROMPT_STRICT}
+ FOR ${line} IN @{lines}
+ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
+ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
+ Utils.Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ${DEFAULT_LINUX_PROMPT_STRICT}
+ END
Utils.Write Commands Until Expected Prompt sudo ovs-vsctl show ${DEFAULT_LINUX_PROMPT_STRICT}
Utils.Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ${DEFAULT_LINUX_PROMPT_STRICT}
Utils.Write Commands Until Expected Prompt sudo ovs-ofctl show ${INTEGRATION_BRIDGE} -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
Get OvsDebugInfo
[Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
- : FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
- \ OpenStackOperations.Get DumpFlows And Ovsconfig ${conn_id}
+ FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
+ OpenStackOperations.Get DumpFlows And Ovsconfig ${conn_id}
+ END
Get Test Teardown Debugs
[Arguments] ${test_name}=${SUITE_NAME}.${TEST_NAME} ${fail}=${FAIL_ON_EXCEPTIONS}
OpenStackOperations.Get OvsDebugInfo
BuiltIn.Run Keyword And Ignore Error DataModels.Get Model Dump ${HA_PROXY_IP} ${netvirt_data_models}
KarafKeywords.Fail If Exceptions Found During Test ${test_name} fail=${fail}
- : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
- \ BuiltIn.Run Keyword And Ignore Error Issue_Command_On_Karaf_Console trace:transactions ${ODL_SYSTEM_${i+1}_IP}
+ FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
+ BuiltIn.Run Keyword And Ignore Error Issue_Command_On_Karaf_Console trace:transactions ${ODL_SYSTEM_${i+1}_IP}
+ END
Get Suite Debugs
Get Test Teardown Debugs test_name=${SUITE_NAME} fail=False
[Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
OpenStackOperations.Get ControlNode Connection
${output} = DevstackUtils.Write Commands Until Prompt And Log sudo ip netns list
- : FOR ${index} IN @{vm_indices}
- \ ${rc} ${output} = OperatingSystem.Run And Return Rc And Output nova show ${index}
- \ BuiltIn.Log ${output}
+ FOR ${index} IN @{vm_indices}
+ ${rc} ${output} = OperatingSystem.Run And Return Rc And Output nova show ${index}
+ BuiltIn.Log ${output}
+ END
OpenStackOperations.List Nova VMs
OpenStackOperations.List Routers
OpenStackOperations.List Networks
[Documentation] Delete all security rules from a specified security group
${sg_rules_output} = OpenStack CLI openstack security group rule list ${sg_name} -cID -fvalue
@{sg_rules} = String.Split String ${sg_rules_output} \n
- : FOR ${rule} IN @{sg_rules}
- \ ${output} = OpenStack CLI openstack security group rule delete ${rule}
+ FOR ${rule} IN @{sg_rules}
+ ${output} = OpenStack CLI openstack security group rule delete ${rule}
+ END
Create Allow All SecurityGroup
[Arguments] ${sg_name} ${ether_type}=IPv4 ${dual}=False
[Arguments] ${ports}
[Documentation] Retrieve the port MacAddr for the given list of port name and return the MAC address list.
${macs} BuiltIn.Create List
- : FOR ${port} IN @{ports}
- \ ${mac} = OpenStackOperations.Get Port Mac ${port}
- \ Collections.Append To List ${macs} ${mac}
+ FOR ${port} IN @{ports}
+ ${mac} = OpenStackOperations.Get Port Mac ${port}
+ Collections.Append To List ${macs} ${mac}
+ END
[Return] ${macs}
Get Port Ip
Neutron Port List Rest
[Documentation] Keyword to get all ports details in Neutron (Using REST).
${resp} = RequestsLibrary.Get Request session ${PORT_URL}
- BuiltIn.Log ${resp.content}
+ BuiltIn.Log ${resp.text}
BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp.content}
+ [Return] ${resp.text}
Get Neutron Port Rest
[Arguments] ${port_id}
[Documentation] Keyword to get the specific port details in Neutron (Using REST).
${resp} = RequestsLibrary.Get Request session ${CONFIG_API}/${GET_PORT_URL}/${port_id}
- BuiltIn.Log ${resp.content}
+ BuiltIn.Log ${resp.text}
BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp.content}
+ [Return] ${resp.text}
Update Port Rest
[Arguments] ${port_id} ${json_data}
[Documentation] Keyword to update ${port_id} with json data received in ${json_data} (Using REST).
BuiltIn.Log ${json_data}
${resp} = RequestsLibrary.Put Request session ${CONFIG_API}/${GET_PORT_URL}/${port_id} ${json_data}
- BuiltIn.Log ${resp.content}
+ BuiltIn.Log ${resp.text}
BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp.content}
+ [Return] ${resp.text}
Get Neutron Network Rest
[Arguments] ${net_id}
[Documentation] Keyword to get the specific network details in Neutron (Using REST).
${resp} = RequestsLibrary.Get Request session ${NETWORK_URL}/network/${net_id}
- BuiltIn.Log ${resp.content}
+ BuiltIn.Log ${resp.text}
BuiltIn.Should Be Equal As Strings ${resp.status_code} 200
- [Return] ${resp.content}
+ [Return] ${resp.text}
Create And Configure Security Group
[Arguments] ${sg-name}
[Arguments] ${networks} ${subnets}
[Documentation] Check propagated routes
OpenStackOperations.Get ControlNode Connection
- : FOR ${INDEX} IN RANGE 0 1
- \ ${net_id} = OpenStackOperations.Get Net Id @{networks}[${INDEX}]
- \ ${is_ipv6} = String.Get Regexp Matches @{subnets}[${INDEX}] ${IP6_REGEX}
- \ ${length} = BuiltIn.Get Length ${is_ipv6}
- \ ${cmd} = BuiltIn.Set Variable If ${length} == 0 ip route ip -6 route
- \ ${output} = Utils.Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ${cmd} ${DEFAULT_LINUX_PROMPT_STRICT}
- \ BuiltIn.Should Contain ${output} @{subnets}[${INDEX}]
+ FOR ${INDEX} IN RANGE 0 1
+ ${net_id} = OpenStackOperations.Get Net Id ${networks}[${INDEX}]
+ ${is_ipv6} = String.Get Regexp Matches ${subnets}[${INDEX}] ${IP6_REGEX}
+ ${length} = BuiltIn.Get Length ${is_ipv6}
+ ${cmd} = BuiltIn.Set Variable If ${length} == 0 ip route ip -6 route
+ ${output} = Utils.Write Commands Until Expected Prompt sudo ip netns exec qdhcp-${net_id} ${cmd} ${DEFAULT_LINUX_PROMPT_STRICT}
+ BuiltIn.Should Contain ${output} ${subnets}[${INDEX}]
+ END
Neutron Cleanup
[Arguments] ${vms}=@{EMPTY} ${networks}=@{EMPTY} ${subnets}=@{EMPTY} ${ports}=@{EMPTY} ${sgs}=@{EMPTY}
- : FOR ${vm} IN @{vms}
- \ BuiltIn.Run Keyword And Ignore Error Delete Vm Instance ${vm}
- : FOR ${port} IN @{ports}
- \ BuiltIn.Run Keyword And Ignore Error Delete Port ${port}
- : FOR ${subnet} IN @{subnets}
- \ BuiltIn.Run Keyword And Ignore Error Delete SubNet ${subnet}
- : FOR ${network} IN @{networks}
- \ BuiltIn.Run Keyword And Ignore Error Delete Network ${network}
- : FOR ${sg} IN @{sgs}
- \ BuiltIn.Run Keyword And Ignore Error Delete SecurityGroup ${sg}
+ FOR ${vm} IN @{vms}
+ BuiltIn.Run Keyword And Ignore Error Delete Vm Instance ${vm}
+ END
+ FOR ${port} IN @{ports}
+ BuiltIn.Run Keyword And Ignore Error Delete Port ${port}
+ END
+ FOR ${subnet} IN @{subnets}
+ BuiltIn.Run Keyword And Ignore Error Delete SubNet ${subnet}
+ END
+ FOR ${network} IN @{networks}
+ BuiltIn.Run Keyword And Ignore Error Delete Network ${network}
+ END
+ FOR ${sg} IN @{sgs}
+ BuiltIn.Run Keyword And Ignore Error Delete SecurityGroup ${sg}
+ END
OpenStack List All
[Documentation] Get a list of different OpenStack resources that might be in use.
@{modules} = BuiltIn.Create List server port network subnet security group
... security group rule floating ip router
- : FOR ${module} IN @{modules}
- \ ${output} = OpenStack CLI openstack ${module} list
+ FOR ${module} IN @{modules}
+ ${output} = OpenStack CLI openstack ${module} list
+ END
OpenStack CLI Get List
[Arguments] ${cmd}
[Documentation] Cleanup all Openstack resources with best effort. The keyword will query for all resources
... in use and then attempt to delete them. Errors are ignored to allow the cleanup to continue.
@{fips} = OpenStack CLI Get List openstack floating ip list -f json
- : FOR ${fip} IN @{fips}
- \ BuiltIn.Run Keyword And Ignore Error Delete Floating IP ${fip['ID']}
+ FOR ${fip} IN @{fips}
+ BuiltIn.Run Keyword And Ignore Error Delete Floating IP ${fip['ID']}
+ END
@{vms} = OpenStack CLI Get List openstack server list -f json
- : FOR ${vm} IN @{vms}
- \ OpenStack CLI openstack server show ${vm['ID']}
- \ BuiltIn.Run Keyword And Ignore Error Delete Vm Instance ${vm['ID']}
+ FOR ${vm} IN @{vms}
+ OpenStack CLI openstack server show ${vm['ID']}
+ BuiltIn.Run Keyword And Ignore Error Delete Vm Instance ${vm['ID']}
+ END
@{routers} = OpenStack CLI Get List openstack router list -f json
- : FOR ${router} IN @{routers}
- \ BuiltIn.Run Keyword And Ignore Error Cleanup Router ${router['ID']}
+ FOR ${router} IN @{routers}
+ BuiltIn.Run Keyword And Ignore Error Cleanup Router ${router['ID']}
+ END
@{ports} = OpenStack CLI Get List openstack port list -f json
- : FOR ${port} IN @{ports}
- \ BuiltIn.Run Keyword And Ignore Error Delete Port ${port['ID']}
+ FOR ${port} IN @{ports}
+ BuiltIn.Run Keyword And Ignore Error Delete Port ${port['ID']}
+ END
@{networks} = OpenStack CLI Get List openstack network list -f json
- : FOR ${network} IN @{networks}
- \ BuiltIn.Run Keyword And Ignore Error Delete Subnet ${network['Subnets']}
- \ BuiltIn.Run Keyword And Ignore Error Delete Network ${network['ID']}
+ FOR ${network} IN @{networks}
+ BuiltIn.Run Keyword And Ignore Error Delete Subnet ${network['Subnets']}
+ BuiltIn.Run Keyword And Ignore Error Delete Network ${network['ID']}
+ END
@{security_groups} = OpenStack CLI Get List openstack security group list -f json
- : FOR ${security_group} IN @{security_groups}
- \ BuiltIn.Run Keyword If "${security_group['Name']}" != "default" BuiltIn.Run Keyword And Ignore Error Delete SecurityGroup ${security_group['ID']}
+ FOR ${security_group} IN @{security_groups}
+ BuiltIn.Run Keyword If "${security_group['Name']}" != "default" BuiltIn.Run Keyword And Ignore Error Delete SecurityGroup ${security_group['ID']}
+ END
OpenStack List All
Cleanup Router
[Arguments] ${id}
[Documentation] Delete a router, but first remove any interfaces or gateways so that the delete will be successful.
@{ports} = OpenStack CLI Get List openstack port list --router ${id} -f json --long
- : FOR ${port} IN @{ports}
- \ ${subnet_id} = OpenStackOperations.Get Match ${port['Fixed IP Addresses']} ${REGEX_UUID} 0
- \ BuiltIn.Run Keyword If "${port['Device Owner']}" == "network:router_gateway" BuiltIn.Run Keyword And Ignore Error Remove Gateway ${id}
- \ BuiltIn.Run Keyword If "${port['Device Owner']}" == "network:router_interface" BuiltIn.Run Keyword And Ignore Error Remove Interface ${id} ${subnet_id}
+ FOR ${port} IN @{ports}
+ ${subnet_id} = OpenStackOperations.Get Match ${port['Fixed IP Addresses']} ${REGEX_UUID} 0
+ BuiltIn.Run Keyword If "${port['Device Owner']}" == "network:router_gateway" BuiltIn.Run Keyword And Ignore Error Remove Gateway ${id}
+ BuiltIn.Run Keyword If "${port['Device Owner']}" == "network:router_interface" BuiltIn.Run Keyword And Ignore Error Remove Interface ${id} ${subnet_id}
+ END
BuiltIn.Run Keyword And Ignore Error Delete Router ${id}
OpenStack Suite Setup
OpenStack Cleanup All
OpenStackOperations.Stop Packet Capture On Nodes ${tcpdump_port_6653_conn_ids}
SSHLibrary.Close All Connections
- : FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
- \ KarafKeywords.Issue Command On Karaf Console threads --list | wc -l ${ODL_SYSTEM_${i+1}_IP}
+ FOR ${i} IN RANGE ${NUM_ODL_SYSTEM}
+ KarafKeywords.Issue Command On Karaf Console threads --list | wc -l ${ODL_SYSTEM_${i+1}_IP}
+ END
Validate Deployment
[Documentation] Validate the deployment. Examples to validate are verifying default table
... flows are installed and that the tunnel mesh has been built correctly.
Write To Validate File ----------------------------------------\n${SUITE_NAME}\n
- : FOR ${keyword} IN @{VALIDATION_KEYWORDS}
- \ ${status} = Builtin.Run Keyword And Return Status ${keyword}
- \ BuiltIn.Run Keyword If "${status}" == "FAIL" or "${status}" == "False" BuiltIn.Run Keywords Write To Validate File Failed: ${keyword}
- \ ... AND BuiltIn.Fail
- \ ... ELSE Write To Validate File Passed: ${keyword}
+ FOR ${keyword} IN @{VALIDATION_KEYWORDS}
+ ${status} = Builtin.Run Keyword And Return Status ${keyword}
+ BuiltIn.Run Keyword If "${status}" == "FAIL" or "${status}" == "False" BuiltIn.Run Keywords Write To Validate File Failed: ${keyword}
+ ... AND BuiltIn.Fail
+ ... ELSE Write To Validate File Passed: ${keyword}
+ END
Write To Validate File
[Arguments] ${msg}
Is Feature Installed
[Arguments] ${features}=none
- : FOR ${feature} IN @{features}
- \ ${status} ${output} BuiltIn.Run Keyword And Ignore Error BuiltIn.Should Contain ${CONTROLLERFEATURES} ${feature}
- \ Return From Keyword If "${status}" == "PASS" True
+ FOR ${feature} IN @{features}
+ ${status} ${output} BuiltIn.Run Keyword And Ignore Error BuiltIn.Should Contain ${CONTROLLERFEATURES} ${feature}
+ Return From Keyword If "${status}" == "PASS" True
+ END
[Return] False
Add OVS Logging On All OpenStack Nodes
[Documentation] Add higher levels of OVS logging to all the OpenStack nodes
- : FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
- \ OVSDB.Add OVS Logging ${conn_id}
+ FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
+ OVSDB.Add OVS Logging ${conn_id}
+ END
Reset OVS Logging On All OpenStack Nodes
[Documentation] Reset the OVS logging to all the OpenStack nodes
- : FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
- \ OVSDB.Reset OVS Logging ${conn_id}
+ FOR ${conn_id} IN @{OS_ALL_CONN_IDS}
+ OVSDB.Reset OVS Logging ${conn_id}
+ END
Start Packet Capture On Nodes
[Arguments] ${tag} ${filter} @{ips}
[Documentation] Returns network segmentation id for the given network name.
${output} = OpenStack CLI openstack network show ${network_name} | grep segmentation_id | awk '{print $4}'
@{list} = String.Split String ${output}
- [Return] @{list}[0]
+ [Return] ${list}[0]
Verify Services
[Documentation] Verify if the services are operational
[Arguments] ${node_ips}=@{OS_ALL_IPS}
[Documentation] Verify if Default Table Entries are programmed on all Nodes
${resp} = RequestsLibrary.Get Request session ${CONFIG_NODES_API}
- Utils.Log Content ${resp.content}
+ Utils.Log Content ${resp.text}
${failed_node_list} = BuiltIn.Create List
- : FOR ${node_ip} IN @{node_ips}
- \ ${failed_table_list} = Verify Expected Default Tables ${node_ip}
- \ ${failed_table_list_size} = BuiltIn.Get Length ${failed_table_list}
- \ BuiltIn.Run Keyword If ${failed_table_list_size} > 0 Collections.Append To List ${failed_node_list} ${node_ip}
+ FOR ${node_ip} IN @{node_ips}
+ ${failed_table_list} = Verify Expected Default Tables ${node_ip}
+ ${failed_table_list_size} = BuiltIn.Get Length ${failed_table_list}
+ BuiltIn.Run Keyword If ${failed_table_list_size} > 0 Collections.Append To List ${failed_node_list} ${node_ip}
+ END
Builtin.Should Be Empty ${failed_node_list}
Verify Expected Default Tables
${flow_dump} = Utils.Run Command On Remote System ${ovs_ip} sudo ovs-ofctl dump-flows ${INTEGRATION_BRIDGE} -OOpenFlow13
BuiltIn.Log ${flow_dump}
${failed_table_list} = BuiltIn.Create List
- : FOR ${table} IN @{DEFAULT_FLOW_TABLES}
- \ ${rc} = Builtin.Run Keyword And Return Status Builtin.Should Not Match Regexp ${flow_dump} .*table=${table}.*priority=0
- \ BuiltIn.Run Keyword If ${rc} Collections.Append To List ${failed_table_list} ${table}
+ FOR ${table} IN @{DEFAULT_FLOW_TABLES}
+ ${rc} = Builtin.Run Keyword And Return Status Builtin.Should Not Match Regexp ${flow_dump} .*table=${table}.*priority=0
+ BuiltIn.Run Keyword If ${rc} Collections.Append To List ${failed_table_list} ${table}
+ END
[Return] ${failed_table_list}
Get Project Id
Get BgpVpn Id
[Arguments] ${vpnName}
[Documentation] Retrieve the bgpvpn id for the given bgpvpn name
- ${output} = OpenStack CLI OperatingSystem.Run And Return Rc And Output openstack bgpvpn show ${vpnName} | grep " ID" | awk '{print $4}'
- ${splitted_output}= String.Split String ${output} ${EMPTY}
- ${vpn_id}= Collections.Get from List ${splitted_output} 0
+ ${output} = OpenStack CLI openstack bgpvpn show ${vpnName} | grep " ID" | awk '{print $4}'
+ ${splitted_output} = String.Split String ${output} ${EMPTY}
+ ${vpn_id} = Collections.Get from List ${splitted_output} 0
[Return] ${vpn_id}
Configure_IP_On_Sub_Interface