ofp_pktinfilter: add 'logging' option

When packet_in_filter discards a packet, it is always logging. However,
it may be felt noisy.

Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Kobayashi 2014-09-10 16:23:36 +09:00 committed by FUJITA Tomonori
parent aa21f3d052
commit 9e8e241652

View File

@ -23,12 +23,13 @@ from ryu.lib.packet import packet
LOG = logging.getLogger(__name__)
def packet_in_filter(cls, args=None):
def packet_in_filter(cls, args=None, logging=False):
def _packet_in_filter(packet_in_handler):
def __packet_in_filter(self, ev):
pkt = packet.Packet(ev.msg.data)
if not packet_in_handler.pkt_in_filter.filter(pkt):
LOG.debug('The packet is discarded by %s: %s' % (cls, pkt))
if logging:
LOG.debug('The packet is discarded by %s: %s' % (cls, pkt))
return
return packet_in_handler(self, ev)
pkt_in_filter = cls(args)