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

Rework show bgp vpn #17653

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

pguibert6WIND
Copy link
Member

@pguibert6WIND pguibert6WIND commented Dec 16, 2024

Rework the internal BGP outputs per neighbor.
Two functions are kind of duplicate in bgp_vpn.c and with peer_adj_routes()

The command show_ip_bgp_l2vpn_evpn_rd_neighbor_advertised_routes
decrements twice the argument counter, whereas it is not justified. Keep
only one decrement in the presence of the json argument.

Fixes: dcc1615 ("bgpd: Display received and advertised EVPN routes from neighbors")
Signed-off-by: Philippe Guibert <[email protected]>
bgpd/bgp_route.c Outdated
uint16_t show_flags)
int peer_adj_routes(struct vty *vty, struct peer *peer, afi_t afi, safi_t safi,
enum bgp_show_adj_route_type type, const char *rmap_name,
const struct prefix *match, uint16_t show_flags, struct prefix_rd *prd)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this a bit problematic since we have redefined below:

const struct prefix_rd *prd;

Copy link
Member Author

Choose a reason for hiding this comment

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

used const

bgpd/bgp_route.c Outdated
table = bgp_dest_get_bgp_table_info(dest);
if (!table)
continue;

if (prd && memcmp(dest_p->u.val, prd->val, 8) != 0)
Copy link
Member

Choose a reason for hiding this comment

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

Please use RD_BYTES instead of 8.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

When the route distinguisher is an ethernet type, the display varies
when using one of the two commands below:

> # show bgp l2vpn evpn
> [..]
> Route Distinguisher: 3:aa:bb:cc:dd:ee:ff
> # show bgp l2vpn evpn json
> [..]
> "rd": "",
> # show bgp ipv4 vpn
> [..]
> Route Distinguisher: LHI:3, aa:bb:cc:dd:ee:ff
> # show bgp ipv4 vpn json
> [..]
> "rd": "LHI:3, aa:bb:cc:dd:ee:ff",

Align the output on the second display. Both json and non json outputs
display the route distinguisher.

Signed-off-by: Philippe Guibert <[email protected]>
Use the same internal function to dump BGP advertised-routes for the
l2vpn evpn address-family. There is no change in the output.

> r1# show bgp l2vpn evpn  neighbors 192.168.100.61 advertised-routes
> BGP table version is 6, local router ID is 192.168.100.21, vrf id 0
> Default local pref 100, local AS 65000
> Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
>                i internal, r RIB-failure, S Stale, R Removed
> Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
> Origin codes:  i - IGP, e - EGP, ? - incomplete
> RPKI validation codes: V valid, I invalid, N Not found
>
>      Network          Next Hop            Metric LocPrf Weight Path
> Route Distinguisher: 192.168.101.41:2
>  *>i [5]:[0]:[32]:[192.168.101.41]
>                     192.168.100.41           0    100      0 i
>                     RT:65000:101 ET:8 Rmac:be:0a:de:84:03:c4
>  *>i [5]:[0]:[128]:[fd00::2]
>                     192.168.100.41           0    100      0 i
>                     RT:65000:101 ET:8 Rmac:be:0a:de:84:03:c4
> Route Distinguisher: 192.168.102.21:2
>  *>  [5]:[0]:[32]:[192.168.102.21]
>                     192.168.100.21           0         32768 i
>                     ET:8 RT:65000:101 Rmac:9a:15:14:fa:a7:05
>  *>  [5]:[0]:[128]:[fd00::1]
>                     192.168.100.21           0         32768 i
>                     ET:8 RT:65000:101 Rmac:9a:15:14:fa:a7:05
>
> Total number of prefixes 4
> r1# show bgp l2vpn evpn  neighbors 192.168.100.61 advertised-routes  json
> {"bgpTableVersion":6,"bgpLocalRouterId":"192.168.100.21","defaultLocPrf":100,"localAS":65000,"advertisedRoutes":
> {"192.168.101.41:2":{
> "rd":"192.168.101.41:2",
> "[5]:[0]:[32]:[192.168.101.41]":{
> "routeType":5,"ethTag":0,"ipLen":32,"ip":"192.168.101.41","nextHop":"192.168.100.41","locPrf":100,"weight":0,"path":"","origin":"IGP","valid":true,"best":true},
> "[5]:[0]:[128]:[fd00::2]":{
> "routeType":5,"ethTag":0,"ipLen":128,"ip":"fd00::2","nextHop":"192.168.100.41","locPrf":100,"weight":0,"path":"","origin":"IGP","valid":true,"best":true}
> },
> "192.168.102.21:2":{
> "rd":"192.168.102.21:2",
> "[5]:[0]:[32]:[192.168.102.21]":{
> "routeType":5,"ethTag":0,"ipLen":32,"ip":"192.168.102.21","nextHop":"192.168.100.21","metric":0,"weight":32768,"path":"","origin":"IGP","valid":true,"best":true},
> "[5]:[0]:[128]:[fd00::1]":{
> "routeType":5,"ethTag":0,"ipLen":128,"ip":"fd00::1","nextHop":"192.168.100.21","metric":0,"weight":32768,"path":"","origin":"IGP","valid":true,"best":true}
> }
> }
> ,"totalPrefixCounter":4,"filteredPrefixCounter":0}

Signed-off-by: Philippe Guibert <[email protected]>
Extend the original 'show bgp l2vpn evpn advertised-command' to dump the
filtered and the received routes.

Signed-off-by: Philippe Guibert <[email protected]>
Add some options to the 'show bgp l2vpn evpn neighbor ..' command.
- add the detail option to dump detailed information about each path
- add the prefix option to dump a given prefix
- add the route-map option to dump a given prefix based on a route-map

Signed-off-by: Philippe Guibert <[email protected]>
Add a route distinguisher parameter so that the peer_adj_routes() is
able to filter the prefixes to display based on the route distinguisher
they belong to.

Signed-off-by: Philippe Guibert <[email protected]>
Use the new peer_adj_routes() command to dump the BGP updates instead of
using the show_adj_route_vpn. Remove the bgp_vpn.c file.

Signed-off-by: Philippe Guibert <[email protected]>
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