From 4352a4e54d6a11005dc670b92b96ffa2698b0fb6 Mon Sep 17 00:00:00 2001 From: Jocelyn Jaubert Date: Fri, 17 Aug 2018 11:10:27 +0200 Subject: [PATCH] interfaces_file: Add test for pre-up/post-up with inet/inet6 --- .../address_family.test_no_changes | 2 + .../address_family.test_no_changes.json | 4 +- .../golden_output/address_family_add_aggi_up | 2 + .../address_family_add_aggi_up.json | 4 +- .../address_family_add_and_delete_aggi_up | 2 + ...address_family_add_and_delete_aggi_up.json | 4 +- .../golden_output/address_family_change_ipv4 | 2 + .../address_family_change_ipv4.json | 4 +- .../address_family_change_ipv4_post_up | 13 +++ ..._family_change_ipv4_post_up.exceptions.txt | 0 .../address_family_change_ipv4_post_up.json | 21 ++++ .../address_family_change_ipv4_pre_up | 13 +++ ...s_family_change_ipv4_pre_up.exceptions.txt | 0 .../address_family_change_ipv4_pre_up.json | 21 ++++ .../golden_output/address_family_change_ipv6 | 2 + .../address_family_change_ipv6.json | 4 +- .../address_family_change_ipv6_post_up | 13 +++ ..._family_change_ipv6_post_up.exceptions.txt | 0 .../address_family_change_ipv6_post_up.json | 21 ++++ .../address_family_change_ipv6_pre_up | 13 +++ ...s_family_change_ipv6_pre_up.exceptions.txt | 0 .../address_family_change_ipv6_pre_up.json | 21 ++++ .../address_family_change_method | 2 + .../address_family_change_method.json | 4 +- .../golden_output/address_family_revert | 2 + .../golden_output/address_family_revert.json | 4 +- .../address_family_set_aggi_and_eth0_mtu | 2 + .../address_family_set_aggi_and_eth0_mtu.json | 4 +- .../address_family_set_aggi_slaves | 2 + .../address_family_set_aggi_slaves.json | 4 +- .../default_dhcp_change_ipv4_post_up | 7 ++ ...lt_dhcp_change_ipv4_post_up.exceptions.txt | 0 .../default_dhcp_change_ipv4_post_up.json | 18 ++++ .../default_dhcp_change_ipv4_pre_up | 7 ++ ...ult_dhcp_change_ipv4_pre_up.exceptions.txt | 0 .../default_dhcp_change_ipv4_pre_up.json | 18 ++++ .../default_dhcp_change_ipv6_post_up | 6 ++ ...lt_dhcp_change_ipv6_post_up.exceptions.txt | 9 ++ .../default_dhcp_change_ipv6_post_up.json | 18 ++++ .../default_dhcp_change_ipv6_pre_up | 6 ++ ...ult_dhcp_change_ipv6_pre_up.exceptions.txt | 9 ++ .../default_dhcp_change_ipv6_pre_up.json | 18 ++++ .../servers.com_change_ipv4_post_up | 58 ++++++++++ ...ers.com_change_ipv4_post_up.exceptions.txt | 9 ++ .../servers.com_change_ipv4_post_up.json | 101 ++++++++++++++++++ .../servers.com_change_ipv4_pre_up | 58 ++++++++++ ...vers.com_change_ipv4_pre_up.exceptions.txt | 9 ++ .../servers.com_change_ipv4_pre_up.json | 101 ++++++++++++++++++ .../servers.com_change_ipv6_post_up | 58 ++++++++++ ...ers.com_change_ipv6_post_up.exceptions.txt | 9 ++ .../servers.com_change_ipv6_post_up.json | 101 ++++++++++++++++++ .../servers.com_change_ipv6_pre_up | 58 ++++++++++ ...vers.com_change_ipv6_pre_up.exceptions.txt | 9 ++ .../servers.com_change_ipv6_pre_up.json | 101 ++++++++++++++++++ .../fixtures/input/address_family | 2 + .../interfaces_file/test_interfaces_file.py | 38 ++++++- 56 files changed, 1008 insertions(+), 10 deletions(-) create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt create mode 100644 test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4 b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4 index cb26bf159a..9a2f5b0594 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4 +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4 @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.42 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up new file mode 100644 index 0000000000..5077e3a681 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up @@ -0,0 +1,13 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + post-up echo configuring ipv4 + post-up XXXX_ipv4 + +iface eth0 inet6 static + address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json @@ -0,0 +1,21 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [ + "echo configuring ipv6" + ], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up new file mode 100644 index 0000000000..5c0f69736c --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up @@ -0,0 +1,13 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + post-up echo configuring ipv4 + pre-up XXXX_ipv4 + +iface eth0 inet6 static + address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json @@ -0,0 +1,21 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [ + "echo configuring ipv6" + ], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6 b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6 index dda6874977..afaaac9620 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6 +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6 @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::42 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up new file mode 100644 index 0000000000..cb3e98b776 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up @@ -0,0 +1,13 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + post-up echo configuring ipv4 + +iface eth0 inet6 static + address fc00::1 + post-up echo configuring ipv6 + post-up XXXX_ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json @@ -0,0 +1,21 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [ + "echo configuring ipv6" + ], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up new file mode 100644 index 0000000000..149da568be --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up @@ -0,0 +1,13 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet static + address 192.168.0.1 + post-up echo configuring ipv4 + +iface eth0 inet6 static + address fc00::1 + post-up echo configuring ipv6 + pre-up XXXX_ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json @@ -0,0 +1,21 @@ +{ + "eth0": { + "address": "fc00::1", + "address_family": "inet6", + "down": [], + "method": "static", + "post-up": [ + "echo configuring ipv6" + ], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method index 3e30d6b5a2..4d407ab7c2 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet manual address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 manual address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json index 2f8251eb0a..c635e56b4d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_change_method.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "manual", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_revert.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu index f8ec44e7a1..40331271ad 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu @@ -5,7 +5,9 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 mtu 1350 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json index bd63594908..ee632bd542 100644 --- a/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json @@ -4,7 +4,9 @@ "address_family": "inet6", "down": [], "method": "static", - "post-up": [], + "post-up": [ + "echo configuring ipv6" + ], "pre-up": [], "up": [] }, diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up new file mode 100644 index 0000000000..998f484469 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up @@ -0,0 +1,7 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp + post-up XXXX_ipv4 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json @@ -0,0 +1,18 @@ +{ + "eth0": { + "address_family": "inet", + "down": [], + "method": "dhcp", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up new file mode 100644 index 0000000000..5e6af40a2d --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up @@ -0,0 +1,7 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp + pre-up XXXX_ipv4 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json @@ -0,0 +1,18 @@ +{ + "eth0": { + "address_family": "inet", + "down": [], + "method": "dhcp", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up @@ -0,0 +1,6 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..48cb29b0aa --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "post-up", + "state": "present", + "value": "XXXX_ipv6" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json @@ -0,0 +1,18 @@ +{ + "eth0": { + "address_family": "inet", + "down": [], + "method": "dhcp", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up @@ -0,0 +1,6 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..fbfed6be37 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "pre-up", + "state": "present", + "value": "XXXX_ipv6" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json @@ -0,0 +1,18 @@ +{ + "eth0": { + "address_family": "inet", + "down": [], + "method": "dhcp", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up new file mode 100644 index 0000000000..4356aa47d7 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up @@ -0,0 +1,58 @@ + auto aggi + iface aggi inet static + hwaddress ether 22:44:77:88:D5:96 + address 10.44.15.196 + netmask 255.255.255.248 + mtu 1500 + slaves int1 int2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K aggi tx off tso off + + auto agge + iface agge inet manual + + auto br0 + iface br0 inet static + bridge_ports agge + hwaddress ether 22:44:77:88:D5:98 + address 188.44.133.76 + netmask 255.255.255.248 + gateway 188.44.133.75 + slaves ext1 ext2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K agge tx off tso off + + up route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi + up route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi + up route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi + + auto int1 + iface int1 inet manual + bond-master aggi + + auto int2 + iface int2 inet manual + bond-master aggi + + auto ext1 + iface ext1 inet manual + bond-master agge + + auto ext2 + iface ext2 inet manual + bond-master agge + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e1e0152320 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet", + "iface": "eth0", + "option": "post-up", + "state": "present", + "value": "XXXX_ipv4" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json new file mode 100644 index 0000000000..0460b552a9 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json @@ -0,0 +1,101 @@ +{ + "agge": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "aggi": { + "address": "10.44.15.196", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "down": [], + "hwaddress": "ether 22:44:77:88:D5:96", + "method": "static", + "mtu": "1500", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K aggi tx off tso off" + ], + "pre-up": [], + "slaves": "int1 int2", + "up": [] + }, + "br0": { + "address": "188.44.133.76", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "bridge_ports": "agge", + "down": [], + "gateway": "188.44.133.75", + "hwaddress": "ether 22:44:77:88:D5:98", + "method": "static", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K agge tx off tso off" + ], + "pre-up": [], + "slaves": "ext1 ext2", + "up": [ + "route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi", + "route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi", + "route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi" + ] + }, + "ext1": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "ext2": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int1": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int2": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up new file mode 100644 index 0000000000..4356aa47d7 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up @@ -0,0 +1,58 @@ + auto aggi + iface aggi inet static + hwaddress ether 22:44:77:88:D5:96 + address 10.44.15.196 + netmask 255.255.255.248 + mtu 1500 + slaves int1 int2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K aggi tx off tso off + + auto agge + iface agge inet manual + + auto br0 + iface br0 inet static + bridge_ports agge + hwaddress ether 22:44:77:88:D5:98 + address 188.44.133.76 + netmask 255.255.255.248 + gateway 188.44.133.75 + slaves ext1 ext2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K agge tx off tso off + + up route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi + up route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi + up route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi + + auto int1 + iface int1 inet manual + bond-master aggi + + auto int2 + iface int2 inet manual + bond-master aggi + + auto ext1 + iface ext1 inet manual + bond-master agge + + auto ext2 + iface ext2 inet manual + bond-master agge + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..9e510654c2 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet", + "iface": "eth0", + "option": "pre-up", + "state": "present", + "value": "XXXX_ipv4" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json new file mode 100644 index 0000000000..0460b552a9 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json @@ -0,0 +1,101 @@ +{ + "agge": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "aggi": { + "address": "10.44.15.196", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "down": [], + "hwaddress": "ether 22:44:77:88:D5:96", + "method": "static", + "mtu": "1500", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K aggi tx off tso off" + ], + "pre-up": [], + "slaves": "int1 int2", + "up": [] + }, + "br0": { + "address": "188.44.133.76", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "bridge_ports": "agge", + "down": [], + "gateway": "188.44.133.75", + "hwaddress": "ether 22:44:77:88:D5:98", + "method": "static", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K agge tx off tso off" + ], + "pre-up": [], + "slaves": "ext1 ext2", + "up": [ + "route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi", + "route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi", + "route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi" + ] + }, + "ext1": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "ext2": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int1": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int2": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up new file mode 100644 index 0000000000..4356aa47d7 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up @@ -0,0 +1,58 @@ + auto aggi + iface aggi inet static + hwaddress ether 22:44:77:88:D5:96 + address 10.44.15.196 + netmask 255.255.255.248 + mtu 1500 + slaves int1 int2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K aggi tx off tso off + + auto agge + iface agge inet manual + + auto br0 + iface br0 inet static + bridge_ports agge + hwaddress ether 22:44:77:88:D5:98 + address 188.44.133.76 + netmask 255.255.255.248 + gateway 188.44.133.75 + slaves ext1 ext2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K agge tx off tso off + + up route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi + up route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi + up route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi + + auto int1 + iface int1 inet manual + bond-master aggi + + auto int2 + iface int2 inet manual + bond-master aggi + + auto ext1 + iface ext1 inet manual + bond-master agge + + auto ext2 + iface ext2 inet manual + bond-master agge + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..48cb29b0aa --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "post-up", + "state": "present", + "value": "XXXX_ipv6" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json new file mode 100644 index 0000000000..0460b552a9 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json @@ -0,0 +1,101 @@ +{ + "agge": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "aggi": { + "address": "10.44.15.196", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "down": [], + "hwaddress": "ether 22:44:77:88:D5:96", + "method": "static", + "mtu": "1500", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K aggi tx off tso off" + ], + "pre-up": [], + "slaves": "int1 int2", + "up": [] + }, + "br0": { + "address": "188.44.133.76", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "bridge_ports": "agge", + "down": [], + "gateway": "188.44.133.75", + "hwaddress": "ether 22:44:77:88:D5:98", + "method": "static", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K agge tx off tso off" + ], + "pre-up": [], + "slaves": "ext1 ext2", + "up": [ + "route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi", + "route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi", + "route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi" + ] + }, + "ext1": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "ext2": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int1": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int2": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up new file mode 100644 index 0000000000..4356aa47d7 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up @@ -0,0 +1,58 @@ + auto aggi + iface aggi inet static + hwaddress ether 22:44:77:88:D5:96 + address 10.44.15.196 + netmask 255.255.255.248 + mtu 1500 + slaves int1 int2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K aggi tx off tso off + + auto agge + iface agge inet manual + + auto br0 + iface br0 inet static + bridge_ports agge + hwaddress ether 22:44:77:88:D5:98 + address 188.44.133.76 + netmask 255.255.255.248 + gateway 188.44.133.75 + slaves ext1 ext2 + bond_mode 4 + bond_miimon 100 + bond_downdelay 200 + bond_updelay 200 + bond_lacp_rate slow + bond_xmit_hash_policy layer3+4 + post-up /sbin/ethtool -K agge tx off tso off + + up route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi + up route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi + up route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi + + auto int1 + iface int1 inet manual + bond-master aggi + + auto int2 + iface int2 inet manual + bond-master aggi + + auto ext1 + iface ext1 inet manual + bond-master agge + + auto ext2 + iface ext2 inet manual + bond-master agge + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..fbfed6be37 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "pre-up", + "state": "present", + "value": "XXXX_ipv6" +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json new file mode 100644 index 0000000000..0460b552a9 --- /dev/null +++ b/test/units/modules/system/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json @@ -0,0 +1,101 @@ +{ + "agge": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "aggi": { + "address": "10.44.15.196", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "down": [], + "hwaddress": "ether 22:44:77:88:D5:96", + "method": "static", + "mtu": "1500", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K aggi tx off tso off" + ], + "pre-up": [], + "slaves": "int1 int2", + "up": [] + }, + "br0": { + "address": "188.44.133.76", + "address_family": "inet", + "bond_downdelay": "200", + "bond_lacp_rate": "slow", + "bond_miimon": "100", + "bond_mode": "4", + "bond_updelay": "200", + "bond_xmit_hash_policy": "layer3+4", + "bridge_ports": "agge", + "down": [], + "gateway": "188.44.133.75", + "hwaddress": "ether 22:44:77:88:D5:98", + "method": "static", + "netmask": "255.255.255.248", + "post-up": [ + "/sbin/ethtool -K agge tx off tso off" + ], + "pre-up": [], + "slaves": "ext1 ext2", + "up": [ + "route add -net 10.0.0.0/8 gw 10.44.15.117 dev aggi", + "route add -net 192.168.0.0/16 gw 10.44.15.117 dev aggi", + "route add -net 188.44.208.0/21 gw 10.44.15.117 dev aggi" + ] + }, + "ext1": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "ext2": { + "address_family": "inet", + "bond-master": "agge", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int1": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "int2": { + "address_family": "inet", + "bond-master": "aggi", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "lo": { + "address_family": "inet", + "down": [], + "method": "loopback", + "post-up": [], + "pre-up": [], + "up": [] + } +} \ No newline at end of file diff --git a/test/units/modules/system/interfaces_file/fixtures/input/address_family b/test/units/modules/system/interfaces_file/fixtures/input/address_family index 26f9d012d0..bc4ecea78d 100644 --- a/test/units/modules/system/interfaces_file/fixtures/input/address_family +++ b/test/units/modules/system/interfaces_file/fixtures/input/address_family @@ -5,6 +5,8 @@ iface lo inet loopback # The primary network interface iface eth0 inet static address 192.168.0.1 + post-up echo configuring ipv4 iface eth0 inet6 static address fc00::1 + post-up echo configuring ipv6 diff --git a/test/units/modules/system/interfaces_file/test_interfaces_file.py b/test/units/modules/system/interfaces_file/test_interfaces_file.py index 84bae14a74..940feb9bd1 100644 --- a/test/units/modules/system/interfaces_file/test_interfaces_file.py +++ b/test/units/modules/system/interfaces_file/test_interfaces_file.py @@ -230,7 +230,7 @@ class TestInterfacesFileModule(unittest.TestCase): # Restore backup move(backupp, path) - def test_change_address(self): + def test_inet_inet6(self): testcases = { "change_ipv4": [ { @@ -250,6 +250,42 @@ class TestInterfacesFileModule(unittest.TestCase): 'state': 'present', } ], + "change_ipv4_pre_up": [ + { + 'iface': 'eth0', + 'address_family': 'inet', + 'option': 'pre-up', + 'value': 'XXXX_ipv4', + 'state': 'present', + } + ], + "change_ipv6_pre_up": [ + { + 'iface': 'eth0', + 'address_family': 'inet6', + 'option': 'pre-up', + 'value': 'XXXX_ipv6', + 'state': 'present', + } + ], + "change_ipv4_post_up": [ + { + 'iface': 'eth0', + 'address_family': 'inet', + 'option': 'post-up', + 'value': 'XXXX_ipv4', + 'state': 'present', + } + ], + "change_ipv6_post_up": [ + { + 'iface': 'eth0', + 'address_family': 'inet6', + 'option': 'post-up', + 'value': 'XXXX_ipv6', + 'state': 'present', + } + ], } for testname, options_list in testcases.items(): for testfile in self.getTestFiles():