From 4de8c7425ebcb14b0e0afd153de44ba89dfebcf2 Mon Sep 17 00:00:00 2001 From: Shu Shen Date: Thu, 12 Feb 2015 17:54:29 -0800 Subject: [PATCH] ofproto: Fix invalid error code OFPQCFC_EPERM -> OFPSCFC_EPERM (EXT-208) Invalid error code OFPQCFC_EPERM should be OFPSCFC_EPERM instead. This is EXT-208 that was included in Openflow v1.3.1. OFPSCFC_EPERM is backported to ofproto_v1_2 so that any new or updated application could consistently use OFPSCFC_EPERM to handle all protocol versions. OFPQCFC_EPERM is left in ofproto_v1_2 and ofproto_v1_3 definitions for backward compatibility. Signed-off-by: Shu Shen Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_2.py | 8 +++++++- ryu/ofproto/ofproto_v1_3.py | 6 +++++- ryu/ofproto/ofproto_v1_4.py | 2 +- ryu/tests/unit/ofproto/test_ofproto_v12.py | 2 +- ryu/tests/unit/ofproto/test_parser_v12.py | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_2.py b/ryu/ofproto/ofproto_v1_2.py index fd5f1cff..f5f831d2 100644 --- a/ryu/ofproto/ofproto_v1_2.py +++ b/ryu/ofproto/ofproto_v1_2.py @@ -738,7 +738,13 @@ OFPQOFC_EPERM = 2 # Permissions error. # enum ofp_switch_config_failed_code OFPSCFC_BAD_FLAGS = 0 # Specified flags is invalid. OFPSCFC_BAD_LEN = 1 # Specified len is invalid. -OFPQCFC_EPERM = 2 # Permissions error. +OFPQCFC_EPERM = 2 # Permissions error (depracated). + # New or updated Ryu applications shall use + # OFPSCFC_EPERM. The variable name is a typo of + # in specifications before v1.3.1 (EXT-208). +OFPSCFC_EPERM = 2 # Permissions error. + # Ported back to ofproto_v1_2 for consistency with + # later OF specs (EXT-208). # enum ofp_role_request_failed_code OFPRRFC_STALE = 0 # Stale Message: old generation_id. diff --git a/ryu/ofproto/ofproto_v1_3.py b/ryu/ofproto/ofproto_v1_3.py index d07bad91..b431d083 100644 --- a/ryu/ofproto/ofproto_v1_3.py +++ b/ryu/ofproto/ofproto_v1_3.py @@ -1021,7 +1021,11 @@ OFPQOFC_EPERM = 2 # Permissions error. # enum ofp_switch_config_failed_code OFPSCFC_BAD_FLAGS = 0 # Specified flags is invalid. OFPSCFC_BAD_LEN = 1 # Specified len is invalid. -OFPQCFC_EPERM = 2 # Permissions error. +OFPQCFC_EPERM = 2 # Permissions error (depracated). + # New or updated Ryu applications shall use + # OFPSCFC_EPERM. The variable name is a typo of + # in specifications before v1.3.1 (EXT-208). +OFPSCFC_EPERM = 2 # Permissions error. # enum ofp_role_request_failed_code OFPRRFC_STALE = 0 # Stale Message: old generation_id. diff --git a/ryu/ofproto/ofproto_v1_4.py b/ryu/ofproto/ofproto_v1_4.py index bb045d8e..6542b6ff 100644 --- a/ryu/ofproto/ofproto_v1_4.py +++ b/ryu/ofproto/ofproto_v1_4.py @@ -850,7 +850,7 @@ OFPQOFC_EPERM = 2 # Permissions error. # enum ofp_switch_config_failed_code OFPSCFC_BAD_FLAGS = 0 # Specified flags is invalid. OFPSCFC_BAD_LEN = 1 # Specified len is invalid. -OFPQCFC_EPERM = 2 # Permissions error. +OFPSCFC_EPERM = 2 # Permissions error. # enum ofp_role_request_failed_code OFPRRFC_STALE = 0 # Stale Message: old generation_id. diff --git a/ryu/tests/unit/ofproto/test_ofproto_v12.py b/ryu/tests/unit/ofproto/test_ofproto_v12.py index d6280a6d..c1228a05 100644 --- a/ryu/tests/unit/ofproto/test_ofproto_v12.py +++ b/ryu/tests/unit/ofproto/test_ofproto_v12.py @@ -630,7 +630,7 @@ class TestOfprot12(unittest.TestCase): def test_enum_ofp_switch_config_failed_code(self): eq_(OFPSCFC_BAD_FLAGS, 0) eq_(OFPSCFC_BAD_LEN, 1) - eq_(OFPQCFC_EPERM, 2) + eq_(OFPSCFC_EPERM, 2) def test_enum_ofp_role_request_failed_code(self): eq_(OFPRRFC_STALE, 0) diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py b/ryu/tests/unit/ofproto/test_parser_v12.py index 2560fbab..13caa526 100644 --- a/ryu/tests/unit/ofproto/test_parser_v12.py +++ b/ryu/tests/unit/ofproto/test_parser_v12.py @@ -742,7 +742,7 @@ class TestOFPErrorMsg(unittest.TestCase): def test_parser_p10_2(self): type_ = ofproto.OFPET_SWITCH_CONFIG_FAILED - code = ofproto.OFPQCFC_EPERM + code = ofproto.OFPSCFC_EPERM data = 'Error Message.' self._test_parser(type_, code, data) @@ -1196,7 +1196,7 @@ class TestOFPErrorMsg(unittest.TestCase): def test_serialize_p10_2(self): self._test_serialize_p(ofproto.OFPET_SWITCH_CONFIG_FAILED, - ofproto.OFPQCFC_EPERM) + ofproto.OFPSCFC_EPERM) def test_serialize_p11_0(self): self._test_serialize_p(ofproto.OFPET_ROLE_REQUEST_FAILED,