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:
Trishna Guha 2017-11-13 14:48:04 +00:00 committed by GitHub
parent b0e7c71716
commit e4052c1261
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 222 additions and 2 deletions

View file

@ -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'])