diff --git a/ansible_collections/arista/avd/docs/porting-guides/5.x.x.md b/ansible_collections/arista/avd/docs/porting-guides/5.x.x.md index 46618e80dd1..4221c47269c 100644 --- a/ansible_collections/arista/avd/docs/porting-guides/5.x.x.md +++ b/ansible_collections/arista/avd/docs/porting-guides/5.x.x.md @@ -510,25 +510,65 @@ With AVD 5.0.0, the default value for `type` in `ethernet_interfaces` and `port_ ### Removal of `type` key dependency for rendering ethernet/port-channel interfaces configuration and documentation -#### IPv4 and IPv6 tables - -In AVD 4.0.0, the tables for `IPv4` and `IPv6` in ethernet and port-channel interfaces were rendered only if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `routed/l3dot1q`. - -With AVD 5.0.0, the dependency on the 'type' key for rendering tables for IPv4 and IPv6 in ethernet and port-channel interfaces has been removed. - #### `vlan_id` configuration In AVD 4.0.0, the configuration for `vlan_id` in ethernet interfaces and port-channel interfaces was rendered only if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `l2dot1q`. -With AVD 5.0.0, the dependency on the 'type' key for rendering the configuration of `vlan_id` in ethernet and port-channel interfaces has been removed. +With AVD 5.0.0, the dependency on the `type` key for rendering the configuration of `vlan_id` in ethernet and port-channel interfaces has been removed. + +```diff +-type: l2dot1q +vlan_id: 10 +``` #### `switchport` configuration and documentation -In AVD 4.0.0, the configuration and documentation for `switchport` in ethernet and port-channel interfaces were renderend only if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `switched` along with the keys `mode`, `vlans`, `native_vlan`, `native_vlan_tag`, `trunk_groups`, `phone`, `vlan_translations`, `trunk_private_vlan_secondary`, `pvlan_mapping`. The `no switchport` was renderend if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `routed`. +In AVD 4.0.0, the configuration and documentation for `switchport` in ethernet and port-channel interfaces were renderend only if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `switched` along with the keys `mode`, `vlans`, `native_vlan`, `native_vlan_tag`, `trunk_groups`, `phone`, `vlan_translations`, `trunk_private_vlan_secondary`, `pvlan_mapping`. +The `no switchport` command was renderend if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `routed`. With AVD 5.0.0, a new key for `switchport` has been introduced under ethernet and port-channel interfaces data-model, which generates the configuration and documentation for `switchport` independent of the `type` key. The keys `mode`, `vlans`, `native_vlan`, `native_vlan_tag`, `trunk_groups`, `phone`, `vlan_translations`, `trunk_private_vlan_secondary`, `pvlan_mapping` are deprecated, to be removed in AVD 6.0.0. +```diff +-type: switched +-mode: trunk +-vlans: '1-5' +-native_vlan: 20 +-native_vlan_tag: true +-trunk_groups: ['group1', 'group2'] +-trunk_private_vlan_secondary: true +-pvlan_mapping: 20-30 +-vlan_translations: +- - from: 10 +- to: 20 +- direction: in +- - from: 23 +- to: 30 +- direction: out +- - from: 1 +- to: 5 +- direction: both ++switchport: ++ mode: trunk ++ trunk: ++ allowed_vlan: 1-5 ++ native_vlan: 20 ++ native_vlan_tag: true ++ trunk_groups: ['group1', 'group2'] ++ private_vlan_secondary: true ++ pvlan_mapping: 20-30 ++ vlan_translations: ++ direction_in: ++ - from: 10 ++ to: 20 ++ direction_out: ++ - from: 23 ++ to: 30 ++ direction_both: ++ - from: 1 ++ to: 5 +``` + #### `encapsulation` configuration and documentation In AVD 4.0.0, the configuration and documentation for `encapsulation` in ethernet and port-channel interfaces were renderend only if `ethernet_interfaces[].type` or `port_channel_interfaces[].type` was set to `l2dot1q/l3dot1q` along with the keys `encapsulation_dot1q_vlan` and `encapsulation_vlan`. @@ -536,6 +576,33 @@ In AVD 4.0.0, the configuration and documentation for `encapsulation` in etherne With AVD 5.0.0, a new key for `encapsulation_dot1q` has been introduced and the schema for `encapsulation_vlan` has been modified under ethernet and port-channel interfaces data-model, which generates the configuration and documentation for `encapsulation` independent of the `type` key. The keys `encapsulation_dot1q_vlan`, `encapsulation_vlan.client.dot1q`, `encapsulation_vlan.client.unmatched`, `encapsulation_vlan.network.dot1q` and `encapsulation_vlan.network.client` are deprecated, to be removed in AVD 6.0.0. +```diff +-type: l3dot1q +-encapsulation_dot1q_vlan: 20 ++encapsulation_dot1q: ++ vlan: 20 ++ inner_vlan: 12 +-encapsulation_vlan: +- dot1q: +- client: +- dot1q: +- outer: 10 +- inner: 12 +- network: +- dot1q: +- outer: 20 +- inner: 22 ++encapsulation_vlan: ++ client: ++ protocol: dot1q ++ outer_vlan: 10 ++ inner_vlan: 12 ++ network: ++ protocol: dot1q ++ outer_vlan: 20 ++ inner_vlan: 22 +``` + ### Removal of deprecated data models The following data model keys have been removed from `eos_cli_config_gen` in v5.0.0. diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/ethernet-interfaces.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/ethernet-interfaces.j2 index dcd5ea86345..a62253c45a8 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/ethernet-interfaces.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/ethernet-interfaces.j2 @@ -192,13 +192,15 @@ interface {{ ethernet_interface.name }} {% if encapsulation_cli is arista.avd.defined %} {% if client_protocol in ['dot1q', 'dot1ad', 'untagged'] and ethernet_interface.encapsulation_vlan.network.protocol is arista.avd.defined and not network_flag %} {% set network_protocol = ethernet_interface.encapsulation_vlan.network.protocol %} -{% if ethernet_interface.encapsulation_vlan.network.vlan is arista.avd.defined %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' ' ~ ethernet_interface.encapsulation_vlan.network.vlan %} -{% elif ethernet_interface.encapsulation_vlan.network.outer_vlan is arista.avd.defined and ethernet_interface.encapsulation_vlan.network.inner_vlan is arista.avd.defined %} -{% if ethernet_interface.encapsulation_vlan.network.inner_protocol is arista.avd.defined %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ ethernet_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ ethernet_interface.encapsulation_vlan.network.inner_protocol ~ ' ' ~ ethernet_interface.encapsulation_vlan.network.inner_vlan %} -{% else %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ ethernet_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ ethernet_interface.encapsulation_vlan.network.inner_vlan %} +{% if network_protocol in ['dot1q', 'dot1ad'] %} +{% if ethernet_interface.encapsulation_vlan.network.vlan is arista.avd.defined %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' ' ~ ethernet_interface.encapsulation_vlan.network.vlan %} +{% elif ethernet_interface.encapsulation_vlan.network.outer_vlan is arista.avd.defined and ethernet_interface.encapsulation_vlan.network.inner_vlan is arista.avd.defined %} +{% if ethernet_interface.encapsulation_vlan.network.inner_protocol is arista.avd.defined %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ ethernet_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ ethernet_interface.encapsulation_vlan.network.inner_protocol ~ ' ' ~ ethernet_interface.encapsulation_vlan.network.inner_vlan %} +{% else %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ ethernet_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ ethernet_interface.encapsulation_vlan.network.inner_vlan %} +{% endif %} {% endif %} {% elif network_protocol == 'untagged' and client_protocol == 'untagged' %} {% set encapsulation_cli = encapsulation_cli ~ ' network untagged' %} 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 5c1ca113d26..0274ccdaa0d 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 @@ -140,13 +140,15 @@ interface {{ port_channel_interface.name }} {% if encapsulation_cli is arista.avd.defined %} {% if client_protocol in ['dot1q', 'dot1ad', 'untagged'] and port_channel_interface.encapsulation_vlan.network.protocol is arista.avd.defined and not network_flag %} {% set network_protocol = port_channel_interface.encapsulation_vlan.network.protocol %} -{% if port_channel_interface.encapsulation_vlan.network.vlan is arista.avd.defined %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' ' ~ port_channel_interface.encapsulation_vlan.network.vlan %} -{% elif port_channel_interface.encapsulation_vlan.network.outer_vlan is arista.avd.defined and port_channel_interface.encapsulation_vlan.network.inner_vlan is arista.avd.defined %} -{% if port_channel_interface.encapsulation_vlan.network.inner_protocol is arista.avd.defined %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ port_channel_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ port_channel_interface.encapsulation_vlan.network.inner_protocol ~ ' ' ~ port_channel_interface.encapsulation_vlan.network.inner_vlan %} -{% else %} -{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ port_channel_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ port_channel_interface.encapsulation_vlan.network.inner_vlan %} +{% if network_protocol in ['dot1q', 'dot1ad'] %} +{% if port_channel_interface.encapsulation_vlan.network.vlan is arista.avd.defined %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' ' ~ port_channel_interface.encapsulation_vlan.network.vlan %} +{% elif port_channel_interface.encapsulation_vlan.network.outer_vlan is arista.avd.defined and port_channel_interface.encapsulation_vlan.network.inner_vlan is arista.avd.defined %} +{% if port_channel_interface.encapsulation_vlan.network.inner_protocol is arista.avd.defined %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ port_channel_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ port_channel_interface.encapsulation_vlan.network.inner_protocol ~ ' ' ~ port_channel_interface.encapsulation_vlan.network.inner_vlan %} +{% else %} +{% set encapsulation_cli = encapsulation_cli ~ ' network ' ~ network_protocol ~ ' outer ' ~ port_channel_interface.encapsulation_vlan.network.outer_vlan ~ ' inner ' ~ port_channel_interface.encapsulation_vlan.network.inner_vlan %} +{% endif %} {% endif %} {% elif network_protocol == 'untagged' and client_protocol == 'untagged' %} {% set encapsulation_cli = encapsulation_cli ~ ' network untagged' %}