Skip to content

Commit b0fc2fe

Browse files
michalis1michalis1mjbear
authored
Updated TextFSM parser for “show interfaces status” on Arista devices. (#2080)
* updates arista show interfaces status * Change flags regex to be one or more non-ws chars * Reinstate old test data and regen in alphab order * Add new test data with Flags column * Reduce two Record lines to one Since the NAME capture group was the only difference between the two lines. * Add test for port channel with flags * Remove arista_eos_show_interfaces_status_port_channel_flags --------- Co-authored-by: michalis1 <milatis@gmail.com> Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
1 parent 75cdf4d commit b0fc2fe

5 files changed

Lines changed: 91 additions & 4 deletions

ntc_templates/templates/arista_eos_show_interfaces_status.textfsm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ Value STATUS (connected|notconnect|inactive|errdisabled|disabled)
44
Value VLAN_ID (\S+)
55
Value DUPLEX (\S+)
66
Value SPEED (\S+)
7-
Value TYPE (.+?)
7+
Value TYPE (\S.*)
8+
Value FLAGS (\S+)
89

910
Start
10-
^${PORT}\s+${NAME}\s+${STATUS}\s+(?:in\s+)?${VLAN_ID}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
11-
^${PORT}\s+${STATUS}\s+(?:in\s+)?${VLAN_ID}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}\s*$$ -> Record
12-
^Port\s+Name\s+Status\s+Vlan\s+Duplex\s+Speed\s+Type\s*$$
11+
^${PORT}(?:\s+${NAME})?\s+${STATUS}\s+(?:in\s+)?${VLAN_ID}\s+${DUPLEX}\s+${SPEED}\s+${TYPE}(?:\s+${FLAGS})?\s*$$ -> Record
12+
^Port\s+Name\s+Status\s+Vlan\s+Duplex\s+Speed\s+Type(?:\s+Flags)?\s*$$
1313
^\s*$$
1414
^. -> Error

