Ejemplo n.º 1
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!"
Ejemplo n.º 2
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!"
Ejemplo n.º 3
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!"
Ejemplo n.º 4
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!"
    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