1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

feat(nmcli): Add support for IPv6 routing rules (#11413)

* feat(nmcli): Add support for IPv6 routing rules

Closes #7094

Signed-off-by: Rémy Jacquin <remy@remyj.fr>

* Add changelog fragment

Signed-off-by: Rémy Jacquin <remy@remyj.fr>

* Fixing doc

Signed-off-by: Rémy Jacquin <remy@remyj.fr>

* Add issue link to changelog fragment

Co-authored-by: Felix Fontein <felix@fontein.de>

* Fix version

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

---------

Signed-off-by: Rémy Jacquin <remy@remyj.fr>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
Rémy Jacquin 2026-01-16 21:05:43 +01:00 committed by GitHub
parent 0a70216763
commit 4b0aeede69
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 48 additions and 2 deletions

View file

@ -167,7 +167,7 @@ TESTCASE_GENERIC_DIFF_CHECK = [
},
]
TESTCASE_GENERIC_MODIFY_ROUTING_RULES = [
TESTCASE_GENERIC_MODIFY_ROUTING_RULES4 = [
{
"type": "generic",
"conn_name": "non_existent_nw_device",
@ -180,6 +180,19 @@ TESTCASE_GENERIC_MODIFY_ROUTING_RULES = [
},
]
TESTCASE_GENERIC_MODIFY_ROUTING_RULES6 = [
{
"type": "generic",
"conn_name": "non_existent_nw_device",
"ifname": "generic_non_existant",
"ip6": "fd00::10/24",
"gw6": "fd00::1",
"routing_rules6": ["priority 5 from fd00::/24 table 5000", "priority 10 from fd01::/24 table 5001"],
"state": "present",
"_ansible_check_mode": False,
},
]
TESTCASE_GENERIC_MODIFY_ROUTING_RULES_SHOW_OUTPUT = """\
connection.id: non_existent_nw_device
connection.interface-name: generic_non_existant
@ -2211,7 +2224,7 @@ def test_generic_connection_unchanged(mocked_generic_connection_unchanged, capfd
@pytest.mark.parametrize(
"patch_ansible_module", TESTCASE_GENERIC_MODIFY_ROUTING_RULES, indirect=["patch_ansible_module"]
"patch_ansible_module", TESTCASE_GENERIC_MODIFY_ROUTING_RULES4, indirect=["patch_ansible_module"]
)
def test_generic_connection_modify_routing_rules4(mocked_generic_connection_create, capfd):
"""
@ -2232,6 +2245,28 @@ def test_generic_connection_modify_routing_rules4(mocked_generic_connection_crea
assert results["changed"]
@pytest.mark.parametrize(
"patch_ansible_module", TESTCASE_GENERIC_MODIFY_ROUTING_RULES6, indirect=["patch_ansible_module"]
)
def test_generic_connection_modify_routing_rules6(mocked_generic_connection_create, capfd):
"""
Test : Generic connection modified with routing-rules6
"""
with pytest.raises(SystemExit):
nmcli.main()
assert nmcli.Nmcli.execute_command.call_count == 1
arg_list = nmcli.Nmcli.execute_command.call_args_list
args, kwargs = arg_list[0]
assert "ipv6.routing-rules" in args[0]
out, err = capfd.readouterr()
results = json.loads(out)
assert not results.get("failed")
assert results["changed"]
@pytest.mark.parametrize("patch_ansible_module", TESTCASE_GENERIC_DNS4_SEARCH, indirect=["patch_ansible_module"])
def test_generic_connection_create_dns_search(mocked_generic_connection_create, capfd):
"""