Skip to content

Commit 99ce440

Browse files
authored
Normalize pvid with vlan_id (#2019)
* Normalize hp_comware pvid >> vlan_id * Normalize edgecore pvid >> vlan_id * Normalize ruckus_fastiron pvid >> vlan_id * Normalize huawei_vrp pvid >> vlan_id * Regenerate yaml for hp_comware disp int brief * Update test data for capture group name change
1 parent 122f262 commit 99ce440

22 files changed

Lines changed: 1923 additions & 1923 deletions

ntc_templates/templates/edgecore_show_interfaces_brief.textfsm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Value INTERFACE (\S+\s+\d+\s*/\s*\d+)
22
Value NAME (.*?)
33
Value STATUS (Up|Down|Disabled)
4-
Value PVID (\d+)
4+
Value VLAN_ID (\d+)
55
Value PRIORITY (\d+)
66
Value NEGOTIATION (Auto)
77
Value SPEED (\d+)
@@ -16,6 +16,6 @@ Start
1616

1717
IfacesTable
1818
^(?:\s*-+)+\s*$$
19-
^\s*${INTERFACE}(?:\s+${NAME})?\s+${STATUS}\s+${PVID}\s+${PRIORITY}\s+(?:${NEGOTIATION})?-?(?:${SPEED}${DUPLEX})?\s+${TYPE}\s+${TRUNK}\s*$$ -> Record
19+
^\s*${INTERFACE}(?:\s+${NAME})?\s+${STATUS}\s+${VLAN_ID}\s+${PRIORITY}\s+(?:${NEGOTIATION})?-?(?:${SPEED}${DUPLEX})?\s+${TYPE}\s+${TRUNK}\s*$$ -> Record
2020
^\s*$$
2121
^. -> Error

ntc_templates/templates/hp_comware_display_interface_brief.textfsm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Value MAIN_IP (\S+)
55
Value SPEED (\S+)
66
Value DUPLEX (\S+)
77
Value TYPE (A|T|H)
8-
Value PVID (\d+)
8+
Value VLAN_ID (\d+)
99
Value DESCRIPTION (.*?)
1010

1111
Start
@@ -26,6 +26,6 @@ RouteModeIfaces
2626
^. -> Error
2727

2828
BridgeModeIfaces
29-
^${INTERFACE}\s+${LINK}\s+${SPEED}(?:\(a\))?\s+${DUPLEX}(?:\(a\))?\s+${TYPE}\s+${PVID}(?:\s+${DESCRIPTION})?\s*$$ -> Record
29+
^${INTERFACE}\s+${LINK}\s+${SPEED}(?:\(a\))?\s+${DUPLEX}(?:\(a\))?\s+${TYPE}\s+${VLAN_ID}(?:\s+${DESCRIPTION})?\s*$$ -> Record
3030
^\s*$$
3131
^. -> Error

ntc_templates/templates/huawei_vrp_display_interface.textfsm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Value PROTOCOL_STATUS (\S*|\S*\s+\(\w+\))
44
Value INTERFACE_DESCRIPTION (.*)
55
Value LINK_TYPE (\S+)
66
Value PORT_TYPE (\S*)
7-
Value PVID (\d+)
7+
Value VLAN_ID (\d+)
88
Value TPID (\S+)
99
Value MTU (\d+)
1010
Value HOLD_TIMER (\d+)
@@ -31,9 +31,9 @@ Start
3131
^\s*Description:${INTERFACE_DESCRIPTION}\s*$$
3232
^\s*${PORT_TYPE}\s+Port,\s*Link-type\s*:\s*${LINK_TYPE},\s*$$
3333
^\s*${PORT_TYPE}\s+Port,\s*The\s+(MTU|Maximum\s+Transmit\s+Unit)\s+is\s+${MTU}(,\s*Hold\s+timer\s+is\s+${HOLD_TIMER}\(sec\))?\s*$$
34-
^\s*${PORT_TYPE}\s+Port,(\s*PVID\s*:\s*${PVID},)?\s*TPID\s*:\s*${TPID},\s*The\s+Maximum\s+(Frame\s+Length|Transmit\s+Unit)\s+is\s+${MTU}\s*$$
34+
^\s*${PORT_TYPE}\s+Port,(\s*PVID\s*:\s*${VLAN_ID},)?\s*TPID\s*:\s*${TPID},\s*The\s+Maximum\s+(Frame\s+Length|Transmit\s+Unit)\s+is\s+${MTU}\s*$$
3535
^\s*TPID\s*:\s*${TPID},\s*The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}\s*$$
36-
^\s*PVID\s*:\s+${PVID},(\s*[^,]+,){0,}\s+The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}
36+
^\s*PVID\s*:\s+${VLAN_ID},(\s*[^,]+,){0,}\s+The\s+Maximum\s+Frame\s+Length\s+is\s+${MTU}
3737
^\s*Internet\s+Address\s+is\s+allocated\s+by\s+DHCP,\s+${IP_ADDRESS}\s*$$
3838
^\s*Internet\s+Address\s+is\s+negotiated,\s+${IP_ADDRESS}\s*$$
3939
^\s*Internet\s+Address\s+is\s+${IP_ADDRESS}\s*$$

