Skip to content

Commit

Permalink
test-network: add tests for issue #11921
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwata authored and poettering committed Mar 11, 2019
1 parent 3a6797f commit 7f45d73
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions test/test-network/conf/21-vlan-test1.network
@@ -0,0 +1,2 @@
[Match]
Name=test1
5 changes: 5 additions & 0 deletions test/test-network/conf/21-vlan-test1.network.d/override.conf
@@ -0,0 +1,5 @@
[Network]
VLAN=vlan99
Address=192.168.24.5/24
Address=192.168.25.5/24
IPv6AcceptRA=false
6 changes: 5 additions & 1 deletion test/test-network/conf/21-vlan.network
@@ -1,2 +1,6 @@
[Match]
Name=test1
Name=vlan99

[Network]
IPv6AcceptRA=false
Address=192.168.23.5/24
2 changes: 0 additions & 2 deletions test/test-network/conf/21-vlan.network.d/override.conf

This file was deleted.

13 changes: 12 additions & 1 deletion test/test-network/systemd-networkd-tests.py
Expand Up @@ -214,6 +214,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'12-dummy.netdev',
'21-macvlan.netdev',
'21-macvtap.netdev',
'21-vlan-test1.network',
'21-vlan.netdev',
'21-vlan.network',
'25-6rd-tunnel.netdev',
Expand Down Expand Up @@ -341,7 +342,8 @@ def test_bond_balanced_tlb(self):
self.assertEqual('1', self.read_link_attr('bond99', 'bonding', 'tlb_dynamic_lb'))

def test_vlan(self):
self.copy_unit_to_networkd_unit_path('21-vlan.netdev', '11-dummy.netdev', '21-vlan.network')
self.copy_unit_to_networkd_unit_path('21-vlan.netdev', '11-dummy.netdev',
'21-vlan.network', '21-vlan-test1.network')
self.start_networkd()

self.assertTrue(self.link_exits('test1'))
Expand All @@ -360,6 +362,15 @@ def test_vlan(self):
self.assertTrue(output, 'MVRP')
self.assertTrue(output, ' id 99 ')

output = subprocess.check_output(['ip', '-4', 'address', 'show', 'dev', 'test1']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'inet 192.168.24.5/24 brd 192.168.24.255 scope global test1')
self.assertRegex(output, 'inet 192.168.25.5/24 brd 192.168.25.255 scope global test1')

output = subprocess.check_output(['ip', '-4', 'address', 'show', 'dev', 'vlan99']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'inet 192.168.23.5/24 brd 192.168.23.255 scope global vlan99')

def test_macvtap(self):
self.copy_unit_to_networkd_unit_path('21-macvtap.netdev', '11-dummy.netdev', 'macvtap.network')
self.start_networkd()
Expand Down

0 comments on commit 7f45d73

Please sign in to comment.