def _emit(self, event, *args, **kwargs): for cb in self._event_callbacks[event]: LOG.debug( "%(func)s from %(module)s gets %(event)s event of " "%(resource)r.", { 'func': cb.__name__, 'module': cb.__module__, 'event': event, 'resource': self }) try: with df_profiler.profiler_context('emit', info={ 'func': cb.__name__, 'module': cb.__module__, 'event': event }): cb(self, *args, **kwargs) except Exception: LOG.exception( 'Error while calling %(func)r(*%(_args)r, **%(kw)r)', extra={ 'func': cb, '_args': args, 'kw': kwargs }, )
def OF_packet_in_handler(self, event): msg = event.msg table_id = msg.table_id if table_id in self.table_handlers: handler = self.table_handlers[table_id] with df_profiler.profiler_context('packet_in', info={"func": handler.__name__}): handler(event) else: LOG.info("No handler for table id %(table)s with message " "%(msg)", {'table': table_id, 'msg': msg})