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

Feat(eos_cli_config_gen): Add support for configuring dhcp server ipv4 and dhcp server ipv6 for Port-Channel interfaces #4885

Merged
merged 5 commits into from
Jan 20, 2025
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 @@ -233,9 +233,9 @@ dhcp server

| Interface name | DHCP IPv4 | DHCP IPv6 |
| -------------- | --------- | --------- |
| Ethernet5 | True | False |
| Ethernet6 | True | False |
| Ethernet8 | True | False |
| Ethernet5 | True | - |
| Ethernet6 | True | - |
| Ethernet8 | True | - |

## Monitoring

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,7 @@ dhcp server vrf VRF01
| Interface name | DHCP IPv4 | DHCP IPv6 |
| -------------- | --------- | --------- |
| Ethernet64 | True | True |
| Port-Channel112 | True | True |

## System Boot Settings

Expand Down Expand Up @@ -5494,6 +5495,8 @@ interface Port-Channel112
switchport
ip address dhcp
dhcp client accept default-route
dhcp server ipv4
dhcp server ipv6
port-channel lacp fallback individual
port-channel lacp fallback timeout 5
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2059,6 +2059,8 @@ interface Port-Channel112
switchport
ip address dhcp
dhcp client accept default-route
dhcp server ipv4
dhcp server ipv6
port-channel lacp fallback individual
port-channel lacp fallback timeout 5
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,8 @@ port_channel_interfaces:
lacp_fallback_mode: individual
ip_address: dhcp
dhcp_client_accept_default_route: true
dhcp_server_ipv4: true
dhcp_server_ipv6: true

- name: Port-Channel113
description: interface_with_mpls_enabled
Expand All @@ -729,6 +731,8 @@ port_channel_interfaces:
ip_address: 172.31.128.9/31
# This won't be rendered because IP address is not DHCP
dhcp_client_accept_default_route: true
dhcp_server_ipv4: false
dhcp_server_ipv6: false
mpls:
ip: true
ldp:
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 @@ -5,12 +5,18 @@
#}
{# doc - dhcp server #}
{% set ethernet_interfaces_dhcp_server = [] %}
{% set port_channel_interfaces_dhcp_server = [] %}
{% for ethernet_interface in ethernet_interfaces | arista.avd.natural_sort('name') %}
{% if ethernet_interface.dhcp_server_ipv4 is arista.avd.defined(true) or ethernet_interface.dhcp_server_ipv4 is arista.avd.defined(true) %}
{% if ethernet_interface.dhcp_server_ipv4 is arista.avd.defined(true) or ethernet_interface.dhcp_server_ipv6 is arista.avd.defined(true) %}
{% do ethernet_interfaces_dhcp_server.append(ethernet_interface) %}
{% endif %}
{% endfor %}
{% if (ethernet_interfaces_dhcp_server | length > 0 or dhcp_servers is arista.avd.defined) %}
{% for port_channel_interface in port_channel_interfaces | arista.avd.natural_sort('name') %}
{% if port_channel_interface.dhcp_server_ipv4 is arista.avd.defined(true) or port_channel_interfaces.dhcp_server_ipv6 is arista.avd.defined(true) %}
{% do port_channel_interfaces_dhcp_server.append(port_channel_interface) %}
{% endif %}
{% endfor %}
{% if (ethernet_interfaces_dhcp_server | length > 0 or port_channel_interfaces_dhcp_server | length > 0 or dhcp_servers is arista.avd.defined) %}
Vibhu-gslab marked this conversation as resolved.
Show resolved Hide resolved

## DHCP Server
{% if dhcp_servers is arista.avd.defined %}
Expand Down Expand Up @@ -123,14 +129,21 @@
{% include 'eos/dhcp-servers.j2' %}
```
{% endif %}
{% if ethernet_interfaces_dhcp_server | length > 0 %}
{% if ethernet_interfaces_dhcp_server | length > 0 or port_channel_interfaces_dhcp_server | length > 0 %}

### DHCP Server Interfaces

| Interface name | DHCP IPv4 | DHCP IPv6 |
| -------------- | --------- | --------- |
{% for ethernet_interface in ethernet_interfaces_dhcp_server | arista.avd.natural_sort %}
| {{ ethernet_interface.name }} | {{ ethernet_interface.dhcp_server_ipv4 | arista.avd.default(false) }} | {{ ethernet_interface.dhcp_server_ipv6 | arista.avd.default(false) }} |
{% endfor %}
{% if ethernet_interfaces_dhcp_server | length > 0 %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if is not needed. The for loop would just not loop if the list is empty. Same for v6

{% for ethernet_interface in ethernet_interfaces_dhcp_server | arista.avd.natural_sort %}
| {{ ethernet_interface.name }} | {{ ethernet_interface.dhcp_server_ipv4 | arista.avd.default("-") }} | {{ ethernet_interface.dhcp_server_ipv6 | arista.avd.default("-") }} |
{% endfor %}
{% endif %}
{% if port_channel_interfaces_dhcp_server | length > 0 %}
{% for port_channel_interface in port_channel_interfaces_dhcp_server | arista.avd.natural_sort %}
| {{ port_channel_interface.name }} | {{ port_channel_interface.dhcp_server_ipv4 | arista.avd.default("-") }} | {{ port_channel_interface.dhcp_server_ipv6 | arista.avd.default("-") }} |
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ interface {{ port_channel_interface.name }}
bfd per-link
{% endif %}
{% endif %}
{% if port_channel_interface.dhcp_server_ipv4 is arista.avd.defined(true) %}
dhcp server ipv4
{% endif %}
{% if port_channel_interface.dhcp_server_ipv6 is arista.avd.defined(true) %}
dhcp server ipv6
{% endif %}
{% if port_channel_interface.ip_igmp_host_proxy.enabled is arista.avd.defined(true) %}
{% set host_proxy_cli = "ip igmp host-proxy" %}
{{ host_proxy_cli }}
Expand Down
10 changes: 10 additions & 0 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 @@ -814,6 +814,12 @@ keys:
dhcp_client_accept_default_route:
type: bool
description: Install default-route obtained via DHCP.
dhcp_server_ipv4:
type: bool
description: Enable IPv4 DHCP server.
dhcp_server_ipv6:
type: bool
description: Enable IPv6 DHCP server.
ip_verify_unicast_source_reachable_via:
type: str
valid_values:
Expand Down
Loading