Merge pull request #12653 from yuwata/test-network-improvements-2

network: fix configuring vxcan devices and several test-network follow-ups
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-05-28 10:27:58 +02:00 committed by GitHub
commit 3f8841f286
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 31 deletions

View File

@ -77,7 +77,7 @@ static bool link_dhcp6_enabled(Link *link) {
if (link->network->bond)
return false;
if (STRPTR_IN_SET(link->kind, "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"))
return false;
if (manager_sysctl_ipv6_enabled(link->manager) == 0)
@ -98,7 +98,7 @@ static bool link_dhcp4_enabled(Link *link) {
if (link->network->bond)
return false;
if (STRPTR_IN_SET(link->kind, "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"))
return false;
return link->network->dhcp & ADDRESS_FAMILY_IPV4;
@ -116,7 +116,7 @@ static bool link_dhcp4_server_enabled(Link *link) {
if (link->network->bond)
return false;
if (STRPTR_IN_SET(link->kind, "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"))
return false;
return link->network->dhcp_server;
@ -132,7 +132,7 @@ bool link_ipv4ll_enabled(Link *link, AddressFamilyBoolean mask) {
if (!link->network)
return false;
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "ip6gre", "ip6tnl", "sit", "vti", "vti6", "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "ip6gre", "ip6tnl", "sit", "vti", "vti6", "can", "vcan", "vxcan"))
return false;
/* L3 or L3S mode do not support ARP. */
@ -157,7 +157,7 @@ static bool link_ipv6ll_enabled(Link *link) {
if (!link->network)
return false;
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "can", "vcan", "vxcan"))
return false;
if (link->network->bond)
@ -181,7 +181,7 @@ static bool link_ipv6_enabled(Link *link) {
if (manager_sysctl_ipv6_enabled(link->manager) == 0)
return false;
if (STRPTR_IN_SET(link->kind, "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"))
return false;
/* DHCPv6 client will not be started if no IPv6 link-local address is configured. */
@ -2569,7 +2569,7 @@ static int link_configure(Link *link) {
assert(link->network);
assert(link->state == LINK_STATE_INITIALIZED);
if (STRPTR_IN_SET(link->kind, "can", "vcan"))
if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"))
return link_configure_can(link);
/* Drop foreign config, but ignore loopback or critical devices.

View File

@ -4,3 +4,4 @@ Name=vlan99
[Network]
IPv6AcceptRA=false
Address=192.168.23.5/24
LinkLocalAddressing=yes

View File

@ -4,3 +4,4 @@ Name=macsec99
[Network]
IPv6AcceptRA=no
Address=10.1.2.3/16
LinkLocalAddressing=yes

View File

@ -0,0 +1,3 @@
[NetDev]
Kind=netdevsim
Name=netdevsim99

View File

@ -0,0 +1,6 @@
[NetDev]
Name=vxcan99
Kind=vxcan
[VXCAN]
Peer=vxcan-peer

View File

@ -6,4 +6,5 @@ MACAddress=00:50:56:c0:00:19
[Network]
IPv6AcceptRA=no
LinkLocalAddressing=yes
MACsec=macsec99

View File

@ -6,6 +6,11 @@ Name=macvtap99
Name=veth99
Name=veth-peer
Name=vcan99
Name=vxcan99
Name=vxcan-peer
Name=vrf99
Name=geneve99
Name=ipiptun99
[Network]
LinkLocalAddressing=yes

View File

@ -3,4 +3,5 @@ Name=test1
[Network]
IPv6AcceptRA=false
LinkLocalAddressing=yes
VXLAN=vxlan99

View File

@ -3,6 +3,7 @@ Name=vxlan99
[Network]
IPv6AcceptRA=no
LinkLocalAddressing=yes
[BridgeFDB]
MACAddress=00:11:22:33:44:55

View File

@ -265,6 +265,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'vtitun97',
'vtitun98',
'vtitun99',
'vxcan99',
'vxlan99',
'wg98',
'wg99']
@ -334,6 +335,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-vti-tunnel-local-any.netdev',
'25-vti-tunnel-remote-any.netdev',
'25-vti-tunnel.netdev',
'25-vxcan.netdev',
'25-vxlan.netdev',
'25-wireguard-23-peers.netdev',
'25-wireguard-23-peers.network',
@ -410,8 +412,6 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.start_networkd(0)
self.wait_online(['bridge99', 'test1:degraded'], bool_any=True)
self.check_link_exists('bridge99')
self.check_link_exists('test1')
self.check_operstate('bridge99', '(?:off|no-carrier)', setup_state='configuring')
self.check_operstate('test1', 'degraded')
@ -458,7 +458,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'21-vlan.network', '21-vlan-test1.network')
self.start_networkd(0)
self.wait_online(['test1', 'vlan99'])
self.wait_online(['test1:degraded', 'vlan99:routable'])
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'test1'], universal_newlines=True).rstrip()
print(output)
@ -570,12 +570,6 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'link/ether 12:34:56:78:9a:bd')
def test_dummy(self):
self.copy_unit_to_networkd_unit_path('11-dummy.netdev')
self.start_networkd(0)
self.wait_online(['test1:off'])
def test_tun(self):
self.copy_unit_to_networkd_unit_path('25-tun.netdev')
self.start_networkd(0)
@ -600,10 +594,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
@expectedFailureIfModuleIsNotAvailable('vrf')
def test_vrf(self):
self.copy_unit_to_networkd_unit_path('25-vrf.netdev')
self.copy_unit_to_networkd_unit_path('25-vrf.netdev', 'netdev-link-local-addressing-yes.network')
self.start_networkd(0)
self.wait_online(['vrf99:off'])
self.wait_online(['vrf99:carrier'])
@expectedFailureIfModuleIsNotAvailable('vcan')
def test_vcan(self):
@ -612,6 +606,13 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.wait_online(['vcan99:carrier'])
@expectedFailureIfModuleIsNotAvailable('vxcan')
def test_vxcan(self):
self.copy_unit_to_networkd_unit_path('25-vxcan.netdev', 'netdev-link-local-addressing-yes.network')
self.start_networkd(0)
self.wait_online(['vxcan99:carrier', 'vxcan-peer:carrier'])
@expectedFailureIfModuleIsNotAvailable('wireguard')
def test_wireguard(self):
self.copy_unit_to_networkd_unit_path('25-wireguard.netdev', '25-wireguard.network',
@ -644,10 +645,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'CJQUtcS9emY2fLYqDlpSZiE/QJyHkPWr\+WHtZLZ90FU=')
def test_geneve(self):
self.copy_unit_to_networkd_unit_path('25-geneve.netdev')
self.copy_unit_to_networkd_unit_path('25-geneve.netdev', 'netdev-link-local-addressing-yes.network')
self.start_networkd(0)
self.wait_online(['geneve99:off'])
self.wait_online(['geneve99:degraded'])
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'geneve99'], universal_newlines=True).rstrip()
print(output)
@ -842,9 +843,6 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.start_networkd(0)
self.wait_online(['isataptun99:routable', 'dummy98:degraded'])
self.check_link_exists('dummy98')
self.check_link_exists('isataptun99')
output = subprocess.check_output(['ip', '-d', 'link', 'show', 'isataptun99'], universal_newlines=True).rstrip()
print(output)
self.assertRegex(output, "isatap ")
@ -884,10 +882,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'oseq')
def test_tunnel_independent(self):
self.copy_unit_to_networkd_unit_path('25-ipip-tunnel-independent.netdev')
self.copy_unit_to_networkd_unit_path('25-ipip-tunnel-independent.netdev', 'netdev-link-local-addressing-yes.network')
self.start_networkd(0)
self.wait_online(['ipiptun99:off'])
self.wait_online(['ipiptun99:carrier'])
@expectedFailureIfModuleIsNotAvailable('fou')
def test_fou(self):
@ -1400,8 +1398,6 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.start_networkd(0)
self.wait_online(['dummy98:degraded'])
self.check_link_exists('dummy98')
self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'forwarding'), '1')
self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'use_tempaddr'), '2')
self.assertEqual(self.read_ipv6_sysctl_attr('dummy98', 'dad_transmits'), '3')
@ -1420,8 +1416,6 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.start_networkd(0)
self.wait_online(['dummy98:routable'])
self.check_link_exists('dummy98')
output = subprocess.check_output(['ip', '-4', 'address', 'show', 'dummy98'], universal_newlines=True).rstrip()
print(output)
self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98')
@ -1439,8 +1433,6 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.start_networkd(0)
self.wait_online(['dummy98:routable'])
self.check_link_exists('dummy98')
output = subprocess.check_output(['ip', '-4', 'address', 'show', 'dummy98'], universal_newlines=True).rstrip()
print(output)
self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98')