Skip to content

Commit

Permalink
Fix networktocode#1321 - Cisco NXOS show ip bgp add support for empty…
Browse files Browse the repository at this point in the history
… status (networktocode#1404)

* Add support for empty status

* Update tests for Cisco NXOS show ip bgp empty status

* Update match compared to value from comments from Ken

* Update tests for show ip bgp nxos

---------

Co-authored-by: tom0010 <[email protected]>
  • Loading branch information
tom0010 and tom0010 authored Jul 21, 2023
1 parent 9e337d7 commit 990de38
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ntc_templates/templates/cisco_nxos_show_ip_bgp.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ Bgp_table
# Network Next Hop Metric LocPrf Weight Path
# Example: *>e10.10.101.4/30 10.10.2.1 0 64102 i
# Example: *>e 10.10.1.1 0 64101 64002 i
^\s+${PATH_SELECTION}${ROUTE_SOURCE}\s\s\s{16}(\s{0,12}${NEXT_HOP}\s{4}|\s{20})(\s{2,14}${METRIC}|\s{8})(\s{1,18}${LOCAL_PREF}|\s{8})(\s{1,22}${WEIGHT})(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}${NETWORK}(\s{0,12}${NEXT_HOP}\s{4}|\s{20})(\s{2,14}${METRIC}|\s{8})(\s{1,18}${LOCAL_PREF}|\s{8})(\s{1,22}${WEIGHT})(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^\s+${PATH_SELECTION}${ROUTE_SOURCE}${NETWORK}(\s{0,12}${NEXT_HOP}\s{4}|\s{20})(\s{2,14}${METRIC}|\s{8})(\s{1,18}${LOCAL_PREF}|\s{8})(\s{1,22}${WEIGHT})(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s\s\s{16}(\s{0,12}${NEXT_HOP}\s{4}|\s{20})(\s{2,14}${METRIC}|\s{8})(\s{1,18}${LOCAL_PREF}|\s{8})(\s{1,22}${WEIGHT})(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
#
# Match newer format (cisco_nxos_show_ip_bgp1.raw)
# Example: * e0.0.0.0/0 1.2.3.4 4294967295 0 12345.102
^\s+${PATH_SELECTION}${ROUTE_SOURCE}${NETWORK}\s${NEXT_HOP}\s${METRIC}\s${LOCAL_PREF}\s${WEIGHT}(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}${NETWORK}\s${NEXT_HOP}\s${METRIC}\s${LOCAL_PREF}\s${WEIGHT}(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^\s+${PATH_SELECTION}${ROUTE_SOURCE}\s${NEXT_HOP}\s${METRIC}\s${LOCAL_PREF}\s${WEIGHT}(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s${NEXT_HOP}\s${METRIC}\s${LOCAL_PREF}\s${WEIGHT}(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
^. -> Error

Expand Down
1 change: 1 addition & 0 deletions tests/cisco_nxos/show_ip_bgp/cisco_nxos_show_ip_bgp.raw
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ x e100.100.100.104/30 10.10.2.1 0 64102 640
*>e 10.10.1.1 0 64101 64002 i
*>e100.100.100.108/30 10.10.2.1 0 64102 {64201 64202} i
*>e100.100.100.112/30 10.10.2.1 0 64102 {64201 64202} 64203 i
l 0.0.0.0 100 32768 i
10 changes: 10 additions & 0 deletions tests/cisco_nxos/show_ip_bgp/cisco_nxos_show_ip_bgp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,3 +400,13 @@ parsed_sample:
route_source: "e"
status: "*"
weight: "0"
- as_path: ""
local_pref: "100"
metric: ""
network: "100.100.100.112/30"
next_hop: "0.0.0.0"
origin: "i"
path_selection: " "
route_source: "l"
status: ""
weight: "32768"

0 comments on commit 990de38

Please sign in to comment.