diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index 88ddbd1923..b4a8ddfe8f 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -273,11 +273,24 @@ class Interfaces(FactsBase): ('eth_hw_desc', 'type') ]) + INTERFACE_SVI_MAP = frozenset([ + ('svi_line_proto', 'state'), + ('svi_bw', 'bandwidth'), + ('svi_mac', 'macaddress'), + ('svi_mtu', 'mtu'), + ('type', 'type') + ]) + INTERFACE_IPV4_MAP = frozenset([ ('eth_ip_addr', 'address'), ('eth_ip_mask', 'masklen') ]) + INTERFACE_SVI_IPV4_MAP = frozenset([ + ('svi_ip_addr', 'address'), + ('svi_ip_mask', 'masklen') + ]) + INTERFACE_IPV6_MAP = frozenset([ ('addr', 'address'), ('prefix', 'subnet') @@ -318,12 +331,19 @@ class Interfaces(FactsBase): name = item['interface'] intf = dict() - intf.update(self.transform_dict(item, self.INTERFACE_MAP)) + if 'type' in item: + intf.update(self.transform_dict(item, self.INTERFACE_SVI_MAP)) + else: + intf.update(self.transform_dict(item, self.INTERFACE_MAP)) if 'eth_ip_addr' in item: intf['ipv4'] = self.transform_dict(item, self.INTERFACE_IPV4_MAP) self.facts['all_ipv4_addresses'].append(item['eth_ip_addr']) + if 'svi_ip_addr' in item: + intf['ipv4'] = self.transform_dict(item, self.INTERFACE_SVI_IPV4_MAP) + self.facts['all_ipv4_addresses'].append(item['svi_ip_addr']) + interfaces[name] = intf return interfaces