Skip to content

Always compare med fix - #20909

Merged
Jafaral merged 2 commits into
FRRouting:masterfrom
donaldsharp:always_compare_med_fix
Feb 24, 2026
Merged

Always compare med fix#20909
Jafaral merged 2 commits into
FRRouting:masterfrom
donaldsharp:always_compare_med_fix

Conversation

@donaldsharp

Copy link
Copy Markdown
Member

topotests have a create_route_map function which takes a dict of values, of which some tester has choosen to send med down which means nothing. Switch it to metric as it should be.

The setup for adding routemaps was using `med` as a key
value to add a metric.  The bgp.py code in lib has no
way to interpret this and as such the routes being
choosen where `oldest path` since there was no metric
to discriminate.  Upon heavy load routes would be received
in a unexpected order and the resulting nexthop would be
unexpected.  Fix this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Med is not something that is recognizable by the create_route_maps
functionality.  Use metric instead since that is what is intended.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
@frrbot frrbot Bot added the tests Topotests, make check, etc label Feb 23, 2026
@greptile-apps

greptile-apps Bot commented Feb 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR corrects a parameter naming issue in topotest route map configurations. The create_route_maps function expects metric as the key in the "set" dictionary, but several tests incorrectly used med, which is non-functional. The PR fixes all occurrences across BGP and OSPF topotests.

Additionally, in test_bgp_always_compare_med_topo1.py, the PR corrects next-hop router references from r2 to r3 on lines 505 and 566, ensuring tests verify the correct expected behavior.

  • Fixed 4 instances of "med" to "metric" in BGP always compare MED test
  • Fixed 9 instances of "med" to "metric" in OSPF route maps test
  • Corrected next-hop verification to use r3 instead of r2 in two test functions

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The changes are straightforward test fixes that correct non-functional parameter names to their proper values. All changes align with the create_route_maps function API which expects metric not med. The next-hop corrections also improve test accuracy. No logic changes or production code affected.
  • No files require special attention

Important Files Changed

Filename Overview
tests/topotests/bgp_always_compare_med/test_bgp_always_compare_med_topo1.py Fixed incorrect med parameter to correct metric parameter in route map configurations and corrected next-hop router reference from r2 to r3
tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py Fixed incorrect med parameter to correct metric parameter in route map set clauses across multiple test configurations

Last reviewed commit: ff9b005

@Jafaral

Jafaral commented Feb 24, 2026

Copy link
Copy Markdown
Member

@Mergifyio backport dev/10.6

@mergify

mergify Bot commented Feb 24, 2026

Copy link
Copy Markdown

backport dev/10.6

βœ… Backports have been created

Details

@Jafaral
Jafaral merged commit fa048f7 into FRRouting:master Feb 24, 2026
22 checks passed
donaldsharp added a commit that referenced this pull request Feb 24, 2026
@donaldsharp
donaldsharp deleted the always_compare_med_fix branch April 29, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport master size/M tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants