diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md index c77e69390bf..10ce7dd2ca3 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md @@ -1355,12 +1355,16 @@ aaa authorization commands 10,15 default group tacacs+ local | Commands - Console | all | start-stop | TACACS | True | | Commands - Console | 0 | start-stop | - | True | | Commands - Console | 1 | start-stop | TACACS1 | False | +| Commands - Console | 2 | none | - | True | +| Commands - Console | 3 | 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 | start-stop | TACACS | False | +| Commands - Default | 2 | none | - | True | +| Commands - Default | 3 | start-stop | - | False | #### AAA Accounting Device Configuration @@ -1369,12 +1373,14 @@ 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 start-stop group TACACS1 +aaa accounting commands 2 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 start-stop group TACACS +aaa accounting commands 2 default none ``` ## Address Locking diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg index 75ba68e07d8..e0fd9b32edc 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg @@ -1432,12 +1432,14 @@ 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 start-stop group TACACS1 +aaa accounting commands 2 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 start-stop group TACACS +aaa accounting commands 2 default none ! cvx no shutdown diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/aaa-accounting.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/aaa-accounting.yml index 52a0b434cc1..134bee8ef1b 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/aaa-accounting.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/aaa-accounting.yml @@ -31,6 +31,14 @@ aaa_accounting: type: start-stop logging: false group: TACACS1 + # As type is none hence logging will not render in config as per actual EOS + - commands: 2 + type: none + logging: true + # If type is start-stop or stop-only then logging should be true or group should be defined to render the config + - commands: 3 + type: start-stop + logging: false default: - commands: all type: start-stop @@ -44,3 +52,11 @@ aaa_accounting: type: start-stop logging: false group: TACACS + # As type is none hence logging will not render in config as per actual EOS + - commands: 2 + type: none + logging: true + # If type is start-stop or stop-only then logging should be true or group should be defined to render the config + - commands: 3 + type: start-stop + logging: false diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/aaa-accounting.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/aaa-accounting.md index 9a3d9cd1ac5..01a2c528802 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/aaa-accounting.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/aaa-accounting.md @@ -27,12 +27,12 @@ | [      group](## "aaa_accounting.dot1x.default.group") | String | | | | Group Name. | | [  commands](## "aaa_accounting.commands") | Dictionary | | | | | | [    console](## "aaa_accounting.commands.console") | List, items: Dictionary | | | | | - | [      - commands](## "aaa_accounting.commands.console.[].commands") | String | | | | Privilege level 'all' or 0-15. | + | [      - commands](## "aaa_accounting.commands.console.[].commands") | String | | | | Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. | | [        type](## "aaa_accounting.commands.console.[].type") | String | | | Valid Values:
- none
- start-stop
- stop-only | | | [        group](## "aaa_accounting.commands.console.[].group") | String | | | | Group Name. | | [        logging](## "aaa_accounting.commands.console.[].logging") | Boolean | | | | | | [    default](## "aaa_accounting.commands.default") | List, items: Dictionary | | | | | - | [      - commands](## "aaa_accounting.commands.default.[].commands") | String | | | | Privilege level 'all' or 0-15. | + | [      - commands](## "aaa_accounting.commands.default.[].commands") | String | | | | Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. | | [        type](## "aaa_accounting.commands.default.[].type") | String | | | Valid Values:
- none
- start-stop
- stop-only | | | [        group](## "aaa_accounting.commands.default.[].group") | String | | | | Group Name. | | [        logging](## "aaa_accounting.commands.default.[].logging") | Boolean | | | | | @@ -69,7 +69,7 @@ commands: console: - # Privilege level 'all' or 0-15. + # Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. - commands: type: @@ -78,7 +78,7 @@ logging: default: - # Privilege level 'all' or 0-15. + # Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. - commands: type: diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-accounting.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-accounting.j2 index a0468ad9a60..e5505adb06b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-accounting.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-accounting.j2 @@ -5,49 +5,47 @@ #} {# eos - aaa accounting #} {% if aaa_accounting is arista.avd.defined %} -{% if aaa_accounting.exec.console.type is arista.avd.defined %} -{% 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 %} -{% 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 %} -{% endif %} -{% if aaa_accounting.exec.console.logging is arista.avd.defined(true) %} -{% set aaa_accounting_exec_console_cli = aaa_accounting_exec_console_cli ~ " logging" %} -{% endif %} +{% if aaa_accounting.exec.console.type is arista.avd.defined('none') %} +aaa accounting exec console none +{% elif aaa_accounting.exec.console.type is arista.avd.defined and (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 exec_console_cli = exec_console_cli ~ " group " ~ aaa_accounting.exec.console.group %} {% endif %} -{{ aaa_accounting_exec_console_cli }} +{% if aaa_accounting.exec.console.logging is arista.avd.defined(true) %} +{% set exec_console_cli = exec_console_cli ~ " logging" %} +{% endif %} +{{ 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 %} -{% 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 %} -{% endif %} -{% if aaa_accounting.exec.default.logging is arista.avd.defined(true) %} -{% set aaa_accounting_exec_default_cli = aaa_accounting_exec_default_cli ~ " logging" %} -{% endif %} +{% if aaa_accounting.exec.default.type is arista.avd.defined('none') %} +aaa accounting exec default none +{% elif aaa_accounting.exec.default.type is arista.avd.defined and (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 exec_default_cli = exec_default_cli ~ " group " ~ aaa_accounting.exec.default.group %} {% endif %} -{{ aaa_accounting_exec_default_cli }} +{% if aaa_accounting.exec.default.logging is arista.avd.defined(true) %} +{% set exec_default_cli = exec_default_cli ~ " logging" %} +{% endif %} +{{ 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 }} @@ -58,15 +56,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 %} diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py index be602c0ed20..6e11a0f1f24 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -243,7 +243,7 @@ class ConsoleItem(AvdModel): "_custom_data": {"type": dict}, } commands: str | None - """Privilege level 'all' or 0-15.""" + """Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another.""" type: Literal["none", "start-stop", "stop-only"] | None group: str | None """Group Name.""" @@ -268,7 +268,7 @@ def __init__( Subclass of AvdModel. Args: - commands: Privilege level 'all' or 0-15. + commands: Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. type: type group: Group Name. logging: logging @@ -292,7 +292,7 @@ class DefaultItem(AvdModel): "_custom_data": {"type": dict}, } commands: str | None - """Privilege level 'all' or 0-15.""" + """Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another.""" type: Literal["none", "start-stop", "stop-only"] | None group: str | None """Group Name.""" @@ -317,7 +317,7 @@ def __init__( Subclass of AvdModel. Args: - commands: Privilege level 'all' or 0-15. + commands: Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. type: type group: Group Name. logging: logging diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml index 23de70e83e1..e07a467f342 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml @@ -84,7 +84,8 @@ keys: type: str convert_types: - int - description: Privilege level 'all' or 0-15. + description: Privilege level 'all' or 0-15. Ensure that if ranges + are used, they do not overlap with one another. type: type: str valid_values: @@ -105,7 +106,8 @@ keys: type: str convert_types: - int - description: Privilege level 'all' or 0-15. + description: Privilege level 'all' or 0-15. Ensure that if ranges + are used, they do not overlap with one another. type: type: str valid_values: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/aaa_accounting.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/aaa_accounting.schema.yml index 98b361ff714..dcbc097c9a2 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/aaa_accounting.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/aaa_accounting.schema.yml @@ -69,8 +69,8 @@ keys: commands: type: str convert_types: - - int - description: Privilege level 'all' or 0-15. + - int + description: Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. type: type: str valid_values: ["none", "start-stop", "stop-only"] @@ -87,8 +87,8 @@ keys: commands: type: str convert_types: - - int - description: Privilege level 'all' or 0-15. + - int + description: Privilege level 'all' or 0-15. Ensure that if ranges are used, they do not overlap with one another. type: type: str valid_values: ["none", "start-stop", "stop-only"]