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

Fix get_bgp_neighbors_detail IOS-XE #1185

Merged
merged 9 commits into from
Apr 29, 2020
Merged

Fix get_bgp_neighbors_detail IOS-XE #1185

merged 9 commits into from
Apr 29, 2020

Conversation

petrmarciniak
Copy link
Contributor

The get_bgp_neighbors_detail function for IOS-XE crashes as it fails to parse the sh ip bgp all sum output correctly when:

  • neighbor information is spread across two lines (happens often when viewing IPv6 neighbors)
  • established, idle, etc. time of the session is in hh:mm:ss format

E.g. the following line would fail to be parsed:

2001:559::1
                4         7922 6944479  138054 116434201    0    0 12:22:20       45646

As a fix I've updated the corresponding TextFSM templates (as well as the test input and correct result).

@coveralls
Copy link

coveralls commented Apr 28, 2020

Coverage Status

Coverage remained the same at 0.0% when pulling 002de61 on petrmarciniak:fix-ios-ip-bgp-all-sum into b8b030a on napalm-automation:develop.

@@ -34,7 +34,8 @@ BGP using 39527928 total bytes of memory
BGP activity 3436532/2710503 prefixes, 19215241/17575537 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:559::1 4 7922 6944479 138054 116434201 0 0 12w2d 45646
Copy link
Member

Choose a reason for hiding this comment

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

To ensure your changes don't break the existing behaviour, please don't change this file and provide a separate test case with the output you're seeing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The show_ip_bgp_all_sum.txt is the base for the whole test. Following your suggestion I've added a new neighbor to the list and kept all the original neighbors in place. Please let me know if this makes sense to you?

Copy link
Member

Choose a reason for hiding this comment

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

We usually prefer to avoid changing this file when fixing a bug (as probably you won't see both outputs, i.e., in both 12:22:20 and 12w2d format at the same time -- but never say never Cisco is Cisco lol), and have a separate test case; that means, another set of files under a directory, e.g., test/ios/mocked_data/test_get_bgp_neighbors_detail/<some test case name>/.
But this change is small enough we can leave this pass...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All right, it all makes sense now. I wasn't quite sure how the test framework works. Thank you for the explanation, I'll keep it in mind for the next time!

@@ -3,7 +3,7 @@ BGP neighbor is 2001:559::1, remote AS 7922, external link
Description: Comcast IPv6 Transit
Inherits from template PEER-SESSION-AS7922 for session parameters
BGP version 4, remote router ID 68.86.1.1
BGP state = Established, up for 12w2d
BGP state = Established, up for 12:22:20
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All understood, I've reverted the the file to the previous version

Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @petrmarciniak

@@ -34,7 +34,8 @@ BGP using 39527928 total bytes of memory
BGP activity 3436532/2710503 prefixes, 19215241/17575537 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:559::1 4 7922 6944479 138054 116434201 0 0 12w2d 45646
Copy link
Member

Choose a reason for hiding this comment

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

We usually prefer to avoid changing this file when fixing a bug (as probably you won't see both outputs, i.e., in both 12:22:20 and 12w2d format at the same time -- but never say never Cisco is Cisco lol), and have a separate test case; that means, another set of files under a directory, e.g., test/ios/mocked_data/test_get_bgp_neighbors_detail/<some test case name>/.
But this change is small enough we can leave this pass...

@mirceaulinic mirceaulinic merged commit a8e9f8a into napalm-automation:develop Apr 29, 2020
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.

3 participants