Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor(eos_cli_config_gen): Update eos template to validate type key defined in aaa_server_group model #4748

Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ ip radius source-interface loopback10
| RADIUS1 | radius | default | 10.10.10.248 |
| RADIUS2 | radius | mgt | 10.10.10.157 |
| RADIUS2 | radius | default | 10.10.10.249 |
| RADIUS3 | radius | - | - |

#### AAA Server Groups Device Configuration

Expand All @@ -1266,6 +1267,8 @@ aaa group server radius RADIUS2
server 10.10.10.157 vrf mgt
server 10.10.10.249
!
aaa group server radius RADIUS3
!
aaa group server tacacs+ TACACS
server 10.10.11.157 vrf mgt
server 10.10.11.249
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,8 @@ aaa group server radius RADIUS2
server 10.10.10.157 vrf mgt
server 10.10.10.249
!
aaa group server radius RADIUS3
!
tacacs-server timeout 10
tacacs-server policy unknown-mandatory-attribute ignore
tacacs-server host 10.10.10.157 single-connection vrf mgt key 7 071B245F5A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ aaa_server_groups:
- server: 10.10.10.157
vrf: mgt
- server: 10.10.10.249
- name: RADIUS3
type: radius
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@
| Server Group Name | Type | VRF | IP address |
| ------------------| ----- | --- | ---------- |
{% for aaa_server_group in aaa_server_groups %}
{% for server in aaa_server_group.servers %}
{% set vrf = server.vrf | arista.avd.default('default') %}
{% if aaa_server_group.type is arista.avd.defined %}
{% if aaa_server_group.servers is arista.avd.defined %}
{% for server in aaa_server_group.servers %}
{% if server.server is arista.avd.defined %}
{% set vrf = server.vrf | arista.avd.default('default') %}
| {{ aaa_server_group.name }} | {{ aaa_server_group.type }} | {{ vrf }} | {{ server.server }} |
gmuloc marked this conversation as resolved.
Show resolved Hide resolved
{% endfor %}
{% endif %}
{% endfor %}
{% else %}
| {{ aaa_server_group.name }} | {{ aaa_server_group.type }} | - | - |
{% endif %}
{% endif %}
{% endfor %}

#### AAA Server Groups Device Configuration
Expand Down
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 == 'ldap' %}
{% for aaa_server_group in aaa_server_groups | arista.avd.natural_sort('name') | selectattr('type', 'equalto', 'ldap') %}
!
aaa group server {{ aaa_server_group.type }} {{ 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 }}
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 %}
{% 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') | arista.avd.natural_sort('type') %}
{% if aaa_server_group.type == '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 {{ aaa_server_group.type }} {{ 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 }}
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 %}
{% 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') | arista.avd.natural_sort('type') %}
{% if aaa_server_group.type == '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 {{ aaa_server_group.type }} {{ 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 }}
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 %}
{% endfor %}
{% endif %}
{{ server_cli }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
Loading