Beispiel #1
0
def prepare_service(args=None):
    try:
        CONF(args=args,
             project='yabgp',
             version=version,
             default_config_files=['/etc/yabgp/yabgp.ini'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project='yabgp', version=version)

    check_running_mode()
    log.init_log()
    LOG.info('Log (Re)opened.')
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e, exc_info=True)
        sys.exit()

    LOG.info('Starting server in PID %s' % os.getpid())

    # write pid file
    if CONF.pid_file:
        with open(CONF.pid_file, 'w') as pid_file:
            pid_file.write(str(os.getpid()))
            LOG.info('create pid file: %s' % CONF.pid_file)
    prepare_twisted_service()
Beispiel #2
0
def prepare_service(args=None, handler=None, api_hander=None):
    """prepare all services
    """
    try:
        CONF(args=args,
             project='yabgp',
             version=version,
             default_config_files=['/etc/yabgp/yabgp.ini'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project='yabgp', version=version)

    log.init_log()
    LOG.info('Log (Re)opened.')
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        if not handler:
            LOG.info('No handler provided, init default handler')
            handler = DefaultHandler()
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e)
        LOG.debug(traceback.format_exc())
        sys.exit()
    # prepare api handler
    if api_hander:
        register_api_handler(api_hander)
    LOG.info('Starting server in PID %s', os.getpid())

    prepare_twisted_service(handler)
Beispiel #3
0
def prepare_service(args=None):
    try:
        CONF(args=args, project='yabgp', version=version,
             default_config_files=['/etc/yabgp/yabgp.ini'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project='yabgp', version=version)

    check_running_mode()
    log.init_log()
    LOG.info('Log (Re)opened.')
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e, exc_info=True)
        sys.exit()

    LOG.info('Starting server in PID %s' % os.getpid())

    # write pid file
    if CONF.pid_file:
        with open(CONF.pid_file, 'w') as pid_file:
            pid_file.write(str(os.getpid()))
            LOG.info('create pid file: %s' % CONF.pid_file)
    prepare_twisted_service()
Beispiel #4
0
def prepare_service(args=None):
    try:
        CONF(args=args, project="yabgp", version=version, default_config_files=["/etc/yabgp/yabgp.ini"])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project="yabgp", version=version)

    check_running_mode()
    log.init_log()
    LOG.info("Log (Re)opened.")
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e)
        LOG.debug(traceback.format_exc())
        sys.exit()

    LOG.info("Starting server in PID %s" % os.getpid())

    # write pid file
    if CONF.pid_file:
        with open(CONF.pid_file, "w") as pid_file:
            pid_file.write(str(os.getpid()))
            LOG.info("create pid file: %s" % CONF.pid_file)
    prepare_twisted_service()
Beispiel #5
0
def prepare_service(args=None):
    try:
        CONF(args=args, project="yabgp", version=version, default_config_files=["/etc/yabgp/yabgp.ini"])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project="yabgp", version=version)

    check_running_mode()
    log.init_log()
    LOG.info("Log (Re)opened.")
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e, exc_info=True)
        sys.exit()
    prepare_twisted_service()
Beispiel #6
0
def prepare_service(args=None):
    try:
        CONF(args=args, project='yabgp', version=version,
             default_config_files=['/etc/yabgp/yabgp.ini'])
    except cfg.ConfigFilesNotFoundError:
        CONF(args=args, project='yabgp', version=version)

    log.init_log()
    LOG.info('Log (Re)opened.')
    LOG.info("Configuration:")
    cfg.CONF.log_opt_values(LOG, logging.INFO)
    try:
        get_bgp_config()
        check_msg_config()
    except Exception as e:
        LOG.error(e)
        LOG.debug(traceback.format_exc())
        sys.exit()

    LOG.info('Starting server in PID %s', os.getpid())

    prepare_twisted_service()