]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-network: add test for issue #24377 24378/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Aug 2022 11:36:12 +0000 (20:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Aug 2022 11:50:02 +0000 (20:50 +0900)
The issue has been already fixed by
b05e52000b4eee764b383cc3031da0a3739e996e (PR #24020).

test/test-network/conf/21-bond-802.3ad.netdev [new file with mode: 0644]
test/test-network/conf/21-bond-802.3ad.network [new file with mode: 0644]
test/test-network/conf/21-dummy-bond-slave.network [new file with mode: 0644]
test/test-network/conf/21-vlan-on-bond.netdev [new file with mode: 0644]
test/test-network/conf/21-vlan-on-bond.network [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

diff --git a/test/test-network/conf/21-bond-802.3ad.netdev b/test/test-network/conf/21-bond-802.3ad.netdev
new file mode 100644 (file)
index 0000000..ccb8228
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[NetDev]
+Name=bond99
+Kind=bond
+
+[Bond]
+Mode=802.3ad
+TransmitHashPolicy=layer3+4
diff --git a/test/test-network/conf/21-bond-802.3ad.network b/test/test-network/conf/21-bond-802.3ad.network
new file mode 100644 (file)
index 0000000..9bed020
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=bond99
+
+[Network]
+VLAN=vlan99
+BindCarrier=test1 dummy98
+LinkLocalAddressing=no
diff --git a/test/test-network/conf/21-dummy-bond-slave.network b/test/test-network/conf/21-dummy-bond-slave.network
new file mode 100644 (file)
index 0000000..4c7c9d7
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=test1
+Name=dummy98
+
+[Network]
+Bond=bond99
diff --git a/test/test-network/conf/21-vlan-on-bond.netdev b/test/test-network/conf/21-vlan-on-bond.netdev
new file mode 100644 (file)
index 0000000..caa217a
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[NetDev]
+Name=vlan99
+Kind=vlan
+
+[VLAN]
+Id=20
diff --git a/test/test-network/conf/21-vlan-on-bond.network b/test/test-network/conf/21-vlan-on-bond.network
new file mode 100644 (file)
index 0000000..6536b7b
--- /dev/null
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=vlan99
+
+[Network]
+IPv6AcceptRA=false
+Address=192.168.23.5/24
+LinkLocalAddressing=yes
index d6625be9ffc14d25cdf3aac654c1571085ed1bb0..284bc3146fba9fb6d9f668eeba1ca9e750db8bd2 100755 (executable)
@@ -1199,6 +1199,31 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
         print(output)
         self.assertRegex(output, 'inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99')
 
+    def test_vlan_on_bond(self):
+        # For issue #24377 (https://github.com/systemd/systemd/issues/24377),
+        # which is fixed by b05e52000b4eee764b383cc3031da0a3739e996e (PR#24020).
+
+        copy_network_unit('21-bond-802.3ad.netdev', '21-bond-802.3ad.network',
+                          '21-vlan-on-bond.netdev', '21-vlan-on-bond.network')
+        start_networkd()
+        self.wait_online(['bond99:off'])
+        self.wait_operstate('vlan99', operstate='off', setup_state='configuring', setup_timeout=10)
+
+        # The commit b05e52000b4eee764b383cc3031da0a3739e996e adds ", ignoring". To make it easily confirmed
+        # that the issue is fixed by the commit, let's allow to match both string.
+        log_re = re.compile('vlan99: Could not bring up interface(, ignoring|): Network is down$', re.MULTILINE)
+        for i in range(20):
+            if i > 0:
+                time.sleep(0.5)
+            if log_re.search(read_networkd_log()):
+                break
+        else:
+            self.fail()
+
+        copy_network_unit('11-dummy.netdev', '12-dummy.netdev', '21-dummy-bond-slave.network')
+        networkctl_reload()
+        self.wait_online(['test1:enslaved', 'dummy98:enslaved', 'bond99:carrier', 'vlan99:routable'])
+
     def test_macvtap(self):
         first = True
         for mode in ['private', 'vepa', 'bridge', 'passthru']: