Skip to content

fix: Update correct datatype for Arista extended communities #260

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

Closed
wants to merge 1 commit into from

Conversation

szferguson
Copy link

@szferguson szferguson commented Jun 9, 2024

Description

This fixes a parsing issue where AristaRouteDetail expects a string for ext_community_list_raw but EOS returns an integer in the json formatted response

Related Issues

#252

Motivation and Context

On some of our routers, we make use of extended communities. For each extended community in the extCommunityListRaw array returned by EOS, it is an integer and not returned as string. Example:

"extCommunityListRaw": [
    595497215591610,
    876972192302256
],

Tests

When the AristaRouteDetail expects a string for ext_community_list_raw, the following error is produced:

[CRITICAL] 20240609 07:17:42 |66 | parse_arista → 11 validation errors for AristaBGPTable
bgpRouteEntries.`1.1.1.0/24`.bgpRoutePaths.0.routeDetail.extCommunityListRaw.0
  Input should be a valid string [type=string_type, input_value=595497215591610, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type
bgpRouteEntries.`1.1.1.0/24`.bgpRoutePaths.0.routeDetail.extCommunityListRaw.1
  Input should be a valid string [type=string_type, input_value=876972192302256, input_type=int]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type
bgpRouteEntries.`1.1.1.0/24`.bgpRoutePaths.1.routeDetail.extCommunityListRaw.0

When replaced with int, these parse errors no longer appear, and the table is rendered correctly.

This fixes a parsing issue where AristaRouteDetail expects a string for ext_community_list_raw but EOS returns an integer in the json formatted response
@szferguson szferguson changed the title Update arista_eos.py Update correct datatype for Arista extended communities Jun 9, 2024
@szferguson szferguson changed the title Update correct datatype for Arista extended communities fix: Update correct datatype for Arista extended communities Jun 9, 2024
@jdhall75 jdhall75 self-assigned this May 16, 2025
@jdhall75
Copy link
Collaborator

Thanks for taking the time to research and submit a PR. Since this fix has been submitted there has been another PR for this issue which allows string and integer values for extended communities. Accepting the fix for issue #305 and merging PR #306.

PR #260 
ext_community_list_raw: t.List[int] = []
PR #306
ext_community_list_raw: t.List[t.Union[int, str]] = []

@jdhall75 jdhall75 closed this May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants