Skip to content

Commit

Permalink
Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Laxmikant Chintakindi committed Dec 2, 2024
1 parent ced8bd0 commit 01469f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,23 @@
{% 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('<br/>') 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: {
'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']
}) %}
{% do all_vlans.setdefault(vlan, {'vlan': vlan}) %}
{% 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('<br/>')}) %}
{% 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 %}
Expand Down

0 comments on commit 01469f9

Please sign in to comment.