コード例 #1
0
def handle_flow_data_request(dbcc, msg):
    err.log_error(err.INFO, "Found a request for flow data")
    end_date_time = datetime.datetime.combine(msg.start_date, msg.start_time) + datetime.timedelta(seconds=msg.time_span)
    start_time_unix_ms = support.to_unix_timestamp_ms_from_date_and_time(msg.start_date, msg.start_time)
    stop_time_unix_ms = support.to_unix_timestamp_ms_from_date_and_time(end_date_time.date(), end_date_time.time())

    db_flow_data_objects = test_db_layout.MaaSFlowData.retrieve_flow_data(dbcc, msg.link_id, start_time_unix_ms, stop_time_unix_ms)

    err.log_error(err.INFO, "Sending " + str(len(db_flow_data_objects)) + " rows of flow data")

    return test_db_layout.MaaSFlowData.construct_maas_single_link_answer(msg.link_id, db_flow_data_objects)
コード例 #2
0
def test_to_unix_timestamp_ms_from_date_and_time():
    t = datetime.time(hour=12, minute=30, second=10, microsecond=6000)
    d = datetime.date(year=1991, month=10, day=17)

    unix_ms = support.to_unix_timestamp_ms_from_date_and_time(d, t)

    run_tests.compare_answer(unix_ms, 687702610006, "")
コード例 #3
0
ファイル: test_supplier.py プロジェクト: Cloudxtreme/mobaas
def handle_flow_data_request(dbcc, msg):
    err.log_error(err.INFO, "Found a request for flow data")
    end_date_time = datetime.datetime.combine(
        msg.start_date,
        msg.start_time) + datetime.timedelta(seconds=msg.time_span)
    start_time_unix_ms = support.to_unix_timestamp_ms_from_date_and_time(
        msg.start_date, msg.start_time)
    stop_time_unix_ms = support.to_unix_timestamp_ms_from_date_and_time(
        end_date_time.date(), end_date_time.time())

    db_flow_data_objects = test_db_layout.MaaSFlowData.retrieve_flow_data(
        dbcc, msg.link_id, start_time_unix_ms, stop_time_unix_ms)

    err.log_error(
        err.INFO,
        "Sending " + str(len(db_flow_data_objects)) + " rows of flow data")

    return test_db_layout.MaaSFlowData.construct_maas_single_link_answer(
        msg.link_id, db_flow_data_objects)