Juniper / py-junos-eznc

Python library for Junos automation
https://www.juniper.net/documentation/en_US/junos-pyez/information-products/pathway-pages/junos-pyez-developer-guide.html
Apache License 2.0
671 stars 344 forks source link

jnpr.junos.exception.ConfigLoadError #499

Closed tanzhixu closed 8 years ago

tanzhixu commented 8 years ago

File "/Users/zhitan/PycharmProjects/JuniperApi/JuniperApi.py", line 57, in main() File "/Users/zhitan/PycharmProjects/JuniperApi/JuniperApi.py", line 53, in main juniperobj.load(config = config) File "/Users/zhitan/PycharmProjects/JuniperApi/JuniperApi.py", line 33, in load cfg.load(path=config, format='set') File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jnpr/junos/utils/config.py", line 397, in load return try_load(rpc_contents, rpc_xattrs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jnpr/junos/utils/config.py", line 348, in try_load raise ConfigLoadError(cmd=err.cmd, rsp=err.rsp, errs=err.errs) jnpr.junos.exception.ConfigLoadError: ConfigLoadError(severity: error, bad_element: None, message: error: internal communications error (tag 'configuration-set') expecting )

vnitinv commented 8 years ago

@tanzhixu Share the content of your config file.

tanzhixu commented 8 years ago

Just one command in config file: set security zones security-zone trust address-book address 10.1.15.79/32 10.1.15.79/32

vnitinv commented 8 years ago

@tanzhixu Share the junos device facts/details.

tanzhixu commented 8 years ago

@vnitinv {'2RE': False, 'HOME': '/cf/var/home/lab', 'RE0': {'last_reboot_reason': '0x200:chassis control reset ', 'model': 'RE-SRX100H', 'status': 'OK', 'up_time': '19 hours, 1 minute, 4 seconds'}, 'domain': None, 'fqdn': 'pytest', 'hostname': 'pytest', 'ifd_style': 'CLASSIC', 'model': 'SRX100h', 'personality': 'SRX_BRANCH', 'serialnumber': 'AU1411AF0046', 'srx_cluster': False, 'switch_style': 'VLAN', 'vc_capable': False, 'version': '10.4R6.5', 'version_info': junos.version_info(major=(10, 4), type=R, minor=6, build=5)}

spidercensus commented 8 years ago

I could not replicate this issue on my SRX100H running 12.1R1.9

>>> dev = Device('10.3.2.1', user='jpack', passwd='password')
>>> dev.open()
Device(10.3.2.1)
>>> config.Config(dev)
jnpr.junos.utils.Config(10.3.2.1)
>>> cc = config.Config(dev)
>>> result = cc.load(cfg_txt, format='set')
>>> result.getchildren()
[<Element ok at 0x7f3d6343be18>]
>>> pp(dev.facts)
{'2RE': False,
 'HOME': '/cf/var/home/jpack',
 'RE0': {'last_reboot_reason': '0x1:power cycle/failure',
         'model': 'RE-SRX100H',
         'status': 'OK',
         'up_time': '13 days, 10 hours, 59 minutes, 1 second'},
 'domain': 'packnet',
 'fqdn': 'PackSRX.packnet',
 'hostname': 'PackSRX',
 'ifd_style': 'CLASSIC',
 'model': 'SRX100H',
 'personality': 'SRX_BRANCH',
 'serialnumber': 'AU3511AF0106',
 'srx_cluster': False,
 'switch_style': 'VLAN',
 'vc_capable': False,
 'version': '12.1R1.9',
 'version_info': junos.version_info(major=(12, 1), type=R, minor=1, build=9)}
vnitinv commented 8 years ago

@tanzhixu I see from the facts "version': '10.4R6.5'" PyEZ is only supported (and is expected to work seamlessly) from 11.4 onwards Junos