Skip to content

Fix sort_show_route to work with multi-line BGP community lists

David Petera requested to merge netlab_sort_show_route_fix into master

I encountered a bug in the script sort_show_route that manifests when the show route dump includes bgp community list spanning multiple lines.

Example:

5.182.20.0/24        unicast [R1111x11 2024-11-06] * (100) [AS1111i]
	via 111.111.0.228 on ve0
	Type: BGP univ
	BGP.origin: IGP
	BGP.as_path: 1111 2222
	BGP.next_hop: 111.203.0.228
	BGP.med: 2
	BGP.local_pref: 100
	BGP.community: (0,16509) (1,1089) (64700,8860) (65400,0) (65400,65400) (1121,65000) (1120,2)
	BGP.large_community: (6695, 0, 3212) (6695, 0, 5578) (6695, 0, 5603) (6695, 0, 5606) (6695, 0, 6204) (6695, 0, 6663) (6695, 0, 6939) (6695, 0, 8262) (6695, 0, 8400) (6695, 0, 8708) (6695, 0, 8717) (6695, 0, 8860) (6695, 0, 8866) (6695, 0, 8932) (6695, 0, 8953) (6695, 0, 9009) (6695, 0, 9050) (6695, 0, 9119) (6695, 0, 12297) (6695, 0, 12713) (6695, 0, 13124) (6695, 0, 15958) (6695, 0, 29405) (6695, 0, 31029) (6695, 0, 31042) (6695, 0, 31287)
		(6695, 0, 34224) (6695, 0, 34569) (6695, 0, 39737) (6695, 0, 41313) (6695, 0, 42295) (6695, 0, 42459) (6695, 0, 42841) (6695, 0, 43205) (6695, 0, 44814) (6695, 0, 44901) (6695, 0, 47734) (6695, 0, 47872) (6695, 0, 49800) (6695, 0, 50020) (6695, 0, 56910) (6695, 0, 57344) (6695, 0, 57463) (6695, 0, 59796) (6695, 0, 199790) (6695, 0, 201494) (6695, 0, 210106) (6695, 0, 210312) (6695, 0, 396998) (57463, 0, 6695) (57463, 64700, 8860)

Multi-line community list are valid so I changed the regexes in the script so that it works with them as well.

While I was at it I also deleted unnecessary/invalid semicolons at the end of some lines :)

Merge request reports