Signed-off-by: itoyuichi <[email protected]>
---
ryu/tests/unit/packet/test_tcp.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/ryu/tests/unit/packet/test_tcp.py
b/ryu/tests/unit/packet/test_tcp.py
index 5618652..a24c65d 100644
--- a/ryu/tests/unit/packet/test_tcp.py
+++ b/ryu/tests/unit/packet/test_tcp.py
@@ -16,6 +16,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import unittest
+import json
import logging
import struct
from struct import *
@@ -53,6 +54,24 @@ class Test_tcp(unittest.TestCase):
offset << 4, bits, window_size, csum, urgent)
buf += option
+ jsonstr = '''
+ {
+ "tcp": {
+ "src_port": 6431,
+ "dst_port": 8080,
+ "seq": 5,
+ "ack": 1,
+ "offset": 6,
+ "bits": 42,
+ "window_size": 2048,
+ "csum": 12345,
+ "urgent": 128,
+ "option": "AQIDBA=="
+ }
+ }
+ '''
+ jsondict = json.loads(jsonstr)
+
def setUp(self):
pass
@@ -138,3 +157,10 @@ class Test_tcp(unittest.TestCase):
def test_malformed_tcp(self):
m_short_buf = self.buf[1:tcp._MIN_LEN]
tcp.parser(m_short_buf)
+
+ def test_to_jsondict(self):
+ eq_(self.jsondict, self.t.to_jsondict())
+
+ def test_from_jsondict(self):
+ t = tcp.from_jsondict(self.jsondict['tcp'])
+ eq_(str(t), str(self.t))
--
1.7.10.4
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel