Skip to content

Commit

Permalink
Fixing order
Browse files Browse the repository at this point in the history
  • Loading branch information
Vibhu-gslab committed Nov 7, 2024
1 parent 74ce852 commit eb9f8df
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ interface Loopback0
| 1.10.1.2 | - | none |
| 1.21.1.20 | - | md5 |
| 10.1.1.2 | 303 | - |
| 2::11.22.33.44 | 3133 | none |
| 2001::db8 | 31 | none |

##### RSVP Graceful Restart

Expand Down Expand Up @@ -184,6 +186,10 @@ mpls rsvp
neighbor 1.10.1.2 authentication type none
neighbor 1.21.1.20 authentication type md5
neighbor 10.1.1.2 authentication index 303 active
neighbor 2::11.22.33.44 authentication type none
neighbor 2::11.22.33.44 authentication index 3133 active
neighbor 2001::db8 authentication type none
neighbor 2001::db8 authentication index 31 active
ip access-group RSVP_access_group_ipv4
ipv6 access-group RSVP_access_group_ipv6
fast-reroute reversion local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ mpls rsvp
neighbor 1.10.1.2 authentication type none
neighbor 1.21.1.20 authentication type md5
neighbor 10.1.1.2 authentication index 303 active
neighbor 2::11.22.33.44 authentication type none
neighbor 2::11.22.33.44 authentication index 3133 active
neighbor 2001::db8 authentication type none
neighbor 2001::db8 authentication index 31 active
ip access-group RSVP_access_group_ipv4
ipv6 access-group RSVP_access_group_ipv6
fast-reroute reversion local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ mpls:
authentication:
index: 3
type: md5
- ipv6_address: 2::11.22.33.44
authentication:
index: 3133
type: none
- ip_address: 10.1.1.2
authentication:
index: 303
- ip_address: 1.1.12.2
authentication:
index: 30
type: none
- ipv6_address: 2001::db8
authentication:
index: 31
type: none
- ip_address: 1.21.1.20
authentication:
type: md5
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 @@ -70,8 +70,15 @@

| Neighbor IP | Index | Type |
| ----------- | ----- | ---- |
{% for neighbor in mpls.rsvp.neighbors | arista.avd.natural_sort('ip_address') %}
{% set with_neighbor_ipv4_address = mpls.rsvp.neighbors | selectattr('ip_address', 'arista.avd.defined') | arista.avd.natural_sort('ip_address') %}
{% set with_neighbor_ipv6_address = mpls.rsvp.neighbors | selectattr('ipv6_address', 'arista.avd.defined') | arista.avd.natural_sort('ipv6_address') %}
{% set sorted_ip_addresses = with_neighbor_ipv4_address | list + with_neighbor_ipv6_address | list %}
{% for neighbor in sorted_ip_addresses %}
{% if neighbor.ip_address is arista.avd.defined %}
| {{ neighbor.ip_address }} | {{ neighbor.authentication.index | arista.avd.default('-') }} | {{ neighbor.authentication.type | arista.avd.default('-') }} |
{% elif neighbor.ipv6_address is arista.avd.defined %}
| {{ neighbor.ipv6_address }} | {{ neighbor.authentication.index | arista.avd.default('-') }} | {{ neighbor.authentication.type | arista.avd.default('-') }} |
{% endif %}
{% endfor %}
{% endif %}
{% if mpls.rsvp.graceful_restart is arista.avd.defined %}
Expand Down
26 changes: 18 additions & 8 deletions python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,24 @@ mpls rsvp
authentication index {{ auth.active_index }} active
{% endif %}
{% endif %}
{% for neighbor in mpls.rsvp.neighbors | arista.avd.natural_sort('ip_address') %}
{% if neighbor.authentication.type is arista.avd.defined %}
neighbor {{ neighbor.ip_address }} authentication type {{ neighbor.authentication.type }}
{% endif %}
{% if neighbor.authentication.index is arista.avd.defined %}
neighbor {{ neighbor.ip_address }} authentication index {{ neighbor.authentication.index }} active
{% endif %}
{% endfor %}
{% if mpls.rsvp.neighbors is arista.avd.defined %}
{% set with_neighbor_ipv4_address = mpls.rsvp.neighbors | selectattr('ip_address', 'arista.avd.defined') | arista.avd.natural_sort('ip_address') %}
{% set with_neighbor_ipv6_address = mpls.rsvp.neighbors | selectattr('ipv6_address', 'arista.avd.defined') | arista.avd.natural_sort('ipv6_address') %}
{% set sorted_ip_addresses = with_neighbor_ipv4_address | list + with_neighbor_ipv6_address | list %}
{% for neighbor in sorted_ip_addresses %}
{% if neighbor.ip_address is arista.avd.defined %}
{% set ipaddress = neighbor.ip_address %}
{% elif neighbor.ipv6_address is arista.avd.defined %}
{% set ipaddress = neighbor.ipv6_address %}
{% endif %}
{% if neighbor.authentication.type is arista.avd.defined %}
neighbor {{ ipaddress }} authentication type {{ neighbor.authentication.type }}
{% endif %}
{% if neighbor.authentication.index is arista.avd.defined %}
neighbor {{ ipaddress }} authentication index {{ neighbor.authentication.index }} active
{% endif %}
{% endfor %}
{% endif %}
{% if mpls.rsvp.ip_access_group is arista.avd.defined %}
ip access-group {{ mpls.rsvp.ip_access_group }}
{% endif %}
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 @@ -106,12 +106,14 @@ keys:
neighbors:
description: Neighbor-specific configuration.
type: list
primary_key: ip_address
items:
type: dict
keys:
ip_address:
description: Neighbor's interface IPv4 or IPv6 address.
description: Neighbor's interface IPv4 address.
type: str
ipv6_address:
description: Neighbor's interface IPv6 address.
type: str
authentication:
description: Cryptographic authentication.
Expand Down

0 comments on commit eb9f8df

Please sign in to comment.