Exemplo n.º 1
0
 def test_013_slave_AP_client_num(self):
     u"""终端设备关联在Slave AP上,检查用户数量统计是否正确(testlink_ID:1155,1156)"""
     log.debug("013")
     #新增一个ssid
     NG2_ssid = "%s-2"%data_ng["NG2_ssid"]
     Add = SSIDBusiness(self.driver)
     Add.new_vlan_ssid(NG2_ssid,data_wireless["short_wpa"],"2")
     #多个网络组时,搜索-配对-加入ssid
     tmp1 = APSBusiness(self.driver)
     tmp1.search_pair_add(2,data_ap["slave:mac2"])
     #使用无线连接slave AP
     tmp1.connect_DHCP_WPA_AP(NG2_ssid,\
                 data_wireless["short_wpa"],data_basic['wlan_pc'])
     #等待2分钟
     time.sleep(120)
     tmp = OVBusiness(self.driver)
     tmp.OV_menu()
     #获取2.4G客户端数
     result1 = tmp.get_2g4_client()
     #获取5G客户端数
     result2 = tmp.get_5g_client()
     #释放无线网卡的ip
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     tmp.disconnect_ap()
     assert (result1 == "1") or (result2 == "1"),\
         "check clients number when client connect slave AP,test fail!"
     print "check clients number when client connect slave AP,test pass!"
 def test_001_factory_reset(self):
     u"""在页面上把AP恢复出厂设置(testlink_ID:773)"""
     #如果登录没有成功,再次使用默认密码登录;如果登录成功则直接退出
     log.debug("001")
     Lg = LoginBusiness(self.driver)
     Lg.login_again()
     tmp = APSBusiness(self.driver)
     #描述:启用无线网卡
     tmp.wlan_enable(data_basic['wlan_pc'])
     #rsyslog服务器准备
     tmp.ready_rsyslog()
     result = tmp.web_factory_reset(data_basic['DUT_ip'],data_basic['sshUser'],\
                            data_basic['super_defalut_pwd'])
     #修改默认网络组的ssid和密码
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_wifi_ssid_key(data_wireless['all_ssid'],
                               data_wireless["short_wpa"])
     tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
                             data_wireless['short_wpa'],
                             data_basic['wlan_pc'])
     #禁用启用有线网卡,以便无线网卡能够在ap的client页面显示在线
     tmp.wlan_disable(data_basic['lan_pc'])
     tmp.wlan_enable(data_basic['lan_pc'])
     time.sleep(60)
     tmp.dhcp_release_wlan(data_basic["wlan_pc"])
     assert result, "reset the AP defalut config in webpage,fail!"
     print "reset the AP defalut config in webpage,pass!"
 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!"
Exemplo n.º 4
0
 def test_016_check_failover_ap_configuation_after_change_master(self):
     u"""master ap做一些改变,确认failover ap和master ap有相同的配置(testlink_ID:2361)"""
     log.debug("016")
     #修改默认网络组的ssid和密码
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_wifi_ssid_key(data_wireless['all_ssid'],data_wireless["short_wpa"])
     tmp = APSBusiness(self.driver)
     #确认failover ap和master ap有相同的配置
     result = tmp.check_check_failover_ap_configuation(
         data_basic['DUT_ip'],data_basic['slave_ip2'],
         data_basic['sshUser'], data_login['all'])
     self.assertTrue(result), "check failover ap configuation is same master ap after changing master ap, test fail!"
     print "check failover ap configuation is same master ap after changing master ap, test pass!"
Exemplo n.º 5
0
    def test_019_masterAP_upload(self):
        u"""AP 上传流量统计的准确性---master ap(testlink_ID:1195_1)---有概率性bug"""
        log.debug("019")
        tmp = OVBusiness(self.driver)
        #AP 上传流量统计的准确性---master ap
        result1,result2 = tmp.check_masterAP_upload_backup(data_wireless['all_ssid'],\
                data_wireless["short_wpa"],data_basic['wlan_pc'],data_basic['lan_pc'],
                data_ap['master:mac'])
        #master AP切换到Dual-Band
        tmp1 = SSIDBusiness(self.driver)
        tmp1.change_AP_Freq("Dual-Band")

        assert ("MB" in result1) or ("GB" in result1),"check master ap upload fail!"
        print "check master ap upload pass!"
