test-network: set xfrm interface ID

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

Fixes #22329.
This commit is contained in:
Yu Watanabe 2022-02-01 13:26:40 +09:00
parent fd11005951
commit 020483b248
5 changed files with 18 additions and 12 deletions

View file

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

View file

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

View file

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

View file

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

View file

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