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