From 766dd59a15da028a13ce291902656e5eff16fdab Mon Sep 17 00:00:00 2001
From: David Hayes <69943293+davidhayes9@users.noreply.github.com>
Date: Wed, 27 Nov 2024 00:14:13 +1100
Subject: [PATCH] Feat(eos_cli_config_gen): Adding support to disable
make_before_break for PIM sparse-mode (#4745)
---
.../documentation/devices/host1.md | 15 +++++---
.../documentation/devices/host2.md | 30 ++++++++++++++++
.../intended/configs/host1.cfg | 3 ++
.../intended/configs/host2.cfg | 8 +++++
.../host1/router-pim-sparse-mode.yml | 3 ++
.../host2/router-pim-sparse-mode.yml | 9 +++++
.../docs/tables/router-pim-sparse-mode.md | 8 +++++
.../documentation/router-pim-sparse-mode.j2 | 36 +++++++++++--------
.../j2templates/eos/router-pim-sparse-mode.j2 | 14 ++++++++
.../schema/eos_cli_config_gen.schema.yml | 6 ++++
.../router_pim_sparse_mode.schema.yml | 6 ++++
11 files changed, 119 insertions(+), 19 deletions(-)
create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host2/router-pim-sparse-mode.yml
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md
index f589451995e..402324f1856 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md
@@ -7577,6 +7577,8 @@ router multicast
BFD enabled: True
+Make-before-break: False
+
##### IP Rendezvous Information
| Rendezvous Point Address | Group Address | Access Lists | Priority | Hashmask | Override |
@@ -7592,11 +7594,11 @@ BFD enabled: True
##### IP Sparse Mode VRFs
-| VRF Name | BFD Enabled |
-| -------- | ----------- |
-| MCAST_VRF1 | True |
-| MCAST_VRF2_ALL_GROUPS | False |
-| Test_RP_ACL | False |
+| VRF Name | BFD Enabled | Make-before-break |
+| -------- | ----------- | ----------------- |
+| MCAST_VRF1 | True | False |
+| MCAST_VRF2_ALL_GROUPS | False | - |
+| Test_RP_ACL | False | True |
| VRF Name | Rendezvous Point Address | Group Address | Access Lists | Priority | Hashmask | Override |
| -------- | ------------------------ | ------------- | ------------ | -------- | -------- | -------- |
@@ -7613,6 +7615,7 @@ router pim sparse-mode
ipv4
ssm range standard
bfd
+ make-before-break disabled
rp address 10.238.1.161 239.12.12.12/32 priority 20
rp address 10.238.1.161 239.12.12.13/32 priority 20
rp address 10.238.1.161 239.12.12.14/32 priority 20
@@ -7628,6 +7631,7 @@ router pim sparse-mode
vrf MCAST_VRF1
ipv4
bfd
+ make-before-break disabled
rp address 10.238.2.161 239.12.22.12/32
rp address 10.238.2.161 239.12.22.13/32
rp address 10.238.2.161 239.12.22.14/32
@@ -7638,6 +7642,7 @@ router pim sparse-mode
!
vrf Test_RP_ACL
ipv4
+ make-before-break
rp address 10.238.4.161 access-list RP_ACL
rp address 10.238.4.161 access-list RP_ACL2 priority 20 hashmask 30 override
```
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host2.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host2.md
index 0b31ca740c5..3ed6124da2e 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host2.md
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host2.md
@@ -48,6 +48,7 @@
- [Queue Monitor Configuration](#queue-monitor-configuration)
- [Multicast](#multicast)
- [IP IGMP Snooping](#ip-igmp-snooping)
+ - [PIM Sparse Mode](#pim-sparse-mode)
- [Filters](#filters)
- [AS Path Lists](#as-path-lists)
- [802.1X Port Security](#8021x-port-security)
@@ -683,6 +684,35 @@ no ip igmp snooping vlan 30
no ip igmp snooping querier
```
+### PIM Sparse Mode
+
+#### Router PIM Sparse Mode
+
+##### IP Sparse Mode Information
+
+BFD enabled: False
+
+Make-before-break: True
+
+##### IP Sparse Mode VRFs
+
+| VRF Name | BFD Enabled | Make-before-break |
+| -------- | ----------- | ----------------- |
+| MCAST_VRF1 | False | True |
+
+##### Router Multicast Device Configuration
+
+```eos
+!
+router pim sparse-mode
+ ipv4
+ make-before-break
+ !
+ vrf MCAST_VRF1
+ ipv4
+ make-before-break
+```
+
## Filters
### AS Path Lists
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg
index cf5d2e8dced..8005d54543c 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg
@@ -4869,6 +4869,7 @@ router pim sparse-mode
ipv4
ssm range standard
bfd
+ make-before-break disabled
rp address 10.238.1.161 239.12.12.12/32 priority 20
rp address 10.238.1.161 239.12.12.13/32 priority 20
rp address 10.238.1.161 239.12.12.14/32 priority 20
@@ -4884,6 +4885,7 @@ router pim sparse-mode
vrf MCAST_VRF1
ipv4
bfd
+ make-before-break disabled
rp address 10.238.2.161 239.12.22.12/32
rp address 10.238.2.161 239.12.22.13/32
rp address 10.238.2.161 239.12.22.14/32
@@ -4894,6 +4896,7 @@ router pim sparse-mode
!
vrf Test_RP_ACL
ipv4
+ make-before-break
rp address 10.238.4.161 access-list RP_ACL
rp address 10.238.4.161 access-list RP_ACL2 priority 20 hashmask 30 override
!
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host2.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host2.cfg
index 7bb341318ff..ef9e0974758 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host2.cfg
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host2.cfg
@@ -189,6 +189,14 @@ router bgp 65101
address-family path-selection
no bgp additional-paths send
!
+router pim sparse-mode
+ ipv4
+ make-before-break
+ !
+ vrf MCAST_VRF1
+ ipv4
+ make-before-break
+!
dot1x system-auth-control
dot1x protocol lldp bypass
dot1x protocol bpdu bypass
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-pim-sparse-mode.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-pim-sparse-mode.yml
index 466d941c846..266cca1795b 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-pim-sparse-mode.yml
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-pim-sparse-mode.yml
@@ -4,6 +4,7 @@
router_pim_sparse_mode:
ipv4:
bfd: true
+ make_before_break: false
rp_addresses:
- address: 10.238.1.161
groups:
@@ -32,6 +33,7 @@ router_pim_sparse_mode:
- name: MCAST_VRF1
ipv4:
bfd: true
+ make_before_break: false
rp_addresses:
- address: 10.238.2.161
groups:
@@ -45,6 +47,7 @@ router_pim_sparse_mode:
hashmask: 30
- name: Test_RP_ACL
ipv4:
+ make_before_break: true
rp_addresses:
- address: 10.238.4.161
access_lists:
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host2/router-pim-sparse-mode.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host2/router-pim-sparse-mode.yml
new file mode 100644
index 00000000000..4dab3fb9320
--- /dev/null
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host2/router-pim-sparse-mode.yml
@@ -0,0 +1,9 @@
+---
+#### Router pim sparse mode ####
+router_pim_sparse_mode:
+ ipv4:
+ make_before_break: true
+ vrfs:
+ - name: MCAST_VRF1
+ ipv4:
+ make_before_break: true
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-pim-sparse-mode.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-pim-sparse-mode.md
index 37224d0c93e..8fbf1bcf33b 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-pim-sparse-mode.md
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-pim-sparse-mode.md
@@ -10,6 +10,7 @@
| [router_pim_sparse_mode](## "router_pim_sparse_mode") | Dictionary | | | | |
| [ ipv4](## "router_pim_sparse_mode.ipv4") | Dictionary | | | | |
| [ bfd](## "router_pim_sparse_mode.ipv4.bfd") | Boolean | | | | Enable/Disable BFD. |
+ | [ make_before_break](## "router_pim_sparse_mode.ipv4.make_before_break") | Boolean | | | | Enable/Disable Make-Before-Break. |
| [ ssm_range](## "router_pim_sparse_mode.ipv4.ssm_range") | String | | | | IPv4 Prefix associated with SSM. |
| [ rp_addresses](## "router_pim_sparse_mode.ipv4.rp_addresses") | List, items: Dictionary | | | | |
| [ - address](## "router_pim_sparse_mode.ipv4.rp_addresses.[].address") | String | Required | | | RP Address. |
@@ -29,6 +30,7 @@
| [ - name](## "router_pim_sparse_mode.vrfs.[].name") | String | Required, Unique | | | VRF Name. |
| [ ipv4](## "router_pim_sparse_mode.vrfs.[].ipv4") | Dictionary | | | | |
| [ bfd](## "router_pim_sparse_mode.vrfs.[].ipv4.bfd") | Boolean | | | | Enable/Disable BFD. |
+ | [ make_before_break](## "router_pim_sparse_mode.vrfs.[].ipv4.make_before_break") | Boolean | | | | Enable/Disable Make-Before-Break. |
| [ rp_addresses](## "router_pim_sparse_mode.vrfs.[].ipv4.rp_addresses") | List, items: Dictionary | | | | |
| [ - address](## "router_pim_sparse_mode.vrfs.[].ipv4.rp_addresses.[].address") | String | Required | | | RP Address. |
| [ groups](## "router_pim_sparse_mode.vrfs.[].ipv4.rp_addresses.[].groups") | List, items: String | | | | |
@@ -48,6 +50,9 @@
# Enable/Disable BFD.
bfd:
+ # Enable/Disable Make-Before-Break.
+ make_before_break:
+
# IPv4 Prefix associated with SSM.
ssm_range:
rp_addresses:
@@ -78,6 +83,9 @@
# Enable/Disable BFD.
bfd:
+
+ # Enable/Disable Make-Before-Break.
+ make_before_break:
rp_addresses:
# RP Address.
diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-pim-sparse-mode.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-pim-sparse-mode.j2
index 4c58ba50057..5c716d0f67f 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-pim-sparse-mode.j2
+++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-pim-sparse-mode.j2
@@ -12,6 +12,10 @@
{% if router_pim_sparse_mode.ipv4 is arista.avd.defined %}
BFD enabled: {{ router_pim_sparse_mode.ipv4.bfd | arista.avd.default(false) }}
+{% if router_pim_sparse_mode.ipv4.make_before_break is arista.avd.defined %}
+
+Make-before-break: {{ router_pim_sparse_mode.ipv4.make_before_break }}
+{% endif %}
{% if router_pim_sparse_mode.ipv4.rp_addresses is arista.avd.defined %}
##### IP Rendezvous Information
@@ -45,26 +49,30 @@ BFD enabled: {{ router_pim_sparse_mode.ipv4.bfd | arista.avd.default(false) }}
##### IP Sparse Mode VRFs
-| VRF Name | BFD Enabled |
-| -------- | ----------- |
+{% set any_ipv4_ip_addresses = namespace(present=false) %}
+| VRF Name | BFD Enabled | Make-before-break |
+| -------- | ----------- | ----------------- |
{% for vrf in router_pim_sparse_mode.vrfs | arista.avd.natural_sort('name') %}
-| {{ vrf.name }} | {{ vrf.ipv4.bfd | arista.avd.default(false) }} |
+{% set any_ipv4_ip_addresses.present = any_ipv4_ip_addresses.present or (vrf.ipv4.rp_addresses is arista.avd.defined and (vrf.ipv4.rp_addresses | length) > 0) %}
+| {{ vrf.name }} | {{ vrf.ipv4.bfd | arista.avd.default(false) }} | {{ vrf.ipv4.make_before_break | default("-") }} |
{% endfor %}
+{% if any_ipv4_ip_addresses.present %}
| VRF Name | Rendezvous Point Address | Group Address | Access Lists | Priority | Hashmask | Override |
| -------- | ------------------------ | ------------- | ------------ | -------- | -------- | -------- |
-{% for vrf in router_pim_sparse_mode.vrfs | arista.avd.natural_sort('name') %}
-{% if vrf.ipv4.rp_addresses is arista.avd.defined %}
-{% for rp_address in vrf.ipv4.rp_addresses | arista.avd.natural_sort('address') %}
-{% set rp_groups = rp_address.groups | arista.avd.default(['-']) | join(', ') %}
-{% set access_lists = rp_address.access_lists | arista.avd.default(['-']) | join(', ') %}
-{% set priority = rp_address.priority | arista.avd.default('-') %}
-{% set hashmask = rp_address.hashmask | arista.avd.default('-') %}
-{% set override = rp_address.override | arista.avd.default('-') %}
+{% for vrf in router_pim_sparse_mode.vrfs | arista.avd.natural_sort('name') %}
+{% if vrf.ipv4.rp_addresses is arista.avd.defined %}
+{% for rp_address in vrf.ipv4.rp_addresses | arista.avd.natural_sort('address') %}
+{% set rp_groups = rp_address.groups | arista.avd.default(['-']) | join(', ') %}
+{% set access_lists = rp_address.access_lists | arista.avd.default(['-']) | join(', ') %}
+{% set priority = rp_address.priority | arista.avd.default('-') %}
+{% set hashmask = rp_address.hashmask | arista.avd.default('-') %}
+{% set override = rp_address.override | arista.avd.default('-') %}
| {{ vrf.name }} | {{ rp_address.address }} | {{ rp_groups }} | {{ access_lists }} | {{ priority }} | {{ hashmask }} | {{ override }} |
-{% endfor %}
-{% endif %}
-{% endfor %}
+{% endfor %}
+{% endif %}
+{% endfor %}
+{% endif %}
{% endif %}
##### Router Multicast Device Configuration
diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-pim-sparse-mode.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-pim-sparse-mode.j2
index 84875e9ae39..7bb8abbb289 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-pim-sparse-mode.j2
+++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-pim-sparse-mode.j2
@@ -15,6 +15,13 @@ router pim sparse-mode
{% if router_pim_sparse_mode.ipv4.bfd is arista.avd.defined(true) %}
bfd
{% endif %}
+{% if router_pim_sparse_mode.ipv4.make_before_break is arista.avd.defined %}
+{% if router_pim_sparse_mode.ipv4.make_before_break %}
+ make-before-break
+{% else %}
+ make-before-break disabled
+{% endif %}
+{% endif %}
{% for rp_address in router_pim_sparse_mode.ipv4.rp_addresses | arista.avd.natural_sort('address') %}
{% set rp_options_cli = "" %}
{% if rp_address.priority is arista.avd.defined %}
@@ -59,6 +66,13 @@ router pim sparse-mode
{% if vrf.ipv4.bfd is arista.avd.defined(true) %}
bfd
{% endif %}
+{% if vrf.ipv4.make_before_break is arista.avd.defined %}
+{% if vrf.ipv4.make_before_break %}
+ make-before-break
+{% else %}
+ make-before-break disabled
+{% endif %}
+{% endif %}
{% for rp_address in vrf.ipv4.rp_addresses | arista.avd.natural_sort('address') %}
{% set rp_options_cli = "" %}
{% if rp_address.priority is arista.avd.defined %}
diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
index f7f1a52ec28..042cf8d9eec 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
+++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
@@ -19421,6 +19421,9 @@ keys:
bfd:
type: bool
description: Enable/Disable BFD.
+ make_before_break:
+ type: bool
+ description: Enable/Disable Make-Before-Break.
ssm_range:
type: str
description: IPv4 Prefix associated with SSM.
@@ -19491,6 +19494,9 @@ keys:
bfd:
type: bool
description: Enable/Disable BFD.
+ make_before_break:
+ type: bool
+ description: Enable/Disable Make-Before-Break.
rp_addresses:
type: list
items:
diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_pim_sparse_mode.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_pim_sparse_mode.schema.yml
index c10d5bf0a87..52d7ba41ecd 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_pim_sparse_mode.schema.yml
+++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_pim_sparse_mode.schema.yml
@@ -15,6 +15,9 @@ keys:
bfd:
type: bool
description: Enable/Disable BFD.
+ make_before_break:
+ type: bool
+ description: Enable/Disable Make-Before-Break.
ssm_range:
type: str
description: IPv4 Prefix associated with SSM.
@@ -85,6 +88,9 @@ keys:
bfd:
type: bool
description: Enable/Disable BFD.
+ make_before_break:
+ type: bool
+ description: Enable/Disable Make-Before-Break.
rp_addresses:
type: list
items: