Skip to content

Commit

Permalink
Merge pull request autotest#5382 from smitterl/passt_function
Browse files Browse the repository at this point in the history
passt/function: fix for multi-arch
  • Loading branch information
chloerh committed Jan 17, 2024
2 parents 69a6f01 + c2dc141 commit ba39c8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
15 changes: 11 additions & 4 deletions libvirt/tests/cfg/virtual_network/passt/passt_function.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
iface_attrs = {'model': 'virtio', 'acpi': {'index': '1'}, 'type_name': 'user', 'backend': {'type': 'passt'}, 'source': {'dev': host_iface}}
vm_iface = eno1
vm_ping_outside = pass
s390-virtio:
iface_attrs = {'model': 'virtio', 'type_name': 'user', 'backend': {'type': 'passt'}, 'source': {'dev': host_iface}}
vm_iface = enc1
- ip_portfw:
ipv6_prefix = 128
alias = {'name': 'ua-c87b89ff-b769-4abc-921f-30d42d7aec5b'}
Expand All @@ -30,6 +33,8 @@
vm_iface = eno1
vm_ping_outside = pass
vm_ping_host_public = pass
s390-virtio:
vm_iface = enc1
variants:
- ip_addr:
portForward_0 = {'attrs': {'proto': 'tcp'}, 'ranges': [{'start': '31339', 'to': '41339'}]}
Expand All @@ -54,8 +59,8 @@
portForward_0 = {'attrs': {'proto': 'tcp', 'dev': host_iface}, 'ranges': [{'start': '31339', 'to': '41339'}]}
portForward_1 = {'attrs': {'proto': 'udp', 'dev': host_iface}, 'ranges': [{'start': '2025'}]}
portForwards = [${portForward_0}, ${portForward_1}]
tcp_port_list = [f'*%{vm_iface}:31339']
udp_port_list = [f'0.0.0.0%{vm_iface}:2025', f'[::]%{vm_iface}:2025']
tcp_port_list = [f'*%{host_iface}:31339']
udp_port_list = [f'0.0.0.0%{host_iface}:2025', f'[::]%{host_iface}:2025']
conn_check_args_1 = ('TCP4', host_ip, 31339, 41339, True, None)
conn_check_args_2 = ('TCP6', host_ip_v6, 31339, 41339, True, None)
conn_check_args_3 = ('UDP4', host_ip, 2025, 2025, True, None)
Expand All @@ -65,9 +70,11 @@
portForward_1 = {'attrs': {'proto': 'udp', 'address': host_ip, 'dev': host_iface}, 'ranges': [{'start': '2025'}]}
portForward_2 = {'attrs': {'proto': 'tcp', 'address': host_ip_v6, 'dev': host_iface}, 'ranges': [{'start': '51339'}]}
portForwards = [${portForward_0}, ${portForward_1}, ${portForward_2}]
tcp_port_list = [f'{host_ip}%{vm_iface}:31339', f'[{host_ip_v6}]%{vm_iface}:51339']
udp_port_list = [f'{host_ip}%{vm_iface}:2025']
tcp_port_list = [f'{host_ip}%{host_iface}:31339', f'[{host_ip_v6}]%{host_iface}:51339']
udp_port_list = [f'{host_ip}%{host_iface}:2025']
conn_check_args_1 = ('TCP4', host_ip, 31339, 41339, True, None)
conn_check_args_2 = ('UDP4', host_ip, 2025, 2025, True, None)
conn_check_args_3 = ('TCP6', host_ip_v6, 51339, 51339, True, None)
iface_attrs = {'model': 'virtio', 'acpi': {'index': '1'}, 'ips': ${ips}, 'backend': ${backend}, 'source': {'dev': host_iface}, 'alias': ${alias}, 'type_name': 'user', 'portForwards': ${portForwards}}
s390-virtio:
iface_attrs = {'model': 'virtio', 'ips': ${ips}, 'backend': ${backend}, 'source': {'dev': host_iface}, 'alias': ${alias}, 'type_name': 'user', 'portForwards': ${portForwards}}
20 changes: 11 additions & 9 deletions libvirt/tests/src/virtual_network/passt/passt_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ def run(test, params, env):
test_passwd)
host_session.close()

host_ip = utils_net.get_host_ip_address(ip_ver='ipv4')
params['host_ip_v6'] = 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_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')
params['host_ip_v6'] = host_ip_v6
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 = eval(params.get('iface_attrs'))
iface_attrs['backend']['logFile'] = log_file
Expand Down Expand Up @@ -97,7 +97,7 @@ def run(test, params, env):
test.fail(f'Logfile of passt "{log_file}" not created')

session = vm.wait_for_serial_login(timeout=60)
passt.check_vm_ip(iface_attrs, session, host_iface)
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)
Expand All @@ -111,10 +111,12 @@ def run(test, params, env):

firewalld.stop()
LOG.debug(f'Status of firewalld: {firewalld.status()}')
passt.check_connection(vm, vm_iface, ['TCP4', 'TCP6', 'UDP4', 'UDP6'])
passt.check_connection(vm, vm_iface,
['TCP4', 'TCP6', 'UDP4', 'UDP6'],
host_iface)

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

vm_sess = vm.wait_for_serial_login(timeout=60)
vm_sess.cmd('systemctl start firewalld')
Expand Down

0 comments on commit ba39c8f

Please sign in to comment.