tests/arista_eos/show_interfaces_status/arista_eos_show_interfaces_status.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
---
22
parsed_sample:
33
- duplex: "a-full"
4+
flags: ""
45
name: "I am a 40G port !! Hi"
56
port: "Et3/1/1"
67
speed: "a-40G"
78
status: "connected"
89
type: "40GBASE-CR4"
910
vlan_id: "trunk"
1011
- duplex: "unconf"
12+
flags: ""
1113
name: ""
1214
port: "Et3/1/4"
1315
speed: "unconf"
1416
status: "inactive"
1517
type: "40GBASE-CR4"
1618
vlan_id: "1"
1719
- duplex: "a-full"
20+
flags: ""
1821
name: "PORTNAME"
1922
port: "Et3/2/1"
2023
speed: "a-10G"
2124
status: "notconnect"
2225
type: "40GBASE-SR"
2326
vlan_id: "trunk"
2427
- duplex: "a-full"
28+
flags: ""
2529
name: "I am a 10G port"
2630
port: "Et3/2/2"
2731
speed: "a-10G"
2832
status: "errdisabled"
2933
type: "40GBASE-SR"
3034
vlan_id: "10"
3135
- duplex: "a-full"
36+
flags: ""
3237
name: "- DISABLED routed ("
3338
port: "Et3/2/4"
3439
speed: "a-10G"
3540
status: "disabled"
3641
type: "40GBASE-SR"
3742
vlan_id: "routed"
3843
- duplex: "a-full"
44+
flags: ""
3945
name: "-"
4046
port: "Et3/2/5"
4147
speed: "a-10G"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Port Name Status Vlan Duplex Speed Type Flags
2+
Et1 notconnect 10 auto auto 10GBASE-T
3+
Et2 notconnect 10 auto auto 10GBASE-T
4+
Et3 notconnect 10 auto auto 10GBASE-T
5+
Ma1 connected routed a-full a-100M 10/100/1000
6+
Et49 Core: drxx.yul01 notconnect in Po49 full 10G Not Present
7+
Et52 Core: drxx.yul01 connected in Po49 full 10G 10GBASE-SR
8+
Ma1 notconnect routed a-half a-10M 10/100/1000
9+
Po49 Core: dr01-dr02.y connected trunk full 20G N/A
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
parsed_sample:
3+
- duplex: "auto"
4+
flags: ""
5+
name: ""
6+
port: "Et1"
7+
speed: "auto"
8+
status: "notconnect"
9+
type: "10GBASE-T"
10+
vlan_id: "10"
11+
- duplex: "auto"
12+
flags: ""
13+
name: ""
14+
port: "Et2"
15+
speed: "auto"
16+
status: "notconnect"
17+
type: "10GBASE-T"
18+
vlan_id: "10"
19+
- duplex: "auto"
20+
flags: ""
21+
name: ""
22+
port: "Et3"
23+
speed: "auto"
24+
status: "notconnect"
25+
type: "10GBASE-T"
26+
vlan_id: "10"
27+
- duplex: "a-full"
28+
flags: ""
29+
name: ""
30+
port: "Ma1"
31+
speed: "a-100M"
32+
status: "connected"
33+
type: "10/100/1000"
34+
vlan_id: "routed"
35+
- duplex: "full"
36+
flags: ""
37+
name: "Core: drxx.yul01"
38+
port: "Et49"
39+
speed: "10G"
40+
status: "notconnect"
41+
type: "Not Present"
42+
vlan_id: "Po49"
43+
- duplex: "full"
44+
flags: ""
45+
name: "Core: drxx.yul01"
46+
port: "Et52"
47+
speed: "10G"
48+
status: "connected"
49+
type: "10GBASE-SR"
50+
vlan_id: "Po49"
51+
- duplex: "a-half"
52+
flags: ""
53+
name: ""
54+
port: "Ma1"
55+
speed: "a-10M"
56+
status: "notconnect"
57+
type: "10/100/1000"
58+
vlan_id: "routed"
59+
- duplex: "full"
60+
flags: ""
61+
name: "Core: dr01-dr02.y"
62+
port: "Po49"
63+
speed: "20G"
64+
status: "connected"
65+
type: "N/A"
66+
vlan_id: "trunk"

tests/arista_eos/show_interfaces_status/arista_eos_show_interfaces_status_port_channel.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
---
22
parsed_sample:
33
- duplex: "auto"
4+
flags: ""
45
name: "Cust: (SERV-XXXXX"
56
port: "Et1"
67
speed: "auto"
78
status: "disabled"
89
type: "1000BASE-T"
910
vlan_id: "1"
1011
- duplex: "auto"
12+
flags: ""
1113
name: "Cust: (SERV-XXXXX"
1214
port: "Et47"
1315
speed: "auto"
1416
status: "disabled"
1517
type: "1000BASE-T"
1618
vlan_id: "1"
1719
- duplex: "full"
20+
flags: ""
1821
name: "Core: drxx.yul01"
1922
port: "Et49"
2023
speed: "10G"
2124
status: "notconnect"
2225
type: "Not Present"
2326
vlan_id: "Po49"
2427
- duplex: "full"
28+
flags: ""
2529
name: "Core: drxx.yul01"
2630
port: "Et52"
2731
speed: "10G"
2832
status: "connected"
2933
type: "10GBASE-SR"
3034
vlan_id: "Po49"
3135
- duplex: "a-half"
36+
flags: ""
3237
name: ""
3338
port: "Ma1"
3439
speed: "a-10M"
3540
status: "notconnect"
3641
type: "10/100/1000"
3742
vlan_id: "routed"
3843
- duplex: "full"
44+
flags: ""
3945
name: "Core: dr01-dr02.y"
4046
port: "Po49"
4147
speed: "20G"

0 commit comments

Comments
 (0)