From 3b5ee1c44de26662d07522674214ef14ddfbad95 Mon Sep 17 00:00:00 2001 From: Laxmikant Chintakindi Date: Mon, 2 Dec 2024 17:21:31 +0530 Subject: [PATCH] Update code --- .../host_vars/host1/vxlan-interface.yml | 1 + .../documentation/vxlan-interface.j2 | 24 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/vxlan-interface.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/vxlan-interface.yml index d79154011ad..2718dfbd302 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/vxlan-interface.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/vxlan-interface.yml @@ -38,6 +38,7 @@ vxlan_interface: vni: 10113,10115-10118 - id: 113 multicast_group: 239.2.2.2 + vrfs: - name: Tenant_A_OP_Zone vni: 10 diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vxlan-interface.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vxlan-interface.j2 index bf9d0b9f29b..9f4218762f8 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vxlan-interface.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vxlan-interface.j2 @@ -79,29 +79,25 @@ {% for vxlan_vlan in vxlan_config.vxlan.vlans %} {% set vlans = vxlan_vlan.id | arista.avd.range_expand %} {% set vni = vxlan_vlan.vni | arista.avd.range_expand if vxlan_vlan.vni is arista.avd.defined else [] %} -{% set multicast_group = vxlan_vlan.multicast_group | arista.avd.default('-') %} -{% set flood_vteps = vxlan_vlan.flood_vteps | join('
') if vxlan_vlan.flood_vteps is arista.avd.defined else '-' %} {% for idx in range(vlans | length) %} {% set vlan = vlans[idx] %} {% set vni_value = vni[idx] if (vni | length > idx) else '-' %} -{% if vlan not in all_vlans %} -{% do all_vlans.update({vlan: { +{% do all_vlans.setdefault(vlan, { 'vlan': vlan, - 'vni': vni_value, - 'multicast_group': multicast_group, - 'flood_vteps': flood_vteps - }}) %} -{% else %} -{% do all_vlans[vlan].update({ - 'vni': vni_value if all_vlans[vlan]['vni'] == '-' else all_vlans[vlan]['vni'], - 'multicast_group': multicast_group if all_vlans[vlan]['multicast_group'] == '-' else all_vlans[vlan]['multicast_group'], - 'flood_vteps': flood_vteps if all_vlans[vlan]['flood_vteps'] == '-' else all_vlans[vlan]['flood_vteps'] }) %} +{% if vni_value != '-' %} +{% do all_vlans[vlan].update({'vni': vni_value}) %} +{% endif %} +{% if vxlan_vlan.multicast_group is arista.avd.defined %} +{% do all_vlans[vlan].update({'multicast_group': vxlan_vlan.multicast_group}) %} +{% endif %} +{% if vxlan_vlan.flood_vteps is arista.avd.defined %} +{% do all_vlans[vlan].update({'flood_vteps': vxlan_vlan.flood_vteps | join('
')}) %} {% endif %} {% endfor %} {% endfor %} {% for vlan in all_vlans.values() | arista.avd.natural_sort("vlan") %} -| {{ vlan.vlan }} | {{ vlan.vni }} | {{ vlan.flood_vteps }} | {{ vlan.multicast_group }} | +| {{ vlan.vlan }} | {{ vlan.vni | arista.avd.default('-') }} | {{ vlan.flood_vteps | arista.avd.default('-') }} | {{ vlan.multicast_group | arista.avd.default('-') }} | {% endfor %} {% endif %} {% if vxlan_config.vxlan.vrfs is arista.avd.defined %}