-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor tenants logic * Small optimization for l2leaf logic
- Loading branch information
1 parent
921758d
commit 421c80e
Showing
17 changed files
with
280 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 14 additions & 18 deletions
32
...s/arista/avd/roles/eos_designs/templates/designs/l3ls-evpn/tenants/ethernet-interfaces.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
{# Leaf Tenant l3 interfaces #} | ||
ethernet_interfaces: | ||
{% for tenant in tenants | arista.avd.natural_sort if tenant in switch.filter_tenants or "all" in switch.filter_tenants %} | ||
{% if tenants[tenant].vrfs is arista.avd.defined %} | ||
{% for vrf in tenants[tenant].vrfs %} | ||
{% if tenants[tenant].vrfs[vrf].l3_interfaces is arista.avd.defined %} | ||
{% for l3_interface in tenants[tenant].vrfs[vrf].l3_interfaces %} | ||
{% if l3_interface.nodes is arista.avd.defined and l3_interface.ip_addresses is arista.avd.defined and l3_interface.interfaces is arista.avd.defined and inventory_hostname in l3_interface.nodes %} | ||
{% for node in l3_interface.nodes %} | ||
{% if node == inventory_hostname %} | ||
{% for tenant in switch.tenants | arista.avd.natural_sort %} | ||
{% for vrf in switch.tenants[tenant].vrfs | arista.avd.natural_sort %} | ||
{% for l3_interface in tenants[tenant].vrfs[vrf].l3_interfaces | arista.avd.default([]) %} | ||
{% if l3_interface.nodes is arista.avd.defined and l3_interface.ip_addresses is arista.avd.defined and l3_interface.interfaces is arista.avd.defined and inventory_hostname in l3_interface.nodes %} | ||
{% for node in l3_interface.nodes %} | ||
{% if node == inventory_hostname %} | ||
{{ l3_interface.interfaces[loop.index0] }}: | ||
type: routed | ||
peer_type: l3_interface | ||
vrf: {{ vrf }} | ||
ip_address: {{ l3_interface.ip_addresses[loop.index0] }} | ||
{% if l3_interface.mtu is arista.avd.defined %} | ||
{% if l3_interface.mtu is arista.avd.defined %} | ||
mtu: {{ l3_interface.mtu }} | ||
{% endif %} | ||
{% if l3_interface.enabled is arista.avd.defined(false) %} | ||
{% endif %} | ||
{% if l3_interface.enabled is arista.avd.defined(false) %} | ||
shutdown: true | ||
{% else %} | ||
{% else %} | ||
shutdown: false | ||
{% endif %} | ||
{% if l3_interface.description is arista.avd.defined %} | ||
{% endif %} | ||
{% if l3_interface.description is arista.avd.defined %} | ||
description: {{ l3_interface.description }} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} |
81 changes: 21 additions & 60 deletions
81
...ions/arista/avd/roles/eos_designs/templates/designs/l3ls-evpn/tenants/ip-igmp-snooping.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,38 @@ | ||
{# Leaf tenant IGMP snooping #} | ||
{% set igmp_snooping = namespace() %} | ||
{% set igmp_snooping.configured = false %} | ||
{% if switch.igmp_snooping_enabled == true %} | ||
{% set igmp_snooping.configured = true %} | ||
{% endif %} | ||
{# Detect if igmp-snopping is globally activated #} | ||
{% for tenant in tenants | arista.avd.natural_sort if tenant in switch.filter_tenants or "all" in switch.filter_tenants %} | ||
{% if tenants[tenant].vrfs is defined %} | ||
{% for vrf in tenants[tenant].vrfs | arista.avd.natural_sort if switch.vrfs is not none and vrf in switch.vrfs %} | ||
{% for svi in tenants[tenant].vrfs[vrf].svis | arista.avd.natural_sort if switch.svis is not none and svi | int in switch.svis %} | ||
{% if tenants[tenant].vrfs[vrf].svis[svi].igmp_snooping is defined %} | ||
{% set igmp_snooping.configured = true %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} | ||
{% if tenants[tenant].l2vlans is defined %} | ||
{% for l2vlan in tenants[tenant].l2vlans | arista.avd.natural_sort %} | ||
{% if tenants[tenant].l2vlans[l2vlan].igmp_snooping is defined %} | ||
{% set igmp_snooping.configured = true %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{# End igmp-snopping status detection #} | ||
ip_igmp_snooping: | ||
globally_enabled: {{ switch.igmp_snooping_enabled }} | ||
{% if igmp_snooping.configured == true %} | ||
{% if switch.igmp_snooping_enabled is arista.avd.defined(true) %} | ||
vlans: | ||
{# ---------------------------- #} | ||
{# SVI & L3VLANs services #} | ||
{# ---------------------------- #} | ||
{% for tenant in tenants | arista.avd.natural_sort if tenant in switch.filter_tenants or "all" in switch.filter_tenants %} | ||
## {{ tenant }} ## | ||
{% if tenants[tenant].vrfs is defined %} | ||
{% for vrf in tenants[tenant].vrfs | arista.avd.natural_sort if switch.vrfs is not none and vrf in switch.vrfs %} | ||
{% for tenant in switch.tenants | arista.avd.natural_sort %} | ||
{% for vrf in switch.tenants[tenant].vrfs | arista.avd.natural_sort %} | ||
{# Tenant VLANs w/SVIs #} | ||
{% for svi in tenants[tenant].vrfs[vrf].svis | arista.avd.natural_sort if switch.svis is not none and svi | int in switch.svis %} | ||
{% for svi in switch.tenants[tenant].vrfs[vrf].svis | arista.avd.natural_sort %} | ||
{% set svi_config = tenants[tenant].vrfs[vrf].svis[svi] %} | ||
{# Detect if a svi_profile exists #} | ||
{# If exists, create a shortpath to access profile data #} | ||
{% set per_svi = namespace() %} | ||
{% set profile = namespace() %} | ||
{% set per_svi.values = tenants[tenant].vrfs[vrf].svis[svi] %} | ||
{% if svi_profiles is defined and svi_profiles is not none %} | ||
{% if tenants[tenant].vrfs[vrf].svis[svi].profile is defined %} | ||
{% if tenants[tenant].vrfs[vrf].svis[svi].profile in svi_profiles %} | ||
{% set profile.values = svi_profiles[tenants[tenant].vrfs[vrf].svis[svi].profile] %} | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} | ||
{# End svi_profile detection #} | ||
{# IGMP SNOOPING detection #} | ||
{% if per_svi.values.igmp_snooping_enabled is defined or profile.values.igmp_snooping_enabled is defined %} | ||
{% if switch.igmp_snooping_enabled == true %} | ||
{% if svi_config.profile is arista.avd.defined %} | ||
{% set svi_profile = svi_profiles[svi_config.profile] | arista.avd.default() %} | ||
{% endif %} | ||
{% set svi_igmp_snooping_enabled = svi_config.igmp_snooping_enabled | arista.avd.default( | ||
svi_profile.igmp_snooping_enabled) %} | ||
{% if svi_igmp_snooping_enabled is arista.avd.defined %} | ||
{{ svi | int }}: | ||
enabled: {{ per_svi.values.igmp_snooping_enabled if per_svi.values.igmp_snooping_enabled is defined else profile.values.igmp_snooping_enabled | default(true) }} | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} | ||
enabled: {{ svi_igmp_snooping_enabled }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{# ---------------------------- #} | ||
{# L2VLANs services #} | ||
{# ---------------------------- #} | ||
{% if tenants[tenant].l2vlans is defined %} | ||
{% for l2vlan in tenants[tenant].l2vlans | arista.avd.natural_sort %} | ||
{% if tenants[tenant].l2vlans[l2vlan].igmp_snooping_enabled is defined %} | ||
{% if tenants[tenant].l2vlans[l2vlan].igmp_snooping_enabled == false and switch.igmp_snooping_enabled == true %} | ||
{% for l2vlan in switch.tenants[tenant].l2vlans | arista.avd.natural_sort %} | ||
{% set l2vlan_igmp_snooping_enabled = tenants[tenant].l2vlans[l2vlan].igmp_snooping_enabled | arista.avd.default() %} | ||
{% if l2vlan_igmp_snooping_enabled is arista.avd.defined %} | ||
{{ l2vlan | int }}: | ||
enabled: false | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} | ||
{% endif %} |
Oops, something went wrong.