of1.0, of1.2, of1.3: Modify the default of max_len in OFPActionOutput

The new default will send a packet to a controller.

Signed-off-by: Satoshi Kobayashi <satoshi-k@stratosphere.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Satoshi Kobayashi 2013-10-23 17:45:56 +09:00 committed by FUJITA Tomonori
parent 315101be5f
commit 3b1f076805
4 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):