From c44d66301f1d967da908ef01c984abe79abdb098 Mon Sep 17 00:00:00 2001 From: Guillaume Mulocher Date: Fri, 15 Dec 2023 14:54:19 +0100 Subject: [PATCH] Fix(eos_cli_config_gen): Render switchport mode for all modes for Port-channels (#3429) --- .../documentation/devices/port-channel-interfaces.md | 7 +++++++ .../intended/configs/port-channel-interfaces.cfg | 6 ++++++ .../inventory/host_vars/port-channel-interfaces.yml | 6 ++++++ .../eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg | 1 + .../eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg | 1 + .../templates/eos/port-channel-interfaces.j2 | 2 +- 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md index 3a52693d547..3ed336dbd77 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md @@ -233,6 +233,7 @@ interface Ethernet50 | Port-Channel121 | access_port_with_no_vlans | switched | access | - | - | - | - | - | - | - | | Port-Channel122 | trunk_port_with_no_vlans | switched | trunk | - | - | - | - | - | - | - | | Port-Channel130 | IP NAT Testing | switched | access | - | - | - | - | - | - | - | +| Port-Channel131 | dot1q-tunnel mode | switched | dot1q-tunnel | - | - | - | - | - | - | - | ##### Encapsulation Dot1q @@ -404,6 +405,7 @@ interface Port-Channel12 switchport trunk native vlan 100 switchport phone vlan 70 switchport phone trunk untagged + switchport mode trunk phone ! interface Port-Channel13 description EVPN-Vxlan single-active redundancy @@ -679,6 +681,11 @@ interface Port-Channel130 ip nat source dynamic access-list ACL2 pool POOL2 ip nat destination static 1.0.0.1 2.0.0.1 ip nat destination dynamic access-list ACL1 pool POOL1 +! +interface Port-Channel131 + description dot1q-tunnel mode + switchport + switchport mode dot1q-tunnel ``` ## BFD diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg index b927ba1cf16..b15df46b1a2 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg @@ -67,6 +67,7 @@ interface Port-Channel12 switchport trunk native vlan 100 switchport phone vlan 70 switchport phone trunk untagged + switchport mode trunk phone ! interface Port-Channel13 description EVPN-Vxlan single-active redundancy @@ -343,6 +344,11 @@ interface Port-Channel130 ip nat destination static 1.0.0.1 2.0.0.1 ip nat destination dynamic access-list ACL1 pool POOL1 ! +interface Port-Channel131 + description dot1q-tunnel mode + switchport + switchport mode dot1q-tunnel +! interface Ethernet3 description MLAG_PEER_DC1-LEAF1B_Ethernet3 channel-group 3 mode active diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml index 77406fd3ed7..926e62e4238 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml @@ -415,6 +415,12 @@ port_channel_interfaces: - original_ip: 3.0.0.1 translated_ip: 4.0.0.1 + - name: Port-Channel131 + description: dot1q-tunnel mode + type: switched + mode: dot1q-tunnel + + # Children interfaces ethernet_interfaces: - name: Ethernet5 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg index 978002ef01e..2d8d69e1d0a 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg @@ -192,6 +192,7 @@ interface Port-Channel26 switchport trunk native vlan 210 switchport phone vlan 211 switchport phone trunk untagged + switchport mode trunk phone ! interface Port-Channel141 description DC1_L2LEAF5_Po1 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg index fe0c2f93c51..89292a69252 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg @@ -192,6 +192,7 @@ interface Port-Channel26 switchport trunk native vlan 210 switchport phone vlan 211 switchport phone trunk untagged + switchport mode trunk phone ! interface Port-Channel141 description DC1_L2LEAF5_Po1 diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 index 0da6bfdf2e8..25f49a410ce 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 @@ -78,7 +78,7 @@ interface {{ port_channel_interface.name }} {% if port_channel_interface.phone.trunk is arista.avd.defined %} switchport phone trunk {{ port_channel_interface.phone.trunk }} {% endif %} -{% if port_channel_interface.mode is arista.avd.defined("trunk") %} +{% if port_channel_interface.mode is arista.avd.defined and port_channel_interface.mode != "access" %} switchport mode {{ port_channel_interface.mode }} {% endif %} {% for trunk_group in port_channel_interface.trunk_groups | arista.avd.natural_sort %}