From 361877d07f6eee8f32a1e9d44456bc322beb7a5a Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 16 Jan 2025 10:40:32 +0100 Subject: [PATCH] add_mpls_tunnel_termination --- .../documentation/devices/host1.md | 2 + .../intended/configs/host1.cfg | 1 + .../inventory/host_vars/host1/mpls.yml | 2 + .../eos_cli_config_gen/docs/tables/mpls.md | 16 +++++ .../j2templates/documentation/mpls-and-ldp.j2 | 6 ++ .../j2templates/eos/mpls.j2 | 6 ++ .../_eos_cli_config_gen/schema/__init__.py | 66 ++++++++++++++++++- .../schema/eos_cli_config_gen.schema.yml | 29 ++++++++ .../schema/schema_fragments/mpls.schema.yml | 23 +++++++ 9 files changed, 150 insertions(+), 1 deletion(-) 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..0a82d675c62 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 @@ -9136,6 +9136,7 @@ router bfd | LDP Interface Disabled Default | True | | LDP Transport-Address Interface | Loopback0 | | ICMP Fragmentation-Needed Tunneling Enabled | True | +| Tunnel Termination Model | ttl uniform dscp uniform | ### MPLS Interfaces @@ -9201,6 +9202,7 @@ router bfd ```eos ! mpls ip +mpls tunnel termination model ttl uniform dscp uniform ! mpls ldp router-id 192.168.1.1 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..11e3e6aa56a 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 @@ -4473,6 +4473,7 @@ ipv6 route vrf TENANT_A_PROJECT01 2b01:cb04:4e6:a400::/64 Vlan102 2a01:cb04:4e6: ipv6 route vrf TENANT_A_PROJECT01 2c01:cb04:4e6:a400::/64 Vlan102 201 tag 102 name No-Track-BFD ! mpls ip +mpls tunnel termination model ttl uniform dscp uniform ! mpls ldp router-id 192.168.1.1 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/mpls.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/mpls.yml index b4035d9a064..a1be562de47 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/mpls.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/mpls.yml @@ -6,6 +6,8 @@ mpls: router_id: 192.168.1.1 shutdown: false transport_address_interface: Loopback0 + tunnel: + termination_model: "ttl uniform dscp uniform" icmp: fragmentation_needed_tunneling: true rsvp: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/mpls.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/mpls.md index 3714c20a48b..308d9f52786 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/mpls.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/mpls.md @@ -67,6 +67,9 @@ | [    p2mp](## "mpls.rsvp.p2mp") | Dictionary | | | | | | [      enabled](## "mpls.rsvp.p2mp.enabled") | Boolean | | | | | | [    shutdown](## "mpls.rsvp.shutdown") | Boolean | | | | Make `shutdown` key false for `no shutdown` cli. | + | [  tunnel](## "mpls.tunnel") | Dictionary | | | | Configure tunnel termination model. | + | [    termination_model](## "mpls.tunnel.termination_model") | String | | | Valid Values:
- ttl pipe dscp pipe
- ttl uniform dscp pipe
- ttl uniform dscp uniform | TTL and DSCP configuration as a string.
Example:
- "ttl pipe dscp pipe"
| + | [    termination_php_model](## "mpls.tunnel.termination_php_model") | String | | | Valid Values:
- ttl pipe dscp pipe
- ttl uniform dscp pipe | TTL and DSCP configuration as a string.
Example:
- "ttl pipe dscp pipe"
| === "YAML" @@ -216,4 +219,17 @@ # Make `shutdown` key false for `no shutdown` cli. shutdown: + + # Configure tunnel termination model. + tunnel: + + # TTL and DSCP configuration as a string. + # Example: + # - "ttl pipe dscp pipe" + termination_model: + + # TTL and DSCP configuration as a string. + # Example: + # - "ttl pipe dscp pipe" + termination_php_model: ``` diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/mpls-and-ldp.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/mpls-and-ldp.j2 index 540cb9ff942..20dd0305bdb 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/mpls-and-ldp.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/mpls-and-ldp.j2 @@ -23,4 +23,10 @@ {% if mpls.icmp.ttl_exceeded_tunneling is arista.avd.defined %} | ICMP TTL-Exceeded Tunneling Enabled | {{ mpls.icmp.ttl_exceeded_tunneling }} | {% endif %} +{% if mpls.tunnel.termination_model is arista.avd.defined %} +| Tunnel Termination Model | {{ mpls.tunnel.termination_model }} | +{% endif %} +{% if mpls.tunnel.termination_php_model is arista.avd.defined %} +| Tunnel Termination PHP Model | {{ mpls.tunnel.termination_php_model }} | +{% endif %} {% endif %} diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 index be407fc6ca4..f92f757549f 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 @@ -8,6 +8,12 @@ ! mpls ip {% endif %} +{% if mpls.tunnel.termination_model is arista.avd.defined %} +mpls tunnel termination model {{ mpls.tunnel.termination_model }} +{% endif %} +{% if mpls.tunnel.termination_php_model is arista.avd.defined %} +mpls tunnel termination php model {{ mpls.tunnel.termination_php_model }} +{% endif %} {% if mpls.ldp is arista.avd.defined %} ! mpls ldp 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..bc256c25795 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -26687,7 +26687,60 @@ def __init__( """ - _fields: ClassVar[dict] = {"ip": {"type": bool}, "ldp": {"type": Ldp}, "icmp": {"type": Icmp}, "rsvp": {"type": Rsvp}, "_custom_data": {"type": dict}} + class Tunnel(AvdModel): + """Subclass of AvdModel.""" + + _fields: ClassVar[dict] = {"termination_model": {"type": str}, "termination_php_model": {"type": str}, "_custom_data": {"type": dict}} + termination_model: Literal["ttl pipe dscp pipe", "ttl uniform dscp pipe", "ttl uniform dscp uniform"] | None + """ + TTL and DSCP configuration as a string. + Example: + - "ttl pipe dscp pipe" + """ + termination_php_model: Literal["ttl pipe dscp pipe", "ttl uniform dscp pipe"] | None + """ + TTL and DSCP configuration as a string. + Example: + - "ttl pipe dscp pipe" + """ + _custom_data: dict[str, Any] + + if TYPE_CHECKING: + + def __init__( + self, + *, + termination_model: Literal["ttl pipe dscp pipe", "ttl uniform dscp pipe", "ttl uniform dscp uniform"] | None | UndefinedType = Undefined, + termination_php_model: Literal["ttl pipe dscp pipe", "ttl uniform dscp pipe"] | None | UndefinedType = Undefined, + _custom_data: dict[str, Any] | UndefinedType = Undefined, + ) -> None: + """ + Tunnel. + + + Subclass of AvdModel. + + Args: + termination_model: + TTL and DSCP configuration as a string. + Example: # fmt: skip + - "ttl pipe dscp pipe" + termination_php_model: + TTL and DSCP configuration as a string. + Example: # fmt: skip + - "ttl pipe dscp pipe" + _custom_data: _custom_data + + """ + + _fields: ClassVar[dict] = { + "ip": {"type": bool}, + "ldp": {"type": Ldp}, + "icmp": {"type": Icmp}, + "rsvp": {"type": Rsvp}, + "tunnel": {"type": Tunnel}, + "_custom_data": {"type": dict}, + } ip: bool | None ldp: Ldp """Subclass of AvdModel.""" @@ -26700,6 +26753,12 @@ def __init__( """ rsvp: Rsvp """Subclass of AvdModel.""" + tunnel: Tunnel + """ + Configure tunnel termination model. + + Subclass of AvdModel. + """ _custom_data: dict[str, Any] if TYPE_CHECKING: @@ -26711,6 +26770,7 @@ def __init__( ldp: Ldp | UndefinedType = Undefined, icmp: Icmp | UndefinedType = Undefined, rsvp: Rsvp | UndefinedType = Undefined, + tunnel: Tunnel | UndefinedType = Undefined, _custom_data: dict[str, Any] | UndefinedType = Undefined, ) -> None: """ @@ -26728,6 +26788,10 @@ def __init__( Subclass of AvdModel. rsvp: Subclass of AvdModel. + tunnel: + Configure tunnel termination model. + + Subclass of AvdModel. _custom_data: _custom_data """ 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..878213f00c5 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 @@ -9240,6 +9240,35 @@ keys: shutdown: type: bool description: Make `shutdown` key false for `no shutdown` cli. + tunnel: + description: Configure tunnel termination model. + type: dict + keys: + termination_model: + type: str + description: 'TTL and DSCP configuration as a string. + + Example: + + - "ttl pipe dscp pipe" + + ' + valid_values: + - ttl pipe dscp pipe + - ttl uniform dscp pipe + - ttl uniform dscp uniform + termination_php_model: + type: str + description: 'TTL and DSCP configuration as a string. + + Example: + + - "ttl pipe dscp pipe" + + ' + valid_values: + - ttl pipe dscp pipe + - ttl uniform dscp pipe name_server: documentation_options: table: ip-name-servers diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/mpls.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/mpls.schema.yml index a124b569b84..9cfedd4e1fe 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/mpls.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/mpls.schema.yml @@ -282,3 +282,26 @@ keys: shutdown: type: bool description: Make `shutdown` key false for `no shutdown` cli. + tunnel: + description: Configure tunnel termination model. + type: dict + keys: + termination_model: + type: str + description: | + TTL and DSCP configuration as a string. + Example: + - "ttl pipe dscp pipe" + valid_values: + - "ttl pipe dscp pipe" + - "ttl uniform dscp pipe" + - "ttl uniform dscp uniform" + termination_php_model: + type: str + description: | + TTL and DSCP configuration as a string. + Example: + - "ttl pipe dscp pipe" + valid_values: + - "ttl pipe dscp pipe" + - "ttl uniform dscp pipe"