Esempio n. 1
0
    def _run_traces(self, trace_interval):
        """ Kytos Thread that will keep reading the
        self.request_queue queue looking for new traces to start.

        Args:
            trace_interval = sleeping time
        """
        while True:
            if self.number_pending_requests() > 0:
                try:
                    r_ids = []
                    for r_id in self._request_queue:
                        entries = self._request_queue[r_id]
                        new_thread(self._spawn_trace, (
                            r_id,
                            entries,
                        ))
                        r_ids.append(r_id)
                    # After starting traces for new requests,
                    # remove them from self._request_queue
                    for rid in r_ids:
                        del self._request_queue[rid]
                except Exception as e:
                    log.error("Trace Error: %s" % e)
            time.sleep(trace_interval)
Esempio n. 2
0
    def _run_traces(self, trace_interval):
        """ Thread that will keep reading the self._request_queue
        queue looking for new trace requests to run.

        Args:
            trace_interval = sleeping time
        """
        while True:
            if self.number_pending_requests() > 0:
                try:
                    new_request_ids = []
                    for req_id in self._request_queue:
                        if not self.limit_traces_reached():
                            entries = self._request_queue[req_id]
                            self._running_traces[req_id] = entries
                            new_thread(self._spawn_trace, (req_id, entries,))
                            new_request_ids.append(req_id)
                        else:
                            break
                    # After starting traces for new requests,
                    # remove them from self._request_queue
                    for rid in new_request_ids:
                        del self._request_queue[rid]
                except Exception as error:  # pylint: disable=broad-except
                    log.error("Trace Error: %s" % error)
            time.sleep(trace_interval)
Esempio n. 3
0
    def _run_traces(self, trace_interval):
        """ Thread that will keep reading the self._request_queue
        queue looking for new trace requests to run.

        Args:
            trace_interval = sleeping time
        """
        while True:
            if self.number_pending_requests() > 0:
                try:
                    new_request_ids = []
                    for req_id in self._request_queue:
                        if not self.limit_traces_reached():
                            entries = self._request_queue[req_id]
                            self._running_traces[req_id] = entries
                            new_thread(self._spawn_trace, (
                                req_id,
                                entries,
                            ))
                            new_request_ids.append(req_id)
                        else:
                            break
                    # After starting traces for new requests,
                    # remove them from self._request_queue
                    for rid in new_request_ids:
                        del self._request_queue[rid]
                except Exception as error:  # pylint: disable=broad-except
                    log.error("Trace Error: %s" % error)
            time.sleep(trace_interval)
Esempio n. 4
0
    def __init__(self, controller):
        """Initialization of the TraceManager class
        Args:
             controller = Kytos.core.controller object
        """
        # Controller
        self.controller = controller

        # Configs
        self._my_domain = settings.MY_DOMAIN

        # Trace ID used to distinguish each trace
        self._id = 30000

        # Trace queues
        self._request_queue = dict()
        self._results_queue = dict()
        self._running_traces = dict()

        # Counters
        self._total_traces_requested = 0

        # PacketIn queue with Probes
        self.trace_pkt_in = []

        # Thread to start traces
        new_thread(self._run_traces, (settings.TRACE_INTERVAL,))
Esempio n. 5
0
 def __init__(self):
     self.start_time = str(datetime.now())
     self.last_msgs = CircularList()
     self.per_dev_last_msgs = dict()
     self.num_packets = 0
     self.packet_types = self.init_type_packets()
     self.per_dev_packet_types = dict()
     self.num_reconnects = 0
     new_thread(self._run_rest, tuple())
Esempio n. 6
0
    def __init__(self, controller):
        """Initialization of the TraceManager class
        Args:
             controller = Kytos.core.controller object
        """
        # Controller
        self.controller = controller

        # Trace ID used to distinguish each trace
        self._id = 30000

        # Trace queues
        self._request_queue = dict()
        self._results_queue = dict()
        self._running_traces = dict()

        # Counters
        self._total_traces_requested = 0

        # PacketIn queue with Probes
        self.trace_pkt_in = []

        # Thread to start traces
        new_thread(self._run_traces, (settings.TRACE_INTERVAL,))