From 69ab6010285daff576289ead4d8174e043224707 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Wed, 21 Aug 2024 19:54:02 +0530 Subject: [PATCH] Adding required for out direction in vlan_translations --- .../documentation/devices/ethernet-interfaces.md | 6 +++--- .../documentation/devices/port-channel-interfaces.md | 1 + .../intended/configs/ethernet-interfaces.cfg | 4 ++-- .../intended/configs/port-channel-interfaces.cfg | 1 + .../inventory/host_vars/ethernet-interfaces.yml | 8 +++++--- .../inventory/host_vars/port-channel-interfaces.yml | 3 ++- .../docs/tables/ethernet-interfaces.md | 8 ++++++-- .../docs/tables/port-channel-interfaces.md | 8 ++++++-- .../j2templates/eos/ethernet-interfaces.j2 | 5 ++++- .../j2templates/eos/port-channel-interfaces.j2 | 5 ++++- .../schema/eos_cli_config_gen.schema.yml | 12 ++++++++++-- .../schema_fragments/ethernet_interfaces.schema.yml | 5 ++++- .../port_channel_interfaces.schema.yml | 5 ++++- 13 files changed, 52 insertions(+), 19 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/ethernet-interfaces.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/ethernet-interfaces.md index 5ed4c654b86..bca3a4ad152 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/ethernet-interfaces.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/ethernet-interfaces.md @@ -89,7 +89,7 @@ sFlow is disabled. | --------- | ----------- | ---- | ----- | ----------- | ----------- | ------------- | | Ethernet1 | P2P_LINK_TO_DC1-SPINE1_Ethernet1 | dot1q-tunnel | 110-111,200,210-211 | tag | ['g1', 'g2'] | - | | Ethernet2 | SRV-POD02_Eth1 | trunk | 110-111,210-211 | - | - | - | -| Ethernet3 | P2P_LINK_TO_DC1-SPINE2_Ethernet2 | - | | 5 | - | - | +| Ethernet3 | P2P_LINK_TO_DC1-SPINE2_Ethernet2 | trunk | | 5 | - | - | | Ethernet5 | Molecule Routing | - | 220 | - | - | - | | Ethernet6 | SRV-POD02_Eth1 | trunk | 110-111,210-211 | - | - | - | | Ethernet7 | Molecule L2 | - | - | - | - | - | @@ -440,7 +440,6 @@ interface Ethernet1 ! interface Ethernet2 description SRV-POD02_Eth1 - switchport vlan translation in required switchport dot1q vlan tag disallowed switchport trunk allowed vlan 110-111,210-211 switchport mode trunk @@ -462,8 +461,8 @@ interface Ethernet2 interface Ethernet3 description P2P_LINK_TO_DC1-SPINE2_Ethernet2 mtu 1500 - switchport mode trunk switchport trunk native vlan 5 + switchport mode trunk no switchport switchport vlan translation out 23 dot1q-tunnel 50 no snmp trap link-change @@ -646,6 +645,7 @@ interface Ethernet15 ! interface Ethernet16 description PVLAN Promiscuous Trunk - vlan translation out + switchport vlan translation out required switchport trunk allowed vlan 110-112 switchport mode trunk switchport 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 216c9a60d31..0a311eeab4a 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 @@ -599,6 +599,7 @@ interface Port-Channel101 ! interface Port-Channel102 description PVLAN Promiscuous Trunk - vlan translation out + switchport vlan translation out required switchport trunk allowed vlan 110-112 switchport mode trunk switchport diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/ethernet-interfaces.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/ethernet-interfaces.cfg index 91531025e47..3332cd87c39 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/ethernet-interfaces.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/ethernet-interfaces.cfg @@ -67,7 +67,6 @@ interface Ethernet1 ! interface Ethernet2 description SRV-POD02_Eth1 - switchport vlan translation in required switchport dot1q vlan tag disallowed switchport trunk allowed vlan 110-111,210-211 switchport mode trunk @@ -89,8 +88,8 @@ interface Ethernet2 interface Ethernet3 description P2P_LINK_TO_DC1-SPINE2_Ethernet2 mtu 1500 - switchport mode trunk switchport trunk native vlan 5 + switchport mode trunk no switchport switchport vlan translation out 23 dot1q-tunnel 50 no snmp trap link-change @@ -273,6 +272,7 @@ interface Ethernet15 ! interface Ethernet16 description PVLAN Promiscuous Trunk - vlan translation out + switchport vlan translation out required switchport trunk allowed vlan 110-112 switchport mode trunk switchport 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 82b72857ec3..42839364e01 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 @@ -231,6 +231,7 @@ interface Port-Channel101 ! interface Port-Channel102 description PVLAN Promiscuous Trunk - vlan translation out + switchport vlan translation out required switchport trunk allowed vlan 110-112 switchport mode trunk switchport diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/ethernet-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/ethernet-interfaces.yml index a9b58370cba..28eb02ee148 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/ethernet-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/ethernet-interfaces.yml @@ -57,7 +57,7 @@ ethernet_interfaces: ethertype: 1536 vlan_tag: required vlan_translations: - required: true + in_required: true direction_in: - from: 10 to: 24 @@ -178,7 +178,7 @@ ethernet_interfaces: mode: protect protect_log: true vlan_translations: - required: true + in_required: false backup_link: prefer_vlan: 20 @@ -212,10 +212,10 @@ ethernet_interfaces: spanning_tree_guard: root tcp_mss_ceiling: ipv6_segment_size: 65 - mode: trunk # test for switchport settings switchport: enabled: false + mode: trunk trunk: native_vlan: 5 port_security: @@ -228,6 +228,7 @@ ethernet_interfaces: - range: 1-3 mac_address_maximum: 3 vlan_translations: + out_required: false direction_out: - from: 23 dot1q_tunnel: @@ -480,6 +481,7 @@ ethernet_interfaces: trunk: allowed_vlan: 110-112 vlan_translations: + out_required: true direction_out: - from: 111-112 to: 110 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 21e330a1b21..bc3630e3d6f 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 @@ -186,7 +186,7 @@ port_channel_interfaces: vlan_tag: required source_interface: tx multicast vlan_translations: - required: true + in_required: true direction_in: - from: 34 to: 23 @@ -366,6 +366,7 @@ port_channel_interfaces: trunk: allowed_vlan: 110-112 vlan_translations: + out_required: true direction_out: - from: 111-112 to: 110 diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/ethernet-interfaces.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/ethernet-interfaces.md index f95e79e3550..af8b470237b 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/ethernet-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/ethernet-interfaces.md @@ -420,7 +420,8 @@ | [        vlan_tag](## "ethernet_interfaces.[].switchport.dot1q.vlan_tag") | String | | | Valid Values:
- disallowed
- required | Allow/disallow VLAN tagged frames. | | [      source_interface](## "ethernet_interfaces.[].switchport.source_interface") | String | | | Valid Values:
- tx
- tx multicast | tx: Allow bridged packets to go out of the source interface.
tx multicast: Allow multicast packets only to go out of the source interface. | | [      vlan_translations](## "ethernet_interfaces.[].switchport.vlan_translations") | Dictionary | | | | VLAN Translation mappings.
Warning: This should not be combined with `ethernet_interfaces[].vlan_translations`. | - | [        required](## "ethernet_interfaces.[].switchport.vlan_translations.required") | Boolean | | | | Drop the ingress packets that do not match any VLAN mapping. | + | [        in_required](## "ethernet_interfaces.[].switchport.vlan_translations.in_required") | Boolean | | | | Drop the ingress packets that do not match any VLAN mapping. | + | [        out_required](## "ethernet_interfaces.[].switchport.vlan_translations.out_required") | Boolean | | | | Drop the egress packets that do not match any VLAN mapping. | | [        direction_in](## "ethernet_interfaces.[].switchport.vlan_translations.direction_in") | List, items: Dictionary | | | | Map ingress packets only. | | [          - from](## "ethernet_interfaces.[].switchport.vlan_translations.direction_in.[].from") | String | Required | | | VLAN ID or range of VLAN IDs to map from. Range 1-4094. | | [            to](## "ethernet_interfaces.[].switchport.vlan_translations.direction_in.[].to") | Integer | Required | | Min: 1
Max: 4094 | VLAN ID to map to. | @@ -1284,7 +1285,10 @@ vlan_translations: # Drop the ingress packets that do not match any VLAN mapping. - required: + in_required: + + # Drop the egress packets that do not match any VLAN mapping. + out_required: # Map ingress packets only. direction_in: 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 ac5f8d6ea14..284b9c78765 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 @@ -266,7 +266,8 @@ | [        vlan_tag](## "port_channel_interfaces.[].switchport.dot1q.vlan_tag") | String | | | Valid Values:
- disallowed
- required | | | [      source_interface](## "port_channel_interfaces.[].switchport.source_interface") | String | | | Valid Values:
- tx
- tx multicast | tx: Allow bridged packets to go out of the source interface.
tx multicast: Allow multicast packets only to go out of the source interface. | | [      vlan_translations](## "port_channel_interfaces.[].switchport.vlan_translations") | Dictionary | | | | VLAN Translation mappings.
Warning: This should not be combined with `port_channel_interfaces[].vlan_translations`. | - | [        required](## "port_channel_interfaces.[].switchport.vlan_translations.required") | Boolean | | | | Drop the ingress packets that do not match any VLAN mapping. | + | [        in_required](## "port_channel_interfaces.[].switchport.vlan_translations.in_required") | Boolean | | | | Drop the ingress packets that do not match any VLAN mapping. | + | [        out_required](## "port_channel_interfaces.[].switchport.vlan_translations.out_required") | Boolean | | | | Drop the egress packets that do not match any VLAN mapping. | | [        direction_in](## "port_channel_interfaces.[].switchport.vlan_translations.direction_in") | List, items: Dictionary | | | | Map ingress packets only. | | [          - from](## "port_channel_interfaces.[].switchport.vlan_translations.direction_in.[].from") | String | | | | VLAN ID or range of VLAN IDs to map from. Range 1-4094. | | [            to](## "port_channel_interfaces.[].switchport.vlan_translations.direction_in.[].to") | Integer | | | Min: 1
Max: 4094 | VLAN ID to map to. | @@ -854,7 +855,10 @@ vlan_translations: # Drop the ingress packets that do not match any VLAN mapping. - required: + in_required: + + # Drop the egress packets that do not match any VLAN mapping. + out_required: # Map ingress packets only. direction_in: 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 e6c066cdc88..11581a4d501 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 @@ -174,9 +174,12 @@ interface {{ ethernet_interface.name }} {% if ethernet_interface.switchport.phone.trunk is arista.avd.defined %} switchport phone trunk {{ ethernet_interface.switchport.phone.trunk }} {% endif %} -{% if ethernet_interface.switchport.vlan_translations.required is arista.avd.defined(true) %} +{% if ethernet_interface.switchport.vlan_translations.in_required is arista.avd.defined(true) %} switchport vlan translation in required {% endif %} +{% if ethernet_interface.switchport.vlan_translations.out_required is arista.avd.defined(true) %} + switchport vlan translation out required +{% endif %} {% if ethernet_interface.switchport.dot1q.vlan_tag is arista.avd.defined %} switchport dot1q vlan tag {{ ethernet_interface.switchport.dot1q.vlan_tag }} {% endif %} 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 bc4dc14da47..ce3b52acdda 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 @@ -122,9 +122,12 @@ interface {{ port_channel_interface.name }} {% if port_channel_interface.switchport.phone.trunk is arista.avd.defined %} switchport phone trunk {{ port_channel_interface.switchport.phone.trunk }} {% endif %} -{% if port_channel_interface.switchport.vlan_translations.required is arista.avd.defined(true) %} +{% if port_channel_interface.switchport.vlan_translations.in_required is arista.avd.defined(true) %} switchport vlan translation in required {% endif %} +{% if port_channel_interface.switchport.vlan_translations.out_required is arista.avd.defined(true) %} + switchport vlan translation out required +{% endif %} {% if port_channel_interface.switchport.dot1q.vlan_tag is arista.avd.defined %} switchport dot1q vlan tag {{ port_channel_interface.switchport.dot1q.vlan_tag }} {% endif %} 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 b846d279f07..98179edb4e2 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 @@ -3621,10 +3621,14 @@ keys: Warning: This should not be combined with `ethernet_interfaces[].vlan_translations`.' type: dict keys: - required: + in_required: type: bool description: Drop the ingress packets that do not match any VLAN mapping. + out_required: + type: bool + description: Drop the egress packets that do not match any VLAN + mapping. direction_in: type: list description: Map ingress packets only. @@ -9846,10 +9850,14 @@ keys: Warning: This should not be combined with `port_channel_interfaces[].vlan_translations`.' type: dict keys: - required: + in_required: type: bool description: Drop the ingress packets that do not match any VLAN mapping. + out_required: + type: bool + description: Drop the egress packets that do not match any VLAN + mapping. direction_in: type: list description: Map ingress packets only. diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/ethernet_interfaces.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/ethernet_interfaces.schema.yml index 65727771222..30c8044cc2b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/ethernet_interfaces.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/ethernet_interfaces.schema.yml @@ -1555,9 +1555,12 @@ keys: Warning: This should not be combined with `ethernet_interfaces[].vlan_translations`. type: dict keys: - required: + in_required: type: bool description: Drop the ingress packets that do not match any VLAN mapping. + out_required: + type: bool + description: Drop the egress packets that do not match any VLAN mapping. direction_in: type: list description: Map ingress packets only. 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 ee36850a323..20ce85fd58e 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 @@ -1002,9 +1002,12 @@ keys: Warning: This should not be combined with `port_channel_interfaces[].vlan_translations`. type: dict keys: - required: + in_required: type: bool description: Drop the ingress packets that do not match any VLAN mapping. + out_required: + type: bool + description: Drop the egress packets that do not match any VLAN mapping. direction_in: type: list description: Map ingress packets only.