示例#1
0
    def __init__(self, port, cert, key):

        Service.__init__(self, every=-1)

        self.port = int(port)
        self.cert = cert
        self.key = key

        tornado.web.Application.__init__(self, [], **self.parms)

        if not cert or not key:
            http_server = tornado.httpserver.HTTPServer(self)
        else:
            http_server = tornado.httpserver.HTTPServer(self, ssl_options={
                "certfile": self.cert,
                "keyfile": self.key,
            })

        http_server.listen(self.port)

        handler_classes = [BaseHandler, EmpowerAppHomeHandler,
                           RequestTenantHandler, ProfileHandler,
                           AuthLoginHandler, AuthLogoutHandler,
                           ManageTenantHandler, AccountsHandler,
                           ComponentsHandler, TenantComponentsHandler,
                           PendingTenantHandler, TenantHandler,
                           AllowHandler, DenyHandler, IMSI2MACHandler,
                           TenantTrafficRuleHandler]

        for handler_class in handler_classes:
            self.add_handler_class(handler_class, http_server)
示例#2
0
    def __init__(self, port):

        Service.__init__(self, every=-1)

        self.port = int(port)
        self.intent_host = "localhost"
        self.intent_port = 8080
        self.intent_url_rules = "/intent/rules"
        self.intent_url_poa = "/intent/poas"
        self.intent_url_traffic_rules = "/intent/trs"

        handlers = []
        for handler in self.handlers:
            for url in handler.HANDLERS:
                handlers.append((url, handler))

        tornado.web.Application.__init__(self, handlers)
        http_server = tornado.httpserver.HTTPServer(self)
        http_server.listen(self.port)

        self.get_traffic_rule()
        self.get_rule()
        self.get_poa()

        self.remove_traffic_rule()
        self.remove_rule()
        self.remove_poa()
示例#3
0
    def to_dict(self):
        """Return a dict representation of the object."""

        out = Service.to_dict(self)
        out['port'] = self.port
        out['certfile'] = self.cert
        out['keyfile'] = self.key

        return out
示例#4
0
    def to_dict(self):
        """Return a dict representation of the object."""

        out = Service.to_dict(self)
        out['port'] = self.port
        out['intent_host'] = self.intent_host
        out['intent_port'] = self.intent_port

        return out