Exemplo n.º 6
0
 def check_group1_radius_portal_function(self, NG2_ssid, password, wlan,
                                         eth, t, radius_name,
                                         radius_password):
     #7000新建一个网络组,vid设为2,开启dhcp server
     tmp1 = NGBusiness(self.driver)
     tmp1.mixed_7000_new_NG()
     #76xx上新建一个网络组,vid为2
     self.driver.get(data_basic['DUT_web'])
     self.driver.implicitly_wait(60)
     self.driver.refresh()
     time.sleep(10)
     tmp3 = SSIDBusiness(self.driver)
     tmp3.new_vlan_ssid(NG2_ssid, password, "2")
     #开启ssid1的强制门户认证
     tmp3.click_ssid_portal(2)
     #master ap加入所有的网络组
     tmp2 = APSBusiness(self.driver)
     tmp2.add_master_to_all_NG()
     #验证默认list:grandstream中的radius认证的有效性
     portal_title,redirect_title,again_title,expiration_title = \
         CPBusiness.check_radius_portal(self,NG2_ssid,password,
         wlan,eth,t,radius_name,radius_password)
     #刷新页面重新登录ap页面
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     #删除master ap的ssid1
     tmp3.del_all_NG()
     #删除7000新建的网络组
     tmp1.mixed_7000_del_NG()
     return portal_title, redirect_title, again_title, expiration_title
Exemplo n.º 7
0
 def test_046_check_connection_m_time_function(self):
     u"""Connection Time单位选择m分钟,功能测试(testlink_ID:3202)"""
     log.debug("046")
     tmp = TimePolicyBusiness(self.driver)
     #断开无线网卡的连接
     tmp.disconnect_ap()
     #先修改ap的系统时间为01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date -s 01:00:00")
     #按照默认配置,新建一个时间策略
     tmp.new_timepolicy_default(0, u"时间策略1", "2", "23", "m")
     #进入网络组中选择客户端时间策略
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_client_time_policy_pagedown(1, u"时间策略1")
     #无线网卡连接
     tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     #等待3分钟
     time.sleep(240)
     #判断AP是否依然连接
     result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
     #释放无线网卡的ip
     tmp1.dhcp_release_wlan(data_basic['wlan_pc'])
     #获取禁止的客户端页面所有标题
     tmp2 = BannedClientsBusiness(self.driver)
     result2 = tmp2.get_bannedclients_title()
     wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()
     self.assertNotIn(data_wireless['all_ssid'], result1)
     self.assertIn(wlan_mac, result2),
     "check connection time function is min, test fail!"
     print "check connection time function is min, test pass!"
Exemplo n.º 8
0
 def check_slave_ap_group1_portal_function(self, NG2_ssid, password, wlan,
                                           eth):
     #7000新建一个网络组,vid设为2,开启dhcp server
     tmp1 = NGBusiness(self.driver)
     tmp1.mixed_7000_new_NG()
     #76xx上新建一个网络组,vid为2
     self.driver.get(data_basic['DUT_web'])
     self.driver.implicitly_wait(60)
     self.driver.refresh()
     time.sleep(10)
     tmp2 = SSIDBusiness(self.driver)
     tmp2.new_vlan_ssid(NG2_ssid, password, "2")
     #开启group1的强制门户认证
     tmp2.click_ssid_portal(2)
     #slave ap加入所有的网络组
     tmp3 = APSBusiness(self.driver)
     tmp3.add_slave_to_all_NG()
     #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
     result = CPBusiness.check_jump_to_No_auth_portal(
         self, NG2_ssid, password, wlan, eth)
     #刷新页面重新登录ap页面
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     #删除ssid1
     tmp2.del_all_NG()
     #删除7000新建的网络组
     tmp1.mixed_7000_del_NG()
     print result
     return result