ntc_templates/templates/huawei_vrp_display_port_vlan.textfsm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Value Required INTERFACE ([\w\.\/\-]+)
22
Value LINK_TYPE (trunk|access|auto|hybrid|desirable)
3-
Value PVID (\d+)
3+
Value VLAN_ID (\d+)
44
Value List TRUNK_VLAN_LIST (\d+\-\d+|\d+)
55

66

@@ -11,7 +11,7 @@ Start
1111

1212
VLANS
1313
^[\w\.\/\-]+ -> Continue.Record
14-
^${INTERFACE}\s+${LINK_TYPE}\s+${PVID}\s+${TRUNK_VLAN_LIST}\s* -> Continue
14+
^${INTERFACE}\s+${LINK_TYPE}\s+${VLAN_ID}\s+${TRUNK_VLAN_LIST}\s* -> Continue
1515
^[\w\.\/\-]+\s+(?:\S+\s+){3}${TRUNK_VLAN_LIST}\s* -> Continue
1616
^[\w\.\/\-]+\s+(?:\S+\s+){4}${TRUNK_VLAN_LIST}\s* -> Continue
1717
^[\w\.\/\-]+\s+(?:\S+\s+){5}${TRUNK_VLAN_LIST}\s* -> Continue
@@ -134,7 +134,7 @@ VLANS
134134
# Bundled interface (PVID is 0)
135135
^${INTERFACE}\s+-\s+0\s+-\s*$$ -> Record
136136
# Access port (PVID is empty)
137-
^${INTERFACE}\s+${LINK_TYPE}\s+${PVID}\s+-\s*$$ -> Record
137+
^${INTERFACE}\s+${LINK_TYPE}\s+${VLAN_ID}\s+-\s*$$ -> Record
138138
# Interface lists
139139
^[\w\.\/\-]+\s+\S+\s+\d+\s+[0-9\- ]+$$
140140
^\s{6,}

ntc_templates/templates/ruckus_fastiron_show_interfaces_brief.textfsm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ Value DUPLEX (\S+)
55
Value SPEED (\S+)
66
Value TRUNK (\S+)
77
Value TAG (\S+)
8-
Value PVID (\S+)
8+
Value VLAN_ID (\S+)
99
Value PRIORITY (\S+)
1010
Value MAC_ADDRESS (([A-Fa-f0-9\.]{14}|None))
1111
Value NAME (\S+)
1212

