From 9e8e2416524800cbae56770d4d083036fa59e892 Mon Sep 17 00:00:00 2001 From: Satoshi Kobayashi Date: Wed, 10 Sep 2014 16:23:36 +0900 Subject: [PATCH] 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 Signed-off-by: FUJITA Tomonori --- ryu/lib/ofp_pktinfilter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ryu/lib/ofp_pktinfilter.py b/ryu/lib/ofp_pktinfilter.py index a84f7bb4..8f69d17a 100644 --- a/ryu/lib/ofp_pktinfilter.py +++ b/ryu/lib/ofp_pktinfilter.py @@ -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)