From 1724d79fe10e88f8fab874c800549789f7cd3230 Mon Sep 17 00:00:00 2001 From: Guillaume Mulocher Date: Fri, 20 Oct 2023 03:24:40 +0200 Subject: [PATCH] Feat(eos_cli_config_gen): Add other valid_values for event-handler trigger 'on-boot' (#3264) --- .../documentation/devices/event-handlers.md | 5 +++++ .../eos_cli_config_gen/intended/configs/event-handlers.cfg | 4 ++++ .../inventory/host_vars/event-handlers.yml | 4 ++++ .../roles/eos_cli_config_gen/docs/tables/event-handlers.md | 2 +- .../schemas/eos_cli_config_gen.jsonschema.json | 1 + .../eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml | 1 + .../schemas/schema_fragments/event_handlers.schema.yml | 5 ++++- .../avd/roles/eos_designs/docs/tables/management-settings.md | 2 +- .../roles/eos_designs/schemas/eos_designs.jsonschema.json | 1 + 9 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/event-handlers.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/event-handlers.md index 3690e9b05a7..306c2b11a8a 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/event-handlers.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/event-handlers.md @@ -45,6 +45,7 @@ interface Management1 | ------- | ----------- | ------ | ------- | | CONFIG_VERSIONING | bash | FN=/mnt/flash/startup-config; LFN="`ls -1 $FN.*-* \| tail -n 1`"; if [ -z "$LFN" -o -n "`diff -I 'last modified' $FN $LFN`" ]; then cp $FN $FN.`date +%Y%m%d-%H%M%S`; ls -1r $FN.*-* \| tail -n +11 \| xargs -I % rm %; fi | on-startup-config | | evpn-blacklist-recovery | bash | FastCli -p 15 -c "clear bgp evpn host-flap" | on-logging | +| trigger-on-boot | bash | echo "on-boot" | on-boot | #### Event Handler Device Configuration @@ -61,4 +62,8 @@ event-handler evpn-blacklist-recovery action bash FastCli -p 15 -c "clear bgp evpn host-flap" delay 300 asynchronous +! +event-handler trigger-on-boot + trigger on-boot + action bash echo "on-boot" ``` diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/event-handlers.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/event-handlers.cfg index 77956f8d975..004de6e950d 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/event-handlers.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/event-handlers.cfg @@ -24,4 +24,8 @@ event-handler evpn-blacklist-recovery delay 300 asynchronous ! +event-handler trigger-on-boot + trigger on-boot + action bash echo "on-boot" +! end diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/event-handlers.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/event-handlers.yml index 13342fc5b11..1e89a977c27 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/event-handlers.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/event-handlers.yml @@ -11,3 +11,7 @@ event_handlers: action: FN=/mnt/flash/startup-config; LFN="`ls -1 $FN.*-* | tail -n 1`"; if [ -z "$LFN" -o -n "`diff -I 'last modified' $FN $LFN`" ]; then cp $FN $FN.`date +%Y%m%d-%H%M%S`; ls -1r $FN.*-* | tail -n +11 | xargs -I % rm %; fi delay: 0 trigger: on-startup-config + - name: trigger-on-boot + trigger: on-boot + action_type: bash + action: echo "on-boot" diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/event-handlers.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/event-handlers.md index 8dbfb47f1dc..f1fef73a9f0 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/event-handlers.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/event-handlers.md @@ -12,7 +12,7 @@ | [    action_type](## "event_handlers.[].action_type") | String | | | Valid Values:
- bash
- increment
- log | | | [    action](## "event_handlers.[].action") | String | | | | Command to execute
| | [    delay](## "event_handlers.[].delay") | Integer | | | | Event-handler delay in seconds
| - | [    trigger](## "event_handlers.[].trigger") | String | | | Valid Values:
- on-logging
- on-startup-config | Configure event trigger condition.
| + | [    trigger](## "event_handlers.[].trigger") | String | | | Valid Values:
- on-boot
- on-logging
- on-startup-config | Configure event trigger condition.
| | [    regex](## "event_handlers.[].regex") | String | | | | Regular expression to use for searching log messages. Required for on-logging trigger
| | [    asynchronous](## "event_handlers.[].asynchronous") | Boolean | | `False` | | Set the action to be non-blocking. | diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json index 689843998d4..3952ce9b2d9 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json @@ -4224,6 +4224,7 @@ "type": "string", "description": "Configure event trigger condition.\n", "enum": [ + "on-boot", "on-logging", "on-startup-config" ], diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml index 0299e2b981c..8795a796648 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml @@ -2524,6 +2524,7 @@ keys: ' valid_values: + - on-boot - on-logging - on-startup-config regex: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/event_handlers.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/event_handlers.schema.yml index a189403490b..46650277c19 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/event_handlers.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/event_handlers.schema.yml @@ -38,7 +38,10 @@ keys: type: str description: | Configure event trigger condition. - valid_values: ["on-logging", "on-startup-config"] + valid_values: + - on-boot + - on-logging + - on-startup-config regex: type: str description: | diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/management-settings.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/management-settings.md index 69236b1e64f..427038c6054 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/management-settings.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/management-settings.md @@ -12,7 +12,7 @@ | [    action_type](## "event_handlers.[].action_type") | String | | | Valid Values:
- bash
- increment
- log | | | [    action](## "event_handlers.[].action") | String | | | | Command to execute
| | [    delay](## "event_handlers.[].delay") | Integer | | | | Event-handler delay in seconds
| - | [    trigger](## "event_handlers.[].trigger") | String | | | Valid Values:
- on-logging
- on-startup-config | Configure event trigger condition.
| + | [    trigger](## "event_handlers.[].trigger") | String | | | Valid Values:
- on-boot
- on-logging
- on-startup-config | Configure event trigger condition.
| | [    regex](## "event_handlers.[].regex") | String | | | | Regular expression to use for searching log messages. Required for on-logging trigger
| | [    asynchronous](## "event_handlers.[].asynchronous") | Boolean | | `False` | | Set the action to be non-blocking. | | [ipv6_mgmt_destination_networks](## "ipv6_mgmt_destination_networks") | List, items: String | | | | List of IPv6 prefixes to configure as static routes towards the OOB IPv6 Management interface gateway.
Replaces the default route.
| diff --git a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json index 479b221d244..7359a3794b0 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json +++ b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json @@ -3233,6 +3233,7 @@ "type": "string", "description": "Configure event trigger condition.\n", "enum": [ + "on-boot", "on-logging", "on-startup-config" ],