| 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 TestNetworkingVLAN(netlib.NetworkCase): |
| 14 |
def testVlan(self) -> None: |
| 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.wait_for_iface(iface, active=False) |
| 24 |
|
| 25 |
# Make a VLAN interface |
| 26 |
b.click("button:contains('Add VLAN')") |
| 27 |
b.wait_visible("#network-vlan-settings-dialog") |
| 28 |
|
| 29 |
# wait until dialog initialized |
| 30 |
b.wait_visible("#network-vlan-settings-dialog button[aria-label=Close]") |
| 31 |
# Remove focus ring around the close button, which causes pixel tests retries. |
| 32 |
b.blur("#network-vlan-settings-dialog button[aria-label=Close]") |
| 33 |
b.wait_visible("#network-vlan-settings-interface-name-input") |
| 34 |
b.assert_pixels("#network-vlan-settings-dialog", "networking-vlan-settings-dialog") |
| 35 |
|
| 36 |
b.select_from_dropdown("#network-vlan-settings-parent-select", iface) |
| 37 |
b.set_input_text("#network-vlan-settings-interface-name-input", "tvlan") |
| 38 |
b.set_input_text("#network-vlan-settings-vlan-id-input", "123") |
| 39 |
b.click("#network-vlan-settings-dialog button:contains('Add')") |
| 40 |
b.wait_not_present("#network-vlan-settings-dialog") |
| 41 |
self.toggle_onoff("label[for='interface-switch']") |
| 42 |
b.wait_text("#network-interface-name", "tvlan") |
| 43 |
|
| 44 |
# It automatically activates. It won't get an IP address, but that's okay. |
| 45 |
self.wait_for_iface_setting("Status", "Configuring IP") |
| 46 |
|
| 47 |
# Check that the actual kernel device has the REORDER_HDR flag |
| 48 |
# set. NetworkManager stopped doing that for connections |
| 49 |
# created via D-Bus at some point. |
| 50 |
self.assertIn("REORDER_HDR", m.execute("ip -d link show tvlan | grep vlan")) |
| 51 |
|
| 52 |
# Delete it |
| 53 |
b.click("#network-interface button:contains('Delete')") |
| 54 |
b.wait_visible("#networking") |
| 55 |
b.wait_not_present("#networking-interfaces tr[data-interface='tvlan']") |
| 56 |
|
| 57 |
|
| 58 |
if __name__ == '__main__': |
| 59 |
testlib.test_main() |