avd icon indicating copy to clipboard operation
avd copied to clipboard

Feat(eos_cli_config_gen): Refactor event-handlers model to accommodate other triggers with their specificities

Open gmuloc opened this issue 1 year ago • 5 comments

          > I think each option supports/requires different options after the keyword on eos. So I think we may have to rewrite this model to a dict.

indeed - only on-boot seems to work like this. I only need on-boot for now so will remove the other and log an issue to revisit the model later.

Though it will be hard to model - you can configure an event-handler without a trigger in CLI (yeah that is useless probably but valid config) and then it would have to be a list for each option.

on-counters is actually a mode to get in..

event-handler trigger-on-boot
   trigger on-boot
   action bash echo "on-boot"
event-handler trigger-on-config
   trigger on-config disabled
   action bash echo "on-config"
event-handler trigger-on-counters
   action bash echo "on-counters"
   !
   trigger on-counters
event-handler trigger-on-intf
   trigger on-intf Ethernet1 ip
   action bash echo "on-intf"
event-handler trigger-on-maintenance
   trigger on-maintenance enter bgp BLAH after stage linkdown
   trigger on-config disabled
   action bash echo "on-maintenance"
event-handler trigger-vm-tracer
   trigger vm-tracer vm
   action bash echo "vm-tracer"

Originally posted by @gmuloc in https://github.com/aristanetworks/ansible-avd/issues/3264#issuecomment-1770231263

gmuloc avatar Oct 19 '23 07:10 gmuloc

we are highly interested in adding on-maintenance ... since we have implemented this at all our customers with evpn fabric and all getting the warnings.

[WARNING]: [KHM-t-dehesw-101]: 'Validation Error: event_handlers[14].trigger': 'on-maintenance enter unit System begin' is not one of ['on-logging', 'on-startup-config']
[WARNING]: [KHM-t-dehesw-201]: 'Validation Error: event_handlers[15].trigger': 'on-maintenance exit unit System begin' is not one of ['on-logging', 'on-startup-config']

the handlers look like:

  ON-MAINTENANCE-ENTER:
    action_type: bash
    action: "FastCli -p 15 -c downlink-maint; FastCli -p 15 -c peerlink-maint; EOF"
    trigger: on-maintenance enter unit System begin
    asynchronous: true

  ON-MAINTENANCE-EXIT:
    action_type: bash
    action: "FastCli -p 15 -c downlink-nomaint; FastCli -p 15 -c peerlink-nomaint; EOF"
    trigger: on-maintenance exit unit System begin
    asynchronous: true

kmueller68 avatar Oct 20 '23 07:10 kmueller68

That is great feedback Karl, thank you!

Since we need extra fields for this trigger, it could be something like:

trigger: "on-maintenance"
on_maintenance:
  event: enter | exit
  unit: <unit name>
  order: begin | ?

ClausHolbechArista avatar Oct 20 '23 08:10 ClausHolbechArista

This issue is stale because it has been open 90 days with no activity. The issue will be reviewed by a maintainer and may be closed

github-actions[bot] avatar Jan 19 '24 00:01 github-actions[bot]

Hello. Do you have this addtional trigger on you roadmap?

kmueller68 avatar Jan 19 '24 12:01 kmueller68

Unfortunately we do not right now. I will ask the team to take a look, but there is a lot on the list.

ClausHolbechArista avatar Jan 19 '24 12:01 ClausHolbechArista