mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-04 12:48:00 +00:00
cc_module_9800_3504.py : added creation of wpa2 profile
wifi_ctl_9800_3504.py : added creation of wpa2 profile Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
committed by
shivam
parent
06ce02fec8
commit
702e11e89a
@@ -139,7 +139,7 @@ class create_controller_series_object:
|
||||
"--user", self.user, "--passwd", self.passwd, "--ap", self.ap, "--band", self.band,
|
||||
"--action", self.action, "--value", self.value, "--series", self.series, "--port", self.port, "--prompt", self.prompt]
|
||||
|
||||
elif self.action in ["disable_wlan", "delete_wlan", "enable_wlan", "create_wlan"]:
|
||||
elif self.action in ["disable_wlan", "delete_wlan", "enable_wlan", "create_wlan", "create_wlan_wpa2"]:
|
||||
|
||||
self.command = ["./wifi_ctl_9800_3504.py",
|
||||
"--scheme", self.scheme, "--dest", self.dest,
|
||||
@@ -170,7 +170,8 @@ class create_controller_series_object:
|
||||
logger.critical("action {action} not supported".format(action=self.action))
|
||||
raise ValueError("action {action} not supported".format(action=self.action))
|
||||
|
||||
logger.info(pformat(self.command))
|
||||
# logger.info(pformat(self.command))
|
||||
logger.info(self.command)
|
||||
# capture output needs to be read
|
||||
# advanced = subprocess.run(self.command, capture_output=False, check=True)
|
||||
advanced = subprocess.run(self.command, capture_output=True, check=True)
|
||||
@@ -343,6 +344,13 @@ class create_controller_series_object:
|
||||
summary = self.send_command()
|
||||
return summary
|
||||
|
||||
# configure wpa2 wlan wpa2
|
||||
def config_wlan_wpa2(self):
|
||||
logger.info("config_wlan_wpa2 wlan: Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(wlan=self.wlan, wlanID=self.wlanID, wlanSSID=self.wlanSSID))
|
||||
self.action = "create_wlan_wpa2"
|
||||
summary = self.send_command()
|
||||
return summary
|
||||
|
||||
# config wireless tag policy and policy_profile
|
||||
# this may need to be split up
|
||||
# WCL1 : RM204-TB1 , WLC2 : RM204-TB2
|
||||
@@ -471,10 +479,11 @@ INCLUDE_IN_README
|
||||
# disable
|
||||
cs.show_ap_dot11_5gz_shutdown()
|
||||
# cs.show_ap_dot11_24gz_shutdown() not in txpower
|
||||
# This needs to be here to disable and delete
|
||||
cs.wlan = 'test wpa2'
|
||||
cs.wlanID = '2'
|
||||
cs.wlanSSID = 'hello123'
|
||||
|
||||
cs.wlan = 'open-wlan'
|
||||
cs.wlanID = '1'
|
||||
cs.wlanSSID = 'open-wlan'
|
||||
# disable_wlan
|
||||
cs.wlan_shutdown()
|
||||
# disable_network_5ghz
|
||||
@@ -490,7 +499,7 @@ INCLUDE_IN_README
|
||||
cs.bandwidth = '20'
|
||||
# bandwidth (to set to 20 if channel change does not support)
|
||||
cs.config_dot11_5ghz_channel_width()
|
||||
cs.channel = '100'
|
||||
cs.channel = '36'
|
||||
# channel
|
||||
cs.config_dot11_5ghz_channel()
|
||||
cs.bandwidth = '40'
|
||||
@@ -498,11 +507,37 @@ INCLUDE_IN_README
|
||||
cs.config_dot11_5ghz_channel_width()
|
||||
# show_wlan_summary
|
||||
cs.show_wlan_summary()
|
||||
# delete_wlan (there were two in the logs)
|
||||
|
||||
# delete_wlan
|
||||
# TODO (there were two in tx_power the logs)
|
||||
# need to check if wlan present
|
||||
cs.wlan = 'test wpa2'
|
||||
cs.wlanID = '2'
|
||||
cs.wlanSSID = 'hello123'
|
||||
|
||||
# delete wlan
|
||||
cs.config_no_wlan()
|
||||
# create_wlan
|
||||
cs.config_wlan_open()
|
||||
|
||||
# Create open
|
||||
# cs.wlan = 'open-wlan_3'
|
||||
# cs.wlanID = '3'
|
||||
# cs.wlanSSID = 'open-wlan_3'
|
||||
|
||||
|
||||
# create_wlan open
|
||||
# cs.wlan = 'open-wlan'
|
||||
# cs.wlanID = '1'
|
||||
# cs.wlanSSID = 'open-wlan'
|
||||
|
||||
# cs.config_wlan_open()
|
||||
|
||||
# Create wpa2
|
||||
cs.wlan = 'wpa2_wlan_3'
|
||||
cs.wlanID = '3'
|
||||
cs.wlanSSID = 'wpa2_wlan_3'
|
||||
|
||||
# create_wlan_wpa2
|
||||
cs.config_wlan_wpa2()
|
||||
# wireless_tag_policy
|
||||
cs.tag_policy = 'RM204-TB1'
|
||||
cs.policy_profile = 'default-policy-profile'
|
||||
|
||||
@@ -141,7 +141,7 @@ def main():
|
||||
parser.add_argument("--action", type=str, help="perform action",
|
||||
choices=["config", "debug_disable_all", "no_logging_console", "line_console_0", "country", "ap_country", "enable", "disable", "summary", "advanced",
|
||||
"cmd", "txPower", "bandwidth", "manual", "auto", "no_wlan", "show_wlan_summary",
|
||||
"ap_channel", "auto_rf", "channel", "show", "create_wlan", "enable_wlan", "disable_wlan", "wlan_qos",
|
||||
"ap_channel", "auto_rf", "channel", "show", "create_wlan", "create_wlan_wpa2", "enable_wlan", "disable_wlan", "wlan_qos",
|
||||
"disable_network_5ghz", "disable_network_24ghz", "enable_network_5ghz", "enable_network_24ghz",
|
||||
"wireless_tag_policy", "no_wlan_wireless_tag_policy", "delete_wlan"])
|
||||
parser.add_argument("--value", type=str, help="set value")
|
||||
@@ -1278,6 +1278,51 @@ def main():
|
||||
print("command show wlan summary ")
|
||||
command = "show wlan summary"
|
||||
|
||||
if (args.action == "create_wlan_wpa2" and ((args.wlanID is None) or (args.wlan is None) or (args.wlanSSID is None))):
|
||||
raise Exception("create_wlan_wpa2 wlanID, wlan, wlanSSID are required an")
|
||||
if (args.action == "create_wlan_wpa2"):
|
||||
logg.info("create_wlan_wpa2 wlan {} wlanID {} wlanSSID {}".format(args.wlan, args.wlanID, args.wlanSSID))
|
||||
if args.series == "9800":
|
||||
egg.sendline("config t")
|
||||
sleep(0.4)
|
||||
i = egg.expect_exact(["(config)#", pexpect.TIMEOUT], timeout=timeout)
|
||||
if i == 0:
|
||||
logg.info("elevated to (config)#")
|
||||
# for create wlan <name> <ID> <ssid>
|
||||
command = "wlan {} {} {}".format(args.wlan, args.wlanID, args.wlanSSID)
|
||||
logg.info("wpa2 network command {}".format(command))
|
||||
egg.sendline(command)
|
||||
sleep(0.4)
|
||||
j = egg.expect_exact([CCP_CONFIG_WLAN, pexpect.TIMEOUT], timeout=timeout)
|
||||
if j == 0:
|
||||
# previous commands for command in ["shutdown","no security ft","no security wpa","no security wpa wpa2","no security wpa wpa2 ciphers aes",
|
||||
# "no security wpa akm dot1x","no shutdown"]:
|
||||
|
||||
# 2/12/2022 - Cisco suggestion
|
||||
for command in [
|
||||
"assisted-roaming dual-list",
|
||||
"bss-transition dual-list",
|
||||
"radio policy dot11 24ghz",
|
||||
"radio policy dot11 5ghz",
|
||||
"security wpa psk set-key ascii 0 12345678",
|
||||
"no security wpa akm dot1x",
|
||||
"security wpa akm psk"
|
||||
"no shutdown"]:
|
||||
egg.sendline(command)
|
||||
sleep(1)
|
||||
k = egg.expect_exact([CCP_CONFIG_WLAN, pexpect.TIMEOUT], timeout=timeout)
|
||||
if k == 0:
|
||||
logg.info("command sent: {}".format(command))
|
||||
if k == 1:
|
||||
logg.info("command time out: {}".format(command))
|
||||
if j == 1:
|
||||
logg.info("did not get the (config-wlan)# prompt")
|
||||
if i == 0:
|
||||
logg.info("did not get the (config)# prompt")
|
||||
else:
|
||||
command = "config wlan create {} {} {}".format(args.wlanID, args.wlan, args.wlanSSID)
|
||||
|
||||
|
||||
if (args.action == "create_wlan" and ((args.wlanID is None) or (args.wlan is None) or (args.wlanSSID is None))):
|
||||
raise Exception("wlanID, wlan, wlanSSID are required an")
|
||||
if (args.action == "create_wlan"):
|
||||
@@ -1309,7 +1354,7 @@ def main():
|
||||
"no security wpa wpa2 ciphers aes"
|
||||
"no security dot1x authentication-list",
|
||||
"no security wpa akm dot1x",
|
||||
"no shutdown"]:
|
||||
"no shutdown"]:
|
||||
egg.sendline(command)
|
||||
sleep(1)
|
||||
k = egg.expect_exact([CCP_CONFIG_WLAN, pexpect.TIMEOUT], timeout=timeout)
|
||||
|
||||
Reference in New Issue
Block a user