Skip to content

Commit

Permalink
update logic in doc
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 4c907a0 commit ced8bd0
Showing 1 changed file with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,33 @@

| VLAN | VNI | Flood List | Multicast Group |
| ---- | --- | ---------- | --------------- |
{% set all_vlans = vxlan_config.vxlan.vlans | map(attribute='id') | map('arista.avd.range_expand') | sum(start=[]) %}
{% for all_vlans_item in all_vlans | arista.avd.natural_sort | unique %}
{% set vlan_namespace = namespace(vlan_vni = "-", flood_list = "-", multicast_group = "-") %}
{% for vxlan_vlans in vxlan_config.vxlan.vlans %}
{% set vlans = vxlan_vlans.id | arista.avd.range_expand %}
{% if all_vlans_item in vlans %}
{% if vxlan_vlans.vni is arista.avd.defined %}
{% set vlan_vnis = vxlan_vlans.vni | arista.avd.range_expand %}
{% set vlan_idx = vlans.index(all_vlans_item) %}
{% if vlans | length == vlan_vnis | length %}
{% set vlan_namespace.vlan_vni = vlan_vnis[vlan_idx] %}
{% else %}
{% set vlan_namespace.vlan_vni = "-" %}
{% endif %}
{% endif %}
{% if vxlan_vlans.multicast_group is arista.avd.defined %}
{% set vlan_namespace.multicast_group = vxlan_vlans.multicast_group %}
{% endif %}
{% if vxlan_vlans.flood_vteps is arista.avd.defined %}
{% set vlan_namespace.flood_list = vxlan_vlans.flood_vteps | join('<br/>') %}
{% endif %}
{% set all_vlans = {} %}
{% 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']
}) %}
{% endif %}
{% endfor %}
| {{ all_vlans_item }} | {{ vlan_namespace.vlan_vni }} | {{ vlan_namespace.flood_list }} | {{ vlan_namespace.multicast_group }} |
{% endfor %}
{% for vlan in all_vlans.values() | arista.avd.natural_sort("vlan") %}
| {{ vlan.vlan }} | {{ vlan.vni }} | {{ vlan.flood_vteps }} | {{ vlan.multicast_group }} |
{% endfor %}
{% endif %}
{% if vxlan_config.vxlan.vrfs is arista.avd.defined %}
Expand Down

0 comments on commit ced8bd0

Please sign in to comment.