Skip to content

Instantly share code, notes, and snippets.

@spdkils
Last active January 15, 2019 22:24
Show Gist options
  • Save spdkils/dd86d72868df78cba2d45432eab68684 to your computer and use it in GitHub Desktop.
Save spdkils/dd86d72868df78cba2d45432eab68684 to your computer and use it in GitHub Desktop.
TextFSM showcdpneighbordetail
Value REMOTE_DEVICE_ID (.*)
Value List REMOTE_ENTRY_ADDRESSES (.*)
Value REMOTE_PLATFORM ([^,]+)
Value REMOTE_SYSTEM_CAPAB (.*)
Value LOCAL_INTERFACE ([^,]+)
Value REMOTE_PORT (.*)
Value REMOTE_HOLDTIME (\d+)
Value REMOTE_SYSTEM_VERSION (.+)
Value REMOTE_CDP_VERSION (.+)
Value REMOTE_DUPLEX (.+)
Value List REMOTE_MGMT_ADDRESSES (.*)
Start
# A line of hyphens delimits neighbor records
^------+ -> Record
^Device ID\s*[:-]\s+${REMOTE_DEVICE_ID}
^Entry address\(es\)\s*[:-] -> Entry
Description
# Capture the entire line and go back to Neighbor state
^${REMOTE_SYSTEM_VERSION} -> Entry
Entry
^.*IP address[:-]\s*${REMOTE_ENTRY_ADDRESSES}
^Platform\s*[:-]\s+${REMOTE_PLATFORM}\s*?Capabilities\s*[:-]\s+${REMOTE_SYSTEM_CAPAB}\s
^Interface\s*[:-]\s+${LOCAL_INTERFACE}\s*?Port ID \(outgoing port\)\s*?[:-]\s+${REMOTE_PORT}
^Holdtime\s*[:-]\s+${REMOTE_HOLDTIME}
^Version\s*: -> Description
^advertisement version\s*?[:-]\s+${REMOTE_CDP_VERSION}
^Duplex\s*[:-]\s*${REMOTE_DUPLEX}
^Management address\(es\): -> Bottom
^------+ -> Record Start
Bottom
^.*IP address[:-]\s*${REMOTE_MGMT_ADDRESSES}
^------+ -> Record Start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment