【发布时间】:2015-09-28 05:35:57
【问题描述】:
我已经实现了一个 python 程序来将数据发送到瞻博网络 wlc100 控制器。我必须使用预先编写的瞻博网络 wlc 文件将数据发送到控制器。错误是缺少“主机”参数。我认为我们不需要将主机参数与我通过查看程序已经传递的 3 个参数一起发送。查看jnpr.wlc代码的github页面是https://github.com/Juniper/py-jnpr-wlc。请花点时间帮助我。谢谢。
我得到的错误是:
from jnpr.wlc import WirelessLanController as WLC
import sys
import urllib2
def WLC_login():
login = {
'user': 'xxxxx',
'hostname': '172.31.99.14',
'password': 'xxxxx',
}
wlc = WLC( login )
try_again = 3
login_ok = False
while try_again > 1:
try:
wlc.open()
login_ok = True
print("Login successful")
break;
except:
try_again-=1
print "Unexpected error:", sys.exc_info()[0]
if not login_ok:
sys.exit(1)
return wlc
WLC_login()
跟踪转储是:
Traceback (most recent call last):
File "C:/Python27/py-jnpr-wlc-master/new.py", line 27, in <module>
WLC_login()
File "C:/Python27/py-jnpr-wlc-master/new.py", line 11, in WLC_login
wlc = WLC( login )
File "C:\Python27\lib\site-packages\jnpr_wlc-0.0.1-py2.7.egg\jnpr\wlc\wlc.py", line 160, in __init__
assert (_a in kvargs), ("Missing required param: %s" % _a)
AssertionError: Missing required param: host
【问题讨论】:
-
您不应该在“登录”字典中使用“主机”而不是“主机名”吗?我对瞻博网络一无所知,但快速阅读了文档..我认为可能是这样..在您发布的 git hub 链接上我看到了这个..“wlc = WLC(user='jeremy', host=' 192.168.56.191', 密码='logmein')"
标签: python host juniper-network-connect