1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-14 04:58:28 +03:00

test-network: remove fou ports on failure

This commit is contained in:
Yu Watanabe 2019-05-24 13:39:50 +09:00
parent 9f10126f3c
commit def9fc0d65

View File

@ -112,6 +112,10 @@ class Utilities():
subprocess.call(['ip', 'link', 'del', 'dev', link])
time.sleep(1)
def remove_fou_ports(self, ports):
for port in ports:
subprocess.call(['ip', 'fou', 'del', 'port', port])
def l2tp_tunnel_remove(self, tunnel_ids):
output = subprocess.check_output(['ip', 'l2tp', 'show', 'tunnel'], universal_newlines=True).rstrip()
for tid in tunnel_ids:
@ -371,10 +375,16 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'vxlan-test1.network',
'vxlan.network']
fou_ports = [
'55555',
'55556']
def setUp(self):
self.remove_fou_ports(self.fou_ports)
self.link_remove(self.links)
def tearDown(self):
self.remove_fou_ports(self.fou_ports)
self.link_remove(self.links)
self.remove_unit_from_networkd_path(self.units)
@ -924,9 +934,6 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55556')
subprocess.call(['ip', 'fou', 'del', 'port', '55555'])
subprocess.call(['ip', 'fou', 'del', 'port', '55556'])
def test_vxlan(self):
self.copy_unit_to_networkd_unit_path('25-vxlan.netdev', 'vxlan.network',
'11-dummy.netdev', 'vxlan-test1.network')