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): Improve the aaa accounting j2 template #4636

Merged
merged 12 commits into from
Dec 3, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,27 @@ aaa authorization commands 10,15 default group tacacs+ local
| Exec - Console | - | start-stop | TACACS | True |
| Commands - Console | all | start-stop | TACACS | True |
| Commands - Console | 0 | start-stop | - | True |
| Commands - Console | 1 | none | - | True |
| Commands - Console | 2 | start-stop | - | False |
| Exec - Default | - | start-stop | TACACS | True |
| System - Default | - | start-stop | TACACS | - |
| Dot1x - Default | - | start-stop | RADIUS | - |
| Commands - Default | all | start-stop | TACACS | True |
| Commands - Default | 0 | start-stop | - | True |
| Commands - Default | 1 | none | - | True |
| Commands - Default | 2 | start-stop | - | False |

#### AAA Accounting Device Configuration

```eos
aaa accounting exec console start-stop group TACACS logging
aaa accounting commands all console start-stop group TACACS logging
aaa accounting commands 0 console start-stop logging
aaa accounting commands 1 console none
aaa accounting exec default start-stop group TACACS logging
aaa accounting system default start-stop group TACACS
aaa accounting dot1x default start-stop group RADIUS
aaa accounting commands all default start-stop group TACACS logging
aaa accounting commands 0 default start-stop logging
aaa accounting commands 1 default none
```
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ aaa authorization commands 10,15 default group tacacs+ local
aaa accounting exec console start-stop group TACACS logging
aaa accounting commands all console start-stop group TACACS logging
aaa accounting commands 0 console start-stop logging
aaa accounting commands 1 console none
aaa accounting exec default start-stop group TACACS logging
laxmikantchintakindi marked this conversation as resolved.
Show resolved Hide resolved
aaa accounting system default start-stop group TACACS
laxmikantchintakindi marked this conversation as resolved.
Show resolved Hide resolved
aaa accounting dot1x default start-stop group RADIUS
aaa accounting commands all default start-stop group TACACS logging
aaa accounting commands 0 default start-stop logging
aaa accounting commands 1 default none
!
interface Management1
description OOB_MANAGEMENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ aaa_accounting:
- commands: 0
type: start-stop
logging: true
# It should not include logging into command
- commands: 1
type: none
logging: true
# It should not generate the command
- commands: 2
type: start-stop
logging: false
# It should not generate the command
- commands: 3
logging: false
default:
- commands: all
type: start-stop
Expand All @@ -122,6 +133,14 @@ aaa_accounting:
- commands: 0
type: start-stop
logging: true
# It should not include logging into command
- commands: 1
type: none
logging: true
# It should not generate the command
- commands: 2
type: start-stop
logging: false

