Ejemplo n.º 1
0
def ev_vrs_update_user_info(data):
    '''
    更新直播用户信息
    {
        "eventid":"EV_VRS_UPDATE_USER_INFO",
        "devid":"1111"
        "devtype":"vrs",
        "rpttime":"2014/06/16:09:57:50",
        "update_user_info":
        {
            "conf_e164":”1230209”, // 会议E164号
            "user_e164":"ter_a_e164", // 用户E164号码,有就填,否则设置为 ""
            "user_moid":"ter_a_moid", // 用户moid,非游客必填,游客为 ""
            "user_name":"ter_a_name", // 用户名称,必填
            "change_time":"2018/2/8 09:20:00", //更新时间
            "user_state":1 //用户状态,0-下线 1-上线
        }
    }
    '''
    r = nms_redis.ev_vrs_update_user_info(
        data['update_user_info'].get('user_moid', str(uuid.uuid1())),
        data['update_user_info']['conf_e164'],
        data['update_user_info'].get('user_e164', ''),
        data['update_user_info']['user_name'],
        data['update_user_info']['change_time'],
        data['update_user_info']['user_state'])
    if r:
        mysql_write_thread.push((nms_mysql.add_live_user_info, r))
Ejemplo n.º 2
0
def del_old_terminal(data):
    '''
    {
        "operation": "del_old_terminal",       // 操作类型说明字符串
        "moid": "1.2.1",              		// 老终端的moid
    }
    '''
    nms_redis.del_old_terminal(data['moid'])
    mysql_write_thread.push((nms_mysql.del_old_terminal, data['moid']))
Ejemplo n.º 3
0
def add_terminal_statistic(info, meeting_moid, meeting_moid_map):
    mttype = info['mttype']
    # 下级级联
    if mttype == MT_TYPE_SSMMCU or mttype == MT_TYPE_CSMMCU:
        mysql_write_thread.push((nms_mysql.add_meeting_meeting_statistic, {
            'meeting_moid':
            meeting_moid,
            'attend_meeting_moid':
            meeting_moid_map.get(info['mtaccount'], ''),
            'attend_conf_e164':
            info['mtaccount'],
            'attend_start_time':
            info['begintime'],
            'attend_conf_name':
            info.get('mtname', ''),
            'cascade_type':
            'down_meeting'
        }))

    # 普通终端
    elif mttype == MT_TYPE_MT:
        mysql_write_thread.push((nms_mysql.add_ip_e164_meeting_statistic, {
            'meeting_moid': meeting_moid,
            'ip_e164': info['mtaccount'],
            'name': info.get('mtname', '')
        }))

    # 上级级联
    elif mttype == MT_TYPE_MMMCU:
        mysql_write_thread.push((nms_mysql.add_meeting_meeting_statistic, {
            'meeting_moid': meeting_moid,
            'attend_conf_e164': info['mtaccount'],
            'attend_start_time': info['begintime'],
            'attend_conf_name': info.get('mtname', ''),
            'cascade_type': 'up_meeting'
        }))

    # 电话
    elif mttype == MT_TYPE_PHONE:
        mysql_write_thread.push((nms_mysql.add_tel_meeting_statistic, {
            'meeting_moid': meeting_moid,
            'tel_number': info['mtaccount']
        }))

    # ipc
    elif mttype == MT_TYPE_IPC:
        mysql_write_thread.push((nms_mysql.add_ipc_meeting_statistic, {
            'meeting_moid': meeting_moid,
            'ipc_e164': info['mtaccount'],
            'ipc_ip': info.get('mtip', '')
        }))
    elif mttype == MT_TYPE_SATD:
        pass
    elif mttype == MT_TYPE_VRSREC:
        pass
