Skip to content

Commit

Permalink
Better logic for eos template
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Vibhu-gslab committed Dec 10, 2024
1 parent 65c732f commit f1cad46
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
that can be found in the LICENSE file.
#}
{# eos - aaa server groups ldap #}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') %}
{% if aaa_server_group.type is arista.avd.defined('ldap') %}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') | selectattr('type', 'equalto', 'ldap') %}
!
aaa group server ldap {{ aaa_server_group.name }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{{ server_cli }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{% endfor %}
{% endif %}
{{ server_cli }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
Use of this source code is governed by the Apache License 2.0
that can be found in the LICENSE file.
#}
{# eos - aaa server groups #}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') %}
{% if aaa_server_group.type is arista.avd.defined('radius') %}
{# eos - aaa server group radius #}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') | selectattr('type', 'equalto', 'radius') %}
!
aaa group server radius {{ aaa_server_group.name }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{{ server_cli }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{% endfor %}
{% endif %}
{{ server_cli }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
Use of this source code is governed by the Apache License 2.0
that can be found in the LICENSE file.
#}
{# eos - aaa server groups #}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') %}
{% if aaa_server_group.type is arista.avd.defined('tacacs+') %}
{# eos - aaa server group tacacs+ #}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') | selectattr('type', 'equalto', 'tacacs+') %}
!
aaa group server tacacs+ {{ aaa_server_group.name }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{{ server_cli }}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set server_cli = "server " ~ server.server %}
{% if server.vrf is arista.avd.defined %}
{% set server_cli = server_cli ~ " vrf " ~ server.vrf %}
{% endif %}
{% endfor %}
{% endif %}
{{ server_cli }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}

0 comments on commit f1cad46

Please sign in to comment.