Junos OS

 View Only

IMPORTANT MODERATION NOTICE

This community is currently under full moderation, meaning  all posts will be reviewed before appearing in the community. Please expect a brief delay—there is no need to post multiple times. If your post is rejected, you'll receive an email outlining the reason(s). We've implemented full moderation to control spam. Thank you for your patience and participation.



  • 1.  PyEz ConnectAuthError

    Posted 08-09-2022 09:46
    This one has me scratching my head....

    Trying to connect to an EX-3400 using PyEz. I've done 'set system services netconf ssh'. I can connect fine using ncclient but PyEz gives me "ConnectAuthError". Here's my code:

    import sys
    from getpass import getpass
    from jnpr.junos import Device
    from jnpr.junos.exception import ConnectError
    
    hostname = input("Device hostname: ")
    junos_username = input("Junos OS username: ")
    junos_password = getpass("Junos OS or SSH key password: ")
    
    dev = Device(host=hostname, user=junos_username, passwd=junos_password)
    
    try:
        dev.open()
    except ConnectError as err:
        print ("Cannot connect to device: {0}".format(err))
        sys.exit(1)
    except Exception as err:
        print (err)
        sys.exit(1)
    
    
    print (dev.facts)
    dev.close()​

    I don't understand how ncclient works but not PyEz since they both use netconf. I've tried using the root user as well as a 'pyez' user that has read-only rights. Any help would be greatly appreciated.



  • 2.  RE: PyEz ConnectAuthError

    Posted 08-10-2022 06:20
    try this format 

    dev=Device(host=Host, user=User, password=Password)

    ------------------------------
    JAWAD HUSSAIN
    ------------------------------