summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2013-10-01 15:49:40 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-10-08 07:31:54 +0900
commit8df8cca872fda961aee45e704b088b654662add5 (patch)
tree135e44409825b8775c1fb7e3d949dcb35d624309
parent0c55f5a69ebd3ad2e5088e2774d6947ebde245cb (diff)
packet.bgp test: parse real packets taken from quagga
bgp4-update case is commented out for now because we don't support 4-octet AS numbers. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/unit/packet/test_bgp.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/ryu/tests/unit/packet/test_bgp.py b/ryu/tests/unit/packet/test_bgp.py
index 6f2e076e..c8b23b96 100644
--- a/ryu/tests/unit/packet/test_bgp.py
+++ b/ryu/tests/unit/packet/test_bgp.py
@@ -127,3 +127,22 @@ class Test_bgp(unittest.TestCase):
for m in sp.parse(b):
results.append(m)
eq_(str(results), str(msgs))
+
+ def test_parser(self):
+ files = [
+ 'bgp4-open',
+# commented out because
+# 1. we don't support 32 bit AS numbers in AS_PATH
+# 2. quagga always uses EXTENDED for AS_PATH
+# 'bgp4-update',
+ 'bgp4-keepalive',
+ ]
+ dir = '../packet_data/bgp4/'
+
+ for f in files:
+ print 'testing', f
+ binmsg = open(dir + f).read()
+ msg, rest = bgp.BGPMessage.parser(binmsg)
+ binmsg2 = msg.serialize()
+ eq_(binmsg, binmsg2)
+ eq_(rest, '')