Exemplo n.º 9
0
 def check_open_close_many_groups_captive_portal_function(
         self, group0_ssid, group1_ssid, group2_ssid, password, wlan, eth):
     result = []
     tmp1 = SSIDBusiness(self.driver)
     for i in range(2):
         #点击group0的强制门户认证
         #点击三个网络组的强制门户认证
         tmp1.click_many_group_portal(3)
         #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
         for j in [group0_ssid, group1_ssid, group2_ssid]:
             result1 = CPBusiness.check_jump_to_No_auth_portal(
                 self, j, password, wlan, eth)
             result.append(result1)
         #测试完成一遍后,再次登录ap页面,为后续循环测试做好准备
         #刷新页面重新登录ap页面
         Lg = LoginBusiness(self.driver)
         Lg.refresh_login_ap()
         time.sleep(30)
     #删除master ap的两个ssid
     tmp1 = SSIDBusiness(self.driver)
     tmp1.del_all_NG()
     #删除7000新建的两个网络组
     tmp2 = NGBusiness(self.driver)
     tmp2.mixed_7000_del_NG()
     print result
     return result
Exemplo n.º 10
0
 def test_032_failover_master_can_modify_NG_configuration(self):
     u"""failover ap 切换到master ap模式后,能够修改网络组的配置(testlink_ID:2382)"""
     log.debug("032")
     tmp = APSBusiness(self.driver)
     #登录failover ap的web界面
     tmp.login_failover_ap(data_basic['slave_web2'],
         data_basic['superUser'], data_login['all'])
     #修改网络组的ssid
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_wifi_ssid_key(data_ng['NG2_ssid'], data_wireless['short_wpa'])
     tmp2 = SSH(data_basic['slave_ip2'],data_login["all"])
     result1 = tmp2.ssh_cmd(data_basic['sshUser'],"uci show grandstream.ssid0.ssid")
     result2 = tmp.connect_DHCP_WPA_AP(data_ng['NG2_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     self.assertIn(data_ng['NG2_ssid'], result1)
     self.assertIn(data_ng['NG2_ssid'], result2), "after failover change to master can modify network configuration, test fail!"
     print "after failover change to master can modify network configuration, test pass!"
Exemplo n.º 11
0
 def check_open_close_captive_portal_No_auth_function(
         self, ssid, password, wlan, eth):
     result = []
     for i in range(6):
         #点击group0的强制门户认证
         tmp1 = SSIDBusiness(self.driver)
         tmp1.click_ssid_portal(1)
         #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
         result1 = CPBusiness.check_jump_to_No_auth_portal(
             self, ssid, password, wlan, eth)
         result.append(result1)
         #测试完成一遍后,再次登录ap页面,为后续循环测试做好准备
         #刷新页面重新登录ap页面
         Lg = LoginBusiness(self.driver)
         Lg.refresh_login_ap()
     print result
     return result
Exemplo n.º 12
0
 def test_010_clients_num(self):
     u"""2.4G/5G 用户数量统计(testlink_ID:1151,1152)"""
     log.debug("010")
     tmp = OVBusiness(self.driver)
     #获取2.4G客户端数
     result1 = tmp.get_2g4_client()
     #获取5G客户端数
     result2 = tmp.get_5g_client()
     #释放无线网卡的ip
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #AP切换到2.4G
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_AP_Freq("2.4GHz")
     assert (result1 == "1") or (result2 == "1"),"check clients number,test fail!"
     print "check clients number,test pass!"
Exemplo n.º 13
0
 def test_036_check_slave_failover_function(self):
     u"""指定failover ap后,确定failover ap的功能正常(testlink_ID:2369)"""
     log.debug("036")
     #点击网络组,添加一个新的指定VID的网络组
     tmp1 = SSIDBusiness(self.driver)
     tmp1.new_vlan_ssid(data_ng['NG2_ssid'], data_wireless['short_wpa'], "2")
     tmp = APSBusiness(self.driver)
     #搜索并配对特定的ap
     tmp.search_pair_AP(data_AP["slave:mac1"],data_AP["slave:mac2"])
     #设置slave ap2为failover ap
     tmp.change_slave_to_failover(data_AP["slave:mac2"])
     #slave加入第2个网络组
     tmp.add_slave_to_NG(data_AP["slave:mac2"], 2)
     #无线网卡连接该ap
     result = tmp.connect_WPA_AP(data_ng['NG2_ssid'], data_wireless['short_wpa'],
         data_basic['wlan_pc'])
     self.assertIn(data_ng['NG2_ssid'], result), "after designating failover ap,check failover ap function,test fail!"
     print "after designating failover ap,check failover ap function,test pass!"
 def test_001_factory_reset(self):
     u"""在页面上把AP恢复出厂设置(testlink_ID:773)"""
     log.debug("001")
     #如果登录没有成功,再次使用默认密码登录;如果登录成功则直接退出
     Lg = LoginBusiness(self.driver)
     Lg.login_again()
     tmp = APSBusiness(self.driver)
     #描述:启用无线网卡
     tmp.wlan_enable(data_basic['wlan_pc'])
     #rsyslog服务器准备
     tmp.ready_rsyslog()
     result = tmp.web_factory_reset(data_basic['DUT_ip'],data_basic['sshUser'],\
                            data_basic['super_defalut_pwd'])
     #修改默认ssid和密码
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_wifi_ssid_key(data_wireless['all_ssid'],data_wireless["short_wpa"])
     assert result,"reset the AP defalut config in webpage,fail!"
     print "reset the AP defalut config in webpage,pass!"
Exemplo n.º 15
0
 def test_011_2g4_client_num(self):
     u"""终端设备在2.4G上, 检查用户数量统计是否正确(testlink_ID:1153_1)"""
     log.debug("011")
     tmp = OVBusiness(self.driver)
     #使用无线连接该AP
     tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],\
                 data_wireless["short_wpa"],data_basic['wlan_pc'])
     #等待2分钟
     time.sleep(120)
     #获取2.4G客户端数
     result = tmp.get_2g4_client()
     #释放无线网卡的ip
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #AP切换到5G
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_AP_Freq("5GHz")
     assert result == "1","check 2.4G client number,test fail!"
     print "check 2.4G client number,test pass!"
