python-textfsm

Creating Textfsm Template For Cisco XR // show isis database


I'am trying to create template for show isis database output in Cisco XR, I can't understand what is wrong. Can someone point out? I can not even load template with command of textfsm.TextFSM(template).

Template:

Value LSPID ((\d+.\d+.\d+)|\S+)
Value LSP_SEQ_NUM (0x.+)
Value LSP_CHECKSUM (0x.+)
Value LSP_HOLDTIME (\d+)
Value ATT_P_OL (\d?\/\d?\/\d?)


Start


^${LSPID}\s+${LSP_SEQ_NUM}\s+${LSP_CHECKSUM}\s+${LSP_HOLD_TIME}\s+${ATT_P_OL} -> Record

Solution

  • Typo in LSP_HOLDTIME and indentation in regex line is missing. This is working one:

    Value LSPID ((\d+.\d+.\d+)|\S+)
    Value LSP_SEQ_NUM (0x\S+)
    Value LSP_CHECKSUM (0x\S+)
    Value LSP_HOLDTIME (\d+)
    Value ATT_P_OL (\d?\/\d?\/\d?)
    
    Start
      ^${LSPID}\s+${LSP_SEQ_NUM}\s+${LSP_CHECKSUM}\s+${LSP_HOLDTIME}\s+${ATT_P_OL} -> Record