aristanetworks / avd

Arista Validated Designs
https://avd.arista.com
Apache License 2.0
298 stars 213 forks source link

Validation errors when using on-maintenance options #4537

Closed dgonzalez85 closed 1 month ago

dgonzalez85 commented 1 month ago

Issue Summary

When using event-handlers with trigger "on-maintenance" we support several options:

DC1-CL1(config-handler-test)#trigger on-maintenance enter ?
  bgp        Trigger condition occurs on maintenance operation of specified BGP peer
  interface  Trigger condition occurs on maintenance operation of specified interface
  unit       Trigger condition occurs on maintenance operation of specified unit

DC1-CL1(config-handler-test)#trigger on-maintenance exit ?
  bgp        Trigger condition occurs on maintenance operation of specified BGP peer
  interface  Trigger condition occurs on maintenance operation of specified interface
  unit       Trigger condition occurs on maintenance operation of specified unit

However we warning when these subcommands are used:

[WARNING]: [sgsi8a1-sp]: 'Validation Error: event_handlers[0].trigger': 'trigger on-maintenance
exit unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a2-sp]: 'Validation Error: event_handlers[0].trigger': 'trigger on-maintenance
exit unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a1-sp]: 'Validation Error: event_handlers[1].trigger': 'on-maintenance enter
unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a2-sp]: 'Validation Error: event_handlers[1].trigger': 'on-maintenance enter
unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']

Which component(s) of AVD impacted

eos_cli_config_gen

How do you run AVD ?

Ansible CLI (with virtual-env or native python)

Steps to reproduce

Use an event-handler as follows:

custom_structured_configuration_event_handlers:
  - name: "Begin_Maintenance"
    trigger: "trigger on-maintenance exit unit System begin"
    actions:
      bash_command: FastCli -p15 -c $'configure\nrouter ospf 100\nno max-metric router-lsa'
  - name: "Exit_Maintenance"
    trigger: "on-maintenance enter unit System begin"
    actions:
      bash_command: FastCli -p15 -c $'configure\nrouter ospf 100\nmax-metric router-lsa external-lsa summary-lsa'

### Relevant log output

```shell
TASK [arista.avd.eos_cli_config_gen : Generate eos intended configuration and device documentation] ***
[WARNING]: [sgsi8a1-sp]: 'Validation Error: event_handlers[0].trigger': 'trigger on-maintenance
exit unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a2-sp]: 'Validation Error: event_handlers[0].trigger': 'trigger on-maintenance
exit unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a1-sp]: 'Validation Error: event_handlers[1].trigger': 'on-maintenance enter
unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
[WARNING]: [sgsi8a2-sp]: 'Validation Error: event_handlers[1].trigger': 'on-maintenance enter
unit System begin' is not one of ['on-boot', 'on-counters', 'on-intf', 'on-logging', 'on-
maintenance', 'on-startup-config', 'vm-tracer vm']
ok: [sgsi8s1-lab-m1 -> localhost]
ok: [sgsi8s1-usr-m2 -> localhost]
ok: [sgsi8s1-svc -> localhost]
ok: [sgsi8s1-lab-m2 -> localhost]
ok: [sgsi8s1-usr-m1 -> localhost]
changed: [sgsi8a2-sp -> localhost]
changed: [sgsi8a1-sp -> localhost]

Contributing Guide

ClausHolbechArista commented 1 month ago

The model only supported a few of the options previously. We added support for all the variations recently. To leverage on-maintenance, set that alone in the trigger field and then set the options needed under the trigger_on_maintenance key. Ref. https://avd.arista.com/4.10/roles/eos_cli_config_gen/docs/input-variables.html#event-handlers

dgonzalez85 commented 1 month ago

great thanks @ClausHolbechArista! makes sense now. i will close this issue then.