Exemplo n.º 16
0
 def check_many_group_portal_function(self, group0_ssid, group1_ssid,
                                      group2_ssid, password, wlan, eth):
     result = []
     #7000新建两个网络组,开启dhcp server
     tmp1 = NGBusiness(self.driver)
     tmp1.mixed_7000_new_many_NG(2)
     #76xx上新建1个对应的网络组
     self.driver.get(data_basic['DUT_web'])
     self.driver.implicitly_wait(60)
     self.driver.refresh()
     time.sleep(10)
     tmp3 = SSIDBusiness(self.driver)
     tmp3.new_vlan_ssid(group2_ssid, password, "3")
     #开启三个网络组的强制门户认证
     tmp3.click_ssid_portal(1)
     tmp3.click_ssid_portal(3)
     #master ap加入所有的网络组
     tmp2 = APSBusiness(self.driver)
     tmp2.add_master_to_all_NG()
     #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
     for j in [group0_ssid, group1_ssid, group2_ssid]:
         result1 = CPBusiness.check_jump_to_No_auth_portal(
             self, j, password, wlan, eth)
         result.append(result1)
     print result
     return result
 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!"
Exemplo n.º 18
0
 def test_012_5g_client_num(self):
     u"""终端设备在5G上, 检查用户数量统计是否正确(testlink_ID:1153_2)"""
     log.debug("012")
     tmp = OVBusiness(self.driver)
     #使用无线连接该AP
     tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],\
                 data_wireless["short_wpa"],data_basic['wlan_pc'])
     time.sleep(120)
     # 获取5G客户端数
     result = tmp.get_5g_client()
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #释放无线网卡的ip
     tmp.disconnect_ap()
     #AP切换到双频
     #切换Dual-Band频段
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_AP_Freq("Dual-Band")
     #7000上新建一个网络组,vid设为2,开启dhcp server
     tmp2 = NGBusiness(self.driver)
     tmp2.mixed_7000_new_NG()
     assert result == "1","check 5G client number,test fail!"
     print "check 5G client number,test pass!"
