| 1 |
Value Filldown STATUS ([bdhimrsSx*>]) |
| 2 |
Value Filldown PATH_SELECTION ([bdhimrsSx*> ]) |
| 3 |
Value Filldown ROUTE_SOURCE ([bdhimrsSx*> ]) |
| 4 |
Value Filldown NETWORK (\S{0,18}) |
| 5 |
Value Required NEXT_HOP (\S{0,15}) |
| 6 |
Value Filldown METRIC (\S{0,10}) |
| 7 |
Value LOCAL_PREF (\S{0,6}) |
| 8 |
Value WEIGHT (\S{0,6}) |
| 9 |
Value AS_PATH (.*?) |
| 10 |
Value ORIGIN ([ie\?]) |
| 11 |
|
| 12 |
Start |
| 13 |
# Since using mostly position, play it safe and ensure we see header first |
| 14 |
^\s+Network\s+Next Hop\s+Metric\s+LocPrf\s+Weight\s+Path -> Bgp_table |
| 15 |
# Capture time-stamp if vty line has command time-stamping turned on |
| 16 |
^Load\s+for\s+ |
| 17 |
^Time\s+source\s+is |
| 18 |
|
| 19 |
Bgp_table |
| 20 |
# |
| 21 |
# |
| 22 |
# Match if subnet is 17,18 characters long, creates two lines |
| 23 |
# Example: *>i 10.104.192.208/29 |
| 24 |
^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}(?=${NETWORK}).{17,18}$$ -> Next |
| 25 |
# |
| 26 |
# |
| 27 |
# Compliment to previous, status, path_selection, route_source, network is filldown. |
| 28 |
# Example: 200.200.186.194 0 100 50000 64801 64808 64608 64601 64787 i |
| 29 |
^\s{20,25}(?=${NEXT_HOP}).{15}\s(?=\s{0,10}${METRIC}).{10}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record |
| 30 |
# |
| 31 |
# |
| 32 |
# Match first when there is no network, since previous line had it already (compliment and filldown below) |
| 33 |
# Example: *> 0.0.0.0 0 32768 i |
| 34 |
^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}\s{16}\s(?=${NEXT_HOP}).{15}\s(?=\s{0,10}${METRIC}).{10}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record |
| 35 |
# |
| 36 |
# |
| 37 |
# Full normal example. metric, and as_path might not exist, regex defaults to blank line. |
| 38 |
# Example: * i172.16.1.0/24 172.16.1.2 0 100 0 i |
| 39 |
^\s{0,1}${STATUS}${PATH_SELECTION}${ROUTE_SOURCE}\s{0,2}(?=${NETWORK}).{16}\s(?=${NEXT_HOP}).{15}\s(?=\s{0,10}${METRIC}).{10}\s(?=\s{0,6}${LOCAL_PREF}).{6}\s(?=\s{0,6}${WEIGHT}).{6}\s*${AS_PATH}\s*${ORIGIN}$$ -> Record |
| 40 |
^Total\s+number\s+of\s+prefixes |
| 41 |
^\s*$$ |
| 42 |
^. -> Error |