Skip to content

[IOS-XR] Accept hyphens and dots in next-hop VRF names in show route - #1009

Open
atishay-kasliwal wants to merge 1 commit into
CiscoTestAutomation:mainfrom
atishay-kasliwal:fix/iosxr-show-route-nexthop-vrf-name
Open

atishay-kasliwal wants to merge 1 commit into
CiscoTestAutomation:mainfrom
atishay-kasliwal:fix/iosxr-show-route-nexthop-vrf-name

Conversation

@atishay-kasliwal

Copy link
Copy Markdown

Description

Fixes #1007.

ShowRouteIpv4 p2/p3 and ShowRouteIpv6 p3 match the optional (nexthop in vrf NAME) with \w+. IOS-XR VRF names can contain hyphens and dots (ENS-PROD, ens.mgmt), and for those the route line matched nothing:

The output pasted in the issue only shows vrf default next hops, which already parse; the crash needs a route whose next-hop VRF has a non-word character, which I reproduced with the same command and output shape.

The VRF name is now matched as [^\s)]+ (anything up to the closing parenthesis) in those three patterns. ShowRouteIpv6 still records it in nexthop_in_vrf, now with the full name.

Motivation and Context

show route vrf <vrf> ipv4 unicast on IOS-XR crashes or drops routes whenever a next hop is in a VRF with a hyphen or dot in its name.

Impact (If any)

None expected. Names that matched \w+ before still match, and the schema is unchanged.

Screenshots:

Golden tests, run with tests/folder_parsing_job.py:

  • New ShowRouteIpv4 golden19 (the issue's output plus a hyphenated VRF route with two paths and a dotted VRF route) and ShowRouteIpv6 golden_outpu_9 (hyphenated VRF on path lines). Both fail without the regex change and pass with it.
  • All IOS-XR goldens: 2381 passed, 0 failed.

Checklist:

  • I have updated the changelog.
  • I have updated the documentation (If applicable).
  • I have added tests to cover my changes (If applicable).
  • All new and existing tests passed.
  • All new code passed compilation.

ShowRouteIpv4 p2/p3 and ShowRouteIpv6 p3 matched "(nexthop in vrf NAME)"
with \w+, so a route whose next hop is in a VRF such as ENS-PROD did not
match. The route was dropped, and a following path line then used
route_dict before it was set, which raised UnboundLocalError.

Match any name up to the closing parenthesis instead, and add golden
tests for hyphenated and dotted VRF names with multiple paths.

@Sripadvallabh Sripadvallabh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the regex scope, schema compatibility, changelog, and IPv4/IPv6 coverage. The change accepts dotted and hyphenated next-hop VRF names without broadening past the closing parenthesis or whitespace.

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.

Issue parsing "show route vrf {vrf_name} ipv4 unicast for IOSXR

2 participants