cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
244
Views
0
Helpful
14
Replies
Highlighted
Beginner

unicon.core.errors.UniconAuthenticationError: Too many password retries

Hi, I am trying my hands on pyats. So I have set up a basic script wherein I've a testbed file having device details in it. so when I am trying to connect to the device, it is giving me following error:

Password:
Password:
Password:
root@10.121.12.36's password: Traceback (most recent call last):
  File "src/unicon/statemachine/statemachine.py", line 701, in unicon.statemachine.statemachine.StateMachine.go_to
  File "src/unicon/statemachine/statetransition.py", line 479, in unicon.statemachine.statetransition.AnyStateTransition.do_transitions
  File "src/unicon/eal/dialogs.py", line 419, in unicon.eal.dialogs.Dialog.process
  File "src/unicon/eal/dialog_processor.py", line 285, in unicon.eal.dialog_processor.SimpleDialogProcessor.process
  File "src/unicon/eal/dialog_processor.py", line 224, in unicon.eal.dialog_processor.SimpleDialogProcessor.expect_eval_statements
  File "/usr/local/lib/python3.6/dist-packages/unicon/plugins/generic/statements.py", line 144, in password_handler
    raise UniconAuthenticationError('Too many password retries')
unicon.core.errors.UniconAuthenticationError: Too many password retries

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/unicon/bases/connection.py", line 532, in unicon.bases.connection.Connection.connect
  File "src/unicon/bases/routers/connection_provider.py", line 146, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.connect
  File "src/unicon/bases/routers/connection_provider.py", line 169, in unicon.bases.routers.connection_provider.BaseSingleRpConnectionProvider.establish_connection
  File "src/unicon/statemachine/statemachine.py", line 704, in unicon.statemachine.statemachine.StateMachine.go_to
unicon.core.errors.StateMachineError: Failed while bringing device to "any" state

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "src/pyats/connections/manager.py", line 305, in pyats.connections.manager.ConnectionManager.connect
  File "src/unicon/bases/connection.py", line 538, in unicon.bases.connection.Connection.connect
unicon.core.errors.ConnectionError: failed to connect to nexus_device

device details are correct, as I am able to login via netmiko library.

 

Please help!!

Everyone's tags (2)
14 REPLIES 14
Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Hi 

What device you are running this against?

As you can see its failing with too many password retires. I suggest you double-check the credentials in the testbed file.

You can validate the testbed file with - pyats validate testbed <testbed_file.yml>

Can you share the testbed file (remove sensitive info) and how you are executing the pyats command?

Thanks

Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Hi,

I tested my testbed file. It results following:

Testbed Name:
    our-testbed-file

Testbed Devices:
.
`-- nexus_device [switch/cisco_nxos]

Warning Messages
----------------
 - Device 'nexus_device' missing 'platform' definition
 - Device 'nexus_device' has no interface definitions

YAML Lint Messages
------------------

Below is the yaml file. I have a nexus device.

 

# a simpe testbed yaml containing a single device

devices:                # all device definition goes under devices block
  nexus_device:           # start a device definition with its HOSTNAME
    type: switch
    os: cisco_nxos
    credentials:
      default:
        username: ****
        password: ****
    connections:        # give the block on how to connect to its mgmt interface
      mgmt:
        protocol: ssh
        ip: ****

 

For execution, I am following this link:

https://developer.cisco.com/docs/pyats/#!connection-to-devices/device-connections

 

 

Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

you can ignore warning messages in pyats validation.

is there any error message or debug output you can share?

does the device prompt shows hostname as - nexus_device - as in your testbed file?

try like this - 

  nexus_device:
    os: nxos
    type: nxos
    credentials: 
      default:
        username: "admin"
        password: "xxx"
        enable: "xxx"
    connections:
      defaults:
        class: unicon.Unicon
      ssh:
        protocol: ssh
        ip: "xxx"
Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

There is no error message, only warnings.
I am not sure what you mean by "shows hostname"question but when I run following command set, it returns output:
pyats shell --testbed-file our-testbed-file.yaml
from pyats.topology import loader
testbed = loader.load('our-testbed-file.yaml')
testbed.devices

it returns following output:
TopologyDict({'nexus_device': <Device nexus_device at 0x7f874e328ba8>})


Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

if you login to the nexus box from putty or cli .. after successful you get the device prompt that shows the hostname of the device. 

R1#
or 
nexus_device#

try to match the hostname configured on the device to the hostname in the testbed file. 

 

TopologyDict({'nexus_device': <Device nexus_device at 0x7f874e328ba8>}) 

is expected after you type testbed.devices

 

what happens when you do - 

>>> device = testbed.devices['nexus_device']
>>> device.connect()

 Do you get password error after this? Can you login to the device with the same creds via Putty or shell?

 

Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Yes I get password error just after "device.connect()". I am successfully able to login via putty
Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

I tried your testbed file on devnet sandbox.

after the device.connect() it logs in but the connection hangs..

if I add enable password in the testbed file .. the connection works fine

have you added the enable password on the testbed file? can you plz try?

 

try these creds for sandbox in your testbed file - 

credentials: 
    default:
      username: admin
      password: Admin_1234!
      enable: Admin_1234!

ip: sbx-nxos-mgmt.cisco.com
port: "8181"
Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Can you share testbed file that you've used? Enable didn't work for me
Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

this is a working testbed file .. i have tested with sandbox.

---
testbed:
  name: testbed
  credentials: 
    default:
      username: admin
      password: Admin_1234!
      enable: Admin_1234!

devices:
  sbx-n9kv-ao:   ## match this with hostname on device
    alias: nexus_device   ## you can use alias here if want to call it nexus_device
    type: nxos  
    os: nxos
    connections:
      mgmt:
        protocol: ssh
        ip: sbx-nxos-mgmt.cisco.com
        port: "8181"

Screenshot 2020-04-13 at 14.43.44.png

Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Are you using console/SSH connection in the testbed? Netmiko will be using SSH.

# a simpe testbed yaml containing a single device

devices:                # all device definition goes under devices block
  csr1000v-1:           # start a device definition with its HOSTNAME
    alias: node1
    type: router
    os: iosxe           # this tells the engine what type of OS its connected to
    credentials:
      default:                         # login credentials
        username: admin
        password: Cisco123
    connections:        # give the block on how to connect to its mgmt interface
      mgmt:
        protocol: ssh
        ip: 172.16.1.1
Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Neither this work for me. I think problem is something else.
Highlighted
Rising star
Rising star

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

Do you password error with sandbox as well?

 

Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

I am not using Sandbox but a lab device and when I am logging via putty, it works fine
Highlighted
Beginner

Re: unicon.core.errors.UniconAuthenticationError: Too many password retries

test with sandbox and check pyats version