diff --git a/tests/unit/modules/network/ios/fixtures/ios_facts_show_ip_interface b/tests/unit/modules/network/ios/fixtures/ios_facts_show_ip_interface index e69de29bb..c64043a87 100644 --- a/tests/unit/modules/network/ios/fixtures/ios_facts_show_ip_interface +++ b/tests/unit/modules/network/ios/fixtures/ios_facts_show_ip_interface @@ -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 \ No newline at end of file diff --git a/tests/unit/modules/network/ios/test_ios_facts.py b/tests/unit/modules/network/ios/test_ios_facts.py index 4878d4ad7..98c9b0ae2 100644 --- a/tests/unit/modules/network/ios/test_ios_facts.py +++ b/tests/unit/modules/network/ios/test_ios_facts.py @@ -19,6 +19,7 @@ __metaclass__ = type +from textwrap import dedent from unittest.mock import patch from ansible.module_utils.six import assertCountEqual @@ -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 + }, + ) +