Exemple #1
0
class BgpDaemon(LookingGlass):

    def __init__(self, catchAllLGLogHandler, **kwargs):
        self.stdin_path = '/dev/null'
        self.stdout_path = '/dev/null'
        self.stderr_path = '/dev/null'
        self.pidfile_path = '/var/run/bagpipe-bgp/bagpipe-bgp.pid'
        self.pidfile_timeout = 5

        logging.info("BGP manager configuration : %s", kwargs["bgpConfig"])
        self.bgpConfig = kwargs["bgpConfig"]

        logging.info("BGP dataplane dataplaneDriver configuration : %s",
                     kwargs["dataplaneConfig"])
        self.dataplaneConfig = kwargs["dataplaneConfig"]

        logging.info("BGP API configuration : %s", kwargs["apiConfig"])
        self.apiConfig = kwargs["apiConfig"]

        self.catchAllLGLogHandler = catchAllLGLogHandler

    def run(self):
        logging.info("Starting BGP component...")

        logging.debug("Creating dataplane drivers")
        drivers = findDataplaneDrivers(self.dataplaneConfig, self.bgpConfig)

        for vpnType in self.dataplaneConfig.iterkeys():
            if vpnType not in drivers:
                logging.error(
                    "Could not initiate any dataplane driver for %s", vpnType)
                return

        logging.debug("Creating BGP manager")
        self.bgpManager = Manager(self.bgpConfig)

        logging.debug("Creating VPN manager")
        self.vpnManager = VPNManager(self.bgpManager, drivers)

        # BGP component REST API
        logging.debug("Creating REST API")
        bgpapi = RESTAPI(
            self.apiConfig, self, self.vpnManager, self.catchAllLGLogHandler)
        bgpapi.run()

    def stop(self, signum, frame):
        logging.info("Received signal %(signum)r, stopping...", vars())
        self.vpnManager.stop()
        self.bgpManager.stop()
        # would need to stop main thread ?
        logging.info("All threads now stopped...")
        exception = SystemExit("Terminated on signal %(signum)r" % vars())
        raise exception

    def getLookingGlassLocalInfo(self, pathPrefix):
        return {
            "dataplane": self.dataplaneConfig,
            "bgp": self.bgpConfig
        }
Exemple #2
0
class BgpDaemon(LookingGlass):
    def __init__(self, catchAllLGLogHandler, **kwargs):
        self.stdin_path = '/dev/null'
        self.stdout_path = '/dev/null'
        self.stderr_path = '/dev/null'
        self.pidfile_path = '/var/run/bagpipe-bgp/bagpipe-bgp.pid'
        self.pidfile_timeout = 5

        logging.info("BGP manager configuration : %s", kwargs["bgpConfig"])
        self.bgpConfig = kwargs["bgpConfig"]

        logging.info("BGP dataplane dataplaneDriver configuration : %s",
                     kwargs["dataplaneConfig"])
        self.dataplaneConfig = kwargs["dataplaneConfig"]

        logging.info("BGP API configuration : %s", kwargs["apiConfig"])
        self.apiConfig = kwargs["apiConfig"]

        self.catchAllLGLogHandler = catchAllLGLogHandler

    def run(self):
        logging.info("Starting BGP component...")

        logging.debug("Creating dataplane drivers")
        drivers = findDataplaneDrivers(self.dataplaneConfig, self.bgpConfig)

        for vpnType in self.dataplaneConfig.iterkeys():
            if vpnType not in drivers:
                logging.error("Could not initiate any dataplane driver for %s",
                              vpnType)
                return

        logging.debug("Creating BGP manager")
        self.bgpManager = Manager(self.bgpConfig)

        logging.debug("Creating VPN manager")
        self.vpnManager = VPNManager(self.bgpManager, drivers)

        # BGP component REST API
        logging.debug("Creating REST API")
        bgpapi = RESTAPI(self.apiConfig, self, self.vpnManager,
                         self.catchAllLGLogHandler)
        bgpapi.run()

    def stop(self, signum, frame):
        logging.info("Received signal %(signum)r, stopping...", vars())
        self.vpnManager.stop()
        self.bgpManager.stop()
        # would need to stop main thread ?
        logging.info("All threads now stopped...")
        exception = SystemExit("Terminated on signal %(signum)r" % vars())
        raise exception

    def getLookingGlassLocalInfo(self, pathPrefix):
        return {"dataplane": self.dataplaneConfig, "bgp": self.bgpConfig}
Exemple #3
0
    def run(self):
        logging.info("Starting BGP component...")

        logging.debug("Creating dataplane drivers")
        drivers = findDataplaneDrivers(self.dataplaneConfig, self.bgpConfig)

        for vpnType in self.dataplaneConfig.iterkeys():
            if vpnType not in drivers:
                logging.error("Could not initiate any dataplane driver for %s",
                              vpnType)
                return

        logging.debug("Creating BGP manager")
        self.bgpManager = Manager(self.bgpConfig)

        logging.debug("Creating VPN manager")
        self.vpnManager = VPNManager(self.bgpManager, drivers)

        # BGP component REST API
        logging.debug("Creating REST API")
        bgpapi = RESTAPI(self.apiConfig, self, self.vpnManager,
                         self.catchAllLGLogHandler)
        bgpapi.run()
Exemple #4
0
    def run(self):
        logging.info("Starting BGP component...")

        logging.debug("Creating dataplane drivers")
        drivers = findDataplaneDrivers(self.dataplaneConfig, self.bgpConfig)

        for vpnType in self.dataplaneConfig.iterkeys():
            if vpnType not in drivers:
                logging.error(
                    "Could not initiate any dataplane driver for %s", vpnType)
                return

        logging.debug("Creating BGP manager")
        self.bgpManager = Manager(self.bgpConfig)

        logging.debug("Creating VPN manager")
        self.vpnManager = VPNManager(self.bgpManager, drivers)

        # BGP component REST API
        logging.debug("Creating REST API")
        bgpapi = RESTAPI(
            self.apiConfig, self, self.vpnManager, self.catchAllLGLogHandler)
        bgpapi.run()