Exemplo n.º 19
0
 def test_052_master_cameback_can_update_configuration(self):
     u"""当master ap回来后,确认能够修改配置(testlink_ID:2406)"""
     log.debug("052")
     tmp1 = SSIDBusiness(self.driver)
     #删除所有的网络组
     tmp1.del_all_NG()
     #修改group0的ssid
     ssid = data_wireless['all_ssid']+"-9"
     tmp1.change_wifi_ssid_key(ssid,data_wireless['short_wpa'])
     #检查ssid是否修改成功
     result1 = tmp1.check_NG_ssid(data_basic["DUT_ip"],
         data_basic["sshUser"], data_login['all'])
     result2 = tmp1.check_NG_ssid(data_basic["slave_ip1"],
         data_basic["sshUser"], data_login['all'])
     result3 = tmp1.check_NG_ssid(data_basic["slave_ip2"],
         data_basic["sshUser"], data_login['all'])
     time.sleep(60)
     #解除slave1,slave2的配对
     tmp = APSBusiness(self.driver)
     tmp.unpair_last_slave_ap(2)
     self.assertIn(ssid, result1)
     self.assertIn(ssid, result2)
     self.assertIn(ssid, result3), "when master ap came back,check can update configuration,test fail!"
     print "when master ap came back,check can update configuration,test pass!"
Exemplo n.º 20
0
 def check_other_group_STA_open_group0(self, NG2_ssid, password, ssid, wlan,
                                       eth):
     #新建一个ssid1,vid2
     tmp1 = SSIDBusiness(self.driver)
     tmp1.new_vlan_ssid(NG2_ssid, password, "2")
     #开启ssid1的强制门户认证
     tmp1.click_ssid_portal(2)
     #master ap加入所有的网络组
     tmp2 = APSBusiness(self.driver)
     tmp2.add_master_to_all_NG()
     #确认STA连接group0,并且不需要认证
     #验证是否需要弹出认证
     result = CPBusiness.\
         check_jump_to_No_auth_portal(self,ssid,password,wlan,eth)
     print result
     return result
