Ejemplo n.º 1
0
def daemon_main():
    logging.register_options(cfg.CONF)

    setup_config()

    log_file_warn = fix_log_file()

    setup_logging()

    if log_file_warn:
        LOG.warning(log_file_warn)

    exabgp_peer_worker.setup_exabgp_env()

    try:
        LOG.info("Starting bagpipe-bgp...")
        pecan_api = api.PecanAPI()

        cfg.CONF.log_opt_values(LOG, logging.INFO)

        def stop(signum, _):
            LOG.info("Received signal %d, stopping...", signum)
            pecan_api.stop()
            LOG.info("All threads now stopped...")
            sys.exit(0)

        signal.signal(signal.SIGTERM, stop)
        signal.signal(signal.SIGINT, stop)

        pecan_api.run()
    except Exception:
        LOG.exception("Error while starting BGP daemon")
Ejemplo n.º 2
0
def daemon_main():
    logging.register_options(cfg.CONF)

    setup_config()

    if cfg.CONF.action != "unset":
        LOG.warning("Running daemonized and using start/stop is not supported "
                    "anymore, use of systemd is your typical alternative")
        if cfg.CONF.action == "stop":
            sys.exit(-1)

    log_file_warn = fix_log_file()

    setup_logging()

    if log_file_warn:
        LOG.warning(log_file_warn)

    exabgp_peer_worker.setup_exabgp_env()

    try:
        LOG.info("Starting bagpipe-bgp...")
        pecan_api = api.PecanAPI()

        cfg.CONF.log_opt_values(LOG, logging.INFO)

        def stop(signum, _):
            LOG.info("Received signal %d, stopping...", signum)
            pecan_api.stop()
            LOG.info("All threads now stopped...")
            sys.exit(0)

        signal.signal(signal.SIGTERM, stop)
        signal.signal(signal.SIGINT, stop)

        pecan_api.run()
    except Exception as e:
        LOG.exception("Error while starting BGP daemon: %s", e)
Ejemplo n.º 3
0
 def test_api_init(self):
     # instantiate the API, will fail if an exception is raised
     api.PecanAPI()