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

New Template: (IOS) show_ip_bgp_neighbors_advertised_routes #674

Merged
merged 3 commits into from
May 19, 2020
Merged

New Template: (IOS) show_ip_bgp_neighbors_advertised_routes #674

merged 3 commits into from
May 19, 2020

Conversation

FragmentedPacket
Copy link
Contributor

ISSUE TYPE
  • New Template Pull Request
COMPONENT

cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm

SUMMARY

Fixes #639

The command output is below for show ip bgp neighbors x.x.x.x advertised-routes

BGP table version is 143173748, local router ID is 192.168.88.2
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
 *>   113.55.45.0/24   0.0.0.0                            32768 i
 *>   113.55.48.0/24   0.0.0.0                            32768 i
 *>   113.55.50.0/24   0.0.0.0                            32768 i
 *>   113.55.51.0/24   0.0.0.0                            32768 i
 *>   113.55.53.0/24   0.0.0.0                            32768 i
 *>   113.55.54.0/24   0.0.0.0                            32768 i
 *>   113.55.58.0/24   0.0.0.0                            32768 i

Total number of prefixes 7

It is the same as the output from show ip bgp, but couldn't figure out a way to make this work without breaking/modifying something else.

Approach 1

We can only add templates to an existing command if they both have KEY values to tie the two templates together which isn't the use case for this issue.

e.g. cisco_ios_show_ip_bgp.textfsm:cisco_ios_show_ip_bgp_neighbors, .*, cisco_ios, sh[[ow]] i[[p]] bgp nei[[ghbors]]

Approach 2

Use the same template as cisco_ios_show_ip_bgp.textfsm, but create a new line above the existing one for this command and add trailing information for the command.

e.g. cisco_ios_show_ip_bgp.textfsm, .*, cisco_ios, sh[[ow]] i[[p]] bgp nei[[ghbors]] adv[[ertised-routes]]

This required adding a $ to the end of the cisco_ios_show_ip_bgp_neighbors line in the index and that would have definitely broken that template when someone specifies the IP address of a neighbor.

Approach 3 - Used in this PR

Copy the cisco_ios_show_ip_bgp.textfsm into a new template (cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm). This is the route I went since I couldn't find a great way to re-use show ip bgp template without breaking existing behavior.

…se the show ip bgp template as the data is the same, but the command is different. Had to adjust test_index_order to send back true if statements were the same length and the command was the same for this use case, added tests for command output as well
…ith tests and it required show ip bgp neighbors to have a $ for end of line that would break something going forward with that route
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

template request: show ip bgp neighbors x.x.x.x advertised-routes
2 participants