1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-09-16 17:45:52 +03:00

test-network: set xfrm interface ID

This also unifies two tests for xfrm, and checks the output of
'ip link' command.

Fixes #22329.

(cherry picked from commit 020483b248)
This commit is contained in:
Yu Watanabe
2022-02-01 13:26:40 +09:00
committed by Luca Boccassi
parent 1ef56ad928
commit a5fc827b3a
5 changed files with 18 additions and 12 deletions

View File

@@ -4,4 +4,5 @@ Kind=xfrm
Name=xfrm99 Name=xfrm99
[Xfrm] [Xfrm]
InterfaceId=0x99
Independent=yes Independent=yes

View File

@@ -1,4 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev] [NetDev]
Kind=xfrm Kind=xfrm
Name=xfrm99 Name=xfrm98
[Xfrm]
InterfaceId=0x98

View File

@@ -18,7 +18,7 @@ Name=geneve99
Name=ifb99 Name=ifb99
Name=ipiptun99 Name=ipiptun99
Name=nlmon99 Name=nlmon99
Name=xfrm99 Name=xfrm98 xfrm99
Name=vxlan98 Name=vxlan98
Name=hogehogehogehogehogehoge Name=hogehogehogehogehogehoge

View File

@@ -4,4 +4,4 @@ Name=dummy98
[Network] [Network]
IPv6AcceptRA=no IPv6AcceptRA=no
Xfrm=xfrm99 Xfrm=xfrm98

View File

@@ -871,6 +871,7 @@ class NetworkctlTests(unittest.TestCase, Utilities):
class NetworkdNetDevTests(unittest.TestCase, Utilities): class NetworkdNetDevTests(unittest.TestCase, Utilities):
links_remove_earlier = [ links_remove_earlier = [
'xfrm98',
'xfrm99', 'xfrm99',
] ]
@@ -1759,20 +1760,21 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
@expectedFailureIfModuleIsNotAvailable('xfrm_interface') @expectedFailureIfModuleIsNotAvailable('xfrm_interface')
def test_xfrm(self): def test_xfrm(self):
copy_unit_to_networkd_unit_path('12-dummy.netdev', 'xfrm.network', copy_unit_to_networkd_unit_path('12-dummy.netdev', 'xfrm.network',
'25-xfrm.netdev', 'netdev-link-local-addressing-yes.network') '25-xfrm.netdev', '25-xfrm-independent.netdev',
'netdev-link-local-addressing-yes.network')
start_networkd() start_networkd()
self.wait_online(['xfrm99:degraded', 'dummy98:degraded']) self.wait_online(['dummy98:degraded', 'xfrm98:degraded', 'xfrm99:degraded'])
output = check_output('ip link show dev xfrm99') output = check_output('ip -d link show dev xfrm98')
print(output) print(output)
self.assertIn('xfrm98@dummy98:', output)
self.assertIn('xfrm if_id 0x98 ', output)
@expectedFailureIfModuleIsNotAvailable('xfrm_interface') output = check_output('ip -d link show dev xfrm99')
def test_xfrm_independent(self): print(output)
copy_unit_to_networkd_unit_path('25-xfrm-independent.netdev', 'netdev-link-local-addressing-yes.network') self.assertIn('xfrm99@lo:', output)
start_networkd() self.assertIn('xfrm if_id 0x99 ', output)
self.wait_online(['xfrm99:degraded'])
@expectedFailureIfModuleIsNotAvailable('fou') @expectedFailureIfModuleIsNotAvailable('fou')
def test_fou(self): def test_fou(self):