04-27-2021 09:29 AM
Hello everyone,
is there a possibility to use the genie parser on output saved in text files?
The issue is that that it is not possible to install pyATS or genie on the machine where I can access the devices. What I can do is get the output of "show ip interface" save that to a text file and have genie parse that file on my machine.
I could use the NTC TextFSM parser, but wanted to know and learn if it is possible to use genie offline, so to say.
Thank you very much.
Kind regards,
Petrit
05-14-2021 02:54 PM - edited 05-14-2021 02:57 PM
Hello,
You can use the pyats-genie-command-parse library as follows
from pyats_genie_command_parse import GenieCommandParse parse_obj = GenieCommandParse(nos='ios') data = parse_obj.parse_file(show_command='show version', file_name_and_path='./show_version.txt') print(data)
This is a library to be able to parse NOS command output using the available Genie parsers, it seperates out needing to create a testbed.yml, and allows you to just get the output, and parse the output with Genie parsers.
08-01-2021 07:46 PM
Hi,
I tried using this "pyats_genie_command_parse", seems that some command works some didn't...Eg. are "show interfaces GigabitEthernet2/0/3 counters" or "show authentication sessions interface GigabitEthernet2/0/48 details" (to see NAC session in switchport).
These command always throw an exception. Did I miss something? Seems that those with an interface name have this issue...
ModuleNotFoundError: Could not find module_name for command show interfaces xxx counters for nos iosxe from genie: cli() missing 1 required positional argument: 'interface'
04-08-2022 12:43 AM
@petritberisha @choywy Were you able to implement genie offline?
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide