mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-09-30 21:43:22 -07:00
[wip] Remove network content (#84)
* rebase * remove broken symlinks * more deletes * restore cs_* integration tests * More deletes - from Felix * cs_common * Remove some more ignores
This commit is contained in:
parent
8d203225d3
commit
c313c825f4
2215 changed files with 0 additions and 333978 deletions
|
@ -1,87 +0,0 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_data = {}
|
||||
|
||||
|
||||
def load_fixture(name):
|
||||
path = os.path.join(fixture_path, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
class TestCiscoWlcModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
|
@ -1,9 +0,0 @@
|
|||
sysname router
|
||||
|
||||
interface create mtc-1 1
|
||||
interface address dynamic-interface mtc-1 10.33.20.4 255.255.255.0 10.33.20.1
|
||||
interface vlan mtc-1 1
|
||||
|
||||
interface create mtc-2 2
|
||||
interface address dynamic-interface mtc-2 10.33.26.4 255.255.255.0 10.33.26.1
|
||||
interface vlan mtc-2 2
|
|
@ -1,9 +0,0 @@
|
|||
sysname foo
|
||||
|
||||
interface create mtc-1 1
|
||||
interface address dynamic-interface mtc-1 10.33.20.4 255.255.255.0 10.33.20.2
|
||||
interface vlan mtc-1 1
|
||||
|
||||
interface create mtc-2 2
|
||||
interface address dynamic-interface mtc-2 10.33.26.4 255.255.255.0 10.33.26.1
|
||||
interface vlan mtc-2 2
|
|
@ -1,43 +0,0 @@
|
|||
Manufacturer's Name.............................. Cisco Systems Inc.
|
||||
Product Name..................................... Cisco Controller
|
||||
Product Version.................................. 8.2.110.0
|
||||
RTOS Version..................................... 8.2.110.0
|
||||
Bootloader Version............................... 8.0.100.0
|
||||
Emergency Image Version.......................... 8.0.100.0
|
||||
|
||||
Build Type....................................... DATA + WPS
|
||||
|
||||
System Name...................................... SOMEHOST
|
||||
System Location.................................. USA
|
||||
System Contact................................... SN:E228240;ASSET:LSMTCc1
|
||||
System ObjectID.................................. 1.3.6.1.4.1.9.1.1615
|
||||
Redundancy Mode.................................. Disabled
|
||||
IP Address....................................... 10.10.10.10
|
||||
IPv6 Address..................................... ::
|
||||
System Up Time................................... 328 days 7 hrs 54 mins 49 secs
|
||||
System Timezone Location......................... (GMT) London, Lisbon, Dublin, Edinburgh
|
||||
System Stats Realtime Interval................... 5
|
||||
System Stats Normal Interval..................... 180
|
||||
|
||||
Configured Country............................... US - United States
|
||||
Operating Environment............................ Commercial (10 to 35 C)
|
||||
Internal Temp Alarm Limits....................... 10 to 38 C
|
||||
Internal Temperature............................. +18 C
|
||||
Fan Status....................................... OK
|
||||
|
||||
RAID Volume Status
|
||||
Drive 0.......................................... Good
|
||||
Drive 1.......................................... Good
|
||||
|
||||
State of 802.11b Network......................... Enabled
|
||||
State of 802.11a Network......................... Enabled
|
||||
Number of WLANs.................................. 1
|
||||
Number of Active Clients......................... 0
|
||||
|
||||
Burned-in MAC Address............................ AA:AA:AA:AA:AA:AA
|
||||
Power Supply 1................................... Present, OK
|
||||
Power Supply 2................................... Present, OK
|
||||
Maximum number of APs supported.................. 6000
|
||||
System Nas-Id....................................
|
||||
WLC MIC Certificate Types........................ SHA1/SHA2
|
||||
Licensing Type................................... RTU
|
|
@ -1,122 +0,0 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.aireos import aireos_command
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .aireos_module import TestCiscoWlcModule, load_fixture
|
||||
from ansible.module_utils import six
|
||||
|
||||
|
||||
class TestCiscoWlcCommandModule(TestCiscoWlcModule):
|
||||
|
||||
module = aireos_command
|
||||
|
||||
def setUp(self):
|
||||
super(TestCiscoWlcCommandModule, self).setUp()
|
||||
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.aireos.aireos_command.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCiscoWlcCommandModule, self).tearDown()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
|
||||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
|
||||
for item in commands:
|
||||
try:
|
||||
obj = json.loads(item['command'])
|
||||
command = obj['command']
|
||||
except ValueError:
|
||||
command = item['command']
|
||||
filename = str(command).replace(' ', '_')
|
||||
output.append(load_fixture(filename))
|
||||
return output
|
||||
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_aireos_command_simple(self):
|
||||
set_module_args(dict(commands=['show sysinfo']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout']), 1)
|
||||
self.assertTrue(result['stdout'][0].startswith('Manufacturer\'s Name'))
|
||||
|
||||
def test_aireos_command_multiple(self):
|
||||
set_module_args(dict(commands=['show sysinfo', 'show sysinfo']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout']), 2)
|
||||
self.assertTrue(result['stdout'][0].startswith('Manufacturer\'s Name'))
|
||||
|
||||
def test_aireos_command_wait_for(self):
|
||||
wait_for = 'result[0] contains "Cisco Systems Inc"'
|
||||
set_module_args(dict(commands=['show sysinfo'], wait_for=wait_for))
|
||||
self.execute_module()
|
||||
|
||||
def test_aireos_command_wait_for_fails(self):
|
||||
wait_for = 'result[0] contains "test string"'
|
||||
set_module_args(dict(commands=['show sysinfo'], wait_for=wait_for))
|
||||
self.execute_module(failed=True)
|
||||
self.assertEqual(self.run_commands.call_count, 10)
|
||||
|
||||
def test_aireos_command_retries(self):
|
||||
wait_for = 'result[0] contains "test string"'
|
||||
set_module_args(dict(commands=['show sysinfo'], wait_for=wait_for, retries=2))
|
||||
self.execute_module(failed=True)
|
||||
self.assertEqual(self.run_commands.call_count, 2)
|
||||
|
||||
def test_aireos_command_match_any(self):
|
||||
wait_for = ['result[0] contains "Cisco Systems Inc"',
|
||||
'result[0] contains "test string"']
|
||||
set_module_args(dict(commands=['show sysinfo'], wait_for=wait_for, match='any'))
|
||||
self.execute_module()
|
||||
|
||||
def test_aireos_command_match_all(self):
|
||||
wait_for = ['result[0] contains "Cisco Systems Inc"',
|
||||
'result[0] contains "Cisco Controller"']
|
||||
set_module_args(dict(commands=['show sysinfo'], wait_for=wait_for, match='all'))
|
||||
self.execute_module()
|
||||
|
||||
def test_aireos_command_match_all_failure(self):
|
||||
wait_for = ['result[0] contains "Cisco Systems Inc"',
|
||||
'result[0] contains "test string"']
|
||||
commands = ['show sysinfo', 'show sysinfo']
|
||||
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
|
||||
self.execute_module(failed=True)
|
||||
|
||||
def test_aireos_command_to_lines_non_ascii(self):
|
||||
''' Test data is one variation of the result of a `show run-config commands`
|
||||
command on Cisco WLC version 8.8.120.0 '''
|
||||
test_data = '''
|
||||
wlan flexconnect learn-ipaddr 101 enable
|
||||
`\xc8\x92\xef\xbf\xbdR\x7f`\xc8\x92\xef\xbf\xbdR\x7f`
|
||||
wlan wgb broadcast-tagging disable 1
|
||||
'''.strip()
|
||||
test_string = six.u(test_data)
|
||||
test_stdout = [test_string, ]
|
||||
result = list(aireos_command.to_lines(test_stdout))
|
||||
print(result[0])
|
||||
self.assertEqual(len(result[0]), 3)
|
|
@ -1,131 +0,0 @@
|
|||
#
|
||||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.aireos import aireos_config
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .aireos_module import TestCiscoWlcModule, load_fixture
|
||||
|
||||
|
||||
class TestCiscoWlcConfigModule(TestCiscoWlcModule):
|
||||
|
||||
module = aireos_config
|
||||
|
||||
def setUp(self):
|
||||
super(TestCiscoWlcConfigModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.aireos.aireos_config.get_config')
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch('ansible_collections.community.general.plugins.modules.network.aireos.aireos_config.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.aireos.aireos_config.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
self.mock_save_config = patch('ansible_collections.community.general.plugins.modules.network.aireos.aireos_config.save_config')
|
||||
self.save_config = self.mock_save_config.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCiscoWlcConfigModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
config_file = 'aireos_config_config.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
||||
def test_aireos_config_unchanged(self):
|
||||
src = load_fixture('aireos_config_config.cfg')
|
||||
set_module_args(dict(src=src))
|
||||
self.execute_module()
|
||||
|
||||
def test_aireos_config_src(self):
|
||||
src = load_fixture('aireos_config_src.cfg')
|
||||
set_module_args(dict(src=src))
|
||||
commands = ['sysname foo', 'interface address dynamic-interface mtc-1 10.33.20.4 255.255.255.0 10.33.20.2']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aireos_config_backup(self):
|
||||
set_module_args(dict(backup=True))
|
||||
result = self.execute_module()
|
||||
self.assertIn('__backup__', result)
|
||||
|
||||
def test_aireos_config_save(self):
|
||||
set_module_args(dict(save=True))
|
||||
self.execute_module()
|
||||
self.assertEqual(self.save_config.call_count, 1)
|
||||
self.assertEqual(self.get_config.call_count, 0)
|
||||
self.assertEqual(self.load_config.call_count, 0)
|
||||
|
||||
def test_aireos_config_before(self):
|
||||
set_module_args(dict(lines=['sysname foo'], before=['test1', 'test2']))
|
||||
commands = ['test1', 'test2', 'sysname foo']
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aireos_config_after(self):
|
||||
set_module_args(dict(lines=['sysname foo'], after=['test1', 'test2']))
|
||||
commands = ['sysname foo', 'test1', 'test2']
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aireos_config_before_after_no_change(self):
|
||||
set_module_args(dict(lines=['sysname router'],
|
||||
before=['test1', 'test2'],
|
||||
after=['test3', 'test4']))
|
||||
self.execute_module()
|
||||
|
||||
def test_aireos_config_config(self):
|
||||
config = 'sysname localhost'
|
||||
set_module_args(dict(lines=['sysname router'], config=config))
|
||||
commands = ['sysname router']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aireos_config_match_none(self):
|
||||
lines = ['sysname router', 'interface create mtc-1 1']
|
||||
set_module_args(dict(lines=lines, match='none'))
|
||||
self.execute_module(changed=True, commands=lines, sort=False)
|
||||
|
||||
def test_nxos_config_save_always(self):
|
||||
args = dict(save_when='always')
|
||||
set_module_args(args)
|
||||
self.execute_module()
|
||||
self.assertEqual(self.save_config.call_count, 1)
|
||||
self.assertEqual(self.get_config.call_count, 0)
|
||||
self.assertEqual(self.load_config.call_count, 0)
|
||||
|
||||
def test_nxos_config_save_changed_true(self):
|
||||
args = dict(save_when='changed', lines=['sysname foo', 'interface create mtc-3 3'])
|
||||
set_module_args(args)
|
||||
self.execute_module(changed=True)
|
||||
self.assertEqual(self.save_config.call_count, 1)
|
||||
self.assertEqual(self.get_config.call_count, 1)
|
||||
self.assertEqual(self.load_config.call_count, 1)
|
||||
|
||||
def test_nxos_config_save_changed_false(self):
|
||||
args = dict(save_when='changed')
|
||||
set_module_args(args)
|
||||
self.execute_module()
|
||||
self.assertEqual(self.save_config.call_count, 0)
|
||||
self.assertEqual(self.get_config.call_count, 0)
|
||||
self.assertEqual(self.load_config.call_count, 0)
|
|
@ -1,88 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_data = {}
|
||||
|
||||
|
||||
def load_fixture(name):
|
||||
path = os.path.join(fixture_path, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
class TestApconosModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
|
@ -1,2 +0,0 @@
|
|||
APCON
|
||||
COMPONENT MODEL VERSION
|
|
@ -1,110 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.apconos import apconos_command
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .apconos_module import TestApconosModule, load_fixture
|
||||
|
||||
|
||||
class TestApconosCommandModule(TestApconosModule):
|
||||
|
||||
module = apconos_command
|
||||
|
||||
def setUp(self):
|
||||
super(TestApconosCommandModule, self).setUp()
|
||||
|
||||
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.apconos.apconos_command.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestApconosCommandModule, self).tearDown()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
|
||||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
for item in commands:
|
||||
filename = str(item).replace(' ', '_')
|
||||
output.append(load_fixture(filename))
|
||||
return output
|
||||
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_apcon_command_simple(self):
|
||||
set_module_args(dict(commands=['show version']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout_lines']), 1)
|
||||
self.assertEqual(result['stdout_lines'][0][0], 'APCON')
|
||||
|
||||
def test_apcon_command_multiple(self):
|
||||
set_module_args(dict(commands=['show version', 'show version']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout_lines']), 2)
|
||||
self.assertEqual(result['stdout_lines'][0][0], 'APCON')
|
||||
self.assertEqual(result['stdout_lines'][1][0], 'APCON')
|
||||
|
||||
def test_apcon_command_wait_for(self):
|
||||
wait_for = 'result[0] contains "APCON"'
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for))
|
||||
self.execute_module()
|
||||
|
||||
def test_apcon_command_wait_for_fails(self):
|
||||
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_commands.call_count, 10)
|
||||
|
||||
def test_apcon_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_commands.call_count, 2)
|
||||
|
||||
def test_apcon_command_match_any(self):
|
||||
wait_for = ['result[0] contains "test string"',
|
||||
'result[0] contains "VERSION"']
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for, match='any'))
|
||||
self.execute_module()
|
||||
|
||||
def test_apcon_command_match_all(self):
|
||||
wait_for = ['result[0] contains "COMPONENT"',
|
||||
'result[0] contains "MODEL"',
|
||||
'result[0] contains "VERSION"']
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for, match='all'))
|
||||
self.execute_module()
|
||||
|
||||
def test_apcon_command_match_all_failure(self):
|
||||
wait_for = ['result[0] contains "APCON OS"',
|
||||
'result[0] contains "test string"']
|
||||
commands = ['show version', 'show version']
|
||||
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
|
||||
self.execute_module(failed=True)
|
||||
|
||||
def test_apcon_command_checkmode_not_warning(self):
|
||||
commands = ['enable ssh']
|
||||
set_module_args(dict(commands=commands, _ansible_check_mode=False))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['warnings'], [])
|
|
@ -1,88 +0,0 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_data = {}
|
||||
|
||||
|
||||
def load_fixture(name):
|
||||
path = os.path.join(fixture_path, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
class TestArubaModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
|
@ -1,17 +0,0 @@
|
|||
!
|
||||
hostname router
|
||||
!
|
||||
interface GigabitEthernet0/0
|
||||
ip address 1.2.3.4 255.255.255.0
|
||||
description test string
|
||||
!
|
||||
interface GigabitEthernet0/1
|
||||
ip address 6.7.8.9 255.255.255.0
|
||||
description test string
|
||||
shutdown
|
||||
!
|
||||
wlan ssid-profile "blah"
|
||||
essid "blah"
|
||||
!
|
||||
ip access-list session blah
|
||||
any any any permit
|
|
@ -1,13 +0,0 @@
|
|||
!
|
||||
hostname router
|
||||
!
|
||||
interface GigabitEthernet0/0
|
||||
ip address 1.2.3.4 255.255.255.0
|
||||
description test string
|
||||
no shutdown
|
||||
!
|
||||
interface GigabitEthernet0/1
|
||||
ip address 6.7.8.9 255.255.255.0
|
||||
description test string
|
||||
shutdown
|
||||
!
|
|
@ -1,11 +0,0 @@
|
|||
!
|
||||
hostname foo
|
||||
!
|
||||
interface GigabitEthernet0/0
|
||||
no ip address
|
||||
!
|
||||
interface GigabitEthernet0/1
|
||||
ip address 6.7.8.9 255.255.255.0
|
||||
description test string
|
||||
shutdown
|
||||
!
|
|
@ -1,17 +0,0 @@
|
|||
Aruba Operating System Software.
|
||||
ArubaOS (MODEL: Aruba7220-US), Version 6.4.3.10
|
||||
Website: http://www.arubanetworks.com
|
||||
Copyright (c) 2002-2016, Aruba Networks, Inc.
|
||||
Compiled on 2016-08-31 at 18:31:30 PDT (build 56305) by p4build
|
||||
|
||||
ROM: System Bootstrap, Version CPBoot 1.2.1.0 (build 39183)
|
||||
Built: 2013-07-26 04:57:47
|
||||
Built by: p4build@re_client_39183
|
||||
|
||||
|
||||
Switch uptime is 15 days 20 hours 51 minutes 51 seconds
|
||||
Reboot Cause: User reboot (Intent:cause:register 78:86:50:2)
|
||||
Supervisor Card
|
||||
Processor (XLP432 Rev B1 (Secure Boot) , 1000 MHz) with 7370M bytes of memory.
|
||||
32K bytes of non-volatile configuration memory.
|
||||
7920M bytes of Supervisor Card system flash.
|
|
@ -1,109 +0,0 @@
|
|||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.aruba import aruba_command
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .aruba_module import TestArubaModule, load_fixture
|
||||
|
||||
|
||||
class TestArubaCommandModule(TestArubaModule):
|
||||
|
||||
module = aruba_command
|
||||
|
||||
def setUp(self):
|
||||
super(TestArubaCommandModule, self).setUp()
|
||||
|
||||
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.aruba.aruba_command.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestArubaCommandModule, self).tearDown()
|
||||
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
|
||||
def load_from_file(*args, **kwargs):
|
||||
module, commands = args
|
||||
output = list()
|
||||
|
||||
for item in commands:
|
||||
try:
|
||||
obj = json.loads(item['command'])
|
||||
command = obj['command']
|
||||
except ValueError:
|
||||
command = item['command']
|
||||
filename = str(command).replace(' ', '_')
|
||||
output.append(load_fixture(filename))
|
||||
return output
|
||||
|
||||
self.run_commands.side_effect = load_from_file
|
||||
|
||||
def test_aruba_command_simple(self):
|
||||
set_module_args(dict(commands=['show version']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout']), 1)
|
||||
self.assertTrue(result['stdout'][0].startswith('Aruba Operating System Software'))
|
||||
|
||||
def test_aruba_command_multiple(self):
|
||||
set_module_args(dict(commands=['show version', 'show version']))
|
||||
result = self.execute_module()
|
||||
self.assertEqual(len(result['stdout']), 2)
|
||||
self.assertTrue(result['stdout'][0].startswith('Aruba Operating System Software'))
|
||||
|
||||
def test_aruba_command_wait_for(self):
|
||||
wait_for = 'result[0] contains "Aruba Operating System Software"'
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for))
|
||||
self.execute_module()
|
||||
|
||||
def test_aruba_command_wait_for_fails(self):
|
||||
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_commands.call_count, 10)
|
||||
|
||||
def test_aruba_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_commands.call_count, 2)
|
||||
|
||||
def test_aruba_command_match_any(self):
|
||||
wait_for = ['result[0] contains "Aruba Operating System Software"',
|
||||
'result[0] contains "test string"']
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for, match='any'))
|
||||
self.execute_module()
|
||||
|
||||
def test_aruba_command_match_all(self):
|
||||
wait_for = ['result[0] contains "Aruba Operating System Software"',
|
||||
'result[0] contains "Aruba Networks"']
|
||||
set_module_args(dict(commands=['show version'], wait_for=wait_for, match='all'))
|
||||
self.execute_module()
|
||||
|
||||
def test_aruba_command_match_all_failure(self):
|
||||
wait_for = ['result[0] contains "Aruba Operating System Software"',
|
||||
'result[0] contains "test string"']
|
||||
commands = ['show version', 'show version']
|
||||
set_module_args(dict(commands=commands, wait_for=wait_for, match='all'))
|
||||
self.execute_module(failed=True)
|
|
@ -1,189 +0,0 @@
|
|||
#
|
||||
# (c) 2016 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.aruba import aruba_config
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .aruba_module import TestArubaModule, load_fixture
|
||||
|
||||
|
||||
class TestArubaConfigModule(TestArubaModule):
|
||||
|
||||
module = aruba_config
|
||||
|
||||
def setUp(self):
|
||||
super(TestArubaConfigModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.aruba.aruba_config.get_config')
|
||||
self.get_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_load_config = patch('ansible_collections.community.general.plugins.modules.network.aruba.aruba_config.load_config')
|
||||
self.load_config = self.mock_load_config.start()
|
||||
|
||||
self.mock_run_commands = patch('ansible_collections.community.general.plugins.modules.network.aruba.aruba_config.run_commands')
|
||||
self.run_commands = self.mock_run_commands.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestArubaConfigModule, self).tearDown()
|
||||
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
self.mock_run_commands.stop()
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
config_file = 'aruba_config_config.cfg'
|
||||
self.get_config.return_value = load_fixture(config_file)
|
||||
self.load_config.return_value = None
|
||||
|
||||
def test_aruba_config_unchanged(self):
|
||||
src = load_fixture('aruba_config_config.cfg')
|
||||
set_module_args(dict(src=src))
|
||||
self.execute_module()
|
||||
|
||||
def test_aruba_config_unchanged_different_spacing(self):
|
||||
# Tab indented
|
||||
set_module_args(dict(lines=['description test string'], parents=['interface GigabitEthernet0/0']))
|
||||
self.execute_module(changed=False)
|
||||
# 3 spaces indented
|
||||
set_module_args(dict(lines=['essid "blah"'], parents=['wlan ssid-profile "blah"']))
|
||||
self.execute_module(changed=False)
|
||||
|
||||
def test_aruba_config_src(self):
|
||||
src = load_fixture('aruba_config_src.cfg')
|
||||
set_module_args(dict(src=src))
|
||||
commands = ['hostname foo', 'interface GigabitEthernet0/0',
|
||||
'no ip address']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aruba_config_backup(self):
|
||||
set_module_args(dict(backup=True))
|
||||
result = self.execute_module()
|
||||
self.assertIn('__backup__', result)
|
||||
|
||||
def test_aruba_config_save_always(self):
|
||||
self.run_commands.return_value = "Hostname foo"
|
||||
set_module_args(dict(save_when='always'))
|
||||
self.execute_module(changed=True)
|
||||
self.assertEqual(self.run_commands.call_count, 1)
|
||||
self.assertEqual(self.get_config.call_count, 0)
|
||||
self.assertEqual(self.load_config.call_count, 0)
|
||||
args = self.run_commands.call_args[0][1]
|
||||
self.assertIn('write memory', args)
|
||||
|
||||
def test_aruba_config_save_changed_true(self):
|
||||
src = load_fixture('aruba_config_src.cfg')
|
||||
set_module_args(dict(src=src, save_when='changed'))
|
||||
commands = ['hostname foo', 'interface GigabitEthernet0/0',
|
||||
'no ip address']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
# src = load_fixture('aruba_config_src.cfg')
|
||||
|
||||
# set_module_args(dict(save_when='changed'))
|
||||
# commands = ['hostname changed']
|
||||
# self.execute_module(changed=False, commands=commands)
|
||||
self.assertEqual(self.run_commands.call_count, 1)
|
||||
self.assertEqual(self.get_config.call_count, 1)
|
||||
self.assertEqual(self.load_config.call_count, 1)
|
||||
args = self.run_commands.call_args[0][1]
|
||||
self.assertIn('write memory', args)
|
||||
|
||||
def test_aruba_config_save_changed_false(self):
|
||||
set_module_args(dict(save_when='changed'))
|
||||
self.execute_module(changed=False)
|
||||
self.assertEqual(self.run_commands.call_count, 0)
|
||||
self.assertEqual(self.get_config.call_count, 0)
|
||||
self.assertEqual(self.load_config.call_count, 0)
|
||||
|
||||
def test_aruba_config_lines_wo_parents(self):
|
||||
set_module_args(dict(lines=['hostname foo']))
|
||||
commands = ['hostname foo']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aruba_config_lines_w_parents(self):
|
||||
set_module_args(dict(lines=['shutdown'], parents=['interface GigabitEthernet0/0']))
|
||||
commands = ['interface GigabitEthernet0/0', 'shutdown']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aruba_config_before(self):
|
||||
set_module_args(dict(lines=['hostname foo'], before=['test1', 'test2']))
|
||||
commands = ['test1', 'test2', 'hostname foo']
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aruba_config_after(self):
|
||||
set_module_args(dict(lines=['hostname foo'], after=['test1', 'test2']))
|
||||
commands = ['hostname foo', 'test1', 'test2']
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aruba_config_before_after_no_change(self):
|
||||
set_module_args(dict(lines=['hostname router'],
|
||||
before=['test1', 'test2'],
|
||||
after=['test3', 'test4']))
|
||||
self.execute_module()
|
||||
|
||||
def test_aruba_config_config(self):
|
||||
config = 'hostname localhost'
|
||||
set_module_args(dict(lines=['hostname router'], config=config))
|
||||
commands = ['hostname router']
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aruba_config_replace_block(self):
|
||||
lines = ['description test string', 'test string']
|
||||
parents = ['interface GigabitEthernet0/0']
|
||||
set_module_args(dict(lines=lines, replace='block', parents=parents))
|
||||
commands = parents + lines
|
||||
self.execute_module(changed=True, commands=commands)
|
||||
|
||||
def test_aruba_config_force(self):
|
||||
lines = ['hostname router']
|
||||
set_module_args(dict(lines=lines, match='none'))
|
||||
self.execute_module(changed=True, commands=lines)
|
||||
|
||||
def test_aruba_config_match_none(self):
|
||||
lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string']
|
||||
parents = ['interface GigabitEthernet0/0']
|
||||
set_module_args(dict(lines=lines, parents=parents, match='none'))
|
||||
commands = parents + lines
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aruba_config_match_strict(self):
|
||||
lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string',
|
||||
'shutdown']
|
||||
parents = ['interface GigabitEthernet0/0']
|
||||
set_module_args(dict(lines=lines, parents=parents, match='strict'))
|
||||
commands = parents + ['shutdown']
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aruba_config_match_exact(self):
|
||||
lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string',
|
||||
'shutdown']
|
||||
parents = ['interface GigabitEthernet0/0']
|
||||
set_module_args(dict(lines=lines, parents=parents, match='exact'))
|
||||
commands = parents + lines
|
||||
self.execute_module(changed=True, commands=commands, sort=False)
|
||||
|
||||
def test_aruba_encrypt_false(self):
|
||||
set_module_args(dict(encrypt=False))
|
||||
self.execute_module()
|
||||
self.assertEqual(self.run_commands.call_count, 2)
|
||||
args = self.run_commands.call_args_list
|
||||
self.assertIn('encrypt disable', args[0][0])
|
||||
self.assertIn('encrypt enable', args[1][0])
|
|
@ -1,215 +0,0 @@
|
|||
{
|
||||
"mock_create_res": {
|
||||
"ansible_facts": {
|
||||
"avi_api_context": {
|
||||
"192.0.2.97:admin:None": {
|
||||
"csrftoken": "qG23CCARDL3rh1KZ66XXPIeUYCUCOZ4q",
|
||||
"session_id": "h5nynf9u9nompp5byai7vii2v8bbn9kd"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_context": null,
|
||||
"changed": true,
|
||||
"invocation": {
|
||||
"module_args": {
|
||||
"access": [{
|
||||
"role_ref": "/api/role?name=Tenant-Admin",
|
||||
"tenant_ref": "/api/tenant/********#********",
|
||||
"all_tenants": false
|
||||
}],
|
||||
"api_context": null,
|
||||
"api_version": "18.2.5",
|
||||
"avi_api_update_method": "put",
|
||||
"avi_credentials": null,
|
||||
"avi_disable_session_cache_as_fact": false,
|
||||
"avi_login_info": null,
|
||||
"controller": "192.0.2.97",
|
||||
"default_tenant_ref": "/api/tenant?name=********",
|
||||
"email": "test@abc.com",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"name": "testuser",
|
||||
"obj_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"obj_username": "testuser",
|
||||
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"state": "present",
|
||||
"tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"tenant_uuid": "",
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
|
||||
}
|
||||
},
|
||||
"obj": {
|
||||
"_last_modified": "1559736767460818",
|
||||
"access": [{
|
||||
"all_tenants": false,
|
||||
"role_ref": "https://192.0.2.97/api/tenant/********/role/role-ff851004-bd75-485b-87ec-2fe1d6a03fb9#Tenant-Admin",
|
||||
"tenant_ref": "https://192.0.2.97/api/tenant/********#********"
|
||||
}],
|
||||
"default_tenant_ref": "https://192.0.2.97/api/tenant/********#********",
|
||||
"email": "test@abc.com",
|
||||
"full_name": "testuser",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"local": true,
|
||||
"name": "testuser",
|
||||
"obj_password": "<sensitive>",
|
||||
"obj_username": "testuser",
|
||||
"password": "<sensitive>",
|
||||
"uid": 2004,
|
||||
"url": "https://192.0.2.97/api/user/user-7087578f-4dfe-4e06-a153-495a91824a1d#testuser",
|
||||
"user_profile_ref": "https://192.0.2.97/api/useraccountprofile/useraccountprofile-78063e7c-b443-48d6-b34c-5253ae1fcd2a#Default-User-Account-Profile",
|
||||
"username": "testuser",
|
||||
"uuid": "user-7087578f-4dfe-4e06-a153-495a91824a1d"
|
||||
},
|
||||
"old_obj": null
|
||||
},
|
||||
"mock_put_res": {
|
||||
"obj": {
|
||||
"username": "testuser",
|
||||
"user_profile_ref": "https://192.0.2.97/api/useraccountprofile/useraccountprofile-546c5e88-6270-4ba1-9cfd-d0c755e68f47#Default-User-Account-Profile",
|
||||
"name": "testuser",
|
||||
"url": "https://192.0.2.97/api/user/user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a#testuser",
|
||||
"is_active": true,
|
||||
"uuid": "user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a",
|
||||
"email": "newemail@abc.com",
|
||||
"access": [{
|
||||
"tenant_ref": "https://192.0.2.97/api/tenant/tenant-57af0f3f-6f14-4657-8f32-9b289407752b#Test-Admin",
|
||||
"all_tenants": false,
|
||||
"role_ref": "https://192.0.2.97/api/tenant/********/role/role-b073ab0d-e1d0-4800-95ef-6ecf2c5ed7d1#Tenant-Admin"
|
||||
}],
|
||||
"is_superuser": true,
|
||||
"obj_username": "testuser",
|
||||
"full_name": "testuser",
|
||||
"_last_modified": "1559802772203285",
|
||||
"password": "<sensitive>",
|
||||
"local": true,
|
||||
"obj_password": "<sensitive>",
|
||||
"default_tenant_ref": "https://192.0.2.97/api/tenant/********#********",
|
||||
"uid": 2002
|
||||
},
|
||||
"changed": true,
|
||||
"api_context": null,
|
||||
"invocation": {
|
||||
"module_args": {
|
||||
"username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"api_version": "18.2.5",
|
||||
"name": "testuser",
|
||||
"state": "present",
|
||||
"is_active": true,
|
||||
"api_context": null,
|
||||
"avi_disable_session_cache_as_fact": false,
|
||||
"controller": "192.0.2.97",
|
||||
"avi_api_patch_op": null,
|
||||
"access": [{
|
||||
"tenant_ref": "/api/tenant?name=Test-Admin",
|
||||
"all_tenants": false,
|
||||
"role_ref": "/api/role?name=Tenant-Admin"
|
||||
}],
|
||||
"is_superuser": true,
|
||||
"avi_credentials": null,
|
||||
"email": "newemail@abc.com",
|
||||
"default_tenant_ref": "/api/tenant?name=********",
|
||||
"obj_username": "testuser",
|
||||
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"tenant_uuid": "",
|
||||
"obj_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"avi_api_update_method": "put",
|
||||
"tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
|
||||
}
|
||||
},
|
||||
"ansible_facts": {
|
||||
"avi_api_context": {
|
||||
"192.0.2.97:admin:None": {
|
||||
"csrftoken": "Y7CET6zaIC9VZAzBqEW4cWo1N26jPg55",
|
||||
"session_id": "364n7o0p3o5so63b9rzd47v6ehya6xg7"
|
||||
}
|
||||
}
|
||||
},
|
||||
"old_obj": {
|
||||
"username": "testuser",
|
||||
"user_profile_ref": "https://192.0.2.97/api/useraccountprofile/useraccountprofile-546c5e88-6270-4ba1-9cfd-d0c755e68f47#Default-User-Account-Profile",
|
||||
"name": "testuser",
|
||||
"url": "https://192.0.2.97/api/user/user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a#testuser",
|
||||
"is_active": true,
|
||||
"uuid": "user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a",
|
||||
"access": [{
|
||||
"tenant_ref": "https://192.0.2.97/api/tenant/tenant-57af0f3f-6f14-4657-8f32-9b289407752b#Test-Admin",
|
||||
"all_tenants": false,
|
||||
"role_ref": "https://192.0.2.97/api/tenant/********/role/role-b073ab0d-e1d0-4800-95ef-6ecf2c5ed7d1#Tenant-Admin"
|
||||
}],
|
||||
"is_superuser": true,
|
||||
"full_name": "testuser",
|
||||
"ui_property": "",
|
||||
"password": "<sensitive>",
|
||||
"local": true,
|
||||
"email": "test@abc.com",
|
||||
"default_tenant_ref": "https://192.0.2.97/api/tenant/********#********",
|
||||
"uid": 2002
|
||||
}
|
||||
},
|
||||
"mock_del_res": {
|
||||
"ansible_facts": {
|
||||
"avi_api_context": {
|
||||
"192.0.2.97:admin:None": {
|
||||
"csrftoken": "Vtkx9GeS2lsrld5yX83cmJqbZO3MAimb",
|
||||
"session_id": "ix3t1dja8yzwb155de59viyn96hibn6b"
|
||||
}
|
||||
}
|
||||
},
|
||||
"api_context": null,
|
||||
"changed": true,
|
||||
"invocation": {
|
||||
"module_args": {
|
||||
"access": [{
|
||||
"role_ref": "/api/role?name=Tenant-Admin",
|
||||
"tenant_ref": "/api/tenant/********#********"
|
||||
}],
|
||||
"api_context": null,
|
||||
"api_version": "18.2.5",
|
||||
"avi_api_update_method": "put",
|
||||
"avi_credentials": null,
|
||||
"avi_disable_session_cache_as_fact": false,
|
||||
"avi_login_info": null,
|
||||
"controller": "192.0.2.97",
|
||||
"default_tenant_ref": "/api/tenant?name=********",
|
||||
"email": "test@abc.com",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"name": "testuser",
|
||||
"obj_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"obj_username": "testuser",
|
||||
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"state": "absent",
|
||||
"tenant": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
|
||||
"tenant_uuid": "",
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
|
||||
}
|
||||
},
|
||||
"obj": null,
|
||||
"old_obj": {
|
||||
"_last_modified": "1559803346264869",
|
||||
"access": [{
|
||||
"all_tenants": false,
|
||||
"role_ref": "https://192.0.2.97/api/tenant/********/role/role-b073ab0d-e1d0-4800-95ef-6ecf2c5ed7d1#Tenant-Admin",
|
||||
"tenant_ref": "https://192.0.2.97/api/tenant/tenant-57af0f3f-6f14-4657-8f32-9b289407752b#Test-Admin"
|
||||
}],
|
||||
"default_tenant_ref": "https://192.0.2.97/api/tenant/********#********",
|
||||
"email": "newemail@abc.com",
|
||||
"full_name": "testuser",
|
||||
"is_active": true,
|
||||
"is_superuser": true,
|
||||
"local": true,
|
||||
"name": "testuser",
|
||||
"password": "<sensitive>",
|
||||
"ui_property": "",
|
||||
"uid": 2002,
|
||||
"url": "https://192.0.2.97/api/user/user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a#testuser",
|
||||
"user_profile_ref": "https://192.0.2.97/api/useraccountprofile/useraccountprofile-546c5e88-6270-4ba1-9cfd-d0c755e68f47#Default-User-Account-Profile",
|
||||
"username": "testuser",
|
||||
"uuid": "user-ed10f328-bd92-4db2-bacd-0cf795fcbf8a"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
import os
|
||||
import json
|
||||
from ansible_collections.community.general.tests.unit.compat import unittest
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import Mock
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from ansible_collections.community.general.plugins.modules.network.avi import avi_user
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
with open(fixture_path + '/avi_user.json') as json_file:
|
||||
data = json.load(json_file)
|
||||
|
||||
|
||||
class TestAviUser(unittest.TestCase):
|
||||
|
||||
def test_create_user(self):
|
||||
set_module_args({
|
||||
"avi_credentials": {
|
||||
"controller": "192.0.2.13",
|
||||
"username": "username",
|
||||
"password": "fakepassword",
|
||||
"api_version": "18.2.5"
|
||||
},
|
||||
"state": "present",
|
||||
"name": "testuser",
|
||||
"obj_username": "testuser",
|
||||
"obj_password": "test123",
|
||||
"email": "test@abc.com",
|
||||
"access": [
|
||||
{
|
||||
"role_ref": "/api/role?name=Tenant-Admin",
|
||||
"tenant_ref": "/api/tenant?name=Test-Admin",
|
||||
"all_tenants": False
|
||||
}
|
||||
],
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"is_active": True,
|
||||
"is_superuser": True,
|
||||
"default_tenant_ref": "/api/tenant?name=admin"
|
||||
})
|
||||
avi_user.avi_ansible_api = Mock(return_value=data['mock_create_res'])
|
||||
response = avi_user.main()
|
||||
assert response['changed']
|
||||
|
||||
def test_put_on_user(self):
|
||||
set_module_args({
|
||||
"avi_credentials": {
|
||||
"controller": "192.0.2.13",
|
||||
"username": "username",
|
||||
"password": "fakepassword",
|
||||
"api_version": "18.2.5"
|
||||
},
|
||||
"state": "present",
|
||||
"avi_api_update_method": "put",
|
||||
"name": "testuser",
|
||||
"obj_username": "testuser",
|
||||
"obj_password": "test123",
|
||||
"email": "newemail@abc.com",
|
||||
"access": [{
|
||||
"role_ref": "/api/role?name=Tenant-Admin",
|
||||
"tenant_ref": "/api/tenant?name=Test-Admin",
|
||||
"all_tenants": False
|
||||
}],
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"is_active": True,
|
||||
"is_superuser": True,
|
||||
"default_tenant_ref": "/api/tenant?name=admin"
|
||||
})
|
||||
avi_user.avi_ansible_api = Mock(return_value=data['mock_put_res'])
|
||||
response = avi_user.main()
|
||||
assert response['changed']
|
||||
assert response['obj']
|
||||
assert response['old_obj']
|
||||
|
||||
def test_delete_user(self):
|
||||
set_module_args({
|
||||
"avi_credentials": {
|
||||
"controller": "192.0.2.13",
|
||||
"username": "username",
|
||||
"password": "fakepassword",
|
||||
"api_version": "18.2.5"
|
||||
|
||||
},
|
||||
"name": "testuser",
|
||||
"obj_username": "testuser",
|
||||
"obj_password": "test123",
|
||||
"email": "test@abc.com",
|
||||
"access": [{
|
||||
"role_ref": "/api/role?name=Tenant-Admin",
|
||||
"tenant_ref": "/api/tenant?name=Test-Admin",
|
||||
"all_tenants": False
|
||||
}],
|
||||
"user_profile_ref": "/api/useraccountprofile?name=Default-User-Account-Profile",
|
||||
"is_active": True,
|
||||
"is_superuser": True,
|
||||
"default_tenant_ref": "/api/tenant?name=admin"
|
||||
})
|
||||
avi_user.avi_ansible_api = Mock(return_value=data['mock_del_res'])
|
||||
response = avi_user.main()
|
||||
assert response['changed']
|
||||
assert not response['obj']
|
||||
assert response['old_obj']
|
|
@ -1,105 +0,0 @@
|
|||
# Copyright (c) 2018 Red Hat
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson
|
||||
|
||||
from ansible.module_utils import basic
|
||||
from ansible_collections.community.general.plugins.modules.network.check_point import checkpoint_access_rule
|
||||
|
||||
OBJECT = {'layer': 'foo', 'position': 'bar', 'name': 'baz',
|
||||
'source': [{'name': 'lol'}], 'destination': [{'name': 'Any'}],
|
||||
'action': {'name': 'drop'}, 'enabled': True}
|
||||
PAYLOAD = {'layer': 'foo', 'position': 'bar', 'name': 'baz'}
|
||||
|
||||
|
||||
class TestCheckpointAccessRule(object):
|
||||
module = checkpoint_access_rule
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(self, mocker):
|
||||
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
||||
|
||||
@pytest.fixture
|
||||
def connection_mock(self, mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_access_rule.Connection')
|
||||
return connection_class_mock.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_access_rule_200(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_access_rule.get_access_rule')
|
||||
mock_function.return_value = (200, OBJECT)
|
||||
return mock_function.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_access_rule_404(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_access_rule.get_access_rule')
|
||||
mock_function.return_value = (404, 'Object not found')
|
||||
return mock_function.return_value
|
||||
|
||||
def test_create(self, get_access_rule_404, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
assert 'checkpoint_access_rules' in result
|
||||
|
||||
def test_create_idempotent(self, get_access_rule_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, PAYLOAD)
|
||||
result = self._run_module(PAYLOAD)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def test_update(self, get_access_rule_200, connection_mock):
|
||||
payload_for_update = {'enabled': False}
|
||||
payload_for_update.update(PAYLOAD)
|
||||
connection_mock.send_request.return_value = (200, payload_for_update)
|
||||
result = self._run_module(payload_for_update)
|
||||
|
||||
assert result['changed']
|
||||
assert not result['checkpoint_access_rules']['enabled']
|
||||
|
||||
def test_delete(self, get_access_rule_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
payload_for_delete = {'state': 'absent'}
|
||||
payload_for_delete.update(PAYLOAD)
|
||||
result = self._run_module(payload_for_delete)
|
||||
|
||||
assert result['changed']
|
||||
|
||||
def test_delete_idempotent(self, get_access_rule_404, connection_mock):
|
||||
payload = {'name': 'baz', 'state': 'absent'}
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(payload)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def _run_module(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleExitJson) as ex:
|
||||
self.module.main()
|
||||
return ex.value.args[0]
|
||||
|
||||
def _run_module_with_fail_json(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
result = exc.value.args[0]
|
||||
return result
|
|
@ -1,99 +0,0 @@
|
|||
# Copyright (c) 2018 Red Hat
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson
|
||||
|
||||
from ansible.module_utils import basic
|
||||
from ansible_collections.community.general.plugins.modules.network.check_point import checkpoint_host
|
||||
|
||||
OBJECT = {'name': 'foo', 'ipv4-address': '192.168.0.15'}
|
||||
CREATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.15'}
|
||||
UPDATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.16'}
|
||||
DELETE_PAYLOAD = {'name': 'foo', 'state': 'absent'}
|
||||
|
||||
|
||||
class TestCheckpointHost(object):
|
||||
module = checkpoint_host
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(self, mocker):
|
||||
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
||||
|
||||
@pytest.fixture
|
||||
def connection_mock(self, mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.Connection')
|
||||
return connection_class_mock.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_host_200(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.get_host')
|
||||
mock_function.return_value = (200, OBJECT)
|
||||
return mock_function.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_host_404(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.get_host')
|
||||
mock_function.return_value = (404, 'Object not found')
|
||||
return mock_function.return_value
|
||||
|
||||
def test_create(self, get_host_404, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(CREATE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
assert 'checkpoint_hosts' in result
|
||||
|
||||
def test_create_idempotent(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(CREATE_PAYLOAD)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def test_update(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(UPDATE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
|
||||
def test_delete(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(DELETE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
|
||||
def test_delete_idempotent(self, get_host_404, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(DELETE_PAYLOAD)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def _run_module(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleExitJson) as ex:
|
||||
self.module.main()
|
||||
return ex.value.args[0]
|
||||
|
||||
def _run_module_with_fail_json(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
result = exc.value.args[0]
|
||||
return result
|
|
@ -1,67 +0,0 @@
|
|||
# Copyright (c) 2018 Red Hat
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson
|
||||
|
||||
from ansible.module_utils import basic
|
||||
from ansible_collections.community.general.plugins.modules.network.check_point import checkpoint_session
|
||||
|
||||
OBJECT = {'uid': '1234'}
|
||||
PAYLOAD = {}
|
||||
|
||||
|
||||
class TestCheckpointAccessRule(object):
|
||||
module = checkpoint_session
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(self, mocker):
|
||||
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
||||
|
||||
@pytest.fixture
|
||||
def connection_mock(self, mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_session.Connection')
|
||||
return connection_class_mock.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_session_200(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_session.get_session')
|
||||
mock_function.return_value = (200, OBJECT)
|
||||
return mock_function.return_value
|
||||
|
||||
def test_publish(self, get_session_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
assert 'checkpoint_session' in result
|
||||
|
||||
def _run_module(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleExitJson) as ex:
|
||||
self.module.main()
|
||||
return ex.value.args[0]
|
||||
|
||||
def _run_module_with_fail_json(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
result = exc.value.args[0]
|
||||
return result
|
|
@ -1,99 +0,0 @@
|
|||
# Copyright (c) 2018 Red Hat
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import pytest
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args, exit_json, fail_json, AnsibleFailJson, AnsibleExitJson
|
||||
|
||||
from ansible.module_utils import basic
|
||||
from ansible_collections.community.general.plugins.modules.network.check_point import checkpoint_host
|
||||
|
||||
OBJECT = {'name': 'foo', 'ipv4-address': '192.168.0.15'}
|
||||
CREATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.15'}
|
||||
UPDATE_PAYLOAD = {'name': 'foo', 'ip_address': '192.168.0.16'}
|
||||
DELETE_PAYLOAD = {'name': 'foo', 'state': 'absent'}
|
||||
|
||||
|
||||
class TestCheckpointHost(object):
|
||||
module = checkpoint_host
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def module_mock(self, mocker):
|
||||
return mocker.patch.multiple(basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json)
|
||||
|
||||
@pytest.fixture
|
||||
def connection_mock(self, mocker):
|
||||
connection_class_mock = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.Connection')
|
||||
return connection_class_mock.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_host_200(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.get_host')
|
||||
mock_function.return_value = (200, OBJECT)
|
||||
return mock_function.return_value
|
||||
|
||||
@pytest.fixture
|
||||
def get_host_404(self, mocker):
|
||||
mock_function = mocker.patch('ansible_collections.community.general.plugins.modules.network.check_point.checkpoint_host.get_host')
|
||||
mock_function.return_value = (404, 'Object not found')
|
||||
return mock_function.return_value
|
||||
|
||||
def test_create(self, get_host_404, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(CREATE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
assert 'checkpoint_hosts' in result
|
||||
|
||||
def test_create_idempotent(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(CREATE_PAYLOAD)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def test_update(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(UPDATE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
|
||||
def test_delete(self, get_host_200, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(DELETE_PAYLOAD)
|
||||
|
||||
assert result['changed']
|
||||
|
||||
def test_delete_idempotent(self, get_host_404, connection_mock):
|
||||
connection_mock.send_request.return_value = (200, OBJECT)
|
||||
result = self._run_module(DELETE_PAYLOAD)
|
||||
|
||||
assert not result['changed']
|
||||
|
||||
def _run_module(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleExitJson) as ex:
|
||||
self.module.main()
|
||||
return ex.value.args[0]
|
||||
|
||||
def _run_module_with_fail_json(self, module_args):
|
||||
set_module_args(module_args)
|
||||
with pytest.raises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
result = exc.value.args[0]
|
||||
return result
|
|
@ -1,90 +0,0 @@
|
|||
# Copyright (c) 2019 Red Hat
|
||||
#
|
||||
# This file is a part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase
|
||||
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_data = {}
|
||||
|
||||
|
||||
def load_fixture(module_name, name, device=''):
|
||||
path = os.path.join(fixture_path, module_name, device, name)
|
||||
if not os.path.exists(path):
|
||||
path = os.path.join(fixture_path, module_name, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
class TestCloudEngineModule(ModuleTestCase):
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']), result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'], result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
|
@ -1,11 +0,0 @@
|
|||
<data>
|
||||
<isiscomm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,11 +0,0 @@
|
|||
<data>
|
||||
<isiscomm xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId></instanceId>
|
||||
<vpnName></vpnName>
|
||||
<description></description>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,26 +0,0 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isCircuits>
|
||||
<isCircuit>
|
||||
<ifName></ifName>
|
||||
<circuitLevelType>level_1</circuitLevelType>
|
||||
<level1DisPriority>10</level1DisPriority>
|
||||
<level2DisPriority>10</level2DisPriority>
|
||||
<silentEnable>true</silentEnable>
|
||||
<silentCost>true</silentCost>
|
||||
<typeP2pEnable>true</typeP2pEnable>
|
||||
<snpaCheck>true</snpaCheck>
|
||||
<p2pNegotiationMode>2_way</p2pNegotiationMode>
|
||||
<p2pPeerIPIgnore>true</p2pPeerIPIgnore>
|
||||
<pPPOsicpCheckEnable>true</pPPOsicpCheckEnable>
|
||||
<level1Cost>10</level1Cost>
|
||||
<level2Cost>10</level2Cost>
|
||||
</isCircuit>
|
||||
</isCircuits>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,26 +0,0 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<isCircuits>
|
||||
<isCircuit>
|
||||
<ifName></ifName>
|
||||
<circuitLevelType></circuitLevelType>
|
||||
<level1DisPriority></level1DisPriority>
|
||||
<level2DisPriority></level2DisPriority>
|
||||
<silentEnable></silentEnable>
|
||||
<silentCost></silentCost>
|
||||
<typeP2pEnable></typeP2pEnable>
|
||||
<snpaCheck></snpaCheck>
|
||||
<p2pNegotiationMode></p2pNegotiationMode>
|
||||
<p2pPeerIPIgnore></p2pPeerIPIgnore>
|
||||
<pPPOsicpCheckEnable></pPPOsicpCheckEnable>
|
||||
<level1Cost></level1Cost>
|
||||
<level2Cost></level2Cost>
|
||||
</isCircuit>
|
||||
</isCircuits>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,104 +0,0 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
<description>ISIS</description>
|
||||
<isLevel>level_1</isLevel>
|
||||
<costStyle>narrow</costStyle>
|
||||
<relaxSpfLimit>true</relaxSpfLimit>
|
||||
<stdLevel1Cost>60</stdLevel1Cost>
|
||||
<stdLevel2Cost>60</stdLevel2Cost>
|
||||
<stdbandwidth>100</stdbandwidth>
|
||||
<stdAutoCostEnable>true</stdAutoCostEnable>
|
||||
<stdAutoCostEnableCompatible>true</stdAutoCostEnableCompatible>
|
||||
<isNetEntitys>
|
||||
<isNetEntity>
|
||||
<netEntity>netentity</netEntity>
|
||||
</isNetEntity>
|
||||
</isNetEntitys>
|
||||
<isSiteMTs>
|
||||
<isSiteMT>
|
||||
<addressFamily>afIpv4</addressFamily>
|
||||
<mtId>0</mtId>
|
||||
<bfdMinRx>100</bfdMinRx>
|
||||
<bfdMinTx>100</bfdMinTx>
|
||||
<bfdMultNum>10</bfdMultNum>
|
||||
<maxLoadBalancing>32</maxLoadBalancing>
|
||||
<isPreferences>
|
||||
<isPreference>
|
||||
<preferenceValue>100</preferenceValue>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
</isPreference>
|
||||
</isPreferences>
|
||||
<isNextHopWeights>
|
||||
<isNextHopWeight>
|
||||
<ipAddress>1.1.1.1</ipAddress>
|
||||
<weight>100</weight>
|
||||
</isNextHopWeight>
|
||||
</isNextHopWeights>
|
||||
<isFilterImports>
|
||||
<isFilterImport>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<policyType>level_1</policyType>
|
||||
</isFilterImport>
|
||||
</isFilterImports>
|
||||
<isFilterExports>
|
||||
<isFilterExport>
|
||||
<protocol>ospf</protocol>
|
||||
<processId>100</processId>
|
||||
<policyType>level_1</policyType>
|
||||
</isFilterExport>
|
||||
</isFilterExports>
|
||||
<isDefaultRoutes>
|
||||
<isDefaultRoute>
|
||||
<defaultMode>always</defaultMode>
|
||||
<routePolicyName>mode</routePolicyName>
|
||||
<cost>100</cost>
|
||||
<tag>100</tag>
|
||||
<levelType>level_1</levelType>
|
||||
<avoidLearning>true</avoidLearning>
|
||||
</isDefaultRoute>
|
||||
</isDefaultRoutes>
|
||||
<isImportRoutes>
|
||||
<isImportRoute>
|
||||
<protocol>import</protocol>
|
||||
<processId>100</processId>
|
||||
<costType>level_1</costType>
|
||||
<cost>100</cost>
|
||||
<tag>100</tag>
|
||||
<policyType>level_1</policyType>
|
||||
<routePolicyName>import</routePolicyName>
|
||||
<levelType>level_1</levelType>
|
||||
<inheritCost>100</inheritCost>
|
||||
<permitIbgp>true</permitIbgp>
|
||||
</isImportRoute>
|
||||
</isImportRoutes>
|
||||
<isLeakRouteLevel1ToLevel2s>
|
||||
<isLeakRouteLevel1ToLevel2>
|
||||
<tag>100</tag>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<leakEnableFlag>true</leakEnableFlag>
|
||||
<allowFilter>true</allowFilter>
|
||||
</isLeakRouteLevel1ToLevel2>
|
||||
</isLeakRouteLevel1ToLevel2s>
|
||||
<isLeakRouteLevel2ToLevel1s>
|
||||
<isLeakRouteLevel2ToLevel1>
|
||||
<tag>100</tag>
|
||||
<routePolicyName>route</routePolicyName>
|
||||
<aclNumOrName>3001</aclNumOrName>
|
||||
<ipPrefix>ip</ipPrefix>
|
||||
<allowFilter>true</allowFilter>
|
||||
</isLeakRouteLevel2ToLevel1>
|
||||
</isLeakRouteLevel2ToLevel1s>
|
||||
</isSiteMT>
|
||||
</isSiteMTs>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,10 +0,0 @@
|
|||
<data>
|
||||
<isiscomm>
|
||||
<isSites>
|
||||
<isSite>
|
||||
<instanceId>100</instanceId>
|
||||
<vpnName>_public_</vpnName>
|
||||
</isSite>
|
||||
</isSites>
|
||||
</isiscomm>
|
||||
</data>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<ifmtrunk xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<TrunkIfs>
|
||||
<TrunkIf>
|
||||
<ifName>Eth-Trunk10</ifName>
|
||||
<lacpTrunk>
|
||||
<isSupportPrmpt>false</isSupportPrmpt>
|
||||
<rcvTimeoutType>Fast</rcvTimeoutType>
|
||||
<fastTimeoutUserDefinedValue>3</fastTimeoutUserDefinedValue>
|
||||
<selectPortStd>Speed</selectPortStd>
|
||||
<promptDelay>30</promptDelay>
|
||||
<maxActiveNum>1</maxActiveNum>
|
||||
<collectMaxDelay>0</collectMaxDelay>
|
||||
<mixRateEnable>false</mixRateEnable>
|
||||
<dampStaFlapEn>false</dampStaFlapEn>
|
||||
<dampUnexpMacEn>false</dampUnexpMacEn>
|
||||
<trunkSysMac>11-22-33</trunkSysMac>
|
||||
<trunkPortIdExt>false</trunkPortIdExt>
|
||||
</lacpTrunk>
|
||||
</TrunkIf>
|
||||
</TrunkIfs>
|
||||
</ifmtrunk>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<ifmtrunk xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<TrunkIfs>
|
||||
<TrunkIf>
|
||||
<ifName>Eth-Trunk10</ifName>
|
||||
<lacpTrunk>
|
||||
<isSupportPrmpt>true</isSupportPrmpt>
|
||||
<rcvTimeoutType>Fast</rcvTimeoutType>
|
||||
<fastTimeoutUserDefinedValue>10</fastTimeoutUserDefinedValue>
|
||||
<selectPortStd>Speed</selectPortStd>
|
||||
<promptDelay>130</promptDelay>
|
||||
<maxActiveNum>13</maxActiveNum>
|
||||
<collectMaxDelay>12</collectMaxDelay>
|
||||
<mixRateEnable>true</mixRateEnable>
|
||||
<dampStaFlapEn>true</dampStaFlapEn>
|
||||
<dampUnexpMacEn>true</dampUnexpMacEn>
|
||||
<trunkSysMac>0000-1111-2222</trunkSysMac>
|
||||
<trunkPortIdExt>true</trunkPortIdExt>
|
||||
</lacpTrunk>
|
||||
</TrunkIf>
|
||||
</TrunkIfs>
|
||||
</ifmtrunk>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<ifmtrunk xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lacpSysInfo>
|
||||
<priority>32768</priority>
|
||||
</lacpSysInfo>
|
||||
</ifmtrunk>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<ifmtrunk xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lacpSysInfo>
|
||||
<priority>32769</priority>
|
||||
</lacpSysInfo>
|
||||
</ifmtrunk>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpSys>
|
||||
<lldpSysParameter>
|
||||
<messageTxInterval>30</messageTxInterval>
|
||||
<messageTxHoldMultiplier>4</messageTxHoldMultiplier>
|
||||
<reinitDelay>2</reinitDelay>
|
||||
<txDelay>2</txDelay>
|
||||
<notificationInterval>5</notificationInterval>
|
||||
<fastMessageCount>4</fastMessageCount>
|
||||
<mdnNotificationInterval>5</mdnNotificationInterval>
|
||||
<mdnNotificationEnable>disabled</mdnNotificationEnable>
|
||||
<configManAddr></configManAddr>
|
||||
<bindifName></bindifName>
|
||||
</lldpSysParameter>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpSys>
|
||||
<lldpSysParameter>
|
||||
<messageTxInterval>8</messageTxInterval>
|
||||
<messageTxHoldMultiplier>8</messageTxHoldMultiplier>
|
||||
<reinitDelay>8</reinitDelay>
|
||||
<txDelay>8</txDelay>
|
||||
<notificationInterval>8</notificationInterval>
|
||||
<fastMessageCount>8</fastMessageCount>
|
||||
<mdnNotificationInterval>8</mdnNotificationInterval>
|
||||
<mdnNotificationEnable>enabled</mdnNotificationEnable>
|
||||
<configManAddr>1.1.1.1</configManAddr>
|
||||
<bindifName>bind-name</bindifName>
|
||||
</lldpSysParameter>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpSys>
|
||||
<lldpEnable>disabled</lldpEnable>
|
||||
<mdnStatus>disabled</mdnStatus>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1024">
|
||||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpSys>
|
||||
<lldpEnable>enabled</lldpEnable>
|
||||
<mdnStatus>rxOnly</mdnStatus>
|
||||
</lldpSys>
|
||||
</lldp>
|
||||
</data>
|
||||
</rpc-reply>
|
|
@ -1,3 +0,0 @@
|
|||
<rpc-reply message-id="801" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" flow-id="98">
|
||||
<ok/>
|
||||
</rpc-reply>
|
|
@ -1,29 +0,0 @@
|
|||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpInterfaces>
|
||||
<lldpInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<lldpAdminStatus>txAndRx</lldpAdminStatus>
|
||||
<msgInterval operation="merge">
|
||||
<txInterval>8</txInterval>
|
||||
</msgInterval>
|
||||
<tlvTxEnable>
|
||||
<manAddrTxEnable>true</manAddrTxEnable>
|
||||
<portDescTxEnable>true</portDescTxEnable>
|
||||
<sysCapTxEnable>true</sysCapTxEnable>
|
||||
<sysDescTxEnable>true</sysDescTxEnable>
|
||||
<sysNameTxEnable>true</sysNameTxEnable>
|
||||
<portVlanTxEnable>true</portVlanTxEnable>
|
||||
<protoVlanTxEnable>true</protoVlanTxEnable>
|
||||
<txProtocolVlanId>112</txProtocolVlanId>
|
||||
<vlanNameTxEnable>true</vlanNameTxEnable>
|
||||
<txVlanNameId>32</txVlanNameId>
|
||||
<linkAggreTxEnable>true</linkAggreTxEnable>
|
||||
<macPhyTxEnable>true</macPhyTxEnable>
|
||||
<maxFrameTxEnable>true</maxFrameTxEnable>
|
||||
<eee>true</eee>
|
||||
</tlvTxEnable>
|
||||
</lldpInterface>
|
||||
</lldpInterfaces>
|
||||
</lldp>
|
||||
</data>
|
|
@ -1,29 +0,0 @@
|
|||
<data>
|
||||
<lldp xmlns="http://www.huawei.com/netconf/vrp" content-version="1.0" format-version="1.0">
|
||||
<lldpInterfaces>
|
||||
<lldpInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<lldpAdminStatus>txOnly</lldpAdminStatus>
|
||||
<msgInterval operation="merge">
|
||||
<txInterval>1</txInterval>
|
||||
</msgInterval>
|
||||
<tlvTxEnable>
|
||||
<manAddrTxEnable>false</manAddrTxEnable>
|
||||
<portDescTxEnable>false</portDescTxEnable>
|
||||
<sysCapTxEnable>false</sysCapTxEnable>
|
||||
<sysDescTxEnable>false</sysDescTxEnable>
|
||||
<sysNameTxEnable>false</sysNameTxEnable>
|
||||
<portVlanTxEnable>false</portVlanTxEnable>
|
||||
<protoVlanTxEnable>false</protoVlanTxEnable>
|
||||
<txProtocolVlanId></txProtocolVlanId>
|
||||
<vlanNameTxEnable>false</vlanNameTxEnable>
|
||||
<txVlanNameId></txVlanNameId>
|
||||
<linkAggreTxEnable>false</linkAggreTxEnable>
|
||||
<macPhyTxEnable>false</macPhyTxEnable>
|
||||
<maxFrameTxEnable>false</maxFrameTxEnable>
|
||||
<eee></eee>
|
||||
</tlvTxEnable>
|
||||
</lldpInterface>
|
||||
</lldpInterfaces>
|
||||
</lldp>
|
||||
</data>
|
|
@ -1,3 +0,0 @@
|
|||
<rpc-reply message-id="801" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" flow-id="98">
|
||||
<ok/>
|
||||
</rpc-reply>
|
|
@ -1,14 +0,0 @@
|
|||
<data>
|
||||
<lldp>
|
||||
<lldpSys>
|
||||
<lldpEnable>enabled</lldpEnable>
|
||||
<mdnStatus>enabled</mdnStatus>
|
||||
</lldpSys>
|
||||
<mdnInterfaces>
|
||||
<mdnInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<mdnStatus>rxOnly</mdnStatus>
|
||||
</mdnInterface>
|
||||
</mdnInterfaces>
|
||||
</lldp>
|
||||
</data>
|
|
@ -1,14 +0,0 @@
|
|||
<data>
|
||||
<lldp>
|
||||
<lldpSys>
|
||||
<lldpEnable>disabled</lldpEnable>
|
||||
<mdnStatus>disabled</mdnStatus>
|
||||
</lldpSys>
|
||||
<mdnInterfaces>
|
||||
<mdnInterface>
|
||||
<ifName>10GE1/0/1</ifName>
|
||||
<mdnStatus>disabled</mdnStatus>
|
||||
</mdnInterface>
|
||||
</mdnInterfaces>
|
||||
</lldp>
|
||||
</data>
|
|
@ -1,10 +0,0 @@
|
|||
<data>
|
||||
<mcastbase>
|
||||
<mcastAfsEnables>
|
||||
<mcastAfsEnable>
|
||||
<vrfName>vpna</vrfName>
|
||||
<addressFamily>ipv4unicast</addressFamily>
|
||||
</mcastAfsEnable>
|
||||
</mcastAfsEnables>
|
||||
</mcastbase>
|
||||
</data>
|
|
@ -1 +0,0 @@
|
|||
<data/>
|
|
@ -1,22 +0,0 @@
|
|||
<data>
|
||||
<l2mc >
|
||||
<l2McSnpgEnables>
|
||||
<l2McSnpgEnable>
|
||||
<addrFamily>ipv4unicast</addrFamily>
|
||||
<sendQueryEnable>false</sendQueryEnable>
|
||||
<sendQuerySrcIpAddr>192.168.0.1</sendQuerySrcIpAddr>
|
||||
</l2McSnpgEnable>
|
||||
</l2McSnpgEnables>
|
||||
<vlan>
|
||||
<l2McVlanCfgs>
|
||||
<l2McVlanCfg>
|
||||
<addrFamily>ipv4unicast</addrFamily>
|
||||
<vlanId>1</vlanId>
|
||||
<version>2</version>
|
||||
<snoopingEnable>true</snoopingEnable>
|
||||
<proxyEnable>true</proxyEnable>
|
||||
</l2McVlanCfg>
|
||||
</l2McVlanCfgs>
|
||||
</vlan>
|
||||
</l2mc>
|
||||
</data>
|
|
@ -1 +0,0 @@
|
|||
<data/>
|
|
@ -1,3 +0,0 @@
|
|||
<rpc-reply message-id="801" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" flow-id="98">
|
||||
<ok/>
|
||||
</rpc-reply>
|
|
@ -1,18 +0,0 @@
|
|||
<data>
|
||||
<staticrt xmlns="http://www.huawei.com/netconf/vrp" format-version="1.0" content-version="1.0">
|
||||
<staticrtbase>
|
||||
<srBfdParas>
|
||||
<srBfdPara>
|
||||
<afType>ipv4unicast</afType>
|
||||
<ifName>Ethernet3/0/0</ifName>
|
||||
<destVrfName>_public_</destVrfName>
|
||||
<nexthop>192.168.2.2</nexthop>
|
||||
<localAddress>192.168.2.1</localAddress>
|
||||
<minRxInterval>50</minRxInterval>
|
||||
<minTxInterval>50</minTxInterval>
|
||||
<multiplier>3</multiplier>
|
||||
</srBfdPara>
|
||||
</srBfdParas>
|
||||
</staticrtbase>
|
||||
</staticrt>
|
||||
</data>
|
|
@ -1,18 +0,0 @@
|
|||
<data>
|
||||
<staticrt xmlns="http://www.huawei.com/netconf/vrp" format-version="1.0" content-version="1.0">
|
||||
<staticrtbase>
|
||||
<srBfdParas>
|
||||
<srBfdPara>
|
||||
<afType>ipv4unicast</afType>
|
||||
<ifName>Ethernet3/0/0</ifName>
|
||||
<destVrfName>_public_</destVrfName>
|
||||
<nexthop>192.168.2.2</nexthop>
|
||||
<localAddress>192.168.2.1</localAddress>
|
||||
<minRxInterval>50</minRxInterval>
|
||||
<minTxInterval>50</minTxInterval>
|
||||
<multiplier>3</multiplier>
|
||||
</srBfdPara>
|
||||
</srBfdParas>
|
||||
</staticrtbase>
|
||||
</staticrt>
|
||||
</data>
|
|
@ -1,18 +0,0 @@
|
|||
<data>
|
||||
<staticrt xmlns="http://www.huawei.com/netconf/vrp" format-version="1.0" content-version="1.0">
|
||||
<staticrtbase>
|
||||
<srRoutes>
|
||||
<srRoute>
|
||||
<vrfName>_public_</vrfName>
|
||||
<afType>ipv4unicast</afType>
|
||||
<topologyName>base</topologyName>
|
||||
<prefix>192.168.20.0</prefix>
|
||||
<maskLength>24</maskLength>
|
||||
<ifName/>
|
||||
<destVrfName>_public_</destVrfName>
|
||||
<nexthop>189.88.252.1</nexthop>
|
||||
</srRoute>
|
||||
</srRoutes>
|
||||
</staticrtbase>
|
||||
</staticrt>
|
||||
</data>
|
|
@ -1,18 +0,0 @@
|
|||
<data>
|
||||
<staticrt xmlns="http://www.huawei.com/netconf/vrp" format-version="1.0" content-version="1.0">
|
||||
<staticrtbase>
|
||||
<srRoutes>
|
||||
<srRoute>
|
||||
<vrfName>_public_</vrfName>
|
||||
<afType>ipv4unicast</afType>
|
||||
<topologyName>base</topologyName>
|
||||
<prefix>192.168.20.0</prefix>
|
||||
<maskLength>24</maskLength>
|
||||
<ifName/>
|
||||
<destVrfName>_public_</destVrfName>
|
||||
<nexthop>189.88.252.1</nexthop>
|
||||
</srRoute>
|
||||
</srRoutes>
|
||||
</staticrtbase>
|
||||
</staticrt>
|
||||
</data>
|
|
@ -1,71 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_is_is_instance
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_is_is_instance
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_instance.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_instance.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_isis_instance_present(self):
|
||||
xml_existing = load_fixture('ce_is_is_instance', 'before.txt')
|
||||
xml_end_state = load_fixture('ce_is_is_instance', 'after.txt')
|
||||
update = ['isis 100', 'vpn-instance __public__']
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
vpn_name='__public__',
|
||||
state='present')
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_isis_instance_present(self):
|
||||
xml_existing = load_fixture('ce_is_is_instance', 'after.txt')
|
||||
xml_end_state = load_fixture('ce_is_is_instance', 'before.txt')
|
||||
update = ['undo isis 100']
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
vpn_name='__public__',
|
||||
state='absent')
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
|
@ -1,100 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_is_is_interface
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_is_is_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_interface.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_interface.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
|
||||
self.before = load_fixture('ce_is_is_interface', 'before_interface.txt')
|
||||
self.after = load_fixture('ce_is_is_interface', 'after_interface.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_isis_interface_present(self):
|
||||
update = ['interface 10GE1/0/1',
|
||||
'isis enable 100',
|
||||
'isis circuit-level level-1',
|
||||
'isis dis-priority 10 level-1',
|
||||
'isis ppp-negotiation 2-way',
|
||||
'isis cost 10 level-2']
|
||||
self.get_nc_config.side_effect = (self.before, self.after)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
ifname='10GE1/0/1',
|
||||
leveltype='level_1',
|
||||
level1dispriority=10,
|
||||
silentenable=True,
|
||||
silentcost=True,
|
||||
typep2penable=True,
|
||||
snpacheck=True,
|
||||
p2pnegotiationmode='2_way',
|
||||
p2ppeeripignore=True,
|
||||
ppposicpcheckenable=True,
|
||||
level2cost=10
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
print(result['updates'])
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_isis_interface_absent(self):
|
||||
update = ['interface 10GE1/0/1',
|
||||
'undo isis enable',
|
||||
'undo isis circuit-level',
|
||||
'undo isis ppp-negotiation']
|
||||
self.get_nc_config.side_effect = (self.after, self.before)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
ifname='10GE1/0/1',
|
||||
leveltype='level_1',
|
||||
level1dispriority=10,
|
||||
silentenable=True,
|
||||
silentcost=True,
|
||||
typep2penable=True,
|
||||
snpacheck=True,
|
||||
p2pnegotiationmode='2_way',
|
||||
p2ppeeripignore=True,
|
||||
ppposicpcheckenable=True,
|
||||
level2cost=10,
|
||||
state='absent'
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
|
@ -1,248 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_is_is_view
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_is_is_view
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_view.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_is_is_view.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
|
||||
self.before = load_fixture('ce_is_is_view', 'before.txt')
|
||||
self.after = load_fixture('ce_is_is_view', 'after.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_ce_is_is_view_absent(self):
|
||||
self.get_nc_config.side_effect = (self.after, self.before)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10,
|
||||
state='absent'
|
||||
)
|
||||
set_module_args(config)
|
||||
self.execute_module(changed=True)
|
||||
|
||||
def test_ce_is_is_view_present(self):
|
||||
self.get_nc_config.side_effect = (self.before, self.after)
|
||||
update = ['isis 100',
|
||||
'description ISIS',
|
||||
'is-level level_1',
|
||||
'cost-style narrow',
|
||||
'circuit-cost 60 level-2',
|
||||
'bandwidth-reference 100',
|
||||
'network-entity netentity',
|
||||
'preference 100 route-policy route',
|
||||
'maximum load-balancing 32',
|
||||
'nexthop 1.1.1.1 weight 100',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'undo import-route isis level-1 into level-2 disable',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'bfd all-interfaces enable',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'filter-policy ip-prefix export route-policy export export ospf 100',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'filter-policy acl-name acl route-policy importimport',
|
||||
'filter-policy ip-prefix export route-policy export export ospf 100',
|
||||
'bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 10',
|
||||
'import-route ospf 100 inherit-cost cost-type external cost 100 tag 100 route-policy import level-1',
|
||||
'default-route-advertise always cost 100 tag 100 level-1 avoid-learning',
|
||||
'import-route isis level-2 into level-1 filter-policy route-policy import tag 100 direct allow-filter-policy allow-up-down-bit',
|
||||
'preference 100 route-policy route',
|
||||
'auto-cost enable',
|
||||
'auto-cost enable compatible']
|
||||
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_ce_is_is_view_no_changed(self):
|
||||
self.get_nc_config.side_effect = (self.after, self.after)
|
||||
config = dict(
|
||||
instance_id=100,
|
||||
description='ISIS',
|
||||
islevel='level_1',
|
||||
coststyle='narrow',
|
||||
stdlevel2cost=60,
|
||||
stdbandwidth=100,
|
||||
autocostenable=True,
|
||||
autocostenablecompatible=True,
|
||||
netentity='netentity',
|
||||
preference_value=100,
|
||||
route_policy_name='route',
|
||||
max_load=32,
|
||||
ip_address='1.1.1.1',
|
||||
weight=100,
|
||||
penetration_direct='level2-level1',
|
||||
import_routepolicy_name='import',
|
||||
tag=100,
|
||||
allow_filter=True,
|
||||
allow_up_down=True,
|
||||
enablelevel1tolevel2=True,
|
||||
defaultmode='always',
|
||||
mode_routepolicyname='mode',
|
||||
cost=100,
|
||||
mode_tag=100,
|
||||
level_type='level_1',
|
||||
avoid_learning=True,
|
||||
protocol='ospf',
|
||||
processid=100,
|
||||
cost_type='external',
|
||||
import_cost=100,
|
||||
import_tag=100,
|
||||
import_route_policy='import',
|
||||
impotr_leveltype='level_1',
|
||||
inheritcost=True,
|
||||
permitibgp=True,
|
||||
export_protocol='ospf',
|
||||
export_policytype='aclNumOrName',
|
||||
export_processid=100,
|
||||
export_ipprefix='export',
|
||||
export_routepolicyname='export',
|
||||
import_aclnumorname='acl',
|
||||
import_routepolicyname='import',
|
||||
bfd_min_rx=100,
|
||||
bfd_min_tx=100,
|
||||
bfd_multiplier_num=10
|
||||
)
|
||||
set_module_args(config)
|
||||
self.execute_module(changed=False)
|
|
@ -1,134 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_lacp
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
from .ce_module import TestCloudEngineModule, load_fixture
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_lacp
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lacp.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lacp.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_lacp_eturnk_present(self):
|
||||
xml_existing = load_fixture('ce_lacp', 'ce_lacp_00.txt')
|
||||
xml_end_state = load_fixture('ce_lacp', 'ce_lacp_01.txt')
|
||||
update = ['lacp max active-linknumber 13',
|
||||
'lacp dampening state-flapping',
|
||||
'lacp port-id-extension enable',
|
||||
'lacp collector delay 12',
|
||||
'lacp preempt enable',
|
||||
'lacp system-id 0000-1111-2222',
|
||||
'lacp mixed-rate link enable',
|
||||
'lacp preempt delay 130',
|
||||
'lacp timeout user-defined 10',
|
||||
'lacp dampening unexpected-mac disable']
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
set_module_args(dict(
|
||||
mode='Dynamic',
|
||||
trunk_id='10',
|
||||
preempt_enable='true',
|
||||
state_flapping='true',
|
||||
port_id_extension_enable='true',
|
||||
unexpected_mac_disable='true',
|
||||
system_id='0000-1111-2222',
|
||||
timeout_type='Fast',
|
||||
fast_timeout='10',
|
||||
mixed_rate_link_enable='true',
|
||||
preempt_delay=11,
|
||||
collector_delay=12,
|
||||
max_active_linknumber=13,
|
||||
select='Speed',
|
||||
state='present'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_lacp_eturnk_absent(self):
|
||||
xml_existing = load_fixture('ce_lacp', 'ce_lacp_10.txt')
|
||||
xml_end_state = load_fixture('ce_lacp', 'ce_lacp_00.txt')
|
||||
default_values = ['undo lacp priority',
|
||||
'lacp timeout Fast',
|
||||
'lacp max active-linknumber 1',
|
||||
'lacp collector delay 0',
|
||||
'lacp preempt enable false',
|
||||
'lacp dampening state-flapping false',
|
||||
'lacp dampening unexpected-mac disable false',
|
||||
'lacp mixed-rate link enable false',
|
||||
'lacp port-id-extension enable false',
|
||||
'lacp preempt delay 30',
|
||||
'lacp select Speed',
|
||||
'lacp system-id 11-22-33',
|
||||
'lacp timeout user-defined 3']
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
set_module_args(dict(
|
||||
mode='Dynamic',
|
||||
trunk_id='10',
|
||||
preempt_enable='true',
|
||||
state_flapping='true',
|
||||
port_id_extension_enable='true',
|
||||
unexpected_mac_disable='true',
|
||||
system_id='0000-1111-2222',
|
||||
timeout_type='Fast',
|
||||
fast_timeout='10',
|
||||
mixed_rate_link_enable='true',
|
||||
preempt_delay=11,
|
||||
collector_delay=12,
|
||||
max_active_linknumber=13,
|
||||
select='Speed',
|
||||
state='absent'
|
||||
))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['updates']), sorted(default_values))
|
||||
|
||||
def test_lacp_global_present(self):
|
||||
xml_existing = load_fixture('ce_lacp', 'ce_lacp_10.txt')
|
||||
xml_end_state = load_fixture('ce_lacp', 'ce_lacp_11.txt')
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
set_module_args(dict(global_priority=32769,
|
||||
state='present'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['updates'], ['lacp priority 32769'])
|
||||
|
||||
def test_lacp_global_absent(self):
|
||||
xml_existing = load_fixture('ce_lacp', 'ce_lacp_11.txt')
|
||||
xml_end_state = load_fixture('ce_lacp', 'ce_lacp_10.txt')
|
||||
self.get_nc_config.side_effect = (xml_existing, xml_end_state)
|
||||
set_module_args(dict(global_priority=32769,
|
||||
state='absent'))
|
||||
result = self.execute_module(changed=True)
|
||||
# excpect: lacp priority is set to default value(32768)
|
||||
self.assertEqual(result['updates'], ['lacp priority 32768'])
|
|
@ -1,113 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_lldp
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_lldp
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lldp.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lldp.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = None
|
||||
xml_existing_1 = load_fixture('ce_lldp', 'ce_lldp_global_00.txt')
|
||||
xml_existing_2 = load_fixture('ce_lldp', 'ce_lldp_global_01.txt')
|
||||
xml_end_state_1 = load_fixture('ce_lldp', 'ce_lldpSysParameter_00.txt')
|
||||
xml_end_state_2 = load_fixture('ce_lldp', 'ce_lldpSysParameter_01.txt')
|
||||
self.get_side_effect = (xml_existing_1, xml_existing_2, xml_end_state_1, xml_end_state_2)
|
||||
self.result_ok = load_fixture('ce_lldp', 'result_ok.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_lldp_global_present(self):
|
||||
update = ['lldp enable',
|
||||
'lldp mdn enable',
|
||||
'lldp mdn enable',
|
||||
'lldp transmit interval 8',
|
||||
'lldp transmit multiplier 8',
|
||||
'lldp restart 8',
|
||||
'lldp transmit delay 8',
|
||||
'lldp trap-interval 8',
|
||||
'lldp fast-count 8',
|
||||
'lldp mdn trap-interval 8',
|
||||
'lldp management-address 1.1.1.1',
|
||||
'lldp management-address bind interface bind-name']
|
||||
self.get_nc_config.side_effect = self.get_side_effect
|
||||
self.set_nc_config.side_effect = [self.result_ok] * 11
|
||||
set_module_args(dict(
|
||||
lldpenable='enabled',
|
||||
mdnstatus='rxOnly',
|
||||
interval=8,
|
||||
hold_multiplier=8,
|
||||
restart_delay=8,
|
||||
transmit_delay=8,
|
||||
notification_interval=8,
|
||||
fast_count=8,
|
||||
mdn_notification_interval=8,
|
||||
management_address='1.1.1.1',
|
||||
bind_name='bind-name')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_lacp_sys_parameter_present(self):
|
||||
update = ['lldp enable',
|
||||
'lldp mdn enable',
|
||||
'lldp mdn enable',
|
||||
'lldp transmit interval 8',
|
||||
'lldp transmit multiplier 8',
|
||||
'lldp restart 8',
|
||||
'lldp transmit delay 8',
|
||||
'lldp trap-interval 8',
|
||||
'lldp fast-count 8',
|
||||
'lldp mdn trap-interval 8',
|
||||
'lldp management-address 1.1.1.1',
|
||||
'lldp management-address bind interface bind-name']
|
||||
self.get_nc_config.side_effect = self.get_side_effect
|
||||
self.set_nc_config.side_effect = [self.result_ok] * 11
|
||||
set_module_args(dict(
|
||||
lldpenable='enabled',
|
||||
mdnstatus='rxOnly',
|
||||
interval=8,
|
||||
hold_multiplier=8,
|
||||
restart_delay=8,
|
||||
transmit_delay=8,
|
||||
notification_interval=8,
|
||||
fast_count=8,
|
||||
mdn_notification_interval=8,
|
||||
management_address='1.1.1.1',
|
||||
bind_name='bind-name')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['updates']), sorted(update))
|
|
@ -1,111 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_lldp_interface
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_lldp_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
# self.mock_get_config = patch('ansible.modules.network.cloudengine.ce_lldp.get_nc_config')
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lldp_interface.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_nc_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_lldp_interface.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_nc_config.start()
|
||||
self.xml_absent = load_fixture('ce_lldp_interface', 'lldp_interface_existing.txt')
|
||||
self.xml_present = load_fixture('ce_lldp_interface', 'lldp_interface_changed.txt')
|
||||
self.result_ok = load_fixture('ce_lldp_interface', 'result_ok.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_nc_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_lldp_present(self):
|
||||
self.get_nc_config.side_effect = (self.xml_absent, self.xml_present) * 5
|
||||
self.set_nc_config.return_value = self.result_ok
|
||||
config = dict(
|
||||
lldpenable='enabled',
|
||||
function_lldp_interface_flag='disableINTERFACE',
|
||||
type_tlv_disable='basic_tlv',
|
||||
type_tlv_enable='dot1_tlv',
|
||||
ifname='10GE1/0/1',
|
||||
lldpadminstatus='txOnly',
|
||||
manaddrtxenable=True,
|
||||
portdesctxenable=True,
|
||||
syscaptxenable=True,
|
||||
sysdesctxenable=True,
|
||||
sysnametxenable=True,
|
||||
portvlantxenable=True,
|
||||
protovlantxenable=True,
|
||||
txprotocolvlanid=True,
|
||||
vlannametxenable=True,
|
||||
txvlannameid=8,
|
||||
txinterval=8,
|
||||
protoidtxenable=True,
|
||||
macphytxenable=True,
|
||||
linkaggretxenable=True,
|
||||
maxframetxenable=True,
|
||||
eee=True,
|
||||
dcbx=True
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
|
||||
def test_lldp_absent(self):
|
||||
self.get_nc_config.side_effect = (self.xml_present, self.xml_present, self.xml_absent, self.xml_absent)
|
||||
self.set_nc_config.return_value = self.result_ok
|
||||
config = dict(
|
||||
lldpenable='enabled',
|
||||
function_lldp_interface_flag='disableINTERFACE',
|
||||
type_tlv_disable='basic_tlv',
|
||||
type_tlv_enable='dot1_tlv',
|
||||
ifname='10GE1/0/1',
|
||||
lldpadminstatus='txOnly',
|
||||
manaddrtxenable=False,
|
||||
portdesctxenable=False,
|
||||
syscaptxenable=False,
|
||||
sysdesctxenable=False,
|
||||
sysnametxenable=False,
|
||||
portvlantxenable=False,
|
||||
protovlantxenable=False,
|
||||
txprotocolvlanid=False,
|
||||
vlannametxenable=False,
|
||||
txvlannameid=18,
|
||||
txinterval=18,
|
||||
protoidtxenable=False,
|
||||
macphytxenable=False,
|
||||
linkaggretxenable=False,
|
||||
maxframetxenable=False,
|
||||
eee=False,
|
||||
dcbx=False,
|
||||
state='absent'
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=False)
|
|
@ -1,67 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_mdn_interface
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_mdn_interface
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_mdn_interface.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_mdn_interface.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = "<ok/>"
|
||||
self.before = load_fixture('ce_mdn_interface', 'before.txt')
|
||||
self.after = load_fixture('ce_mdn_interface', 'after.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_mdn_enable(self):
|
||||
update = [['lldp enable', 'interface 10GE1/0/1', 'lldp mdn enable']]
|
||||
self.get_nc_config.side_effect = (self.before, self.before, self.after, self.after)
|
||||
set_module_args(dict(
|
||||
lldpenable='enabled',
|
||||
mdnstatus='rxOnly',
|
||||
ifname='10GE1/0/1')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_repeat_enable(self):
|
||||
self.get_nc_config.side_effect = (self.after, self.after, self.after, self.after, )
|
||||
set_module_args(dict(
|
||||
lldpenable='enabled',
|
||||
mdnstatus='rxOnly',
|
||||
ifname='10GE1/0/1')
|
||||
)
|
||||
self.execute_module(changed=False)
|
|
@ -1,69 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_multicast_global
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_multicast_global
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_multicast_global.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_multicast_global.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = "<ok/>"
|
||||
self.before = load_fixture('ce_multicast_global', 'before.txt')
|
||||
self.after = load_fixture('ce_multicast_global', 'after.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_multicast_enable(self):
|
||||
update = ['multicast routing-enable']
|
||||
self.get_nc_config.side_effect = (self.before, self.after)
|
||||
set_module_args(dict(
|
||||
aftype='v4',
|
||||
vrf='vpna',
|
||||
state='present')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_multicast_undo_enable(self):
|
||||
update = ['undo multicast routing-enable']
|
||||
self.get_nc_config.side_effect = (self.after, self.before)
|
||||
set_module_args(dict(
|
||||
aftype='v4',
|
||||
vrf='vpna',
|
||||
state='absent')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
|
@ -1,80 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_multicast_igmp_enable
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_multicast_igmp_enable
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_multicast_igmp_enable.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_multicast_igmp_enable.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = "<ok/>"
|
||||
self.before = load_fixture('ce_multicast_igmp_enable', 'before.txt')
|
||||
self.after = load_fixture('ce_multicast_igmp_enable', 'after.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_igmp_enable(self):
|
||||
update = ['igmp snooping enable',
|
||||
'igmp snooping version 2',
|
||||
'igmp snooping proxy']
|
||||
self.get_nc_config.side_effect = (self.before, self.after)
|
||||
set_module_args(dict(
|
||||
aftype='v4',
|
||||
features='vlan',
|
||||
vlan_id=1,
|
||||
igmp=True,
|
||||
version=2,
|
||||
proxy=True)
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
||||
|
||||
def test_igmp_undo_enable(self):
|
||||
update = ['undo igmp snooping enable',
|
||||
'undo igmp snooping version',
|
||||
'undo igmp snooping proxy']
|
||||
self.get_nc_config.side_effect = (self.after, self.before)
|
||||
set_module_args(dict(
|
||||
aftype='v4',
|
||||
features='vlan',
|
||||
vlan_id=1,
|
||||
igmp=True,
|
||||
version=2,
|
||||
proxy=True,
|
||||
state='absent')
|
||||
)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEquals(sorted(result['updates']), sorted(update))
|
|
@ -1,102 +0,0 @@
|
|||
# (c) 2019 Red Hat Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudengine import ce_static_route_bfd
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.network.cloudengine.ce_module import TestCloudEngineModule, load_fixture
|
||||
from ansible_collections.community.general.tests.unit.plugins.modules.utils import set_module_args
|
||||
|
||||
|
||||
class TestCloudEngineLacpModule(TestCloudEngineModule):
|
||||
module = ce_static_route_bfd
|
||||
|
||||
def setUp(self):
|
||||
super(TestCloudEngineLacpModule, self).setUp()
|
||||
|
||||
self.mock_get_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_static_route_bfd.get_nc_config')
|
||||
self.get_nc_config = self.mock_get_config.start()
|
||||
|
||||
self.mock_set_config = patch('ansible_collections.community.general.plugins.modules.network.cloudengine.ce_static_route_bfd.set_nc_config')
|
||||
self.set_nc_config = self.mock_set_config.start()
|
||||
self.set_nc_config.return_value = load_fixture('ce_lldp', 'result_ok.txt')
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCloudEngineLacpModule, self).tearDown()
|
||||
self.mock_set_config.stop()
|
||||
self.mock_get_config.stop()
|
||||
|
||||
def test_ce_static_route_bfd_changed_false(self):
|
||||
srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
|
||||
staticrtbase_1 = load_fixture('ce_static_route_bfd', 'staticrtbase_1.txt')
|
||||
self.get_nc_config.side_effect = (srBfdPara_1, srBfdPara_1, staticrtbase_1, staticrtbase_1)
|
||||
|
||||
config = dict(
|
||||
prefix='255.255.0.0',
|
||||
mask=22,
|
||||
aftype='v4',
|
||||
next_hop='10.10.1.1',
|
||||
nhp_interface='10GE1/0/1',
|
||||
vrf='mgnt',
|
||||
destvrf='_public_',
|
||||
tag=23,
|
||||
description='for a test',
|
||||
pref='22',
|
||||
function_flag='dynamicBFD',
|
||||
min_tx_interval='32',
|
||||
min_rx_interval='23',
|
||||
detect_multiplier='24',
|
||||
bfd_session_name='43'
|
||||
)
|
||||
set_module_args(config)
|
||||
self.execute_module(changed=False)
|
||||
|
||||
def test_ce_static_route_bfd_changed_true(self):
|
||||
srBfdPara_1 = load_fixture('ce_static_route_bfd', 'srBfdPara_1.txt')
|
||||
srBfdPara_2 = load_fixture('ce_static_route_bfd', 'srBfdPara_2.txt')
|
||||
staticrtbase_1 = load_fixture('ce_static_route_bfd', 'staticrtbase_1.txt')
|
||||
staticrtbase_2 = load_fixture('ce_static_route_bfd', 'staticrtbase_2.txt')
|
||||
self.get_nc_config.side_effect = (srBfdPara_1, staticrtbase_1, srBfdPara_2, staticrtbase_2)
|
||||
updates = ['ip route-static vpn-instance mgnt 255.255.0.0 255.255.252.0 10GE1/0/1 10.10.1.1',
|
||||
' preference 22',
|
||||
' tag 23',
|
||||
' track bfd-session 43',
|
||||
' description for a test']
|
||||
config = dict(
|
||||
prefix='255.255.0.0',
|
||||
mask=22,
|
||||
aftype='v4',
|
||||
next_hop='10.10.1.1',
|
||||
nhp_interface='10GE1/0/1',
|
||||
vrf='mgnt',
|
||||
destvrf='_public_',
|
||||
tag=23,
|
||||
description='for a test',
|
||||
pref='22',
|
||||
function_flag='dynamicBFD',
|
||||
min_tx_interval='32',
|
||||
min_rx_interval='23',
|
||||
detect_multiplier='24',
|
||||
bfd_session_name='43'
|
||||
)
|
||||
set_module_args(config)
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(sorted(result['updates']), sorted(updates))
|
|
@ -1,886 +0,0 @@
|
|||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat import unittest
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch, Mock
|
||||
import sys
|
||||
sys.modules['cvprac'] = Mock()
|
||||
sys.modules['cvprac.cvp_client'] = Mock()
|
||||
sys.modules['cvprac.cvp_client_errors'] = Mock()
|
||||
from ansible_collections.community.general.plugins.modules.network.cloudvision import cv_server_provision
|
||||
|
||||
|
||||
class MockException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class TestCvServerProvision(unittest.TestCase):
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpApiError',
|
||||
new_callable=lambda: MockException)
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_module_args(self, mock_module, mock_connect, mock_info,
|
||||
mock_comp, mock_server_conf, mock_exception):
|
||||
''' Test main module args.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='show', switch_name='eos')
|
||||
mock_module_object.fail_json.side_effect = SystemExit('Exiting')
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_connect.return_value = 'Client'
|
||||
mock_info.side_effect = mock_exception('Error Getting Info')
|
||||
argument_spec = dict(
|
||||
host=dict(required=True),
|
||||
port=dict(required=False, default=None),
|
||||
protocol=dict(default='https', choices=['http', 'https']),
|
||||
username=dict(required=True),
|
||||
password=dict(required=True, no_log=True),
|
||||
server_name=dict(required=True),
|
||||
switch_name=dict(required=True),
|
||||
switch_port=dict(required=True),
|
||||
port_vlan=dict(required=False, default=None),
|
||||
template=dict(require=True),
|
||||
action=dict(default='show', choices=['show', 'add', 'remove']),
|
||||
auto_run=dict(type='bool', default=False),
|
||||
)
|
||||
self.assertRaises(SystemExit, cv_server_provision.main)
|
||||
mock_module.assert_called_with(argument_spec=argument_spec,
|
||||
supports_check_mode=False)
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
mock_comp.assert_not_called()
|
||||
mock_server_conf.assert_not_called()
|
||||
mock_module_object.fail_json.assert_called_with(msg='Error Getting Info')
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpApiError',
|
||||
new_callable=lambda: MockException)
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_no_switch_configlet(self, mock_module, mock_connect,
|
||||
mock_info, mock_comp, mock_server_conf,
|
||||
mock_exception):
|
||||
''' Test main fails if switch has no configlet for Ansible to edit.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='add', switch_name='eos')
|
||||
mock_module_object.fail_json.side_effect = SystemExit('Exiting')
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_connect.return_value = 'Client'
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = None
|
||||
self.assertRaises(SystemExit, cv_server_provision.main)
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
self.assertEqual(mock_comp.call_count, 1)
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
mock_module_object.fail_json.assert_called_with(
|
||||
msg='Switch eos has no configurable server ports.')
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpApiError',
|
||||
new_callable=lambda: MockException)
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.port_configurable')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_port_not_in_config(self, mock_module, mock_connect, mock_info,
|
||||
mock_comp, mock_server_conf,
|
||||
mock_port_conf, mock_exception):
|
||||
''' Test main fails if user specified port not in configlet.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='add', switch_name='eos',
|
||||
switch_port='3')
|
||||
mock_module_object.fail_json.side_effect = SystemExit('Exiting')
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_connect.return_value = 'Client'
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = 'Configlet'
|
||||
mock_port_conf.return_value = None
|
||||
self.assertRaises(SystemExit, cv_server_provision.main)
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
self.assertEqual(mock_comp.call_count, 1)
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
self.assertEqual(mock_port_conf.call_count, 1)
|
||||
mock_module_object.fail_json.assert_called_with(
|
||||
msg='Port 3 is not configurable as a server port on switch eos.')
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_action')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.port_configurable')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_show(self, mock_module, mock_connect, mock_info, mock_comp,
|
||||
mock_server_conf, mock_port_conf, mock_conf_action):
|
||||
''' Test main good with show action.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='show', switch_name='eos',
|
||||
switch_port='3', auto_run=False)
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_connect.return_value = 'Client'
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = 'Configlet'
|
||||
mock_port_conf.return_value = 'Port'
|
||||
mock_conf_action.return_value = dict()
|
||||
cv_server_provision.main()
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
mock_comp.assert_not_called()
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
self.assertEqual(mock_port_conf.call_count, 1)
|
||||
self.assertEqual(mock_conf_action.call_count, 1)
|
||||
mock_module_object.fail_json.assert_not_called()
|
||||
return_dict = dict(changed=False, switchInfo='Info',
|
||||
switchConfigurable=True, portConfigurable=True,
|
||||
taskCreated=False, taskExecuted=False,
|
||||
taskCompleted=False)
|
||||
mock_module_object.exit_json.assert_called_with(**return_dict)
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_action')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.port_configurable')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_add_no_auto_run(self, mock_module, mock_connect, mock_info,
|
||||
mock_comp, mock_server_conf, mock_port_conf,
|
||||
mock_conf_action):
|
||||
''' Test main good with add action and no auto_run.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='add', switch_name='eos',
|
||||
switch_port='3', auto_run=False)
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_connect.return_value = 'Client'
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = 'Configlet'
|
||||
mock_port_conf.return_value = 'Port'
|
||||
mock_conf_action.return_value = dict(taskCreated=True)
|
||||
cv_server_provision.main()
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
self.assertEqual(mock_comp.call_count, 1)
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
self.assertEqual(mock_port_conf.call_count, 1)
|
||||
self.assertEqual(mock_conf_action.call_count, 1)
|
||||
mock_module_object.fail_json.assert_not_called()
|
||||
return_dict = dict(changed=False, switchInfo='Info',
|
||||
switchConfigurable=True, portConfigurable=True,
|
||||
taskCreated=True, taskExecuted=False,
|
||||
taskCompleted=False)
|
||||
mock_module_object.exit_json.assert_called_with(**return_dict)
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.wait_for_task_completion')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_update_task')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_action')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.port_configurable')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_add_auto_run(self, mock_module, mock_connect, mock_info,
|
||||
mock_comp, mock_server_conf, mock_port_conf,
|
||||
mock_conf_action, mock_conf_task, mock_wait):
|
||||
''' Test main good with add and auto_run. Config updated, task created.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='add', switch_name='eos',
|
||||
switch_port='3', auto_run=True)
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_client_object = Mock()
|
||||
mock_connect.return_value = mock_client_object
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = 'Configlet'
|
||||
mock_port_conf.return_value = 'Port'
|
||||
mock_conf_action.return_value = dict(taskCreated=True, changed=True)
|
||||
mock_conf_task.return_value = '7'
|
||||
mock_wait.return_value = True
|
||||
cv_server_provision.main()
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
self.assertEqual(mock_comp.call_count, 1)
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
self.assertEqual(mock_port_conf.call_count, 1)
|
||||
self.assertEqual(mock_conf_action.call_count, 1)
|
||||
self.assertEqual(mock_conf_task.call_count, 1)
|
||||
self.assertEqual(mock_wait.call_count, 1)
|
||||
mock_module_object.fail_json.assert_not_called()
|
||||
return_dict = dict(changed=True, switchInfo='Info', taskId='7',
|
||||
switchConfigurable=True, portConfigurable=True,
|
||||
taskCreated=True, taskExecuted=True,
|
||||
taskCompleted=True)
|
||||
mock_module_object.exit_json.assert_called_with(**return_dict)
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.wait_for_task_completion')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_update_task')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.configlet_action')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.port_configurable')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.server_configurable_configlet')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_in_compliance')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.connect')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.AnsibleModule')
|
||||
def test_main_add_auto_run_no_task(self, mock_module, mock_connect,
|
||||
mock_info, mock_comp, mock_server_conf,
|
||||
mock_port_conf, mock_conf_action, mock_conf_task,
|
||||
mock_wait):
|
||||
''' Test main good with add and auto_run. Config not updated, no task.
|
||||
'''
|
||||
mock_module_object = Mock()
|
||||
mock_module_object.params = dict(action='add', switch_name='eos',
|
||||
switch_port='3', auto_run=True)
|
||||
mock_module.return_value = mock_module_object
|
||||
mock_client_object = Mock()
|
||||
mock_connect.return_value = mock_client_object
|
||||
mock_info.return_value = 'Info'
|
||||
mock_server_conf.return_value = 'Configlet'
|
||||
mock_port_conf.return_value = 'Port'
|
||||
mock_conf_action.return_value = dict(taskCreated=True, changed=False)
|
||||
mock_conf_task.return_value = None
|
||||
cv_server_provision.main()
|
||||
self.assertEqual(mock_connect.call_count, 1)
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
self.assertEqual(mock_comp.call_count, 1)
|
||||
self.assertEqual(mock_server_conf.call_count, 1)
|
||||
self.assertEqual(mock_port_conf.call_count, 1)
|
||||
self.assertEqual(mock_conf_action.call_count, 1)
|
||||
self.assertEqual(mock_conf_task.call_count, 1)
|
||||
mock_wait.assert_not_called()
|
||||
mock_module_object.fail_json.assert_not_called()
|
||||
return_dict = dict(changed=False, switchInfo='Info',
|
||||
switchConfigurable=True, portConfigurable=True,
|
||||
taskCreated=False, taskExecuted=False,
|
||||
taskCompleted=False)
|
||||
mock_module_object.exit_json.assert_called_with(**return_dict)
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpClient')
|
||||
def test_connect_good(self, mock_client):
|
||||
''' Test connect success.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(host='host', username='username',
|
||||
password='password', protocol='https', port='10')
|
||||
connect_mock = Mock()
|
||||
mock_client.return_value = connect_mock
|
||||
client = cv_server_provision.connect(module)
|
||||
self.assertIsInstance(client, Mock)
|
||||
self.assertEqual(mock_client.call_count, 1)
|
||||
connect_mock.connect.assert_called_once_with(['host'], 'username',
|
||||
'password', port='10',
|
||||
protocol='https')
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpLoginError',
|
||||
new_callable=lambda: MockException)
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.CvpClient')
|
||||
def test_connect_fail(self, mock_client, mock_exception):
|
||||
''' Test connect failure with login error.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(host='host', username='username',
|
||||
password='password', protocol='https', port='10')
|
||||
module.fail_json.side_effect = SystemExit
|
||||
connect_mock = Mock()
|
||||
connect_mock.connect.side_effect = mock_exception('Login Error')
|
||||
mock_client.return_value = connect_mock
|
||||
self.assertRaises(SystemExit, cv_server_provision.connect, module)
|
||||
self.assertEqual(connect_mock.connect.call_count, 1)
|
||||
module.fail_json.assert_called_once_with(msg='Login Error')
|
||||
|
||||
def test_switch_info_good(self):
|
||||
''' Test switch_info success.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos')
|
||||
module.client.api.get_device_by_name.return_value = dict(fqdn='eos')
|
||||
info = cv_server_provision.switch_info(module)
|
||||
self.assertEqual(module.client.api.get_device_by_name.call_count, 1)
|
||||
self.assertEqual(info['fqdn'], 'eos')
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
def test_switch_info_no_switch(self):
|
||||
''' Test switch_info fails.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos')
|
||||
module.client.api.get_device_by_name.return_value = None
|
||||
info = cv_server_provision.switch_info(module)
|
||||
self.assertEqual(module.client.api.get_device_by_name.call_count, 1)
|
||||
self.assertEqual(info, None)
|
||||
module.fail_json.assert_called_once_with(
|
||||
msg="Device with name 'eos' does not exist.")
|
||||
|
||||
def test_switch_in_compliance_good(self):
|
||||
''' Test switch_in_compliance good.
|
||||
'''
|
||||
module = Mock()
|
||||
module.client.api.check_compliance.return_value = dict(
|
||||
complianceCode='0000')
|
||||
sw_info = dict(key='key', type='type', fqdn='eos')
|
||||
cv_server_provision.switch_in_compliance(module, sw_info)
|
||||
self.assertEqual(module.client.api.check_compliance.call_count, 1)
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
def test_switch_in_compliance_fail(self):
|
||||
''' Test switch_in_compliance fail.
|
||||
'''
|
||||
module = Mock()
|
||||
module.client.api.check_compliance.return_value = dict(
|
||||
complianceCode='0001')
|
||||
sw_info = dict(key='key', type='type', fqdn='eos')
|
||||
cv_server_provision.switch_in_compliance(module, sw_info)
|
||||
self.assertEqual(module.client.api.check_compliance.call_count, 1)
|
||||
module.fail_json.assert_called_with(
|
||||
msg='Switch eos is not in compliance.'
|
||||
' Returned compliance code 0001.')
|
||||
|
||||
def test_server_configurable_configlet_good(self):
|
||||
''' Test server_configurable_configlet good.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos')
|
||||
configlets = [dict(name='configlet1', info='line'),
|
||||
dict(name='eos-server', info='info')]
|
||||
module.client.api.get_configlets_by_device_id.return_value = configlets
|
||||
sw_info = dict(key='key', type='type', fqdn='eos')
|
||||
result = cv_server_provision.server_configurable_configlet(module,
|
||||
sw_info)
|
||||
self.assertEqual(module.client.api.get_configlets_by_device_id.call_count, 1)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['name'], 'eos-server')
|
||||
self.assertEqual(result['info'], 'info')
|
||||
|
||||
def test_server_configurable_configlet_not_configurable(self):
|
||||
''' Test server_configurable_configlet fail. No server configlet.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos')
|
||||
configlets = [dict(name='configlet1', info='line'),
|
||||
dict(name='configlet2', info='info')]
|
||||
module.client.api.get_configlets_by_device_id.return_value = configlets
|
||||
sw_info = dict(key='key', type='type', fqdn='eos')
|
||||
result = cv_server_provision.server_configurable_configlet(module, sw_info)
|
||||
self.assertEqual(module.client.api.get_configlets_by_device_id.call_count, 1)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_server_configurable_configlet_no_configlets(self):
|
||||
''' Test server_configurable_configlet fail. No switch configlets.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos')
|
||||
module.client.api.get_configlets_by_device_id.return_value = []
|
||||
sw_info = dict(key='key', type='type', fqdn='eos')
|
||||
result = cv_server_provision.server_configurable_configlet(module,
|
||||
sw_info)
|
||||
self.assertEqual(module.client.api.get_configlets_by_device_id.call_count, 1)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_port_configurable_good(self):
|
||||
''' Test port_configurable user provided switch port in configlet.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
configlet = dict(name='eos-server', config=config)
|
||||
result = cv_server_provision.port_configurable(module, configlet)
|
||||
self.assertTrue(result)
|
||||
|
||||
def test_port_configurable_fail(self):
|
||||
''' Test port_configurable user provided switch port not in configlet.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='2')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
configlet = dict(name='eos-server', config=config)
|
||||
result = cv_server_provision.port_configurable(module, configlet)
|
||||
self.assertFalse(result)
|
||||
|
||||
def test_port_configurable_fail_no_config(self):
|
||||
''' Test port_configurable configlet empty.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='2')
|
||||
config = ''
|
||||
configlet = dict(name='eos-server', config=config)
|
||||
result = cv_server_provision.port_configurable(module, configlet)
|
||||
self.assertFalse(result)
|
||||
|
||||
def test_configlet_action_show_blank_config(self):
|
||||
''' Test configlet_action show returns current port configuration.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(action='show', switch_name='eos', switch_port='3')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
configlet = dict(name='eos-server', key='key', config=config)
|
||||
result = cv_server_provision.configlet_action(module, configlet)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['currentConfigBlock'], 'interface Ethernet3\n!')
|
||||
module.client.api.update_configlet.assert_not_called()
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.config_from_template')
|
||||
def test_configlet_action_add_with_task(self, mock_template):
|
||||
''' Test configlet_action add with change updates configlet and adds
|
||||
proper info to return data. Including task spawned info.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(action='add', switch_name='eos', switch_port='3')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
configlet = dict(name='eos-server', key='key', config=config)
|
||||
template_config = ('interface Ethernet3\n description Host eos'
|
||||
' managed by Ansible and Jinja template\n'
|
||||
' load-interval 30\n'
|
||||
' switchport\n'
|
||||
' switchport mode trunk\n'
|
||||
' no shutdown\n!')
|
||||
mock_template.return_value = template_config
|
||||
update_return = dict(data='Configlet eos-server successfully updated'
|
||||
' and task initiated.')
|
||||
module.client.api.update_configlet.return_value = update_return
|
||||
result = cv_server_provision.configlet_action(module, configlet)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['oldConfigBlock'], 'interface Ethernet3\n!')
|
||||
full_config = '!\n' + template_config + '\ninterface Ethernet4\n!'
|
||||
self.assertEqual(result['fullConfig'], full_config)
|
||||
self.assertEqual(result['updateConfigletResponse'],
|
||||
update_return['data'])
|
||||
self.assertTrue(result['changed'])
|
||||
self.assertTrue(result['taskCreated'])
|
||||
self.assertEqual(module.client.api.update_configlet.call_count, 1)
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.config_from_template')
|
||||
def test_configlet_action_add_no_task(self, mock_template):
|
||||
''' Test configlet_action add that doesn't change configlet adds proper
|
||||
info to return data. Does not including any task info.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(action='add', switch_name='eos', switch_port='3')
|
||||
config = ('!\ninterface Ethernet3\n description test\n'
|
||||
'!\ninterface Ethernet4\n!')
|
||||
configlet = dict(name='eos-server', key='key', config=config)
|
||||
template_config = 'interface Ethernet3\n description test\n!'
|
||||
mock_template.return_value = template_config
|
||||
update_return = dict(data='Configlet eos-server successfully updated.')
|
||||
module.client.api.update_configlet.return_value = update_return
|
||||
result = cv_server_provision.configlet_action(module, configlet)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['oldConfigBlock'],
|
||||
'interface Ethernet3\n description test\n!')
|
||||
self.assertEqual(result['fullConfig'], config)
|
||||
self.assertEqual(result['updateConfigletResponse'],
|
||||
update_return['data'])
|
||||
self.assertNotIn('changed', result)
|
||||
self.assertNotIn('taskCreated', result)
|
||||
self.assertEqual(module.client.api.update_configlet.call_count, 1)
|
||||
|
||||
def test_configlet_action_remove_with_task(self):
|
||||
''' Test configlet_action remove with change updates configlet and adds
|
||||
proper info to return data. Including task spawned info.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(action='remove', switch_name='eos',
|
||||
switch_port='3')
|
||||
config = ('!\ninterface Ethernet3\n description test\n'
|
||||
'!\ninterface Ethernet4\n!')
|
||||
configlet = dict(name='eos-server', key='key', config=config)
|
||||
update_return = dict(data='Configlet eos-server successfully updated'
|
||||
' and task initiated.')
|
||||
module.client.api.update_configlet.return_value = update_return
|
||||
result = cv_server_provision.configlet_action(module, configlet)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['oldConfigBlock'],
|
||||
'interface Ethernet3\n description test\n!')
|
||||
full_config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
self.assertEqual(result['fullConfig'], full_config)
|
||||
self.assertEqual(result['updateConfigletResponse'],
|
||||
update_return['data'])
|
||||
self.assertTrue(result['changed'])
|
||||
self.assertTrue(result['taskCreated'])
|
||||
self.assertEqual(module.client.api.update_configlet.call_count, 1)
|
||||
|
||||
def test_configlet_action_remove_no_task(self):
|
||||
''' Test configlet_action with remove that doesn't change configlet and
|
||||
adds proper info to return data. Does not including any task info.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(action='remove', switch_name='eos',
|
||||
switch_port='3')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
configlet = dict(name='eos-server', key='key', config=config)
|
||||
update_return = dict(data='Configlet eos-server successfully updated.')
|
||||
module.client.api.update_configlet.return_value = update_return
|
||||
result = cv_server_provision.configlet_action(module, configlet)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result['oldConfigBlock'], 'interface Ethernet3\n!')
|
||||
self.assertEqual(result['fullConfig'], config)
|
||||
self.assertEqual(result['updateConfigletResponse'],
|
||||
update_return['data'])
|
||||
self.assertNotIn('changed', result)
|
||||
self.assertNotIn('taskCreated', result)
|
||||
self.assertEqual(module.client.api.update_configlet.call_count, 1)
|
||||
|
||||
def test_current_config_empty_config(self):
|
||||
''' Test current_config with empty config for port
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='4')
|
||||
config = '!\ninterface Ethernet3\n!\ninterface Ethernet4'
|
||||
result = cv_server_provision.current_config(module, config)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result, 'interface Ethernet4')
|
||||
|
||||
def test_current_config_with_config(self):
|
||||
''' Test current_config with config for port
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3')
|
||||
config = ('!\ninterface Ethernet3\n description test\n'
|
||||
'!\ninterface Ethernet4\n!')
|
||||
result = cv_server_provision.current_config(module, config)
|
||||
self.assertIsNotNone(result)
|
||||
self.assertEqual(result, 'interface Ethernet3\n description test\n!')
|
||||
|
||||
def test_current_config_no_match(self):
|
||||
''' Test current_config with no entry for port
|
||||
'''
|
||||
module = Mock()
|
||||
module.fail_json.side_effect = SystemExit
|
||||
module.params = dict(switch_name='eos', switch_port='2')
|
||||
config = '!\ninterface Ethernet3\n description test\n!'
|
||||
self.assertRaises(SystemExit, cv_server_provision.current_config,
|
||||
module, config)
|
||||
|
||||
def test_valid_template_true(self):
|
||||
''' Test valid_template true
|
||||
'''
|
||||
template = 'interface Ethernet3\n description test\n!'
|
||||
result = cv_server_provision.valid_template('3', template)
|
||||
self.assertTrue(result)
|
||||
|
||||
def test_valid_template_false(self):
|
||||
''' Test valid_template false
|
||||
'''
|
||||
template = 'interface Ethernet3\n description test\n!'
|
||||
result = cv_server_provision.valid_template('4', template)
|
||||
self.assertFalse(result)
|
||||
|
||||
@patch('jinja2.DebugUndefined')
|
||||
@patch('jinja2.Environment')
|
||||
@patch('jinja2.FileSystemLoader')
|
||||
def test_config_from_template_no_template(self, mock_file_sys, mock_env,
|
||||
mock_debug):
|
||||
''' Test config_from_template good. No template.
|
||||
'''
|
||||
module = Mock()
|
||||
module.fail_json.side_effect = SystemExit
|
||||
module.params = dict(switch_name='eos', switch_port='3',
|
||||
server_name='new', template='jinja.j2')
|
||||
mock_file_sys.return_value = 'file'
|
||||
mock_debug.return_value = 'debug'
|
||||
env_mock = Mock()
|
||||
env_mock.get_template.return_value = None
|
||||
mock_env.return_value = env_mock
|
||||
self.assertRaises(SystemExit, cv_server_provision.config_from_template,
|
||||
module)
|
||||
self.assertEqual(mock_file_sys.call_count, 1)
|
||||
self.assertEqual(mock_env.call_count, 1)
|
||||
self.assertEqual(module.fail_json.call_count, 1)
|
||||
|
||||
@patch('jinja2.meta.find_undeclared_variables')
|
||||
@patch('jinja2.DebugUndefined')
|
||||
@patch('jinja2.Environment')
|
||||
@patch('jinja2.FileSystemLoader')
|
||||
def test_config_from_template_good_no_vlan(self, mock_file_sys, mock_env, mock_debug,
|
||||
mock_find):
|
||||
''' Test config_from_template good. No port_vlan.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3',
|
||||
server_name='new', template='jinja.j2')
|
||||
mock_file_sys.return_value = 'file'
|
||||
mock_debug.return_value = 'debug'
|
||||
template_mock = Mock()
|
||||
template_mock.render.return_value = ('interface Ethernet3\n'
|
||||
' description test\n'
|
||||
' switchport\n'
|
||||
' switchport mode trunk\n'
|
||||
' no shutdown\n!')
|
||||
env_mock = Mock()
|
||||
env_mock.loader.get_source.return_value = ['one', 'two']
|
||||
env_mock.parse.return_value = 'parsed'
|
||||
env_mock.get_template.return_value = template_mock
|
||||
mock_env.return_value = env_mock
|
||||
mock_find.return_value = dict(server_name=None, switch_port=None)
|
||||
result = cv_server_provision.config_from_template(module)
|
||||
self.assertIsNotNone(result)
|
||||
expected = ('interface Ethernet3\n'
|
||||
' description test\n'
|
||||
' switchport\n'
|
||||
' switchport mode trunk\n'
|
||||
' no shutdown\n!')
|
||||
self.assertEqual(result, expected)
|
||||
self.assertEqual(mock_file_sys.call_count, 1)
|
||||
self.assertEqual(mock_env.call_count, 1)
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
@patch('jinja2.meta.find_undeclared_variables')
|
||||
@patch('jinja2.DebugUndefined')
|
||||
@patch('jinja2.Environment')
|
||||
@patch('jinja2.FileSystemLoader')
|
||||
def test_config_from_template_good_vlan(self, mock_file_sys, mock_env, mock_debug,
|
||||
mock_find):
|
||||
''' Test config_from_template good. With port_vlan.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3',
|
||||
server_name='new', template='jinja.j2', port_vlan='7')
|
||||
mock_file_sys.return_value = 'file'
|
||||
mock_debug.return_value = 'debug'
|
||||
template_mock = Mock()
|
||||
template_mock.render.return_value = ('interface Ethernet3\n'
|
||||
' description test\n'
|
||||
' switchport\n'
|
||||
' switchport access vlan 7\n'
|
||||
' no shutdown\n!')
|
||||
env_mock = Mock()
|
||||
env_mock.loader.get_source.return_value = ['one', 'two']
|
||||
env_mock.parse.return_value = 'parsed'
|
||||
env_mock.get_template.return_value = template_mock
|
||||
mock_env.return_value = env_mock
|
||||
mock_find.return_value = dict(server_name=None, switch_port=None,
|
||||
port_vlan=None)
|
||||
result = cv_server_provision.config_from_template(module)
|
||||
self.assertIsNotNone(result)
|
||||
expected = ('interface Ethernet3\n'
|
||||
' description test\n'
|
||||
' switchport\n'
|
||||
' switchport access vlan 7\n'
|
||||
' no shutdown\n!')
|
||||
self.assertEqual(result, expected)
|
||||
self.assertEqual(mock_file_sys.call_count, 1)
|
||||
self.assertEqual(mock_env.call_count, 1)
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
@patch('jinja2.meta.find_undeclared_variables')
|
||||
@patch('jinja2.DebugUndefined')
|
||||
@patch('jinja2.Environment')
|
||||
@patch('jinja2.FileSystemLoader')
|
||||
def test_config_from_template_fail_wrong_port(self, mock_file_sys, mock_env,
|
||||
mock_debug, mock_find):
|
||||
''' Test config_from_template fail. Wrong port number in template.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='4',
|
||||
server_name='new', template='jinja.j2')
|
||||
mock_file_sys.return_value = 'file'
|
||||
mock_debug.return_value = 'debug'
|
||||
template_mock = Mock()
|
||||
template_mock.render.return_value = ('interface Ethernet3\n'
|
||||
' description test\n!')
|
||||
env_mock = Mock()
|
||||
env_mock.loader.get_source.return_value = ['one', 'two']
|
||||
env_mock.parse.return_value = 'parsed'
|
||||
env_mock.get_template.return_value = template_mock
|
||||
mock_env.return_value = env_mock
|
||||
mock_find.return_value = dict(server_name=None, switch_port=None)
|
||||
result = cv_server_provision.config_from_template(module)
|
||||
self.assertIsNotNone(result)
|
||||
expected = 'interface Ethernet3\n description test\n!'
|
||||
self.assertEqual(result, expected)
|
||||
self.assertEqual(mock_file_sys.call_count, 1)
|
||||
self.assertEqual(mock_env.call_count, 1)
|
||||
module.fail_json.assert_called_with(msg='Template content does not'
|
||||
' configure proper interface'
|
||||
' - %s' % expected)
|
||||
|
||||
@patch('jinja2.meta.find_undeclared_variables')
|
||||
@patch('jinja2.DebugUndefined')
|
||||
@patch('jinja2.Environment')
|
||||
@patch('jinja2.FileSystemLoader')
|
||||
def test_config_from_template_fail_no_vlan(self, mock_file_sys, mock_env,
|
||||
mock_debug, mock_find):
|
||||
''' Test config_from_template fail. Template needs vlan but none provided.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3',
|
||||
server_name='new', template='jinja.j2',
|
||||
port_vlan=None)
|
||||
mock_file_sys.return_value = 'file'
|
||||
mock_debug.return_value = 'debug'
|
||||
template_mock = Mock()
|
||||
template_mock.render.return_value = ('interface Ethernet3\n'
|
||||
' description test\n!')
|
||||
env_mock = Mock()
|
||||
env_mock.loader.get_source.return_value = ['one', 'two']
|
||||
env_mock.parse.return_value = 'parsed'
|
||||
env_mock.get_template.return_value = template_mock
|
||||
mock_env.return_value = env_mock
|
||||
mock_find.return_value = dict(server_name=None, switch_port=None,
|
||||
port_vlan=None)
|
||||
result = cv_server_provision.config_from_template(module)
|
||||
self.assertIsNotNone(result)
|
||||
expected = 'interface Ethernet3\n description test\n!'
|
||||
self.assertEqual(result, expected)
|
||||
self.assertEqual(mock_file_sys.call_count, 1)
|
||||
self.assertEqual(mock_env.call_count, 1)
|
||||
module.fail_json.assert_called_with(msg='Template jinja.j2 requires a'
|
||||
' vlan. Please re-run with vlan'
|
||||
' number provided.')
|
||||
|
||||
def test_updated_configlet_content_add(self):
|
||||
''' Test updated_configlet_content. Add config.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3')
|
||||
existing_config = '!\ninterface Ethernet3\n!\ninterface Ethernet4\n!'
|
||||
new_config_block = 'interface Ethernet3\n description test\n!'
|
||||
result = cv_server_provision.updated_configlet_content(module,
|
||||
existing_config,
|
||||
new_config_block)
|
||||
expected = ('!\ninterface Ethernet3\n description test\n'
|
||||
'!\ninterface Ethernet4\n!')
|
||||
self.assertEqual(result, expected)
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
def test_updated_configlet_content_remove(self):
|
||||
''' Test updated_configlet_content. Remove config.
|
||||
'''
|
||||
module = Mock()
|
||||
module.params = dict(switch_name='eos', switch_port='3')
|
||||
existing_config = ('!\ninterface Ethernet3\n description test\n'
|
||||
'!\ninterface Ethernet4')
|
||||
new_config_block = 'interface Ethernet3\n!'
|
||||
result = cv_server_provision.updated_configlet_content(module,
|
||||
existing_config,
|
||||
new_config_block)
|
||||
expected = '!\ninterface Ethernet3\n!\ninterface Ethernet4'
|
||||
self.assertEqual(result, expected)
|
||||
module.fail_json.assert_not_called()
|
||||
|
||||
def test_updated_configlet_content_no_match(self):
|
||||
''' Test updated_configlet_content. Interface not in config.
|
||||
'''
|
||||
module = Mock()
|
||||
module.fail_json.side_effect = SystemExit
|
||||
module.params = dict(switch_name='eos', switch_port='2')
|
||||
existing_config = '!\ninterface Ethernet3\n description test\n!'
|
||||
new_config_block = 'interface Ethernet3\n!'
|
||||
self.assertRaises(SystemExit,
|
||||
cv_server_provision.updated_configlet_content,
|
||||
module, existing_config, new_config_block)
|
||||
|
||||
@patch('time.sleep')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
def test_configlet_update_task_good_one_try(self, mock_info, mock_sleep):
|
||||
''' Test configlet_update_task gets task after one try.
|
||||
'''
|
||||
module = Mock()
|
||||
task = dict(data=dict(WORKFLOW_ACTION='Configlet Push'),
|
||||
description='Configlet Assign',
|
||||
workOrderId='7')
|
||||
device_info = dict(taskIdList=[task])
|
||||
mock_info.return_value = device_info
|
||||
result = cv_server_provision.configlet_update_task(module)
|
||||
self.assertEqual(result, '7')
|
||||
mock_sleep.assert_not_called()
|
||||
self.assertEqual(mock_info.call_count, 1)
|
||||
|
||||
@patch('time.sleep')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
def test_configlet_update_task_good_three_tries(self, mock_info, mock_sleep):
|
||||
''' Test configlet_update_task gets task on third try.
|
||||
'''
|
||||
module = Mock()
|
||||
task1 = dict(data=dict(WORKFLOW_ACTION='Configlet Push'),
|
||||
description='Configlet Assign',
|
||||
workOrderId='7')
|
||||
task2 = dict(data=dict(WORKFLOW_ACTION='Nonsense'),
|
||||
description='Configlet Assign',
|
||||
workOrderId='700')
|
||||
device_info = dict(taskIdList=[task1, task2])
|
||||
mock_info.side_effect = [dict(), dict(), device_info]
|
||||
result = cv_server_provision.configlet_update_task(module)
|
||||
self.assertEqual(result, '7')
|
||||
self.assertEqual(mock_sleep.call_count, 2)
|
||||
self.assertEqual(mock_info.call_count, 3)
|
||||
|
||||
@patch('time.sleep')
|
||||
@patch('ansible_collections.community.general.plugins.modules.network.cloudvision.cv_server_provision.switch_info')
|
||||
def test_configlet_update_task_no_task(self, mock_info, mock_sleep):
|
||||
''' Test configlet_update_task does not get task after three tries.
|
||||
'''
|
||||
module = Mock()
|
||||
mock_info.side_effect = [dict(), dict(), dict()]
|
||||
result = cv_server_provision.configlet_update_task(module)
|
||||
self.assertIsNone(result)
|
||||
self.assertEqual(mock_sleep.call_count, 3)
|
||||
self.assertEqual(mock_info.call_count, 3)
|
||||
|
||||
@patch('time.sleep')
|
||||
def test_wait_for_task_completion_good_one_try(self, mock_time):
|
||||
''' Test wait_for_task_completion completed. One Try.
|
||||
'''
|
||||
module = Mock()
|
||||
module.client.api.get_task_by_id.return_value = dict(
|
||||
workOrderUserDefinedStatus='Completed')
|
||||
result = cv_server_provision.wait_for_task_completion(module, '7')
|
||||
self.assertTrue(result)
|
||||
self.assertEqual(module.client.api.get_task_by_id.call_count, 1)
|
||||
module.fail_json.assert_not_called()
|
||||
mock_time.assert_not_called()
|
||||
|
||||
@patch('time.sleep')
|
||||
def test_wait_for_task_completion_good_three_tries(self, mock_time):
|
||||
''' Test wait_for_task_completion completed. Three tries.
|
||||
'''
|
||||
module = Mock()
|
||||
try_one_two = dict(workOrderUserDefinedStatus='Pending')
|
||||
try_three = dict(workOrderUserDefinedStatus='Completed')
|
||||
module.client.api.get_task_by_id.side_effect = [try_one_two,
|
||||
try_one_two, try_three]
|
||||
result = cv_server_provision.wait_for_task_completion(module, '7')
|
||||
self.assertTrue(result)
|
||||
self.assertEqual(module.client.api.get_task_by_id.call_count, 3)
|
||||
module.fail_json.assert_not_called()
|
||||
self.assertEqual(mock_time.call_count, 2)
|
||||
|
||||
@patch('time.sleep')
|
||||
def test_wait_for_task_completion_fail(self, mock_time):
|
||||
''' Test wait_for_task_completion failed.
|
||||
'''
|
||||
module = Mock()
|
||||
try_one = dict(workOrderUserDefinedStatus='Failed')
|
||||
try_two = dict(workOrderUserDefinedStatus='Completed')
|
||||
module.client.api.get_task_by_id.side_effect = [try_one, try_two]
|
||||
result = cv_server_provision.wait_for_task_completion(module, '7')
|
||||
self.assertTrue(result)
|
||||
self.assertEqual(module.client.api.get_task_by_id.call_count, 2)
|
||||
text = ('Task 7 has reported status Failed. Please consult the CVP'
|
||||
' admins for more information.')
|
||||
module.fail_json.assert_called_with(msg=text)
|
||||
self.assertEqual(mock_time.call_count, 1)
|
|
@ -1,126 +0,0 @@
|
|||
# Copyright (C) 2017 Lenovo, Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Make coding more python3-ish
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
import tempfile
|
||||
|
||||
from ansible_collections.community.general.tests.unit.compat import unittest
|
||||
from ansible_collections.community.general.tests.unit.compat.mock import patch
|
||||
from ansible.module_utils import basic
|
||||
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_data = {}
|
||||
|
||||
|
||||
def load_fixture(name):
|
||||
path = os.path.join(fixture_path, name)
|
||||
|
||||
if path in fixture_data:
|
||||
return fixture_data[path]
|
||||
|
||||
with open(path) as f:
|
||||
data = f.read()
|
||||
|
||||
try:
|
||||
data = json.loads(data)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
fixture_data[path] = data
|
||||
return data
|
||||
|
||||
|
||||
class AnsibleExitJson(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class AnsibleFailJson(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class TestCnosModule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
super(TestCnosModule, self).setUp()
|
||||
|
||||
self.test_log = tempfile.mkstemp(prefix='ansible-test-cnos-module-', suffix='.log')[1]
|
||||
|
||||
self.mock_sleep = patch('time.sleep')
|
||||
self.mock_sleep.start()
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCnosModule, self).tearDown()
|
||||
|
||||
self.mock_sleep.stop()
|
||||
os.remove(self.test_log)
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None,
|
||||
sort=True, defaults=False):
|
||||
|
||||
self.load_fixtures(commands)
|
||||
|
||||
if failed:
|
||||
result = self.failed()
|
||||
self.assertTrue(result['failed'], result)
|
||||
else:
|
||||
result = self.changed(changed)
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
|
||||
if commands is not None:
|
||||
if sort:
|
||||
self.assertEqual(sorted(commands), sorted(result['commands']),
|
||||
result['commands'])
|
||||
else:
|
||||
self.assertEqual(commands, result['commands'],
|
||||
result['commands'])
|
||||
|
||||
return result
|
||||
|
||||
def failed(self):
|
||||
def fail_json(*args, **kwargs):
|
||||
kwargs['failed'] = True
|
||||
raise AnsibleFailJson(kwargs)
|
||||
|
||||
with patch.object(basic.AnsibleModule, 'fail_json', fail_json):
|
||||
with self.assertRaises(AnsibleFailJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertTrue(result['failed'], result)
|
||||
return result
|
||||
|
||||
def changed(self, changed=False):
|
||||
def exit_json(*args, **kwargs):
|
||||
if 'changed' not in kwargs:
|
||||
kwargs['changed'] = False
|
||||
raise AnsibleExitJson(kwargs)
|
||||
|
||||
with patch.object(basic.AnsibleModule, 'exit_json', exit_json):
|
||||
with self.assertRaises(AnsibleExitJson) as exc:
|
||||
self.module.main()
|
||||
|
||||
result = exc.exception.args[0]
|
||||
self.assertEqual(result['changed'], changed, result)
|
||||
return result
|
||||
|
||||
def load_fixtures(self, commands=None):
|
||||
pass
|
|
@ -1,3 +0,0 @@
|
|||
this is a sample
|
||||
mulitline banner
|
||||
used for testing
|
|
@ -1,24 +0,0 @@
|
|||
!
|
||||
router bgp 33
|
||||
router-id 1.2.3.4
|
||||
bestpath always-compare-med
|
||||
cluster-id 1.2.3.4
|
||||
confederation identifier 333
|
||||
enforce-first-as
|
||||
bgp as-local-count 33
|
||||
bestpath compare-confed-aspath
|
||||
maxas-limit 333
|
||||
graceful-restart-helper
|
||||
graceful-restart stalepath-time 333
|
||||
timers bgp 333 3333
|
||||
address-family ipv4 unicast
|
||||
synchronization
|
||||
network 0.0.0.0 backdoor
|
||||
network 0.0.0.0 backdoor
|
||||
dampening 13 233 333 15 33
|
||||
neighbor 10.241.107.40 remote-as 13
|
||||
bfd
|
||||
address-family ipv4 unicast
|
||||
next-hop-self
|
||||
!
|
||||
|
|
@ -1,337 +0,0 @@
|
|||
!
|
||||
version "10.8.0.42"
|
||||
!
|
||||
hostname ip10-241-107-39
|
||||
!
|
||||
banner motd NMS India CNOS
|
||||
banner motd NMS India CNOS G8272
|
||||
!
|
||||
clock timezone EDT 0 0
|
||||
!
|
||||
logging console 7
|
||||
vrf context management
|
||||
ip route 0.0.0.0/0 10.241.107.1
|
||||
!
|
||||
!
|
||||
port-channel load-balance ethernet destination-mac
|
||||
port-channel load-balance ethernet source-interface
|
||||
feature telnet
|
||||
ip domain-name labs.lenovo.com vrf management
|
||||
ip domain-list labs.lenovo.com vrf management
|
||||
ip name-server 10.241.104.120 vrf management
|
||||
ip name-server 10.240.0.10 vrf management
|
||||
ip host ip10-241-107-39.labs.lenovo.com 10.241.107.39 vrf management
|
||||
ip host ip10-241-107-39 10.241.107.39 vrf management
|
||||
ip domain-name labs.lenovo.com vrf default
|
||||
ip domain-list labs.lenovo.com vrf default
|
||||
ip name-server 10.240.0.10 vrf default
|
||||
ip name-server 10.241.104.120 vrf default
|
||||
ip host ip10-241-107-39.labs.lenovo.com 10.241.107.39 vrf default
|
||||
ip host ip10-241-107-39 10.241.107.39 vrf default
|
||||
ntp server 173.230.154.254 prefer
|
||||
ntp server 97.127.86.33 prefer
|
||||
ntp server 129.250.35.250 prefer
|
||||
ntp server 174.136.103.130 prefer
|
||||
ntp server 69.10.161.7 prefer
|
||||
ntp server 96.226.123.196 prefer
|
||||
ntp server 104.238.179.130 prefer
|
||||
ntp server 108.61.73.244 prefer
|
||||
ntp server 208.75.89.4 prefer
|
||||
snmp-server community public group network-operator
|
||||
snmp-server community private group network-admin
|
||||
snmp-server contact Ralph
|
||||
username admin role network-admin password encrypted $6$bJoWyEu/$9pzSgFPAKGRm1stpTCEl3I39htbjxiFCfhqiHag1NQiKHv/IiLQ2lYW0V3p7p72SgSmVHp38em9P9R/EdePpk/
|
||||
logging server 10.241.107.231
|
||||
logging server 10.241.107.222
|
||||
feature restApi
|
||||
ovsdb pki ovsdb_mgmt vrf management
|
||||
ovsdb pki ovsdb_default vrf default
|
||||
lacp system-priority 32769
|
||||
vlag tier-id 313
|
||||
vlag priority 1313
|
||||
vlag isl port-channel 100
|
||||
vlag hlthchk keepalive-attempts 5
|
||||
vlag hlthchk peer-ip 1.2.3.4
|
||||
vlag auto-recovery 266
|
||||
vlag startup-delay 323
|
||||
vlag enable
|
||||
vlag instance 1 port-channel 1003
|
||||
vlag instance 1 enable
|
||||
vlag instance 2 port-channel 20
|
||||
vlag instance 2 enable
|
||||
vlag instance 12 port-channel 23
|
||||
vlag instance 33 port-channel 333
|
||||
vlag instance 33 enable
|
||||
spanning-tree mode mst
|
||||
telemetry heartbeat enabled interval 15
|
||||
!
|
||||
policy-map type control-plane copp-system-policy
|
||||
class type control-plane copp-s-pvst-bpdu
|
||||
police pps 500
|
||||
class type control-plane copp-s-ecp
|
||||
police pps 3000
|
||||
class type control-plane copp-s-igmp
|
||||
police pps 3000
|
||||
!
|
||||
vlan 1-2
|
||||
no flood ipv4
|
||||
!
|
||||
vlan 3
|
||||
!
|
||||
vlan 5
|
||||
!
|
||||
vlan 12
|
||||
!
|
||||
vlan 13
|
||||
name dave
|
||||
!
|
||||
vlan dot1q tag native egress-only
|
||||
!
|
||||
interface Ethernet1/1
|
||||
description Link 1 to LP21
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
channel-group 33 mode on
|
||||
!
|
||||
interface Ethernet1/2
|
||||
description Link 2 to LP21
|
||||
channel-group 1001 mode active
|
||||
!
|
||||
interface Ethernet1/3
|
||||
description Link 1 to LP22
|
||||
switchport mode trunk
|
||||
channel-group 1003 mode active
|
||||
!
|
||||
interface Ethernet1/4
|
||||
description Link 2 to LP22
|
||||
switchport mode trunk
|
||||
channel-group 1004 mode active
|
||||
!
|
||||
interface Ethernet1/5
|
||||
description Link 1 to LP23
|
||||
no switchport
|
||||
ip address 20.131.1.1/30
|
||||
!
|
||||
interface Ethernet1/6
|
||||
description Link 2 to LP23
|
||||
no switchport
|
||||
ip address 20.131.2.1/30
|
||||
!
|
||||
interface Ethernet1/7
|
||||
description Link 1 to LP24
|
||||
no switchport
|
||||
ip address 20.141.1.1/30
|
||||
!
|
||||
interface Ethernet1/8
|
||||
description Link 2 to LP24
|
||||
no switchport
|
||||
ip address 20.141.2.1/30
|
||||
!
|
||||
interface Ethernet1/9
|
||||
!
|
||||
interface Ethernet1/10
|
||||
!
|
||||
interface Ethernet1/11
|
||||
no switchport
|
||||
mtu 1402
|
||||
ip address 1.1.1.2/8
|
||||
!
|
||||
!
|
||||
interface Ethernet1/12
|
||||
ip address 100.10.10.10/24
|
||||
mtu 1402
|
||||
no switchport
|
||||
!
|
||||
interface Ethernet1/13
|
||||
description test string
|
||||
no switchport
|
||||
ip address 10.241.107.54/24
|
||||
vrrp 254
|
||||
address 10.241.107.55
|
||||
priority 254
|
||||
no shutdown
|
||||
ip arp timeout 1500
|
||||
!
|
||||
interface Ethernet1/14
|
||||
!
|
||||
interface Ethernet1/15
|
||||
!
|
||||
interface Ethernet1/16
|
||||
!
|
||||
interface Ethernet1/17
|
||||
!
|
||||
interface Ethernet1/18
|
||||
!
|
||||
interface Ethernet1/19
|
||||
!
|
||||
interface Ethernet1/20
|
||||
!
|
||||
interface Ethernet1/21
|
||||
!
|
||||
interface Ethernet1/22
|
||||
!
|
||||
interface Ethernet1/23
|
||||
channel-group 11 mode active
|
||||
lacp port-priority 32769
|
||||
!
|
||||
interface Ethernet1/24
|
||||
!
|
||||
interface Ethernet1/25
|
||||
!
|
||||
interface Ethernet1/26
|
||||
!
|
||||
interface Ethernet1/27
|
||||
!
|
||||
interface Ethernet1/28
|
||||
!
|
||||
interface Ethernet1/29
|
||||
!
|
||||
interface Ethernet1/30
|
||||
!
|
||||
interface Ethernet1/31
|
||||
!
|
||||
interface Ethernet1/32
|
||||
!
|
||||
interface Ethernet1/33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
microburst-detection enable threshold 25
|
||||
lldp tlv-select max-frame-size
|
||||
lacp port-priority 33
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
interface Ethernet1/34
|
||||
!
|
||||
interface Ethernet1/35
|
||||
!
|
||||
interface Ethernet1/36
|
||||
!
|
||||
interface Ethernet1/37
|
||||
!
|
||||
interface Ethernet1/38
|
||||
!
|
||||
interface Ethernet1/39
|
||||
!
|
||||
interface Ethernet1/40
|
||||
!
|
||||
interface Ethernet1/41
|
||||
!
|
||||
interface Ethernet1/42
|
||||
!
|
||||
interface Ethernet1/43
|
||||
!
|
||||
interface Ethernet1/44
|
||||
ip address 6.7.8.9 255.255.255.0
|
||||
description test string
|
||||
shutdown
|
||||
!
|
||||
interface Ethernet1/45
|
||||
!
|
||||
interface Ethernet1/46
|
||||
!
|
||||
interface Ethernet1/47
|
||||
!
|
||||
interface Ethernet1/48
|
||||
!
|
||||
interface Ethernet1/49
|
||||
!
|
||||
interface Ethernet1/50
|
||||
!
|
||||
interface Ethernet1/51
|
||||
!
|
||||
interface Ethernet1/52
|
||||
!
|
||||
interface Ethernet1/53
|
||||
!
|
||||
interface Ethernet1/54
|
||||
!
|
||||
interface loopback0
|
||||
no switchport
|
||||
!
|
||||
interface mgmt0
|
||||
no switchport
|
||||
vrf member management
|
||||
no ip address dhcp
|
||||
ip address 10.241.107.39/24
|
||||
no ipv6 address dhcp
|
||||
!
|
||||
interface Vlan1
|
||||
no switchport
|
||||
!
|
||||
interface port-channel1
|
||||
!
|
||||
interface port-channel2
|
||||
!
|
||||
interface port-channel11
|
||||
lacp min-links 2
|
||||
!
|
||||
interface port-channel13
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel17
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel20
|
||||
!
|
||||
interface port-channel33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
interface port-channel100
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel1001
|
||||
!
|
||||
interface port-channel1002
|
||||
!
|
||||
interface port-channel1003
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel1004
|
||||
switchport mode trunk
|
||||
!
|
||||
router bgp 33
|
||||
router-id 1.2.3.4
|
||||
bestpath always-compare-med
|
||||
cluster-id 1.2.3.4
|
||||
confederation identifier 333
|
||||
enforce-first-as
|
||||
bgp as-local-count 33
|
||||
bestpath compare-confed-aspath
|
||||
maxas-limit 333
|
||||
graceful-restart-helper
|
||||
graceful-restart stalepath-time 333
|
||||
timers bgp 333 3333
|
||||
address-family ipv4 unicast
|
||||
synchronization
|
||||
network 0.0.0.0 backdoor
|
||||
dampening 13 233 333 15 33
|
||||
neighbor 10.241.107.40 remote-as 13
|
||||
bfd
|
||||
address-family ipv4 unicast
|
||||
next-hop-self
|
||||
!
|
||||
route-map anil permit 10
|
||||
!
|
||||
ip arp timeout 1000
|
||||
!
|
||||
line con 0
|
||||
line vty 0
|
||||
exec-timeout 90 0
|
||||
line vty 1 39
|
||||
!
|
||||
!
|
||||
!
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
!
|
||||
hostname foo
|
||||
!
|
||||
interface ethernet 1/13
|
||||
speed 10000
|
||||
!
|
|
@ -1,36 +0,0 @@
|
|||
!
|
||||
hostname ip10-241-107-39
|
||||
!
|
||||
interface Ethernet1/33
|
||||
description anil
|
||||
microburst-detection enable threshold 25
|
||||
lldp tlv-select max-frame-size
|
||||
lacp port-priority 33
|
||||
!
|
||||
interface Ethernet1/44
|
||||
!
|
||||
interface Ethernet1/10
|
||||
no switchport
|
||||
ip address 10.241.108.10/24
|
||||
vrrp 202
|
||||
address 10.241.108.20
|
||||
shutdown
|
||||
!
|
||||
interface Ethernet1/11
|
||||
no switchport
|
||||
mtu 1402
|
||||
ip address 1.1.1.2/8
|
||||
!
|
||||
interface port-channel20
|
||||
!
|
||||
interface port-channel33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
interface Ethernet1/9
|
||||
!
|
|
@ -1,9 +0,0 @@
|
|||
!
|
||||
logging logfile anil 4 size 10485760
|
||||
logging level vlan 4
|
||||
logging server 1.2.3.4 facility local0
|
||||
logging server 1.2.34.5 port 34
|
||||
logging server 1.2.3.5 4 facility local2 port 23
|
||||
logging server anil 5
|
||||
logging server tapas 4 facility local2 port 23
|
||||
!
|
|
@ -1,3 +0,0 @@
|
|||
ip route 1.2.3.4/32 1.2.34.5
|
||||
ip route 10.241.106.0/24 Ethernet1/13 10.241.107.1 113 tag 1013 description anil
|
||||
ip route 10.8.0.0/14 15.16.17.18
|
|
@ -1,11 +0,0 @@
|
|||
hostname lenovo
|
||||
|
||||
ip route 1.2.0.0/24 Null0 255
|
||||
ip route 1.2.3.4/31 Ethernet1/44 1.2.3.1
|
||||
ip route 1.2.3.4/32 1.2.34.5
|
||||
ip route 10.241.106.0/24 Ethernet1/13 10.241.107.1 113 tag 1013 description anil
|
||||
ip route 10.241.106.4/32 1.2.3.5 tag 333 description anillll
|
||||
ip route 10.241.106.4/32 1.3.56.7
|
||||
ip route 10.241.107.0/24 10.241.107.1
|
||||
ip route 10.241.107.1/32 Ethernet1/33 10.241.107.2 100 tag 111 description anil
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
User:admin
|
||||
role: network-admin
|
||||
|
||||
User:ansible
|
||||
role: network-operator
|
||||
no password set. Local login not allowed
|
||||
this user is created by remote authentication
|
||||
Remote login through RADIUS/TACACS+ is possible
|
|
@ -1,63 +0,0 @@
|
|||
Global State : enabled
|
||||
VRRP active/active mode : enabled
|
||||
vLAG system MAC : 08:17:f4:c3:de:38
|
||||
ISL Information:
|
||||
PCH Ifindex State Previous State
|
||||
-------+-----------+-----------+---------------------------------
|
||||
33 100033 Down Down
|
||||
|
||||
Mis-Match Information:
|
||||
Local Peer
|
||||
-------------+---------------------------+-----------------------
|
||||
Match Result : Mis-match Mis-match
|
||||
Tier ID : 313 0
|
||||
System Type : G8272
|
||||
OS Version : 10.8.x.x 0.0.x.x
|
||||
|
||||
Role Information:
|
||||
Local Peer
|
||||
-------------+---------------------------+-----------------------
|
||||
Admin Role : Primary Unselected
|
||||
Oper Role : Primary Unselected
|
||||
Priority : 1313 0
|
||||
System MAC : a4:8c:db:33:bc:01 00:00:00:00:00:00
|
||||
|
||||
Consistency Checking Information:
|
||||
State : enabled
|
||||
Strict Mode : enabled
|
||||
Final Result : pass
|
||||
|
||||
FDB refresh Information:
|
||||
FDB is doing refresh with below setting:
|
||||
FDB refresh is configured
|
||||
Bridge FDB aging timer is 1800 second(s)
|
||||
|
||||
FDB synchronization Information:
|
||||
FDB is NOT being synchronized.
|
||||
|
||||
Auto Recovery Interval 266s (Finished)
|
||||
|
||||
Startup Delay Interval 323s (Finished)
|
||||
|
||||
Health Check Information:
|
||||
Health check Peer IP Address: 1.2.3.4
|
||||
Health check Local IP Address: 0.0.0.0
|
||||
Health check retry interval: 133 seconds
|
||||
Health check number of keepalive attempts: 13
|
||||
Health check keepalive interval: 131 seconds
|
||||
Health check status: DOWN
|
||||
|
||||
Peer Gateway State : enabled
|
||||
|
||||
VLAG instance 1 : enabled
|
||||
Instance Information
|
||||
PCH ifindex State Previous State Cons Res
|
||||
----------+-----------+--------------+-----------------+--------
|
||||
1003 101003 Down Down pass
|
||||
|
||||
VLAG instance 33 : enabled
|
||||
Instance Information
|
||||
PCH ifindex State Previous State Cons Res
|
||||
----------+-----------+--------------+-----------------+--------
|
||||
333 0 Down Down pass
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
Flags:
|
||||
u - untagged egress traffic for this VLAN
|
||||
t - tagged egress traffic for this VLAN
|
||||
|
||||
d - auto-provisioned VLAN
|
||||
h - static and auto-provisioned VLAN
|
||||
|
||||
VLAN Name Status IPMC FLOOD Ports
|
||||
======== ================================ ======= ========== ===================
|
||||
1 default ACTIVE IPv6
|
||||
po1(u)
|
||||
po2(u)
|
||||
po11(u)
|
||||
po12(u)
|
||||
po13(u)
|
||||
po14(u)
|
||||
po15(u)
|
||||
po17(u)
|
||||
po20(u)
|
||||
po100(u)
|
||||
po1001(u)
|
||||
po1002(u)
|
||||
po1003(u)
|
||||
po1004(u)
|
||||
Ethernet1/2(u)
|
||||
Ethernet1/3(u)
|
||||
Ethernet1/4(u)
|
||||
Ethernet1/9(u)
|
||||
Ethernet1/10(u)
|
||||
Ethernet1/11(u)
|
||||
Ethernet1/14(u)
|
||||
Ethernet1/15(u)
|
||||
Ethernet1/16(u)
|
||||
Ethernet1/17(u)
|
||||
Ethernet1/18(u)
|
||||
Ethernet1/19(u)
|
||||
Ethernet1/20(u)
|
||||
Ethernet1/21(u)
|
||||
Ethernet1/22(u)
|
||||
Ethernet1/23(u)
|
||||
Ethernet1/24(u)
|
||||
Ethernet1/25(u)
|
||||
Ethernet1/26(u)
|
||||
Ethernet1/27(u)
|
||||
Ethernet1/28(u)
|
||||
Ethernet1/29(u)
|
||||
Ethernet1/30(u)
|
||||
Ethernet1/31(u)
|
||||
Ethernet1/32(u)
|
||||
Ethernet1/33(u)
|
||||
Ethernet1/34(u)
|
||||
Ethernet1/35(u)
|
||||
Ethernet1/36(u)
|
||||
Ethernet1/37(u)
|
||||
Ethernet1/38(u)
|
||||
Ethernet1/39(u)
|
||||
Ethernet1/40(u)
|
||||
Ethernet1/41(u)
|
||||
Ethernet1/42(u)
|
||||
Ethernet1/43(u)
|
||||
Ethernet1/44(u)
|
||||
Ethernet1/45(u)
|
||||
Ethernet1/46(u)
|
||||
Ethernet1/47(u)
|
||||
Ethernet1/48(u)
|
||||
Ethernet1/49(u)
|
||||
Ethernet1/50(u)
|
||||
Ethernet1/51(u)
|
||||
Ethernet1/52(u)
|
||||
Ethernet1/53(u)
|
||||
Ethernet1/54(u)
|
||||
2 VLAN0002 ACTIVE IPv6
|
||||
3 VLAN0003 ACTIVE IPv4,IPv6
|
||||
5 VLAN0005 ACTIVE IPv4,IPv6
|
||||
12 VLAN0012 ACTIVE IPv4,IPv6
|
||||
13 anil ACTIVE IPv4,IPv6
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
Maximum number of vrfs allowed: 65
|
||||
VRF default, FIB ID 0
|
||||
Router ID: 20.141.2.1 (automatic)
|
||||
RD 0:0
|
||||
Interfaces:
|
||||
Vlan1
|
||||
Vlan2
|
||||
Vlan13
|
||||
loopback0
|
||||
Ethernet1/5
|
||||
Ethernet1/6
|
||||
Ethernet1/7
|
||||
Ethernet1/8
|
||||
Ethernet1/9
|
||||
Ethernet1/11
|
||||
Ethernet1/12
|
||||
Ethernet1/13
|
||||
Ethernet1/44
|
||||
po1
|
||||
po2
|
||||
po3
|
||||
po4
|
||||
po6
|
||||
po7
|
||||
po8
|
||||
po9
|
||||
po10
|
||||
po11
|
||||
po12
|
||||
po13
|
||||
po14
|
||||
po15
|
||||
po16
|
||||
po17
|
||||
po18
|
||||
po19
|
||||
po21
|
||||
po22
|
||||
po23
|
||||
po24
|
||||
po25
|
||||
po26
|
||||
po27
|
||||
po28
|
||||
po29
|
||||
po30
|
||||
po31
|
||||
po32
|
||||
po33
|
||||
po34
|
||||
po35
|
||||
po36
|
||||
po37
|
||||
po38
|
||||
po39
|
||||
po40
|
||||
po41
|
||||
po42
|
||||
po43
|
||||
po44
|
||||
po45
|
||||
po46
|
||||
po47
|
||||
po48
|
||||
po49
|
||||
po50
|
||||
po51
|
||||
po52
|
||||
po53
|
||||
po54
|
||||
po55
|
||||
po56
|
||||
po57
|
||||
po58
|
||||
po59
|
||||
po60
|
||||
po61
|
||||
po62
|
||||
po63
|
||||
po64
|
||||
po65
|
||||
po66
|
||||
po67
|
||||
po1001
|
||||
po1002
|
||||
po1003
|
||||
po1004
|
||||
Ethernet1/1
|
||||
Ethernet1/2
|
||||
Ethernet1/3
|
||||
Ethernet1/4
|
||||
Ethernet1/10
|
||||
Ethernet1/14
|
||||
Ethernet1/15
|
||||
Ethernet1/16
|
||||
Ethernet1/17
|
||||
Ethernet1/18
|
||||
Ethernet1/19
|
||||
Ethernet1/20
|
||||
Ethernet1/21
|
||||
Ethernet1/22
|
||||
Ethernet1/23
|
||||
Ethernet1/24
|
||||
Ethernet1/25
|
||||
Ethernet1/26
|
||||
Ethernet1/27
|
||||
Ethernet1/28
|
||||
Ethernet1/29
|
||||
Ethernet1/30
|
||||
Ethernet1/31
|
||||
Ethernet1/32
|
||||
Ethernet1/34
|
||||
Ethernet1/35
|
||||
Ethernet1/36
|
||||
Ethernet1/37
|
||||
Ethernet1/38
|
||||
Ethernet1/39
|
||||
Ethernet1/40
|
||||
Ethernet1/41
|
||||
Ethernet1/42
|
||||
Ethernet1/43
|
||||
Ethernet1/45
|
||||
Ethernet1/46
|
||||
Ethernet1/47
|
||||
Ethernet1/48
|
||||
Ethernet1/49
|
||||
Ethernet1/50
|
||||
Ethernet1/51
|
||||
Ethernet1/52
|
||||
Ethernet1/53
|
||||
Ethernet1/54
|
||||
!
|
||||
VRF management, FIB ID 1
|
||||
Router ID: 10.241.107.39 (automatic)
|
||||
RD 0:0
|
||||
Interfaces:
|
||||
mgmt0
|
||||
!
|
||||
VRF test, FIB ID 2
|
||||
Router ID is not set
|
||||
RD 1:201
|
||||
Interfaces:
|
||||
Ethernet1/33
|
||||
!
|
||||
VRF test1, FIB ID 3
|
||||
Router ID is not set
|
||||
RD 1:202
|
||||
Interfaces:
|
||||
loopback1
|
||||
loopback2
|
||||
loopback3
|
||||
loopback4
|
||||
loopback5
|
||||
loopback6
|
||||
!
|
||||
VRF test2, FIB ID 4
|
||||
Router ID is not set
|
||||
RD 0:0
|
||||
Interfaces:
|
||||
!
|
||||
VRF test3, FIB ID 5
|
||||
Router ID is not set
|
||||
RD 1:203
|
||||
Interfaces:
|
||||
!
|
||||
VRF test4, FIB ID 6
|
||||
Router ID is not set
|
||||
RD 1:204
|
||||
Interfaces:
|
||||
!
|
||||
VRF test5, FIB ID 7
|
||||
Router ID is not set
|
||||
RD 1:205
|
||||
Interfaces:
|
||||
!
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
!
|
||||
version "10.8.0.42"
|
||||
!
|
||||
hostname ip10-241-107-39
|
||||
!
|
||||
vlan 13
|
||||
name dave
|
||||
!
|
||||
interface Ethernet1/9
|
||||
ip address 10.201.107.1 255.255.255.0
|
||||
ipv6 address dead::beaf/64
|
||||
description Bleh
|
||||
!
|
||||
interface Ethernet1/33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
microburst-detection enable threshold 25
|
||||
lldp tlv-select max-frame-size
|
||||
lacp port-priority 33
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
!
|
||||
end
|
|
@ -1,92 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Ethernet PVID Type Mode Status Reason Speed Port
|
||||
Interface NVLAN Ch#
|
||||
--------------------------------------------------------------------------------
|
||||
Ethernet1/1 33 eth access down Link not connected 10000 33
|
||||
Ethernet1/2 1 eth access down Link not connected 10000 1001
|
||||
Ethernet1/3 1 eth trunk down Link not connected 10000 1003
|
||||
Ethernet1/4 1 eth trunk down Link not connected 10000 1004
|
||||
Ethernet1/5 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/6 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/7 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/8 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/9 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/10 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/11 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/12 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/13 -- eth routed down Link not connected 10000 --
|
||||
Ethernet1/14 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/15 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/16 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/17 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/18 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/19 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/20 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/21 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/22 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/23 1 eth access down Link not connected 10000 11
|
||||
Ethernet1/24 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/25 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/26 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/27 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/28 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/29 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/30 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/31 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/32 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/33 33 eth access down Link not connected 10000 --
|
||||
Ethernet1/34 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/35 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/36 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/37 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/38 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/39 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/40 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/41 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/42 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/43 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/44 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/45 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/46 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/47 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/48 1 eth access down Link not connected 10000 --
|
||||
Ethernet1/49 1 eth access down Link not connected 40000 --
|
||||
Ethernet1/50 1 eth access down Link not connected 40000 --
|
||||
Ethernet1/51 1 eth access down Link not connected 40000 --
|
||||
Ethernet1/52 1 eth access down Link not connected 40000 --
|
||||
Ethernet1/53 1 eth access down Link not connected 40000 --
|
||||
Ethernet1/54 1 eth access down Link not connected 40000 --
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Port-channel PVID Type Mode Status Reason Speed Protocol
|
||||
Interface NVLAN
|
||||
--------------------------------------------------------------------------------
|
||||
po1 1 eth access down No link up members NA none
|
||||
po2 1 eth access down No link up members NA none
|
||||
po11 1 eth access down No link up members NA lacp
|
||||
po13 1 eth trunk down No link up members NA none
|
||||
po17 1 eth trunk down No link up members NA none
|
||||
po20 1 eth access down No link up members NA none
|
||||
po33 33 eth access down No link up members NA none
|
||||
po100 1 eth trunk down No link up members NA none
|
||||
po1001 1 eth access down No link up members NA lacp
|
||||
po1002 1 eth access down No link up members NA none
|
||||
po1003 1 eth trunk down No link up members NA lacp
|
||||
po1004 1 eth trunk down No link up members NA lacp
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Port VRF Status IP Address Speed MTU
|
||||
--------------------------------------------------------------------------------
|
||||
mgmt0 management up 10.241.107.39 1000 1500
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Interface Secondary VLAN(Type) Status Reason
|
||||
-------------------------------------------------------------------------------
|
||||
Vlan1 -- down VLAN is down
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Interface Status Description
|
||||
--------------------------------------------------------------------------------
|
||||
loopback0 up --
|
||||
loopback3 up --
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
Interface Ethernet1/33
|
||||
Switchport : enabled
|
||||
Switchport mode : access
|
||||
Ingress filter : enable
|
||||
Tag Ingress PVID : disabled
|
||||
Acceptable frame types : all
|
||||
Default/Native Vlan : 1
|
||||
Configured Vlans : 1
|
||||
Enabled Vlans : 1
|
||||
Egress-Tagged Vlans : None
|
||||
Private-VLAN : Disabled
|
||||
Private-VLAN Port Type : None
|
||||
Primary/Secondary VLAN : None/None
|
|
@ -1,14 +0,0 @@
|
|||
Interface Ethernet1/45
|
||||
Switchport : enabled
|
||||
Switchport mode : access
|
||||
Ingress filter : enable
|
||||
Tag Ingress PVID : disabled
|
||||
Acceptable frame types : all
|
||||
Default/Native Vlan : 1
|
||||
Configured Vlans : 1
|
||||
Enabled Vlans : 1
|
||||
Egress-Tagged Vlans : None
|
||||
Private-VLAN : Disabled
|
||||
Private-VLAN Port Type : None
|
||||
Primary/Secondary VLAN : None/None
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Interface Mac-Address Burn-in Mac-Address
|
||||
--------------------------------------------------------------------------------
|
||||
Ethernet1/1 a48c.db33.bc02 a48c.db33.bc02
|
||||
Ethernet1/2 a48c.db33.bc03 a48c.db33.bc03
|
||||
Ethernet1/3 a48c.db33.bc04 a48c.db33.bc04
|
||||
Ethernet1/4 a48c.db33.bc05 a48c.db33.bc05
|
||||
Ethernet1/5 a48c.db33.bc01 a48c.db33.bc06
|
||||
Ethernet1/6 a48c.db33.bc01 a48c.db33.bc07
|
||||
Ethernet1/7 a48c.db33.bc01 a48c.db33.bc08
|
||||
Ethernet1/8 a48c.db33.bc01 a48c.db33.bc09
|
||||
Ethernet1/9 a48c.db33.bc0a a48c.db33.bc0a
|
||||
Ethernet1/10 a48c.db33.bc0b a48c.db33.bc0b
|
||||
Ethernet1/11 a48c.db33.bc01 a48c.db33.bc0c
|
||||
Ethernet1/12 a48c.db33.bc01 a48c.db33.bc0d
|
||||
Ethernet1/13 a48c.db33.bc01 a48c.db33.bc0e
|
||||
Ethernet1/14 a48c.db33.bc0f a48c.db33.bc0f
|
||||
Ethernet1/15 a48c.db33.bc10 a48c.db33.bc10
|
||||
Ethernet1/16 a48c.db33.bc11 a48c.db33.bc11
|
||||
Ethernet1/17 a48c.db33.bc12 a48c.db33.bc12
|
||||
Ethernet1/18 a48c.db33.bc13 a48c.db33.bc13
|
||||
Ethernet1/19 a48c.db33.bc14 a48c.db33.bc14
|
||||
Ethernet1/20 a48c.db33.bc15 a48c.db33.bc15
|
||||
Ethernet1/21 a48c.db33.bc16 a48c.db33.bc16
|
||||
Ethernet1/22 a48c.db33.bc17 a48c.db33.bc17
|
||||
Ethernet1/23 a48c.db33.bc18 a48c.db33.bc18
|
||||
Ethernet1/24 a48c.db33.bc19 a48c.db33.bc19
|
||||
Ethernet1/25 a48c.db33.bc1a a48c.db33.bc1a
|
||||
Ethernet1/26 a48c.db33.bc1b a48c.db33.bc1b
|
||||
Ethernet1/27 a48c.db33.bc1c a48c.db33.bc1c
|
||||
Ethernet1/28 a48c.db33.bc1d a48c.db33.bc1d
|
||||
Ethernet1/29 a48c.db33.bc1e a48c.db33.bc1e
|
||||
Ethernet1/30 a48c.db33.bc1f a48c.db33.bc1f
|
||||
Ethernet1/31 a48c.db33.bc20 a48c.db33.bc20
|
||||
Ethernet1/32 a48c.db33.bc21 a48c.db33.bc21
|
||||
Ethernet1/33 a48c.db33.bc22 a48c.db33.bc22
|
||||
Ethernet1/34 a48c.db33.bc23 a48c.db33.bc23
|
||||
Ethernet1/35 a48c.db33.bc24 a48c.db33.bc24
|
||||
Ethernet1/36 a48c.db33.bc25 a48c.db33.bc25
|
||||
Ethernet1/37 a48c.db33.bc26 a48c.db33.bc26
|
||||
Ethernet1/38 a48c.db33.bc27 a48c.db33.bc27
|
||||
Ethernet1/39 a48c.db33.bc28 a48c.db33.bc28
|
||||
Ethernet1/40 a48c.db33.bc29 a48c.db33.bc29
|
||||
Ethernet1/41 a48c.db33.bc2a a48c.db33.bc2a
|
||||
Ethernet1/42 a48c.db33.bc2b a48c.db33.bc2b
|
||||
Ethernet1/43 a48c.db33.bc2c a48c.db33.bc2c
|
||||
Ethernet1/44 a48c.db33.bc2d a48c.db33.bc2d
|
||||
Ethernet1/45 a48c.db33.bc2e a48c.db33.bc2e
|
||||
Ethernet1/46 a48c.db33.bc2f a48c.db33.bc2f
|
||||
Ethernet1/47 a48c.db33.bc30 a48c.db33.bc30
|
||||
Ethernet1/48 a48c.db33.bc31 a48c.db33.bc31
|
||||
Ethernet1/49 a48c.db33.bc32 a48c.db33.bc32
|
||||
Ethernet1/50 a48c.db33.bc33 a48c.db33.bc33
|
||||
Ethernet1/51 a48c.db33.bc34 a48c.db33.bc34
|
||||
Ethernet1/52 a48c.db33.bc35 a48c.db33.bc35
|
||||
Ethernet1/53 a48c.db33.bc36 a48c.db33.bc36
|
||||
Ethernet1/54 a48c.db33.bc37 a48c.db33.bc37
|
||||
mgmt0 a48c.db33.bc00 a48c.db33.bc00
|
||||
po1 0e00.0000.0001 (not set)
|
||||
po2 0e00.0000.0002 (not set)
|
||||
po11 a48c.db33.bc18 (not set)
|
||||
po13 0e00.0000.0003 (not set)
|
||||
po17 0e00.0000.0004 (not set)
|
||||
po20 0e00.0000.0005 (not set)
|
||||
po33 a48c.db33.bc02 (not set)
|
||||
po100 0e00.0000.0006 (not set)
|
||||
po1001 a48c.db33.bc03 (not set)
|
||||
po1002 0e00.0000.0007 (not set)
|
||||
po1003 a48c.db33.bc04 (not set)
|
||||
po1004 a48c.db33.bc05 (not set)
|
||||
Vlan1 a48c.db33.bc01 (not set)
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
--------------------------------------------------------------------------------
|
||||
Port Name Status Vlan Duplex Speed Type
|
||||
--------------------------------------------------------------------------------
|
||||
Ethernet1/1 Link 1 to LP21 notconnec 33 full 10000 eth
|
||||
Ethernet1/2 Link 2 to LP21 notconnec 1 full 10000 eth
|
||||
Ethernet1/3 Link 1 to LP22 notconnec trunk full 10000 eth
|
||||
Ethernet1/4 Link 2 to LP22 notconnec trunk full 10000 eth
|
||||
Ethernet1/5 Link 1 to LP23 notconnec routed full 10000 eth
|
||||
Ethernet1/6 Link 2 to LP23 notconnec routed full 10000 eth
|
||||
Ethernet1/7 Link 1 to LP24 notconnec routed full 10000 eth
|
||||
Ethernet1/8 Link 2 to LP24 notconnec routed full 10000 eth
|
||||
Ethernet1/9 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/10 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/11 -- notconnec routed full 10000 eth
|
||||
Ethernet1/12 -- notconnec routed full 10000 eth
|
||||
Ethernet1/13 -- notconnec routed full 10000 eth
|
||||
Ethernet1/14 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/15 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/16 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/17 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/18 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/19 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/20 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/21 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/22 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/23 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/24 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/25 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/26 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/27 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/28 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/29 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/30 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/31 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/32 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/33 Hentammoo notconnec 33 full 10000 eth
|
||||
Ethernet1/34 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/35 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/36 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/37 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/38 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/39 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/40 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/41 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/42 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/43 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/44 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/45 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/46 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/47 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/48 -- notconnec 1 full 10000 eth
|
||||
Ethernet1/49 -- notconnec 1 full 40000 eth
|
||||
Ethernet1/50 -- notconnec 1 full 40000 eth
|
||||
Ethernet1/51 -- notconnec 1 full 40000 eth
|
||||
Ethernet1/52 -- notconnec 1 full 40000 eth
|
||||
Ethernet1/53 -- notconnec 1 full 40000 eth
|
||||
Ethernet1/54 -- notconnec 1 full 40000 eth
|
||||
po1 -- notconnec 1 full NA eth
|
||||
po2 -- notconnec 1 full NA eth
|
||||
po11 -- notconnec 1 full NA eth
|
||||
po13 -- notconnec trunk full NA eth
|
||||
po17 -- notconnec trunk full NA eth
|
||||
po20 -- notconnec 1 full NA eth
|
||||
po33 Hentammoo notconnec 33 full NA eth
|
||||
po100 -- notconnec trunk full NA eth
|
||||
po1001 -- notconnec 1 full NA eth
|
||||
po1002 -- notconnec 1 full NA eth
|
||||
po1003 -- notconnec trunk full NA eth
|
||||
po1004 -- notconnec trunk full NA eth
|
||||
mgmt0 -- connected routed full 1000 eth
|
||||
loopback0 -- connected routed half NA eth
|
||||
loopback3 -- connected routed half NA eth
|
||||
Vlan1 -- notconnec routed auto NA --
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
Interface IP-Address Admin-Status Link-Status VRF
|
||||
Ethernet1/5 20.131.1.1 up down default
|
||||
Ethernet1/6 20.131.2.1 up down default
|
||||
Ethernet1/7 20.141.1.1 up down default
|
||||
Ethernet1/8 20.141.2.1 up down default
|
||||
Ethernet1/11 1.1.1.2 up down default
|
||||
Ethernet1/12 100.10.10.10 up down default
|
||||
Ethernet1/13 10.241.107.54 up down default
|
||||
mgmt0 10.241.107.39 up up management
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
Interface IPv6 Address/Link-local Address Admin-Status Link-Status VRF
|
||||
loopback0 fe80::200:ff:fe00:0 up up default
|
||||
loopback3 fe80::200:ff:fe00:0 up up default
|
||||
mgmt0 fe80::a68c:dbff:fe33:bc00 up up management
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
Capability codes:
|
||||
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
|
||||
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
|
||||
Device ID Local Intf Hold-time Capability Port ID
|
||||
INDIA-LAB-1-C3750X.l... mgmt0 120 BR Gi1/0/30
|
||||
|
||||
Total entries displayed: 1
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
PID MemAlloc StkSize RSSMem LibMem StackBase/Ptr Process
|
||||
----- -------- ---------- ------- ------- ------------------ ----------
|
||||
1 6204 8388608 12312 5380 bff01bc0/bff01590 nsm
|
||||
4 2608 8388608 5264 5312 bfa92080/bfa91ab0 ospfd
|
||||
7 14152 8388608 5924 5284 bfaa7250/bfaa6c20 hostpd
|
||||
10 2092 8388608 4652 5312 bfafcbf0/bfafc620 mribd
|
||||
11 2024 8388608 3108 5284 bfb7c650/bfb7c080 pimd
|
||||
14 2016 8388608 4896 5312 bff0ff10/bff0f940 lacpd
|
||||
17 48608 8388608 36200 5312 bfc10e30/bfc10830 mstpd
|
||||
24 2520 8388608 5340 5312 bf90ad00/bf90a730 onmd
|
||||
26 228628 8388608 77312 5376 bfb34e10/bfb34830 hsl
|
||||
28 2020 8388608 4784 5312 bff3c410/bff3be10 oam
|
||||
39 21396 8388608 8184 5312 bf9b1a50/bf9b1460 vrrpd
|
||||
40 2480 8388608 4064 5336 bfe5f020/bfe5ea20 ndd
|
||||
42 2860 8388608 5672 5364 bfe83aa0/bfe83470 ribd
|
||||
44 3528 8388608 7140 5328 bf90b720/bf90b110 bgpd
|
||||
45 1772 8388608 4404 5312 bf9fc250/bf9fbc80 hostmibd
|
||||
46 39564 8388608 25632 5428 bfe30db0/bfe30780 l2mribd
|
||||
62 1876 8388608 3920 5312 bf81c210/bf81bc40 sysmgr
|
||||
63 94380 8388608 13804 5292 bfcb67d0/bfcb61d0 nwvd
|
||||
64 1920 8388608 5664 5676 bfc28470/bfc27ea0 ovsdbd
|
||||
65 96548 8388608 55168 5292 bfdbcf80/bfdbc980 vlagd
|
||||
66 1756 8388608 3808 5284 bfa15ab0/bfa154e0 slpd
|
||||
71 2116 8388608 5880 10076 bfe8abd0/bfe8a600 npad
|
||||
72 2220 8388608 5452 7936 bf9e6da0/bf9e67d0 hscd
|
||||
73 1920 8388608 2760 5284 bfbc6cd0/bfbc6700 dhcpsnpd
|
||||
74 58620 8388608 16168 9956 bfe1af70/bfe1a970 telemetryd
|
||||
75 1756 8388608 3456 5284 bfb21da0/bfb217d0 securityd
|
||||
76 2152 8388608 4216 5284 bfc36900/bfc36330 l2fd
|
||||
77 1920 8388608 3876 5284 bf91e480/bf91dec0 sflowd
|
||||
78 1888 8388608 3772 5284 bffd10c0/bffd0af0 qosd
|
||||
69 70520 8388608 5584 5260 bfca0980/bfca0490 platform_mgr
|
||||
70 26828 8388608 2116 2040 bfce09c0/bfce0440 service_mgr
|
||||
|
||||
total used free shared buff/cache available
|
||||
Mem: 4081464 442136 3144092 153168 495236 3452732
|
||||
Swap: 0 0 0
|
||||
|
|
@ -1,331 +0,0 @@
|
|||
!
|
||||
version "10.8.0.42"
|
||||
!
|
||||
hostname ip10-241-107-39
|
||||
!
|
||||
banner motd NMS India CNOS
|
||||
banner motd NMS India CNOS G8272
|
||||
!
|
||||
clock timezone EDT 0 0
|
||||
!
|
||||
logging console 7
|
||||
vrf context management
|
||||
ip route 0.0.0.0/0 10.241.107.1
|
||||
!
|
||||
!
|
||||
port-channel load-balance ethernet destination-mac
|
||||
port-channel load-balance ethernet source-interface
|
||||
feature telnet
|
||||
ip domain-name labs.lenovo.com vrf management
|
||||
ip domain-list labs.lenovo.com vrf management
|
||||
ip name-server 10.241.104.120 vrf management
|
||||
ip name-server 10.240.0.10 vrf management
|
||||
ip host ip10-241-107-39.labs.lenovo.com 10.241.107.39 vrf management
|
||||
ip host ip10-241-107-39 10.241.107.39 vrf management
|
||||
ip domain-name labs.lenovo.com vrf default
|
||||
ip domain-list labs.lenovo.com vrf default
|
||||
ip name-server 10.240.0.10 vrf default
|
||||
ip name-server 10.241.104.120 vrf default
|
||||
ip host ip10-241-107-39.labs.lenovo.com 10.241.107.39 vrf default
|
||||
ip host ip10-241-107-39 10.241.107.39 vrf default
|
||||
ntp server 173.230.154.254 prefer
|
||||
ntp server 97.127.86.33 prefer
|
||||
ntp server 129.250.35.250 prefer
|
||||
ntp server 174.136.103.130 prefer
|
||||
ntp server 69.10.161.7 prefer
|
||||
ntp server 96.226.123.196 prefer
|
||||
ntp server 104.238.179.130 prefer
|
||||
ntp server 108.61.73.244 prefer
|
||||
ntp server 208.75.89.4 prefer
|
||||
snmp-server community public group network-operator
|
||||
snmp-server community private group network-admin
|
||||
snmp-server contact Ralph
|
||||
username admin role network-admin password encrypted $6$bJoWyEu/$9pzSgFPAKGRm1stpTCEl3I39htbjxiFCfhqiHag1NQiKHv/IiLQ2lYW0V3p7p72SgSmVHp38em9P9R/EdePpk/
|
||||
logging server 10.241.107.231
|
||||
logging server 10.241.107.222
|
||||
feature restApi
|
||||
ovsdb pki ovsdb_mgmt vrf management
|
||||
ovsdb pki ovsdb_default vrf default
|
||||
lacp system-priority 32769
|
||||
vlag tier-id 313
|
||||
vlag priority 1313
|
||||
vlag isl port-channel 100
|
||||
vlag hlthchk keepalive-attempts 5
|
||||
vlag hlthchk peer-ip 1.2.3.4
|
||||
vlag auto-recovery 266
|
||||
vlag startup-delay 323
|
||||
vlag enable
|
||||
vlag instance 1 port-channel 1003
|
||||
vlag instance 1 enable
|
||||
vlag instance 2 port-channel 20
|
||||
vlag instance 2 enable
|
||||
vlag instance 12 port-channel 23
|
||||
vlag instance 33 port-channel 333
|
||||
vlag instance 33 enable
|
||||
spanning-tree mode mst
|
||||
telemetry heartbeat enabled interval 15
|
||||
!
|
||||
policy-map type control-plane copp-system-policy
|
||||
class type control-plane copp-s-pvst-bpdu
|
||||
police pps 500
|
||||
class type control-plane copp-s-ecp
|
||||
police pps 3000
|
||||
class type control-plane copp-s-igmp
|
||||
police pps 3000
|
||||
!
|
||||
vlan 1-2
|
||||
no flood ipv4
|
||||
!
|
||||
vlan 3
|
||||
!
|
||||
vlan 5
|
||||
!
|
||||
vlan 12
|
||||
!
|
||||
vlan 13
|
||||
name dave
|
||||
!
|
||||
vlan dot1q tag native egress-only
|
||||
!
|
||||
interface Ethernet1/1
|
||||
description Link 1 to LP21
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
channel-group 33 mode on
|
||||
!
|
||||
interface Ethernet1/2
|
||||
description Link 2 to LP21
|
||||
channel-group 1001 mode active
|
||||
!
|
||||
interface Ethernet1/3
|
||||
description Link 1 to LP22
|
||||
switchport mode trunk
|
||||
channel-group 1003 mode active
|
||||
!
|
||||
interface Ethernet1/4
|
||||
description Link 2 to LP22
|
||||
switchport mode trunk
|
||||
channel-group 1004 mode active
|
||||
!
|
||||
interface Ethernet1/5
|
||||
description Link 1 to LP23
|
||||
no switchport
|
||||
ip address 20.131.1.1/30
|
||||
!
|
||||
interface Ethernet1/6
|
||||
description Link 2 to LP23
|
||||
no switchport
|
||||
ip address 20.131.2.1/30
|
||||
!
|
||||
interface Ethernet1/7
|
||||
description Link 1 to LP24
|
||||
no switchport
|
||||
ip address 20.141.1.1/30
|
||||
!
|
||||
interface Ethernet1/8
|
||||
description Link 2 to LP24
|
||||
no switchport
|
||||
ip address 20.141.2.1/30
|
||||
!
|
||||
interface Ethernet1/9
|
||||
!
|
||||
interface Ethernet1/10
|
||||
!
|
||||
interface Ethernet1/11
|
||||
no switchport
|
||||
mtu 1402
|
||||
ip address 1.1.1.2/8
|
||||
!
|
||||
interface Ethernet1/12
|
||||
no switchport
|
||||
ip address 100.10.10.10/24
|
||||
!
|
||||
interface Ethernet1/13
|
||||
no switchport
|
||||
ip address 10.241.107.54/24
|
||||
vrrp 254
|
||||
address 10.241.107.55
|
||||
priority 254
|
||||
no shutdown
|
||||
ip arp timeout 1500
|
||||
!
|
||||
interface Ethernet1/14
|
||||
!
|
||||
interface Ethernet1/15
|
||||
!
|
||||
interface Ethernet1/16
|
||||
!
|
||||
interface Ethernet1/17
|
||||
!
|
||||
interface Ethernet1/18
|
||||
!
|
||||
interface Ethernet1/19
|
||||
!
|
||||
interface Ethernet1/20
|
||||
!
|
||||
interface Ethernet1/21
|
||||
!
|
||||
interface Ethernet1/22
|
||||
!
|
||||
interface Ethernet1/23
|
||||
channel-group 11 mode active
|
||||
lacp port-priority 32769
|
||||
!
|
||||
interface Ethernet1/24
|
||||
!
|
||||
interface Ethernet1/25
|
||||
!
|
||||
interface Ethernet1/26
|
||||
!
|
||||
interface Ethernet1/27
|
||||
!
|
||||
interface Ethernet1/28
|
||||
!
|
||||
interface Ethernet1/29
|
||||
!
|
||||
interface Ethernet1/30
|
||||
!
|
||||
interface Ethernet1/31
|
||||
!
|
||||
interface Ethernet1/32
|
||||
!
|
||||
interface Ethernet1/33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
microburst-detection enable threshold 25
|
||||
lldp tlv-select max-frame-size
|
||||
lacp port-priority 33
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
interface Ethernet1/34
|
||||
!
|
||||
interface Ethernet1/35
|
||||
!
|
||||
interface Ethernet1/36
|
||||
!
|
||||
interface Ethernet1/37
|
||||
!
|
||||
interface Ethernet1/38
|
||||
!
|
||||
interface Ethernet1/39
|
||||
!
|
||||
interface Ethernet1/40
|
||||
!
|
||||
interface Ethernet1/41
|
||||
!
|
||||
interface Ethernet1/42
|
||||
!
|
||||
interface Ethernet1/43
|
||||
!
|
||||
interface Ethernet1/44
|
||||
!
|
||||
interface Ethernet1/45
|
||||
!
|
||||
interface Ethernet1/46
|
||||
!
|
||||
interface Ethernet1/47
|
||||
!
|
||||
interface Ethernet1/48
|
||||
!
|
||||
interface Ethernet1/49
|
||||
!
|
||||
interface Ethernet1/50
|
||||
!
|
||||
interface Ethernet1/51
|
||||
!
|
||||
interface Ethernet1/52
|
||||
!
|
||||
interface Ethernet1/53
|
||||
!
|
||||
interface Ethernet1/54
|
||||
!
|
||||
interface loopback0
|
||||
no switchport
|
||||
!
|
||||
interface mgmt0
|
||||
no switchport
|
||||
vrf member management
|
||||
no ip address dhcp
|
||||
ip address 10.241.107.39/24
|
||||
no ipv6 address dhcp
|
||||
!
|
||||
interface Vlan1
|
||||
no switchport
|
||||
!
|
||||
interface port-channel1
|
||||
!
|
||||
interface port-channel2
|
||||
!
|
||||
interface port-channel11
|
||||
lacp min-links 2
|
||||
!
|
||||
interface port-channel13
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel17
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel20
|
||||
!
|
||||
interface port-channel33
|
||||
description Hentammoo
|
||||
load-interval counter 2 33
|
||||
switchport access vlan 33
|
||||
storm-control broadcast level 12.50
|
||||
mtu 66
|
||||
spanning-tree mst 33-35 cost 33
|
||||
spanning-tree bpduguard enable
|
||||
!
|
||||
interface port-channel100
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel1001
|
||||
!
|
||||
interface port-channel1002
|
||||
!
|
||||
interface port-channel1003
|
||||
switchport mode trunk
|
||||
!
|
||||
interface port-channel1004
|
||||
switchport mode trunk
|
||||
!
|
||||
router bgp 33
|
||||
router-id 1.2.3.4
|
||||
bestpath always-compare-med
|
||||
cluster-id 1.2.3.4
|
||||
confederation identifier 333
|
||||
enforce-first-as
|
||||
bgp as-local-count 33
|
||||
bestpath compare-confed-aspath
|
||||
maxas-limit 333
|
||||
graceful-restart-helper
|
||||
graceful-restart stalepath-time 333
|
||||
timers bgp 333 3333
|
||||
address-family ipv4 unicast
|
||||
synchronization
|
||||
network 0.0.0.0 backdoor
|
||||
dampening 13 233 333 15 33
|
||||
neighbor 10.241.107.40 remote-as 13
|
||||
bfd
|
||||
address-family ipv4 unicast
|
||||
next-hop-self
|
||||
!
|
||||
route-map anil permit 10
|
||||
!
|
||||
ip arp timeout 1000
|
||||
!
|
||||
line con 0
|
||||
line vty 0
|
||||
exec-timeout 90 0
|
||||
line vty 1 39
|
||||
!
|
||||
!
|
||||
!
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
Interface Ethernet1/33
|
||||
Switchport : enabled
|
||||
Switchport mode : access
|
||||
Ingress filter : enable
|
||||
Tag Ingress PVID : disabled
|
||||
Acceptable frame types : all
|
||||
Default/Native Vlan : 1
|
||||
Configured Vlans : 1
|
||||
Enabled Vlans : 1
|
||||
Egress-Tagged Vlans : None
|
||||
Private-VLAN : Disabled
|
||||
Private-VLAN Port Type : None
|
||||
Primary/Secondary VLAN : None/None
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue