Resource Tcpdump.robot
Resource Utils.robot
Resource ../variables/Variables.robot
+Resource ../variables/openflowplugin/Variables.robot
Resource ../variables/netvirt/Variables.robot
Variables ../variables/netvirt/Modules.py
[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
# 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
${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]
+ 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]
+ ${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}
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}
[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
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
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}
[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}
+ ${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}]
+ BuiltIn.Should Contain ${output} ${subnets}[${INDEX}]
END
Neutron Cleanup
[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
Verify Expected Default Tables On Nodes
[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}
+ ${resp} = RequestsLibrary.Get Request session ${RFC8040_CONFIG_NODES_API}
+ 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}