Skip to content

Commit 1c0598d

Browse files
committed
config/textfsm: created textfsm routes templates for sonic 4.2
- created sonic_routes_v42.tfsm: template specific for route command in sonic v42 where entries contains the vrf id instead of the vrf name - created sonic_vrf_show.tfsm: template to parse the output of the ip vrf show command, useful to get the vrf name Signed-off-by: AndryNick98 <[email protected]>
1 parent 4de5990 commit 1c0598d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Value protocol (\w+)
2+
Value Required prefix ([0-9./]*|[0-9a-f:/]*|default)
3+
Value vrf_id (\d+)
4+
Value source ([0-9./]*)
5+
Value List nexthopIps ([0-9./]*|[0-9a-f:/]*)
6+
Value List oifs (\S+)
7+
Value List weights (\d+)
8+
Value metric (\d+)
9+
Value action (blackhole)
10+
11+
Start
12+
^\S+ -> Continue.Record
13+
^${action}\s+(?:nhid \d+\s+)?${prefix}\s+proto ${protocol}\s+metric ${metric}.*$$
14+
^\s+nexthop via\s+${nexthopIps}\s+dev ${oifs}\s+weight ${weights}.*$$
15+
^${prefix}\s+(?:nhid \d+\s+)?via\s+${nexthopIps}\s+dev ${oifs}\s+table ${vrf_id}\s+proto ${protocol}\s+metric ${metric}.*$$
16+
^${prefix}\s+(?:nhid \d+\s+)?dev ${oifs}\s+table ${vrf_id}\s+proto ${protocol}.*src ${source}.*$$
17+
^unreachable\s+(?:nhid \d+\s+)?${prefix}\s+table ${vrf_id}\s+metric ${metric}.*$$
18+
^${prefix}\s+(?:nhid \d+\s+)?via\s+${nexthopIps}\s+dev ${oifs}\s+table ${vrf_id}
19+
^${prefix}\s+(?:nhid \d+\s+)?proto ${protocol}\s+metric ${metric}.*$$
20+
^${prefix}\s+(?:nhid \d+\s+)?proto ${protocol}\s+src ${source}\s+metric ${metric}.*$$
21+
^${prefix}\s+(?:nhid \d+\s+)?via ${nexthopIps}\s+dev ${oifs}\s+proto ${protocol}\s+metric ${metric}.*$$
22+
^${prefix}\s+(?:nhid \d+\s+)?dev ${oifs}\s+proto ${protocol}.*src ${source}.*$$
23+
^${prefix}\s+(?:nhid \d+\s+)?via ${nexthopIps}\s+dev ${oifs}.*$$
24+
^${prefix}\s+(?:nhid \d+\s+)?table ${vrf_id}\s+proto ${protocol}\s+metric ${metric}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Value vrf (\S+)
2+
Value table_id (\d+)
3+
4+
Start
5+
^${vrf}\s+${table_id} -> Record

0 commit comments

Comments
 (0)