Beispiel #1
0
def launch_device_manager(test_id,
                          api_server_ip,
                          api_server_port,
                          conf_sections=None):

    kombu_mock = mock.Mock()
    kombu_patch = mock.patch('device_manager.dm_server.KombuAmqpClient')
    kombu_init_mock = kombu_patch.start()
    kombu_init_mock.side_effect = kombu_mock

    wait_for_device_manager_down()
    allocated_sockets = []
    args_str = ""
    args_str = args_str + "--cluster_id %s " % (test_id)
    args_str = args_str + "--api_server_ip %s " % (api_server_ip)
    args_str = args_str + "--api_server_port %s " % (api_server_port)
    args_str = args_str + "--http_server_port %s " % (
        get_free_port(allocated_sockets))
    args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 "
    args_str = args_str + "--log_local "
    args_str = args_str + "--log_file device_manager_%s.log " % (test_id)
    args_str = args_str + "--dm_run_mode Full "

    if conf_sections is not None:
        with tempfile.NamedTemporaryFile(mode='w+') as conf:
            cfg_parser = generate_conf_file_contents(conf_sections)
            cfg_parser.write(conf)
            conf.flush()
            args_str = args_str + "--conf_file %s " % conf.name
            dm_server.main(args_str)
    else:
        dm_server.main(args_str)
def launch_device_manager(test_id, api_server_ip, api_server_port,
                          conf_sections=None):

    kombu_mock = mock.Mock()
    kombu_patch = mock.patch(
        'device_manager.dm_server.KombuAmqpClient')
    kombu_init_mock = kombu_patch.start()
    kombu_init_mock.side_effect = kombu_mock

    wait_for_device_manager_down()
    allocated_sockets = []
    args_str = ""
    args_str = args_str + "--cluster_id %s " % (test_id)
    args_str = args_str + "--api_server_ip %s " % (api_server_ip)
    args_str = args_str + "--api_server_port %s " % (api_server_port)
    args_str = args_str + "--http_server_port %s " % (get_free_port(allocated_sockets))
    args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 "
    args_str = args_str + "--log_local "
    args_str = args_str + "--log_file device_manager_%s.log " %(test_id)

    if conf_sections is not None:
        with tempfile.NamedTemporaryFile() as conf:
            cfg_parser = generate_conf_file_contents(conf_sections)
            cfg_parser.write(conf)
            conf.flush()
            args_str = args_str + "--conf_file %s " % conf.name
            dm_server.main(args_str)
    else:
        dm_server.main(args_str)