-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #646 from ClausHolbechArista/expand-custom-structu…
…red-configuration Add support for multiple custom_structured_configuration prefixes
- Loading branch information
Showing
12 changed files
with
115 additions
and
11 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
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
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
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
11 changes: 11 additions & 0 deletions
11
...ions/arista/avd/molecule/evpn_underlay_ebgp_overlay_ebgp/inventory/group_vars/DC1_BL1.yml
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
my_dci_ethernet_interfaces: | ||
Ethernet4000: | ||
description: My test | ||
ip_address: 10.1.2.3/12 | ||
shutdown: false | ||
type: routed | ||
mtu: 1500 | ||
peer: MY-own-peer | ||
peer_interface: Ethernet123 | ||
peer_type: my_precious |
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
4 changes: 4 additions & 0 deletions
4
...ions/arista/avd/molecule/evpn_underlay_ebgp_overlay_ebgp/inventory/host_vars/DC1-BL1A.yml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
my_special_dci_ethernet_interfaces: | ||
Ethernet4000: | ||
ip_address: 10.3.2.1/21 |
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
27 changes: 20 additions & 7 deletions
27
...lections/arista/avd/roles/eos_l3ls_evpn/templates/base/custom_structured_configuration.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,13 +1,26 @@ | ||
{% set tmp_custom_structured_configuration = {} %} | ||
{% for key_name in hostvars[inventory_hostname].keys() %} | ||
{% if key_name | regex_search('^' ~ custom_structured_configuration_prefix) %} | ||
{% set tmp_key_name = key_name | regex_replace('^' ~ custom_structured_configuration_prefix) %} | ||
{% do tmp_custom_structured_configuration.update( { tmp_key_name : hostvars[inventory_hostname][key_name] } ) %} | ||
{% set tmp_custom_structured_configurations = [ {} ] %} | ||
{% if custom_structured_configuration_prefix is arista.avd.defined %} | ||
{% if custom_structured_configuration_prefix is string %} | ||
{% set tmp_prefixes = [ custom_structured_configuration_prefix ] %} | ||
{% else %} | ||
{% set tmp_prefixes = custom_structured_configuration_prefix %} | ||
{% endif %} | ||
{% endfor %} | ||
{% for tmp_prefix in tmp_prefixes %} | ||
{% set tmp_custom_structured_configuration = {} %} | ||
{% for key_name in hostvars[inventory_hostname].keys() %} | ||
{% if key_name | regex_search('^' ~ tmp_prefix) %} | ||
{% set tmp_key_name = key_name | regex_replace('^' ~ tmp_prefix) %} | ||
{% do tmp_custom_structured_configuration.update( { tmp_key_name : hostvars[inventory_hostname][key_name] } ) %} | ||
{% endif %} | ||
{% endfor %} | ||
{% do tmp_custom_structured_configurations.append( tmp_custom_structured_configuration ) %} | ||
{% endfor %} | ||
{% endif %} | ||
{# By parsing the list of custom_structured_configurations to the combine filter, #} | ||
{# it will apply them one at a time, so the first can be overridden by the next etc. #} | ||
{{ | ||
lookup('template', root_dir ~ '/intended/structured_configs/' ~ inventory_hostname ~ '.yml') | | ||
from_yaml | | ||
combine(tmp_custom_structured_configuration, recursive=true) | | ||
combine(tmp_custom_structured_configurations, recursive=true) | | ||
to_nice_yaml(indent=2,sort_keys=False) | ||
}} |