Signed-off-by: itoyuichi <[email protected]>
---
 ryu/tests/unit/packet/test_arp.py |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/ryu/tests/unit/packet/test_arp.py 
b/ryu/tests/unit/packet/test_arp.py
index c9bf6e2..3d4c491 100644
--- a/ryu/tests/unit/packet/test_arp.py
+++ b/ryu/tests/unit/packet/test_arp.py
@@ -16,6 +16,7 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4

 import unittest
+import json
 import logging
 import struct
 from struct import *
@@ -56,6 +57,23 @@ class Test_arp(unittest.TestCase):
     a = arp(hwtype, proto, hlen, plen, opcode, src_mac, src_ip, dst_mac,
             dst_ip)

+    jsonstr = '''
+    {
+        "arp": {
+            "hwtype": 1,
+            "proto": 2048,
+            "hlen": 6,
+            "plen": 4,
+            "opcode": 1,
+            "src_mac": "00:07:0d:af:f4:54",
+            "src_ip": "24.166.172.1",
+            "dst_mac": "00:00:00:00:00:00",
+            "dst_ip": "24.166.173.159"
+        }
+    }
+    '''
+    jsondict = json.loads(jsonstr)
+
     def setUp(self):
         pass

@@ -177,3 +195,10 @@ class Test_arp(unittest.TestCase):
     def test_malformed_arp(self):
         m_short_buf = self.buf[1:arp._MIN_LEN]
         arp.parser(m_short_buf)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.a.to_jsondict())
+
+    def test_from_jsondict(self):
+        e = arp.from_jsondict(self.jsondict['arp'])
+        eq_(str(e), str(self.a))
-- 
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

Reply via email to