diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-21 17:48:49 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-21 19:31:50 +0100 |
commit | 6a97a864898c95d761347b2c1cfc5addf2ef3b9b (patch) | |
tree | 7742f6774b56fdfcd530c9bf56c3e99753d4e2ea /test/test-network | |
parent | network: fix netdev_tunnel_verify() (diff) | |
download | systemd-6a97a864898c95d761347b2c1cfc5addf2ef3b9b.tar.xz systemd-6a97a864898c95d761347b2c1cfc5addf2ef3b9b.zip |
test-network: add more tests for tunneling devices
Diffstat (limited to '')
30 files changed, 335 insertions, 18 deletions
diff --git a/test/test-network/conf/25-erspan-tunnel-local-any.netdev b/test/test-network/conf/25-erspan-tunnel-local-any.netdev new file mode 100644 index 0000000000..cd7df3ada1 --- /dev/null +++ b/test/test-network/conf/25-erspan-tunnel-local-any.netdev @@ -0,0 +1,11 @@ +[NetDev] +Name=erspan98 +Kind=erspan + +[Tunnel] +Independent=true +ERSPANIndex=124 +Local = any +Remote = 172.16.1.100 +Key=102 +SerializeTunneledPackets=true diff --git a/test/test-network/conf/25-erspan-tunnel.netdev b/test/test-network/conf/25-erspan-tunnel.netdev index 746b7ac64f..60da0e9dad 100644 --- a/test/test-network/conf/25-erspan-tunnel.netdev +++ b/test/test-network/conf/25-erspan-tunnel.netdev @@ -1,5 +1,5 @@ [NetDev] -Name=erspan-test +Name=erspan99 Kind=erspan [Tunnel] diff --git a/test/test-network/conf/25-gre-tunnel-local-any.netdev b/test/test-network/conf/25-gre-tunnel-local-any.netdev new file mode 100644 index 0000000000..69a92c6c44 --- /dev/null +++ b/test/test-network/conf/25-gre-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=gretun98 +Kind=gre + +[Tunnel] +Local=any +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-gre-tunnel-remote-any.netdev b/test/test-network/conf/25-gre-tunnel-remote-any.netdev new file mode 100644 index 0000000000..286b2699ed --- /dev/null +++ b/test/test-network/conf/25-gre-tunnel-remote-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=gretun97 +Kind=gre + +[Tunnel] +Local=10.65.223.238 +Remote=any diff --git a/test/test-network/conf/25-gretap-tunnel-local-any.netdev b/test/test-network/conf/25-gretap-tunnel-local-any.netdev new file mode 100644 index 0000000000..19e8d61d62 --- /dev/null +++ b/test/test-network/conf/25-gretap-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=gretap98 +Kind=gretap + +[Tunnel] +Local=any +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-ip6gre-tunnel-local-any.netdev b/test/test-network/conf/25-ip6gre-tunnel-local-any.netdev new file mode 100644 index 0000000000..b3781f027c --- /dev/null +++ b/test/test-network/conf/25-ip6gre-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=ip6gretun98 +Kind=ip6gre + +[Tunnel] +Local=any +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ip6gre-tunnel-remote-any.netdev b/test/test-network/conf/25-ip6gre-tunnel-remote-any.netdev new file mode 100644 index 0000000000..828c17f2a6 --- /dev/null +++ b/test/test-network/conf/25-ip6gre-tunnel-remote-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=ip6gretun97 +Kind=ip6gre + +[Tunnel] +Local=2a00:ffde:4567:edde::4987 +Remote=any diff --git a/test/test-network/conf/25-ip6gre-tunnel.netdev b/test/test-network/conf/25-ip6gre-tunnel.netdev index b16e0b4969..ba7d2bc372 100644 --- a/test/test-network/conf/25-ip6gre-tunnel.netdev +++ b/test/test-network/conf/25-ip6gre-tunnel.netdev @@ -1,6 +1,6 @@ [NetDev] -Name=ip6gretap99 -Kind=ip6gretap +Name=ip6gretun99 +Kind=ip6gre [Tunnel] Local=2a00:ffde:4567:edde::4987 diff --git a/test/test-network/conf/25-ip6gretap-tunnel-local-any.netdev b/test/test-network/conf/25-ip6gretap-tunnel-local-any.netdev new file mode 100644 index 0000000000..7a962e8a8e --- /dev/null +++ b/test/test-network/conf/25-ip6gretap-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=ip6gretap98 +Kind=ip6gretap + +[Tunnel] +Local=any +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ip6gretap-tunnel.netdev b/test/test-network/conf/25-ip6gretap-tunnel.netdev new file mode 100644 index 0000000000..b16e0b4969 --- /dev/null +++ b/test/test-network/conf/25-ip6gretap-tunnel.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=ip6gretap99 +Kind=ip6gretap + +[Tunnel] +Local=2a00:ffde:4567:edde::4987 +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ip6tnl-tunnel-local-any.netdev b/test/test-network/conf/25-ip6tnl-tunnel-local-any.netdev new file mode 100644 index 0000000000..7732eb8819 --- /dev/null +++ b/test/test-network/conf/25-ip6tnl-tunnel-local-any.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ip6tnl98 +Kind=ip6tnl + +[Tunnel] +Mode=ip6ip6 +Local=any +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-ip6tnl-tunnel-remote-any.netdev b/test/test-network/conf/25-ip6tnl-tunnel-remote-any.netdev new file mode 100644 index 0000000000..0d9d1e9007 --- /dev/null +++ b/test/test-network/conf/25-ip6tnl-tunnel-remote-any.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ip6tnl97 +Kind=ip6tnl + +[Tunnel] +Mode=ip6ip6 +Local=2a00:ffde:4567:edde::4987 +Remote=any diff --git a/test/test-network/conf/25-ipip-tunnel-local-any.netdev b/test/test-network/conf/25-ipip-tunnel-local-any.netdev new file mode 100644 index 0000000000..8fa27e82fd --- /dev/null +++ b/test/test-network/conf/25-ipip-tunnel-local-any.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ipiptun98 +Kind=ipip +MTUBytes=1480 + +[Tunnel] +Local=any +Remote=192.169.224.239 diff --git a/test/test-network/conf/25-ipip-tunnel-remote-any.netdev b/test/test-network/conf/25-ipip-tunnel-remote-any.netdev new file mode 100644 index 0000000000..58d7feb61f --- /dev/null +++ b/test/test-network/conf/25-ipip-tunnel-remote-any.netdev @@ -0,0 +1,8 @@ +[NetDev] +Name=ipiptun97 +Kind=ipip +MTUBytes=1480 + +[Tunnel] +Local=192.168.223.238 +Remote=any diff --git a/test/test-network/conf/25-sit-tunnel-local-any.netdev b/test/test-network/conf/25-sit-tunnel-local-any.netdev new file mode 100644 index 0000000000..20c1a334a5 --- /dev/null +++ b/test/test-network/conf/25-sit-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=sittun98 +Kind=sit + +[Tunnel] +Local=any +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-sit-tunnel-remote-any.netdev b/test/test-network/conf/25-sit-tunnel-remote-any.netdev new file mode 100644 index 0000000000..ed7b9b7499 --- /dev/null +++ b/test/test-network/conf/25-sit-tunnel-remote-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=sittun97 +Kind=sit + +[Tunnel] +Local=10.65.223.238 +Remote=any diff --git a/test/test-network/conf/25-vti-tunnel-local-any.netdev b/test/test-network/conf/25-vti-tunnel-local-any.netdev new file mode 100644 index 0000000000..cab3886430 --- /dev/null +++ b/test/test-network/conf/25-vti-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vtitun98 +Kind=vti + +[Tunnel] +Local=remote +Remote=10.65.223.239 diff --git a/test/test-network/conf/25-vti-tunnel-remote-any.netdev b/test/test-network/conf/25-vti-tunnel-remote-any.netdev new file mode 100644 index 0000000000..b8bedffaa2 --- /dev/null +++ b/test/test-network/conf/25-vti-tunnel-remote-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vtitun97 +Kind=vti + +[Tunnel] +Local=10.65.223.238 +Remote=any diff --git a/test/test-network/conf/25-vti6-tunnel-local-any.netdev b/test/test-network/conf/25-vti6-tunnel-local-any.netdev new file mode 100644 index 0000000000..c3d05b4f58 --- /dev/null +++ b/test/test-network/conf/25-vti6-tunnel-local-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vti6tun98 +Kind=vti6 + +[Tunnel] +Local=any +Remote=2001:473:fece:cafe::5179 diff --git a/test/test-network/conf/25-vti6-tunnel-remote-any.netdev b/test/test-network/conf/25-vti6-tunnel-remote-any.netdev new file mode 100644 index 0000000000..b86c628abf --- /dev/null +++ b/test/test-network/conf/25-vti6-tunnel-remote-any.netdev @@ -0,0 +1,7 @@ +[NetDev] +Name=vti6tun97 +Kind=vti6 + +[Tunnel] +Local=2a00:ffde:4567:edde::4987 +Remote=any diff --git a/test/test-network/conf/gretap.network b/test/test-network/conf/gretap.network index 88b9250349..1493fcf2b0 100644 --- a/test/test-network/conf/gretap.network +++ b/test/test-network/conf/gretap.network @@ -3,3 +3,4 @@ Name=dummy98 [Network] Tunnel=gretap99 +Tunnel=gretap98 diff --git a/test/test-network/conf/gretun.network b/test/test-network/conf/gretun.network index 376074cb1b..00bb03cab2 100644 --- a/test/test-network/conf/gretun.network +++ b/test/test-network/conf/gretun.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=gretun99 +Tunnel=gretun98 +Tunnel=gretun97 diff --git a/test/test-network/conf/ip6gretap.network b/test/test-network/conf/ip6gretap.network index cad0bae04a..7ae4e3aea7 100644 --- a/test/test-network/conf/ip6gretap.network +++ b/test/test-network/conf/ip6gretap.network @@ -3,3 +3,4 @@ Name=dummy98 [Network] Tunnel=ip6gretap99 +Tunnel=ip6gretap98 diff --git a/test/test-network/conf/ip6gretun.network b/test/test-network/conf/ip6gretun.network new file mode 100644 index 0000000000..6d39bbd777 --- /dev/null +++ b/test/test-network/conf/ip6gretun.network @@ -0,0 +1,7 @@ +[Match] +Name=dummy98 + +[Network] +Tunnel=ip6gretun99 +Tunnel=ip6gretun98 +Tunnel=ip6gretun97 diff --git a/test/test-network/conf/ip6tnl.network b/test/test-network/conf/ip6tnl.network index 41e3448495..15c6d15d45 100644 --- a/test/test-network/conf/ip6tnl.network +++ b/test/test-network/conf/ip6tnl.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=ip6tnl99 +Tunnel=ip6tnl98 +Tunnel=ip6tnl97 diff --git a/test/test-network/conf/ipip.network b/test/test-network/conf/ipip.network index 4ce6714904..ec6c958114 100644 --- a/test/test-network/conf/ipip.network +++ b/test/test-network/conf/ipip.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=ipiptun99 +Tunnel=ipiptun98 +Tunnel=ipiptun97 diff --git a/test/test-network/conf/sit.network b/test/test-network/conf/sit.network index 84e5af0ff0..8d97823a5a 100644 --- a/test/test-network/conf/sit.network +++ b/test/test-network/conf/sit.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=sittun99 +Tunnel=sittun98 +Tunnel=sittun97 diff --git a/test/test-network/conf/vti.network b/test/test-network/conf/vti.network index 7fbad6a82d..1e0b8405c5 100644 --- a/test/test-network/conf/vti.network +++ b/test/test-network/conf/vti.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=vtitun99 +Tunnel=vtitun98 +Tunnel=vtitun97 diff --git a/test/test-network/conf/vti6.network b/test/test-network/conf/vti6.network index 49a9d11fff..60ccb77f56 100644 --- a/test/test-network/conf/vti6.network +++ b/test/test-network/conf/vti6.network @@ -3,3 +3,5 @@ Name=dummy98 [Network] Tunnel=vti6tun99 +Tunnel=vti6tun98 +Tunnel=vti6tun97 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 4ed94b242c..1621d400b1 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -191,17 +191,31 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): 'bridge99', 'dropin-test', 'dummy98', - 'erspan-test', + 'erspan98', + 'erspan99', 'geneve99', + 'gretap98', 'gretap99', + 'gretun97', + 'gretun98', 'gretun99', + 'ip6gretap98', 'ip6gretap99', + 'ip6gretun97', + 'ip6gretun98', + 'ip6gretun99', + 'ip6tnl97', + 'ip6tnl98', 'ip6tnl99', + 'ipiptun97', + 'ipiptun98', 'ipiptun99', 'ipvlan99', 'isataptun99', 'macvlan99', 'macvtap99', + 'sittun97', + 'sittun98', 'sittun99', 'tap99', 'test1', @@ -210,7 +224,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): 'veth99', 'vlan99', 'vrf99', + 'vti6tun97', + 'vti6tun98', 'vti6tun99', + 'vtitun97', + 'vtitun98', 'vtitun99', 'vxlan99', 'wg98', @@ -229,23 +247,41 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): '25-bond.netdev', '25-bond-balanced-tlb.netdev', '25-bridge.netdev', + '25-erspan-tunnel-local-any.netdev', '25-erspan-tunnel.netdev', '25-geneve.netdev', + '25-gretap-tunnel-local-any.netdev', '25-gretap-tunnel.netdev', + '25-gre-tunnel-local-any.netdev', + '25-gre-tunnel-remote-any.netdev', '25-gre-tunnel.netdev', + '25-ip6gretap-tunnel-local-any.netdev', + '25-ip6gretap-tunnel.netdev', + '25-ip6gre-tunnel-local-any.netdev', + '25-ip6gre-tunnel-remote-any.netdev', '25-ip6gre-tunnel.netdev', + '25-ip6tnl-tunnel-remote-any.netdev', + '25-ip6tnl-tunnel-local-any.netdev', '25-ip6tnl-tunnel.netdev', '25-ipip-tunnel-independent.netdev', + '25-ipip-tunnel-local-any.netdev', + '25-ipip-tunnel-remote-any.netdev', '25-ipip-tunnel.netdev', '25-ipvlan.netdev', '25-isatap-tunnel.netdev', + '25-sit-tunnel-local-any.netdev', + '25-sit-tunnel-remote-any.netdev', '25-sit-tunnel.netdev', '25-tap.netdev', '25-tun.netdev', '25-vcan.netdev', '25-veth.netdev', '25-vrf.netdev', + '25-vti6-tunnel-local-any.netdev', + '25-vti6-tunnel-remote-any.netdev', '25-vti6-tunnel.netdev', + '25-vti-tunnel-local-any.netdev', + '25-vti-tunnel-remote-any.netdev', '25-vti-tunnel.netdev', '25-vxlan.netdev', '25-wireguard-23-peers.netdev', @@ -257,6 +293,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): 'gretap.network', 'gretun.network', 'ip6gretap.network', + 'ip6gretun.network', 'ip6tnl.network', 'ipip.network', 'ipvlan.network', @@ -495,60 +532,177 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): self.assertTrue(output, 'udp6zerocsumrx') def test_ipip_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ipip-tunnel.netdev', 'ipip.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ipip-tunnel.netdev', 'ipip.network', + '25-ipip-tunnel-local-any.netdev', '25-ipip-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('ipiptun99')) + self.assertTrue(self.link_exits('ipiptun98')) + self.assertTrue(self.link_exits('ipiptun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ipip (?:ipip |)remote 192.169.224.239 local 192.168.223.238 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ipip (?:ipip |)remote 192.169.224.239 local any dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ipiptun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ipip (?:ipip |)remote any local 192.168.223.238 dev dummy98') def test_gre_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gre-tunnel.netdev', 'gretun.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gre-tunnel.netdev', 'gretun.network', + '25-gre-tunnel-local-any.netdev', '25-gre-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('gretun99')) + self.assertTrue(self.link_exits('gretun98')) + self.assertTrue(self.link_exits('gretun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'gre remote 10.65.223.239 local 10.65.223.238 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'gre remote 10.65.223.239 local any dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'gre remote any local 10.65.223.238 dev dummy98') + + def test_ip6gre_tunnel(self): + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gre-tunnel.netdev', 'ip6gretun.network', + '25-ip6gre-tunnel-local-any.netdev', '25-ip6gre-tunnel-remote-any.netdev') + self.start_networkd() + + self.assertTrue(self.link_exits('dummy98')) + self.assertTrue(self.link_exits('ip6gretun99')) + self.assertTrue(self.link_exits('ip6gretun98')) + self.assertTrue(self.link_exits('ip6gretun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6gre remote 2001:473:fece:cafe::5179 local any dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6gre remote any local 2a00:ffde:4567:edde::4987 dev dummy98') def test_gretap_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gretap-tunnel.netdev', 'gretap.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-gretap-tunnel.netdev', 'gretap.network', + '25-gretap-tunnel-local-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('gretap99')) + self.assertTrue(self.link_exits('gretap98')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretap99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'gretap remote 10.65.223.239 local 10.65.223.238 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'gretap98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'gretap remote 10.65.223.239 local any dev dummy98') def test_ip6gretap_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gre-tunnel.netdev', 'ip6gretap.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6gretap-tunnel.netdev', 'ip6gretap.network', + '25-ip6gretap-tunnel-local-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('ip6gretap99')) + self.assertTrue(self.link_exits('ip6gretap98')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretap99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6gretap98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6gretap remote 2001:473:fece:cafe::5179 local any dev dummy98') def test_vti_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti-tunnel.netdev', 'vti.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti-tunnel.netdev', 'vti.network', + '25-vti-tunnel-local-any.netdev', '25-vti-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('vtitun99')) + self.assertTrue(self.link_exits('vtitun98')) + self.assertTrue(self.link_exits('vtitun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti remote 10.65.223.239 local 10.65.223.238 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti remote 10.65.223.239 local any dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vtitun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti remote any local 10.65.223.238 dev dummy98') def test_vti6_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti6-tunnel.netdev', 'vti6.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-vti6-tunnel.netdev', 'vti6.network', + '25-vti6-tunnel-local-any.netdev', '25-vti6-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('vti6tun99')) + self.assertTrue(self.link_exits('vti6tun98')) + self.assertTrue(self.link_exits('vti6tun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti6 remote 2001:473:fece:cafe::5179 local (?:any|::) dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'vti6tun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'vti6 remote (?:any|::) local 2a00:ffde:4567:edde::4987 dev dummy98') def test_ip6tnl_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6tnl-tunnel.netdev', 'ip6tnl.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-ip6tnl-tunnel.netdev', 'ip6tnl.network', + '25-ip6tnl-tunnel-local-any.netdev', '25-ip6tnl-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('ip6tnl99')) + self.assertTrue(self.link_exits('ip6tnl98')) + self.assertTrue(self.link_exits('ip6tnl97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local (?:any|::) dev dummy98') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'ip6tnl97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'ip6tnl ip6ip6 remote (?:any|::) local 2a00:ffde:4567:edde::4987 dev dummy98') def test_sit_tunnel(self): - self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-sit-tunnel.netdev', 'sit.network') + self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-sit-tunnel.netdev', 'sit.network', + '25-sit-tunnel-local-any.netdev', + '25-sit-tunnel-remote-any.netdev') self.start_networkd() self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('sittun99')) + self.assertTrue(self.link_exits('sittun98')) + self.assertTrue(self.link_exits('sittun97')) + + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, "sit (?:ip6ip |)remote 10.65.223.239 local 10.65.223.238 dev dummy98") + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun98']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, "sit (?:ip6ip |)remote 10.65.223.239 local any dev dummy98") + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun97']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, "sit (?:ip6ip |)remote any local 10.65.223.238 dev dummy98") def test_isatap_tunnel(self): self.copy_unit_to_networkd_unit_path('12-dummy.netdev', '25-isatap-tunnel.netdev', 'isatap.network') @@ -568,18 +722,26 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities): self.assertTrue(self.link_exits('dummy98')) self.assertTrue(self.link_exits('sittun99')) + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'sittun99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, '6rd-prefix 2602::/24') + @expectedFailureIfERSPANModuleIsNotAvailable() def test_erspan_tunnel(self): - self.copy_unit_to_networkd_unit_path('25-erspan-tunnel.netdev') + self.copy_unit_to_networkd_unit_path('25-erspan-tunnel.netdev', '25-erspan-tunnel-local-any.netdev') self.start_networkd() - self.assertTrue(self.link_exits('erspan-test')) + self.assertTrue(self.link_exits('erspan99')) + self.assertTrue(self.link_exits('erspan98')) - output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan-test']).rstrip().decode('utf-8') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan99']).rstrip().decode('utf-8') + print(output) + self.assertRegex(output, 'erspan remote 172.16.1.100 local 172.16.1.200') + self.assertRegex(output, '101') + output = subprocess.check_output(['ip', '-d', 'link', 'show', 'erspan98']).rstrip().decode('utf-8') print(output) - self.assertTrue(output, '172.16.1.200') - self.assertTrue(output, '172.16.1.100') - self.assertTrue(output, '101') + self.assertRegex(output, 'erspan remote 172.16.1.100 local any') + self.assertRegex(output, '102') def test_tunnel_independent(self): self.copy_unit_to_networkd_unit_path('25-ipip-tunnel-independent.netdev') |