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

yang: use relative path instead of absolute one for route-map #16102

Merged
merged 1 commit into from
May 29, 2024

Conversation

lsang6WIND
Copy link

@lsang6WIND lsang6WIND commented May 29, 2024

Using absolute xpath is not optimal for finding the target node. As the route map configuration grows, the yang validation will take more time to complete. Relative paths are much faster.

Tested with a config file that contains ~3k route map config lines.
-before:
time cat conf | vtysh
configure
log syslog errors
router bgp 65000
!
route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 101
match community CL:HCC:PATH_PRIO1_EAST1
set local-preference 15200
!

... (route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 102-1181)

route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 1182
match community CL:HCC:PATH_PRIO1_EAST1082
set local-preference 16281
!

real 13m51.500s
user 0m0.522s
sys 0m4.854s

-after:
time cat conf | vtysh
...
real 0m48.390s
user 0m0.384s
sys 0m1.245s

Using absolute xpath is not optimal for finding the target node. As the
route map configuration grows, the yang validation will take more time
to complete. Relative paths are much faster.

Tested with a config file that contains ~3k route map config lines.
- before:
time cat conf | vtysh
configure
log syslog errors
router bgp 65000
!
route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 101
 match community CL:HCC:PATH_PRIO1_EAST1
  set local-preference 15200
!
...
route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 1182
 match community CL:HCC:PATH_PRIO1_EAST1082
 set local-preference 16281
!

real    13m51.500s
user    0m0.522s
sys     0m4.854s

- after:
time cat conf | vtysh
...
real    0m48.390s
user    0m0.384s
sys     0m1.245s

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
@donaldsharp
Copy link
Member

Can the same thing be applied to prefix lists?

@lsang6WIND
Copy link
Author

lsang6WIND commented May 29, 2024

Can the same thing be applied to prefix lists?

Yes, it will enhance performance on the prefix list. In my case, by using a relative path, libyang avoids iterating over the route map list to locate the current node.
For prefix list, as both 'access-list-ref' and 'prefix-list-ref' types use the prefix list's name, the relative path eliminates the need to iterate over the prefix list.

@donaldsharp donaldsharp merged commit 8f23eb7 into FRRouting:master May 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants