From 26bf9c302d322255ab8d70c963e812ed25faab38 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 21 Feb 2019 14:21:21 +0900 Subject: [PATCH] test-network: add tests for address pool --- .../conf/25-address-section.network | 11 +++++++++++ test/test-network/systemd-networkd-tests.py | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/test/test-network/conf/25-address-section.network b/test/test-network/conf/25-address-section.network index 3904953443a..29bbee4f60b 100644 --- a/test/test-network/conf/25-address-section.network +++ b/test/test-network/conf/25-address-section.network @@ -16,3 +16,14 @@ Label=33 [Address] Address=2001:db8::20 Peer=2001:db8::10/128 + +[Address] +Address=0.0.0.0/24 +Label=34 + +[Address] +Address=0.0.0.0/16 +Label=35 + +[Address] +Address=::/64 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index ced5e048f9a..757e6da6571 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -765,11 +765,28 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities): self.assertTrue(self.link_exits('dummy98')) - output = subprocess.check_output(['ip', 'address', 'show', 'dummy98']).rstrip().decode('utf-8') + # This also tests address pool + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'dummy98', 'label', '32']).rstrip().decode('utf-8') print(output) self.assertRegex(output, 'inet 10.2.3.4 peer 10.2.3.5/16 scope global 32') + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'dummy98', 'label', '33']).rstrip().decode('utf-8') + print(output) self.assertRegex(output, 'inet 10.6.7.8/16 brd 10.6.255.255 scope global 33') + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'dummy98', 'label', '34']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'inet 192.168.[0-9]*.1/24 brd 192.168.[0-9]*.255 scope global 34') + + output = subprocess.check_output(['ip', 'address', 'show', 'dev', 'dummy98', 'label', '35']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'inet 172.[0-9]*.0.1/16 brd 172.[0-9]*.255.255 scope global 35') + + output = subprocess.check_output(['ip', '-6', 'address', 'show', 'dev', 'dummy98']).rstrip().decode('utf-8') + print(output) self.assertRegex(output, 'inet6 2001:db8::20 peer 2001:db8::10/128 scope global') + self.assertRegex(output, 'inet6 fd[0-9a-f:]*1/64 scope global') output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8') print(output) -- 2.47.3