genieparser
genieparser copied to clipboard
BGP Advertised Routes pulls junk value
When I am parsing the output of 'show ip bgp all neighbors
any luck with this?
Hi, apologies for the delay.
Is that the exact command you attempted to parse? We have a parser for show bgp all neighbors {neighbor} advertised-routes
but not specifically for show bgp all neighbors advertised-routes
. I am attempting to find if it is selecting the correct parser, or if a new command needs to be added.
it is show bgp all neighbors {neighbor} advertised-routes, sorry for the syntax mix up.
Is this issue being looked at,?!
This is still broken, I wrote my own program to parse out the data I needed. Leaving this open just in case this gets any attention, but I am no longer using pyats for this use case.
Hi, apologies for the delay.
Can you share what output you are expecting and what output you got with the parser. Please share the output and not the screenshot of the output to investigate further.
Hi,
Are you still looking into this issue.
I no longer use this tool, however I think it is something I would like to be able to use. I will try and pull the information today, I need to rerun a test, and give you some files to look at.
Sure thanks for the update.
adv_route.zip I printed the output of the parse command so you can see what the parser if grabbing. All the logs files zipped up in here as well.
thanks!
Thanks for the update. Will look into it and get back back to you with an update
I have noticed a similar issue on IOS
Show command
show bgp all neighbors 10.3.4.5 advertised-routes
Sample Data
For address family: IPv4 Unicast
BGP table version is 87654, local router ID is 10.1.2.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 10.111.222.0/24 0.0.0.0 0 32768 i
*> 10.111.223.3/3 0.0.0.0 0 32768 i
*> 10.200.1.1/32 0.0.0.0 0 32768 i
*> 15.16.17.0/20 0.0.0.0 0 32768 i
Parsed Result
{
"vrf": {
"default": {
"neighbor": {
"10.3.4.5": {
"address_family": {
"ipv4 unicast": {
"advertised": {
"condary": {
"index": {
"1": {
"status_codes": "t s",
"path_type": "e",
"next_hop": "path,"
}
}
}
},
"bgp_table_version": 44660,
"local_router_id": "10.1.2.3"
}
}
}
}
}
}
}
Note that under ipv4_unicast : advertised: CONDARY. I believe the parser is breaking and detecting part of 'secondary'
So in the IOS-XE parser for show_bgp.py, p3_1 on line 4814-4817
Results in the following regex processing

