def test_009_check_ssid1(self): u"""新建立的ssid1+有线或无线+用户客户端显示(testlink_ID:496)""" log.debug("009") NG2_ssid = "%s-2" % data_ng["NG2_ssid"] #新建一个SSID tmp = SSIDBusiness(self.driver) tmp.new_ssid(NG2_ssid, data_wireless["short_wpa"]) #将master ap加入所有的ssids tmp1 = APSBusiness(self.driver) tmp1.add_master_to_all_NG() #使用无线网卡能够连接上NG2的ssid,并正常使用 tmp1.connect_WPA_AP(NG2_ssid, data_wireless['short_wpa'], data_basic['wlan_pc']) tmp2 = ClientsBusiness(self.driver) #得到无线客户端的mac mac = tmp2.get_wlan_mac(data_basic['wlan_pc']) client_mac, ssid_name, connecttype, conap = tmp2.check_ssid(mac) print client_mac, ssid_name, connecttype, conap Mac = mac.upper() #得到master ap的mac MasterAP = data_AP['master:mac'].upper() assert (client_mac == Mac) and (ssid_name == NG2_ssid) and \ (connecttype == (u"无线" or "Wireless")) and (conap == MasterAP),\ "Check newssid+wireless+client display,test fail!" print "Check newssid+wireless+client display,test pass!"
def check_STA_unblock_no_need_auth(self, ssid, password, wlan, eth): #无线STA通过group0的认证 tmp = CPBusiness(self.driver) tmp.access_No_auth_portal(ssid, password, wlan, eth, "wpa") #无线网卡释放ip地址 CPControl.dhcp_release_wlan(self, wlan) #断开无线连接 CPControl.disconnect_ap(self) #启用有线网卡 CPControl.wlan_enable(self, eth) #刷新页面重新登录ap页面 Lg = LoginBusiness(self.driver) Lg.refresh_login_ap() #block STA tmp.connect_WPA_AP(ssid, password, wlan) tmp3 = ClientsBusiness(self.driver) wlan_mac = tmp3.get_wlan_mac(wlan) tmp3.block_client(wlan_mac) #unblock STA tmp4 = ClientAccessBusiness(self.driver) #删除Global Blacklist里面的所有的mac tmp4.del_Global_Blacklist_mac() #使用免认证的规则,腾讯首页,判断是否跳转到portal页面 result = tmp.check_jump_to_No_auth_portal(ssid, password, wlan, eth) return result
def test_018_del_client_name(self): u"""删除设置用户名称后,用户再次连接后主机名显示为用户本身名字(testlink_ID:516)""" log.debug("018") tmp = ClientsBusiness(self.driver) wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) #只有一个客户端时,修改客户端名称 tmp.change_client_name(wlan_mac, "") #重启ap tmp1 = UpgradeBusiness(self.driver) tmp1.web_reboot(data_basic['DUT_ip']) tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'],\ data_wireless['short_wpa'],data_basic['wlan_pc']) tmp.dhcp_release_wlan(data_basic['wlan_pc']) self.driver.refresh() self.driver.implicitly_wait(10) #登录AP Lg = LoginBusiness(self.driver) Lg.login(data_basic['superUser'], data_login['all']) #获取第一个客户端的名称 result = tmp.check_client_name(wlan_mac) #取测试平台的name PC_name = subprocess.check_output("hostname", shell=True).strip("\n") print result, PC_name # tmp.dhcp_release_wlan(data_basic['wlan_pc']) assert (result == PC_name) or (result == ""), "del client name,test fail!" print "del client name,test pass!"
def test_008_check_ssid0(self): u"""ssid0+无线+客户端显示(testlink_ID:494)""" log.debug("008") tmp = ClientsBusiness(self.driver) wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) client_mac, ssid_name, connecttype, conap = tmp.check_ssid(wlan_mac) print client_mac, ssid_name, connecttype, conap #得到无线客户端的mac mac = tmp.get_wlan_mac(data_basic['wlan_pc']) Mac = mac.upper() #得到master ap的mac MasterAP = data_AP['master:mac'].upper() assert (client_mac == Mac) and (ssid_name == data_wireless['all_ssid']) and \ (connecttype == (u"无线" or "Wireless")) and (conap == MasterAP),\ "Check ssid0+wireless+client display,test fail!" print "Check ssid0+wireless+client display,test pass!"
def check_portal_client_block_function(self, ssid, password, wlan, eth): #通过免认证方式上网 CPBusiness.\ access_No_auth_portal(self,ssid,password,wlan,eth,"wpa") #无线网卡释放ip地址 CPControl.dhcp_release_wlan(self, wlan) #断开无线连接 CPControl.disconnect_ap(self) #启用有线网卡 CPControl.wlan_enable(self, eth) tmp = ClientsBusiness(self.driver) #使用无线网卡能够连接上ssid,并正常使用 tmp.connect_DHCP_WPA_AP(ssid, password, wlan) #无线网卡释放ip地址 CPControl.dhcp_release_wlan(self, wlan) #刷新页面重新登录ap页面 Lg = LoginBusiness(self.driver) Lg.refresh_login_ap() #只有一个客户端,阻塞该客户端 wlan_mac = tmp.get_wlan_mac(wlan) tmp.block_client(wlan_mac) time.sleep(60) #测试机上判断无线客户端是否依然是连接上的 result = tmp.get_client_cmd_result("iw dev %s link" % wlan) #无线网卡释放ip地址 CPControl.dhcp_release_wlan(self, wlan) #断开无线连接 CPControl.disconnect_ap(self) #刷新页面重新登录ap页面 Lg = LoginBusiness(self.driver) Lg.refresh_login_ap() tmp1 = ClientAccessBusiness(self.driver) #删除Global Blacklist里面的所有的mac tmp1.del_Global_Blacklist_mac() return result
def test_019_check_confirm_box(self): u"""Block client时的确认框(testlink_ID:517)""" log.debug("019") tmp = ClientsBusiness(self.driver) #Block client时的确认框 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.check_confirm_box(wlan_mac) assert result == True, "check confirm box Blocking client,test fail!" print "check confirm box Blocking client,test pass!"
def test_013_set_client_digital(self): u"""设置用户名为全数字(testlink_ID:512)""" log.debug("013") tmp = ClientsBusiness(self.driver) #客户端名称设置为不合法时 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result1, result2 = tmp.check_set_client_name( wlan_mac, data_client['digital_name']) assert result1 and result2, "set client name is digital,test fail!" print "set client name is digital,test pass!"
def test_016_set_client_err_name2(self): u"""设置用户名为___(testlink_ID:515)""" log.debug("016") tmp = ClientsBusiness(self.driver) #客户端名称设置为不合法时 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result1, result2 = tmp.check_set_client_name(wlan_mac, data_client['err_name2']) assert result1 and result2, "set client name is ___,test fail!" print "set client name is ___,test pass!"
def test_003_check_connected_info(self): u"""连接方式(无线)信息核对(testlink_ID:488)""" log.debug("003") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取第一个客户端的类型 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_cient_type(wlan_mac) assert result == ( u"无线" or "Wireless"), "Check wireless connected type info,test fail!" print "Check wireless connected type info,test pass!"
def test_024_unblock_block(self): u"""被block的终端重连WLAN后再被block(testlink_ID:523)""" log.debug("024") tmp = ClientsBusiness(self.driver) #只有一个客户端,阻塞该客户端 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) tmp.block_client(wlan_mac) #测试机上判断无线客户端是否依然是连接上的 result = tmp.get_client_cmd_result("iw dev %s link" % data_basic['wlan_pc']) print result assert 'Not connected' in result, "block client again,test fail!" print "block client again,test pass!"
def test_004_check_ip(self): u"""IP地址信息核对(testlink_ID:489)--bug78714""" log.debug("004") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取第一个客户端的IP地址 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_client_IP(wlan_mac) print "client ip on Client page is " + result tmp.dhcp_release_wlan(data_basic['wlan_pc']) assert result != "", "Check IP address on client page,test fail!" print "Check IP address on client page,test pass!"
def test_007_check_AP_mac(self): u"""AP的mac地址信息核对(testlink_ID:492)""" log.debug("007") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() #获取客户端所连接的AP名称或mac wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result = tmp.get_AP_name(wlan_mac) MasterAP = data_AP['master:mac'].upper() print result, MasterAP assert result == MasterAP, "Check AP mac,test fail!" print "Check AP mac,test pass!"
def test_005_check_connected_time(self): u"""连接时间信息核对--15s更新一次(testlink_ID:490)""" log.debug("005") tmp = ClientsBusiness(self.driver) #点击客户端菜单 tmp.clients_menu() self.driver.refresh() #获取第一个客户端的连接时间 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result1 = tmp.get_client_time(wlan_mac) time.sleep(16) result2 = tmp.get_client_time(wlan_mac) assert result1 != result2, "Check updated time on client page,test fail!" print "Check updated time on client page,test pass!"
def test_020_block_client(self): u"""block客户端后,判断客户端不能够连接(testlink_ID:518)""" log.debug("020") tmp = ClientsBusiness(self.driver) #使用无线网卡能够连接上ssid,并正常使用 tmp.connect_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #只有一个客户端,阻塞该客户端 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) tmp.block_client(wlan_mac) #测试机上判断无线客户端是否依然是连接上的 result = tmp.get_client_cmd_result("iw dev %s link" % data_basic['wlan_pc']) print result assert 'Not connected' in result, "after blocking client,it can't connect AP,test fail!" print "after blocking client,it can't connect AP,test pass!"
def test_034_failover_master_can_modify_client_configuration(self): u"""failover ap 切换到master ap模式后,能够修改client的配置(testlink_ID:2384)""" log.debug("034") tmp = APSBusiness(self.driver) #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], data_basic['superUser'], data_login['all']) #修改客户端名字 tmp1 = ClientsBusiness(self.driver) mac = tmp1.get_wlan_mac(data_basic['wlan_pc']) tmp1.change_client_name(mac, data_Client['letter_digital_name']) #获取第一个客户端的名称 time.sleep(60) result = tmp1.check_client_name(mac) tmp1.dhcp_release_wlan(data_basic['wlan_pc']) self.assertEqual(data_Client['letter_digital_name'], result), "after failover change to master can modify client configuration, test fail!" print "after failover change to master can modify client configuration, test pass!"
def test_002_connect_clients_info(self): u"""无线网卡连接上ap后,查看客户端信息(testlink_ID:485)""" log.debug("002") tmp = ClientsBusiness(self.driver) #使用无线网卡能够连接上ssid,并正常使用 tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #获取客户端的mac地址 result1 = tmp.check_client(data_basic['wlan_pc']) wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result2 = tmp.get_online_status(wlan_mac) print result1, result2 assert result1 and ( (u"在线" or 'Online') in result2), "test after connecting ap,clients info,test fail!" print "test after connecting ap,clients info,test pass!"
def test_017_set_client_letter_digital(self): u"""设置用户名为全字母+数字(testlink_ID:512+513)""" log.debug("017") tmp = ClientsBusiness(self.driver) #只有一个客户端时,修改客户端名称 wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) tmp.change_client_name(wlan_mac, data_client['letter_digital_name']) #重启ap tmp1 = UpgradeBusiness(self.driver) tmp1.web_reboot(data_basic['DUT_ip']) tmp1.connect_WPA_AP(data_wireless['all_ssid'],\ data_wireless['short_wpa'],data_basic['wlan_pc']) self.driver.refresh() self.driver.implicitly_wait(10) #登录AP Lg = LoginBusiness(self.driver) Lg.login(data_basic['superUser'], data_login['all']) #获取第一个客户端的名称 result = tmp.check_client_name(wlan_mac) assert result == data_client[ 'letter_digital_name'], "set client name is letter+digital,test fail!" print "set client name is letter+digital,test pass!"
def test_012_disconnect_clients_info(self): u"""无线网卡断开ap后,查看客户端信息(testlink_ID:501)""" log.debug("012") tmp = ClientsBusiness(self.driver) #无线网卡断开已连接的AP tmp.wlan_disable(data_basic['wlan_pc']) #获取客户端的mac地址 result1 = tmp.check_client(data_basic['wlan_pc']) wlan_mac = tmp.get_wlan_mac(data_basic['wlan_pc']) result2 = tmp.get_offline_status(wlan_mac) print result1, result2 #删除SSID1 tmp1 = SSIDBusiness(self.driver) tmp1.del_all_NG() #使用无线网卡能够连接上ssid,并正常使用 tmp.wlan_enable(data_basic['wlan_pc']) tmp.connect_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) assert result1 and ( (u"离线" or 'Offline') in result2), "test after disconnecting ap,test fail!" print "test after disconnecting ap,test pass!"