<template name="cisco_ios_arp" results="per_template">
<doc>
Template to parse Cisco IOS and IOS-XE `show ip arp` and `show ipv6 neighbors`
output and normalize it for the `arp` getter.

Returns a list of dictionaries, one per entry, with `ip`, `mac`, `interface`,
`vrf`, `age` and `state` keys (see the `arp` getter).

Notes:

- Neither command names the VRF. `show ip arp` and `show ipv6 neighbors`
  list the global table, and `vrf` is `null`. For a VRF's table, parse
  `show ip arp vrf NAME` and `show ipv6 neighbors vrf NAME` with the VRF name
  in the `vrf` template variable, e.g.
  `parse_output(data, get="arp", platform="cisco_ios", template_vars={"vrf": "NAME"})`;
  every entry in that parse gets it. IOS has no command listing every VRF's
  table: `show vrf` lists the VRFs, each read and parsed on its own.
- Ages are printed in minutes and returned in seconds.
- A `-` for the age marks a configured entry or one of the router's own
  addresses; both are returned as `static`, with no age.
- Incomplete and configured entries have no interface in `show ip arp`, so
  their `interface` is `null`.
- `show ipv6 neighbors` abbreviates interface names (`Gi1`); the common
  abbreviations are expanded (`GigabitEthernet1`), others are returned as
  printed.
- Supply IPv4 and IPv6 output separately or concatenate output from both
  commands with a newline and parse it through the default input.
</doc>

<input>
commands = ['show ip arp', 'show ipv6 neighbors']
platform = ['cisco_ios', 'ios', 'cisco_iosxe']
</input>

<macro>
def transform_arp_to_records(payload):
    from ttp_templates.utils.cisco_ios_process_show_ip_arp import transform_cisco_ios

    return transform_cisco_ios(payload, _ttp_["vars"].get("vrf"))
</macro>

<group name="ipv4*">
Internet  {{ ip | IP | _start_ }}  {{ age }}  {{ mac }}  {{ ignore }}  {{ interface }}
Internet  {{ ip | IP | _start_ }}  {{ age }}  {{ mac }}  {{ ignore }}
</group>

<group name="ipv6*">
{{ ip | _start_ }} {{ age }} {{ mac }} {{ state }} {{ interface }}
</group>

<output macro="transform_arp_to_records"/>

</template>
