View Only

How-To: Install Junos PyEZ correctly

By Erdem posted 04-24-2014 19:49



Basic remote connectivity and fact gathering.




from pprint import pprint
from jnpr.junos import Device
dev = Device(host='my_host_or_ipaddr', user='jeremy', password='jeremy123' )
pprint( dev.facts )


Here is the sample output when connecting to an SRX210 device:


>>> pprint(dev.facts)
{'2RE': False, 'RE0': {'last_reboot_reason': '0x20:power-button soft power off', 'model': 'RE-SRX210H', 'status': 'OK', 'up_time': '10 minutes, 3 seconds'}, 'domain':''
'fqdn': '', 'hostname': 'srx210', 'ifd_style': 'CLASSIC', 'model': 'SRX210H','personality': 'SRX_BRANCH', 'serialnumber': 'AD2909AA0096', 'switch_style': 'VLAN', 'version': '12.1X44-D10.4', 'version_info': junos.versino_info(major=(12, 1), type=X, minor=(44, 'D', 10), build=4)}




1 view



08-05-2015 08:35

ktorkmen says:
Hi Jeremy,
I am trying to issue rpc commands through the execute method of Device. I was expecting that the method would return an xml however it is returning a Boolean (which I suppose has the value True if the rpc is correct). Is this an expected behavior?
Posted 08:35, 25 Mar 2015

03-30-2015 02:24

ktorkmen says:
Thanks Rick
Posted 02:24, 30 Mar 2015

03-25-2015 09:36

rsherman says:
Hi Karim,

You should be using the RPC on demand feature of PyEZ. Execute is a lower level API and requires the command be built out as an XML object.

If you need further assistance, please reach out to our Google Group!forum/junos-python-ez

Posted 09:36, 25 Mar 2015

04-25-2014 19:53 says:

Please let me know what is causing the following issues:

a) 'match' option is cli command is not honoured.
Example: show configuration interface | display set | match vlan ; display all interfaces not the vlans onlt

b) certain randomness in netconf session established
Example; I run a script that scans a list of ex4200 sequentially. Detconf session establishment is not consistent - sometimes it works and sometimes it does not. Wonder if there is a netconf session establishment timer limit.
Posted 12:10, 25 Apr 2014