Ejemplo n.º 1
0
 def _setTimer(self):
     if self._timer: self._timer.cancel()
     self._timer = None
     if len(self._packets) != 0:
         self._timer = Timer(LLDP_SEND_CYCLE / len(self._packets),
                             self._timerHandler,
                             recurring=True)
Ejemplo n.º 2
0
 def __init__ (self):
   
   # The following tables should go to Topology later
   self.entryByMAC = {}
   self._t = Timer(timeoutSec['timerInterval'],
                  self._check_timeouts, recurring=True)
   self.listenTo(core)
   log.info("host_tracker ready")
Ejemplo n.º 3
0
    def __init__(self):
        self._dps = set()
        self.adjacency = {}  # From Link to time.time() stamp
        self._sender = LLDPSender()
        Timer(TIMEOUT_CHECK_PERIOD, self._expireLinks, recurring=True)

        if core.hasComponent("openflow"):
            self.listenTo(core.openflow)
        else:
            # We'll wait for openflow to come up
            self.listenTo(core)
Ejemplo n.º 4
0
    def setup_connection(self, connection, packet):
        """
        1. Takes a connection and a packet

        2. Inits self.connection_data, which is a dict {<connection_tuple>: <connection_info_dict>}

        """

        if connection in self.connection_data:
            log.debug("Connection %s is already setup" % (str(connection)))
            return

        now = time.time()

        # create timer
        try:
            timer = Timer(30,
                          self.delete_idle_connection,
                          args=[connection],
                          recurring=True)
        except Exception, e:
            log.debug("----ERROR-----: %s" % (str(e)))
Ejemplo n.º 5
0
        Event.__init__(self)
        self.packet = packet
        self.connection = connection
        self.sig = connection.sig
        self.action = connection.action
        self.opaque = connection.opaque
        self.reverse = self.packet.next.srcip == self.connection.sig.dst
        self.send = connection.send

    def _invoke(self, handler, *args, **kw):
        r = handler(self, self.sig, self.packet)
        self.connection.opaque = self.opaque
        return r


stray_timer = Timer(90, roll_strays, recurring=True)


class EE122Gateway(EventMixin):
    _eventMixin_events = set([
        DeferredConnectionIn,
        ConnectionIn,
        MonitorData,
    ])

    def __init__(self, switch, ports):
        global INSIDE_PORT, OUTSIDE_PORT, INTERNAL_PORT
        for p in ports:
            if p.name == OUTSIDE_PORT:
                OUTSIDE_PORT = p.port_no
            if isinstance(INSIDE_PORT, list) and p.name in INSIDE_PORT:
Ejemplo n.º 6
0
 def __init__(self):
     self._session_key_salt = str(time.time()) + "POX"
     self._connections = {}
     #self._t = Timer(5, self._check_timeouts, recurring=True)
     self._t = Timer(60 * 2, self._check_timeouts, recurring=True)