|
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
|
|
|
|
import os
|
|
|
|
from ansible.compat.tests.mock import patch
|
|
|
|
from ansible.compat.tests.mock import patch
|
|
|
|
from ansible.modules.network.cnos import cnos_interface
|
|
|
|
from ansible.modules.network.cnos import cnos_interface
|
|
|
|
from units.modules.utils import set_module_args
|
|
|
|
from units.modules.utils import set_module_args
|
|
|
@ -21,6 +22,7 @@ class TestCnosEthernetModule(TestCnosModule):
|
|
|
|
def tearDown(self):
|
|
|
|
def tearDown(self):
|
|
|
|
super(TestCnosEthernetModule, self).tearDown()
|
|
|
|
super(TestCnosEthernetModule, self).tearDown()
|
|
|
|
self.mock_run_cnos_commands.stop()
|
|
|
|
self.mock_run_cnos_commands.stop()
|
|
|
|
|
|
|
|
os.remove('test.log')
|
|
|
|
|
|
|
|
|
|
|
|
def load_fixtures(self, commands=None, transport='cli'):
|
|
|
|
def load_fixtures(self, commands=None, transport='cli'):
|
|
|
|
self.run_cnos_commands.return_value = [load_fixture('cnos_ethernet_config.cfg')]
|
|
|
|
self.run_cnos_commands.return_value = [load_fixture('cnos_ethernet_config.cfg')]
|
|
|
@ -31,9 +33,6 @@ class TestCnosEthernetModule(TestCnosModule):
|
|
|
|
'outputfile': 'test.log', 'interfaceOption': 'ethernet', 'interfaceRange': '33',
|
|
|
|
'outputfile': 'test.log', 'interfaceOption': 'ethernet', 'interfaceRange': '33',
|
|
|
|
'interfaceArg1': 'channel-group', 'interfaceArg2': '33', 'interfaceArg3': 'on'})
|
|
|
|
'interfaceArg1': 'channel-group', 'interfaceArg2': '33', 'interfaceArg3': 'on'})
|
|
|
|
result = self.execute_module(changed=True)
|
|
|
|
result = self.execute_module(changed=True)
|
|
|
|
file = open('Anil.txt', "a")
|
|
|
|
|
|
|
|
file.write(str(result))
|
|
|
|
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
expected_result = 'Interface Configuration is Accomplished'
|
|
|
|
expected_result = 'Interface Configuration is Accomplished'
|
|
|
|
self.assertEqual(result['msg'], expected_result)
|
|
|
|
self.assertEqual(result['msg'], expected_result)
|
|
|
|
|
|
|
|
|
|
|
|