def test_005_apmode_save_config_file(self): """AP模式下保存配置""" tmp = WorkModeBusiness(self.driver) #设置PC的静态IP,能够访问DUT的webpage tmp.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip']) #修改工作模式为AP模式,内网设置静态IP tmp.change_workmode_to_ap_LANstaticIP(data_basic['DUT_ip'], data_lan['netmask1'], data_wirless['all_ssid'], "psk2", data_wirless['short_wpa'], "HT20") time.sleep(30) #逻辑类对象,建一个实例 Lg = LoginBusiness(self.driver) #刷新页面重新登录ap页面 Lg.refresh_login_ap() #下载配置文件 tmp1 = ConfigUpdateBusiness(self.driver) tmp1.download_config_file() #判断配置文件是否下载 #文件路径 PATH = os.path.join(os.getcwd(), "bakup.file") print(PATH) result = os.path.exists(PATH) #登录ap后台,判断ap的工作模式 result5 = tmp.check_DUT_workmode(data_basic['DUT_ip'], data_basic['ssh_user'], data_basic['ssh_pwd']) self.assertTrue(result) self.assertIn("ap", result5) log.debug("005\t\tpass")
def test_004_check_apmode_reboot_ap(self): """AP模式下在页面上点击重启设备后,验证设备是否重启""" tmp1 = WorkModeBusiness(self.driver) #设置PC的静态IP,能够访问DUT的webpage tmp1.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip']) #修改工作模式为AP模式,内网设置静态IP tmp1.change_workmode_to_ap_LANstaticIP(data_basic['DUT_ip'], data_lan['netmask1'], data_wirless['all_ssid'], "psk2", data_wirless['short_wpa'], "HT20") #time.sleep(30) #逻辑类对象,建一个实例 Lg = LoginBusiness(self.driver) #刷新页面重新登录ap页面 Lg.refresh_login_ap() #登录ap后台,判断ap的工作模式 result5 = tmp1.check_DUT_workmode(data_basic['DUT_ip'], data_basic['ssh_user'], data_basic['ssh_pwd']) tmp = RebootSystemBusiness(self.driver) #在页面上点击重启设备后,验证设备是否重启 result1, result2 = tmp.check_reboot_ap(data_basic['DUT_ip']) self.assertIn("ap", result5) self.assertNotEqual(0, result1) self.assertEqual(0, result2) log.debug("004\t\tpass")
def test_005_apmode_system_downgrade_check_config(self): """ap模式下,修改配置后,系统降级,检查配置""" tmp1 = WorkModeBusiness(self.driver) #设置PC的静态IP,能够访问DUT的webpage tmp1.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip']) #修改工作模式为AP模式,内网设置静态IP tmp1.change_workmode_to_ap_LANstaticIP(data_basic['DUT_ip'], data_lan['netmask1'], data_wirless['all_ssid'], "psk2", data_wirless['short_wpa'], "HT20") time.sleep(30) #逻辑类对象,建一个实例 Lg = LoginBusiness(self.driver) #刷新页面重新登录ap页面 Lg.refresh_login_ap() #选择固件路径,降级固件 PATH = os.path.join( os.getcwd(), AP_model + '-' + data_basic['old_version'] + '.bin') print(PATH) tmp = SystemUpgradeBusiness(self.driver) tmp.upgrade_system(PATH) #设置PC的静态IP,能够访问DUT的webpage tmp.set_eth_ip(data_basic['lan_pc'], data_basic['static_PC_ip']) #刷新页面重新登录ap页面 Lg.refresh_login_ap() tmp1 = StateInfoBusiness(self.driver) #获取当前模式 result1 = tmp1.obtain_AP_current_mode() #获取内网IP获取方式 result2 = tmp1.obtain_WAN_IP_generation() #获取IP地址 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']) #检查固件版本 result6 = tmp.check_system_version(data_basic['old_version']) self.assertEqual(result1, "AP模式") self.assertEqual(result2, "静态IP") self.assertEqual(data_basic['DUT_ip'], result3) self.assertIn(data_wirless['all_ssid'], result4) self.assertIn("ap", result5) self.assertTrue(result6) log.debug("005\t\tpass")