### AAA Root ###
aaa_root:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,50 @@
{# eos - aaa accounting #}
{% if aaa_accounting is arista.avd.defined %}
{% if aaa_accounting.exec.console.type is arista.avd.defined %}
MaheshGSLAB marked this conversation as resolved.
Show resolved Hide resolved
{% set aaa_accounting_exec_console_cli = "aaa accounting exec console" %}
{% if aaa_accounting.exec.console.type is arista.avd.defined('none') %}
{% set aaa_accounting_exec_console_cli = aaa_accounting_exec_console_cli ~ " none" %}
{% else %}
{% set aaa_accounting_exec_console_cli = aaa_accounting_exec_console_cli ~ " " ~ aaa_accounting.exec.console.type %}
aaa accounting exec console none
{% elif aaa_accounting.exec.console.group is arista.avd.defined or aaa_accounting.exec.console.logging is arista.avd.defined(true) %}
{% set exec_console_cli = "aaa accounting exec console " ~ aaa_accounting.exec.console.type %}
{% if aaa_accounting.exec.console.group is arista.avd.defined %}
{% set aaa_accounting_exec_console_cli = aaa_accounting_exec_console_cli ~ " group " ~ aaa_accounting.exec.console.group %}
{% set exec_console_cli = exec_console_cli ~ " group " ~ aaa_accounting.exec.console.group %}
{% endif %}
{% if aaa_accounting.exec.console.logging is arista.avd.defined(true) %}
{% set aaa_accounting_exec_console_cli = aaa_accounting_exec_console_cli ~ " logging" %}
{% set exec_console_cli = exec_console_cli ~ " logging" %}
{% endif %}
{{ exec_console_cli }}
{% endif %}
{{ aaa_accounting_exec_console_cli }}
{% endif %}
{% if aaa_accounting.commands.console is arista.avd.defined %}
{% for command_default in aaa_accounting.commands.console %}
{% if command_default.commands is arista.avd.defined and command_default.type is arista.avd.defined %}
{% set aaa_accounting_commands_commands_console_cli = "aaa accounting commands " ~ command_default.commands ~ " console " ~ command_default.type %}
{% if command_default.group is arista.avd.defined %}
{% set aaa_accounting_commands_commands_console_cli = aaa_accounting_commands_commands_console_cli ~ " group " ~ command_default.group %}
{% endif %}
{% if command_default.logging is arista.avd.defined(true) %}
{% set aaa_accounting_commands_commands_console_cli = aaa_accounting_commands_commands_console_cli ~ " logging" %}
{% if command_default.type is arista.avd.defined('none') %}
aaa accounting commands {{ command_default.commands }} console none
{% elif command_default.group is arista.avd.defined or command_default.logging is arista.avd.defined(true) %}
{% set commands_console_cli = "aaa accounting commands " ~ command_default.commands ~ " console " ~ command_default.type %}
{% if command_default.group is arista.avd.defined %}
{% set commands_console_cli = commands_console_cli ~ " group " ~ command_default.group %}
{% endif %}
{% if command_default.logging is arista.avd.defined(true) %}
{% set commands_console_cli = commands_console_cli ~ " logging" %}
{% endif %}
{{ commands_console_cli }}
{% endif %}
{% endif %}
{{ aaa_accounting_commands_commands_console_cli }}
{% endfor %}
{% endif %}
{% if aaa_accounting.exec.default.type is arista.avd.defined %}
{% set aaa_accounting_exec_default_cli = "aaa accounting exec default" %}
{% if aaa_accounting.exec.default.type is arista.avd.defined('none') %}
{% set aaa_accounting_exec_default_cli = aaa_accounting_exec_default_cli ~ " none" %}
{% else %}
{% set aaa_accounting_exec_default_cli = aaa_accounting_exec_default_cli ~ " " ~ aaa_accounting.exec.default.type %}
aaa accounting exec default none
{% elif aaa_accounting.exec.default.group is arista.avd.defined or aaa_accounting.exec.default.logging is arista.avd.defined(true) %}
{% set exec_default_cli = "aaa accounting exec default " ~ aaa_accounting.exec.default.type %}
{% if aaa_accounting.exec.default.group is arista.avd.defined %}
{% set aaa_accounting_exec_default_cli = aaa_accounting_exec_default_cli ~ " group " ~ aaa_accounting.exec.default.group %}
{% set exec_default_cli = exec_default_cli ~ " group " ~ aaa_accounting.exec.default.group %}
{% endif %}
{% if aaa_accounting.exec.default.logging is arista.avd.defined(true) %}
{% set aaa_accounting_exec_default_cli = aaa_accounting_exec_default_cli ~ " logging" %}
{% set exec_default_cli = exec_default_cli ~ " logging" %}
{% endif %}
{{ exec_default_cli }}
gmuloc marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
{{ aaa_accounting_exec_default_cli }}
{% endif %}
{% if aaa_accounting.system.default.type is arista.avd.defined and aaa_accounting.system.default.group is arista.avd.defined %}
aaa accounting system default {{ aaa_accounting.system.default.type }} group {{ aaa_accounting.system.default.group }}
Expand All @@ -58,15 +60,19 @@ aaa accounting dot1x default {{ aaa_accounting.dot1x.default.type }} group {{ aa
{% if aaa_accounting.commands.default is arista.avd.defined %}
{% for command_default in aaa_accounting.commands.default %}
{% if command_default.commands is arista.avd.defined and command_default.type is arista.avd.defined %}
{% set aaa_accounting_commands_commands_default_cli = "aaa accounting commands " ~ command_default.commands ~ " default " ~ command_default.type %}
{% if command_default.group is arista.avd.defined %}
{% set aaa_accounting_commands_commands_default_cli = aaa_accounting_commands_commands_default_cli ~ " group " ~ command_default.group %}
{% endif %}
{% if command_default.logging is arista.avd.defined(true) %}
{% set aaa_accounting_commands_commands_default_cli = aaa_accounting_commands_commands_default_cli ~ " logging" %}
{% if command_default.type is arista.avd.defined('none') %}
aaa accounting commands {{ command_default.commands }} default none
{% elif command_default.group is arista.avd.defined or command_default.logging is arista.avd.defined(true) %}
{% set commands_default_cli = "aaa accounting commands " ~ command_default.commands ~ " default " ~ command_default.type %}
{% if command_default.group is arista.avd.defined %}
{% set commands_default_cli = commands_default_cli ~ " group " ~ command_default.group %}
{% endif %}
{% if command_default.logging is arista.avd.defined(true) %}
{% set commands_default_cli = commands_default_cli ~ " logging" %}
{% endif %}
{{ commands_default_cli }}
{% endif %}
{% endif %}
{{ aaa_accounting_commands_commands_default_cli }}
{% endfor %}
{% endif %}
{% endif %}
Loading