ntc-templates icon indicating copy to clipboard operation
ntc-templates copied to clipboard

juniper junos_show_interfaces not parsing correctly

Open andyb2000 opened this issue 1 year ago • 0 comments

ISSUE TYPE
  • Template Issue with error and raw data
TEMPLATE USING

./ntc_templates/templates/juniper_junos_show_interfaces.textfsm

Value Required INTERFACE (\S+)
Value LINK_STATUS (\w+)
Value ADMIN_STATE (\S+)
Value HARDWARE_TYPE (\S+)
Value DESCRIPTION (\w+.*)
Value DESTINATION (\S+)
Value LOCAL (\S+)
Value MTU (\d+|Unlimited)

Start
  ^\s*\S+\s+interface -> Continue.Record
  ^Physical\s+interface:\s+${INTERFACE},\s+${ADMIN_STATE},\s+Physical\s+link\s+is\s+${LINK_STATUS}
  ^.*Description:\s+${DESCRIPTION}
  ^.*ype:\s+${HARDWARE_TYPE},.*MTU:\s+${MTU}.*
  ^\s+Logical\s+interface\s+${INTERFACE}
  ^.*Destination:\s+${DESTINATION},\s+Local:\s+${LOCAL},.*
  ^\s*$$
  ^{master:\d+}

SAMPLE COMMAND OUTPUT
Physical interface: xe-0/1/0, Enabled, Physical link is Up
  Interface index: 153, SNMP ifIndex: 564
  Description: ### My description - remote host - remote location - feature codes - info here ###
  Link-level type: Ethernet, MTU: 9114, MRU: 9122, LAN-PHY mode, Speed: 10Gbps, BPDU Error: None, Loop Detect PDU Error: None, MAC-REWRITE Error: None, Loopback: None, Source filtering: Disabled, Flow control: Enabled, Speed Configuration: 1G
  Pad to minimum frame size: Disabled
  Device flags   : Present Running
  Interface flags: SNMP-Traps Internal: 0x4000
  Link flags     : None
  CoS queues     : 8 supported, 8 maximum usable queues
  Schedulers     : 0
  Current address: 0a:aa:aa:aa:aa:aa, Hardware address: 0a:aa:aa:aa:aa:aa
  Last flapped   : 2022-07-28 21:30:59 GMT (43w0d 15:54 ago)
  Input rate     : 648 bps (1 pps)
  Output rate    : 968 bps (0 pps)
  Active alarms  : None
  Active defects : None
  PCS statistics                      Seconds
    Bit errors                             1
    Errored blocks                         0
  Interface transmit statistics: Disabled
EXPECTED RESULTS

parsing of description, IP, mac address, etc.

ACTUAL RESULTS
{'admin_state': 'Enabled',
  'description': '',
  'destination': '',
  'hardware_type': 'Ethernet',
  'interface': 'xe-0/1/0',
  'link_status': 'Up',
  'local': '',
  'mtu': '9114'},

andyb2000 avatar May 26 '23 14:05 andyb2000