예제 #1
0
def main():
    parser = create_parser()

    # Parse the args
    args = parser.parse_args()
    if not args.cmd:
        parser.print_usage()
        exit(1)

    print('Preparing %s load test...' % args.cmd)
    client = MobilityServiceStub(
        ServiceRegistry.get_rpc_channel(
            MOBILITYD_SERVICE_NAME,
            ServiceRegistry.LOCAL,
        ), )

    if args.cmd == 'allocate':
        _cleanup_subs()
        _setup_ip_block(client)
        input_file = 'allocate_data.json'
        request_type = 'AllocateIPAddress'
        _build_allocate_ip_data(args.num, input_file)
        benchmark_grpc_request(
            proto_path=PROTO_PATH,
            full_request_type=make_full_request_type(
                MOBILITYD_SERVICE_RPC_PATH,
                request_type,
            ),
            input_file=input_file,
            output_file=make_output_file_path(request_type),
            num_reqs=args.num,
            address=MOBILITYD_PORT,
            import_path=args.import_path,
        )
        _cleanup_subs()

    elif args.cmd == 'release':
        input_file = 'release_data.json'
        request_type = 'ReleaseIPAddress'
        _build_release_ip_data(client, input_file)
        benchmark_grpc_request(
            proto_path=PROTO_PATH,
            full_request_type=make_full_request_type(
                MOBILITYD_SERVICE_RPC_PATH,
                request_type,
            ),
            input_file=input_file,
            output_file=make_output_file_path(request_type),
            num_reqs=args.num,
            address=MOBILITYD_PORT,
            import_path=args.import_path,
        )

    print('Done')
예제 #2
0
def main():
    parser = create_parser()

    # Parse the args
    args = parser.parse_args()
    if not args.cmd:
        parser.print_usage()
        exit(1)

    print('Preparing %s load test...' % args.cmd)
    if args.cmd == 'add':
        _cleanup_subs()
        input_file = 'add_subs.json'
        request_type = 'AddSubscriber'
        _build_add_subs_data(args.num, input_file)

    if args.cmd == 'list':
        _cleanup_subs()
        input_file = 'list_subs.json'
        request_type = 'ListSubscribers'
        _build_list_subs_data(args.num, input_file)

    if args.cmd == 'delete':
        _cleanup_subs()
        input_file = 'delete_subs.json'
        request_type = 'DeleteSubscriber'
        _build_delete_subs_data(args.num, input_file)

    if args.cmd == 'get':
        _cleanup_subs()
        input_file = 'get_subs.json'
        request_type = 'GetSubscriberData'
        _build_get_subs_data(args.num, input_file)

    if args.cmd == 'update':
        _cleanup_subs()
        input_file = 'update_subs.json'
        request_type = 'UpdateSubscriber'
        _build_update_subs_data(args.num, input_file)

    benchmark_grpc_request(
        proto_path=PROTO_PATH,
        full_request_type=make_full_request_type(
            SUBSCRIBERDB_SERVICE_RPC_PATH,
            request_type,
        ),
        input_file=input_file,
        output_file=make_output_file_path(request_type),
        num_reqs=args.num,
        address=SUBSCRIBERDB_PORT,
        import_path=args.import_path,
    )
    _cleanup_subs()

    print('Done')
예제 #3
0
def _handle_end_session_benchmarking(subs: List[SubscriberID]):
    _build_end_session_data(subs)
    request_type = 'EndSession'
    benchmark_grpc_request(
        PROTO_PATH,
        make_full_request_type(SERVICE_NAME, request_type),
        END_SESSION_FILENAME,
        make_output_file_path(request_type),
        len(subs),
        SESSIOND_PORT,
    )
예제 #4
0
def _handle_create_session_benchmarking(subs: List[SubscriberID],
                                        import_path: str = None):
    _build_create_session_data(subs)
    request_type = 'CreateSession'
    benchmark_grpc_request(
        PROTO_PATH,
        make_full_request_type(SERVICE_NAME, request_type),
        CREATE_SESSION_FILENAME,
        make_output_file_path(request_type),
        len(subs),
        SESSIOND_PORT,
        import_path=import_path,
    )
예제 #5
0
def update_record_test(args):
    input_file = 'update_record.json'
    _build_update_records_data(args.num_of_requests, input_file)
    request_type = 'UpdateRecord'
    benchmark_grpc_request(
        proto_path=PROTO_PATH,
        full_request_type=make_full_request_type(
            DIRECTORYD_SERVICE_RPC_PATH,
            request_type,
        ),
        input_file=input_file,
        output_file=make_output_file_path(request_type),
        num_reqs=args.num_of_requests,
        address=DIRECTORYD_PORT,
        import_path=args.import_path,
    )
    _cleanup_subs()
예제 #6
0
def disable_static_rules_test(args):
    input_file = 'disable_static_rules.json'
    imsi_list = _gen_imsi(args.num_of_ues)
    _build_disable_static_rules_data(imsi_list, input_file)
    request_type = 'DisableStaticRules'
    benchmark_grpc_request(
        proto_path=PROTO_PATH,
        full_request_type=make_full_request_type(
            POLICYDB_SERVICE_RPC_PATH,
            request_type,
        ),
        input_file=input_file,
        output_file=make_output_file_path(request_type),
        num_reqs=args.num_of_ues,
        address=POLICYDB_PORT,
        import_path=args.import_path,
    )
예제 #7
0
def deactivate_flows_test(args):
    ue_dict = _gen_ue_set(args.num_of_ues)
    input_file = 'deactivate_flows.json'
    _build_deactivate_flows_data(ue_dict, input_file)
    request_type = 'DeactivateFlows'
    benchmark_grpc_request(
        proto_path=PROTO_PATH,
        full_request_type=make_full_request_type(
            PIPELINED_SERVICE_RPC_PATH,
            request_type,
        ),
        input_file=input_file,
        output_file=make_output_file_path(request_type),
        num_reqs=args.num_of_ues,
        address=PIPELINED_PORT,
        import_path=args.import_path,
    )
예제 #8
0
def get_all_records_test(args):
    input_file = 'get_all_records.json'
    record_list = _load_subs(args.num_of_requests)
    _build_get_all_record_data(record_list, input_file)
    request_type = 'GetAllDirectoryRecords'
    benchmark_grpc_request(
        proto_path=PROTO_PATH,
        full_request_type=make_full_request_type(
            DIRECTORYD_SERVICE_RPC_PATH,
            request_type,
        ),
        input_file=input_file,
        output_file=make_output_file_path(request_type),
        num_reqs=2000,
        address=DIRECTORYD_PORT,
        import_path=args.import_path,
    )
    _cleanup_subs()