From c40de24e9c54240ffb83086cdda4bdaf18c73335 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Tue, 14 Nov 2017 10:40:37 +0000 Subject: [PATCH] fix mtu check nxos_interface (#32880) Signed-off-by: Trishna Guha --- lib/ansible/modules/network/nxos/nxos_interface.py | 2 +- test/units/modules/network/nxos/test_nxos_interface.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_interface.py b/lib/ansible/modules/network/nxos/nxos_interface.py index ad90dba5f5e..4938e3adf07 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_interface.py @@ -485,7 +485,7 @@ def get_interface_config_commands(interface, intf, existing): commands.append(command) mtu = interface.get('mtu') - if mtu: + if mtu != 'None': commands.append('mtu {0}'.format(mtu)) admin_state = interface.get('admin_state') diff --git a/test/units/modules/network/nxos/test_nxos_interface.py b/test/units/modules/network/nxos/test_nxos_interface.py index b9e14f1abb6..a6afed2e464 100644 --- a/test/units/modules/network/nxos/test_nxos_interface.py +++ b/test/units/modules/network/nxos/test_nxos_interface.py @@ -62,12 +62,14 @@ class TestNxosInterfaceModule(TestNxosModule): def test_nxos_interface_up(self): set_module_args(dict(interface='loopback0')) result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['interface loopback0', 'no shutdown']) + self.assertIn('interface loopback0', result['commands']) + self.assertIn('no shutdown', result['commands']) def test_nxos_interface_down(self): set_module_args(dict(interface='loopback0', admin_state='down')) result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['interface loopback0', 'shutdown']) + self.assertIn('interface loopback0', result['commands']) + self.assertIn('shutdown', result['commands']) def test_nxos_interface_delete(self): set_module_args(dict(interface='loopback0', state='absent'))