diff options
author | Ansible Core Team <info@ansible.com> | 2020-03-09 10:40:26 +0100 |
---|---|---|
committer | Matt Martz <matt@sivel.net> | 2020-03-23 17:14:21 +0100 |
commit | 32bf1b81152779cbbdf23a03ac8a7afeac585832 (patch) | |
tree | 34a57228f4e4a2963c0f08fb1f6048ad38c744cf /test/units/modules | |
parent | Migrated to containers.podman (diff) | |
download | ansible-32bf1b81152779cbbdf23a03ac8a7afeac585832.tar.xz ansible-32bf1b81152779cbbdf23a03ac8a7afeac585832.zip |
Migrated to frr.frr
Diffstat (limited to 'test/units/modules')
7 files changed, 0 insertions, 546 deletions
diff --git a/test/units/modules/network/frr/fixtures/frr_bgp_config b/test/units/modules/network/frr/fixtures/frr_bgp_config deleted file mode 100644 index eeecbe7ae6..0000000000 --- a/test/units/modules/network/frr/fixtures/frr_bgp_config +++ /dev/null @@ -1,24 +0,0 @@ -! -router bgp 64496 - bgp router-id 192.0.2.1 - bgp log-neighbor-changes - neighbor 192.51.100.1 remote-as 64496 - neighbor 192.51.100.1 timers 120 360 - neighbor 198.51.100.3 remote-as 64498 - neighbor 2.2.2.2 remote-as 500 - neighbor 2.2.2.2 description EBGP_PEER - ! - address-family ipv4 unicast - network 192.0.1.0/24 route-map RMAP_1 - network 198.51.100.0/24 route-map RMAP_2 - redistribute static metric 100 - redistribute eigrp metric 10 route-map RMAP_3 - neighbor 2.2.2.2 remove-private-AS - neighbor 2.2.2.2 maximum-prefix 100 - exit-address-family - ! - address-family ipv4 multicast - network 10.0.0.0/8 route-map RMAP_1 - network 20.0.0.0/8 route-map RMAP_2 - exit-address-family -! diff --git a/test/units/modules/network/frr/fixtures/frr_facts_show_interface b/test/units/modules/network/frr/fixtures/frr_facts_show_interface deleted file mode 100644 index 62f08881f5..0000000000 --- a/test/units/modules/network/frr/fixtures/frr_facts_show_interface +++ /dev/null @@ -1,36 +0,0 @@ -Interface eth0 is up, line protocol is up - Link ups: 0 last: (never) - Link downs: 0 last: (never) - vrf: Default-IP-Routing-Table - index 2 metric 0 mtu 1450 speed 0 - flags: <UP,BROADCAST,RUNNING,MULTICAST> - Type: Ethernet - HWaddr: fa:16:3e:d4:32:b2 - bandwidth 4048 Mbps - inet 192.168.1.8/24 broadcast 192.168.1.255 - inet6 fe80::f816:3eff:fed4:32b2/64 - Interface Type Other -Interface eth1 is up, line protocol is up - Link ups: 0 last: (never) - Link downs: 0 last: (never) - vrf: Default-IP-Routing-Table - Description: Secondary Interface - index 3 metric 0 mtu 1500 speed 0 - flags: <UP,BROADCAST,RUNNING,MULTICAST> - Type: Ethernet - HWaddr: fa:16:3e:95:88:f7 - inet 192.168.1.21/24 broadcast 192.168.1.255 - inet 192.168.1.19/24 broadcast 192.168.1.255 secondary - inet 192.168.1.18/24 broadcast 192.168.1.255 secondary - inet6 fe80::f816:3eff:fe95:88f7/64 - inet6 3ffe:506::1/48 - inet6 3ffe:504::1/48 - Interface Type Other -Interface lo is up, line protocol is up - Link ups: 0 last: (never) - Link downs: 0 last: (never) - vrf: Default-IP-Routing-Table - index 1 metric 0 mtu 65536 speed 0 - flags: <UP,LOOPBACK,RUNNING> - Type: Loopback - Interface Type Other diff --git a/test/units/modules/network/frr/fixtures/frr_facts_show_memory b/test/units/modules/network/frr/fixtures/frr_facts_show_memory deleted file mode 100644 index d64a9a4c5c..0000000000 --- a/test/units/modules/network/frr/fixtures/frr_facts_show_memory +++ /dev/null @@ -1,82 +0,0 @@ -Memory statistics for zebra: -System allocator statistics: - Total heap allocated: 4200 KiB - Holding block headers: 0 bytes - Used small blocks: 0 bytes - Used ordinary blocks: 2927 KiB - Free small blocks: 2096 bytes - Free ordinary blocks: 1273 KiB - Ordinary blocks: 14 - Small blocks: 60 - Holding blocks: 0 -(see system documentation for 'mallinfo' for meaning) ---- qmem libfrr --- -Buffer : 18 24 448 -Buffer data : 1 4120 4120 -Host config : 4 (variably sized) 96 -Command Tokens : 3162 72 228128 -Command Token Text : 2362 (variably sized) 77344 -Command Token Help : 2362 (variably sized) 56944 -Command Argument : 2 (variably sized) 48 -Command Argument Name : 534 (variably sized) 12912 -FRR POSIX Thread : 28 (variably sized) 2016 -POSIX synchronization primitives: 28 (variably sized) 1344 -Graph : 24 8 576 -Graph Node : 3744 32 150112 -Hash : 2495 (variably sized) 119880 -Hash Bucket : 778 32 31296 -Hash Index : 1248 (variably sized) 363040 -Hook entry : 12 48 672 -Interface : 3 248 744 -Connected : 8 40 320 -Informational Link Parameters : 1 96 104 -Link List : 43 40 1720 -Link Node : 1308 24 31456 -Logging : 1 80 88 -Temporary memory : 23 (variably sized) 42584 -Nexthop : 27 112 3256 -NetNS Context : 2 (variably sized) 128 -NetNS Name : 1 18 24 -Priority queue : 15 32 600 -Priority queue data : 15 256 3960 -Prefix : 12 48 672 -Privilege information : 2 (variably sized) 80 -Stream : 36 (variably sized) 591264 -Stream FIFO : 28 64 2016 -Route table : 14 48 784 -Route node : 43 (variably sized) 4920 -Thread : 51 176 9384 -Thread master : 59 (variably sized) 251016 -Thread Poll Info : 30 8192 246000 -Thread stats : 52 64 3744 -Vector : 7543 16 181432 -Vector index : 7543 (variably sized) 246776 -VRF : 1 184 184 -VRF bit-map : 28 8 672 -VTY : 6 (variably sized) 19440 -Work queue : 2 (variably sized) 224 -Work queue name string : 1 22 24 -Redistribution instance IDs : 1 2 24 ---- qmem Label Manager --- -Label Manager Chunk : 1 16 24 ---- qmem zebra --- -ZEBRA VRF : 1 656 664 -Route Entry : 27 80 2392 -RIB destination : 19 48 1080 -RIB table info : 4 16 96 -Nexthop tracking object : 2 200 400 -Zebra Name Space : 1 312 312 -PTM BFD process registration table.: 3 32 120 ---- qmem Table Manager --- - -Memory statistics for ripd: -System allocator statistics: - Total heap allocated: 936 KiB - Holding block headers: 0 bytes - Used small blocks: 0 bytes - Used ordinary blocks: 901 KiB - Free small blocks: 1504 bytes - Free ordinary blocks: 35 KiB - Ordinary blocks: 4 - Small blocks: 44 - Holding blocks: 0 diff --git a/test/units/modules/network/frr/fixtures/frr_facts_show_version b/test/units/modules/network/frr/fixtures/frr_facts_show_version deleted file mode 100644 index daec039dfc..0000000000 --- a/test/units/modules/network/frr/fixtures/frr_facts_show_version +++ /dev/null @@ -1,16 +0,0 @@ -FRRouting 6.0 (rtr1). -Copyright 1996-2005 Kunihiro Ishiguro, et al. -configured with: - '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--program-prefix=' - '--disable-dependency-tracking' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' - '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' - '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' - '--infodir=/usr/share/info' '--sbindir=/usr/lib/frr' '--sysconfdir=/etc/frr' '--localstatedir=/var/run/frr' - '--disable-static' '--disable-werror' '--enable-irdp' '--enable-multipath=256' '--enable-vtysh' - '--enable-ospfclient' '--enable-ospfapi' '--enable-rtadv' '--enable-ldpd' '--enable-pimd' - '--enable-pbrd' '--enable-nhrpd' '--enable-eigrpd' '--enable-babeld' '--enable-user=frr' - '--enable-group=frr' '--enable-vty-group=frrvty' '--enable-fpm' '--enable-watchfrr' '--disable-bgp-vnc' - '--enable-isisd' '--enable-systemd' '--disable-rpki' '--enable-bfdd' 'build_alias=x86_64-redhat-linux-gnu' - 'host_alias=x86_64-redhat-linux-gnu' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' - 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong - --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,-z,relro ' diff --git a/test/units/modules/network/frr/frr_module.py b/test/units/modules/network/frr/frr_module.py deleted file mode 100644 index b14d1fdb26..0000000000 --- a/test/units/modules/network/frr/frr_module.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import os -import json - -from units.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 TestFrrModule(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 diff --git a/test/units/modules/network/frr/test_frr_bgp.py b/test/units/modules/network/frr/test_frr_bgp.py deleted file mode 100644 index 878c8fc99a..0000000000 --- a/test/units/modules/network/frr/test_frr_bgp.py +++ /dev/null @@ -1,199 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from ansible.module_utils.network.frr.providers.cli.config.bgp.process import Provider -from ansible.modules.network.frr import frr_bgp -from .frr_module import TestFrrModule, load_fixture - - -class TestFrrBgpModule(TestFrrModule): - module = frr_bgp - - def setUp(self): - super(TestFrrBgpModule, self).setUp() - self._bgp_config = load_fixture('frr_bgp_config') - - def test_frr_bgp(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, router_id='192.0.2.2', networks=None, - address_family=None), operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['router bgp 64496', 'bgp router-id 192.0.2.2', 'exit']) - - def test_frr_bgp_idempotent(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, router_id='192.0.2.1', networks=None, - address_family=None), operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_remove(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, networks=None, - address_family=None), operation='delete')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['no router bgp 64496']) - - def test_frr_bgp_neighbor(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, neighbors=[dict(neighbor='192.51.100.2', remote_as=64496)], - networks=None, address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, ['router bgp 64496', 'neighbor 192.51.100.2 remote-as 64496', 'exit']) - - def test_frr_bgp_neighbor_idempotent(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, neighbors=[dict(neighbor='192.51.100.1', remote_as=64496, - timers=dict(keepalive=120, holdtime=360))], - networks=None, address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_network(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, networks=[dict(prefix='192.0.2.0', masklen=24, route_map='RMAP_1')], - address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(sorted(commands), sorted(['router bgp 64496', 'network 192.0.2.0/24 route-map RMAP_1', 'exit'])) - - def test_frr_bgp_network_idempotent(self): - obj = Provider(params=dict(config=dict(bgp_as=64496, networks=[dict(prefix='192.0.1.0', masklen=24, route_map='RMAP_1'), - dict(prefix='198.51.100.0', masklen=24, route_map='RMAP_2')], - address_family=None), - operation='merge')) - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_address_family_redistribute(self): - rd_1 = dict(protocol='ospf', id='233', metric=90, route_map=None) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='unicast', redistribute=[rd_1])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'address-family ipv4 unicast', 'redistribute ospf 233 metric 90', - 'exit-address-family', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_frr_bgp_address_family_redistribute_idempotent(self): - rd_1 = dict(protocol='eigrp', metric=10, route_map='RMAP_3', id=None) - rd_2 = dict(protocol='static', metric=100, id=None, route_map=None) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='unicast', redistribute=[rd_1, rd_2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_address_family_neighbors(self): - af_nbr_1 = dict(neighbor='192.51.100.1', maximum_prefix=35, activate=True) - af_nbr_2 = dict(neighbor='192.51.100.3', route_reflector_client=True, activate=True) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='multicast', neighbors=[af_nbr_1, af_nbr_2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'address-family ipv4 multicast', 'neighbor 192.51.100.1 activate', - 'neighbor 192.51.100.1 maximum-prefix 35', 'neighbor 192.51.100.3 activate', - 'neighbor 192.51.100.3 route-reflector-client', 'exit-address-family', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_frr_bgp_address_family_neighbors_idempotent(self): - af_nbr_1 = dict(neighbor='2.2.2.2', remove_private_as=True, maximum_prefix=100) - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='unicast', neighbors=[af_nbr_1])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_address_family_networks(self): - net = dict(prefix='1.0.0.0', masklen=8, route_map='RMAP_1') - net2 = dict(prefix='192.168.1.0', masklen=24, route_map='RMAP_2') - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='multicast', networks=[net, net2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - cmd = ['router bgp 64496', 'address-family ipv4 multicast', 'network 1.0.0.0/8 route-map RMAP_1', - 'network 192.168.1.0/24 route-map RMAP_2', 'exit-address-family', 'exit'] - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_frr_bgp_address_family_networks_idempotent(self): - net = dict(prefix='10.0.0.0', masklen=8, route_map='RMAP_1') - net2 = dict(prefix='20.0.0.0', masklen=8, route_map='RMAP_2') - - config = dict(bgp_as=64496, address_family=[dict(afi='ipv4', safi='multicast', networks=[net, net2])], - networks=None) - - obj = Provider(params=dict(config=config, operation='merge')) - - commands = obj.render(self._bgp_config) - self.assertEqual(commands, []) - - def test_frr_bgp_operation_override(self): - net_1 = dict(prefix='1.0.0.0', masklen=8, route_map='RMAP_1') - net_2 = dict(prefix='192.168.1.0', masklen=24, route_map='RMAP_2') - nbr_1 = dict(neighbor='192.51.100.1', remote_as=64496, advertisement_interval=120) - nbr_2 = dict(neighbor='192.51.100.3', remote_as=64496, timers=dict(keepalive=300, holdtime=360)) - af_nbr_1 = dict(neighbor='192.51.100.1', maximum_prefix=35) - af_nbr_2 = dict(neighbor='192.51.100.3', route_reflector_client=True) - - af_1 = dict(afi='ipv4', safi='unicast', neighbors=[af_nbr_1, af_nbr_2]) - af_2 = dict(afi='ipv4', safi='multicast', networks=[net_1, net_2]) - config = dict(bgp_as=64496, neighbors=[nbr_1, nbr_2], address_family=[af_1, af_2], networks=None) - - obj = Provider(params=dict(config=config, operation='override')) - commands = obj.render(self._bgp_config) - - cmd = ['no router bgp 64496', 'router bgp 64496', 'neighbor 192.51.100.1 remote-as 64496', - 'neighbor 192.51.100.1 advertisement-interval 120', 'neighbor 192.51.100.3 remote-as 64496', - 'neighbor 192.51.100.3 timers 300 360', 'address-family ipv4 unicast', - 'neighbor 192.51.100.1 maximum-prefix 35', 'neighbor 192.51.100.3 route-reflector-client', 'exit-address-family', - 'address-family ipv4 multicast', 'network 1.0.0.0/8 route-map RMAP_1', 'network 192.168.1.0/24 route-map RMAP_2', - 'exit-address-family', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_frr_bgp_operation_replace(self): - rd = dict(protocol='ospf', id=223, metric=110, route_map=None) - net = dict(prefix='10.0.0.0', masklen=8, route_map='RMAP_1') - net2 = dict(prefix='20.0.0.0', masklen=8, route_map='RMAP_2') - - af_1 = dict(afi='ipv4', safi='unicast', redistribute=[rd]) - af_2 = dict(afi='ipv4', safi='multicast', networks=[net, net2]) - - config = dict(bgp_as=64496, address_family=[af_1, af_2], networks=None) - obj = Provider(params=dict(config=config, operation='replace')) - commands = obj.render(self._bgp_config) - - cmd = ['router bgp 64496', 'address-family ipv4 unicast', 'redistribute ospf 223 metric 110', 'no redistribute eigrp', - 'no redistribute static', 'exit-address-family', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) - - def test_frr_bgp_operation_replace_with_new_as(self): - rd = dict(protocol='ospf', id=223, metric=110, route_map=None) - - af_1 = dict(afi='ipv4', safi='unicast', redistribute=[rd]) - - config = dict(bgp_as=64497, address_family=[af_1], networks=None) - obj = Provider(params=dict(config=config, operation='replace')) - commands = obj.render(self._bgp_config) - - cmd = ['no router bgp 64496', 'router bgp 64497', 'address-family ipv4 unicast', 'redistribute ospf 223 metric 110', - 'exit-address-family', 'exit'] - - self.assertEqual(sorted(commands), sorted(cmd)) diff --git a/test/units/modules/network/frr/test_frr_facts.py b/test/units/modules/network/frr/test_frr_facts.py deleted file mode 100644 index 8e15311c4c..0000000000 --- a/test/units/modules/network/frr/test_frr_facts.py +++ /dev/null @@ -1,114 +0,0 @@ -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.frr import frr_facts -from units.modules.utils import set_module_args -from .frr_module import TestFrrModule, load_fixture - - -class TestFrrFactsModule(TestFrrModule): - - module = frr_facts - - def setUp(self): - super(TestFrrFactsModule, self).setUp() - self.mock_run_commands = patch('ansible.modules.network.frr.frr_facts.run_commands') - self.run_commands = self.mock_run_commands.start() - - self.mock_get_capabilities = patch('ansible.modules.network.frr.frr_facts.get_capabilities') - self.get_capabilities = self.mock_get_capabilities.start() - self.get_capabilities.return_value = { - 'device_info': { - 'network_os': 'frr', - 'network_os_hostname': 'rtr1', - 'network_os_version': '6.0', - }, - 'supported_protocols': { - 'ldp': False - }, - 'network_api': 'cliconf' - } - - def tearDown(self): - super(TestFrrFactsModule, self).tearDown() - self.mock_run_commands.stop() - self.mock_get_capabilities.stop() - - def load_fixtures(self, commands=None): - def load_from_file(*args, **kwargs): - commands = kwargs['commands'] - output = list() - - for command in commands: - filename = str(command).split(' | ')[0].replace(' ', '_') - output.append(load_fixture('frr_facts_%s' % filename)) - return output - - self.run_commands.side_effect = load_from_file - - def test_frr_facts_default(self): - set_module_args(dict(gather_subset='default')) - result = self.execute_module() - self.assertEqual( - result['ansible_facts']['ansible_net_hostname'], 'rtr1' - ) - self.assertEqual( - result['ansible_facts']['ansible_net_version'], '6.0' - ) - self.assertEqual( - result['ansible_facts']['ansible_net_system'], 'frr' - ) - - def test_frr_facts_interfaces(self): - set_module_args(dict(gather_subset='interfaces')) - result = self.execute_module() - self.assertEqual( - result['ansible_facts']['ansible_net_interfaces']['eth0']['macaddress'], 'fa:16:3e:d4:32:b2' - ) - self.assertEqual( - result['ansible_facts']['ansible_net_interfaces']['eth1']['macaddress'], 'fa:16:3e:95:88:f7' - ) - self.assertEqual( - result['ansible_facts']['ansible_net_interfaces']['eth0']['ipv4'], [{"address": "192.168.1.8", - "subnet": "24"}] - ) - self.assertEqual( - result['ansible_facts']['ansible_net_interfaces']['eth0']['ipv6'], [{"address": "fe80::f816:3eff:fed4:32b2", - "subnet": "64"}] - ) - self.assertEqual( - sorted(result['ansible_facts']['ansible_net_all_ipv4_addresses']), sorted(["192.168.1.19", - "192.168.1.18", - "192.168.1.21", - "192.168.1.8"]) - ) - self.assertEqual( - sorted(result['ansible_facts']['ansible_net_all_ipv6_addresses']), sorted(["fe80::f816:3eff:fe95:88f7", - "3ffe:506::1", - "3ffe:504::1", - "fe80::f816:3eff:fed4:32b2"]) - ) - - def test_frr_facts_hardware(self): - set_module_args(dict(gather_subset='hardware')) - result = self.execute_module() - - self.assertEqual( - result['ansible_facts']['ansible_net_mem_stats']["zebra"]['total_heap_allocated'], '4200 KiB' - ) - - self.assertEqual( - result['ansible_facts']['ansible_net_mem_stats']["ripd"]['total_heap_allocated'], '936 KiB' - ) - - self.assertEqual( - result['ansible_facts']['ansible_net_mem_stats']["ripd"]['used_ordinary_blocks'], '901 KiB' - ) - - self.assertEqual( - result['ansible_facts']['ansible_net_mem_stats']["ripd"]['holding_block_headers'], '0 bytes' - ) |