From 1068e316a60a1467047afecf7d67dfe3842b2d7c Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Tue, 19 May 2020 14:57:37 -0600 Subject: [PATCH] New Template: (IOS) show_ip_bgp_neighbors_advertised_routes (#674) --- ...ip_bgp_neighbors_advertised_routes.textfsm | 42 +++++++++++ templates/index | 1 + ...how_ip_bgp_neighbors_advertised_routes.raw | 18 +++++ ...how_ip_bgp_neighbors_advertised_routes.yml | 72 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 templates/cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm create mode 100644 tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.raw create mode 100644 tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.yml diff --git a/templates/cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm b/templates/cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm new file mode 100644 index 0000000000..ba982be044 --- /dev/null +++ b/templates/cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm @@ -0,0 +1,42 @@ +Value Filldown STATUS ([bdhimrsSx*>]) +Value Filldown PATH_SELECTION ([bdhimrsSx*> ]) +Value Filldown ROUTE_SOURCE ([bdhimrsSx*> ]) +Value Filldown NETWORK (\S{0,18}) +Value Required NEXT_HOP (\S{0,19}) +Value Filldown METRIC (\S{0,6}) +Value LOCAL_PREF (\S{0,6}) +Value WEIGHT (\S{0,6}) +Value AS_PATH (.*?) +Value ORIGIN ([ie\?]) + +Start + # Since using mostly position, play it safe and ensure we see header first + ^\s+Network\s+Next Hop\s+Metric\s+LocPrf\s+Weight\s+Path -> Bgp_table + # Capture time-stamp if vty line has command time-stamping turned on + ^Load\s+for\s+ + ^Time\s+source\s+is + +Bgp_table + # + # + # Match if subnet is 17,18 characters long, creates two lines + # Example: *>i 10.104.192.208/29 + ^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}(?=${NETWORK}).{17,18}$$ -> Next + # + # + # Compliment to previous, status, path_selection, route_source, network is filldown. + # Example: 200.200.186.194 0 100 50000 64801 64808 64608 64601 64787 i + ^\s{20,25}(?=${NEXT_HOP}).{19}\s(?=\s{0,6}${METRIC}).{6}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record + # + # + # Match first when there is no network, since previous line had it already (compliment and filldown below) + # Example: *> 0.0.0.0 0 32768 i + ^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}\s{16}\s(?=${NEXT_HOP}).{19}\s(?=\s{0,6}${METRIC}).{6}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record + # + # + # Full normal example. metric, and as_path might not exist, regex defaults to blank line. + # Example: * i172.16.1.0/24 172.16.1.2 0 100 0 i + ^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}(?=${NETWORK}).{16}\s(?=${NEXT_HOP}).{19}\s(?=\s{0,6}${METRIC}).{6}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record + ^Total\s+number\s+of\s+prefixes + ^\s*$$ + ^. -> Error diff --git a/templates/index b/templates/index index 18b37ad593..3d5ffc946b 100644 --- a/templates/index +++ b/templates/index @@ -146,6 +146,7 @@ cisco_asa_dir.textfsm, .*, cisco_asa, dir cisco_ios_show_module.textfsm:cisco_ios_show_module_status.textfsm:cisco_ios_show_module_submodule.textfsm:cisco_ios_show_module_online_diag.textfsm, .*, cisco_ios, sh[[ow]] mod[[ule]] cisco_ios_show_switch_detail.textfsm:cisco_ios_show_switch_detail_stack_ports.textfsm, .*, cisco_ios, sh[[ow]] sw[[itch]] d[[etail]] cisco_ios_show_running-config_partition_access-list.textfsm, .*, cisco_ios, sh[[ow]] ru[[nning-config]] p[[artition]] a[[ccess-list]] +cisco_ios_show_ip_bgp_neighbors_advertised_routes.textfsm, .*, cisco_ios, sh[[ow]] ip bgp nei[[ghbors]] adv[[ertised-routes]] cisco_ios_show_running-config_partition_route-map.textfsm, .*, cisco_ios, sh[[ow]] ru[[nning-config]] p[[artition]] route-[[map]] cisco_ios_show_capability_feature_routing.textfsm, .*, cisco_ios, sh[[ow]] cap[[ability]] f[[eature]] r[[outing]] cisco_ios_show_ip_ospf_database_network.textfsm, .*, cisco_ios, sh[[ow]] ip ospf data[[base]] ne[[twork]] diff --git a/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.raw b/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.raw new file mode 100644 index 0000000000..4306c21570 --- /dev/null +++ b/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.raw @@ -0,0 +1,18 @@ +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 diff --git a/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.yml b/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.yml new file mode 100644 index 0000000000..2f79971867 --- /dev/null +++ b/tests/cisco_ios/show_ip_bgp_neighbors_advertised_routes/show_ip_bgp_neighbors_advertised_routes.yml @@ -0,0 +1,72 @@ +--- +parsed_sample: + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.45.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.48.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.50.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.51.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.53.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.54.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i" + - status: "*" + path_selection: ">" + route_source: " " + network: "113.55.58.0/24" + next_hop: "0.0.0.0" + metric: "" + local_pref: "" + weight: "32768" + as_path: "" + origin: "i"