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_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!"