Ejemplo n.º 4
0
def ev_pas_p2pconf_destroy(data):
    '''
    点对点会议销毁
    {
        "eventid": "EV_PAS_P2PCONF_DESTROY",
        "devid": "1111",
        "devtype": "pas",
        "rpttime": "2014/06/16:09:57:50",
        "confinfo": {
                "callerE164": "051255566", // 主叫方终端E164号码
                "calleeE164": "051255567" // 被叫方终端E164号码
        }
    }
    '''
    r = nms_redis.ev_pas_p2pconf_destroy(data['devid'],
                                         data['confinfo']['callerE164'],
                                         data['confinfo']['calleeE164'],
                                         data['rpttime'])
    if r:
        mysql_write_thread.push(
            (nms_mysql.add_p2p_meeting_statistic, r['meeting_info']))
        for info in r['terminal_info'].values():
            mysql_write_thread.push(
                (nms_mysql.add_meeting_terminal_detail_statistic,
                 info['terminal_detail']))
            for privideo in info['privideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_privideo, privideo))
            for assvideo in info['assvideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_assvideo, assvideo))
Ejemplo n.º 5
0
def ev_dev_offline(data):
    '''
    {
        "eventid": "EV_DEV_OFFLINE",
        "devid": "1111",
        "devtype": "SERVICE_TS_SRV_MPCD",
        "collectorid": "60a44c502a60"
    }
    '''
    r = nms_redis.ev_dev_offline_t48(data['devid'], data['collectorid'])
    if r is None:
        return
    warning_handler(r['collector_p_server_moid'], r['warning_trigger_flag'],
                    2016, data['rpttime'], 'p_server', **r)
    # 48终端上线状态
    mysql_write_thread.push((nms_mysql.offline_old_terminal, data['devid']))
Ejemplo n.º 6
0
def ev_conf_entity(data):
    '''
    实体会议
    {
        "eventid": "EV_CONF_ENTITY",
        "userDomainMoid": "xxxxxxxxxx", //用户域moid
        "operation": "delete", //取值delete/add/update,
        "conf": {
            "id": 111, //会议id
            // "confe164": "05551234567", //会议e164号
            "subject": 5, //会议主题
            "organizerMoid": "xxxxxxxxx", //会议组织者moid
            "startTime": "2018/06/02 09:18:03", //会议开始时间
            "endTime": "2018/06/02 10:18:03", //会议结束时间
            "regularId": 123, //所属例会
            "isVideoMeeting": 0, //是否是视频会议,1-是,0-否
            "creator": "李四", //创会人
            "mobile": "0551234567", //座机
            "telephone": "1555555553", //手机
            "meetingType": 0, //是否例会,0-单次例会,1-例会
            "lastModifyTime": "2018/06/01 09:18:03", //最后更新时间
            // "meetingResourceVO": {
            //     "id": 123, //会议室规模或类型id
            //     "name": "Hello", //名称
            //     "key": "xxxx", //映射key
            //     "multi": 8, //方数
            //     "resolution": "1080P", //分辨率
            //     "totalCount": 10, //总数
            //     "usedCount": 3 //已使用
            // },
            "rooms": [
                {
                    "id": 111, //会议室id
                    "name": "DDD" //会议室名称
                }
            ]
        }
    }
    '''
    r = nms_redis.ev_conf_entity(data.get('userDomainMoid', ''), data['conf'],
                                 ['id'], data['operation'],
                                 data['conf'].get('startTime', ''),
                                 data['conf'].get('endTime', ''),
                                 json.dumps(data['conf']))
    if r and data['operation'] == 'delete':
        r['domain_moid'] = data['userDomainMoid']
        mysql_write_thread.push((nms_mysql.add_multi_meeting_statistic, r))
Ejemplo n.º 7
0
def warning_repair(device_moid, code, resolve_time, server_type):
    '''
    告警修复流程
    '''
    # mysql
    if server_type == 'terminal':
        mysql_write_thread.push((nms_mysql.add_terminal_warning_repaired, {
            'device_moid': device_moid,
            'code': code,
            'resolve_time': resolve_time
        }))
    else:
        mysql_write_thread.push((nms_mysql.add_server_warning_repaired, {
            'device_moid': device_moid,
            'code': code,
            'resolve_time': resolve_time
        }))
    # redis
    nms_redis.del_warning_unrepaired(server_type, device_moid, code)
Ejemplo n.º 8
0
def warning_trigger(start_time, server_type, server_info, warning_info,
                    extra_info):
    '''
    产生告警流程
    '''
    # mysql
    if server_type == 'terminal':
        mysql_write_thread.push((nms_mysql.add_terminal_warning_unrepaired, {
            'device_moid': server_info.get('moid'),
            'device_name': server_info.get('name'),
            'device_type': extra_info.get('device_type'),
            'device_ip': server_info.get('device_ip'),
            'device_e164': server_info.get('e164'),
            'domain_moid': server_info.get('domain_moid'),
            'domain_name': server_info.get('domain_name'),
            'start_time': start_time,
            **warning_info
        }))
    else:
        mysql_write_thread.push((nms_mysql.add_server_warning_unrepaired, {
            'device_moid':
            server_info.get('moid'),
            'device_name':
            server_info.get('name'),
            'device_type':
            server_info.get('type'),
            'device_ip':
            server_info.get('ip'),
            'machine_room_moid':
            server_info.get('machine_room_moid'),
            'machine_room_name':
            server_info.get('machine_room_name'),
            'start_time':
            start_time,
            'server_type':
            0 if server_type == 'p_server' else 1,
            **warning_info
        }))

    # redis
    nms_redis.add_warning_unrepaired(server_type, server_info['moid'],
                                     warning_info['code'],
                                     warning_info['level'])
Ejemplo n.º 9
0
def ev_dcs_mode_switch(data):
    '''
    模式切换消息
    {
        "eventid":"EV_DCS_MODE_SWITCH",
        "devid":"1111"
        "devtype":"dcs",
        "rpttime":"2014/06/16:09:57:50",
        "dcsmode":
        {
            "conftype":1, //会议类型(1-多点会议,0-点对点会议)
            "dcsmode":0, //DCS模式, 0-自由模式/1-管理方模式
            "confe164":"1230209" //终端所属会议的E164号
        }
    }
    '''
    r = nms_redis.ev_dcs_mode_switch(data['dcsmode']['confe164'],
                                     data['dcsmode']['dcsmode'])
    if r:
        mysql_write_thread.push((nms_mysql.add_dcs_mode_change_recode, r))
Ejemplo n.º 10
0
def ev_vrs_destroy_live_info(data):
    '''
    直播结束消息
    {
        "eventid":"EV_VRS_DESTROY_LIVE_INFO",
        "devid":"1111"
        "devtype":"vrs",
        "rpttime":"2014/06/16:09:57:50",
        "destroy_live_info":
        {
            "conf_e164":"1230209", // 会议E164号
            "end_time":"2018/2/8 09:20:00"  //结束时间
        }
    }
    '''
    r = nms_redis.ev_vrs_destroy_live_info(
        data['devid'], data['destroy_live_info']['conf_e164'],
        data['destroy_live_info']['end_time'])
    mysql_write_thread.push((nms_mysql.add_live_info, r['live_info']))
    for info in r['live_users']:
        mysql_write_thread.push((nms_mysql.add_live_user_info, info))
Ejemplo n.º 11
0
def ev_dcs_destroy_conf_info(data):
    '''
    数据会议结束消息
    {
        "eventid":"EV_DCS_DESTROY_CONF_INFO",
        "devid":"1111"
        "devtype":"dcs",
        "rpttime":"2014/06/16:09:57:50",
        "delconf":
        {
            "confe164":"1230209", //会议E164号码
            "conftype":1, //会议类型(1-多点会议,0-点对点会议)
            "endtime":"2018/2/8 09:20:00" //会议结束时间
        }
    }
    '''
    r = nms_redis.ev_dcs_destroy_conf_info(data['delconf']['confe164'],
                                           data['delconf']['endtime'])
    if r:
        for terminal_info in r['terminals']:
            mysql_write_thread.push(
                (nms_mysql.add_terminal_info_for_dcs, terminal_info))
        mysql_write_thread.push(
            (nms_mysql.add_meeting_dcs_info, r['dcs_info']))
        mysql_write_thread.push(
            (nms_mysql.add_dcs_mode_change_recode, r['mode_recode']))
Ejemplo n.º 12
0
def add_old_terminal(data):
    '''
    {
        "operation": "add_old_terminal",       // 操作类型说明字符串
        "moid": "1.2.1",              		// 老终端的moid
        "domainMoid": "1.2",         		// 老终端所属用户域的moid
        "name": "张三",              		// 老终端的名称
        "e164": "1230456044",  // 老终端的E164号
        "ip": "172.16.80.236",  // 老终端的IP地址
    }
    '''
    nms_redis.add_old_terminal(
        data['moid'], data['domainMoid'], data.get(
            'name', ''), data('e164', ''), data.get('ip', '')
    )
    mysql_write_thread.push((nms_mysql.add_old_terminal, {
        'moid': data['moid'],
        'user_domain_moid': data['domainMoid'],
        'name': data.get('name'),
        'e164': data.get('e164'),
        'ip': data.get('ip')
    }))
Ejemplo n.º 13
0
def ev_dcs_conf_mt_del_info(data):
    '''
    删除数据会议终端消息
    {
        "eventid":"EV_DCS_CONF_MT_DEL_INFO",
        "devid":"1111"
        "devtype":"dcs",
        "rpttime":"2014/06/16:09:57:50",
        "delmt":
        {
            "mtaccount":"05121118883", //终端e164号码
            "confe164":"1230209", //终端所属会议的E164号
            "conftype":1, //会议类型(1-多点会议,0-点对点会议)
            "deltime":"2018/2/8 09:20:00",//终端删除时间
        }
    }
    '''
    r = nms_redis.ev_dcs_conf_mt_del_info(data['delmt']['confe164'],
                                          data['delmt']['mtaccount'],
                                          data['delmt']['deltime'])
    if r:
        mysql_write_thread.push((nms_mysql.add_terminal_info_for_dcs, r))
Ejemplo n.º 14
0
def ev_dcs_coop_state_change_info(data):
    '''
    终端协作状态改变消息
    {
        "eventid": "EV_DCS_COOP_STATE_CHANGE_INFO",
        "devid": "1111"
        "devtype": "dcs",
        "rpttime": "2014/06/16:09:57:50",
        "coopstate":
        {
            "mtaccount": "05121118883", // 终端e164号码
            "confe164": "1230209", // 终端所属会议的E164号
            "conftype": 1, // 会议类型(1-多点会议,0-点对点会议)
            "changetime": "2018/2/8 09:20:00", // 状态改变时间
            "coopstate": 0//终端协作状态0-未参与协作, 1-参与协作
        }
    }
    '''
    r = nms_redis.ev_dcs_coop_state_change_info(
        data['coopstate']['confe164'], data['coopstate']['mtaccount'],
        data['coopstate']['changetime'], data['coopstate']['coopstate'])
    if r:
        mysql_write_thread.push((nms_mysql.add_terminal_info_for_dcs, r))
Ejemplo n.º 15
0
def ev_mcu_mt_del(data):
    '''
    终端离会
    {
        "eventid": "EV_MCU_MT_DEL",
        "devid": "1111"
        "devtype": "cmu",
        "rpttime": "2014/06/16:09:57:50",
        "mtinfo":
        {
            "confe164": "0513**77", // 会议E164号
            "conftype": 1, // 会议类型(0: 传统会议 1: 端口会议)
            "mttype": 2, // 终端设备类型
            "mtaccount": "05121111888", // 终端账号
            # //普通终端就是e164号码
            # // 电话终端就是电话号码
            # // 级联会议就是会议e164号
            "mtip": "1.1.1.1",
            "endtime": "2014/06/16:10:57:50"
            "leavereason": 1 // 离会原因
        }
    }
    '''
    e164_or_ip = data['mtinfo'].get('mtaccount') if data['mtinfo'].get(
        'mtaccount', '') else data['mtinfo'].get('mtip', '')
    if e164_or_ip:
        r = nms_redis.del_meeting_terminal(data['mtinfo']['confe164'],
                                           data['mtinfo']['endtime'],
                                           e164_or_ip,
                                           data['mtinfo']['leavereason'])
        if r:
            mysql_write_thread.push(
                (nms_mysql.add_meeting_terminal_detail_statistic,
                 r['terminal_detail']))
            for privideo in r['privideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_privideo, privideo))
            for assvideo in r['assvideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_assvideo, assvideo))
Ejemplo n.º 16
0
def ev_mcu_conf_destroy(data):
    '''
    结会消息
    {
        "eventid": "EV_MCU_CONF_DESTROY",
        "devid": "1111"
        "devtype": "cmu",
        "rpttime": "2014/06/16:09:57:50",
        "confinfo":
        {
            "confe164": "0513**77", // 会议E164号
            "endtime": "2014/06/16:10:57:50",
            "conftype": 1 // 会议类型(0: 传统会议 1: 端口会议)
        }
    }
    '''
    # 统计会议信息
    # 统计终端信息
    # 清除会议相关信息
    terminal_info_list = nms_redis.del_meeting_terminal(
        data['confinfo']['confe164'], data['rpttime'])

    r = nms_redis.ev_mcu_conf_destroy(data['confinfo']['confe164'],
                                      data['confinfo']['endtime'])

    # 会议信息
    if r.get('meeting_info'):
        mysql_write_thread.push(
            (nms_mysql.add_multi_meeting_statistic, r['meeting_info']))
    else:
        logger.error('ev_mcu_conf_destroy: lost meeting info')

    # 离会原因
    if r.get('leave_reason'):
        for info in r['leave_reason']:
            mysql_write_thread.push(
                (nms_mysql.add_terminal_leave_meeting_reason, info))

    # 终端会议评分记录
    if r.get('score_info'):
        for info in r['score_info']:
            mysql_write_thread.push(
                (nms_mysql.add_terminal_meeting_socre, info))

    # 终端信息
    for terminal_info in terminal_info_list:
        if terminal_info:
            mysql_write_thread.push(
                (nms_mysql.add_meeting_terminal_detail_statistic,
                 terminal_info['terminal_detail']))
            for privideo in terminal_info['privideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_privideo, privideo))
            for assvideo in terminal_info['assvideo']:
                mysql_write_thread.push(
                    (nms_mysql.add_terminal_meeting_assvideo, assvideo))