예제 #1
0
def registration_list(ctx, config, statsd, logger, run_id, conn, metadata_conn,
                      command, metrics_root, metrics_run_root, input_file,
                      disable_historic_check, delta, disable_delta_adds_check,
                      disable_delta_removes_check,
                      disable_delta_updates_check):
    """Import the Registration list data found in INPUT into the PostgreSQL database."""
    params = _common_import_params(ctx)
    reg_tc = config.import_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'delta':
        delta,
        'perform_delta_adds_check':
        not disable_delta_adds_check,
        'perform_delta_removes_check':
        not disable_delta_removes_check,
        'import_size_variation_percent':
        reg_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        reg_tc.import_size_variation_absolute,
        'perform_delta_updates_check':
        not disable_delta_updates_check
    })
    with importer_factory.make_data_importer('registration_list', input_file,
                                             config, statsd, conn,
                                             metadata_conn, run_id,
                                             metrics_root, metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #2
0
def golden_list(ctx, config, statsd, logger, run_id, conn, metadata_conn,
                command, metrics_root, metrics_run_root, input_file,
                pre_hashed, disable_historic_check, delta,
                disable_delta_adds_check, disable_delta_removes_check,
                disable_delta_updates_check):
    """Import the Golden list data found in INPUT into the PostgreSQL database.

    NOTE: Use caution when adding entries to the Golden list, as any IMEIs added to this list will never be blocked.
    """
    params = _common_import_params(ctx)
    golden_tc = config.golden_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'prehashed_input_data':
        pre_hashed,
        'delta':
        delta,
        'perform_delta_adds_check':
        not disable_delta_adds_check,
        'perform_delta_removes_check':
        not disable_delta_removes_check,
        'import_size_variation_percent':
        golden_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        golden_tc.import_size_variation_absolute,
        'perform_delta_updates_check':
        not disable_delta_updates_check
    })
    with importer_factory.make_data_importer('golden_list', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #3
0
def gsma_tac(ctx, config, statsd, logger, run_id, conn, metadata_conn, command,
             metrics_root, metrics_run_root, input_file,
             disable_historic_check):
    """
    Import the GSMA TAC DB data found in INPUT into the PostgreSQL database.

    :param ctx: current cli context obj
    :param config: dirbs config obj
    :param statsd: statsd obj
    :param logger: dirbs logger obj
    :param run_id: job run id
    :param conn: database connection
    :param metadata_conn: metadata db connection
    :param command: command name
    :param metrics_root:
    :param metrics_run_root:
    :param input_file: input file path
    :param disable_historic_check: historic check flag
    """
    params = _common_import_params(ctx)
    gsma_tc = config.gsma_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'import_size_variation_percent':
        gsma_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        gsma_tc.import_size_variation_absolute
    })
    with importer_factory.make_data_importer('gsma_tac', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #4
0
def device_association_list(
        ctx, config, statsd, logger, run_id, conn, metadata_conn, command,
        metrics_root, metrics_run_root, input_file, disable_historic_check,
        delta, disable_delta_adds_check, disable_delta_removes_check,
        disable_delta_updates_check):
    """Import the Device Association List data found in INPUT file."""
    params = _common_import_params(ctx)
    associations_tc = config.associations_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'delta':
        delta,
        'perform_delta_adds_check':
        not disable_delta_adds_check,
        'perform_delta_removes_check':
        not disable_delta_removes_check,
        'import_size_variation_percent':
        associations_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        associations_tc.import_size_variation_absolute,
        'perform_delta_updates_check':
        not disable_delta_updates_check
    })

    with importer_factory.make_data_importer('device_association_list',
                                             input_file, config, statsd, conn,
                                             metadata_conn, run_id,
                                             metrics_root, metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #5
0
def golden_list(ctx, config, statsd, logger, run_id, conn, metadata_conn,
                command, metrics_root, metrics_run_root, input_file,
                pre_hashed, disable_historic_check, delta,
                disable_delta_adds_check, disable_delta_removes_check,
                disable_delta_updates_check):
    """
    Import the Golden list data found in INPUT into the PostgreSQL database.

    NOTE: Use caution when adding entries to the Golden list, as any IMEIs added to this list will never be blocked.

    :param ctx: current cli context obj
    :param config: dirbs config obj
    :param statsd: statsd obj
    :param logger: dirbs logger obj
    :param run_id: job run id
    :param conn: database connection
    :param metadata_conn: database connection for metadata
    :param command: command name
    :param metrics_root:
    :param metrics_run_root:
    :param input_file: input file path
    :param pre_hashed: pre hashed flag
    :param disable_historic_check: historic check flag
    :param delta: delta file flag
    :param disable_delta_adds_check: delta adds check flag
    :param disable_delta_removes_check: delta removes check flag
    :param disable_delta_updates_check: delta updates check flag
    """
    params = _common_import_params(ctx)
    golden_tc = config.golden_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'prehashed_input_data':
        pre_hashed,
        'delta':
        delta,
        'perform_delta_adds_check':
        not disable_delta_adds_check,
        'perform_delta_removes_check':
        not disable_delta_removes_check,
        'import_size_variation_percent':
        golden_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        golden_tc.import_size_variation_absolute,
        'perform_delta_updates_check':
        not disable_delta_updates_check
    })
    with importer_factory.make_data_importer('golden_list', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #6
0
def registration_list(ctx, config, statsd, logger, run_id, conn, metadata_conn,
                      command, metrics_root, metrics_run_root, input_file,
                      disable_historic_check, delta, disable_delta_adds_check,
                      disable_delta_removes_check,
                      disable_delta_updates_check):
    """Import the Registration list data found in INPUT into the PostgreSQL database.

    :param ctx: current cli context obj
    :param config: dirbs config obj
    :param statsd: statsd obj
    :param logger: dirbs logger obj
    :param run_id: job run id
    :param conn: database connection
    :param metadata_conn: database connection for metadata
    :param command: command name
    :param metrics_root:
    :param metrics_run_root:
    :param input_file: input file path
    :param disable_historic_check: historic check flag
    :param delta: delta file check
    :param disable_delta_adds_check: delta adds check flag
    :param disable_delta_removes_check: delta removes check flag
    :param disable_delta_updates_check: delta updates check flag
    """
    params = _common_import_params(ctx)
    reg_tc = config.import_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'delta':
        delta,
        'perform_delta_adds_check':
        not disable_delta_adds_check,
        'perform_delta_removes_check':
        not disable_delta_removes_check,
        'import_size_variation_percent':
        reg_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        reg_tc.import_size_variation_absolute,
        'perform_delta_updates_check':
        not disable_delta_updates_check
    })
    with importer_factory.make_data_importer('registration_list', input_file,
                                             config, statsd, conn,
                                             metadata_conn, run_id,
                                             metrics_root, metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #7
0
def operator(ctx, config, statsd, logger, run_id, conn, metadata_conn, command,
             metrics_root, metrics_run_root, operator_id, input_file,
             disable_leading_zero_check, disable_null_check,
             disable_clean_check, disable_region_check, disable_home_check,
             disable_historic_check):
    """Import the CSV operator data found in INPUT into the PostgreSQL database.

    OPERATOR_ID is an ID up to 16 characters to unique identify the operator.
    """
    op_tc = config.operator_threshold_config
    params = _common_import_params(ctx)
    params.update({
        'operator_id': operator_id,
        'null_imei_threshold': op_tc.null_imei_threshold,
        'null_imsi_threshold': op_tc.null_imsi_threshold,
        'null_msisdn_threshold': op_tc.null_msisdn_threshold,
        'null_rat_threshold': op_tc.null_rat_threshold,
        'null_threshold': op_tc.null_threshold,
        'unclean_imei_threshold': op_tc.unclean_imei_threshold,
        'unclean_imsi_threshold': op_tc.unclean_imsi_threshold,
        'unclean_threshold': op_tc.unclean_threshold,
        'out_of_region_imsi_threshold': op_tc.out_of_region_imsi_threshold,
        'out_of_region_msisdn_threshold': op_tc.out_of_region_msisdn_threshold,
        'out_of_region_threshold': op_tc.out_of_region_threshold,
        'non_home_network_threshold': op_tc.non_home_network_threshold,
        'historic_imei_threshold': op_tc.historic_imei_threshold,
        'historic_imsi_threshold': op_tc.historic_imsi_threshold,
        'historic_msisdn_threshold': op_tc.historic_msisdn_threshold,
        'perform_msisdn_import': config.region_config.import_msisdn_data,
        'perform_rat_import': config.region_config.import_rat_data,
        'perform_leading_zero_check': not disable_leading_zero_check,
        'perform_null_checks': not disable_null_check,
        'perform_unclean_checks': not disable_clean_check,
        'perform_region_checks': not disable_region_check,
        'perform_home_network_check': not disable_home_check,
        'perform_historic_checks': not disable_historic_check
    })
    with importer_factory.make_data_importer('operator', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #8
0
def gsma_tac(ctx, config, statsd, logger, run_id, conn, metadata_conn, command,
             metrics_root, metrics_run_root, input_file,
             disable_historic_check):
    """Import the GSMA TAC DB data found in INPUT into the PostgreSQL database."""
    params = _common_import_params(ctx)
    gsma_tc = config.gsma_threshold_config
    params.update({
        'perform_historic_check':
        not disable_historic_check,
        'import_size_variation_percent':
        gsma_tc.import_size_variation_percent,
        'import_size_variation_absolute':
        gsma_tc.import_size_variation_absolute
    })
    with importer_factory.make_data_importer('gsma_tac', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()
예제 #9
0
def operator(ctx, config, statsd, logger, run_id, conn, metadata_conn, command,
             metrics_root, metrics_run_root, operator_id, input_file,
             disable_leading_zero_check, disable_null_check,
             disable_clean_check, disable_region_check, disable_home_check,
             disable_historic_check):
    """
    Import the CSV operator data found in INPUT into the PostgreSQL database.

    OPERATOR_ID is an ID up to 16 characters to unique identify the operator.

    :param ctx: current cli context obj
    :param config: dirbs config obj
    :param statsd: statsd obj
    :param logger: dirbs logger obj
    :param run_id: job run id
    :param conn: database connection
    :param metadata_conn: database metadata connection
    :param command: command name
    :param metrics_root:
    :param metrics_run_root:
    :param operator_id: operator id
    :param input_file: input file name/path
    :param disable_leading_zero_check: leading zero check flag
    :param disable_null_check: null check flag
    :param disable_clean_check: clean check flag
    :param disable_region_check: region check flag
    :param disable_home_check: home check flag
    :param disable_historic_check: historic check flag
    """
    op_tc = config.operator_threshold_config
    params = _common_import_params(ctx)
    params.update({
        'operator_id': operator_id,
        'null_imei_threshold': op_tc.null_imei_threshold,
        'null_imsi_threshold': op_tc.null_imsi_threshold,
        'null_msisdn_threshold': op_tc.null_msisdn_threshold,
        'null_rat_threshold': op_tc.null_rat_threshold,
        'null_threshold': op_tc.null_threshold,
        'unclean_imei_threshold': op_tc.unclean_imei_threshold,
        'unclean_imsi_threshold': op_tc.unclean_imsi_threshold,
        'unclean_threshold': op_tc.unclean_threshold,
        'out_of_region_imsi_threshold': op_tc.out_of_region_imsi_threshold,
        'out_of_region_msisdn_threshold': op_tc.out_of_region_msisdn_threshold,
        'out_of_region_threshold': op_tc.out_of_region_threshold,
        'non_home_network_threshold': op_tc.non_home_network_threshold,
        'historic_imei_threshold': op_tc.historic_imei_threshold,
        'historic_imsi_threshold': op_tc.historic_imsi_threshold,
        'historic_msisdn_threshold': op_tc.historic_msisdn_threshold,
        'perform_msisdn_import': config.region_config.import_msisdn_data,
        'perform_rat_import': config.region_config.import_rat_data,
        'perform_leading_zero_check': not disable_leading_zero_check,
        'perform_null_checks': not disable_null_check,
        'perform_unclean_checks': not disable_clean_check,
        'perform_region_checks': not disable_region_check,
        'perform_home_network_check': not disable_home_check,
        'perform_historic_checks': not disable_historic_check
    })
    with importer_factory.make_data_importer('operator', input_file, config,
                                             statsd, conn, metadata_conn,
                                             run_id, metrics_root,
                                             metrics_run_root,
                                             **params) as importer:
        importer.import_data()