Skip to content

Commit

Permalink
Refactoring schema for interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivani-gslab committed Feb 22, 2024
1 parent 8ece604 commit 1a6b879
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ event-handler trigger-on-boot
action bash echo "on-boot"
!
event-handler trigger-on-maintenance
trigger on-maintenance enter interface Ethernet 4 all
trigger on-maintenance enter interface Ethernet4 all
action bash echo "on-maintenance"
!
event-handler trigger-on-maintenance1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ event-handler trigger-on-boot
action bash echo "on-boot"
!
event-handler trigger-on-maintenance
trigger on-maintenance enter interface Ethernet 4 all
trigger on-maintenance enter interface Ethernet4 all
action bash echo "on-maintenance"
!
event-handler trigger-on-maintenance1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ event_handlers:
trigger: on-maintenance
trigger_on_maintenance:
operation: enter
interface:
interface_type: Ethernet
interface_number: 4
interface: Ethernet4
stage: all
action_type: bash
action: echo "on-maintenance"
Expand All @@ -31,9 +29,7 @@ event_handlers:
operation: enter
bgp:
neighbor_address_ipv4: 10.0.0.2
interface:
interface_type: Management
interface_number: 3
interface: Management3
stage: after
after_before_stage: linkdown
action_type: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;neighbor_address_ipv4</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.neighbor_address_ipv4") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;neighbor_address_ipv6</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.neighbor_address_ipv6") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;peer_group_name</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.peer_group_name") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stage</samp>](## "event_handlers.[].trigger_on_maintenance.stage") | String | Required | | Valid Values:<br>- <code>after</code><br>- <code>before</code><br>- <code>all</code><br>- <code>begin</code><br>- <code>end</code><br>- <code>vrf</code> | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stage</samp>](## "event_handlers.[].trigger_on_maintenance.stage") | String | Required | | Valid Values:<br>- <code>after</code><br>- <code>before</code><br>- <code>all</code><br>- <code>begin</code><br>- <code>end</code><br>- <code>vrf</code> | Stages of maintenance operation. "vrf" stage can be defined for "bgp" only. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;after_before_stage</samp>](## "event_handlers.[].trigger_on_maintenance.after_before_stage") | String | | | Valid Values:<br>- <code>bgp</code><br>- <code>linkdown</code><br>- <code>mlag</code><br>- <code>ratemon</code> | Action is triggered after/before specified stage. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vrf</samp>](## "event_handlers.[].trigger_on_maintenance.vrf") | String | | | | VRF name. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface</samp>](## "event_handlers.[].trigger_on_maintenance.interface") | Dictionary | | | | Trigger condition occurs on maintenance operation of specified interface. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface_type</samp>](## "event_handlers.[].trigger_on_maintenance.interface.interface_type") | String | Required | | Valid Values:<br>- <code>Ethernet</code><br>- <code>Fabric</code><br>- <code>Loopback</code><br>- <code>Management</code><br>- <code>Port-Channel</code><br>- <code>Tunnel</code><br>- <code>Vlan</code><br>- <code>Vxlan</code> | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface_number</samp>](## "event_handlers.[].trigger_on_maintenance.interface.interface_number") | Integer | Required | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface</samp>](## "event_handlers.[].trigger_on_maintenance.interface") | String | | | | Trigger condition occurs on maintenance operation of specified interface. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit</samp>](## "event_handlers.[].trigger_on_maintenance.unit") | String | | | | Name of unit. Trigger condition occurs on maintenance operation of specified unit |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;regex</samp>](## "event_handlers.[].regex") | String | | | | Regular expression to use for searching log messages. Required for on-logging trigger<br> |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;asynchronous</samp>](## "event_handlers.[].asynchronous") | Boolean | | `False` | | Set the action to be non-blocking.<br> |
Expand Down Expand Up @@ -59,6 +57,8 @@
neighbor_address_ipv4: <str>
neighbor_address_ipv6: <str>
peer_group_name: <str>

# Stages of maintenance operation. "vrf" stage can be defined for "bgp" only.
stage: <str; "after" | "before" | "all" | "begin" | "end" | "vrf"; required>

# Action is triggered after/before specified stage.
Expand All @@ -68,9 +68,7 @@
vrf: <str>

# Trigger condition occurs on maintenance operation of specified interface.
interface:
interface_type: <str; "Ethernet" | "Fabric" | "Loopback" | "Management" | "Port-Channel" | "Tunnel" | "Vlan" | "Vxlan"; required>
interface_number: <int; required>
interface: <str>

