Skip to content

Commit

Permalink
passt_attach_detach: add control to select the host interface
Browse files Browse the repository at this point in the history
The test host might have more than one interface and if passt
is tested against the second or any other than the first,
we need to make sure that the right information is checked.

Signed-off-by: Sebastian Mitterle <smitterl@redhat.com>
  • Loading branch information
smitterl committed Sep 15, 2023
1 parent 5fdffdf commit 1cfc37d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions libvirt/tests/src/virtual_network/passt/passt_attach_detach.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ def run(test, params, env):
scenario = params.get('scenario')
virsh_uri = params.get('virsh_uri')
add_iface = 'yes' == params.get('add_iface', 'no')
host_ip = utils_net.get_host_ip_address(ip_ver='ipv4')
host_ip_v6 = utils_net.get_host_ip_address(ip_ver='ipv6')
host_iface = params.get('host_iface')
host_iface = host_iface if host_iface else utils_net.get_net_if(
state="UP")[0]
host_iface_index = int(params.get('host_iface_index', 0))
host_ip = utils_net.get_ip_address_by_interface(host_iface, ip_ver='ipv4')
host_ip_v6 = utils_net.get_ip_address_by_interface(host_iface, ip_ver='ipv6')
iface_attrs = eval(params.get('iface_attrs'))
params['socket_dir'] = socket_dir = eval(params.get('socket_dir'))
params['proc_checks'] = proc_checks = eval(params.get('proc_checks', '{}'))
vm_iface = params.get('vm_iface', 'eno1')
mtu = params.get('mtu')
outside_ip = params.get('outside_ip')
host_iface = params.get('host_iface')
host_iface = host_iface if host_iface else utils_net.get_net_if(
state="UP")[0]
log_file = f'/run/user/{user_id}/passt.log'
iface_attrs['backend']['logFile'] = log_file
iface_attrs['source']['dev'] = host_iface
Expand Down Expand Up @@ -126,8 +127,8 @@ def run(test, params, env):
session = vm.wait_for_serial_login(timeout=60)
passt.check_vm_ip(iface_attrs, session, host_iface, vm_iface)
passt.check_vm_mtu(session, vm_iface, mtu)
passt.check_default_gw(session)
passt.check_nameserver(session)
passt.check_default_gw(session, host_iface_index)
passt.check_nameserver(session, cleanup=True)

ips = {
'outside_ip': outside_ip,
Expand All @@ -138,7 +139,8 @@ def run(test, params, env):
firewalld.stop()
LOG.debug(f'Service status of firewalld: {firewalld.status()}')
passt.check_connection(vm, vm_iface,
['TCP4', 'TCP6', 'UDP4', 'UDP6'])
['TCP4', 'TCP6', 'UDP4', 'UDP6'],
host_iface_index)

if 'portForwards' in iface_attrs:
passt.check_portforward(vm, host_ip, params)
Expand Down

0 comments on commit 1cfc37d

Please sign in to comment.