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 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_021_check_block_client(self): u"""Block wireless client后MAC地址会出现在Global Blacklist MAC(testlink_ID:519)""" log.debug("021") tmp = ClientAccessBusiness(self.driver) #获取Global Blacklist的mac地址 result = tmp.get_Global_Blacklist_mac() mac = tmp.get_wlan_mac(data_basic['wlan_pc']) assert mac.upper( ) in result, "After block wifi,check client mac in Global Blacklist MAC,test fail!" print "After block wifi,check client mac in Global Blacklist MAC,test pass!"
def test_023_unblock_client(self): u"""在Global Blacklist MAC列表里删除已被block的终端MAC,判断客户端能够连接ap成功(testlink_ID:522)""" log.debug("023") tmp = ClientAccessBusiness(self.driver) #删除Global Blacklist里面的所有的mac tmp.del_Global_Blacklist_mac() #使用无线网卡能够连接上ssid,并正常使用 result = tmp.connect_WPA_AP(data_wireless['all_ssid'],\ data_wireless['short_wpa'],data_basic['wlan_pc']) assert data_wireless[ 'all_ssid'] in result, "after unblocking client,it can connect AP,test fail!" print "after unblocking client,it can connect AP,test pass!"
def test_025_check_block_client_again(self): u"""被block的终端重连WLAN后再被block后Global Blacklist MAC列表验证(testlink_ID:524)""" log.debug("025") tmp = ClientAccessBusiness(self.driver) #获取Global Blacklist的mac地址 result = tmp.get_Global_Blacklist_mac() mac = tmp.get_wlan_mac(data_basic['wlan_pc']) #删除Global Blacklist里面的所有的mac tmp.del_Global_Blacklist_mac() #使用无线网卡能够连接上ssid,并正常使用 tmp.connect_WPA_AP(data_wireless['all_ssid'],\ data_wireless['short_wpa'],data_basic['wlan_pc']) assert mac.upper( ) in result, "After block wifi again,check client mac in Global Blacklist MAC,test fail!" print "After block wifi again,check client mac in Global Blacklist MAC,test pass!"