def launch_api_server(test_id, listen_ip, listen_port, http_server_port, admin_port, conf_sections): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " %(test_id) import cgitb cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " %(conf.name) args_str = args_str + "--logging_conf %s " %(logconf.name) vnc_cfg_api_server.main(args_str)
def launch_api_server(test_id, listen_ip, listen_port, http_server_port, admin_port, ifmap_port, conf_sections, ifmap_server_ip=None): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) if ifmap_server_ip is not None: args_str = args_str + "--ifmap_server_ip %s " % ifmap_server_ip args_str = args_str + "--ifmap_server_port %s " % ifmap_port else: args_str = args_str + "--ifmap_listen_ip %s " % listen_ip args_str = args_str + "--ifmap_listen_port %s " % ifmap_port args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " %(test_id) vnc_cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " %(conf.name) args_str = args_str + "--logging_conf %s " %(logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server)
def launch_api_server(test_id, listen_ip, listen_port, http_server_port, admin_port, conf_sections): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " % (test_id) args_str = args_str + "--cluster_id %s " % (test_id) vnc_cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, \ tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " % (conf.name) args_str = args_str + "--logging_conf %s " % (logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server)
def launch_api_server(listen_ip, listen_port, http_server_port, admin_port, conf_sections): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_test.log " import cgitb cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, tempfile.NamedTemporaryFile( ) as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " % (conf.name) args_str = args_str + "--logging_conf %s " % (logconf.name) vnc_cfg_api_server.main(args_str)
def launch_api_server_rdbms(test_id, listen_ip, listen_port, http_server_port, admin_port, conf_sections): db_file = "./test_db_%s.db" % test_id args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--db_engine rdbms " args_str = args_str + "--rdbms_connection sqlite:///%s " % db_file args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " % (test_id) vnc_cgitb.enable(format='text') try: os.remove(db_file) shutil.copyfile('./base_db.db', db_file) except: pass with tempfile.NamedTemporaryFile() as conf, tempfile.NamedTemporaryFile( ) as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " % (conf.name) args_str = args_str + "--logging_conf %s " % (logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server)
def launch_api_server_rdbms(test_id, listen_ip, listen_port, http_server_port, admin_port, conf_sections): db_file = "./test_db_%s.db" % test_id args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--db_engine rdbms " args_str = args_str + "--rdbms_connection sqlite:///%s " % db_file args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " %(test_id) vnc_cgitb.enable(format='text') try: os.remove(db_file) shutil.copyfile('./base_db.db', db_file) except: pass with tempfile.NamedTemporaryFile() as conf, tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " %(conf.name) args_str = args_str + "--logging_conf %s " %(logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server)
def launch_api_server(listen_ip, listen_port, http_server_port): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160" vnc_cfg_api_server.main(args_str)
def launch_api_server(listen_ip, listen_port): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--ifmap_username api-server " args_str = args_str + "--ifmap_password api-server " args_str = args_str + "--cassandra_server_list 0.0.0.0:9160" vnc_cfg_api_server.main(args_str)
def launch_api_server(listen_ip, listen_port, http_server_port): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160" import cgitb cgitb.enable(format='text') vnc_cfg_api_server.main(args_str)
def launch_api_server(listen_ip, listen_port, http_server_port, conf_sections): args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " import cgitb cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as temp: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(temp) temp.flush() args_str = args_str + "--conf_file %s " %(temp.name) vnc_cfg_api_server.main(args_str)
def launch_api_server(test_id, listen_ip, listen_port, http_server_port, admin_port, ifmap_port, conf_sections, ifmap_server_ip=None): args_str = "" ifmap_cert_dir = None args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) if ifmap_server_ip is not None: args_str = args_str + "--ifmap_server_ip %s " % ifmap_server_ip args_str = args_str + "--ifmap_server_port %s " % ifmap_port else: args_str = args_str + "--ifmap_listen_ip %s " % listen_ip args_str = args_str + "--ifmap_listen_port %s " % ifmap_port ifmap_cert_dir = tempfile.mkdtemp() args_str = args_str + "--ifmap_key_path %s/key " % ifmap_cert_dir args_str = args_str + "--ifmap_cert_path %s/cert " % ifmap_cert_dir args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " % (test_id) vnc_cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, \ tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " % (conf.name) args_str = args_str + "--logging_conf %s " % (logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server) if ifmap_cert_dir is not None: shutil.rmtree(ifmap_cert_dir)
def launch_api_server(test_id, listen_ip, listen_port, http_server_port, admin_port, conf_sections): kombu_mock = mock.Mock() kombu_patch = mock.patch( 'vnc_cfg_api_server.vnc_cfg_api_server.KombuAmqpClient') kombu_init_mock = kombu_patch.start() kombu_init_mock.side_effect = kombu_mock args_str = "" args_str = args_str + "--listen_ip_addr %s " % (listen_ip) args_str = args_str + "--listen_port %s " % (listen_port) args_str = args_str + "--http_server_port %s " % (http_server_port) args_str = args_str + "--admin_port %s " % (admin_port) args_str = args_str + "--cassandra_server_list 0.0.0.0:9160 " args_str = args_str + "--log_local " args_str = args_str + "--log_file api_server_%s.log " %(test_id) args_str = args_str + "--cluster_id %s " %(test_id) vnc_cgitb.enable(format='text') with tempfile.NamedTemporaryFile() as conf, \ tempfile.NamedTemporaryFile() as logconf: cfg_parser = generate_conf_file_contents(conf_sections) cfg_parser.write(conf) conf.flush() cfg_parser = generate_logconf_file_contents() cfg_parser.write(logconf) logconf.flush() args_str = args_str + "--conf_file %s " %(conf.name) args_str = args_str + "--logging_conf %s " %(logconf.name) server = vnc_cfg_api_server.VncApiServer(args_str) gevent.getcurrent().api_server = server vnc_cfg_api_server.main(args_str, server)