TextFSM | Cisco | VRF Data

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024
  • Let's suppose you want to extract parameters like RD,RT,VRF etc from Cisco router configuration.
    One way is to use regular expression but this is not easy way.
    Another option is to use TextFSM module for easy extract of parameters from parsed configuration
    Install Following module
    textfsm
    pprint
    #### Template for Reference [
    Value Required VRF (\S+)
    Value rd (\S+)
    Value import_map (\S+)
    Value export_map (\S+)
    Value List RT_import (\S+)
    Value List RT_export (\S+)
    Start
    ^vrf definition ${VRF}
    ^ rd ${rd}
    ^ export map ${export_map}
    ^ import map ${import_map}
    ^ route-target export ${RT_export}
    ^ route-target import ${RT_import}
    ^! # Record (# is actually dash + Angled bracket)

Комментарии • 4