Exemple #1
0
def _make_log_from_db_request(request: 'DBRequest') -> DPLog:  # noqa: F821
    fcc_id, network_id, serial_number = get_cbsd_basic_params(request.cbsd)
    return DPLog(
        log_from='DP',
        log_to='SAS',
        log_name=str(request.type.name),
        log_message=str(request.payload),
        cbsd_serial_number=str(serial_number),
        network_id=str(network_id),
        fcc_id=str(fcc_id),
    )
Exemple #2
0
def _make_dp_log_from_grpc_request(
        method_name: str,
        request: 'CBSDRequest',  # noqa: F821
        cbsd: 'DBCbsd',  # noqa: F821
):
    fcc_id, network_id, _ = get_cbsd_basic_params(cbsd)

    return DPLog(
        log_from='CBSD',
        log_to='DP',
        log_name=method_name + 'Request',
        log_message=str(request),
        cbsd_serial_number=str(request.serial_number),
        network_id=str(network_id),
        fcc_id=str(fcc_id),
    )
Exemple #3
0
def _make_dp_log_from_grpc_response(
    method_name: str,
    result: 'CBSDStateResult',  # noqa: F821
    cbsd: 'DBCbsd',  # noqa: F821
    serial_number: str,
):
    fcc_id, network_id, _ = get_cbsd_basic_params(cbsd)

    return DPLog(
        log_from='DP',
        log_to='CBSD',
        log_name=method_name + 'Response',
        log_message=str(result),
        cbsd_serial_number=str(serial_number),
        network_id=str(network_id),
        fcc_id=str(fcc_id),
    )
Exemple #4
0
def _make_log_from_db_response(response: 'DBResponse') -> DPLog:  # noqa: F821
    cbsd = response.request.cbsd
    fcc_id, network_id, serial_number = get_cbsd_basic_params(cbsd)
    log_name = request_response[response.request.type.name]
    response_code = response.payload.get(
        'response', {},
    ).get('responseCode', None)
    return DPLog(
        event_timestamp=now(),
        log_from='SAS',
        log_to='DP',
        log_name=str(log_name),
        log_message=str(response.payload),
        cbsd_serial_number=str(serial_number),
        network_id=str(network_id),
        fcc_id=str(fcc_id),
        response_code=response_code,
    )