<template name="arista_eos_vrrp" results="per_template">
<doc>
Template to parse and normalize Arista EOS VRRP interface configuration.

This template requires output of:

- `show running-config section vrrp`

Both legacy and current EOS syntax are supported, including `ip` and `ipv4`
virtual addresses, IPv6 virtual addresses, `priority` and `priority-level`,
and text or IETF MD5 peer authentication. Authentication credentials are not
included in normalized output. The default VRRP priority is 100.

Returns a normalized list of dictionaries with these keys:

- `interface` - interface name string
- `group` - VRRP group number integer
- `virtual_address` - virtual IPv4 or IPv6 address string
- `priority` - VRRP priority integer
- `authentication_type` - authentication type string or `null`

Example normalized output (YAML):

```yaml
- interface: Vlan50
  group: 10
  virtual_address: 10.10.4.10
  priority: 200
  authentication_type: text
```

</doc>

<input>
commands = [
    "show running-config section vrrp"
]
platform = [
    "arista_eos",
    "eos",
]
</input>

<macro>
def transform_vrrp_to_records(data):
    from ttp_templates.utils.arista_eos_process_show_running_config_section_vrrp import transform_vrrp_config

    return transform_vrrp_config(data)
</macro>

<group name="interfaces**.{{ interface }}**">
interface {{ interface | _start_ }}

   <group name="ipv4**.{{ group }}**" method="table">
   vrrp {{ group | DIGIT | to_int }} ip {{ virtual_address }}
   vrrp {{ group | DIGIT | to_int }} ipv4 {{ virtual_address }}
   vrrp {{ group | DIGIT | to_int }} priority {{ priority | DIGIT | to_int }}
   vrrp {{ group | DIGIT | to_int }} priority-level {{ priority | DIGIT | to_int }}
   vrrp {{ group | DIGIT | to_int }} peer authentication text {{ authentication_key | let("authentication_type", "text") }}
   vrrp {{ group | DIGIT | to_int }} peer authentication ietf-md5 key-string 0 {{ authentication_key | let("authentication_type", "md5") }}
   vrrp {{ group | DIGIT | to_int }} peer authentication ietf-md5 key-string {{ authentication_key | let("authentication_type", "md5") }}
   </group>

   <group name="ipv6**.{{ group }}**" method="table">
   vrrp {{ group | DIGIT | to_int }} ipv6 {{ virtual_address }}
   vrrp {{ group | DIGIT | to_int }} priority {{ priority | DIGIT | to_int }}
   vrrp {{ group | DIGIT | to_int }} priority-level {{ priority | DIGIT | to_int }}
   </group>

!{{ _end_ }}
</group>

<output macro="transform_vrrp_to_records"/>

</template>
