Deprecate nxos_switchport and Add nxos_l2_interface DI module (#33813)

* Deprecate nxos_switchport

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add nxos_l2_interface DI module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* pep8 fixes

* aggregate test for nxos_l2_interface

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* revert nxos_switchport test change

* gundalow's comment

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-01-05 13:14:02 +05:30 committed by John R Barker
parent e9a5ff912a
commit 9d2182bcf8
16 changed files with 869 additions and 7 deletions

View file

@ -20,24 +20,24 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_switchport
from ansible.modules.network.nxos import _nxos_switchport
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosSwitchportModule(TestNxosModule):
module = nxos_switchport
module = _nxos_switchport
def setUp(self):
super(TestNxosSwitchportModule, self).setUp()
self.mock_run_commands = patch('ansible.modules.network.nxos.nxos_switchport.run_commands')
self.mock_run_commands = patch('ansible.modules.network.nxos._nxos_switchport.run_commands')
self.run_commands = self.mock_run_commands.start()
self.mock_load_config = patch('ansible.modules.network.nxos.nxos_switchport.load_config')
self.mock_load_config = patch('ansible.modules.network.nxos._nxos_switchport.load_config')
self.load_config = self.mock_load_config.start()
self.mock_get_capabilities = patch('ansible.modules.network.nxos.nxos_switchport.get_capabilities')
self.mock_get_capabilities = patch('ansible.modules.network.nxos._nxos_switchport.get_capabilities')
self.get_capabilities = self.mock_get_capabilities.start()
self.get_capabilities.return_value = {'network_api': 'cliconf'}
@ -54,7 +54,7 @@ class TestNxosSwitchportModule(TestNxosModule):
for command in commands:
filename = str(command).split(' | ')[0].replace(' ', '_')
filename = filename.replace('2/1', '')
output.append(load_fixture('nxos_switchport', filename))
output.append(load_fixture('_nxos_switchport', filename))
return output
self.run_commands.side_effect = load_from_file