Ejemplo n.º 1
0
    def __init__(self, config, daemon, vpnManager, catchAllLGLogHandler):
        self.config = config
        self.daemon = daemon

        self.vpnManager = vpnManager
        self.catchAllLGLogHandler = catchAllLGLogHandler

        self.bottle = Bottle()

        # Wrapping route callbacks (instead of using decorator) to url
        self.bottle.get("/ping", callback=self.ping)
        self.bottle.post("/attach_localport", callback=self.attach_localport)
        self.bottle.post("/detach_localport", callback=self.detach_localport)

        self.bottle.get("/%s<path:path>" % LOOKING_GLASS_BASE,
                        callback=self.looking_glass)
        self.bottle.get("/%s" % LOOKING_GLASS_BASE,
                        callback=self.looking_glass_root)

        self.bottle.error_handler[500] = self.error500

        self.startTime = time.time()

        LookingGlassReferences.setRoot(LOOKING_GLASS_BASE)
        LookingGlassReferences.setReferencePath("BGP_WORKERS",
                                                ["bgp", "workers"])
        LookingGlassReferences.setReferencePath("VPN_INSTANCES",
                                                ["vpns", "instances"])
Ejemplo n.º 2
0
    def __init__(self, config, daemon, vpnManager, catchAllLGLogHandler):
        self.config = config
        self.daemon = daemon

        self.vpnManager = vpnManager
        self.catchAllLGLogHandler = catchAllLGLogHandler

        self.bottle = Bottle()

        # Wrapping route callbacks (instead of using decorator) to url
        self.bottle.get("/ping", callback=self.ping)
        self.bottle.post("/attach_localport", callback=self.attach_localport)
        self.bottle.post("/detach_localport", callback=self.detach_localport)

        self.bottle.get("/%s<path:path>" %
                        LOOKING_GLASS_BASE, callback=self.looking_glass)
        self.bottle.get("/%s" %
                        LOOKING_GLASS_BASE, callback=self.looking_glass_root)

        self.bottle.error_handler[500] = self.error500

        self.startTime = time.time()

        LookingGlassReferences.setRoot(LOOKING_GLASS_BASE)
        LookingGlassReferences.setReferencePath(
            "BGP_WORKERS", ["bgp", "workers"])
        LookingGlassReferences.setReferencePath(
            "VPN_INSTANCES", ["vpns", "instances"])