From 79f4cca38995b0959a68fdbbb62b3e1e8dc5bd55 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Thu, 16 Jan 2025 12:11:11 +0530 Subject: [PATCH 1/5] Feat(eos_cli_config_gen): Add support for configuring for a Port-Channel interface --- .../eos_cli_config_gen/documentation/devices/host1.md | 1 + .../molecule/eos_cli_config_gen/intended/configs/host1.cfg | 1 + .../inventory/host_vars/host1/port-channel-interfaces.yml | 2 ++ .../docs/tables/port-channel-interfaces.md | 4 ++++ .../j2templates/eos/port-channel-interfaces.j2 | 3 +++ python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py | 5 +++++ .../_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml | 3 +++ .../schema_fragments/port_channel_interfaces.schema.yml | 3 +++ 8 files changed, 22 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md index 8f5d5d93dfb..8c5c760776e 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md @@ -5494,6 +5494,7 @@ interface Port-Channel112 switchport ip address dhcp dhcp client accept default-route + dhcp server ipv4 port-channel lacp fallback individual port-channel lacp fallback timeout 5 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg index f0add4ca69a..e4e1627bada 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg @@ -2059,6 +2059,7 @@ interface Port-Channel112 switchport ip address dhcp dhcp client accept default-route + dhcp server ipv4 port-channel lacp fallback individual port-channel lacp fallback timeout 5 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml index 18ec3400772..bb91f0f33aa 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml @@ -721,6 +721,7 @@ port_channel_interfaces: lacp_fallback_mode: individual ip_address: dhcp dhcp_client_accept_default_route: true + dhcp_server_ipv4: true - name: Port-Channel113 description: interface_with_mpls_enabled @@ -729,6 +730,7 @@ 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 mpls: ip: true ldp: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md index ff848c485c1..a8b2ce9340d 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md @@ -217,6 +217,7 @@ | [      mpass](## "port_channel_interfaces.[].ptp.mpass") | Boolean | | | | When MPASS is enabled on an MLAG port-channel, MLAG peers coordinate to function as a single PTP logical device.
Arista PTP enabled devices always place PTP messages on the same physical link within the port-channel.
Hence, MPASS is needed only on MLAG port-channels connected to non-Arista devices. | | [    ip_address](## "port_channel_interfaces.[].ip_address") | String | | | | IPv4 address/mask or "dhcp". | | [    dhcp_client_accept_default_route](## "port_channel_interfaces.[].dhcp_client_accept_default_route") | Boolean | | | | Install default-route obtained via DHCP. | + | [    dhcp_server_ipv4](## "port_channel_interfaces.[].dhcp_server_ipv4") | Boolean | | | | Enable IPv4 DHCP server. | | [    ip_verify_unicast_source_reachable_via](## "port_channel_interfaces.[].ip_verify_unicast_source_reachable_via") | String | | | Valid Values:
- any
- rx | | | [    ip_nat](## "port_channel_interfaces.[].ip_nat") | Dictionary | | | | | | [      destination](## "port_channel_interfaces.[].ip_nat.destination") | Dictionary | | | | | @@ -926,6 +927,9 @@ # Install default-route obtained via DHCP. dhcp_client_accept_default_route: + + # Enable IPv4 DHCP server. + dhcp_server_ipv4: ip_verify_unicast_source_reachable_via: ip_nat: destination: diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 index 92a538f7106..906bc1c9124 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 @@ -356,6 +356,9 @@ 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.ip_igmp_host_proxy.enabled is arista.avd.defined(true) %} {% set host_proxy_cli = "ip igmp host-proxy" %} {{ host_proxy_cli }} diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py index 59a3ba27572..93479d255c0 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -33102,6 +33102,7 @@ def __init__( "ptp": {"type": Ptp}, "ip_address": {"type": str}, "dhcp_client_accept_default_route": {"type": bool}, + "dhcp_server_ipv4": {"type": bool}, "ip_verify_unicast_source_reachable_via": {"type": str}, "ip_nat": {"type": IpNat}, "ipv6_enable": {"type": bool}, @@ -33267,6 +33268,8 @@ def __init__( """IPv4 address/mask or "dhcp".""" dhcp_client_accept_default_route: bool | None """Install default-route obtained via DHCP.""" + dhcp_server_ipv4: bool | None + """Enable IPv4 DHCP server.""" ip_verify_unicast_source_reachable_via: Literal["any", "rx"] | None ip_nat: IpNat """Subclass of AvdModel.""" @@ -33396,6 +33399,7 @@ def __init__( ptp: Ptp | UndefinedType = Undefined, ip_address: str | None | UndefinedType = Undefined, dhcp_client_accept_default_route: bool | None | UndefinedType = Undefined, + dhcp_server_ipv4: bool | None | UndefinedType = Undefined, ip_verify_unicast_source_reachable_via: Literal["any", "rx"] | None | UndefinedType = Undefined, ip_nat: IpNat | UndefinedType = Undefined, ipv6_enable: bool | None | UndefinedType = Undefined, @@ -33522,6 +33526,7 @@ def __init__( ptp: Subclass of AvdModel. ip_address: IPv4 address/mask or "dhcp". dhcp_client_accept_default_route: Install default-route obtained via DHCP. + dhcp_server_ipv4: Enable IPv4 DHCP server. ip_verify_unicast_source_reachable_via: ip_verify_unicast_source_reachable_via ip_nat: Subclass of AvdModel. ipv6_enable: ipv6_enable diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml index 5a9c4cf3c4b..78b20e1538b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml @@ -10745,6 +10745,9 @@ 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. ip_verify_unicast_source_reachable_via: type: str valid_values: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml index 6fffebb2833..efdfbdb79c2 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml @@ -814,6 +814,9 @@ 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. ip_verify_unicast_source_reachable_via: type: str valid_values: From 3052044cf1b40295a06bcfa3d76b947fbdfb56fb Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 17 Jan 2025 17:54:43 +0530 Subject: [PATCH 2/5] dhcp_server_ipv6 --- .../eos_cli_config_gen/documentation/devices/host1.md | 1 + .../molecule/eos_cli_config_gen/intended/configs/host1.cfg | 1 + .../inventory/host_vars/host1/port-channel-interfaces.yml | 2 ++ .../docs/tables/port-channel-interfaces.md | 4 ++++ .../j2templates/eos/port-channel-interfaces.j2 | 3 +++ python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py | 5 +++++ .../_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml | 3 +++ .../schema_fragments/port_channel_interfaces.schema.yml | 3 +++ 8 files changed, 22 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md index 8c5c760776e..67d9d599aa6 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md @@ -5495,6 +5495,7 @@ interface Port-Channel112 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 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg index e4e1627bada..020de4eade7 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg @@ -2060,6 +2060,7 @@ interface Port-Channel112 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 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml index bb91f0f33aa..6b71974fc0f 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml @@ -722,6 +722,7 @@ port_channel_interfaces: 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 @@ -731,6 +732,7 @@ port_channel_interfaces: # 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: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md index a8b2ce9340d..548206a2d78 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md @@ -218,6 +218,7 @@ | [    ip_address](## "port_channel_interfaces.[].ip_address") | String | | | | IPv4 address/mask or "dhcp". | | [    dhcp_client_accept_default_route](## "port_channel_interfaces.[].dhcp_client_accept_default_route") | Boolean | | | | Install default-route obtained via DHCP. | | [    dhcp_server_ipv4](## "port_channel_interfaces.[].dhcp_server_ipv4") | Boolean | | | | Enable IPv4 DHCP server. | + | [    dhcp_server_ipv6](## "port_channel_interfaces.[].dhcp_server_ipv6") | Boolean | | | | Enable IPv6 DHCP server. | | [    ip_verify_unicast_source_reachable_via](## "port_channel_interfaces.[].ip_verify_unicast_source_reachable_via") | String | | | Valid Values:
- any
- rx | | | [    ip_nat](## "port_channel_interfaces.[].ip_nat") | Dictionary | | | | | | [      destination](## "port_channel_interfaces.[].ip_nat.destination") | Dictionary | | | | | @@ -930,6 +931,9 @@ # Enable IPv4 DHCP server. dhcp_server_ipv4: + + # Enable IPv6 DHCP server. + dhcp_server_ipv6: ip_verify_unicast_source_reachable_via: ip_nat: destination: diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 index 906bc1c9124..c5ed42541d7 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 @@ -359,6 +359,9 @@ interface {{ port_channel_interface.name }} {% 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 }} diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py index 93479d255c0..9673536c334 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -33103,6 +33103,7 @@ def __init__( "ip_address": {"type": str}, "dhcp_client_accept_default_route": {"type": bool}, "dhcp_server_ipv4": {"type": bool}, + "dhcp_server_ipv6": {"type": bool}, "ip_verify_unicast_source_reachable_via": {"type": str}, "ip_nat": {"type": IpNat}, "ipv6_enable": {"type": bool}, @@ -33270,6 +33271,8 @@ def __init__( """Install default-route obtained via DHCP.""" dhcp_server_ipv4: bool | None """Enable IPv4 DHCP server.""" + dhcp_server_ipv6: bool | None + """Enable IPv6 DHCP server.""" ip_verify_unicast_source_reachable_via: Literal["any", "rx"] | None ip_nat: IpNat """Subclass of AvdModel.""" @@ -33400,6 +33403,7 @@ def __init__( ip_address: str | None | UndefinedType = Undefined, dhcp_client_accept_default_route: bool | None | UndefinedType = Undefined, dhcp_server_ipv4: bool | None | UndefinedType = Undefined, + dhcp_server_ipv6: bool | None | UndefinedType = Undefined, ip_verify_unicast_source_reachable_via: Literal["any", "rx"] | None | UndefinedType = Undefined, ip_nat: IpNat | UndefinedType = Undefined, ipv6_enable: bool | None | UndefinedType = Undefined, @@ -33527,6 +33531,7 @@ def __init__( ip_address: IPv4 address/mask or "dhcp". dhcp_client_accept_default_route: Install default-route obtained via DHCP. dhcp_server_ipv4: Enable IPv4 DHCP server. + dhcp_server_ipv6: Enable IPv6 DHCP server. ip_verify_unicast_source_reachable_via: ip_verify_unicast_source_reachable_via ip_nat: Subclass of AvdModel. ipv6_enable: ipv6_enable diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml index 78b20e1538b..48a3e4c529e 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml @@ -10748,6 +10748,9 @@ keys: 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: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml index efdfbdb79c2..e835d6e781e 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml @@ -817,6 +817,9 @@ keys: 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: From 81569127477b34a7e1598fb09609254cef3ad48e Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 17 Jan 2025 18:52:16 +0530 Subject: [PATCH 3/5] Updating documentation and a small bug in dhcp_servers.j2 --- .../j2templates/documentation/dhcp-servers.j2 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 index 59a8aa2f936..61c4985a471 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 @@ -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) %} ## DHCP Server {% if dhcp_servers is arista.avd.defined %} From 0f543255b5b77fd7437dcc18a534e125e707b0b3 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 17 Jan 2025 19:16:42 +0530 Subject: [PATCH 4/5] fix documentation --- .../molecule/eos_cli_config_gen/documentation/devices/host1.md | 1 + .../j2templates/documentation/dhcp-servers.j2 | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md index 67d9d599aa6..0aeba97556f 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md @@ -1794,6 +1794,7 @@ dhcp server vrf VRF01 | Interface name | DHCP IPv4 | DHCP IPv6 | | -------------- | --------- | --------- | | Ethernet64 | True | True | +| Port-Channel112 | True | True | ## System Boot Settings diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 index 61c4985a471..30986104209 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 @@ -138,5 +138,8 @@ {% 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 %} +{% 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(false) }} | {{ port_channel_interface.dhcp_server_ipv6 | arista.avd.default(false) }} | +{% endfor %} {% endif %} {% endif %} From f8fdd781f860e31d4a7eda4b4ab78ae6b07cec6e Mon Sep 17 00:00:00 2001 From: Vibhu-gslab Date: Fri, 17 Jan 2025 19:53:58 +0530 Subject: [PATCH 5/5] correcting docs --- .../documentation/devices/inet-cloud.md | 6 +++--- .../j2templates/documentation/dhcp-servers.j2 | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ansible_collections/arista/avd/examples/cv-pathfinder/documentation/devices/inet-cloud.md b/ansible_collections/arista/avd/examples/cv-pathfinder/documentation/devices/inet-cloud.md index 5cf8a45f6d5..81d07555186 100644 --- a/ansible_collections/arista/avd/examples/cv-pathfinder/documentation/devices/inet-cloud.md +++ b/ansible_collections/arista/avd/examples/cv-pathfinder/documentation/devices/inet-cloud.md @@ -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 diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 index 30986104209..57122cfbd44 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/dhcp-servers.j2 @@ -129,17 +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 %} -{% 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(false) }} | {{ port_channel_interface.dhcp_server_ipv6 | arista.avd.default(false) }} | -{% endfor %} +{% if ethernet_interfaces_dhcp_server | length > 0 %} +{% 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 %}