Which shows the
- group "status_codes" as "t s"
- group "prefix" as "condary"
- group "next_hop" as "path,"
- group "path_type" as "e"
The flow should be:
- Match on p1 = Get Address family.lower() -Working
- Match on p2: -Working
- create default vrf or add named vrf
- create neighbor and add ip
- add address family, and type
- Add Table Version, and Local RID
- Match P3_1 - Broken
Match P3_1 is:
^\s*(?P<status_codes>(s|d|h|\*|\>|i|r|S|m|b|f|x|a|c|t|L|\s)+)?(?P<path_type>(i|e|c|l|a|r|I))?(\s)?(?P<prefix>[a-zA-Z0-9\.\:\/\[\]\,]+)(?: *(?P<next_hop>[a-zA-Z0-9\.\:\/\[\]\,]+))?$
and the offending section is:
(?P<status_codes>(s|d|h|\*|\>|i|r|S|m|b|f|x|a|c|t|L|\s)+)
Obviously we need to cater for routes with the 't' secondary path designation
*>i [2]:[77][7,0][10.69.9.9,1,151587081][10.135.1.1,22][10.106.101.1,10.76.1.30]/616
*>t 2001:db8:aaaa:1::/113 ::ffff:10.106.101.1
*> 2001:db8:a69:484::/64 2001:DB8:20:4:6::6
but I am unsure of the best way to do this.
I wound up writing my own parser and ignoring a large portion of the values in pyats. I rewrote this so that I would pull primarily the flags, prefix and next-hop values as those were the most interesting to us. Hopefully, this gets some attention though, as I am sure others have had some issues.
Yeah, I've been creating an automatic site documentation builder, and I need to list the advertised networks, and this seems to be the best way to do it.
or i can dodgy it up to process part of the show run like the ospf and eigrp parsers do.
Hello @mupchu,
Are you still looking for a resolution for this issue, Please let me know .
Hello @mupchu,
Is there any update, Kindly let me know.
Sorry, been a busy week.
I am no longer using pyats for this feature, but I can help test if someone does want to look into what is going on with this. I had to create my own parser, and it was just easier to do outside of pyats. If someone wants to work on this great, if not then this can be closed.
Hi,
I am working on this parser issue. Trying to fix the pattern.
I have noticed a similar issue on IOS Show command
show bgp all neighbors 10.3.4.5 advertised-routes
Sample Data
For address family: IPv4 Unicast BGP table version is 87654, local router ID is 10.1.2.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.111.222.0/24 0.0.0.0 0 32768 i *> 10.111.223.3/3 0.0.0.0 0 32768 i *> 10.200.1.1/32 0.0.0.0 0 32768 i *> 15.16.17.0/20 0.0.0.0 0 32768 i
Parsed Result
{ "vrf": { "default": { "neighbor": { "10.3.4.5": { "address_family": { "ipv4 unicast": { "advertised": { "condary": { "index": { "1": { "status_codes": "t s", "path_type": "e", "next_hop": "path," } } } }, "bgp_table_version": 44660, "local_router_id": "10.1.2.3" } } } } } } }
Note that under ipv4_unicast : advertised: CONDARY. I believe the parser is breaking and detecting part of 'secondary'
So in the IOS-XE parser for show_bgp.py, p3_1 on line 4814-4817
Results in the following regex processing
![]()
Which shows the
* group "status_codes" as "t s" * group "prefix" as "condary" * group "next_hop" as "path," * group "path_type" as "e"
The flow should be:
* Match on p1 = Get Address family.lower() -Working * Match on p2: -Working * create default vrf or add named vrf * create neighbor and add ip * add address family, and type * Add Table Version, and Local RID * Match P3_1 - **Broken**
Match P3_1 is:
^\s*(?P<status_codes>(s|d|h|\*|\>|i|r|S|m|b|f|x|a|c|t|L|\s)+)?(?P<path_type>(i|e|c|l|a|r|I))?(\s)?(?P<prefix>[a-zA-Z0-9\.\:\/\[\]\,]+)(?: *(?P<next_hop>[a-zA-Z0-9\.\:\/\[\]\,]+))?$
and the offending section is:
(?P<status_codes>(s|d|h|\*|\>|i|r|S|m|b|f|x|a|c|t|L|\s)+)
Obviously we need to cater for routes with the 't' secondary path designation
*>i [2]:[77][7,0][10.69.9.9,1,151587081][10.135.1.1,22][10.106.101.1,10.76.1.30]/616 *>t 2001:db8:aaaa:1::/113 ::ffff:10.106.101.1 *> 2001:db8:a69:484::/64 2001:DB8:20:4:6::6
but I am unsure of the best way to do this.
yes same observation here as well - would be nice to get this fixed
I will say that this parser should almost be split up between the header and the actual table. What I needed was the actual table, so there were a few python libraries that were able to pull what I needed without having to fuss about with the rest of this. I also wrote my own parser outside of pyats, that just used regex and was able to gather what i needed from the table (for this particular table i did not need every value but, I did need the prefix, and the next-hop).
Hello @mupchu, @MaikHahn and @zacsmits,
I have added a fix for this issue and it will be available in the upcoming version of pyATS. Hence, I am closing this issue, if you still face the same issue with newer version of pyATS then kindly re-open the ticket.
Thank you.
Hi @SohanTirpude, thanks 👍
- where could I find it in the code (branch/parser/...) if I would like to check and patch it manually in my version ?
- in which release will it be fixed ?
Hello @MaikHahn,
The fix will be available un the upcoming pyATS release 24.1, so kindly wait until that.
Thank you.
Hi @SohanTirpude I still have issue - not sure if this is the right place but the show command which I need also links to the same show_bgp.py
device#sh ip bgp all neighbors ?
A.B.C.D Neighbor to display information about
X:X:X:X::X IPv6 neighbor to display information about
slow Slow neighbor status
| Output modifiers
the command itself is not supported in ios-xe Version 17.6.5 on C9500-32C
so I'm using show bgp {address_family} neighbors {neighbor} advertised-routes
https://pubhub.devnetcloud.com/media/genie-feature-browser/docs/#/parsers/show%2520bgp%2520%257Baddress_family%257D%2520neighbors%2520%257Bneighbor%257D%2520advertised-routes
https://github.com/CiscoTestAutomation/genieparser/blob/master/src/genie/libs/parser/iosxe/show_bgp.py#L5319
Even I have plenty of routes which are advertised I get
| Parsed command 'show bgp vpnv4 unicast vrf rb-bcn neighbors 10.1.1.1 | | advertised-routes' but it returned empty |
Hello @MaikHahn,
It seems your current issues is not related to this issue, so kindly create a new issue with complete information to exclude confusion.
From your comment, this I what I understood that you are using this command: show bgp {address_family} neighbors {neighbor} advertised-routes
but it is taking 'show bgp vpnv4 unicast vrf rb-bcn neighbors 10.1.1.1 | advertised-routes
this command.
If I am wrong, then kindly in your new ticket explain clearly. The logs will be better to understand it clearly.
Thank you.
Yes I have already opened a new issue - thanks :-)