networktocode/ntc-templates

nxos show ip bgp does not support AS set

tom0010 opened this issue · 0 comments

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING
# Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Value STATUS ([sxSdh*])
# ? \| multipath
Value PATH_SELECTION ([> |])
# Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-injected
Value ROUTE_SOURCE ([ieclarI])
Value Filldown NETWORK ([A-Fa-f0-9:\.]+\/\d+)
Value NEXT_HOP ([A-Fa-f0-9:\.]+)
Value METRIC (\d+)
Value LOCAL_PREF (\d+)
Value WEIGHT (\d+)
Value AS_PATH (\d+(\s\d+)*)
# Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup
Value ORIGIN ([ie\?\|&])


Start
  ^BGP\s+(routing|table)\s 
  ^Status:
  ^Path type:
  ^Origin codes:
  ^\s*Network\s+Next Hop\s+Metric\s+LocPrf\s+Weight\s+Path -> Bgp_table
  ^. -> Error

Bgp_table
  #
  # Match first when there is no network, since previous line had it already (compliment and filldown below)
  # Older table format, with blank values parsing not reliable. (cisco_nxos_show_ip_bgp.raw)
  #             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
  ^${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
  ^${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 
  ^${STATUS}${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}\s${NEXT_HOP}\s${METRIC}\s${LOCAL_PREF}\s${WEIGHT}(\s${AS_PATH})?\s${ORIGIN}$$ -> Record
  ^. -> Error

EOF
SAMPLE COMMAND OUTPUT
show ip bgp
SUMMARY

If the bgp table has an AS set in the output from show ip bgp, the template is unable to parse.

STEPS TO REPRODUCE
  • Check a device that has an AS set in its BGP table
  • Run show ip bgp with the nxos_show_ip_bgp template

With AS set:
image

Without AS set:
image

EXPECTED RESULTS

Template to parse the AS set

ACTUAL RESULTS

Template error, see screenshot:

[
	"State Error raised. Rule Line: 39. Input Line: *>e1.1.1.2/23         2.2.2.2                                   0 100 {200 300} i"
]