mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-18 11:04:51 +00:00
updates to for 9800 series
This commit is contained in:
@@ -95,7 +95,9 @@ def main():
|
|||||||
choices=["a", "b", "abgn"])
|
choices=["a", "b", "abgn"])
|
||||||
parser.add_argument("--action", type=str, help="perform action",
|
parser.add_argument("--action", type=str, help="perform action",
|
||||||
choices=["config", "country", "ap_country", "enable", "disable", "summary", "advanced",
|
choices=["config", "country", "ap_country", "enable", "disable", "summary", "advanced",
|
||||||
"cmd", "txPower", "bandwidth", "manual", "auto", "open_wlan","no_open_wlan","show_wlan_summary","ap_channel", "channel", "show", "wlan", "enable_wlan", "delete_wlan", "wlan_qos" ])
|
"cmd", "txPower", "bandwidth", "manual", "auto", "open_wlan","no_open_wlan","show_wlan_summary",
|
||||||
|
"ap_channel", "channel", "show", "wlan", "enable_wlan", "delete_wlan", "wlan_qos",
|
||||||
|
"disable_network_5ghz","disable_network_24ghz","enable_network_5ghz","enable_network_24ghz" ])
|
||||||
parser.add_argument("--value", type=str, help="set value")
|
parser.add_argument("--value", type=str, help="set value")
|
||||||
|
|
||||||
args = None
|
args = None
|
||||||
@@ -173,7 +175,7 @@ def main():
|
|||||||
if args.series == "9800":
|
if args.series == "9800":
|
||||||
while logged_in_9800 == False and loop_count <= 2:
|
while logged_in_9800 == False and loop_count <= 2:
|
||||||
#egg.sendline(CR)
|
#egg.sendline(CR)
|
||||||
i = egg.expect_exact(["Escape character is '^]'.",">","#","ssword\:",pexpect.TIMEOUT],timeout=2)
|
i = egg.expect_exact(["Escape character is '^]'.",">","#","ser\:","ssword\:",pexpect.TIMEOUT],timeout=2)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
print("9800 found Escape charter is sending carriage return i: {} before: {} after: {}".format(i,egg.before,egg.after))
|
print("9800 found Escape charter is sending carriage return i: {} before: {} after: {}".format(i,egg.before,egg.after))
|
||||||
egg.sendline(CR)
|
egg.sendline(CR)
|
||||||
@@ -254,8 +256,8 @@ def main():
|
|||||||
logged_in_9800 = True
|
logged_in_9800 = True
|
||||||
|
|
||||||
if i == 3:
|
if i == 3:
|
||||||
print("9800 found User will put in args.user {} j: {} before {} after {}".format(args.user,j, egg.before,egg.after))
|
print("9800 found User will put in args.user {} i: {} before {} after {}".format(args.user,i, egg.before,egg.after))
|
||||||
egg.sendline(args.user)
|
#egg.sendline(args.user)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
k = egg.expect(["ssword\:",pexpect.TIMEOUT], timeout=2)
|
k = egg.expect(["ssword\:",pexpect.TIMEOUT], timeout=2)
|
||||||
if k == 0:
|
if k == 0:
|
||||||
@@ -272,7 +274,7 @@ def main():
|
|||||||
print("9800 received timeout after looking for password after sending user k: {} before {} after {}".format(k, egg.before,egg.after))
|
print("9800 received timeout after looking for password after sending user k: {} before {} after {}".format(k, egg.before,egg.after))
|
||||||
|
|
||||||
if i == 4:
|
if i == 4:
|
||||||
print("9800 received password prompt will send password: {} k: {} before {} after {}".format(args.passwd, k, egg.before,egg.after))
|
print("9800 received password prompt will send password: {} i: {} before {} after {}".format(args.passwd, k, egg.before,egg.after))
|
||||||
egg.sendline(args.passwd)
|
egg.sendline(args.passwd)
|
||||||
sleep(1)
|
sleep(1)
|
||||||
l = egg.expect(["#",pexpect.TIMEOUT],timeout=2)
|
l = egg.expect(["#",pexpect.TIMEOUT],timeout=2)
|
||||||
@@ -321,7 +323,7 @@ def main():
|
|||||||
while logged_in_9800 == False and loop_count <= 2:
|
while logged_in_9800 == False and loop_count <= 2:
|
||||||
#egg.sendline(CR)
|
#egg.sendline(CR)
|
||||||
try:
|
try:
|
||||||
i = egg.expect_exact(["Escape character is '^]'.",">","#","ssword\:",pexpect.TIMEOUT],timeout=2)
|
i = egg.expect_exact(["Escape character is '^]'.",">","#","ser\:","ssword\:",pexpect.TIMEOUT],timeout=2)
|
||||||
except pexpect.EOF as e:
|
except pexpect.EOF as e:
|
||||||
print('connection failed. or refused')
|
print('connection failed. or refused')
|
||||||
exit(1)
|
exit(1)
|
||||||
@@ -554,6 +556,22 @@ def main():
|
|||||||
else:
|
else:
|
||||||
command = "ap name %s dot11 24ghz radio role auto"%(args.ap)
|
command = "ap name %s dot11 24ghz radio role auto"%(args.ap)
|
||||||
|
|
||||||
|
if (args.action == "disable_network_5ghz"):
|
||||||
|
if args.series == "9800":
|
||||||
|
command = "ap dot11 5ghz shutdown"
|
||||||
|
|
||||||
|
if (args.action == "disable_network_24ghz"):
|
||||||
|
if args.series == "9800":
|
||||||
|
command = "ap dot11 24ghz shutdown"
|
||||||
|
|
||||||
|
if (args.action == "enable_network_5ghz"):
|
||||||
|
if args.series == "9800":
|
||||||
|
command = "no ap dot11 5ghz shutdown"
|
||||||
|
|
||||||
|
if (args.action == "enable_network_24ghz"):
|
||||||
|
if args.series == "9800":
|
||||||
|
command = "no ap dot11 24ghz shutdown"
|
||||||
|
|
||||||
|
|
||||||
if (args.action in ["enable", "disable" ] and (args.ap is None)):
|
if (args.action in ["enable", "disable" ] and (args.ap is None)):
|
||||||
raise Exception("action requires AP name")
|
raise Exception("action requires AP name")
|
||||||
|
|||||||
@@ -452,9 +452,20 @@ def main():
|
|||||||
# Disable AP, apply settings, enable AP
|
# Disable AP, apply settings, enable AP
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "disable","--series",args.series])
|
"--action", "disable","--series",args.series])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
|
||||||
|
if args.series == "9800":
|
||||||
|
# 9800 series need to "Configure radio for manual channel assignment"
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "disable_network_5ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "disable_network_24ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "manual","--series",args.series])
|
||||||
|
|
||||||
|
else:
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11a disable network","--series",args.series])
|
"--action", "cmd", "--value", "config 802.11a disable network","--series",args.series])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11b disable network"])
|
"--action", "cmd", "--value", "config 802.11b disable network"])
|
||||||
|
|
||||||
if (tx != "NA"):
|
if (tx != "NA"):
|
||||||
@@ -469,53 +480,70 @@ def main():
|
|||||||
if (ch != "NA"):
|
if (ch != "NA"):
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "channel", "--value", ch])
|
"--action", "channel", "--value", ch])
|
||||||
# disables transmission for the entier 802.11z network
|
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
# TODO do not know when to configure open wlan
|
||||||
|
if args.series == "9800":
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "open_wlan","--series",args.series])
|
||||||
|
|
||||||
|
# enable transmission for the entier 802.11z network
|
||||||
|
if args.series == "9800":
|
||||||
|
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "enable_network_5ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "enable_network_24ghz","--series",args.series])
|
||||||
|
|
||||||
|
else:
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11a enable network"])
|
"--action", "cmd", "--value", "config 802.11a enable network"])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11b enable network"])
|
"--action", "cmd", "--value", "config 802.11b enable network"])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "enable"])
|
"--action", "enable"])
|
||||||
|
|
||||||
# Wait a bit for AP to come back up
|
# Wait a bit for AP to come back up
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
# TODO figure out equivalent of the advanced command for 9800
|
||||||
advanced = subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
if args.series == "9800":
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
advanced = subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "advanced"], capture_output=True)
|
"--action", "advanced"], capture_output=True)
|
||||||
pss = advanced.stdout.decode('utf-8', 'ignore')
|
pss = advanced.stdout.decode('utf-8', 'ignore')
|
||||||
print(pss)
|
print(pss)
|
||||||
|
|
||||||
searchap = False
|
searchap = False
|
||||||
cc_mac = ""
|
cc_mac = ""
|
||||||
cc_ch = ""
|
cc_ch = ""
|
||||||
cc_bw = ""
|
cc_bw = ""
|
||||||
cc_power = ""
|
cc_power = ""
|
||||||
cc_dbm = ""
|
cc_dbm = ""
|
||||||
for line in pss.splitlines():
|
for line in pss.splitlines():
|
||||||
if (line.startswith("---------")):
|
if (line.startswith("---------")):
|
||||||
searchap = True
|
searchap = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (searchap):
|
if (searchap):
|
||||||
pat = "%s\s+(\S+)\s+\S+\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s+\(\s*(\S+)\s+dBm"%(args.ap)
|
pat = "%s\s+(\S+)\s+\S+\s+\S+\s+\S+\s+(\S+)\s+(\S+)\s+\(\s*(\S+)\s+dBm"%(args.ap)
|
||||||
m = re.search(pat, line)
|
m = re.search(pat, line)
|
||||||
if (m != None):
|
if (m != None):
|
||||||
cc_mac = m.group(1)
|
cc_mac = m.group(1)
|
||||||
cc_ch = m.group(2); # (132,136,140,144)
|
cc_ch = m.group(2); # (132,136,140,144)
|
||||||
cc_power = m.group(3)
|
cc_power = m.group(3)
|
||||||
cc_power = cc_power.replace("/", " of ", 1) # spread-sheets turn 1/8 into a date
|
cc_power = cc_power.replace("/", " of ", 1) # spread-sheets turn 1/8 into a date
|
||||||
cc_dbm = m.group(4)
|
cc_dbm = m.group(4)
|
||||||
|
|
||||||
ch_count = cc_ch.count(",")
|
ch_count = cc_ch.count(",")
|
||||||
cc_bw = 20 * (ch_count + 1)
|
cc_bw = 20 * (ch_count + 1)
|
||||||
break
|
break
|
||||||
|
|
||||||
if (cc_dbm == ""):
|
if (cc_dbm == ""):
|
||||||
# Could not talk to controller?
|
# Could not talk to controller?
|
||||||
err = "ERROR: Could not query dBm from controller, maybe controller died?"
|
err = "ERROR: Could not query dBm from controller, maybe controller died?"
|
||||||
print(err)
|
print(err)
|
||||||
e_tot += err
|
e_tot += err
|
||||||
e_tot += " "
|
e_tot += " "
|
||||||
|
|
||||||
# Up station
|
# Up station
|
||||||
subprocess.run(["./lf_portmod.pl", "--manager", lfmgr, "--card", lfresource, "--port_name", lfstation,
|
subprocess.run(["./lf_portmod.pl", "--manager", lfmgr, "--card", lfresource, "--port_name", lfstation,
|
||||||
@@ -891,9 +919,16 @@ def main():
|
|||||||
# Disable AP, apply settings, enable AP
|
# Disable AP, apply settings, enable AP
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "disable"])
|
"--action", "disable"])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
|
||||||
|
if args.series == "9800":
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "disable_network_5ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "disable_network_24ghz","--series",args.series])
|
||||||
|
else:
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11a disable network"])
|
"--action", "cmd", "--value", "config 802.11a disable network"])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11b disable network"])
|
"--action", "cmd", "--value", "config 802.11b disable network"])
|
||||||
|
|
||||||
if (tx != "NA"):
|
if (tx != "NA"):
|
||||||
@@ -908,11 +943,21 @@ def main():
|
|||||||
if (ch != "NA"):
|
if (ch != "NA"):
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "channel", "--value", "36"])
|
"--action", "channel", "--value", "36"])
|
||||||
|
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
if args.series == "9800":
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "enable_network_5ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "enable_network_24ghz","--series",args.series])
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
|
"--action", "auto","--series",args.series])
|
||||||
|
|
||||||
|
else:
|
||||||
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11a enable network"])
|
"--action", "cmd", "--value", "config 802.11a enable network"])
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "cmd", "--value", "config 802.11b enable network"])
|
"--action", "cmd", "--value", "config 802.11b enable network"])
|
||||||
|
|
||||||
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
subprocess.run(["./cisco_wifi_ctl.py", "--scheme", scheme, "-d", args.dest, "-u", args.user, "-p", args.passwd, "-a", args.ap, "--band", band,
|
||||||
"--action", "enable"])
|
"--action", "enable"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user