mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Clean up after cnos tests (#45564)
This commit is contained in:
parent
ac58c36ad0
commit
0b433b3ea9
5 changed files with 10 additions and 15 deletions
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.cnos import cnos_bgp
|
||||
from units.modules.utils import set_module_args
|
||||
|
@ -21,6 +22,7 @@ class TestCnosBgpModule(TestCnosModule):
|
|||
def tearDown(self):
|
||||
super(TestCnosBgpModule, self).tearDown()
|
||||
self.mock_run_cnos_commands.stop()
|
||||
os.remove('test.log')
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
self.run_cnos_commands.return_value = [load_fixture('cnos_bgp_config.cfg')]
|
||||
|
@ -33,9 +35,6 @@ class TestCnosBgpModule(TestCnosModule):
|
|||
'bgpArg3': '13', 'bgpArg4': 'address-family',
|
||||
'bgpArg5': 'ipv4', 'bgpArg6': 'next-hop-self'})
|
||||
result = self.execute_module(changed=True)
|
||||
file = open('Anil.txt', "a")
|
||||
file.write(str(result))
|
||||
file.close()
|
||||
expected_result = 'BGP configurations accomplished'
|
||||
self.assertEqual(result['msg'], expected_result)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.cnos import cnos_interface
|
||||
from units.modules.utils import set_module_args
|
||||
|
@ -21,6 +22,7 @@ class TestCnosEthernetModule(TestCnosModule):
|
|||
def tearDown(self):
|
||||
super(TestCnosEthernetModule, self).tearDown()
|
||||
self.mock_run_cnos_commands.stop()
|
||||
os.remove('test.log')
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
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',
|
||||
'interfaceArg1': 'channel-group', 'interfaceArg2': '33', 'interfaceArg3': 'on'})
|
||||
result = self.execute_module(changed=True)
|
||||
file = open('Anil.txt', "a")
|
||||
file.write(str(result))
|
||||
file.close()
|
||||
expected_result = 'Interface Configuration is Accomplished'
|
||||
self.assertEqual(result['msg'], expected_result)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.cnos import cnos_portchannel
|
||||
from units.modules.utils import set_module_args
|
||||
|
@ -21,6 +22,7 @@ class TestCnosPortchannelModule(TestCnosModule):
|
|||
def tearDown(self):
|
||||
super(TestCnosPortchannelModule, self).tearDown()
|
||||
self.mock_run_cnos_commands.stop()
|
||||
os.remove('test.log')
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
self.run_cnos_commands.return_value = [load_fixture('cnos_portchannel_config.cfg')]
|
||||
|
@ -31,9 +33,6 @@ class TestCnosPortchannelModule(TestCnosModule):
|
|||
'outputfile': 'test.log', 'interfaceRange': '33',
|
||||
'interfaceArg1': 'channel-group', 'interfaceArg2': '33', 'interfaceArg3': 'on'})
|
||||
result = self.execute_module(changed=True)
|
||||
file = open('Anil.txt', "a")
|
||||
file.write(str(result))
|
||||
file.close()
|
||||
expected_result = 'Port Channel Configuration is done'
|
||||
self.assertEqual(result['msg'], expected_result)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.cnos import cnos_vlag
|
||||
from units.modules.utils import set_module_args
|
||||
|
@ -21,6 +22,7 @@ class TestCnosVlagModule(TestCnosModule):
|
|||
def tearDown(self):
|
||||
super(TestCnosVlagModule, self).tearDown()
|
||||
self.mock_run_cnos_commands.stop()
|
||||
os.remove('test.log')
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
self.run_cnos_commands.return_value = [load_fixture('cnos_vlag_config.cfg')]
|
||||
|
@ -30,9 +32,6 @@ class TestCnosVlagModule(TestCnosModule):
|
|||
'host': '10.241.107.39', 'deviceType': 'g8272_cnos',
|
||||
'outputfile': 'test.log', 'vlagArg1': 'enable'})
|
||||
result = self.execute_module(changed=True)
|
||||
file = open('Anil.txt', "a")
|
||||
file.write(str(result))
|
||||
file.close()
|
||||
expected_result = 'VLAG configurations accomplished'
|
||||
self.assertEqual(result['msg'], expected_result)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
from ansible.compat.tests.mock import patch
|
||||
from ansible.modules.network.cnos import cnos_vlan
|
||||
from units.modules.utils import set_module_args
|
||||
|
@ -21,6 +22,7 @@ class TestCnosVlanModule(TestCnosModule):
|
|||
def tearDown(self):
|
||||
super(TestCnosVlanModule, self).tearDown()
|
||||
self.mock_run_cnos_commands.stop()
|
||||
os.remove('test.log')
|
||||
|
||||
def load_fixtures(self, commands=None, transport='cli'):
|
||||
self.run_cnos_commands.return_value = [load_fixture('cnos_vlan_config.cfg')]
|
||||
|
@ -31,9 +33,6 @@ class TestCnosVlanModule(TestCnosModule):
|
|||
'outputfile': 'test.log', 'vlanArg1': '13',
|
||||
'vlanArg2': 'name', 'vlanArg3': 'anil'})
|
||||
result = self.execute_module(changed=True)
|
||||
file = open('Anil.txt', "a")
|
||||
file.write(str(result))
|
||||
file.close()
|
||||
expected_result = 'VLAN configuration is accomplished'
|
||||
self.assertEqual(result['msg'], expected_result)
|
||||
|
||||
|
|
Loading…
Reference in a new issue