'Check snmp v3 usm user invalid args'

def check_snmp_v3_usm_user_args(self, **kwargs):

    module = kwargs['module']
    result = dict()
    result['usm_user_info'] = []
    need_cfg = False
    state = module.params['state']
    usm_user_name = module.params['usm_user_name']
    remote_engine_id = module.params['remote_engine_id']
    acl_number = module.params['acl_number']
    user_group = module.params['user_group']
    auth_protocol = module.params['auth_protocol']
    auth_key = module.params['auth_key']
    priv_protocol = module.params['priv_protocol']
    priv_key = module.params['priv_key']
    local_user_name = module.params['aaa_local_user']
    if usm_user_name:
        if ((len(usm_user_name) > 32) or (len(usm_user_name) == 0)):
            module.fail_json(msg=('Error:    The    length    of    usm_user_name    %s    is    out    of    [1    -    32].' % usm_user_name))
        if remote_engine_id:
            if ((len(remote_engine_id) > 64) or (len(remote_engine_id) < 10)):
                module.fail_json(msg=('Error:    The    length    of    remote_engine_id    %s    is    out    of    [10    -    64].' % remote_engine_id))
        conf_str = CE_GET_SNMP_V3_USM_USER_HEADER
        if acl_number:
            if acl_number.isdigit():
                if ((int(acl_number) > 2999) or (int(acl_number) < 2000)):
                    module.fail_json(msg=('Error:    The    value    of    acl_number    %s    is    out    of    [2000    -    2999].' % acl_number))
            elif ((not acl_number[0].isalpha()) or (len(acl_number) > 32) or (len(acl_number) < 1)):
                module.fail_json(msg=('Error:    The    length    of    acl_number    %s    is    out    of    [1    -    32].' % acl_number))
            conf_str += '<aclNumber></aclNumber>'
        if user_group:
            if ((len(user_group) > 32) or (len(user_group) == 0)):
                module.fail_json(msg=('Error:    The    length    of    user_group    %s    is    out    of    [1    -    32].' % user_group))
            conf_str += '<groupName></groupName>'
        if auth_protocol:
            conf_str += '<authProtocol></authProtocol>'
        if auth_key:
            if ((len(auth_key) > 255) or (len(auth_key) == 0)):
                module.fail_json(msg=('Error:    The    length    of    auth_key    %s    is    out    of    [1    -    255].' % auth_key))
            conf_str += '<authKey></authKey>'
        if priv_protocol:
            if (not auth_protocol):
                module.fail_json(msg='Error:    Please    input    auth_protocol    at    the    same    time.')
            conf_str += '<privProtocol></privProtocol>'
        if priv_key:
            if ((len(priv_key) > 255) or (len(priv_key) == 0)):
                module.fail_json(msg=('Error:    The    length    of    priv_key    %s    is    out    of    [1    -    255].' % priv_key))
            conf_str += '<privKey></privKey>'
        conf_str += CE_GET_SNMP_V3_USM_USER_TAIL
        recv_xml = self.netconf_get_config(module=module, conf_str=conf_str)
        if ('<data/>' in recv_xml):
            if (state == 'present'):
                need_cfg = True
        else:
            xml_str = recv_xml.replace('\r', '').replace('\n', '').replace('xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"', '').replace('xmlns="http://www.huawei.com/netconf/vrp"', '')
            root = ElementTree.fromstring(xml_str)
            usm_user_info = root.findall('data/snmp/usmUsers/usmUser')
            if usm_user_info:
                for tmp in usm_user_info:
                    tmp_dict = dict()
                    for site in tmp:
                        if (site.tag in ['userName', 'remoteEngineID', 'engineID', 'groupName', 'authProtocol', 'authKey', 'privProtocol', 'privKey', 'aclNumber']):
                            tmp_dict[site.tag] = site.text
                    result['usm_user_info'].append(tmp_dict)
            if result['usm_user_info']:
                for tmp in result['usm_user_info']:
                    if ('userName' in tmp.keys()):
                        if (state == 'present'):
                            if (tmp['userName'] != usm_user_name):
                                need_cfg = True
                        elif (tmp['userName'] == usm_user_name):
                            need_cfg = True
                    if ('remoteEngineID' in tmp.keys()):
                        if remote_engine_id:
                            enable = 'true'
                        else:
                            enable = 'false'
                        if (state == 'present'):
                            if (tmp['remoteEngineID'] != enable):
                                need_cfg = True
                        elif (tmp['remoteEngineID'] == enable):
                            need_cfg = True
                    if remote_engine_id:
                        if ('engineID' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['engineID'] != remote_engine_id):
                                    need_cfg = True
                            elif (tmp['engineID'] == remote_engine_id):
                                need_cfg = True
                    if user_group:
                        if ('groupName' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['groupName'] != user_group):
                                    need_cfg = True
                            elif (tmp['groupName'] == user_group):
                                need_cfg = True
                    if auth_protocol:
                        if ('authProtocol' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['authProtocol'] != auth_protocol):
                                    need_cfg = True
                            elif (tmp['authProtocol'] == auth_protocol):
                                need_cfg = True
                    if auth_key:
                        if ('authKey' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['authKey'] != auth_key):
                                    need_cfg = True
                            elif (tmp['authKey'] == auth_key):
                                need_cfg = True
                    if priv_protocol:
                        if ('privProtocol' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['privProtocol'] != priv_protocol):
                                    need_cfg = True
                            elif (tmp['privProtocol'] == priv_protocol):
                                need_cfg = True
                    if priv_key:
                        if ('privKey' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['privKey'] != priv_key):
                                    need_cfg = True
                            elif (tmp['privKey'] == priv_key):
                                need_cfg = True
                    if acl_number:
                        if ('aclNumber' in tmp.keys()):
                            if (state == 'present'):
                                if (tmp['aclNumber'] != acl_number):
                                    need_cfg = True
                            elif (tmp['aclNumber'] == acl_number):
                                need_cfg = True
    result['need_cfg'] = need_cfg
    return result
