Skip to content

Commit

Permalink
Adding new key for vlan ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Laxmikant Chintakindi committed Dec 4, 2024
1 parent 01469f9 commit e323630
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ vxlan_interface:
- 10.1.1.11
- id: 112
multicast_group: 239.9.1.6
- id: 113,115-118
vni: 10113,10115-10118
- id: 113
multicast_group: 239.2.2.2
vlan_range:
vlans: 113,115-118
vnis: 10113,10115-10118

vrfs:
- name: Tenant_A_OP_Zone
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,36 @@
{% elif vxlan_config.vxlan.multicast.headend_replication is arista.avd.defined(false) %}
| Multicast headend-replication | Disabled |
{% endif %}
{% if vxlan_config.vxlan.vlans is arista.avd.defined %}
{% if vxlan_config.vxlan.vlans is arista.avd.defined or vxlan_config.vxlan.vlan_range is arista.avd.defined %}

##### VLAN to VNI, Flood List and Multicast Group Mappings

| VLAN | VNI | Flood List | Multicast Group |
| ---- | --- | ---------- | --------------- |
{% 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 [] %}
{% for idx in range(vlans | length) %}
{% set vlan = vlans[idx] %}
{% set vni_value = vni[idx] if (vni | length > idx) else '-' %}
{% 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 %}
{% for vlan in vxlan_config.vxlan.vlans %}
{% do all_vlans.setdefault(vlan.id, {}) %}
{% if vlan.vni is arista.avd.defined %}
{% do all_vlans[vlan.id].update({"vni": vlan.vni}) %}
{% endif %}
{% if vlan.multicast_group is arista.avd.defined %}
{% do all_vlans[vlan.id].update({"multicast_group": vlan.multicast_group}) %}
{% endif %}
{% if vlan.flood_vteps is arista.avd.defined %}
{% do all_vlans[vlan.id].update({'flood_list': vlan.flood_vteps | join('<br/>')}) %}
{% endif %}
{% endfor %}
{% for vlan in all_vlans.values() | arista.avd.natural_sort("vlan") %}
| {{ vlan.vlan }} | {{ vlan.vni | arista.avd.default('-') }} | {{ vlan.flood_vteps | arista.avd.default('-') }} | {{ vlan.multicast_group | arista.avd.default('-') }} |
{% if vxlan_config.vxlan.vlan_range.vlans is arista.avd.defined and vxlan_config.vxlan.vlan_range.vnis is arista.avd.defined %}
{% set vlans = vxlan_config.vxlan.vlan_range.vlans | arista.avd.range_expand %}
{% for vlan in vlans %}
{% do all_vlans.setdefault(vlan, {}) %}
{% set vnis = vxlan_config.vxlan.vlan_range.vnis | arista.avd.range_expand %}
{% set vni = vnis[vlans.index(vlan)] %}
{% do all_vlans[vlan].update({"vni": vni}) %}
{% endfor %}
{% endif %}
{% for vlan, data in all_vlans.items() | arista.avd.natural_sort %}
| {{ vlan }} | {{ data.vni | arista.avd.default('-') }} | {{ data.flood_list | arista.avd.default('-') }} | {{ data.multicast_group | arista.avd.default('-') }} |
{% endfor %}
{% endif %}
{% if vxlan_config.vxlan.vrfs is arista.avd.defined %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ interface Vxlan1
{% endif %}
{% for vlan in vxlan_config.vxlan.vlans | arista.avd.natural_sort('id') %}
{% if vlan.vni is arista.avd.defined %}
{% if vlan.id | arista.avd.range_expand | length == vlan.vni | arista.avd.range_expand | length %}
vxlan vlan {{ vlan.id }} vni {{ vlan.vni }}
{% endif %}
{% endif %}
{% endfor %}
{% if vxlan_config.vxlan.vlan_range is arista.avd.defined %}
{% if vxlan_config.vxlan.vlan_range.vlans is arista.avd.defined and vxlan_config.vxlan.vlan_range.vnis is arista.avd.defined %}
vxlan vlan {{ vxlan_config.vxlan.vlan_range.vlans }} vni {{ vxlan_config.vxlan.vlan_range.vnis }}
{% endif %}
{% endif %}
{% for vrf in vxlan_config.vxlan.vrfs | arista.avd.natural_sort('name') %}
{% if vrf.vni is arista.avd.defined %}
vxlan vrf {{ vrf.name }} vni {{ vrf.vni }}
Expand Down
Loading

0 comments on commit e323630

Please sign in to comment.