1313
Start
1414
^Port\s+Link\s+State\s+Dupl\s+Speed\s+Trunk\s+Tag\s+Pvid\s+Pri\s+MAC\s+Name
15-
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${PVID}\s+${PRIORITY}\s+${MAC_ADDRESS}\s+${NAME} -> Record
16-
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${PVID}\s+${PRIORITY}\s+${MAC_ADDRESS} -> Record
15+
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${VLAN_ID}\s+${PRIORITY}\s+${MAC_ADDRESS}\s+${NAME} -> Record
16+
^${PORT}\s+${LINK}\s+${STATE}\s+${DUPLEX}\s+${SPEED}\s+${TRUNK}\s+${TAG}\s+${VLAN_ID}\s+${PRIORITY}\s+${MAC_ADDRESS} -> Record
1717
^\s*$$
1818
^. -> Error
Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,102 @@
11
---
22
parsed_sample:
3-
- interface: "Eth 1/ 1"
3+
- duplex: ""
4+
interface: "Eth 1/ 1"
45
name: "Mikrotik-11.22.33."
5-
priority: "0"
6-
pvid: "1"
76
negotiation: "Auto"
7+
priority: "0"
88
speed: ""
9-
duplex: ""
109
status: "Down"
1110
trunk: "None"
1211
type: "100TX"
13-
- interface: "Eth 1/ 2"
12+
vlan_id: "1"
13+
- duplex: ""
14+
interface: "Eth 1/ 2"
1415
name: "vl10_toTESTS-PC"
15-
priority: "0"
16-
pvid: "5"
1716
negotiation: "Auto"
17+
priority: "0"
1818
speed: ""
19-
duplex: ""
2019
status: "Down"
2120
trunk: "None"
2221
type: "100TX"
23-
- interface: "Eth 1/ 3"
22+
vlan_id: "5"
23+
- duplex: "full"
24+
interface: "Eth 1/ 3"
2425
name: "FortiGateLOL-vl10"
25-
priority: "0"
26-
pvid: "730"
2726
negotiation: "Auto"
27+
priority: "0"
2828
speed: "100"
29-
duplex: "full"
3029
status: "Up"
3130
trunk: "None"
3231
type: "100TX"
33-
- interface: "Eth 1/ 4"
32+
vlan_id: "730"
33+
- duplex: ""
34+
interface: "Eth 1/ 4"
3435
name: ""
35-
priority: "0"
36-
pvid: "3010"
3736
negotiation: "Auto"
37+
priority: "0"
3838
speed: ""
39-
duplex: ""
4039
status: "Down"
4140
trunk: "None"
4241
type: "100TX"
43-
- interface: "Eth 1/ 5"
42+
vlan_id: "3010"
43+
- duplex: "full"
44+
interface: "Eth 1/ 5"
4445
name: ""
45-
priority: "0"
46-
pvid: "884"
4746
negotiation: ""
47+
priority: "0"
4848
speed: "100"
49-
duplex: "full"
5049
status: "Down"
5150
trunk: "None"
5251
type: "100TX"
53-
- interface: "Eth 1/ 6"
52+
vlan_id: "884"
53+
- duplex: ""
54+
interface: "Eth 1/ 6"
5455
name: ""
55-
priority: "0"
56-
pvid: "884"
5756
negotiation: "Auto"
57+
priority: "0"
5858
speed: ""
59-
duplex: ""
6059
status: "Down"
6160
trunk: "None"
6261
type: "100TX"
63-
- interface: "Eth 1/ 7"
62+
vlan_id: "884"
63+
- duplex: "full"
64+
interface: "Eth 1/ 7"
6465
name: "Phone_Lollink_RNCB"
65-
priority: "0"
66-
pvid: "222"
6766
negotiation: "Auto"
67+
priority: "0"
6868
speed: "100"
69-
duplex: "full"
7069
status: "Up"
7170
trunk: "None"
7271
type: "100TX"
73-
- interface: "Eth 1/ 8"
72+
vlan_id: "222"
73+
- duplex: "full"
74+
interface: "Eth 1/ 8"
7475
name: ""
75-
priority: "0"
76-
pvid: "222"
7776
negotiation: "Auto"
77+
priority: "0"
7878
speed: "100"
79-
duplex: "full"
8079
status: "Up"
8180
trunk: "None"
8281
type: "100TX"
83-
- interface: "Eth 1/ 9"
82+
vlan_id: "222"
83+
- duplex: "full"
84+
interface: "Eth 1/ 9"
8485
name: ""
85-
priority: "0"
86-
pvid: "1"
8786
negotiation: "Auto"
87+
priority: "0"
8888
speed: "1000"
89-
duplex: "full"
9089
status: "Up"
9190
trunk: "None"
9291
type: "1000T"
93-
- interface: "Eth 1/10"
92+
vlan_id: "1"
93+
- duplex: "full"
94+
interface: "Eth 1/10"
9495
name: "Uplink"
95-
priority: "0"
96-
pvid: "1"
9796
negotiation: "Auto"
97+
priority: "0"
9898
speed: "1000"
99-
duplex: "full"
10099
status: "Up"
101100
trunk: "None"
102101
type: "1000Base SFP"
102+
vlan_id: "1"

