Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor(eos_cli_config_gen): Wildcard dict to list for interface-groups #1644

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bgp_groups:
vrf: red

interface_groups:
SFP_Interface_Group:
- name: SFP_Interface_Group
interfaces:
- Ethernet10-20
- Ethernet30-48
Expand All @@ -27,7 +27,7 @@ interface_groups:
- downlink-interfaces
- ix-interfaces

QSFP_Interface_Group:
- name: QSFP_Interface_Group
interfaces:
- Ethernet1,5
interface_maintenance_profiles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1555,7 +1555,7 @@ bgp_groups:

```yaml
interface_groups:
< group_name >:
- name: < group_name >
interfaces:
- "< interface_or_interface_range >"
bgp_maintenance_profiles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

| Interface Group | Interfaces | Interface maintenance profile | BGP maintenance profiles |
| --------------- | ---------- | ----------------------------- | ------------------------ |
{% for interface_group in interface_groups | arista.avd.natural_sort %}
{% set interfaces = interface_groups[interface_group].interfaces | arista.avd.natural_sort | join('<br>') %}
{% if interface_groups[interface_group].interface_maintenance_profiles is arista.avd.defined %}
{% set interface_profile = interface_groups[interface_group].interface_maintenance_profiles | arista.avd.natural_sort | join('<br>') %}
{% for interface_group in interface_groups | arista.avd.convert_dicts('name') | arista.avd.natural_sort('name') %}
{% set interfaces = interface_group.interfaces | arista.avd.natural_sort | join('<br>') %}
{% if interface_group.interface_maintenance_profiles is arista.avd.defined %}
{% set interface_profile = interface_group.interface_maintenance_profiles | arista.avd.natural_sort | join('<br>') %}
{% else %}
{% set interface_profile = maintenance.default_interface_profile | arista.avd.default('Default') %}
{% endif %}
{% if interface_groups[interface_group].bgp_maintenance_profiles is arista.avd.defined %}
{% set bgp_profile = interface_groups[interface_group].bgp_maintenance_profiles | arista.avd.natural_sort | join('<br>') %}
{% if interface_group.bgp_maintenance_profiles is arista.avd.defined %}
{% set bgp_profile = interface_group.bgp_maintenance_profiles | arista.avd.natural_sort | join('<br>') %}
{% else %}
{% set bgp_profile = maintenance.default_bgp_profile | arista.avd.default('Default') %}
{% endif %}
| {{ interface_group }} | {{ interfaces }} | {{ interface_profile }} | {{ bgp_profile }} |
| {{ interface_group.name }} | {{ interfaces }} | {{ interface_profile }} | {{ bgp_profile }} |
{% endfor %}

### Interface Groups Configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% for interface_group in interface_groups | arista.avd.natural_sort %}
{% for interface_group in interface_groups | arista.avd.convert_dicts('name') | arista.avd.natural_sort('name') %}
!
group interface {{ interface_group }}
{% for interface in interface_groups[interface_group].interfaces | arista.avd.natural_sort %}
group interface {{ interface_group.name }}
{% for interface in interface_group.interfaces | arista.avd.natural_sort %}
interface {{ interface }}
{% endfor %}
{% for interface_profile in interface_groups[interface_group].interface_maintenance_profiles | arista.avd.natural_sort %}
{% for interface_profile in interface_group.interface_maintenance_profiles | arista.avd.natural_sort %}
maintenance profile interface {{ interface_profile }}
{% endfor %}
{% for bgp_profile in interface_groups[interface_group].bgp_maintenance_profiles | arista.avd.natural_sort %}
{% for bgp_profile in interface_group.bgp_maintenance_profiles | arista.avd.natural_sort %}
maintenance profile bgp {{ bgp_profile }}
{% endfor %}
{% endfor %}