Skip to content

Commit

Permalink
Change VRRP preempt default value to True (#1419)
Browse files Browse the repository at this point in the history
The 'vrrp.preempt' parameter did not have a well-defined default value, and the configuration templates implemented it haphazardly using different default values.

This commit:

* Defines the default value as True (preemption is enabled)
* Modifies all relevant configuration templates to enable or disable VRRP preemption based on the 'vrrp preempt' parameter
---------
Co-authored-by: Seb d'Argoeuves <[email protected]>
Co-authored-by: Ivan Pepelnjak <[email protected]>
  • Loading branch information
sdargoeuves authored Oct 24, 2024
1 parent b04fde4 commit 1b3218c
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/module/gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ More complex topologies, such as multiple VRRPv3 instances *on the same subnet*,

* **vrrp.group** (default: 1) -- VRRP group
* **vrrp.priority** (interface parameter, integer)
* **vrrp.preempt** (interface parameter, boolean)
* **vrrp.preempt** (interface parameter, boolean) -- VRRP preempting is enabled by default; you can disable it with **vrrp.preempt: False**.

No other aspect of VRRP (VRRP version, timers...) is manageable through *netlab* parameters; if you want to configure them, create a plugin to implement additional VRRP functionality.
2 changes: 1 addition & 1 deletion netsim/ansible/templates/gateway/arubacx.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface {{ intf.ifname }}
address fe80::1 primary
address {{ intf.gateway[af]|ipaddr('address') }} secondary
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
preempt
{% else %}
no preempt
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/gateway/cumulus.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
vrrp {{ intf.gateway.vrrp.group }} priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
vrrp {{ intf.gateway.vrrp.group }} preempt
{% else %}
no vrrp {{ intf.gateway.vrrp.group }} preempt
{% endif %}
{% endfor %}
do write
Expand Down
2 changes: 1 addition & 1 deletion netsim/ansible/templates/gateway/dellos10.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if not intf.gateway.vrrp.preempt|default(False) %}
{% if not intf.gateway.vrrp.preempt|default(True) %}
no preempt
{% endif %}
{% endfor %}
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/gateway/eos.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
vrrp {{ intf.gateway.vrrp.group }} priority-level {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
vrrp {{ intf.gateway.vrrp.group }} preempt
{% else %}
no vrrp {{ intf.gateway.vrrp.group }} preempt
{% endif %}
{% endif %}
{% endfor %}
4 changes: 3 additions & 1 deletion netsim/ansible/templates/gateway/frr.vrrp-config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
vrrp {{ intf.gateway.vrrp.group }} priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
vrrp {{ intf.gateway.vrrp.group }} preempt
{% else %}
no vrrp {{ intf.gateway.vrrp.group }} preempt
{% endif %}
{% for af in 'ipv4','ipv6' if af in intf.gateway %}
vrrp {{ intf.gateway.vrrp.group }} {{ af|replace('ipv4','ip') }} {{ intf.gateway[af]|ipaddr('address') }}
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/gateway/ios.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
preempt
{% else %}
no preempt
{% endif %}
{% endfor %}
{% endif %}
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/gateway/nxos.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ interface {{ intf.ifname }}
{% if 'priority' in intf.gateway.vrrp %}
priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if intf.gateway.vrrp.preempt|default(False) %}
{% if intf.gateway.vrrp.preempt|default(True) %}
preempt
{% else %}
no preempt
{% endif %}
{% endif %}
{% endfor %}
2 changes: 1 addition & 1 deletion netsim/ansible/templates/gateway/sros.j2
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ updates:
mac: {{ intf.gateway.anycast.mac|hwaddr('linux') }}
{% endif %}
{% if intf.gateway.protocol == 'vrrp' %}
preempt: {{ intf.gateway.vrrp.preempt|default(False)|bool }}
preempt: {{ intf.gateway.vrrp.preempt|default(True)|bool }}
{% if 'priority' in intf.gateway.vrrp %}
priority: {{ intf.gateway.vrrp.priority }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion netsim/ansible/templates/gateway/vyos.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set high-availability vrrp group {{ vrrp_name }} address {{ intf.gateway[af] }}
{% if 'priority' in intf.gateway.vrrp %}
set high-availability vrrp group {{ vrrp_name }} priority {{ intf.gateway.vrrp.priority }}
{% endif %}
{% if not intf.gateway.vrrp.preempt|default(False) %}
{% if not intf.gateway.vrrp.preempt|default(True) %}
set high-availability vrrp group {{ vrrp_name }} no-preempt
{% endif %}

Expand Down

0 comments on commit 1b3218c

Please sign in to comment.