Ejemplo n.º 1
0
    def initTask(self):
        """Thrift handler task initialization.

        Performs the steps needed to initialize the shaping subsystem.
        """
        super(AtcdThriftHandlerTask, self).initTask()

        # Do this first because it can error out and it's better to
        # error out before touching the networking stacks
        self.db_task = self.service.tasks.AtcdDBQueueTask

        self.lan = {'name': self.lan_name}
        self.wan = {'name': self.wan_name}
        self._links_lookup()

        self._ip_to_id_map = {}
        self._id_to_ip_map = {}
        self.initialize_id_manager()
        self.ip_to_pcap_proc_map = {}
        self.initialize_shaping_system()

        # Map of IP address to tc object that is currently
        # being used to shape traffic from that IP.
        # {ip: {'tc': tc, 'timeout': timeout}}
        # {'10.0.0.1': {'tc': TrafficControl(...), 'timeout': 1234567890.1234}}
        self._current_shapings = {}

        self.access_manager = AccessManager(secure=self.mode != 'unsecure')
        if not self.fresh_start:
            self.logger.info('Restoring shaped connection from DB')
            self._restore_saved_shapings()
Ejemplo n.º 2
0
def am():
    return AccessManager()