Skip to content

Commit

Permalink
updated error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahesh Kumar authored and laxmikantchintakindi committed Dec 10, 2024
1 parent e55a3db commit 8e7e534
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ tenants:

expected_error_message: >-
Invalid configuration on VRF 'Tenant_X_OP_Zone' in Tenant 'Tenant_X'.
Both 'vtep_diagnostic.loopback' and 'vtep_diagnostic.loopback_ip_pools' must be defined when 'router_id' is set to 'vtep_diagnostic' on the VRF.
'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined
when 'router_id' is set to 'vtep_diagnostic' on the VRF.
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ tenants:

expected_error_message: >-
Invalid configuration on VRF 'Tenant_X_OP_Zone' in Tenant 'Tenant_X'.
Both 'vtep_diagnostic.loopback' and 'vtep_diagnostic.loopback_ip_pools' must be defined when 'router_id' is set to 'vtep_diagnostic' on the VRF.
'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined
when 'router_id' is set to 'vtep_diagnostic' on the VRF.
Original file line number Diff line number Diff line change
Expand Up @@ -425,21 +425,20 @@ def get_vrf_router_id(
"""
# Handle "vtep_diagnostic" router ID case
if router_id == "vtep_diagnostic":
vrf_diagnostic_loopback = vrf.vtep_diagnostic.loopback
loopback_ip_pools = vrf.vtep_diagnostic.loopback_ip_pools
interface_data = self._get_vtep_diagnostic_loopback_for_vrf(vrf)

# Validate required configuration
if vrf_diagnostic_loopback is None or loopback_ip_pools is None:
if interface_data is None:
msg = (
f"Invalid configuration on VRF '{vrf.name}' in Tenant '{tenant_name}'. "
"Both 'vtep_diagnostic.loopback' and 'vtep_diagnostic.loopback_ip_pools' must be defined "
"'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined "
"when 'router_id' is set to 'vtep_diagnostic' on the VRF."
)
raise AristaAvdInvalidInputsError(msg)

# Resolve router ID from loopback interface
interface_data = self._get_vtep_diagnostic_loopback_for_vrf(vrf)
return interface_data["ip_address"].split("/")[0]

return str(ipaddress.ip_interface(interface_data["ip_address"]).ip)

# Handle "main_router_id" with general router ID enabled/disabled
if router_id == "main_router_id":
Expand Down

0 comments on commit 8e7e534

Please sign in to comment.