Exemplo n.º 21
0
    def check_country_channel_power(self, host, user, pwd):
        chan_2g4 = []
        chan_5g = []
        rate_2g4 = []
        rate_5g_1 = []
        rate_5g_2 = []
        fail_info = []
        country = data_countrycode['country']
        countrycode = data_countrycode['ctycode']
        rate2 = data_countrycode['rate_2g']
        rate51 = data_countrycode['rate_5g_band1']
        rate52 = data_countrycode['rate_5g_band2']
        for i in range(len(country)):
            #从后台取出当前国家应该有的所有信道
            correct_chan_2g, correct_chan_5g = BasicBusiness.get_correct_channel(
                self, host, user, pwd, countrycode[i])
            # 循环设置国家
            BasicBusiness.set_country(self, countrycode[i])
            print "set country is %s successfully!" % country[i]
            # 检查2.4G当前可用信道,返回值与预期结果比较
            result1 = BasicBusiness.check_current_channel(
                self, host, user, pwd, "ath0")
            if result1 == correct_chan_2g:
                chan_2g4.append(True)
            else:
                print "Fail!!!The country:%s testing 2.4g channel is %s" % (
                    country[i], result1)
                chan_2g4_fail_info = "%s\t\t\t%s\t\t\t2.4G channel\t\t\t%s\t\t\t%s" % (
                    country[i], countrycode[i], result1, correct_chan_2g)
                fail_info.append(chan_2g4_fail_info)
                chan_2g4.append(False)
            # 检查5G当前可用信道,返回值与预期结果比较
            result2 = BasicBusiness.check_current_channel(
                self, host, user, pwd, "ath1")
            if result2 == correct_chan_5g:
                chan_5g.append(True)
            else:
                print "Fail!!!The country:%s testing 5g channel is %s" % (
                    country[i], result2)
                chan_5g_fail_info = "%s\t\t\t%s\t\t\t5G channel\t\t\t%s\t\t\t%s" % (
                    country[i], countrycode[i], result2, correct_chan_5g)
                fail_info.append(chan_5g_fail_info)
                chan_5g.append(False)

            #检查2.4的Tx-Power
            result3 = BasicBusiness.check_tx_power(self, host, user, pwd,
                                                   "ath0")
            if result3 == rate2[i]:
                rate_2g4.append(True)
            else:
                print "Fail!!!The country:%s testing 2.4g power is %s" % (
                    country[i], result3)
                rate_2g4_fail_info = "%s\t\t\t%s\t\t\t2.4G power\t\t\t%s\t\t\t%s" % (
                    country[i], countrycode[i], result3, rate2[i])
                fail_info.append(rate_2g4_fail_info)
                rate_2g4.append(False)

            #1如果没有5G信号的
            if correct_chan_5g == "":
                rate_5g_1.append(True)
                rate_5g_2.append(True)
            #2有5G信号,但没有5g band2
            elif (correct_chan_5g != "") and ("149" not in correct_chan_5g):
                #检查5G的Tx-Power,结果追加到rate1
                result41 = BasicBusiness.check_tx_power(
                    self, host, user, pwd, "ath1")
                if result41 == rate51[i]:
                    rate_5g_1.append(True)
                else:
                    print "Fail!!!The country:%s testing 5g power1 is %s" % (
                        country[i], result41)
                    rate_5g1_fail_info = "%s\t\t\t%s\t\t\t5G power1\t\t\t%s\t\t\t%s" % (
                        country[i], countrycode[i], result41, rate51[i])
                    fail_info.append(rate_5g1_fail_info)
                    rate_5g_1.append(False)
                #将True追加到rate2
                rate_5g_2.append(True)
            #3有5G信号,但没有5g band1
            elif (correct_chan_5g != "") and ("36" not in correct_chan_5g):
                #将True追加到rate1
                rate_5g_1.append(True)
                #检查5G的Tx-Power,结果追加到rate2
                result42 = BasicBusiness.check_tx_power(
                    self, host, user, pwd, "ath1")
                if result42 == rate52[i]:
                    rate_5g_2.append(True)
                else:
                    print "Fail!!!The country:%s testing 5g power2 is %s" % (
                        country[i], result42)
                    rate_5g2_fail_info = "%s\t\t\t%s\t\t\t5G power2\t\t\t%s\t\t\t%s" % (
                        country[i], countrycode[i], result42, rate52[i])
                    fail_info.append(rate_5g2_fail_info)
                    rate_5g_2.append(False)
            #4有5G信号,既有5g band1,又有5g band2
            else:
                tmp1 = SSIDBusiness(self.driver)
                #修改freq为5GHz
                tmp1.change_AP_Freq("5GHz")
                #由于后面需要改5G信道来进行测试,而有些国家40M的模式下没有信道选项,所有先需要修改5G带宽为20M后才能修改信道
                #一起修改5G的带宽和信道36
                tmp = APSBusiness(self.driver)
                tmp.change_5g_width_channel("20MHz", "36")
                #检查5G的Tx-Power,结果追加到rate1
                result51 = BasicBusiness.check_tx_power(
                    self, host, user, pwd, "ath0")
                if result51 == rate51[i]:
                    rate_5g_1.append(True)
                else:
                    print "Fail!!!The country:%s testing 5g power1 is %s" % (
                        country[i], result51)
                    rate_5g1_fail_info1 = "%s\t\t\t%s\t\t\t5G power1\t\t\t%s\t\t\t%s" % (
                        country[i], countrycode[i], result51, rate51[i])
                    fail_info.append(rate_5g1_fail_info1)
                    rate_5g_1.append(False)
                #修改信道为149
                tmp.set_master_ap_5g_channel_backup("149")
                #检查5G的Tx-Power,结果追加到rate1
                result52 = BasicBusiness.check_tx_power(
                    self, host, user, pwd, "ath0")
                if result52 == rate52[i]:
                    rate_5g_2.append(True)
                else:
                    print "Fail!!!The country:%s testing 5g power2 is %s" % (
                        country[i], result52)
                    rate_5g1_fail_info2 = "%s\t\t\t%s\t\t\t5G power2\t\t\t%s\t\t\t%s" % (
                        country[i], countrycode[i], result52, rate52[i])
                    fail_info.append(rate_5g1_fail_info2)
                    rate_5g_2.append(False)
                #修改回freq为Dual-Band
                tmp1.change_AP_Freq("Dual-Band")
        #如果有fail信息,则打印
        if fail_info != []:
            print "country\t\t\tcountrycode\t\t\ttest item\t\t\ttest result\t\t\tcorrect result"
            fail_info_str = "\n".join(fail_info)
            print fail_info_str
        return chan_2g4, chan_5g, rate_2g4, rate_5g_1, rate_5g_2