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): Add default: default for ip_name_servers[].vrf #4842

Closed
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 @@ -379,25 +379,29 @@ ip domain-list domain2.local

| Name Server | VRF | Priority |
| ----------- | --- | -------- |
| 10.10.128.10 | - | - |
| 10.10.129.10 | - | 0 |
| 10.10.128.10 | default | - |
| 10.10.129.10 | default | 0 |
| 10.10.128.10 | mgmt | - |
| 10.10.128.10 | TEST | 3 |
| 2001:db8::1 | - | - |
| 2001:db8::2 | - | 0 |
| 2001:db8::1 | default | - |
| 2001:db8::2 | default | 0 |
| 2001:db8::1 | mgmt | - |
| 2001:db8::2 | TEST | 3 |
| 2001:db8::1 | TEST | 3 |
| 10.10.128.11 | TEST | 2 |

#### IP Name Servers Device Configuration

```eos
ip name-server 10.10.128.10
ip name-server vrf default 10.10.128.10
ip name-server vrf default 10.10.129.10
ip name-server vrf default 2001:db8::1
ip name-server vrf default 2001:db8::2
ip name-server vrf mgmt 10.10.128.10
ip name-server vrf TEST 10.10.128.10 priority 3
ip name-server 10.10.129.10 priority 0
ip name-server 2001:db8::1
ip name-server vrf mgmt 2001:db8::1
ip name-server 2001:db8::2 priority 0
ip name-server vrf TEST 10.10.128.11 priority 2
ip name-server vrf TEST 10.10.128.10 priority 3
ip name-server vrf TEST 2001:db8::1 priority 3
ip name-server vrf TEST 2001:db8::2 priority 3
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,15 @@ ip nat profile NAT-PROFILE-TEST-VRF vrf TEST
hostname hostname-set-via-hostname-var
ip domain lookup source-interface Loopback0
ip domain lookup vrf mgt source-interface Management0
ip name-server 10.10.128.10
ip name-server vrf default 10.10.128.10
ip name-server vrf default 10.10.129.10
ip name-server vrf default 2001:db8::1
ip name-server vrf default 2001:db8::2
ip name-server vrf mgmt 10.10.128.10
ip name-server vrf TEST 10.10.128.10 priority 3
ip name-server 10.10.129.10 priority 0
ip name-server 2001:db8::1
ip name-server vrf mgmt 2001:db8::1
ip name-server 2001:db8::2 priority 0
ip name-server vrf TEST 10.10.128.11 priority 2
ip name-server vrf TEST 10.10.128.10 priority 3
ip name-server vrf TEST 2001:db8::1 priority 3
ip name-server vrf TEST 2001:db8::2 priority 3
dns domain test.local
ip domain-list domain1.local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ ip_name_servers:
- ip_address: 2001:db8::2
vrf: TEST
priority: 3
- ip_address: 2001:db8::1
vrf: TEST
priority: 3
- ip_address: 10.10.128.11
vrf: TEST
priority: 2
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ transceiver qsfp default-mode 4x10G
service routing protocols model multi-agent
!
hostname custom-structured-configuration
ip name-server vrf MGMT 192.168.42.10
ip name-server vrf MGMT 192.168.42.40
ip name-server vrf MGMT 192.168.42.50
ip name-server vrf VRF1 192.168.42.1
ip name-server vrf VRF2 192.168.42.1
ip name-server vrf VRF1 192.168.42.4
ip name-server vrf VRF2 192.168.42.8
ip name-server vrf MGMT 192.168.42.10
ip name-server vrf VRF1 192.168.42.10
ip name-server vrf MGMT 192.168.42.40
ip name-server vrf VRF2 192.168.42.1
ip name-server vrf VRF2 192.168.42.8
ip name-server vrf VRF2 192.168.42.40
ip name-server vrf MGMT 192.168.42.50
!
vrf instance MGMT
!
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 @@ -13,7 +13,7 @@
| Name Server | VRF | Priority |
| ----------- | --- | -------- |
{% for name_server in ip_name_servers | arista.avd.default([]) %}
| {{ name_server.ip_address }} | {{ name_server.vrf | arista.avd.default('-') }} | {{ name_server.priority | arista.avd.default('-') }} |
| {{ name_server.ip_address }} | {{ name_server.vrf | arista.avd.default('default') }} | {{ name_server.priority | arista.avd.default('-') }} |
{% endfor %}

#### IP Name Servers Device Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,24 @@
that can be found in the LICENSE file.
#}
{# eos - ip name servers #}
{% for name_server in ip_name_servers | arista.avd.natural_sort('ip_address') %}
{% set name_server_cli = "ip name-server" %}
{% if name_server.vrf is arista.avd.defined %}
{% set name_server_cli = name_server_cli ~ " vrf " ~ name_server.vrf %}
{% endif %}
{% set name_server_cli = name_server_cli ~ " " ~ name_server.ip_address %}
{% if name_server.priority is arista.avd.defined %}
{% set name_server_cli = name_server_cli ~ " priority " ~ name_server.priority %}
{% endif %}
{{ name_server_cli }}
{% endfor %}
{% if ip_name_servers is arista.avd.defined %}
{% set all_name_servers = [] %}
{% for name_server in ip_name_servers %}
{% set server = {'ip_address':"",'priority': 0, 'vrf': 'default'} %}
{% do server.update({'ip_address': name_server.ip_address}) %}
{% if name_server.priority is arista.avd.defined %}
{% do server.update({'priority': name_server.priority}) %}
{% endif %}
{% if name_server.vrf is arista.avd.defined %}
{% do server.update({'vrf': name_server.vrf}) %}
{% endif %}
{% do all_name_servers.append(server) %}
{% endfor %}
{% for name_server in all_name_servers | arista.avd.natural_sort('ip_address') | arista.avd.natural_sort('vrf') | arista.avd.natural_sort('priority') %}
{% if name_server.priority | int == 0 %}
ip name-server vrf {{ name_server.vrf }} {{ name_server.ip_address }}
{% else %}
ip name-server vrf {{ name_server.vrf }} {{ name_server.ip_address }} priority {{ name_server.priority }}
{% endif %}
{% endfor %}
{% endif %}
17 changes: 13 additions & 4 deletions python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py

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

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 @@ -18,6 +18,7 @@ keys:
vrf:
description: VRF Name.
type: str
default: default
convert_types:
- int
priority:
Expand Down
Loading