summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorwatanabe.fumitaka <watanabe.fumitaka@nttcom.co.jp>2013-08-05 13:07:39 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-08-06 09:25:49 +0900
commite0d82b9d375a1ce697b9d32ffb28271a0d1c4304 (patch)
tree5ec7fb25d7378d1ac49a6194074535aa55ef8777
parent87cb024392b554ea98fd6aeddec251d1a8f4bd7a (diff)
packet lib to string: add __str__ to base
Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/packet/packet.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index f80948a6..785a28be 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -127,3 +127,7 @@ class Packet(object):
issubclass(protocol, packet_base.PacketBase)):
return protocol in [p.__class__ for p in self.protocols]
return protocol in self.protocols
+
+ def __str__(self):
+ return ', '.join(repr(protocol) for protocol in self.protocols)
+ __repr__ = __str__ # note: str(list) uses __repr__ for elements