Ejemplo n.º 1
0
    def test_014_clientmode_check_restore_AP_factory(self):
        """
        客户端模式下验证AP是否恢复出厂配置
        """
        tmp = ConfigUpdateBusiness(self.driver)
        #在AP的web页面上点击恢复出厂设置
        tmp.restore_AP_factory()
        #判断ssid是否恢复出厂
        tmp1 = WirelessSettingsBusiness(self.driver)
        result1 = tmp1.get_first_ssid(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #判断wan口是否恢复出厂
        tmp2 = WanSettingsBusiness(self.driver)
        result2 = tmp2.get_wan_way(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #默认ssid
        default_ssid = "3ONE_2G_"+ data.master_last_6mac()
        #登录ap后台,判断ap的工作模式
        tmp3 = WorkModeBusiness(self.driver)
        result3 = tmp3.check_DUT_workmode(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])

        #设置PC的静态IP,能够访问DUT的webpage
        tmp.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip'])

        self.assertIn(default_ssid, result1)
        self.assertIn("dhcp", result2)
        self.assertNotIn("wds_c", result3)
        log.debug("014\t\tpass")
Ejemplo n.º 2
0
    def test_011_bridgemode_upload_config_file(self):
        """桥接模式下验证上传配置文件"""
        tmp = ConfigUpdateBusiness(self.driver)
        #文件路径
        PATH = os.path.join(os.getcwd(), "bakup.file")
        print(PATH)
        #上传配置文件
        tmp.upload_config_file(PATH)

        #设置PC的静态IP,能够访问DUT的webpage
        tmp.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip'])
        #关闭AP的eth1端口,以免她来分配ip地址,和桥接的dhcp server相冲突
        tmp4 = WorkModeBusiness(self.driver)
        tmp4.down_ap_eth1(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #逻辑类对象,建一个实例
        Lg = LoginBusiness(self.driver)
        #刷新页面重新登录ap页面
        Lg.refresh_login_ap()
        tmp1 = StateInfoBusiness(self.driver)
        #获取当前模式
        result1 = tmp1.obtain_AP_current_mode()
        #获取桥接的连接状态
        result2 = tmp1.obtain_WAN_IP_generation()
        #获取信号强度
        result3 = tmp1.obtain_WAN_IP_address()

        #判断ssid是否恢复
        tmp2 = WirelessSettingsBusiness(self.driver)
        result4 = tmp2.get_first_ssid(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #登录ap后台,判断ap的工作模式
        tmp3 = WorkModeBusiness(self.driver)
        result5 = tmp3.check_DUT_workmode(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #测试完成后删除备份文件
        if result1 != "网桥模式":
            #如果恢复配置失败,保存配置文件
            dirname = os.path.dirname(os.path.dirname(__file__))
            current_time = time.strftime('%m%d%H%M',time.localtime(time.time()))
            backfile_PATH = os.path.join(dirname, "data", "testresultdata", "bridgemode_{}_bakup.file".format(current_time))
            shutil.copy(PATH, backfile_PATH)
        os.unlink(PATH)
        self.assertEqual(result1, "网桥模式")
        self.assertEqual(result2, "已连接")
        self.assertIn("dBm", result3)
        self.assertIn(data_wirless['all_ssid'], result4)
        self.assertIn("wds", result5)
        log.debug("011\t\tpass")