From d21e7bd81c53d739e59d137573912420c78d12a6 Mon Sep 17 00:00:00 2001 From: John R Barker Date: Tue, 17 Mar 2020 17:15:18 +0000 Subject: [PATCH] Add interfaces_file unit tests (#21) --- .../interfaces_file/__init__.py | 0 .../interfaces_file/fixtures/__init__.py | 0 .../address_family.test_no_changes | 12 + .../address_family.test_no_changes.json | 21 ++ .../golden_output/address_family_add_aggi_up | 12 + .../address_family_add_aggi_up.exceptions.txt | 8 + .../address_family_add_aggi_up.json | 21 ++ .../address_family_add_and_delete_aggi_up | 12 + ...mily_add_and_delete_aggi_up.exceptions.txt | 17 + ...address_family_add_and_delete_aggi_up.json | 21 ++ .../golden_output/address_family_change_ipv4 | 12 + .../address_family_change_ipv4.exceptions.txt | 0 .../address_family_change_ipv4.json | 21 ++ .../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 | 12 + .../address_family_change_ipv6.exceptions.txt | 0 .../address_family_change_ipv6.json | 21 ++ .../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 | 12 + ...ddress_family_change_method.exceptions.txt | 8 + .../address_family_change_method.json | 21 ++ .../golden_output/address_family_revert | 12 + .../address_family_revert.exceptions.txt | 0 .../golden_output/address_family_revert.json | 21 ++ .../address_family_set_aggi_and_eth0_mtu | 13 + ...amily_set_aggi_and_eth0_mtu.exceptions.txt | 8 + .../address_family_set_aggi_and_eth0_mtu.json | 21 ++ .../address_family_set_aggi_slaves | 12 + ...ress_family_set_aggi_slaves.exceptions.txt | 8 + .../address_family_set_aggi_slaves.json | 21 ++ .../default_dhcp.test_no_changes | 6 + .../default_dhcp.test_no_changes.json | 18 + .../golden_output/default_dhcp_add_aggi_up | 6 + .../default_dhcp_add_aggi_up.exceptions.txt | 8 + .../default_dhcp_add_aggi_up.json | 18 + .../default_dhcp_add_and_delete_aggi_up | 6 + ...dhcp_add_and_delete_aggi_up.exceptions.txt | 17 + .../default_dhcp_add_and_delete_aggi_up.json | 18 + .../golden_output/default_dhcp_change_ipv4 | 7 + .../default_dhcp_change_ipv4.exceptions.txt | 0 .../default_dhcp_change_ipv4.json | 18 + .../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 + .../golden_output/default_dhcp_change_ipv6 | 6 + .../default_dhcp_change_ipv6.exceptions.txt | 9 + .../default_dhcp_change_ipv6.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 + .../golden_output/default_dhcp_change_method | 6 + .../default_dhcp_change_method.exceptions.txt | 8 + .../default_dhcp_change_method.json | 18 + .../golden_output/default_dhcp_revert | 6 + .../default_dhcp_revert.exceptions.txt | 0 .../golden_output/default_dhcp_revert.json | 18 + .../default_dhcp_set_aggi_and_eth0_mtu | 7 + ..._dhcp_set_aggi_and_eth0_mtu.exceptions.txt | 8 + .../default_dhcp_set_aggi_and_eth0_mtu.json | 18 + .../default_dhcp_set_aggi_slaves | 6 + ...efault_dhcp_set_aggi_slaves.exceptions.txt | 8 + .../default_dhcp_set_aggi_slaves.json | 18 + .../golden_output/servers.com.test_no_changes | 61 ++++ .../servers.com.test_no_changes.json | 109 ++++++ .../golden_output/servers.com_add_aggi_up | 62 ++++ .../servers.com_add_aggi_up.exceptions.txt | 0 .../servers.com_add_aggi_up.json | 109 ++++++ .../servers.com_add_and_delete_aggi_up | 61 ++++ ....com_add_and_delete_aggi_up.exceptions.txt | 0 .../servers.com_add_and_delete_aggi_up.json | 109 ++++++ .../golden_output/servers.com_change_ipv4 | 61 ++++ .../servers.com_change_ipv4.exceptions.txt | 9 + .../servers.com_change_ipv4.json | 109 ++++++ .../servers.com_change_ipv4_post_up | 61 ++++ ...ers.com_change_ipv4_post_up.exceptions.txt | 9 + .../servers.com_change_ipv4_post_up.json | 109 ++++++ .../servers.com_change_ipv4_pre_up | 61 ++++ ...vers.com_change_ipv4_pre_up.exceptions.txt | 9 + .../servers.com_change_ipv4_pre_up.json | 109 ++++++ .../golden_output/servers.com_change_ipv6 | 61 ++++ .../servers.com_change_ipv6.exceptions.txt | 9 + .../servers.com_change_ipv6.json | 109 ++++++ .../servers.com_change_ipv6_post_up | 61 ++++ ...ers.com_change_ipv6_post_up.exceptions.txt | 9 + .../servers.com_change_ipv6_post_up.json | 109 ++++++ .../servers.com_change_ipv6_pre_up | 61 ++++ ...vers.com_change_ipv6_pre_up.exceptions.txt | 9 + .../servers.com_change_ipv6_pre_up.json | 109 ++++++ .../golden_output/servers.com_change_method | 61 ++++ .../servers.com_change_method.exceptions.txt | 0 .../servers.com_change_method.json | 109 ++++++ .../fixtures/golden_output/servers.com_revert | 61 ++++ .../servers.com_revert.exceptions.txt | 8 + .../golden_output/servers.com_revert.json | 109 ++++++ .../servers.com_set_aggi_and_eth0_mtu | 61 ++++ ...s.com_set_aggi_and_eth0_mtu.exceptions.txt | 8 + .../servers.com_set_aggi_and_eth0_mtu.json | 109 ++++++ .../golden_output/servers.com_set_aggi_slaves | 61 ++++ ...servers.com_set_aggi_slaves.exceptions.txt | 0 .../servers.com_set_aggi_slaves.json | 109 ++++++ .../fixtures/input/address_family | 12 + .../fixtures/input/default_dhcp | 6 + .../fixtures/input/servers.com | 61 ++++ .../interfaces_file/test_interfaces_file.py | 327 ++++++++++++++++++ 120 files changed, 3562 insertions(+) create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/__init__.py create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/__init__.py create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6 create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.exceptions.txt create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.json create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/address_family create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/default_dhcp create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/servers.com create mode 100644 tests/unit/modules/system/interfaces_file/interfaces_file/test_interfaces_file.py diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/__init__.py b/tests/unit/modules/system/interfaces_file/interfaces_file/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/__init__.py b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family.test_no_changes.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt new file mode 100644 index 0000000000..8d223b041b --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt new file mode 100644 index 0000000000..1c9adbd9fc --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.exceptions.txt @@ -0,0 +1,17 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} +===== +[1] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "absent", + "value": null +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_add_and_delete_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4 new file mode 100644 index 0000000000..9a2f5b0594 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4 @@ -0,0 +1,12 @@ +# The loopback network interface +auto lo eth0 +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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up new file mode 100644 index 0000000000..5077e3a681 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_post_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up new file mode 100644 index 0000000000..5c0f69736c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv4_pre_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6 new file mode 100644 index 0000000000..afaaac9620 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6 @@ -0,0 +1,12 @@ +# 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::42 + post-up echo configuring ipv6 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up new file mode 100644 index 0000000000..cb3e98b776 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_post_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up new file mode 100644 index 0000000000..149da568be --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_ipv6_pre_up.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt new file mode 100644 index 0000000000..050a983971 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.exceptions.txt @@ -0,0 +1,8 @@ +fail_json message: Error: interface eth1 not found +options: +{ + "iface": "eth1", + "option": "method", + "state": "present", + "value": "dhcp" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_change_method.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_revert.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu new file mode 100644 index 0000000000..40331271ad --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu @@ -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 + mtu 1350 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt new file mode 100644 index 0000000000..3f0da8b1c7 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "mtu", + "state": "present", + "value": "1350" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_and_eth0_mtu.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt new file mode 100644 index 0000000000..0af87750b7 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "slaves", + "state": "present", + "value": "int1 int3" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.json new file mode 100644 index 0000000000..ee632bd542 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/address_family_set_aggi_slaves.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp.test_no_changes.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.exceptions.txt new file mode 100644 index 0000000000..8d223b041b --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.exceptions.txt new file mode 100644 index 0000000000..1c9adbd9fc --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.exceptions.txt @@ -0,0 +1,17 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "present", + "value": "route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi" +} +===== +[1] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "up", + "state": "absent", + "value": null +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_add_and_delete_aggi_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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4 new file mode 100644 index 0000000000..6962937416 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4 @@ -0,0 +1,7 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp + address 192.168.0.42 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up new file mode 100644 index 0000000000..998f484469 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_post_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up new file mode 100644 index 0000000000..5e6af40a2d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv4_pre_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6 new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6 @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.exceptions.txt new file mode 100644 index 0000000000..04c2089186 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "address", + "state": "present", + "value": "fc00::42" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..48cb29b0aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_post_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..fbfed6be37 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_ipv6_pre_up.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.exceptions.txt new file mode 100644 index 0000000000..050a983971 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.exceptions.txt @@ -0,0 +1,8 @@ +fail_json message: Error: interface eth1 not found +options: +{ + "iface": "eth1", + "option": "method", + "state": "present", + "value": "dhcp" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_change_method.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_revert.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu new file mode 100644 index 0000000000..7bbad22a5e --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu @@ -0,0 +1,7 @@ +# The loopback network interface +auto lo eth0 +iface lo inet loopback + +# The primary network interface +iface eth0 inet dhcp + mtu 1350 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.exceptions.txt new file mode 100644 index 0000000000..3f0da8b1c7 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "mtu", + "state": "present", + "value": "1350" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_and_eth0_mtu.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.exceptions.txt new file mode 100644 index 0000000000..0af87750b7 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.exceptions.txt @@ -0,0 +1,8 @@ +[0] fail_json message: Error: interface aggi not found +options: +{ + "iface": "aggi", + "option": "slaves", + "state": "present", + "value": "int1 int3" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.json new file mode 100644 index 0000000000..bffc17a989 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/default_dhcp_set_aggi_slaves.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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com.test_no_changes.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up new file mode 100644 index 0000000000..e86b25782b --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up @@ -0,0 +1,62 @@ + 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 + up route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi + + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_aggi_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_add_and_delete_aggi_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4 new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4 @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.exceptions.txt new file mode 100644 index 0000000000..a1600d9a67 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet", + "iface": "eth0", + "option": "address", + "state": "present", + "value": "192.168.0.42" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.exceptions.txt new file mode 100644 index 0000000000..e1e0152320 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_post_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.exceptions.txt new file mode 100644 index 0000000000..9e510654c2 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv4_pre_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6 b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6 new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6 @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.exceptions.txt new file mode 100644 index 0000000000..04c2089186 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.exceptions.txt @@ -0,0 +1,9 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "address_family": "inet6", + "iface": "eth0", + "option": "address", + "state": "present", + "value": "fc00::42" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.exceptions.txt new file mode 100644 index 0000000000..48cb29b0aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_post_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.exceptions.txt new file mode 100644 index 0000000000..fbfed6be37 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_ipv6_pre_up.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method new file mode 100644 index 0000000000..065bf0f041 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet dhcp + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.json new file mode 100644 index 0000000000..8e9863b2ea --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_change_method.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "dhcp", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.exceptions.txt new file mode 100644 index 0000000000..fddf3b3b0a --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.exceptions.txt @@ -0,0 +1,8 @@ +fail_json message: Error: interface eth0 not found +options: +{ + "iface": "eth0", + "option": "mtu", + "state": "absent", + "value": "1350" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_revert.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu new file mode 100644 index 0000000000..5218eed194 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu @@ -0,0 +1,61 @@ + 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 1350 + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.exceptions.txt new file mode 100644 index 0000000000..764c9cb016 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.exceptions.txt @@ -0,0 +1,8 @@ +[1] fail_json message: Error: interface eth0 not found +options: +{ + "iface": "eth0", + "option": "mtu", + "state": "present", + "value": "1350" +} \ No newline at end of file diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_and_eth0_mtu.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves new file mode 100644 index 0000000000..e2b78e93ab --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves @@ -0,0 +1,61 @@ + 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 int3 + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.exceptions.txt b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.exceptions.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.json b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.json new file mode 100644 index 0000000000..9e97da32aa --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/golden_output/servers.com_set_aggi_slaves.json @@ -0,0 +1,109 @@ +{ + "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" + ] + }, + "eth1": { + "address_family": "inet", + "down": [], + "method": "manual", + "post-up": [], + "pre-up": [], + "up": [] + }, + "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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/address_family b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/address_family new file mode 100644 index 0000000000..bc4ecea78d --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/address_family @@ -0,0 +1,12 @@ +# 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 diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/default_dhcp b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/default_dhcp new file mode 100644 index 0000000000..bd4522ec09 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/default_dhcp @@ -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/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/servers.com b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/servers.com new file mode 100644 index 0000000000..c826bbe73c --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/fixtures/input/servers.com @@ -0,0 +1,61 @@ + 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 eth1 + iface eth1 inet manual + + auto lo + iface lo inet loopback + +source /etc/network/interfaces.d/*.cfg diff --git a/tests/unit/modules/system/interfaces_file/interfaces_file/test_interfaces_file.py b/tests/unit/modules/system/interfaces_file/interfaces_file/test_interfaces_file.py new file mode 100644 index 0000000000..3f81e6b3d9 --- /dev/null +++ b/tests/unit/modules/system/interfaces_file/interfaces_file/test_interfaces_file.py @@ -0,0 +1,327 @@ +# (c) 2017, Roman Belyakovsky +# +# This file is part of Ansible +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . + +from ansible_collections.ansible.posix.tests.unit.compat import unittest +from ansible_collections.community.general.plugins.modules import interfaces_file +from shutil import copyfile, move +import difflib +import inspect +import io +import json +import os +import re +import shutil +import tempfile + + +class AnsibleFailJson(Exception): + pass + + +class ModuleMocked(): + def atomic_move(self, src, dst): + move(src, dst) + + def backup_local(self, path): + backupp = os.path.join("/tmp", os.path.basename(path) + ".bak") + copyfile(path, backupp) + return backupp + + def fail_json(self, msg): + raise AnsibleFailJson(msg) + + +module = ModuleMocked() +fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'input') +golden_output_path = os.path.join(os.path.dirname(__file__), 'fixtures', 'golden_output') + + +class TestInterfacesFileModule(unittest.TestCase): + def getTestFiles(self, include_filter=None, exclude_filter=None): + flist = next(os.walk(fixture_path))[2] + if include_filter: + flist = filter(lambda x: re.match(include_filter, x), flist) + if exclude_filter: + flist = filter(lambda x: not re.match(exclude_filter, x), flist) + return flist + + def compareFileToBackup(self, path, backup): + with open(path) as f1: + with open(backup) as f2: + diffs = difflib.context_diff(f1.readlines(), + f2.readlines(), + fromfile=os.path.basename(path), + tofile=os.path.basename(backup)) + # Restore backup + move(backup, path) + deltas = [d for d in diffs] + self.assertTrue(len(deltas) == 0) + + def compareInterfacesLinesToFile(self, interfaces_lines, path, testname=None): + if not testname: + testname = "%s.%s" % (path, inspect.stack()[1][3]) + self.compareStringWithFile("".join([d['line'] for d in interfaces_lines if 'line' in d]), testname) + + def compareInterfacesToFile(self, ifaces, path, testname=None): + if not testname: + testname = "%s.%s.json" % (path, inspect.stack()[1][3]) + self.compareStringWithFile(json.dumps(ifaces, sort_keys=True, indent=4, separators=(',', ': ')), testname) + + def compareStringWithFile(self, string, path): + # self.assertEqual("","_",msg=path) + testfilepath = os.path.join(golden_output_path, path) + goldenstring = string + if not os.path.isfile(testfilepath): + f = io.open(testfilepath, 'wb') + f.write(string) + f.close() + else: + with open(testfilepath, 'r') as goldenfile: + goldenstring = goldenfile.read() + goldenfile.close() + self.assertEqual(string, goldenstring) + + def test_no_changes(self): + for testfile in self.getTestFiles(): + path = os.path.join(fixture_path, testfile) + lines, ifaces = interfaces_file.read_interfaces_file(module, path) + self.compareInterfacesLinesToFile(lines, testfile) + self.compareInterfacesToFile(ifaces, testfile) + + def test_add_up_aoption_to_aggi(self): + testcases = { + "add_aggi_up": [ + { + 'iface': 'aggi', + 'option': 'up', + 'value': 'route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi', + 'state': 'present', + } + ], + "add_and_delete_aggi_up": [ + { + 'iface': 'aggi', + 'option': 'up', + 'value': 'route add -net 224.0.0.0 netmask 240.0.0.0 dev aggi', + 'state': 'present', + }, + { + 'iface': 'aggi', + 'option': 'up', + 'value': None, + 'state': 'absent', + }, + ], + "set_aggi_slaves": [ + { + 'iface': 'aggi', + 'option': 'slaves', + 'value': 'int1 int3', + 'state': 'present', + }, + ], + "set_aggi_and_eth0_mtu": [ + { + 'iface': 'aggi', + 'option': 'mtu', + 'value': '1350', + 'state': 'present', + }, + { + 'iface': 'eth0', + 'option': 'mtu', + 'value': '1350', + 'state': 'present', + }, + ], + } + for testname, options_list in testcases.items(): + for testfile in self.getTestFiles(): + path = os.path.join(fixture_path, testfile) + lines, ifaces = interfaces_file.read_interfaces_file(module, path) + fail_json_iterations = [] + for i, options in enumerate(options_list): + try: + _, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], options['option'], options['value'], options['state']) + except AnsibleFailJson as e: + fail_json_iterations.append("[%d] fail_json message: %s\noptions:\n%s" % + (i, str(e), json.dumps(options, sort_keys=True, indent=4, separators=(',', ': ')))) + self.compareStringWithFile("\n=====\n".join(fail_json_iterations), "%s_%s.exceptions.txt" % (testfile, testname)) + + self.compareInterfacesLinesToFile(lines, testfile, "%s_%s" % (testfile, testname)) + self.compareInterfacesToFile(ifaces, testfile, "%s_%s.json" % (testfile, testname)) + + def test_revert(self): + testcases = { + "revert": [ + { + 'iface': 'eth0', + 'option': 'mtu', + 'value': '1350', + } + ], + } + for testname, options_list in testcases.items(): + for testfile in self.getTestFiles(): + with tempfile.NamedTemporaryFile() as temp_file: + src_path = os.path.join(fixture_path, testfile) + path = temp_file.name + shutil.copy(src_path, path) + lines, ifaces = interfaces_file.read_interfaces_file(module, path) + backupp = module.backup_local(path) + options = options_list[0] + for state in ['present', 'absent']: + fail_json_iterations = [] + options['state'] = state + try: + _, lines = interfaces_file.setInterfaceOption(module, lines, + options['iface'], options['option'], options['value'], options['state']) + except AnsibleFailJson as e: + fail_json_iterations.append("fail_json message: %s\noptions:\n%s" % + (str(e), json.dumps(options, sort_keys=True, indent=4, separators=(',', ': ')))) + interfaces_file.write_changes(module, [d['line'] for d in lines if 'line' in d], path) + + self.compareStringWithFile("\n=====\n".join(fail_json_iterations), "%s_%s.exceptions.txt" % (testfile, testname)) + + self.compareInterfacesLinesToFile(lines, testfile, "%s_%s" % (testfile, testname)) + self.compareInterfacesToFile(ifaces, testfile, "%s_%s.json" % (testfile, testname)) + self.compareFileToBackup(path, backupp) + + def test_change_method(self): + testcases = { + "change_method": [ + { + 'iface': 'eth1', + 'option': 'method', + 'value': 'dhcp', + 'state': 'present', + } + ], + } + for testname, options_list in testcases.items(): + for testfile in self.getTestFiles(): + with tempfile.NamedTemporaryFile() as temp_file: + src_path = os.path.join(fixture_path, testfile) + path = temp_file.name + shutil.copy(src_path, path) + lines, ifaces = interfaces_file.read_interfaces_file(module, path) + backupp = module.backup_local(path) + options = options_list[0] + fail_json_iterations = [] + try: + changed, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], options['option'], + options['value'], options['state']) + # When a changed is made try running it again for proper idempotency + if changed: + changed_again, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], + options['option'], options['value'], options['state']) + self.assertFalse(changed_again, + msg='Second request for change should return false for {0} running on {1}'.format(testname, + testfile)) + except AnsibleFailJson as e: + fail_json_iterations.append("fail_json message: %s\noptions:\n%s" % + (str(e), json.dumps(options, sort_keys=True, indent=4, separators=(',', ': ')))) + interfaces_file.write_changes(module, [d['line'] for d in lines if 'line' in d], path) + + self.compareStringWithFile("\n=====\n".join(fail_json_iterations), "%s_%s.exceptions.txt" % (testfile, testname)) + + self.compareInterfacesLinesToFile(lines, testfile, "%s_%s" % (testfile, testname)) + self.compareInterfacesToFile(ifaces, testfile, "%s_%s.json" % (testfile, testname)) + # Restore backup + move(backupp, path) + + def test_inet_inet6(self): + testcases = { + "change_ipv4": [ + { + 'iface': 'eth0', + 'address_family': 'inet', + 'option': 'address', + 'value': '192.168.0.42', + 'state': 'present', + } + ], + "change_ipv6": [ + { + 'iface': 'eth0', + 'address_family': 'inet6', + 'option': 'address', + 'value': 'fc00::42', + '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(): + with tempfile.NamedTemporaryFile() as temp_file: + src_path = os.path.join(fixture_path, testfile) + path = temp_file.name + shutil.copy(src_path, path) + lines, ifaces = interfaces_file.read_interfaces_file(module, path) + backupp = module.backup_local(path) + options = options_list[0] + fail_json_iterations = [] + try: + _, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], options['option'], + options['value'], options['state'], options['address_family']) + except AnsibleFailJson as e: + fail_json_iterations.append("fail_json message: %s\noptions:\n%s" % + (str(e), json.dumps(options, sort_keys=True, indent=4, separators=(',', ': ')))) + interfaces_file.write_changes(module, [d['line'] for d in lines if 'line' in d], path) + + self.compareStringWithFile("\n=====\n".join(fail_json_iterations), "%s_%s.exceptions.txt" % (testfile, testname)) + + self.compareInterfacesLinesToFile(lines, testfile, "%s_%s" % (testfile, testname)) + self.compareInterfacesToFile(ifaces, testfile, "%s_%s.json" % (testfile, testname)) + # Restore backup + move(backupp, path)