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

diff --git a/ryu/tests/unit/packet/test_llc.py 
b/ryu/tests/unit/packet/test_llc.py
new file mode 100644
index 0000000..8f65499
--- /dev/null
+++ b/ryu/tests/unit/packet/test_llc.py
@@ -0,0 +1,110 @@
+# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+import unittest
+import json
+import logging
+
+from nose.tools import eq_
+from ryu.lib.packet import llc
+
+
+LOG = logging.getLogger(__name__)
+
+
+class Test_ControlFormatI(unittest.TestCase):
+    msg = llc.llc(llc.SAP_BPDU, llc.SAP_BPDU, llc.ControlFormatI())
+    jsonstr = '''
+    {
+        "llc": {
+            "dsap_addr": 66,
+            "ssap_addr": 66,
+            "control": {
+                "ControlFormatI": {
+                    "send_sequence_number": 0,
+                    "pf_bit": 0,
+                    "receive_sequence_number": 0
+                }
+            }
+        }
+    }
+    '''
+    jsondict = json.loads(jsonstr)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.msg.to_jsondict())
+
+    def test_from_jsondict(self):
+        msg2 = llc.llc.from_jsondict(
+            self.jsondict['llc'])
+        eq_(str(msg2), str(self.msg))
+
+
+class Test_ControlFormatS(unittest.TestCase):
+    msg = llc.llc(llc.SAP_BPDU, llc.SAP_BPDU, llc.ControlFormatS())
+    jsonstr = '''
+    {
+        "llc": {
+            "dsap_addr": 66,
+            "ssap_addr": 66,
+            "control": {
+                "ControlFormatS": {
+                    "supervisory_function": 0,
+                    "pf_bit": 0,
+                    "receive_sequence_number": 0
+                }
+            }
+        }
+    }
+    '''
+    jsondict = json.loads(jsonstr)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.msg.to_jsondict())
+
+    def test_from_jsondict(self):
+        msg2 = llc.llc.from_jsondict(
+            self.jsondict['llc'])
+        eq_(str(msg2), str(self.msg))
+
+
+class Test_ControlFormatU(unittest.TestCase):
+    msg = llc.llc(llc.SAP_BPDU, llc.SAP_BPDU, llc.ControlFormatU())
+    jsonstr = '''
+    {
+        "llc": {
+            "dsap_addr": 66,
+            "ssap_addr": 66,
+            "control": {
+                "ControlFormatU": {
+                    "modifier_function1": 0,
+                    "pf_bit": 0,
+                    "modifier_function2": 0
+                }
+            }
+        }
+    }
+    '''
+    jsondict = json.loads(jsonstr)
+
+    def test_to_jsondict(self):
+        eq_(self.jsondict, self.msg.to_jsondict())
+
+    def test_from_jsondict(self):
+        msg2 = llc.llc.from_jsondict(
+            self.jsondict['llc'])
+        eq_(str(msg2), str(self.msg))
-- 
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