[英]RPC Error when using jnpr.junos.utils.config Load command
still rather new to Python. 对Python来说还是很新的。 I've been referencing a few blogs regarding the jnpr.junos packages.
我一直在参考有关jnpr.junos软件包的一些博客。 Specifically from Jeremy Schulman ( http://forums.juniper.net/t5/Automation/Python-for-Non-Programmers-Part-2/bc-p/277682 ).
特别是来自Jeremy Schulman( http://forums.juniper.net/t5/Automation/Python-for-Non-Programmers-Part-2/bc-p/277682 )。 I'm simply trying to make sure I have the commands right.
我只是想确保我的命令正确。 I'm just attempting to pass simple commands to my SRX cluster.
我只是试图将简单的命令传递给我的SRX群集。 I'm attempting to pass the following to an SRX650 cluster.
我正在尝试将以下内容传递给SRX650群集。
>>> from jnpr.junos.utils.config import Config
>>> from jnpr.junos import Device
>>> dev = Device(host='devip',user='myuser',password='mypwd')
>>> dev.open()
Device(devip)
>>> cu = Config(dev)
>>> cu
jnpr.junos.utils.Config(devip)
>>> set_cmd = 'set system login message "Hello Admin!"'
>>> cu.load(set_cmd,format='set')
Warning (from warnings module):
File "C:\Python27\lib\site-packages\junos_eznc-1.0.0- py2.7.egg\jnpr\junos\utils\config.py", line 273
if any([e.find('[error-severity="error"]') for e in rerrs]):
FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
cu.load(set_cmd,format='set')
File "C:\Python27\lib\site-packages\junos_eznc-1.0.0- py2.7.egg\jnpr\junos\utils\config.py", line 296, in load
return try_load(rpc_contents, rpc_xattrs)
File "C:\Python27\lib\site-packages\junos_eznc-1.0.0-py2.7.egg\jnpr\junos\utils\config.py", line 274, in try_load
raise err
RpcError
I've done quite a bit of searching and can't seem to find anything as to why this RPC error is popping up. 我已经做了大量的搜索工作,但是似乎找不到关于为何弹出此RPC错误的任何信息。 I've confirmed that the syntax is correct and read through the jnpr.junos documentation for Junos EZ.
我已经确认语法正确,并已阅读Junos EZ的jnpr.junos文档。
Found that I was using an outdated version of junos.eznc. 发现我正在使用junos.eznc的过时版本。 Running
pip install -U junos-eznc
updated me to junos.eznc 1.3.1. 运行
pip install -U junos-eznc
将我更新为junos.eznc 1.3.1。 After doing this, my script worked properly. 完成此操作后,我的脚本正常运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.