nxos_facts: svi support ipv4 (#35222)
* nxos_facts: svi support ipv4 * nxos_facts: copy paste error * https://app.shippable.com/github/ansible/ansible/runs/51845/1/tests * E111 indentation is not a multiple of four * Update nxos_facts.py
This commit is contained in:
parent
48005da645
commit
98f804ecb4
1 changed files with 21 additions and 1 deletions
|
@ -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()
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue