def test_013_edit_ssid_name(self): u"""修改group2的ssid名称,避免客户端数量被干扰""" log.debug('013') #选择进入group1网络组 tmp1 = NetworkListBusiness(self.s) tmp1.goin_network("group2") #修改ssid tmp = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict = { 'membership_macs': "%s" % (data_ap['7600lr_mac'].upper()), 'ssid_ssid': data_wireless['grou1_all_ssid'] + "3" } tmp.edit_ssid(data_ap['7600lr_mac'], 'GWN-Cloud', encry_dict, data_dict) time.sleep(60) #AP 上传流量统计的准确性 tmp2 = APSBusiness(self.s) tmp2.run_AP_download_back(data_wireless['grou1_all_ssid'] + "3", data_wireless['short_wpa'], data_basic['wlan_pc'], data_basic['lan_pc']) time.sleep(360) #等待5分钟 result = tmp.connect_DHCP_WPA_AP(data_wireless['grou1_all_ssid'] + "3", data_wireless['short_wpa'], data_basic['wlan_pc']) tmp.dhcp_release_wlan_backup(data_basic['wlan_pc']) self.assertIn(data_wireless['grou1_all_ssid'] + "3", result)
def test_009_default_client_connect_iperf_ap(self): u"""修改default下面ssid0频段为5G,使用无线client连接""" log.debug("009") #修改ssid tmp = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict = { 'membership_macs': "%s" % (data_ap['7610_mac'].upper()), 'ssid_ssid': data_wireless['all_ssid'], 'ssid_ssid_band': "5", } tmp.edit_ssid(data_ap['7610_mac'], data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(60) #AP 上传流量统计的准确性 tmp2 = APSBusiness(self.s) tmp2.run_AP_download_back(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc'], data_basic['lan_pc']) time.sleep(360) #等待5分钟 result = tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) tmp.dhcp_release_wlan_backup(data_basic['wlan_pc']) self.assertIn(data_wireless['all_ssid'], result)
def test_012_check_change_network_client_count(self): u"""修改group1下面ssid,使用无线client连接,并打流""" log.debug("012") #选择进入group1网络组 tmp1 = NetworkListBusiness(self.s) tmp1.goin_network("group1") #修改ssid tmp = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict = { 'membership_macs': "%s" % (data_ap['7600_mac'].upper()), 'ssid_ssid': data_wireless['grou1_all_ssid'] } tmp.edit_ssid(data_ap['7600_mac'], 'GWN-Cloud', encry_dict, data_dict) time.sleep(60) #AP 上传流量统计的准确性 tmp2 = APSBusiness(self.s) tmp2.run_AP_download_back(data_wireless['grou1_all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc'], data_basic['lan_pc']) #等待5分钟 result = tmp.connect_DHCP_WPA_AP(data_wireless['grou1_all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) time.sleep(360) tmp.dhcp_release_wlan_backup(data_basic['wlan_pc']) self.assertIn(data_wireless['grou1_all_ssid'], result)
def test_024_modify_ssid(self): u"""更改client所在的ssid名称后显示(testlinkID:1452)""" log.debug("024") #修改ssid2的ssid tmp1 = SSIDSBusiness(self.s) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid': data_wireless['all_ssid']+"-3"} tmp1.edit_ssid(data_ap['7600_mac'], data_wireless['all_ssid']+"-2", encry_dict, data_dict) time.sleep(120) tmp = Clients_Business(self.s) tmp.connect_WPA_AP(data_wireless['all_ssid']+"-3", data_wireless['short_wpa'], data_basic["wlan_pc"]) time.sleep(120) # tmp.dhcp_release_wlan(data_basic["wlan_pc"]) #客户端-状态,获取第一个客户端的信息 # #使用用户名密码,带着cookie登录cloud,并返回响应数据 # tmp.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) client_info = tmp.get_first_client_info() AP_ssid = client_info['ssid'] #删除ssid2 tmp1.delete_ssid(data_wireless['all_ssid']+"-3") self.assertEqual(AP_ssid, data_wireless['all_ssid']+"-3")
def test_002_clients_count(self): u"""用户数量统计(testlinkID:1380,1381)""" log.debug("002") #修改ssid tmp1 = SSIDSBusiness(self.s) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid': data_wireless['all_ssid'], 'removed_macs': "%s,%s"%(data_ap['7600_mac'].upper(), data_ap['7600lr_mac'].upper())} tmp1.edit_ssid(data_ap['7610_mac'], 'GWN-Cloud', encry_dict, data_dict) time.sleep(120) tmp = Clients_Business(self.s) #无线网卡连接ap tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic["wlan_pc"]) #使用无线网卡ping internet 1分钟 tmp.set_wlan_ping_internet_1min(data_basic['lan_pc']) #等待10分钟ap上传数据到cloud time.sleep(600) tmp.dhcp_release_wlan(data_basic["wlan_pc"]) client_count = tmp.get_current_5mins_clients_count("1d") self.assertEqual(client_count, 1)
def test_013_client_upload(self): u"""实时客户端upload流量统计(testlinkID:1412)""" log.debug("013") #修改ssid改为7610 tmp1 = SSIDSBusiness(self.s) #修改为5G encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid_band': "5", 'removed_macs': "%s,%s"%(data_ap['7600_mac'].upper(), data_ap['7600lr_mac'].upper())} tmp1.edit_ssid(data_ap['7610_mac'], data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(120) #AP 下载流量-10M tmp2 = APSBusiness(self.s) tmp2.run_AP_upload(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc'], data_basic['lan_pc']) #等待6分钟 time.sleep(360) tmp = Clients_Business(self.s) #客户端-状态,获取第一个客户端的信息 client_info = tmp.get_first_client_info() client_up = client_info['txBytes'] #上传流量大于5M self.assertGreaterEqual(client_up, (5*1024*1024))
def test_075_reset_cloud(self): u"""删除ap,并恢复cloud的初始环境""" log.debug("075") #删除ssid2 tmp1 = SSIDSBusiness(self.s) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) tmp1.disconnect_ap() tmp1.delete_ssid(data_wireless['all_ssid'] + "-2") time.sleep(120) #测试完后恢复初始环境 #1.修改ap的ssid为GWN-Cloud encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict = {'ssid_ssid': "GWN-Cloud", 'ssid_ssid_band': ""} tmp1.edit_ssid("", data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(120) #删除多有access list tmp2 = AccessListBusiness(self.s) tmp2.delete_list("Access list1") tmp2.delete_list("Access list2") tmp2.delete_list("Access list3") time.sleep(120) #删除三个ap tmp = APSBusiness(self.s) tmp.delete_ap(data_ap['7610_mac']) tmp.delete_ap(data_ap['7600_mac']) tmp.delete_ap(data_ap['7600lr_mac']) time.sleep(360)
def test_006_chart_ssid_bandwidth_2h(self): u"""检查2 hour的bandwidth usage统计数据是否正确(testlinkID:1401)""" log.debug("006") #修改ssid为5G tmp1 = SSIDSBusiness(self.s) #修改为5G encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid_band': "5"} tmp1.edit_ssid(data_ap['7610_mac'], data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(120) #AP 下载流量-10M tmp2 = APSBusiness(self.s) tmp2.run_AP_download(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc'], data_basic['lan_pc']) #等待6分钟 time.sleep(360) tmp = Clients_Business(self.s) ssid_bw = tmp.check_chart_ssid_bandwidth("2h") self.assertTrue(ssid_bw)
def test_010_client_mac(self): u"""验证客户端mac信息正确(testlinkID:1408)""" log.debug("010") #修改ssid改为7600 tmp1 = SSIDSBusiness(self.s) #修改为5G encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid_band': "5", 'removed_macs': "%s,%s"%(data_ap['7610_mac'].upper(), data_ap['7600lr_mac'].upper())} tmp1.edit_ssid(data_ap['7600_mac'], data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(120) tmp = Clients_Business(self.s) tmp.connect_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic["wlan_pc"]) time.sleep(120) # tmp.dhcp_release_wlan(data_basic["wlan_pc"]) # #使用用户名密码,带着cookie登录cloud,并返回响应数据 # tmp.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) #客户端-状态,获取第一个客户端的信息 client_info = tmp.get_first_client_info() client_mac = client_info['clientId'] wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']).upper() self.assertEqual(client_mac, wlan_mac)
def test_057_reset_cloud(self): u"""删除ap,并恢复cloud的初始环境""" log.debug("057") #测试完后恢复初始环境 #1.修改ap的ssid为GWN-Cloud tmp1 = SSIDSBusiness(self.s) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) tmp1.disconnect_ap() encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict = {'ssid_ssid': "GWN-Cloud", 'ssid_ssid_band': ""} tmp1.edit_ssid("", data_wireless['all_ssid'], encry_dict, data_dict) time.sleep(120) #删除三个ap tmp = APSBusiness(self.s) tmp1 = NetworkListBusiness(self.s) tmp.delete_ap(data_ap['7610_mac']) tmp1.goin_network('group1') tmp.delete_ap(data_ap['7600_mac']) tmp1.goin_network('group2') tmp.delete_ap(data_ap['7600lr_mac']) tmp1.delete_network('group1') tmp1.delete_network('group2') time.sleep(360)
def check_manyaccesslist_blacklist(self, client_mac, ap_mac, wifi_ssid, wifi_pwd, host, user, ssh_pwd): tmp = AccessListBusiness(self.s) #已有一个Access list1,先编辑 macs = [] macs2 = [] macs3 = [] macs.append(client_mac) tmp.edit_list("Access list1", macs) time.sleep(60) #然后再添加两个list random_mac2 = tmp.randomMAC() macs2.append(random_mac2) random_mac3 = tmp.randomMAC() macs3.append(random_mac3) tmp.add_list("Access list2", macs2) time.sleep(60) tmp.add_list("Access list3", macs3) time.sleep(60) #获取Access list的id list_info = tmp.get_list_info("Access list1") id1 = list_info['id'] list_info = tmp.get_list_info("Access list2") id2 = list_info['id'] list_info = tmp.get_list_info("Access list3") id3 = list_info['id'] #然后在修改ssid1为黑名单 tmp1 = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': wifi_pwd } data_dict = { 'ssid_mac_filtering': "2", 'ssid_maclist_black': ["%s" % id1, "%s" % id2, "%s" % id3] } tmp1.edit_ssid(ap_mac, wifi_ssid, encry_dict, data_dict) time.sleep(120) result1 = tmp.check_Blacklist_cli(host, user, ssh_pwd, client_mac) result2 = tmp.check_Blacklist_cli(host, user, ssh_pwd, random_mac2) result3 = tmp.check_Blacklist_cli(host, user, ssh_pwd, random_mac3) return result1, result2, result3
def test_015_reset_cloud(self): u"""恢复cloud的初始环境""" log.debug("015") #测试完后恢复初始环境 #1.修改ap的ssid为GWN-Cloud tmp1 = SSIDSBusiness(self.s) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) tmp1.disconnect_ap() #使用用户名密码,带着cookie登录cloud,并返回响应数据 tmp1.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid': "GWN-Cloud", 'ssid_ssid_band': ""} tmp1.edit_ssid("", data_wireless['all_ssid']+"NW", encry_dict, data_dict) time.sleep(120)
def test_002_Platform_Administrator_edit_ssid(self): u"""平台管理员-修改ssid""" log.debug("002") #修改ssid tmp = SSIDSBusiness(self.s) #使用测试用户登录 tmp.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd']) time.sleep(180) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid': data_wireless['all_ssid']} tmp.edit_ssid(data_ap['7610_mac'], 'GWN-Cloud', encry_dict, data_dict) time.sleep(120) #获取修改后的ssid ssid = tmp.get_ssid_info(data_wireless['all_ssid'])['ssid'] self.assertEqual(ssid, data_wireless['all_ssid'])
def test_003_client_connect_newNetwork_ap(self): u"""无线连接该ap""" log.debug("003") tmp = NetworkListBusiness(self.s) #选择进入group1网络组 tmp.goin_network("group1") #修改新网络组的ssid tmp1 = SSIDSBusiness(self.s) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid': data_wireless['all_ssid']+"-group1" } tmp1.edit_ssid(data_ap['7610_mac'], 'GWN-Cloud', encry_dict, data_dict) time.sleep(120) #无线网卡连接ap result = tmp.connect_WPA_AP(data_wireless['all_ssid']+"-group1", data_wireless['short_wpa'], data_basic["wlan_pc"]) self.assertIn(data_wireless['all_ssid'], result)
def test_019_client_radio_5g(self): u"""radio信息核对-2.4G(testlinkID:1417-2)""" log.debug("019") #修改ssid2为5g tmp2 = SSIDSBusiness(self.s) encry_dict = {'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa']} data_dict = {'ssid_ssid_band': "5"} tmp2.edit_ssid(data_ap['7600_mac'], data_wireless['all_ssid']+"-2", encry_dict, data_dict) time.sleep(120) tmp = Clients_Business(self.s) tmp.connect_WPA_AP(data_wireless['all_ssid']+"-2", data_wireless['short_wpa'], data_basic["wlan_pc"]) time.sleep(120) # tmp.dhcp_release_wlan(data_basic["wlan_pc"]) #客户端-状态,获取第一个客户端的信息 # #使用用户名密码,带着cookie登录cloud,并返回响应数据 # tmp.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd']) client_info = tmp.get_first_client_info() channelClass = client_info['channelClass'] self.assertEqual(channelClass, 5)
def test_004_check_connection_time_d_function(self): u"""Connection Time单位选择d功能测试(Enabled勾选)(testlink_ID:1501)""" log.debug("004") tmp = TimePolicyBusiness(self.s) # #断开无线网卡的连接 # tmp.disconnect_ap() # #释放被禁的客户端 # client_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) # tmp.release_restrict_mac(client_mac) # time.sleep(60) #新增策略time policy3,连接时间1d,重置时间每周周一的23点 data_dict = { 'status': 1, 'reconnectType': 2, 'resetDay': 1, 'resetHour': "23", 'hour': "24", 'resetTimeType': "AM", 'timezone': "Etc/GMT", 'connectionTimeMap': { 'd': "1", 'h': "0", 'm': "0" }, 'connectionTimeoutMap': { 'd': "", 'h': "", 'm': "" } } tmp.add_timepolicy("time policy3", data_dict) #获取时间策略的id timepolicy_id = tmp.get_timepolicy_id("time policy3") #修改ssid1的ssid,并开启时间策略,并选择time policy3 tmp1 = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict1 = {'ssid_timed_client_policy': "%s" % timepolicy_id} tmp1.edit_ssid(data_ap['7600_mac'], data_wireless['all_ssid'], encry_dict, data_dict1) time.sleep(120) #先修改ap的系统时间为2018-08-08 10:00:00 tmp2 = SettingsBusiness(self.s) ssh_pwd = tmp2.get_ssh_pwd() ssh = SSH(data_basic['7600_ip'], ssh_pwd) ssh.ssh_cmd(data_basic['sshUser'], "date 201808081000") #无线网卡连接 tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #再修改ap的系统时间为2018-08-09 10:00:00 ssh.ssh_cmd(data_basic['sshUser'], "date 201808091000") #等待3分钟 time.sleep(180) #判断AP是否依然连接 result = subprocess.check_output("iw dev %s link" % data_basic['wlan_pc'], shell=True) print result #释放无线网卡的ip tmp.dhcp_release_wlan(data_basic['wlan_pc']) #断开无线网卡的连接 tmp.disconnect_ap() #释放被禁的客户端 client_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) tmp.release_restrict_mac(client_mac) time.sleep(60) self.assertIn("Not connected.", result)
def test_002_check_connection_m_time_function(self): u"""Connection Time单位选择m(分钟)功能测试(Enable勾选)(testlink_ID:1589)""" log.debug("002") #新建一个策略time policy1,连接时间2分钟,重置时间每天23点 tmp = TimePolicyBusiness(self.s) #断开无线网卡的连接 tmp.disconnect_ap() data_dict = { 'status': 1, 'reconnectType': 1, 'resetDay': 1, 'resetHour': "23", 'hour': "24", 'resetTimeType': "AM", 'timezone': "Etc/GMT", 'connectionTimeMap': { 'd': "0", 'h': "0", 'm': "2" }, 'connectionTimeoutMap': { 'd': "", 'h': "", 'm': "" } } tmp.add_timepolicy("time policy1", data_dict) #获取时间策略的id timepolicy_id = tmp.get_timepolicy_id("time policy1") #修改ssid1的ssid,并开启时间策略,并选择time policy1 tmp1 = SSIDSBusiness(self.s) encry_dict = { 'ssid_encryption': "3", 'ssid_wpa_encryption': "0", 'ssid_wpa_key_mode': "0", 'ssid_wpa_key': data_wireless['short_wpa'] } data_dict1 = { 'ssid_ssid': data_wireless['all_ssid'], 'ssid_timed_client_policy': "%s" % timepolicy_id, 'removed_macs': "%s,%s" % (data_ap['7610_mac'].upper(), data_ap['7600lr_mac'].upper()) } tmp1.edit_ssid(data_ap['7600_mac'], 'GWN-Cloud', encry_dict, data_dict1) time.sleep(120) #先修改ap的系统时间为01:00:00 tmp2 = SettingsBusiness(self.s) ssh_pwd = tmp2.get_ssh_pwd() ssh = SSH(data_basic['7600_ip'], ssh_pwd) ssh.ssh_cmd(data_basic['sshUser'], "date -s 01:00:00") #无线网卡连接 tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #等待3分钟 time.sleep(240) #判断AP是否依然连接 result = subprocess.check_output("iw dev %s link" % data_basic['wlan_pc'], shell=True) print result tmp1.dhcp_release_wlan(data_basic['wlan_pc']) #断开无线网卡的连接 tmp.disconnect_ap() #释放被禁的客户端 client_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) tmp.release_restrict_mac(client_mac) time.sleep(60) self.assertIn("Not connected.", result)