Skip to content

Commit

Permalink
Feat(eos_cli_config_gen): Add support for ip name server groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Laxmikant Chintakindi authored and Laxmikant Chintakindi committed Nov 26, 2024
1 parent 766dd59 commit 13bff48
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,10 @@ monitor server radius
| Name | Interfaces |
| ---- | ---------- |

##### Name-server

Name-server Group: mynameserver1

### Monitor Connectivity Device Configuration

```eos
Expand Down Expand Up @@ -1991,6 +1995,7 @@ monitor connectivity
url https://server2.local.com
!
vrf yellow
name-server group mynameserver1
interval 5
no shutdown
interface set GLOBAL_SET Ethernet1-4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ monitor server radius
probe threshold failure 100
probe method access-request username arista password 7 141600021F102B
!
ip name-server group mynameserver0
name-server vrf default 1.1.1.1
name-server vrf default 8.8.8.8
name-server vrf default 2.2.2.2 priority 1
dns domain arista.avd.com
ip domain-list domain-list1
!
ip name-server group mynameserver1
name-server vrf default 1.1.1.1
name-server vrf vrf1 8.8.8.8
name-server vrf vrf1 2.2.2.2 priority 1
dns domain arista.avd.com
ip domain-list domain-list1
!
ip nat translation address selection hash field source-ip
ip nat translation address selection any
ip nat translation tcp-timeout 7200
Expand Down Expand Up @@ -2996,6 +3010,7 @@ monitor connectivity
url https://server2.local.com
!
vrf yellow
name-server group mynameserver1
interval 5
no shutdown
interface set GLOBAL_SET Ethernet1-4
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
ip_name_server_groups:
- name: mynameserver1
ip_domain_list: domain-list1
dns_domain: arista.avd.com
name_servers:
- ip_address: 8.8.8.8
vrf: vrf1
- ip_address: 1.1.1.1
- ip_address: 2.2.2.2
vrf: vrf1
priority: 1
- name: mynameserver0
ip_domain_list: domain-list1
dns_domain: arista.avd.com
name_servers:
- ip_address: 8.8.8.8
- ip_address: 1.1.1.1
- ip_address: 2.2.2.2
priority: 1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ monitor_connectivity:
- name: HOST_SET
interfaces: Loopback2-4, Loopback10-12
local_interfaces: GLOBAL_SET
name_server_group: mynameserver1
hosts:
- name: server1
description: server1_connectivity_monitor
Expand Down

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.

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 @@ -81,6 +81,12 @@
{% endif %}
{% endfor %}
{% endif %}
{% if monitor_connectivity.name_server_group is arista.avd.defined %}

##### Name-server

Name-server Group: {{ monitor_connectivity.name_server_group }}
{% endif %}

### Monitor Connectivity Device Configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
{% include 'eos/mcs-client.j2' %}
{# monitor server radius #}
{% include 'eos/monitor-server-radius.j2' %}
{# ip name-server groups #}
{% include 'eos/ip-name-server-groups.j2' %}
{# platform - trident#}
{% include 'eos/platform-trident.j2' %}
{# IP NAT - Part 1#}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{#
Copyright (c) 2023-2024 Arista Networks, Inc.
Use of this source code is governed by the Apache License 2.0
that can be found in the LICENSE file.
#}
{% for name_server_group in ip_name_server_groups | arista.avd.natural_sort("name") %}
!
ip name-server group {{ name_server_group.name }}
{% for name_server in name_server_group.name_servers | arista.avd.natural_sort("ip_address") %}
{% if name_server.priority is not arista.avd.defined %}
{% set name_server_cli = "name-server vrf " ~ name_server.vrf | arista.avd.default("default") ~ " " ~ name_server.ip_address %}
{{ name_server_cli }}
{% endif %}
{% endfor %}
{% for name_server in name_server_group.name_servers | arista.avd.natural_sort("ip_address") %}
{% if name_server.priority is arista.avd.defined %}
{% set name_server_cli = "name-server vrf " ~ name_server.vrf | arista.avd.default("default") ~ " " ~ name_server.ip_address ~ " priority " ~ name_server.priority %}
{{ name_server_cli }}
{% endif %}
{% endfor %}
{% if name_server_group.dns_domain is arista.avd.defined %}
dns domain {{ name_server_group.dns_domain }}
{% endif %}
{% if name_server_group.ip_domain_list is arista.avd.defined %}
ip domain-list {{ name_server_group.ip_domain_list }}
{% endif %}
{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ monitor connectivity
{% endfor %}
{% endif %}
{% endfor %}
{% if monitor_connectivity.name_server_group is arista.avd.defined %}
name-server group {{ monitor_connectivity.name_server_group }}
{% endif %}
{% if monitor_connectivity.interval is arista.avd.defined %}
interval {{ monitor_connectivity.interval }}
{% 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
@@ -0,0 +1,24 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
# yaml-language-server: $schema=../../../_schema/avd_meta_schema.json
# Line above is used by RedHat's YAML Schema vscode extension
# Use Ctrl + Space to get suggestions for every field. Autocomplete will pop up after typing 2 letters.
type: dict
keys:
ip_name_server_groups:
type: list
primary_key: name
items:
type: dict
keys:
name:
type: str
name_servers:
type: list
$ref: "eos_cli_config_gen#/$defs/ip_name_servers"
dns_domain:
type: str
ip_domain_list:
type: str
description: Set domain names to complete unqualified host names.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Line above is used by RedHat's YAML Schema vscode extension
# Use Ctrl + Space to get suggestions for every field. Autocomplete will pop up after typing 2 letters.
type: dict
keys:
$defs:
ip_name_servers:
type: list
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ keys:
default: true
url:
type: str
name_server_group:
type: str
description: Set name-server group.
vrfs:
type: list
primary_key: name
Expand Down

0 comments on commit 13bff48

Please sign in to comment.