You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Value Required INTERFACE (\S+)
Value LINK_STATUS (\w+)
Value ADMIN_STATE (\S+)
Value HARDWARE_TYPE (.*)
Value ADDRESS ([a-zA-Z0-9]+.[a-zA-Z0-9]+.[a-zA-Z0-9]+)
Value BIA ([a-zA-Z0-9]+.[a-zA-Z0-9]+.[a-zA-Z0-9]+)
Value DESCRIPTION (.*)
Value IP_ADDRESS (\d+\.\d+\.\d+\.\d+\/\d+)
Value MTU (\d+)
Value DUPLEX (.+duplex?)
Value SPEED (.+?)
Value BANDWIDTH (\d+\s+\w+)
Value DELAY (\d+\s+\w+)
Value ENCAPSULATION (\w+)
Start
^${INTERFACE}\s+is\s+${LINK_STATUS}
^admin\s+state\s+is\s+${ADMIN_STATE},
^\s+Hardware(:|\s+is)\s+${HARDWARE_TYPE},\s+address(:|\s+is)\s+${ADDRESS}(.*bia\s+${BIA})*
^\s+Description:\s+${DESCRIPTION}
^\s+Internet\s+Address\s+is\s+${IP_ADDRESS}
^\s+${DUPLEX}, ${SPEED}(,|$$)
^\s+MTU\s+${MTU}.*BW\s+${BANDWIDTH}.*DLY\s+${DELAY}
^\s+Encapsulation\s+${ENCAPSULATION}
^\s+Last -> Record
^\s+Rx -> Record
SAMPLE COMMAND OUTPUT
Vlan1 is down (Administratively down), line protocol is down
Hardware is EtherSVI, address is 00de.fb01.c9bc
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
Vlan330 is up, line protocol is up
Hardware is EtherSVI, address is 00de.fb01.c921
Internet Address is 192.168.1.3/24
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
Vlan336 is up, line protocol is up
Hardware is EtherSVI, address is 00de.fb01.c933
Internet Address is 192.168.2.3/24
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
Vlan339 is up, line protocol is up
Hardware is EtherSVI, address is 00de.fb01.c9ab
Internet Address is 192.168.3.3/24
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
Vlan300 is up, line protocol is up
Hardware is EtherSVI, address is 00de.fb01.c9ef
Internet Address is 192.168.24.1/24
MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
Ethernet106/1/1 is down (Link not connected)
Hardware: 10/100/1000 Ethernet, address: 0000.d200.0000 (bia 0000.d200.0000)
MTU 1500 bytes, BW 23 Kbit, DLY 10 usec
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA
Port mode is access
auto-duplex, auto-speed
Beacon is turned off
Input flow-control is off, output flow-control is on
Switchport monitor is off
EtherType is 0x8100
Last link flapped 14week(s) 5day(s)
Last clearing of "show interface" counters never
9 interface resets
30 seconds input rate 0 bits/sec, 0 packets/sec
30 seconds output rate 0 bits/sec, 0 packets/sec
Load-Interval #2: 5 minute (300 seconds)
input rate 0 bps, 0 pps; output rate 0 bps, 0 pps
RX
18476 unicast packets 506094 multicast packets 362760 broadcast packets
887330 input packets 70500074 bytes
2 jumbo packets 0 storm suppression bytes
0 runts 0 giants 0 CRC 0 no buffer
0 input error 0 short frame 0 overrun 0 underrun 0 ignored
0 watchdog 0 bad etype drop 0 bad proto drop 0 if down drop
0 input with dribble 0 input discard
0 Rx pause
TX
17841 unicast packets 5660600 multicast packets 339717 broadcast packets
6018158 output packets 711823811 bytes
0 jumbo packets
0 output error 0 collision 0 deferred 0 late collision
0 lost carrier 0 no carrier 0 babble 0 output discard
0 Tx pause
SUMMARY
When the VLAN interface on show interfaces is in the middle of a section, TextFSM does not detect the VLAN interface. When it does pick up the VLAN interface is when the VLAN is the last item in the list.
Also just noticed, that with the sample provided above that the ip address detected and assigned to the physical interface was the VLAN IP address.
Ran the information pasted above through a textfsm parser as referenced in the Netmiko slack channel.
Originally I had developed a script to add IP addresses to Netbox that was not populating the Vlan information, and found that the template was not finding the Vlan information unless the Vlan was the last interface.
import textfsmimport pprintinput_file = open("tests//cisco_nxos//cisco_nxos_show_interface.raw")raw_text_data = input_file.read()input_file.close()fsm_template = open('cisco_nxos_show_interface.template')fsm_table = textfsm.TextFSM(fsm_template)fsm_results = fsm_table.ParseText(raw_text_data)with open('data.yml', 'w') as outfile:
for row in fsm_results:
temp_dict = {}for index, element in enumerate(row):
temp_dict[fsm_table.header[index].lower()] = elementprint '\n'pprint.pprint(temp_dict)
EXPECTED RESULTS
I expected to see outputs for 5 VLAN interfaces.
ACTUAL RESULTS
There are no VLANs and the VLAN IP address is assigned to the first physical interface after the VLANs in the output.
ISSUE TYPE
TEMPLATE USING
SAMPLE COMMAND OUTPUT
SUMMARY
When the VLAN interface on
show interfaces
is in the middle of a section, TextFSM does not detect the VLAN interface. When it does pick up the VLAN interface is when the VLAN is the last item in the list.Also just noticed, that with the sample provided above that the ip address detected and assigned to the physical interface was the VLAN IP address.
{'address': '0041.d23f.b4d1',
'admin_state': '',
'bandwidth': '23 Kbit',
'bia': '0041.d23f.b4d1',
'delay': '10 usec',
'description': '',
'duplex': 'auto-duplex',
'encapsulation': 'ARPA',
'hardware_type': '10/100/1000 Ethernet',
'interface': 'Ethernet106/1/48',
'ip_address': '',
'link_status': 'down',
'mtu': '1500',
'speed': 'auto-speed'}
STEPS TO REPRODUCE
Ran the information pasted above through a textfsm parser as referenced in the Netmiko slack channel.
Originally I had developed a script to add IP addresses to Netbox that was not populating the Vlan information, and found that the template was not finding the Vlan information unless the Vlan was the last interface.
EXPECTED RESULTS
I expected to see outputs for 5 VLAN interfaces.
ACTUAL RESULTS
There are no VLANs and the VLAN IP address is assigned to the first physical interface after the VLANs in the output.
The text was updated successfully, but these errors were encountered: