| 1 |
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv) |
| 2 |
|
| 3 |
# |
| 4 |
# Copyright (C) 2013 Red Hat, Inc. |
| 5 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 |
|
| 7 |
|
| 8 |
import netlib |
| 9 |
import testlib |
| 10 |
|
| 11 |
|
| 12 |
@testlib.nondestructive |
| 13 |
class TestNetworkingMTU(netlib.NetworkCase): |
| 14 |
def testMtu(self): |
| 15 |
b = self.browser |
| 16 |
m = self.machine |
| 17 |
|
| 18 |
self.login_and_go("/network") |
| 19 |
b.wait_visible("#networking") |
| 20 |
|
| 21 |
iface = 'cockpit1' |
| 22 |
self.add_veth(iface, dhcp_cidr="10.111.113.2/20") |
| 23 |
self.nm_activate_eth(iface) |
| 24 |
self.wait_for_iface(iface) |
| 25 |
|
| 26 |
self.select_iface(iface) |
| 27 |
b.wait_visible("#network-interface") |
| 28 |
|
| 29 |
self.configure_iface_setting('MTU') |
| 30 |
b.wait_visible("#network-mtu-settings-dialog") |
| 31 |
|
| 32 |
# wait until dialog initialized |
| 33 |
b.wait_visible("#network-mtu-settings-dialog button[aria-label=Close]") |
| 34 |
b.wait_visible("#network-mtu-settings-custom") |
| 35 |
b.assert_pixels("#network-mtu-settings-dialog", "networking-mtu-settings-dialog") |
| 36 |
|
| 37 |
b.set_checked('#network-mtu-settings-custom', val=True) |
| 38 |
b.set_input_text("#network-mtu-settings-input", "-1500") |
| 39 |
b.click("button:contains('Save')") |
| 40 |
b.wait_in_text("#network-mtu-settings-error", "MTU must be a positive number") |
| 41 |
b.set_input_text('#network-mtu-settings-input', "1400") |
| 42 |
b.click("#network-mtu-settings-save") |
| 43 |
b.wait_not_present("#network-mtu-settings-dialog") |
| 44 |
self.wait_for_iface_setting('MTU', '1400') |
| 45 |
|
| 46 |
# We're debugging failures here log status to journal for diagnosis |
| 47 |
testlib.wait(lambda: "mtu 1400" in m.execute(f"ip link show {iface} | logger -s 2>&1")) |
| 48 |
|
| 49 |
self.configure_iface_setting("MTU") |
| 50 |
b.wait_visible("#network-mtu-settings-dialog") |
| 51 |
b.set_checked("#network-mtu-settings-auto", val=True) |
| 52 |
b.click("button:contains('Save')") |
| 53 |
self.wait_for_iface_setting("MTU", "Automatic") |
| 54 |
|
| 55 |
|
| 56 |
if __name__ == '__main__': |
| 57 |
testlib.test_main() |