02-21-2021 11:48 PM - edited 02-21-2021 11:50 PM
Hello,
I would like to use pyAts as a tool to read configuration from devices. I do not need to enter `config state` mode and I don't even have the rights to do that.
When I run my example code
from genie.testbed import load
from pprint import pprint
tb = load('testbed.yaml')
dev = tb.devices['R115']
dev.connect()I end up with the error:
config term
^
% Invalid input detected at '^' marker.
unicon.core.errors.TimeoutError: timeout occurred:
timeout value: 10
last_command: 'config term\r'
pattern: ['^(.*)\\(.*(con|cfg|ipsec-profile|ca-trustpoint|gkm-local-server)\\S*\\)#\\s?$', '^.*--\\s?[Mm]ore\\s?--.*$']
buffer:"config term\r\nconfig term\r\n ^\r\n% Invalid input detected at '^' marker.\r\n\r\nR115#"
unicon.core.errors.SubCommandFailure: (StateMachineError('Failed while bringing device to "config" state'), "config term\r\nconfig term\r\n ^\r\n% Invalid input detected at '^' marker.\r\n\r\nR115#")When the connect() command is executed, the following commands are executed
config term device(config)#no logging console device(config)#line console device(config)#exec-timeout 0 device(config)#terminal width 511 device(config)#end device#
Is there any way, to bypass these commands? (entering config state mode)
Thank you.
Solved! Go to Solution.
02-22-2021 04:51 AM
Thanks to Antoine Orsoni
The connection below solves the problem
device.connect(init_exec_commands=[],
init_config_commands=[],
log_stdout=False)02-22-2021 03:53 AM
@JanKrupa45054 if you do not get the reply here, head over to the pyATS Webex room here --> https://eurl.io/#r18UzrQVr
You can email our external customer mailer at pyats-support-ext@cisco.com. The development team is in EST time zone,
and will usually respond within a day - we will provide best-effort support for your question.
02-22-2021 04:51 AM
Thanks to Antoine Orsoni
The connection below solves the problem
device.connect(init_exec_commands=[],
init_config_commands=[],
log_stdout=False)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