Signed-off-by: itoyuichi <[email protected]>
---
ryu/tests/unit/packet/test_ethernet.py | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/ryu/tests/unit/packet/test_ethernet.py
b/ryu/tests/unit/packet/test_ethernet.py
index 151e5c6..17147dd 100644
--- a/ryu/tests/unit/packet/test_ethernet.py
+++ b/ryu/tests/unit/packet/test_ethernet.py
@@ -16,6 +16,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
import unittest
+import json
import logging
import struct
import netaddr
@@ -46,6 +47,17 @@ class Test_ethernet(unittest.TestCase):
e = ethernet(dst, src, ethertype)
+ jsonstr = '''
+ {
+ "ethernet": {
+ "dst": "aa:aa:aa:aa:aa:aa",
+ "src": "bb:bb:bb:bb:bb:bb",
+ "ethertype": 2054
+ }
+ }
+ '''
+ jsondict = json.loads(jsonstr)
+
def setUp(self):
pass
@@ -87,3 +99,10 @@ class Test_ethernet(unittest.TestCase):
def test_malformed_ethernet(self):
m_short_buf = self.buf[1:ethernet._MIN_LEN]
ethernet.parser(m_short_buf)
+
+ def test_to_jsondict(self):
+ eq_(self.jsondict, self.e.to_jsondict())
+
+ def test_from_jsondict(self):
+ e = ethernet.from_jsondict(self.jsondict['ethernet'])
+ eq_(str(e), str(self.e))
--
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