예제 #1
0
    def test_002_set_wan_staticIP(self):
        """外网设置为静态IP,能否上网"""
        tmp = WanSettingsBusiness(self.driver)
        #设置外网为staticIP
        tmp.change_wan_to_staticIP(data_wan['static_IP'], data_wan['netmask'],
                                   data_wan['gateway'], data_wan['DNS'])

        #判断ap能够上网
        time.sleep(30)
        #逻辑类对象,建一个实例
        Lg = LoginBusiness(self.driver)
        #刷新页面重新登录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()
        result4 = tmp.get_ping("www.baidu.com")
        self.assertEqual(result1, "路由模式")
        self.assertEqual(result2, "静态IP")
        self.assertEqual(data_wan['static_IP'], result3)
        self.assertEqual(0, result4)
        log.debug("002\t\tpass")
예제 #2
0
 def test_003_set_wan_dhcp(self):
     """外网设置为动态获取,能否上网"""
     tmp = WanSettingsBusiness(self.driver)
     #设置外网为动态获取
     tmp.change_wan_to_dhcp()
     time.sleep(30)
     #逻辑类对象,建一个实例
     Lg = LoginBusiness(self.driver)
     #刷新页面重新登录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()
     #判断ap能够上网
     result4 = tmp.get_ping("www.baidu.com")
     tmp.disconnect_ap()
     self.assertEqual(result1, "路由模式")
     self.assertEqual(result2, "动态获取")
     self.assertIn(data_wan['wan_str'], result3)
     self.assertEqual(0, result4)
     log.debug("003\t\tpass")
    def test_002_check_routemode_config_file_after_reboot_ap(self):
        """验证路由模式下重启后配置文件没有丢失"""
        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'])
        #判断wan口是否是静态IP
        tmp3 = WanSettingsBusiness(self.driver)
        result5 = tmp3.get_wan_way(data_basic['DUT_ip'],
                                   data_basic['ssh_user'],
                                   data_basic['ssh_pwd'])
        self.assertEqual(result1, "路由模式")
        self.assertEqual(result2, "静态IP")
        self.assertEqual(data_wan['static_IP'], result3)
        self.assertIn(data_wirless['all_ssid'], result4)
        self.assertIn("static", result5)
        log.debug("002\t\tpass")
    def test_008_check_bridgemode_config_file_after_reboot_ap(self):
        """验证桥接模式下重启后配置文件没有丢失"""
        #关闭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'])
        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'])
        self.assertEqual(result1, "网桥模式")
        self.assertEqual(result2, "已连接")
        self.assertIn("dBm", result3)
        self.assertIn(data_wirless['all_ssid'], result4)
        self.assertIn("wds", result5)
        log.debug("008\t\tpass")
    def test_005_check_apmode_config_file_after_reboot_ap(self):
        """验证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'])
        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)
        log.debug("005\t\tpass")
예제 #6
0
    def test_010_clientmode_system_upgrade_check_config(self):
        """客户端模式下,系统升级,检查配置"""
        tmp = SystemUpgradeBusiness(self.driver)
        #选择固件路径,升级固件
        PATH = os.path.join(
            os.getcwd(), AP_model + '-' + data_basic['new_version'] + '.bin')
        print(PATH)
        tmp.upgrade_system(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()

        #登录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['new_version'])

        #修改工作模式为路由模式,外网设置dhcp模式
        tmp4.change_workmode_to_route_WANdhcp(data_wirless['all_ssid'], "psk2",
                                              data_wirless['short_wpa'],
                                              "HT40", "auto")
        #client重新获取ip
        tmp.dhcp_release_wlan(data_basic['lan_pc'])
        tmp.dhcp_wlan(data_basic['lan_pc'])
        tmp.disconnect_ap()
        #删除下载固件
        os.unlink(PATH)

        self.assertEqual(result1, "客户端模式")
        self.assertEqual(result2, "已连接")
        self.assertIn("dBm", result3)
        self.assertIn("wds_c", result5)
        self.assertTrue(result6)
        log.debug("010\t\tpass")
예제 #7
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")
예제 #8
0
    def test_008_bridgemode_system_upgrade_check_config(self):
        """桥接模式下,系统升级,检查配置"""
        tmp = SystemUpgradeBusiness(self.driver)
        #选择固件路径,升级固件
        PATH = os.path.join(
            os.getcwd(), AP_model + '-' + data_basic['new_version'] + '.bin')
        print(PATH)
        tmp.upgrade_system(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'])
        #检查固件版本
        result6 = tmp.check_system_version(data_basic['new_version'])
        self.assertEqual(result1, "网桥模式")
        self.assertEqual(result2, "已连接")
        self.assertIn("dBm", result3)
        self.assertIn(data_wirless['all_ssid'], result4)
        self.assertIn("wds", result5)
        self.assertTrue(result6)
        log.debug("008\t\tpass")
예제 #9
0
    def test_003_routemode_upload_config_file(self):
        """路由模式下验证上传配置文件"""
        tmp = ConfigUpdateBusiness(self.driver)
        #文件路径
        PATH = os.path.join(os.getcwd(), "bakup.file")
        print(PATH)
        #上传配置文件
        tmp.upload_config_file(PATH)

        #逻辑类对象,建一个实例
        Lg = LoginBusiness(self.driver)
        #刷新页面重新登录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'])
        #判断wan口是否是静态IP
        tmp3 = WanSettingsBusiness(self.driver)
        result5 = tmp3.get_wan_way(data_basic['DUT_ip'], data_basic['ssh_user'],
            data_basic['ssh_pwd'])
        #测试完成后删除备份文件
        if result2 != "静态IP":
            #如果恢复配置失败,保存配置文件
            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", "routemode_{}_bakup.file".format(current_time))
            shutil.copy(PATH, backfile_PATH)
        os.unlink(PATH)
        self.assertEqual(result1, "路由模式")
        self.assertEqual(result2, "静态IP")
        self.assertEqual(data_wan['static_IP'], result3)
        self.assertIn(data_wirless['all_ssid'], result4)
        self.assertIn("static", result5)
        log.debug("003\t\tpass")
예제 #10
0
 def test_004_routemode_system_upgrade_check_config(self):
     """路由模式下,系统升级,检查配置"""
     tmp = SystemUpgradeBusiness(self.driver)
     #选择固件路径,升级固件
     PATH = os.path.join(
         os.getcwd(), AP_model + '-' + data_basic['new_version'] + '.bin')
     print(PATH)
     tmp.upgrade_system(PATH)
     Lg = LoginBusiness(self.driver)
     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'])
     #判断wan口是否是静态IP
     tmp3 = WanSettingsBusiness(self.driver)
     result5 = tmp3.get_wan_way(data_basic['DUT_ip'],
                                data_basic['ssh_user'],
                                data_basic['ssh_pwd'])
     #检查固件版本
     result6 = tmp.check_system_version(data_basic['new_version'])
     self.assertEqual(result1, "路由模式")
     self.assertEqual(result2, "静态IP")
     self.assertEqual(data_wan['static_IP'], result3)
     self.assertIn(data_wirless['all_ssid'], result4)
     self.assertIn("static", result5)
     self.assertTrue(result6)
     log.debug("004\t\tpass")
    def test_011_check_clientmode_config_file_after_reboot_ap(self):
        """验证客户端模式下重启后配置文件没有丢失"""
        #关闭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'])
        tmp1 = StateInfoBusiness(self.driver)
        #获取当前模式
        result1 = tmp1.obtain_AP_current_mode()
        #获取桥接的连接状态
        result2 = tmp1.obtain_WAN_IP_generation()
        #获取信号强度
        result3 = tmp1.obtain_WAN_IP_address()

        #登录ap后台,判断ap的工作模式
        tmp3 = WorkModeBusiness(self.driver)
        result5 = tmp3.check_DUT_workmode(data_basic['DUT_ip'],
                                          data_basic['ssh_user'],
                                          data_basic['ssh_pwd'])
        self.assertEqual(result1, "客户端模式")
        self.assertEqual(result2, "已连接")
        self.assertIn("dBm", result3)
        self.assertIn("wds_c", result5)
        log.debug("011\t\tpass")