mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
nmcli: Allow setting ipv4.dhcp-client-id parameter (#34268)
Signed-off-by: Orion Poplawski <orion@cora.nwra.com> Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
8dc0048698
commit
becb31f34c
2 changed files with 48 additions and 3 deletions
|
@ -132,6 +132,20 @@ TESTCASE_VLAN = [
|
|||
]
|
||||
|
||||
|
||||
TESTCASE_ETHERNET_DHCP = [
|
||||
{
|
||||
'type': 'ethernet',
|
||||
'conn_name': 'non_existent_nw_device',
|
||||
'ifname': 'ethernet_non_existant',
|
||||
'ip4': '10.10.10.10',
|
||||
'gw4': '10.10.10.1',
|
||||
'state': 'present',
|
||||
'_ansible_check_mode': False,
|
||||
'dhcp_client_id': '00:11:22:AA:BB:CC:DD',
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def mocker_set(mocker, connection_exists=False):
|
||||
"""
|
||||
Common mocker object
|
||||
|
@ -378,7 +392,7 @@ def test_mod_bridge_slave(mocked_generic_connection_modify):
|
|||
@pytest.mark.parametrize('patch_ansible_module', TESTCASE_VLAN, indirect=['patch_ansible_module'])
|
||||
def test_create_vlan_con(mocked_generic_connection_create):
|
||||
"""
|
||||
Test if Bridge_slave created
|
||||
Test if VLAN created
|
||||
"""
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
|
@ -395,7 +409,7 @@ def test_create_vlan_con(mocked_generic_connection_create):
|
|||
@pytest.mark.parametrize('patch_ansible_module', TESTCASE_VLAN, indirect=['patch_ansible_module'])
|
||||
def test_mod_vlan_conn(mocked_generic_connection_modify):
|
||||
"""
|
||||
Test if Bridge_slave modified
|
||||
Test if VLAN modified
|
||||
"""
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
|
@ -407,3 +421,18 @@ def test_mod_vlan_conn(mocked_generic_connection_modify):
|
|||
|
||||
for param in ['vlan.id']:
|
||||
assert param in args[0]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('patch_ansible_module', TESTCASE_ETHERNET_DHCP, indirect=['patch_ansible_module'])
|
||||
def test_eth_dhcp_client_id_con_create(mocked_generic_connection_create):
|
||||
"""
|
||||
Test : Ethernet connection created with DHCP_CLIENT_ID
|
||||
"""
|
||||
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 'ipv4.dhcp-client-id' in args[0]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue