def generate_ios_info(): ios_info = IOSInfo() ios_info.udid = "test IOS" + formatdata.random_str(5) ios_info.openUdid = "test" + formatdata.random_str(6) ios_info.idfa = "test" + formatdata.random_str(5) ios_info.idfv = "test" + formatdata.random_str(5) ios_info.apn = formatdata.random_apn() return ios_info
def generate_pc_info(): pc_info = PcInfo() pc_info.pcDid = "test" + formatdata.random_str(5) pc_info.macAddress = formatdata.random_mac() pc_info.cpuType = "xxIntel MX" pc_info.memorySize = "100G" pc_info.hardDiskId = formatdata.random_str(32) pc_info.macAddress = formatdata.random_mac() pc_info.graphics = "xxGTX750Ti" return pc_info
def generate_instance_info(instance_id, status): data_info = BaseInfo() instance_info = BaseInfo() data_info.notifyType = "1" if status in ["01", "23", "31"]: instance_info.serviceId = instance_id instance_info.status = status data_info.sToken = formatdata.random_str(64) ip = "192.168.%s.%s" % (formatdata.random_int( 0, 249), formatdata.random_int(0, 249)) audio = "rtmp://%s1935/publishlive/mystreamaudio?st=%s" % ( ip, data_info.sToken) video = "rtmp://%s1935/publishlive/mystream?st=%s" % (ip, data_info.sToken) url = "ws://%s:7681/%s" % (ip, data_info.sToken) stream_info = BaseInfo() stream_info.audioUrl = audio stream_info.videoUrl = video input_info = BaseInfo() input_info.url = url instance_info.streamInfo = stream_info instance_info.inputInfo = input_info data_info.InstanceInfo = instance_info else: instance_info.serviceId = instance_id instance_info.status = status data_info.InstanceInfo = instance_info return data_info
def generate_android_info(): android_info = AndriodInfo() android_info.androidId = "Test android" + formatdata.random_str(5) android_info.macAddress = formatdata.random_mac() android_info.bluetoothMac = formatdata.random_mac() android_info.apn = formatdata.random_apn() android_info.phonenum = formatdata.random_phone_num() return android_info
def __init__(self, parallel_num, access_key='xiamatest', min_playtime=300000,max_playtime=360000): self.users = [] for i in range(parallel_num): userrequest = {} uid = access_key + formatdata.expand_int(i) utoken = formatdata.random_str(32) clouduser = CloudUser(uid, utoken, access_key) userrequest['user'] = clouduser # userrequest['package'] = common.random_str(40) userrequest['package'] = "com.jimei.xsanguo.haima" userrequest['priority'] = common.random_int(100, 10000) userrequest['playtime'] = common.random_int(min_playtime, max_playtime) userrequest['waiting'] = True #游戏overtime后,使用调用stop userrequest['intervel'] = max_playtime + 60000 self.user.append(userrequest)
def encrypt_cloud_request(context, secret_key): protocol_version = context.action.protocol.split(".")[0] action = context.action.actId if protocol_version >= "3" and action != ACTION_PAAS_CALLBACK: if action in [ACTION_GET_CLOUD_SERVICE, ACTION_STOP_CLOUD_SERVICE]: context.action.random = context.data.cid else: context.action.random = formatdata.random_str(16).lower() secret_key = __get_encrypt_key(context, secret_key) logger.debug("[request: %s]" % (context)) context.data = __encrypt(json.dumps(context.data), secret_key) if hasattr(context, 'client'): context.client = __encrypt(json.dumps(context.client), secret_key) if hasattr(context, 'device'): context.device = __encrypt(json.dumps(context.device), secret_key) else: logger.debug("[request: %s]" % (context)) return context
def generate_mac_info(): mac_info = MacInfo() mac_info.macDid = "Test Mac" + formatdata.random_str(5) mac_info.macAddress = formatdata.random_mac() return mac_info
def generate_web_info(): web_info = WebInfo() web_info.browserType = "Test Inc" web_info.platform = "Test Linux" web_info.userAgent = "Test Web" + formatdata.random_str(10) return web_info