mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
[nmcli] add runner and runner-hwaddr-policy for network teaming (#2901)
* [nmcli] add runner and runner-hwaddr-policy for network teaming * [nmcli] delete extra space * Update plugins/modules/net_tools/nmcli.py * Update plugins/modules/net_tools/nmcli.py * [nmcli] add changelog fragment * Update plugins/modules/net_tools/nmcli.py Co-authored-by: Amin Vakil <info@aminvakil.com> Co-authored-by: Oriol MULA VALLS <oriol.mula@lxp.lu> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Amin Vakil <info@aminvakil.com>
This commit is contained in:
parent
3fc97bf80a
commit
9ffc1ef393
3 changed files with 59 additions and 1 deletions
|
@ -279,8 +279,20 @@ ipv4.may-fail: yes
|
|||
ipv6.method: auto
|
||||
ipv6.ignore-auto-dns: no
|
||||
ipv6.ignore-auto-routes: no
|
||||
team.runner: roundrobin
|
||||
"""
|
||||
|
||||
TESTCASE_TEAM_HWADDR_POLICY_FAILS = [
|
||||
{
|
||||
'type': 'team',
|
||||
'conn_name': 'non_existent_nw_device',
|
||||
'ifname': 'team0_non_existant',
|
||||
'runner_hwaddr_policy': 'by_active',
|
||||
'state': 'present',
|
||||
'_ansible_check_mode': False,
|
||||
}
|
||||
]
|
||||
|
||||
TESTCASE_TEAM_SLAVE = [
|
||||
{
|
||||
'type': 'team-slave',
|
||||
|
@ -1053,6 +1065,20 @@ def test_team_connection_unchanged(mocked_team_connection_unchanged, capfd):
|
|||
assert not results['changed']
|
||||
|
||||
|
||||
@pytest.mark.parametrize('patch_ansible_module', TESTCASE_TEAM_HWADDR_POLICY_FAILS, indirect=['patch_ansible_module'])
|
||||
def test_team_connection_create_hwaddr_policy_fails(mocked_generic_connection_create, capfd):
|
||||
"""
|
||||
Test : Team connection created
|
||||
"""
|
||||
with pytest.raises(SystemExit):
|
||||
nmcli.main()
|
||||
|
||||
out, err = capfd.readouterr()
|
||||
results = json.loads(out)
|
||||
assert results.get('failed')
|
||||
assert results['msg'] == "Runner-hwaddr-policy is only allowed for runner activebackup"
|
||||
|
||||
|
||||
@pytest.mark.parametrize('patch_ansible_module', TESTCASE_TEAM_SLAVE, indirect=['patch_ansible_module'])
|
||||
def test_create_team_slave(mocked_generic_connection_create, capfd):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue