aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-12-06 14:32:52 +0100
committerGitHub <noreply@github.com>2018-12-06 14:32:52 +0100
commit801503d22bcf3702a2ec708f61854441409a27b3 (patch)
treed65a0d34866a07403d79591078ad042dc008785a /test/test-network
parentMerge pull request #11032 from ssahani/invert-rule (diff)
parenttest-network: add test for bridge MulticastToUnicast (diff)
downloadsystemd-801503d22bcf3702a2ec708f61854441409a27b3.tar.gz
systemd-801503d22bcf3702a2ec708f61854441409a27b3.tar.bz2
systemd-801503d22bcf3702a2ec708f61854441409a27b3.zip
Merge pull request #10988 from ssahani/IFLA_BRPORT_MCAST_TO_UCAST
networkd: bridge add support to configure multicast_to_unicast
Diffstat (limited to 'test/test-network')
-rw-r--r--test/test-network/conf/26-bridge-slave-interface-1.network1
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py22
2 files changed, 19 insertions, 4 deletions
diff --git a/test/test-network/conf/26-bridge-slave-interface-1.network b/test/test-network/conf/26-bridge-slave-interface-1.network
index 84f221d53..81b372fb6 100644
--- a/test/test-network/conf/26-bridge-slave-interface-1.network
+++ b/test/test-network/conf/26-bridge-slave-interface-1.network
@@ -9,3 +9,4 @@ Cost=400
HairPin = true
FastLeave = true
UnicastFlood = true
+MulticastToUnicast = true
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 918eefa25..e709ef0dd 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -61,6 +61,15 @@ class Utilities():
with open(os.path.join(os.path.join(os.path.join('/sys/class/net/', link), dev), attribute)) as f:
return f.readline().strip()
+ def read_bridge_port_attr(self, bridge, link, attribute):
+
+ path_bridge = os.path.join('/sys/devices/virtual/net', bridge)
+ path_port = 'lower_' + link + '/brport'
+ path = os.path.join(path_bridge, path_port)
+
+ with open(os.path.join(path, attribute)) as f:
+ return f.readline().strip()
+
def link_exits(self, link):
return os.path.exists(os.path.join('/sys/class/net', link))
@@ -735,10 +744,15 @@ class NetworkdNetWorkBrideTests(unittest.TestCase, Utilities):
output = subprocess.check_output(['bridge', '-d', 'link', 'show', 'dummy98']).rstrip().decode('utf-8')
print(output)
- self.assertRegex(output, 'cost 400')
- self.assertRegex(output, 'hairpin on')
- self.assertRegex(output, 'flood on')
- self.assertRegex(output, 'fastleave on')
+
+ self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'hairpin_mode'), '1')
+ self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'path_cost'), '400')
+ self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'unicast_flood'), '1')
+ self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'multicast_fast_leave'), '1')
+
+ # CONFIG_BRIDGE_IGMP_SNOOPING=y
+ if (os.path.exists('/sys/devices/virtual/net/bridge00/lower_dummy98/brport/multicast_to_unicast')):
+ self.assertEqual(self.read_bridge_port_attr('bridge99', 'dummy98', 'multicast_to_unicast'), '1')
class NetworkdNetWorkLLDPTests(unittest.TestCase, Utilities):
links = ['veth99']