05-19-2019 02:49 AM
Hey,
Im trying to get a handle on pyats and explore what it might be able to do and i have run into an interesting problem straight out of the gate. This one is gonna sound pretty basic but thats where i am at with this sort of thing so here goes.
when running any of the pyats sample scripts using a testbed modified to match my own devices i get the following errors. If i use the ipyats to connect to the devnet testbed from my local machone it works just fine. Im not really sure how to troubleshoot this further so i turn to the DevNet community for suggestions. For the record i can connect via ssh to the device from this device normally.
From playing in the testbed it should move on to configuring an automation friendly terminal, setting term len, width etc but it just hangs here until it times out
Cheers
-----
Error Snippet
-----
In [2]: rr.connect()
[2019-05-19 19:37:51,671] +++ ios1 logfile /tmp/ios1-cli-20190519T193751669.log +++
[2019-05-19 19:37:51,672] +++ Unicon plugin ios +++
[2019-05-19 19:37:51,677] +++ connection to spawn: ssh -l <username> <ip address>, id: 4663560008 +++
[2019-05-19 19:37:51,678] connection to ios1
Password:
Last switch-over Wed Sep 26 23:43:20 2018: 33 weeks, 3 days, 19 hours, 54 minutes ago
RP/0/RSP0/CPU0:<device_hostname>#---------------------------------------------------------------------------
TimeoutError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/statemachine/statemachine.cpython-36m-darwin.so in unicon.statemachine.statemachine.StateMachine.go_to()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/statemachine/statetransition.cpython-36m-darwin.so in unicon.statemachine.statetransition.AnyStateTransition.do_transitions()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/dialogs.cpython-36m-darwin.so in unicon.eal.dialogs.Dialog.process()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/dialog_processor.cpython-36m-darwin.so in unicon.eal.dialog_processor.AlarmBasedDialogProcessor.process()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/dialog_processor.cpython-36m-darwin.so in unicon.eal.dialog_processor.AlarmBasedDialogProcessor.process()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/dialog_processor.cpython-36m-darwin.so in unicon.eal.dialog_processor.AlarmBasedDialogProcessor.expect_eval_statements()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/backend/pty_backend.cpython-36m-darwin.so in unicon.eal.backend.pty_backend.RawSpawn.read_update_buffer()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/backend/pty_backend.cpython-36m-darwin.so in unicon.eal.backend.pty_backend.RawPtySpawn.is_readable()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/backend/pty_backend.cpython-36m-darwin.so in unicon.eal.backend.pty_backend.RawPtySpawn.is_readable()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/eal/dialog_processor.cpython-36m-darwin.so in unicon.eal.dialog_processor.AlarmBasedDialogProcessor.timeout_handler()
TimeoutError: timeout occurred:
timeout value: 60
last_command: '<password>\r'
pattern: ['^.*?% (Bad passwords|Access denied|Authentication failed)', '^.*Login incorrect', '^.*([Uu]sername|[Ll]ogin): ?$', '^.*User Access Verification', '^.*[Pp]assword( for )?(\\S+)?: ?$', '^(.*)Kerberos: No default realm defined for Kerberos!', '^.*(initial|basic) configuration dialog ?\\?? ((\\[yes.*\\])|(\\(yes/no\\))|(\\(yes/no\\) (\\[y\\]))):', 'Would you like to enter basic management setup\\? \\[yes/no\\]:', 'Escape character is .*\\n', '^.*RETURN to get started', 'Are you sure you want to continue connecting \\(yes/no\\)', '^.*(Connection refused|Connection reset by peer|Network is down|closed by remote host)', 'Received disconnect from .*:', 'Hit Enter to proceed:', '^(.*?)Press Ctrl\\+x to Exit the session', '^(.*?)Connected.', '^.*?% (Bad passwords|Access denied|Authentication failed)', '^.*Login incorrect', '^.*([Uu]sername|[Ll]ogin): ?$', '^.*User Access Verification', '^.*[Pp]assword( for )?(\\S+)?: ?$', '^(.*)Kerberos: No default realm defined for Kerberos!', '^.*[Pp]assword( for )?(\\S+)?: ?$', '^.*?% (Bad passwords|Access denied|Authentication failed)', 'rommon[\\s\\d]*>\\s?$', '^(.*?)(Router|Router-stby|Router-sdby|RouterRP|RouterRP-standby|ios1-standby|ios1-sdby|ios1-stby|(S|s)witch|s(S|s)witch\\(standby\\)|Controller|ios|-Slot[0-9]+|ios1)(\\(boot\\))*>\\s?$', '^(.*)\\(.*(con|cfg|ipsec-profile)\\S*\\)#\\s?$', '^(.*?)(Router|Router-stby|Router-sdby|RouterRP|RouterRP-standby|ios1-standby|ios1\\(standby\\)|ios1-sdby|ios1-stby|(S|s)witch|(S|s)witch\\(standby\\)|Controller|ios|-Slot[0-9]+|ios1)(\\(boot\\))*#\\s?$', '^.*--\\s?[Mm]ore\\s?--.*']
buffer:'\r\nLast switch-over Wed Sep 26 23:43:20 2018: 33 weeks, 3 days, 19 hours, 54 minutes ago\r\n\r\nRP/0/RSP0/CPU0:<device_hostname>#'
The above exception was the direct cause of the following exception:
StateMachineError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/bases/connection.cpython-36m-darwin.so in unicon.bases.connection.Connection.connect()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/bases/routers/connection_provider.cpython-36m-darwin.so in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/bases/routers/connection_provider.cpython-36m-darwin.so in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/statemachine/statemachine.cpython-36m-darwin.so in unicon.statemachine.statemachine.StateMachine.go_to()
StateMachineError: Failed while bringing device to "any" state
The above exception was the direct cause of the following exception:
ConnectionError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ipyats/main.py in <module>
----> 1 rr.connect()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyats/connections/manager.cpython-36m-darwin.so in pyats.connections.manager.ConnectionManager.connect()
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/unicon/bases/connection.cpython-36m-darwin.so in unicon.bases.connection.Connection.connect()
ConnectionError: failed to connect to ios1
Solved! Go to Solution.
08-18-2019 11:19 AM
Hey,
Guessing you probably worked it out by now, the device name in your testbed file must be an exact match of the hostname of the device. Unfortunately is not very clear in peoples how-to-guides or the DevNet videos, but is in the unicon documentation.
Thanks
08-18-2019 11:19 AM
Hey,
Guessing you probably worked it out by now, the device name in your testbed file must be an exact match of the hostname of the device. Unfortunately is not very clear in peoples how-to-guides or the DevNet videos, but is in the unicon documentation.
Thanks
08-18-2019 04:12 PM
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