Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(eos_designs): Accept auto as argument for rd_override and rt_override #4858

Draft
wants to merge 2 commits into
base: devel
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def get_vlan_rd(
"""Return a string with the route-destinguisher for one VLAN."""
rd_override = default(vlan.rd_override, vlan.rt_override, vlan.vni_override)

if isinstance(rd_override, str) and ":" in rd_override:
if isinstance(rd_override, str) and (":" in rd_override or rd_override == "auto"):
return rd_override

if rd_override is not None:
Expand All @@ -283,7 +283,7 @@ def get_vlan_rt(
"""Return a string with the route-target for one VLAN."""
rt_override = default(vlan.rt_override, vlan.vni_override)

if isinstance(rt_override, str) and ":" in rt_override:
if isinstance(rt_override, str) and (":" in rt_override or rt_override == "auto"):
rrajpuro-anet marked this conversation as resolved.
Show resolved Hide resolved
return rt_override

if self._rt_admin_subfield is not None:
Expand Down Expand Up @@ -330,7 +330,7 @@ def get_vrf_rd(self: AvdStructuredConfigNetworkServices, vrf: EosDesigns._Dynami
rd_override = vrf.rd_override

if rd_override is not None:
if ":" in rd_override:
if ":" in rd_override or rd_override == "auto":
return rd_override

return f"{self.shared_utils.overlay_rd_type_vrf_admin_subfield}:{rd_override}"
Expand All @@ -341,7 +341,7 @@ def get_vrf_rt(self: AvdStructuredConfigNetworkServices, vrf: EosDesigns._Dynami
"""Return a string with the route-target for one VRF."""
rt_override = vrf.rt_override

if rt_override is not None and ":" in rt_override:
if rt_override is not None and (":" in rt_override or rt_override == "auto"):
return rt_override

if self._vrf_rt_admin_subfield is not None:
Expand All @@ -368,7 +368,7 @@ def get_vlan_aware_bundle_rd(
admin_subfield = self.shared_utils.overlay_rd_type_vrf_admin_subfield if is_vrf else self.shared_utils.overlay_rd_type_admin_subfield

if rd_override is not None:
if ":" in str(rd_override):
if ":" in rd_override or rd_override == "auto":
return rd_override

return f"{admin_subfield}:{rd_override}"
Expand All @@ -385,7 +385,7 @@ def get_vlan_aware_bundle_rt(
rt_override: str | None = None,
) -> str:
"""Return a string with the route-target for one VLAN Aware Bundle."""
if rt_override is not None and ":" in str(rt_override):
if rt_override is not None and (":" in rt_override or rt_override == "auto"):
return rt_override

bundle_number = id + tenant.vlan_aware_bundle_number_base
Expand Down
Loading