试图从无线控制器中提取数据。 命令是show ap auto rf 频段可以是802.11a 802.11b或802.11-abgn ap名称是任意的
样本输出:
(Cisco控制器)>;显示ap auto rf 802.11-abgn走廊38
Number Of Slots.................................. 2
AP Name.......................................... Hallway38
MAC Address...................................... a0:e0:af:33:d0:bc
Slot ID........................................ 0
Radio Type..................................... RADIO_TYPE_80211abgn
Current TX/RX Band............................. 80211 2.4G band
Sub-band Type.................................. All
Noise Information
Noise Profile................................ PASSED
Channel 1.................................... -90 dBm
Channel 2.................................... -77 dBm
Channel 3.................................... -88 dBm
Channel 4.................................... -93 dBm
Channel 5.................................... -91 dBm
Channel 6.................................... -88 dBm
Channel 7.................................... -93 dBm
错误输出: 文件“./wlc auto-射频功率,第34行,在 子.sendline('show ap auto rf'['radio']['apname']) TypeError:字符串索引必须是整数,而不是str
感谢您的帮助。你知道吗
here is the script:
!/usr/bin/python
#
# requires python pexpect module
#
import pexpect
import sys
firstarg=sys.argv[0]
address=sys.argv[1]
username=sys.argv[2]
password=sys.argv[3]
radio=sys.argv[4]
apname=sys.argv[5]
output=sys.argv[6]
child = pexpect.spawn ('ssh' , [address])
child.expect ('User:')
child.sendline (username)
child.expect ('Password:')
child.sendline (password)
child.expect ("Controller")
child.sendline ('config paging disable')
#
child.expect ("Controller")
child.sendline ('show ap auto-rf' ['radio']['apname'])
child.logfile = open(output , "w")
child.expect ("Controller")
child.sendline ('logout')
child.expect('(y/N)')
child.sendline ('N')
child.expect(pexpect.EOF)
我可以通过字符串连接将变量添加到一个字符串中来修复它 子.sendline('show ap auto rf'+收音机+''''''''+电话名)
相关问题 更多 >
编程相关推荐