mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-14 04:09:11 -07:00
Add mtu option nxos_interface feature idea (#32680)
* Add mtu option nxos_interface feature idea Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add unit test for mtu feature Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
b0e7c71716
commit
e4052c1261
5 changed files with 222 additions and 2 deletions
|
@ -42,7 +42,22 @@ class TestNxosInterfaceModule(TestNxosModule):
|
|||
self.mock_load_config.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, device=''):
|
||||
module_name = self.module.__name__.rsplit('.', 1)[1]
|
||||
|
||||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
|
||||
for command in commands:
|
||||
if type(command) == dict:
|
||||
command = command['command']
|
||||
filename = str(command).split(' | ')[0].replace(' ', '_').replace('/', '_')
|
||||
print(filename)
|
||||
output.append(load_fixture(module_name, filename))
|
||||
return output
|
||||
|
||||
self.load_config.return_value = None
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_nxos_interface_up(self):
|
||||
set_module_args(dict(interface='loopback0'))
|
||||
|
@ -58,3 +73,8 @@ class TestNxosInterfaceModule(TestNxosModule):
|
|||
set_module_args(dict(interface='loopback0', state='absent'))
|
||||
result = self.execute_module(changed=False)
|
||||
self.assertEqual(result['commands'], [])
|
||||
|
||||
def test_nxos_interface_mtu_change(self):
|
||||
set_module_args(dict(interface='Ethernet2/5', mtu=1606, state='present'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['interface Ethernet2/5', 'mtu 1606', 'no shutdown'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue