NOTE: test_to_jsondict() is skipped.

the class 'lacp' has some public members which do not relate to arguments of 
__init__().

a json used for creation of the object does not need 'actor_tag', 
'actor_length', etc.,
but a json which the object generated include them.


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

diff --git a/ryu/tests/unit/packet/test_slow.py 
b/ryu/tests/unit/packet/test_slow.py
index c7cd3bd..42b6b01 100644
--- a/ryu/tests/unit/packet/test_slow.py
+++ b/ryu/tests/unit/packet/test_slow.py
@@ -16,9 +16,11 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4

 import unittest
+import json
 import logging
 import copy
 from struct import pack, unpack_from
+from nose.plugins.skip import SkipTest
 from nose.tools import ok_, eq_, raises
 from ryu.ofproto import ether
 from ryu.lib.packet.ethernet import ethernet
@@ -291,6 +293,42 @@ class Test_lacp(unittest.TestCase):
                       self.partner_state_expired,
                       self.collector_max_delay)

+        self.jsonstr = '''
+        {
+            "lacp": {
+                "version": 1,
+                "actor_system_priority": 65534,
+                "actor_system": "00:07:0d:af:f4:54",
+                "actor_key": 1,
+                "actor_port_priority": 65535,
+                "actor_port": 1,
+                "actor_state_activity": 1,
+                "actor_state_timeout": 0,
+                "actor_state_aggregation": 1,
+                "actor_state_synchronization": 1,
+                "actor_state_collecting": 1,
+                "actor_state_distributing": 1,
+                "actor_state_defaulted": 0,
+                "actor_state_expired": 1,
+                "partner_system_priority": 0,
+                "partner_system": "00:00:00:00:00:00",
+                "partner_key": 0,
+                "partner_port_priority": 0,
+                "partner_port": 0,
+                "partner_state_activity": 0,
+                "partner_state_timeout": 1,
+                "partner_state_aggregation": 0,
+                "partner_state_synchronization": 0,
+                "partner_state_collecting": 0,
+                "partner_state_distributing": 0,
+                "partner_state_defaulted": 0,
+                "partner_state_expired": 0,
+                "collector_max_delay": 0
+            }
+        }
+        '''
+        self.jsondict = json.loads(self.jsonstr)
+
     def tearDown(self):
         pass

@@ -1094,3 +1132,18 @@ class Test_lacp(unittest.TestCase):
                  -1,
                  self.collector_max_delay)
         l.serialize()
+
+    def test_to_jsondict(self):
+        # lacp has public members which do not relate to argments
+        # of __init__().
+        LOG.info("SKIP [Test_lacp.test_to_jsondict]")
+        LOG.debug("self.jsondict:")
+        LOG.debug(self.jsondict)
+        LOG.debug("self.l.to_jsondict():")
+        LOG.debug(self.l.to_jsondict())
+        raise SkipTest("TODO: make reversible lacp.")
+        eq_(self.jsondict, self.l.to_jsondict())
+
+    def test_from_jsondict(self):
+        l = lacp.from_jsondict(self.jsondict['lacp'])
+        eq_(str(l), str(self.l))
-- 
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