# Name of unit. Trigger condition occurs on maintenance operation of specified unit
unit: <str>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ keys:
stage:
type: str
required: true
description: Stages of maintenance operation. "vrf" stage can be defined for "bgp" only.
valid_values:
- after
- before
Expand All @@ -85,26 +86,8 @@ keys:
type: str
description: VRF name.
interface:
type: str
description: Trigger condition occurs on maintenance operation of specified interface.
type: dict
keys:
interface_type:
type: str
required: true
valid_values:
- Ethernet
- Fabric
- Loopback
- Management
- Port-Channel
- Tunnel
- Vlan
- Vxlan
interface_number:
type: int
convert_types:
- str
required: true
unit:
type: str
description: Name of unit. Trigger condition occurs on maintenance operation of specified unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ event-handler {{ handler.name }}
{% elif handler.trigger_on_maintenance.bgp.peer_group_name is arista.avd.defined %}
{% set trigger_on_manitenance_cli = trigger_on_manitenance_cli ~ " bgp " ~ handler.trigger_on_maintenance.bgp.peer_group_name %}
{% endif %}
{% elif handler.trigger_on_maintenance.interface.interface_type is arista.avd.defined and handler.trigger_on_maintenance.interface.interface_number is arista.avd.defined %}
{% set trigger_on_manitenance_cli = trigger_on_manitenance_cli ~ " interface " ~ handler.trigger_on_maintenance.interface.interface_type ~ " " ~ handler.trigger_on_maintenance.interface.interface_number %}
{% elif handler.trigger_on_maintenance.interface is arista.avd.defined %}
{% set trigger_on_manitenance_cli = trigger_on_manitenance_cli ~ " interface " ~ handler.trigger_on_maintenance.interface %}
{% elif handler.trigger_on_maintenance.unit is arista.avd.defined %}
{% set trigger_on_manitenance_cli = trigger_on_manitenance_cli ~ " unit " ~ handler.trigger_on_maintenance.unit %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;neighbor_address_ipv4</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.neighbor_address_ipv4") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;neighbor_address_ipv6</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.neighbor_address_ipv6") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;peer_group_name</samp>](## "event_handlers.[].trigger_on_maintenance.bgp.peer_group_name") | String | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stage</samp>](## "event_handlers.[].trigger_on_maintenance.stage") | String | Required | | Valid Values:<br>- <code>after</code><br>- <code>before</code><br>- <code>all</code><br>- <code>begin</code><br>- <code>end</code><br>- <code>vrf</code> | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stage</samp>](## "event_handlers.[].trigger_on_maintenance.stage") | String | Required | | Valid Values:<br>- <code>after</code><br>- <code>before</code><br>- <code>all</code><br>- <code>begin</code><br>- <code>end</code><br>- <code>vrf</code> | Stages of maintenance operation. "vrf" stage can be defined for "bgp" only. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;after_before_stage</samp>](## "event_handlers.[].trigger_on_maintenance.after_before_stage") | String | | | Valid Values:<br>- <code>bgp</code><br>- <code>linkdown</code><br>- <code>mlag</code><br>- <code>ratemon</code> | Action is triggered after/before specified stage. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vrf</samp>](## "event_handlers.[].trigger_on_maintenance.vrf") | String | | | | VRF name. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface</samp>](## "event_handlers.[].trigger_on_maintenance.interface") | Dictionary | | | | Trigger condition occurs on maintenance operation of specified interface. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface_type</samp>](## "event_handlers.[].trigger_on_maintenance.interface.interface_type") | String | Required | | Valid Values:<br>- <code>Ethernet</code><br>- <code>Fabric</code><br>- <code>Loopback</code><br>- <code>Management</code><br>- <code>Port-Channel</code><br>- <code>Tunnel</code><br>- <code>Vlan</code><br>- <code>Vxlan</code> | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface_number</samp>](## "event_handlers.[].trigger_on_maintenance.interface.interface_number") | Integer | Required | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;interface</samp>](## "event_handlers.[].trigger_on_maintenance.interface") | String | | | | Trigger condition occurs on maintenance operation of specified interface. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unit</samp>](## "event_handlers.[].trigger_on_maintenance.unit") | String | | | | Name of unit. Trigger condition occurs on maintenance operation of specified unit |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;regex</samp>](## "event_handlers.[].regex") | String | | | | Regular expression to use for searching log messages. Required for on-logging trigger<br> |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;asynchronous</samp>](## "event_handlers.[].asynchronous") | Boolean | | `False` | | Set the action to be non-blocking.<br> |
Expand Down Expand Up @@ -97,6 +95,8 @@
neighbor_address_ipv4: <str>
neighbor_address_ipv6: <str>
peer_group_name: <str>

# Stages of maintenance operation. "vrf" stage can be defined for "bgp" only.
stage: <str; "after" | "before" | "all" | "begin" | "end" | "vrf"; required>

# Action is triggered after/before specified stage.
Expand All @@ -106,9 +106,7 @@
vrf: <str>

# Trigger condition occurs on maintenance operation of specified interface.
interface:
interface_type: <str; "Ethernet" | "Fabric" | "Loopback" | "Management" | "Port-Channel" | "Tunnel" | "Vlan" | "Vxlan"; required>
interface_number: <int; required>
interface: <str>

# Name of unit. Trigger condition occurs on maintenance operation of specified unit
unit: <str>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a6b879

Please sign in to comment.