tests/hp_comware/display_interface_brief/hp_comware_display_interface_brief.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,96 +6,96 @@ parsed_sample:
66
link: "UP"
77
main_ip: "--"
88
protocol: "UP"
9-
pvid: ""
109
speed: ""
1110
type: ""
11+
vlan_id: ""
1212
- description: ""
1313
duplex: ""
1414
interface: "Cellular0/0"
1515
link: "DOWN"
1616
main_ip: "--"
1717
protocol: "DOWN"
18-
pvid: ""
1918
speed: ""
2019
type: ""
20+
vlan_id: ""
2121
- description: "The interface for connecting RouterA."
2222
duplex: ""
2323
interface: "GE0/0"
2424
link: "UP"
2525
main_ip: "192.168.100.1"
2626
protocol: "UP"
27-
pvid: ""
2827
speed: ""
2928
type: ""
29+
vlan_id: ""
3030
- description: "--"
3131
duplex: ""
3232
interface: "Loop0"
3333
link: "UP"
3434
main_ip: "--"
3535
protocol: "UP(s)"
36-
pvid: ""
3736
speed: ""
3837
type: ""
38+
vlan_id: ""
3939
- description: ""
4040
duplex: ""
4141
interface: "MP0"
4242
link: "DOWN"
4343
main_ip: "--"
4444
protocol: "DOWN"
45-
pvid: ""
4645
speed: ""
4746
type: ""
47+
vlan_id: ""
4848
- description: "--"
4949
duplex: ""
5050
interface: "NULL0"
5151
link: "UP"
5252
main_ip: "--"
5353
protocol: "UP(s)"
54-
pvid: ""
5554
speed: ""
5655
type: ""
56+
vlan_id: ""
5757
- description: ""
5858
duplex: ""
5959
interface: "Vlan1"
6060
link: "DOWN"
6161
main_ip: "192.168.1.1"
6262
protocol: "DOWN"
63-
pvid: ""
6463
speed: ""
6564
type: ""
65+
vlan_id: ""
6666
- description: ""
6767
duplex: "A"
6868
interface: "GE0/1"
6969
link: "DOWN"
7070
main_ip: ""
7171
protocol: ""
72-
pvid: "1"
7372
speed: "auto"
7473
type: "A"
74+
vlan_id: "1"
7575
- description: ""
7676
duplex: "A"
7777
interface: "GE0/2"
7878
link: "DOWN"
7979
main_ip: ""
8080
protocol: ""
81-
pvid: "1"
8281
speed: "auto"
8382
type: "A"
83+
vlan_id: "1"
8484
- description: ""
8585
duplex: "A"
8686
interface: "GE0/3"
8787
link: "DOWN"
8888
main_ip: ""
8989
protocol: ""
90-
pvid: "1"
9190
speed: "auto"
9291
type: "A"
92+
vlan_id: "1"
9393
- description: ""
9494
duplex: "A"
9595
interface: "GE0/4"
9696
link: "DOWN"
9797
main_ip: ""
9898
protocol: ""
99-
pvid: "1"
10099
speed: "auto"
101100
type: "A"
101+
vlan_id: "1"

tests/hp_comware/display_interface_brief/hp_comware_display_interface_brief_fullauto.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,42 @@ parsed_sample:
66
link: "ADM"
77
main_ip: "--"
88
protocol: "DOWN"
9-
pvid: ""
109
speed: ""
1110
type: ""
11+
vlan_id: ""
1212
- description: ""
1313
duplex: ""
1414
interface: "NULL0"
1515
link: "UP"
1616
main_ip: "--"
1717
protocol: "UP(s)"
18-
pvid: ""
1918
speed: ""
2019
type: ""
20+
vlan_id: ""
2121
- description: ""
2222
duplex: ""
2323
interface: "Vlan1081"
2424
link: "UP"
2525
main_ip: "1.2.3.6"
2626
protocol: "UP"
27-
pvid: ""
2827
speed: ""
2928
type: ""
29+
vlan_id: ""
3030
- description: "mydescr"
3131
duplex: "F(a)"
3232
interface: "BAGG10"
3333
link: "UP"
3434
main_ip: ""
3535
protocol: ""
36-
pvid: "4094"
3736
speed: "20G(a)"
3837
type: "T"
38+
vlan_id: "4094"
3939
- description: "mydescr"
4040
duplex: "F(a)"
4141
interface: "BAGG11"
4242
link: "UP"
4343
main_ip: ""
4444
protocol: ""
45-
pvid: "4094"
4645
speed: "20G(a)"
4746
type: "T"
47+
vlan_id: "4094"

0 commit comments

Comments
 (0)