Update iosxr cliconf plugin (#43837)

* Update iosxr cliconf plugin

Fixes #39056

*  Update iosxr cliconf plugin
*  Modify iosxr module_utils code to support
   refactored cliconf plugin api's
*  Other minor changes

* Fix unit test failure

* Update ios, eos, nxos plugin for diff

* Fix review comment
This commit is contained in:
Ganesh Nalawade 2018-08-10 13:12:51 +05:30 committed by GitHub
parent 7b1cc11685
commit d1de1e0449
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 217 additions and 153 deletions

View file

@ -32,13 +32,13 @@ class TestIosxrCommandModule(TestIosxrModule):
def setUp(self):
super(TestIosxrCommandModule, self).setUp()
self.mock_run_command = patch('ansible.modules.network.iosxr.iosxr_command.run_command')
self.run_command = self.mock_run_command.start()
self.mock_run_commands = patch('ansible.modules.network.iosxr.iosxr_command.run_commands')
self.run_commands = self.mock_run_commands.start()
def tearDown(self):
super(TestIosxrCommandModule, self).tearDown()
self.mock_run_command.stop()
self.mock_run_commands.stop()
def load_fixtures(self, commands=None):
@ -55,7 +55,7 @@ class TestIosxrCommandModule(TestIosxrModule):
output.append(load_fixture(filename))
return output
self.run_command.side_effect = load_from_file
self.run_commands.side_effect = load_from_file
def test_iosxr_command_simple(self):
set_module_args(dict(commands=['show version']))
@ -78,13 +78,13 @@ class TestIosxrCommandModule(TestIosxrModule):
wait_for = 'result[0] contains "test string"'
set_module_args(dict(commands=['show version'], wait_for=wait_for))
self.execute_module(failed=True)
self.assertEqual(self.run_command.call_count, 10)
self.assertEqual(self.run_commands.call_count, 10)
def test_iosxr_command_retries(self):
wait_for = 'result[0] contains "test string"'
set_module_args(dict(commands=['show version'], wait_for=wait_for, retries=2))
self.execute_module(failed=True)
self.assertEqual(self.run_command.call_count, 2)
self.assertEqual(self.run_commands.call_count, 2)
def test_iosxr_command_match_any(self):
wait_for = ['result[0] contains "Cisco IOS"',