Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roverflow committed Dec 24, 2024
1 parent e6605e6 commit b219ff1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Tunnel1110 is up, line protocol is up
Internet address is 10.10.10.2/30
GigabitEthernet2/5/5 is up, line protocol is up
Internet protocol processing disabled
GigabitEthernet2/5/5.1874 is deleted, line protocol is down
Internet protocol processing disabled
27 changes: 27 additions & 0 deletions tests/unit/modules/network/ios/test_ios_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


__metaclass__ = type
from textwrap import dedent
from unittest.mock import patch

from ansible.module_utils.six import assertCountEqual
Expand Down Expand Up @@ -199,3 +200,29 @@ def test_ios_facts_neighbors(self):
result["ansible_facts"]["ansible_net_neighbors"]["GigabitEthernet3"],
[{"host": "Rtest", "port": "Gi1", "ip": "10.3.0.3"}],
)

def test_ios_facts_interfaces(self):
set_module_args(dict(gather_subset="interfaces"))
result = self.execute_module()
self.assertEqual(
result["ansible_facts"]["ansible_net_interfaces"]["GigabitEthernet2/5/5.1874"],
{'ipv4': [], 'operstatus': 'deleted'},
)
self.assertEqual(
result["ansible_facts"]["ansible_net_interfaces"]["Tunnel1110"],
{
'bandwidth': None,
'description': None,
'duplex': None,
'ipv4': [
{'address': '10.10.10.2', 'subnet': '30'}
],
'lineprotocol': 'up',
'macaddress': None,
'mediatype': None,
'mtu': None,
'operstatus': 'up',
'type': None
},
)

0 comments on commit b219ff1

Please sign in to comment.