Signed-off-by: itoyuichi <[email protected]>
---
ryu/tests/unit/packet/test_mpls.py | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/ryu/tests/unit/packet/test_mpls.py
b/ryu/tests/unit/packet/test_mpls.py
index abde030..2199d04 100644
--- a/ryu/tests/unit/packet/test_mpls.py
+++ b/ryu/tests/unit/packet/test_mpls.py
@@ -15,6 +15,7 @@
import unittest
+import json
import logging
import inspect
@@ -34,6 +35,18 @@ class Test_mpls(unittest.TestCase):
ttl = 64
mp = mpls.mpls(label, exp, bsb, ttl)
+ jsonstr = '''
+ {
+ "mpls": {
+ "label": 29,
+ "exp": 6,
+ "bsb": 1,
+ "ttl": 64
+ }
+ }
+ '''
+ jsondict = json.loads(jsonstr)
+
def setUp(self):
pass
@@ -52,3 +65,10 @@ class Test_mpls(unittest.TestCase):
eq_(str(self.mp), mpls_str)
eq_(repr(self.mp), mpls_str)
+
+ def test_to_jsondict(self):
+ eq_(self.jsondict, self.mp.to_jsondict())
+
+ def test_from_jsondict(self):
+ msg = mpls.mpls.from_jsondict(self.jsondict['mpls'])
+ eq_(str(msg), str(self.mp))
--
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