The new default will send a packet to a controller.
Signed-off-by: Satoshi Kobayashi <[email protected]>
---
Change for v2:
- of1.0 is modified by the same value in of1.2 and of1.3
ryu/ofproto/ofproto_v1_0_parser.py | 5 ++++-
ryu/ofproto/ofproto_v1_2_parser.py | 3 ++-
ryu/ofproto/ofproto_v1_3_parser.py | 3 ++-
ryu/tests/unit/ofproto/test_parser_v10.py | 8 ++++----
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py
b/ryu/ofproto/ofproto_v1_0_parser.py
index 8856fa1..e10236e 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -253,7 +253,10 @@ class OFPAction(OFPActionHeader):
@OFPAction.register_action_type(ofproto_v1_0.OFPAT_OUTPUT,
ofproto_v1_0.OFP_ACTION_OUTPUT_SIZE)
class OFPActionOutput(OFPAction):
- def __init__(self, port, max_len=0):
+ # NOTE: The reason of this magic number (0xffe5)
+ # is because there is no good constant in of1.0.
+ # The same value as OFPCML_MAX of of1.2 and of1.3 is used.
+ def __init__(self, port, max_len=0xffe5):
super(OFPActionOutput, self).__init__()
self.port = port
self.max_len = max_len
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py
b/ryu/ofproto/ofproto_v1_2_parser.py
index 0215903..97ab485 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -1112,7 +1112,8 @@ class OFPActionOutput(OFPAction):
max_len Max length to send to controller
================ ======================================================
"""
- def __init__(self, port, max_len=0, type_=None, len_=None):
+ def __init__(self, port, max_len=ofproto_v1_2.OFPCML_MAX,
+ type_=None, len_=None):
super(OFPActionOutput, self).__init__()
self.port = port
self.max_len = max_len
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
b/ryu/ofproto/ofproto_v1_3_parser.py
index 8d35db2..606ffa2 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -2587,7 +2587,8 @@ class OFPActionOutput(OFPAction):
max_len Max length to send to controller
================ ======================================================
"""
- def __init__(self, port, max_len=0, type_=None, len_=None):
+ def __init__(self, port, max_len=ofproto_v1_3.OFPCML_MAX,
+ type_=None, len_=None):
super(OFPActionOutput, self).__init__()
self.port = port
self.max_len = max_len
diff --git a/ryu/tests/unit/ofproto/test_parser_v10.py
b/ryu/tests/unit/ofproto/test_parser_v10.py
index 81b96de..8e593d2 100644
--- a/ryu/tests/unit/ofproto/test_parser_v10.py
+++ b/ryu/tests/unit/ofproto/test_parser_v10.py
@@ -3238,7 +3238,7 @@ class TestNXTFlowMod(unittest.TestCase):
eq_(ofproto_v1_0.OFPAT_OUTPUT, res[15])
eq_(ofproto_v1_0.OFP_ACTION_OUTPUT_SIZE, res[16])
eq_(self.port['val'], res[17])
- eq_(0, res[18])
+ eq_(0xffe5, res[18])
class TestNXTRoleRequest(unittest.TestCase):
@@ -4751,7 +4751,7 @@ class TestOFPPacketOut(unittest.TestCase):
"""
port = 0x2ae0
- actions = [OFPActionOutput(port)]
+ actions = [OFPActionOutput(port, max_len=0)]
def setUp(self):
pass
@@ -4888,7 +4888,7 @@ class TestOFPFlowMod(unittest.TestCase):
tp_dst['val'])
port = 0x2ae0
- actions = [OFPActionOutput(port)]
+ actions = [OFPActionOutput(port, max_len=1000)]
def setUp(self):
pass
@@ -4988,7 +4988,7 @@ class TestOFPFlowMod(unittest.TestCase):
eq_(ofproto_v1_0.OFPAT_OUTPUT, res[25])
eq_(ofproto_v1_0.OFP_ACTION_OUTPUT_SIZE, res[26])
eq_(self.port, res[27])
- eq_(0, res[28])
+ eq_(1000, res[28])
class TestOFPBarrierRequest(unittest.TestCase):
--
1.7.1
------------------------------------------------------------------------------
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=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel