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

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

 import unittest
+import json
 import logging
 import struct
 from struct import *
@@ -45,6 +46,18 @@ class Test_vlan(unittest.TestCase):

     v = vlan(pcp, cfi, vid, ethertype)

+    jsonstr = '''
+    {
+        "vlan": {
+            "pcp": 0,
+            "cfi": 0,
+            "vid": 32,
+            "ethertype": 2048
+        }
+    }
+    '''
+    jsondict = json.loads(jsonstr)
+
     def setUp(self):
         pass

@@ -136,3 +149,10 @@ class Test_vlan(unittest.TestCase):
     def test_malformed_vlan(self):
         m_short_buf = self.buf[1:vlan._MIN_LEN]
         vlan.parser(m_short_buf)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.v.to_jsondict())
+
+    def test_from_jsondict(self):
+        v = vlan.from_jsondict(self.jsondict['vlan'])
+        eq_(str(v), str(self.v))
-- 
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