Esempio n. 1
0
rc = Configuration()

to_log('WIFI+DHCP+USB打印网络配置测试\n')

if rc.wc(name='QA', pwd='12345678', secure=2):
    # 生成WIFI+DHCP+USB网络配置二维码
    wifi_mode(name='QA', pwd='12345678', pr='usb', dh='dhcp')

    # 配网时间
    time.sleep(10)

    # 获取系统当前时间
    nowTimestamp = time.strftime('%Y-%m-%d %H-%M-%S',
                                 time.localtime(time.time()))
    # 获取设备属性
    da = get_device_attribute(data_for_networkTest.get('deviceNo'))
    # 修正时间
    correction_time = nowTimestamp[:-4] + str(int(nowTimestamp[-4]) + 1)

    if da.get('time', 'failed')[:-3] == nowTimestamp[:-3] or da.get(
            'time', 'failed')[:-3] == correction_time:
        if da.get('persist.net.type') == 'wifi' and da.get(
                'persist.net.dhcp') == 'true':
            to_log('WIFI+DHCP+USB打印网络配置测试Pass\n')
            to_log('配网方式:' + da.get('persist.net.type', ''))
            to_log('DHCP:' + da.get('persist.net.dhcp', ''))
            to_log('IP:' + da.get('sys.net.ip', ''))
            to_log('MAC:' + da.get('system.net.wifi.mac', '') + '\n')
        else:
            to_log('请检查断言参数\n')
Esempio n. 2
0
# coding=utf-8
import time
from to_log import to_log
from QRCodeOfNetworkConfig import lan_mode
from dmSupport import get_device_attribute
from configFile import data_for_networkTest, check_network_config_if_success

to_log('LAN+静态IP网络配置测试\n')

# 生成LAN+静态IP网络配置二维码
lan_mode(ip=data_for_networkTest.get('ip'),
         mask=data_for_networkTest.get('mask'),
         gw=data_for_networkTest.get('gw'),
         dns=data_for_networkTest.get('dns'))

# 配网时间
time.sleep(5)

if check_network_config_if_success(120):
    # 获取系统当前时间
    nowTimestamp = time.strftime('%Y-%m-%d %H-%M-%S',
                                 time.localtime(time.time()))

    # 获取设备属性
    da = get_device_attribute(data_for_networkTest.get('deviceNo'))
    # 修正时间
    correction_time = nowTimestamp[:-4] + str(int(nowTimestamp[-4]) + 1)

    if da.get('time', 'failed')[:-3] == nowTimestamp[:-3] or da.get(
            'time', 'failed')[:-3] == correction_time:
        if da.get('persist.net.type') == 'eth' and da.get(
# coding=utf-8
from dmSupport import *
from configFile import configuration, data_for_networkTest

custom_common_config_id = None
if 'testing' in configuration.get('dmServer', ''):
    custom_common_config_id = 106
elif 'preo' in configuration.get('dmServer', ''):
    custom_common_config_id = 90
else:
    custom_common_config_id = 90

device_info = get_device_info(data_for_networkTest.get('deviceNo', ''))

# 自定义通用配置参数下发
issue_user_defined_config(custom_common_config_id, device_info['id'],
                          device_info.get('serialNum', ''))