diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-08-22 14:43:37 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-08-23 11:40:46 +0900 |
commit | cccd01f5ea627517c5504ddd5aa36ff7eb10811c (patch) | |
tree | 75f49850ec140c861c52451f58f7ec8a459cf665 | |
parent | c8cd4226d75a6eccdca500cfde46c2f9ac88f657 (diff) |
test: fix pep8 1.3.3 warnings
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/tests/integrated/test_add_flow_v10.py | 6 | ||||
-rw-r--r-- | ryu/tests/integrated/test_add_flow_v12_actions.py | 6 | ||||
-rw-r--r-- | ryu/tests/integrated/test_add_flow_v12_matches.py | 8 | ||||
-rw-r--r-- | ryu/tests/integrated/test_request_reply_v12.py | 34 | ||||
-rw-r--r-- | ryu/tests/integrated/tester.py | 14 | ||||
-rw-r--r-- | ryu/tests/test_lib.py | 17 | ||||
-rw-r--r-- | ryu/tests/unit/ofproto/test_ofproto_parser.py | 50 | ||||
-rw-r--r-- | ryu/tests/unit/ofproto/test_parser_v10.py | 314 | ||||
-rw-r--r-- | ryu/tests/unit/ofproto/test_parser_v12.py | 71 |
9 files changed, 259 insertions, 261 deletions
diff --git a/ryu/tests/integrated/test_add_flow_v10.py b/ryu/tests/integrated/test_add_flow_v10.py index 24ca7706..6aec1560 100644 --- a/ryu/tests/integrated/test_add_flow_v10.py +++ b/ryu/tests/integrated/test_add_flow_v10.py @@ -68,7 +68,7 @@ class RunTest(tester.TestFlowBase): action = actions[0] if action.cls_action_type != type_: return "Action type error. send:%s, val:%s" \ - % (type_, action.cls_action_type) + % (type_, action.cls_action_type) except IndexError: return "Action is not setting." @@ -84,14 +84,14 @@ class RunTest(tester.TestFlowBase): if f_value != value: return "Value error. send:%s=%s val:%s" \ - % (name, value, f_value) + % (name, value, f_value) return True def _verify_rule(self, rule, name, value): f_value = getattr(rule, name) if f_value != value: return "Value error. send:%s=%s val:%s" \ - % (name, value, f_value) + % (name, value, f_value) return True def verify_default(self, dp, stats): diff --git a/ryu/tests/integrated/test_add_flow_v12_actions.py b/ryu/tests/integrated/test_add_flow_v12_actions.py index 1940b27c..820ed816 100644 --- a/ryu/tests/integrated/test_add_flow_v12_actions.py +++ b/ryu/tests/integrated/test_add_flow_v12_actions.py @@ -73,7 +73,7 @@ class RunTest(tester.TestFlowBase): action = stats[0].instructions[0].actions[0] if action.cls_action_type != type_: return "Action type error. send:%s, val:%s" \ - % (type_, action.cls_action_type) + % (type_, action.cls_action_type) except IndexError: return "Action is not setting." @@ -87,12 +87,12 @@ class RunTest(tester.TestFlowBase): if name == 'field': if s_val.header != field: return "Field error. send:%s val:%s" \ - % (field, s_val.field) + % (field, s_val.field) s_val = s_val.value if name and s_val != value: return "Value error. send:%s=%s val:%s" \ - % (name, value, s_val) + % (name, value, s_val) return True diff --git a/ryu/tests/integrated/test_add_flow_v12_matches.py b/ryu/tests/integrated/test_add_flow_v12_matches.py index 53efe7db..778f99ff 100644 --- a/ryu/tests/integrated/test_add_flow_v12_matches.py +++ b/ryu/tests/integrated/test_add_flow_v12_matches.py @@ -64,11 +64,11 @@ class RunTest(tester.TestFlowBase): if f_value == value and f_mask == mask: return True - elif value == None: + elif value is None: return "Field[%s] is setting." % (headers, ) else: return "Value error. send: (%s/%s), val:(%s/%s)" \ - % (value, mask, f_value, f_mask) + % (value, mask, f_value, f_mask) def test_rule_set_dl_dst(self, dp): dl_dst = 'e2:7a:09:79:0b:0f' @@ -861,7 +861,7 @@ class RunTest(tester.TestFlowBase): mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:0' mask_int = self.ipv6_to_int(mask) ipv6_src_masked = [x & y for (x, y) in - itertools.izip(ipv6_src_int, mask_int)] + itertools.izip(ipv6_src_int, mask_int)] self._verify = [(dp.ofproto.OXM_OF_IPV6_SRC, dp.ofproto.OXM_OF_IPV6_SRC_W, ), ipv6_src_masked, mask_int] @@ -921,7 +921,7 @@ class RunTest(tester.TestFlowBase): mask = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:0' mask_int = self.ipv6_to_int(mask) ipv6_dst_masked = [x & y for (x, y) in - itertools.izip(ipv6_dst_int, mask_int)] + itertools.izip(ipv6_dst_int, mask_int)] self._verify = [(dp.ofproto.OXM_OF_IPV6_DST, dp.ofproto.OXM_OF_IPV6_DST_W, ), ipv6_dst_masked, mask_int] diff --git a/ryu/tests/integrated/test_request_reply_v12.py b/ryu/tests/integrated/test_request_reply_v12.py index a36888b5..15d49275 100644 --- a/ryu/tests/integrated/test_request_reply_v12.py +++ b/ryu/tests/integrated/test_request_reply_v12.py @@ -76,7 +76,7 @@ class RunTest(tester.TestFlowBase): verify_func = getattr(self, v) result = verify_func(dp, msg) - if result == True: + if result is True: self.unclear -= 1 self.results[self.current] = result @@ -136,9 +136,11 @@ class RunTest(tester.TestFlowBase): out_group = dp.ofproto.OFPG_ANY m = dp.ofproto_parser.OFPFlowMod(dp, cookie, cookie_mask, - table_id, command, idle_timeout, hard_timeout, - priority, buffer_id, out_port, out_group, - flags, match, inst) + table_id, command, + idle_timeout, hard_timeout, + priority, buffer_id, + out_port, out_group, + flags, match, inst) dp.send_msg(m) @@ -157,8 +159,8 @@ class RunTest(tester.TestFlowBase): self._verify = dp.ofproto.OFPST_AGGREGATE match = dp.ofproto_parser.OFPMatch() m = dp.ofproto_parser.OFPAggregateStatsRequest( - dp, dp.ofproto.OFPTT_ALL, dp.ofproto.OFPP_ANY, - dp.ofproto.OFPG_ANY, 0, 0, match) + dp, dp.ofproto.OFPTT_ALL, dp.ofproto.OFPP_ANY, + dp.ofproto.OFPG_ANY, 0, 0, match) dp.send_msg(m) def test_table_stats_request(self, dp): @@ -246,8 +248,8 @@ class RunTest(tester.TestFlowBase): dp.send_barrier() match = dp.ofproto_parser.OFPMatch() m = dp.ofproto_parser.OFPAggregateStatsRequest( - dp, dp.ofproto.OFPTT_ALL, dp.ofproto.OFPP_ANY, - dp.ofproto.OFPG_ANY, 0, 0, match) + dp, dp.ofproto.OFPTT_ALL, dp.ofproto.OFPP_ANY, + dp.ofproto.OFPG_ANY, 0, 0, match) dp.send_msg(m) def verify_aggregate_stats_flow_count(self, dp, msg): @@ -265,8 +267,8 @@ class RunTest(tester.TestFlowBase): out_port = 2 match = dp.ofproto_parser.OFPMatch() m = dp.ofproto_parser.OFPAggregateStatsRequest( - dp, dp.ofproto.OFPTT_ALL, out_port, - dp.ofproto.OFPG_ANY, 0, 0, match) + dp, dp.ofproto.OFPTT_ALL, out_port, + dp.ofproto.OFPG_ANY, 0, 0, match) dp.send_msg(m) def verify_aggregate_stats_flow_count_out_port(self, dp, msg): @@ -424,12 +426,10 @@ class RunTest(tester.TestFlowBase): a2 = dp.ofproto_parser.OFPActionOutput(2, 1500) # table_id, cookie, priority, dl_dst, action) - tables = { - 0: [0xffff, 10, '\xee' * 6, a1], + tables = {0: [0xffff, 10, '\xee' * 6, a1], 1: [0xff00, 10, '\xee' * 6, a2], 2: [0xf000, 100, '\xee' * 6, a1], - 3: [0x0000, 10, '\xff' * 6, a1], - } + 3: [0x0000, 10, '\xff' * 6, a1]} self._verify = tables for table_id, val in tables.items(): @@ -666,7 +666,7 @@ class RunTest(tester.TestFlowBase): msg = ev.msg dp = msg.datapath if self._verify == dp.ofproto.OFPST_TABLE: - self.table_stats = msg.body[0] + self.table_stats = msg.body self.start_next_test(dp) else: self.run_verify(ev) @@ -696,8 +696,8 @@ class RunTest(tester.TestFlowBase): if self.capabilities is None: m = dp.ofproto_parser.OFPFeaturesRequest(dp) dp.send_msg(m) - elif self.capabilities & dp.ofproto.OFPC_TABLE_STATS \ - and self.table_stats is None: + elif (self.capabilities & dp.ofproto.OFPC_TABLE_STATS > 0 and + self.table_stats is None): self._verify = dp.ofproto.OFPST_TABLE m = dp.ofproto_parser.OFPTableStatsRequest(dp) dp.send_msg(m) diff --git a/ryu/tests/integrated/tester.py b/ryu/tests/integrated/tester.py index c6274036..daf60e1b 100644 --- a/ryu/tests/integrated/tester.py +++ b/ryu/tests/integrated/tester.py @@ -49,9 +49,7 @@ class TestFlowBase(app_manager.RyuApp): To check flows of switch. """ - _CONTEXTS = { - 'dpset': dpset.DPSet, - } + _CONTEXTS = {'dpset': dpset.DPSet} def __init__(self, *args, **kwargs): super(TestFlowBase, self).__init__(*args, **kwargs) @@ -70,8 +68,7 @@ class TestFlowBase(app_manager.RyuApp): match = dp.ofproto_parser.OFPMatch(dp.ofproto.OFPFW_ALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - m = dp.ofproto_parser.OFPFlowMod( - dp, match, 0, + m = dp.ofproto_parser.OFPFlowMod(dp, match, 0, dp.ofproto.OFPFC_DELETE, 0, 0, 0, 0, dp.ofproto.OFPP_NONE, 0, None) @@ -91,9 +88,8 @@ class TestFlowBase(app_manager.RyuApp): match = dp.ofproto_parser.OFPMatch(dp.ofproto.OFPFW_ALL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - m = dp.ofproto_parser.OFPFlowStatsRequest( - dp, 0, match, - 0, dp.ofproto.OFPP_NONE) + m = dp.ofproto_parser.OFPFlowStatsRequest(dp, 0, match, + 0, dp.ofproto.OFPP_NONE) elif dp.ofproto == ofproto_v1_2: match = dp.ofproto_parser.OFPMatch() m = dp.ofproto_parser.OFPFlowStatsRequest(dp, dp.ofproto.OFPTT_ALL, @@ -142,7 +138,7 @@ class TestFlowBase(app_manager.RyuApp): verify_func = getattr(self, v) result = verify_func(dp, msg.body) - if result == True: + if result is True: self.unclear -= 1 self.results[self.current] = result diff --git a/ryu/tests/test_lib.py b/ryu/tests/test_lib.py index 97315662..77d5a276 100644 --- a/ryu/tests/test_lib.py +++ b/ryu/tests/test_lib.py @@ -9,6 +9,7 @@ import logging from nose import result from nose import core from nose import config +from nose.plugins.skip import SkipTest class _AnsiColorizer(object): @@ -65,9 +66,9 @@ class _Win32Colorizer(object): See _AnsiColorizer docstring. """ def __init__(self, stream): - from win32console import GetStdHandle, STD_OUT_HANDLE, \ - FOREGROUND_RED, FOREGROUND_BLUE, FOREGROUND_GREEN, \ - FOREGROUND_INTENSITY + from win32console import GetStdHandle, STD_OUT_HANDLE + from win32console import FOREGROUND_RED, FOREGROUND_BLUE + from win32console import FOREGROUND_GREEN, FOREGROUND_INTENSITY red, green, blue, bold = (FOREGROUND_RED, FOREGROUND_GREEN, FOREGROUND_BLUE, FOREGROUND_INTENSITY) self.stream = stream @@ -217,9 +218,9 @@ class RyuTestResult(result.TextTestResult): class RyuTestRunner(core.TextTestRunner): def _makeResult(self): return RyuTestResult(self.stream, - self.descriptions, - self.verbosity, - self.config) + self.descriptions, + self.verbosity, + self.config) def run_tests(c=None): @@ -239,6 +240,6 @@ def run_tests(c=None): return True runner = RyuTestRunner(stream=c.stream, - verbosity=c.verbosity, - config=c) + verbosity=c.verbosity, + config=c) return not core.run(config=c, testRunner=runner) diff --git a/ryu/tests/unit/ofproto/test_ofproto_parser.py b/ryu/tests/unit/ofproto/test_ofproto_parser.py index ea2f466d..114a6998 100644 --- a/ryu/tests/unit/ofproto/test_ofproto_parser.py +++ b/ryu/tests/unit/ofproto/test_ofproto_parser.py @@ -32,25 +32,27 @@ class TestOfproto_Parser(unittest.TestCase): def setUp(self): LOG.debug('setUp') self.bufHello = binascii.unhexlify('0100000800000001') - self.bufFeaturesReply = binascii.unhexlify( - '010600b0000000020000000000000abc' \ - + '00000100010000000000008700000fff' \ - + '0002aefa39d2b9177472656d61302d30' \ - + '00000000000000000000000000000000' \ - + '000000c0000000000000000000000000' \ - + 'fffe723f9a764cc87673775f30786162' \ - + '63000000000000000000000100000001' \ - + '00000082000000000000000000000000' \ - + '00012200d6c5a1947472656d61312d30' \ - + '00000000000000000000000000000000' \ - + '000000c0000000000000000000000000') - self.bufPacketIn = binascii.unhexlify( - '010a005200000000000001010040' \ - + '00020000000000000002000000000001' \ - + '080045000032000000004011f967c0a8' \ - + '0001c0a8000200010001001e00000000' \ - + '00000000000000000000000000000000' \ - + '00000000') + + fr = '010600b0000000020000000000000abc' \ + + '00000100010000000000008700000fff' \ + + '0002aefa39d2b9177472656d61302d30' \ + + '00000000000000000000000000000000' \ + + '000000c0000000000000000000000000' \ + + 'fffe723f9a764cc87673775f30786162' \ + + '63000000000000000000000100000001' \ + + '00000082000000000000000000000000' \ + + '00012200d6c5a1947472656d61312d30' \ + + '00000000000000000000000000000000' \ + + '000000c0000000000000000000000000' + self.bufFeaturesReply = binascii.unhexlify(fr) + + pi = '010a005200000000000001010040' \ + + '00020000000000000002000000000001' \ + + '080045000032000000004011f967c0a8' \ + + '0001c0a8000200010001001e00000000' \ + + '00000000000000000000000000000000' \ + + '00000000' + self.bufPacketIn = binascii.unhexlify(pi) def tearDown(self): LOG.debug('tearDown') @@ -160,12 +162,10 @@ class TestMsgBase(unittest.TestCase): def _test_parser(self, msg_type=ofproto_v1_0.OFPT_HELLO): xid = 2183948390 - res = ofproto_v1_0_parser.OFPHello.parser(object, \ - ofproto_v1_0.OFP_VERSION, \ - msg_type, \ - ofproto_v1_0.OFP_HEADER_SIZE, \ - xid, \ - str().zfill(ofproto_v1_0.OFP_HEADER_SIZE)) + res = ofproto_v1_0_parser.OFPHello.parser( + object, ofproto_v1_0.OFP_VERSION, msg_type, + ofproto_v1_0.OFP_HEADER_SIZE, xid, + str().zfill(ofproto_v1_0.OFP_HEADER_SIZE)) eq_(ofproto_v1_0.OFP_VERSION, res.version) eq_(ofproto_v1_0.OFPT_HELLO, res.msg_type) diff --git a/ryu/tests/unit/ofproto/test_parser_v10.py b/ryu/tests/unit/ofproto/test_parser_v10.py index 7dc59187..9a47ebca 100644 --- a/ryu/tests/unit/ofproto/test_parser_v10.py +++ b/ryu/tests/unit/ofproto/test_parser_v10.py @@ -229,9 +229,9 @@ class TestOFPActionHeader(unittest.TestCase): len = {'buf': '\x00\x08', 'val': ofproto_v1_0.OFP_ACTION_HEADER_SIZE} zfill = '\x00' * 4 - buf = type['buf'] + \ - len['buf'] + \ - zfill + buf = type['buf'] \ + + len['buf'] \ + + zfill c = OFPActionHeader(type['val'], len['val']) @@ -362,9 +362,9 @@ class TestOFPActionVlanVid(unittest.TestCase): type_ = {'buf': '\x00\x02', 'val': 2} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.vlan_vid['buf'] \ - + self.zfill + + self.len_['buf'] \ + + self.vlan_vid['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -373,9 +373,9 @@ class TestOFPActionVlanVid(unittest.TestCase): len_ = {'buf': '\x00\x07', 'val': 7} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.vlan_vid['buf'] \ - + self.zfill + + len_['buf'] \ + + self.vlan_vid['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -427,9 +427,9 @@ class TestOFPActionVlanPcp(unittest.TestCase): type_ = {'buf': '\x00\x01', 'val': 1} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.vlan_pcp['buf'] \ - + self.zfill + + self.len_['buf'] \ + + self.vlan_pcp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -438,9 +438,9 @@ class TestOFPActionVlanPcp(unittest.TestCase): len_ = {'buf': '\x00\x07', 'val': 7} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.vlan_pcp['buf'] \ - + self.zfill + + len_['buf'] \ + + self.vlan_pcp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -697,8 +697,8 @@ class TestOFPActionSetNwSrc(unittest.TestCase): type_ = {'buf': '\x00\x05', 'val': 5} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.nw_addr['buf'] + + self.len_['buf'] \ + + self.nw_addr['buf'] self.c.parser(buf, 0) @@ -707,8 +707,8 @@ class TestOFPActionSetNwSrc(unittest.TestCase): len_ = {'buf': '\x00\x10', 'val': 16} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.nw_addr['buf'] + + len_['buf'] \ + + self.nw_addr['buf'] self.c.parser(buf, 0) @@ -768,8 +768,8 @@ class TestOFPActionSetNwDst(unittest.TestCase): type_ = {'buf': '\x00\x05', 'val': 5} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.nw_addr['buf'] + + self.len_['buf'] \ + + self.nw_addr['buf'] self.c.parser(buf, 0) @@ -778,8 +778,8 @@ class TestOFPActionSetNwDst(unittest.TestCase): len_ = {'buf': '\x00\x10', 'val': 16} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.nw_addr['buf'] + + len_['buf'] \ + + self.nw_addr['buf'] self.c.parser(buf, 0) @@ -831,9 +831,9 @@ class TestOFPActionSetNwTos(unittest.TestCase): type_ = {'buf': '\x00\x05', 'val': 5} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.tos['buf'] \ - + self.zfill + + self.len_['buf'] \ + + self.tos['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -842,9 +842,9 @@ class TestOFPActionSetNwTos(unittest.TestCase): len_ = {'buf': '\x00\x07', 'val': 7} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.tos['buf'] \ - + self.zfill + + len_['buf'] \ + + self.tos['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -907,9 +907,9 @@ class TestOFPActionSetTpSrc(unittest.TestCase): type_ = {'buf': '\x00\x07', 'val': 7} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.tp['buf'] \ - + self.zfill + + self.len_['buf'] \ + + self.tp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -918,9 +918,9 @@ class TestOFPActionSetTpSrc(unittest.TestCase): len_ = {'buf': '\x00\x07', 'val': 7} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.tp['buf'] \ - + self.zfill + + len_['buf'] \ + + self.tp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -983,9 +983,9 @@ class TestOFPActionSetTpDst(unittest.TestCase): type_ = {'buf': '\x00\x10', 'val': 16} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.tp['buf'] \ - + self.zfill + + self.len_['buf'] \ + + self.tp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -994,9 +994,9 @@ class TestOFPActionSetTpDst(unittest.TestCase): len_ = {'buf': '\x00\x07', 'val': 7} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.tp['buf'] \ - + self.zfill + + len_['buf'] \ + + self.tp['buf'] \ + + self.zfill self.c.parser(buf, 0) @@ -1053,10 +1053,10 @@ class TestOFPActionEnqueue(unittest.TestCase): type_ = {'buf': '\x00\x0a', 'val': 10} buf = type_['buf'] \ - + self.len_['buf'] \ - + self.port['buf'] \ - + self.zfill \ - + self.queue_id['buf'] + + self.len_['buf'] \ + + self.port['buf'] \ + + self.zfill \ + + self.queue_id['buf'] self.c.parser(buf, 0) @@ -1065,10 +1065,10 @@ class TestOFPActionEnqueue(unittest.TestCase): len_ = {'buf': '\x00\x05', 'val': 5} buf = self.type_['buf'] \ - + len_['buf'] \ - + self.port['buf'] \ - + self.zfill \ - + self.queue_id['buf'] + + len_['buf'] \ + + self.port['buf'] \ + + self.zfill \ + + self.queue_id['buf'] self.c.parser(buf, 0) @@ -2127,20 +2127,20 @@ class TestOFPFlowStats(unittest.TestCase): # OFP_MATCH_PACK_STR # '!IH6s6sHBxHBB2xIIHH'... match = '\x97\x7c\xa6\x1e' \ - + '\x5e\xa0' \ - + '\x7a\x3e\xed\x30\x4a\x90' \ - + '\x96\x8e\x67\xbe\x2f\xe2' \ - + '\xb1\x81' \ - + '\xbe' \ - + '\x00' \ - + '\x01\xab' \ - + '\x42' \ - + '\xfe' \ - + '\x00\x00' \ - + '\xa4\x5d\x5c\x42' \ - + '\xa2\x5c\x2e\x05' \ - + '\x5a\x94' \ - + '\x64\xd4' + + '\x5e\xa0' \ + + '\x7a\x3e\xed\x30\x4a\x90' \ + + '\x96\x8e\x67\xbe\x2f\xe2' \ + + '\xb1\x81' \ + + '\xbe' \ + + '\x00' \ + + '\x01\xab' \ + + '\x42' \ + + '\xfe' \ + + '\x00\x00' \ + + '\xa4\x5d\x5c\x42' \ + + '\xa2\x5c\x2e\x05' \ + + '\x5a\x94' \ + + '\x64\xd4' # OFP_FLOW_STATS_1_PACK_STR # '!IIHHH6xQQQ'...duration_sec, duration_nsec, priority, @@ -2157,7 +2157,7 @@ class TestOFPFlowStats(unittest.TestCase): packet_count = {'buf': '\x47\x5c\xc6\x05\x28\xff\x7c\xdb', 'val': 5142202600015232219} byte_count = {'buf': '\x24\xe9\x4b\xee\xcb\x57\xd9\xc3', - 'val': 2659740543924820419} + 'val': 2659740543924820419} # <action>_PACK_STR...type_, len_ [others...] type = {'buf': '\x00\x00', 'val': ofproto_v1_0.OFPAT_OUTPUT} @@ -2184,17 +2184,17 @@ class TestOFPFlowStats(unittest.TestCase): def _parser(self, action=None): buf = self.table_id['buf'] \ - + self.zfill_0 \ - + self.match \ - + self.duration_sec['buf'] \ - + self.duration_nsec['buf'] \ - + self.priority['buf'] \ - + self.idle_timeout['buf'] \ - + self.hard_timeout['buf'] \ - + self.zfill_1 \ - + self.cookie['buf'] \ - + self.packet_count['buf'] \ - + self.byte_count['buf'] + + self.zfill_0 \ + + self.match \ + + self.duration_sec['buf'] \ + + self.duration_nsec['buf'] \ + + self.priority['buf'] \ + + self.idle_timeout['buf'] \ + + self.hard_timeout['buf'] \ + + self.zfill_1 \ + + self.cookie['buf'] \ + + self.packet_count['buf'] \ + + self.byte_count['buf'] if not action: buf = self.length['buf'] + buf @@ -2534,20 +2534,18 @@ class TestOFPQueuePropNone(unittest.TestCase): def test_init(self): cls = OFPQueuePropHeader._QUEUE_PROPERTIES[self.c.cls_prop_type] - ok_(self.property['val'] \ - == self.c.cls_prop_type \ - == self.c.property \ - == cls.cls_prop_type) + eq_(self.property['val'], self.c.cls_prop_type) + eq_(self.property['val'], self.c.property) + eq_(self.property['val'], cls.cls_prop_type) - ok_(self.len['val'] \ - == self.c.cls_prop_len \ - == self.c.len \ - == cls.cls_prop_len) + eq_(self.len['val'], self.c.cls_prop_len) + eq_(self.len['val'], self.c.len) + eq_(self.len['val'], cls.cls_prop_len) def test_parser(self): buf = self.property['buf'] \ - + self.len['buf'] \ - + self.zfill + + self.len['buf'] \ + + self.zfill ok_(self.c.parser(buf, 0)) @@ -2591,14 +2589,12 @@ class TestOFPQueuePropMinRate(unittest.TestCase): def test_init(self): cls = OFPQueuePropHeader._QUEUE_PROPERTIES[self.c.cls_prop_type] - ok_(self.rate['val'] \ - == self.c.cls_prop_type \ - == self.c.rate \ - == cls.cls_prop_type) + eq_(self.rate['val'], self.c.cls_prop_type) + eq_(self.rate['val'], self.c.rate) + eq_(self.rate['val'], cls.cls_prop_type) - ok_(self.len['val'] \ - == self.c.cls_prop_len \ - == cls.cls_prop_len) + eq_(self.len['val'], self.c.cls_prop_len) + eq_(self.len['val'], cls.cls_prop_len) def test_parser(self): res = self.c.parser(self.buf, 0) @@ -2700,11 +2696,11 @@ class TestOFPHello(unittest.TestCase): def test_parser(self): xid = 2183948390 - res = OFPHello.parser(object, \ - ofproto_v1_0.OFP_VERSION, \ - ofproto_v1_0.OFPT_HELLO, \ - ofproto_v1_0.OFP_HEADER_SIZE, \ - xid, \ + res = OFPHello.parser(object, + ofproto_v1_0.OFP_VERSION, + ofproto_v1_0.OFPT_HELLO, + ofproto_v1_0.OFP_HEADER_SIZE, + xid, str().zfill(ofproto_v1_0.OFP_HEADER_SIZE)) eq_(ofproto_v1_0.OFP_VERSION, res.version) @@ -2868,11 +2864,11 @@ class TestOFPEchoRequest(unittest.TestCase): + data res = OFPEchoRequest.parser(object, - version['val'], - msg_type['val'], - msg_len['val'], - xid['val'], - buf) + version['val'], + msg_type['val'], + msg_len['val'], + xid['val'], + buf) eq_(version['val'], res.version) eq_(msg_type['val'], res.msg_type) @@ -2954,11 +2950,11 @@ class TestOFPEchoReply(unittest.TestCase): + data res = OFPEchoReply.parser(object, - version['val'], - msg_type['val'], - msg_len['val'], - xid['val'], - buf) + version['val'], + msg_type['val'], + msg_len['val'], + xid['val'], + buf) eq_(version['val'], res.version) eq_(msg_type['val'], res.msg_type) @@ -3479,9 +3475,9 @@ class TestOFPSwitchFeatures(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x06', 'val': ofproto_v1_0.OFPT_FEATURES_REPLY} - msg_len = {'buf': '\x00\x4c', - 'val': ofproto_v1_0.OFP_SWITCH_FEATURES_SIZE \ - + ofproto_v1_0.OFP_PHY_PORT_SIZE} + msg_len_val = ofproto_v1_0.OFP_SWITCH_FEATURES_SIZE \ + + ofproto_v1_0.OFP_PHY_PORT_SIZE + msg_len = {'buf': '\x00\x4c', 'val': msg_len_val} xid = {'buf': '\xcc\x0a\x41\xd4', 'val': 3423224276} # OFP_SWITCH_FEATURES_PACK_STR @@ -4109,9 +4105,9 @@ class TestOFPQueueGetConfigReply(unittest.TestCase): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x0a', 'val': ofproto_v1_0.OFPT_QUEUE_GET_CONFIG_REPLY} - msg_len = {'buf': '\x00\x14', - 'val': ofproto_v1_0.OFP_QUEUE_GET_CONFIG_REPLY_SIZE \ - + ofproto_v1_0.OFP_PACKET_QUEUE_SIZE} + msg_len_val = ofproto_v1_0.OFP_QUEUE_GET_CONFIG_REPLY_SIZE \ + + ofproto_v1_0.OFP_PACKET_QUEUE_SIZE + msg_len = {'buf': '\x00\x14', 'val': msg_len_val} xid = {'buf': '\x94\xc4\xd2\xcd', 'val': 2495926989} buf = version['buf'] \ @@ -4200,9 +4196,9 @@ class TestOFPDescStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x04\x38', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_DESC_STATS_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_DESC_STATS_SIZE + msg_len = {'buf': '\x04\x38', 'val': msg_len_val} xid = {'buf': '\x94\xc4\xd2\xcd', 'val': 2495926989} buf = version['buf'] \ @@ -4300,9 +4296,9 @@ class TestOFPFlowStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x00\x64', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_FLOW_STATS_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_FLOW_STATS_SIZE + msg_len = {'buf': '\x00\x64', 'val': msg_len_val} xid = {'buf': '\x94\xc4\xd2\xcd', 'val': 2495926989} buf = version['buf'] \ @@ -4332,20 +4328,20 @@ class TestOFPFlowStatsReply(unittest.TestCase): # OFP_MATCH_PACK_STR # '!IH6s6sHBxHBB2xIIHH'... match = '\x97\x7c\xa6\x1e' \ - + '\x5e\xa0' \ - + '\x70\x17\xdc\x80\x59\x9e' \ - + '\x79\xc6\x56\x87\x92\x28' \ - + '\xb1\x81' \ - + '\xbe' \ - + '\x00' \ - + '\x01\xab' \ - + '\x42' \ - + '\xfe' \ - + '\x00\x00' \ - + '\xa4\x5d\x5c\x42' \ - + '\xa2\x5c\x2e\x05' \ - + '\x5a\x94' \ - + '\x64\xd4' + + '\x5e\xa0' \ + + '\x70\x17\xdc\x80\x59\x9e' \ + + '\x79\xc6\x56\x87\x92\x28' \ + + '\xb1\x81' \ + + '\xbe' \ + + '\x00' \ + + '\x01\xab' \ + + '\x42' \ + + '\xfe' \ + + '\x00\x00' \ + + '\xa4\x5d\x5c\x42' \ + + '\xa2\x5c\x2e\x05' \ + + '\x5a\x94' \ + + '\x64\xd4' buf += match @@ -4364,17 +4360,17 @@ class TestOFPFlowStatsReply(unittest.TestCase): packet_count = {'buf': '\x47\x5c\xc6\x05\x28\xff\x7c\xdb', 'val': 5142202600015232219} byte_count = {'buf': '\x24\xe9\x4b\xee\xcb\x57\xd9\xc3', - 'val': 2659740543924820419} - - buf += duration_sec['buf'] \ - + duration_nsec['buf'] \ - + priority['buf'] \ - + idle_timeout['buf'] \ - + hard_timeout['buf'] \ - + zfill \ - + cookie['buf'] \ - + packet_count['buf'] \ - + byte_count['buf'] + 'val': 2659740543924820419} + + buf += duration_sec['buf'] + buf += duration_nsec['buf'] + buf += priority['buf'] + buf += idle_timeout['buf'] + buf += hard_timeout['buf'] + buf += zfill + buf += cookie['buf'] + buf += packet_count['buf'] + buf += byte_count['buf'] # <action>_PACK_STR...type_, len_ [others...] type = {'buf': '\x00\x00', 'val': ofproto_v1_0.OFPAT_OUTPUT} @@ -4467,9 +4463,9 @@ class TestOFPAggregateStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x00\x4c', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_AGGREGATE_STATS_REPLY_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_AGGREGATE_STATS_REPLY_SIZE + msg_len = {'buf': '\x00\x4c', 'val': msg_len_val} xid = {'buf': '\xc6\xd6\xce\x38', 'val': 3335966264} buf = version['buf'] \ @@ -4564,9 +4560,9 @@ class TestOFPTableStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x00\x4c', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_TABLE_STATS_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_TABLE_STATS_SIZE + msg_len = {'buf': '\x00\x4c', 'val': msg_len_val} xid = {'buf': '\xd6\xb4\x8d\xe6', 'val': 3602157030} buf = version['buf'] \ @@ -4674,9 +4670,9 @@ class TestOFPPortStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x00\x74', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_PORT_STATS_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_PORT_STATS_SIZE + msg_len = {'buf': '\x00\x74', 'val': msg_len_val} xid = {'buf': '\xc2\xaf\x3d\xff', 'val': 3266264575} buf = version['buf'] \ @@ -4814,9 +4810,9 @@ class TestOFPQueueStatsReply(unittest.TestCase): def test_parser(self): version = {'buf': '\x01', 'val': ofproto_v1_0.OFP_VERSION} msg_type = {'buf': '\x11', 'val': ofproto_v1_0.OFPT_STATS_REPLY} - msg_len = {'buf': '\x00\x2c', - 'val': ofproto_v1_0.OFP_STATS_MSG_SIZE \ - + ofproto_v1_0.OFP_QUEUE_STATS_SIZE} + msg_len_val = ofproto_v1_0.OFP_STATS_MSG_SIZE \ + + ofproto_v1_0.OFP_QUEUE_STATS_SIZE + msg_len = {'buf': '\x00\x2c', 'val': msg_len_val} xid = {'buf': '\x19\xfc\x28\x6c', 'val': 435955820} buf = version['buf'] \ @@ -5430,9 +5426,9 @@ class TestOFPQueueGetConfigRequest(unittest.TestCase): eq_(ofproto_v1_0.OFPT_QUEUE_GET_CONFIG_REQUEST, self.c.msg_type) eq_(0, self.c.xid) - fmt = '!' \ - + ofproto_v1_0.OFP_HEADER_PACK_STR.replace('!', '') \ - + ofproto_v1_0.OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR.replace('!', '') + a = ofproto_v1_0.OFP_HEADER_PACK_STR.replace('!', '') + b = ofproto_v1_0.OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR.replace('!', '') + fmt = '!' + a + b res = struct.unpack(fmt, str(self.c.buf)) eq_(ofproto_v1_0.OFP_VERSION, res[0]) diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py b/ryu/tests/unit/ofproto/test_parser_v12.py index 371395a6..5efd527a 100644 --- a/ryu/tests/unit/ofproto/test_parser_v12.py +++ b/ryu/tests/unit/ofproto/test_parser_v12.py @@ -86,11 +86,11 @@ class TestOFPHello(unittest.TestCase): def test_parser(self): xid = 2183948390 - res = OFPHello.parser(object, \ - ofproto_v1_2.OFP_VERSION, \ - ofproto_v1_2.OFPT_HELLO, \ - ofproto_v1_2.OFP_HEADER_SIZE, \ - xid, \ + res = OFPHello.parser(object, + ofproto_v1_2.OFP_VERSION, + ofproto_v1_2.OFPT_HELLO, + ofproto_v1_2.OFP_HEADER_SIZE, + xid, str().zfill(ofproto_v1_2.OFP_HEADER_SIZE)) eq_(ofproto_v1_2.OFP_VERSION, res.version) @@ -380,7 +380,7 @@ class TestOFPPort(unittest.TestCase): fmt = ofproto_v1_2.OFP_PORT_PACK_STR buf = pack(fmt, port_no, hw_addr, name, config, state, curr, - advertised, supported, peer, curr_speed, max_speed) + advertised, supported, peer, curr_speed, max_speed) c = OFPPort(port_no, hw_addr, name, config, state, curr, advertised, supported, peer, curr_speed, max_speed) @@ -482,7 +482,7 @@ class TestOFPSwitchFeatures(unittest.TestCase): version = ofproto_v1_2.OFP_VERSION msg_type = ofproto_v1_2.OFPT_FEATURES_REPLY msg_len = ofproto_v1_2.OFP_SWITCH_FEATURES_SIZE \ - + ofproto_v1_2.OFP_PORT_SIZE + + ofproto_v1_2.OFP_PORT_SIZE xid = 2495926989 fmt = ofproto_v1_2.OFP_HEADER_PACK_STR @@ -1130,7 +1130,7 @@ class TestOFPInstructionActions(unittest.TestCase): # '!HH4x'...type, len, pad(4) type_ = ofproto_v1_2.OFPIT_WRITE_ACTIONS len_ = ofproto_v1_2.OFP_INSTRUCTION_ACTIONS_SIZE \ - + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE + + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE fmt = ofproto_v1_2.OFP_INSTRUCTION_ACTIONS_PACK_STR buf = pack(fmt, type_, len_) @@ -1835,7 +1835,7 @@ class TestOFPBucket(unittest.TestCase): # OFP_BUCKET_PACK_STR # '!HHII4x'...len, weight, watch_port, watch_group, pad(4) len_ = ofproto_v1_2.OFP_BUCKET_SIZE \ - + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE + + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE weight = 4386 watch_port = 6606 watch_group = 3 @@ -2010,8 +2010,8 @@ class TestOFPPortMod(unittest.TestCase): eq_(0, self.c.xid) fmt = '!' \ - + ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') \ - + ofproto_v1_2.OFP_PORT_MOD_PACK_STR.replace('!', '') + + ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') \ + + ofproto_v1_2.OFP_PORT_MOD_PACK_STR.replace('!', '') res = struct.unpack(fmt, str(self.c.buf)) @@ -2059,8 +2059,8 @@ class TestOFPTableMod(unittest.TestCase): eq_(0, self.c.xid) fmt = '!' \ - + ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') \ - + ofproto_v1_2.OFP_TABLE_MOD_PACK_STR.replace('!', '') + + ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') \ + + ofproto_v1_2.OFP_TABLE_MOD_PACK_STR.replace('!', '') res = struct.unpack(fmt, str(self.c.buf)) @@ -2321,8 +2321,9 @@ class TestOFPFlowStatsRequest(unittest.TestCase): eq_(res[0], ofproto_v1_2.OFP_VERSION) eq_(res[1], ofproto_v1_2.OFPT_STATS_REQUEST) - eq_(res[2], ofproto_v1_2.OFP_STATS_REPLY_SIZE \ - + ofproto_v1_2.OFP_FLOW_STATS_REQUEST_SIZE) + size = ofproto_v1_2.OFP_STATS_REPLY_SIZE \ + + ofproto_v1_2.OFP_FLOW_STATS_REQUEST_SIZE + eq_(res[2], size) eq_(res[3], 0) eq_(res[4], ofproto_v1_2.OFPST_FLOW) eq_(res[5], 0) @@ -2342,7 +2343,7 @@ class TestOFPFlowStats(unittest.TestCase): # priority, idle_timeoutl, hard_timeout, pad(6), # cookie, packet_count, byte_count length = ofproto_v1_2.OFP_FLOW_STATS_SIZE \ - + ofproto_v1_2.OFP_INSTRUCTION_GOTO_TABLE_SIZE + + ofproto_v1_2.OFP_INSTRUCTION_GOTO_TABLE_SIZE table_id = 81 duration_sec = 2484712402 duration_nsec = 3999715196 @@ -2464,8 +2465,9 @@ class TestOFPAggregateStatsRequest(unittest.TestCase): eq_(res[0], ofproto_v1_2.OFP_VERSION) eq_(res[1], ofproto_v1_2.OFPT_STATS_REQUEST) - eq_(res[2], ofproto_v1_2.OFP_STATS_REPLY_SIZE + - ofproto_v1_2.OFP_AGGREGATE_STATS_REQUEST_SIZE) + size = ofproto_v1_2.OFP_STATS_REPLY_SIZE \ + + ofproto_v1_2.OFP_AGGREGATE_STATS_REQUEST_SIZE + eq_(res[2], size) eq_(res[3], 0) eq_(res[4], ofproto_v1_2.OFPST_AGGREGATE) eq_(res[5], 0) @@ -2632,8 +2634,9 @@ class TestOFPPortStatsRequest(unittest.TestCase): eq_(res[0], ofproto_v1_2.OFP_VERSION) eq_(res[1], ofproto_v1_2.OFPT_STATS_REQUEST) - eq_(res[2], ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ - + ofproto_v1_2.OFP_PORT_STATS_REQUEST_SIZE) + size = ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ + + ofproto_v1_2.OFP_PORT_STATS_REQUEST_SIZE + eq_(res[2], size) eq_(res[3], 0) eq_(res[4], ofproto_v1_2.OFPST_PORT) eq_(res[5], 0) @@ -2735,8 +2738,9 @@ class TestOFPQueueStatsRequest(unittest.TestCase): eq_(res[0], ofproto_v1_2.OFP_VERSION) eq_(res[1], ofproto_v1_2.OFPT_STATS_REQUEST) - eq_(res[2], ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ - + ofproto_v1_2.OFP_QUEUE_STATS_REQUEST_SIZE) + size = ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ + + ofproto_v1_2.OFP_QUEUE_STATS_REQUEST_SIZE + eq_(res[2], size) eq_(res[3], 0) eq_(res[4], ofproto_v1_2.OFPST_QUEUE) eq_(res[5], 0) @@ -2847,8 +2851,9 @@ class TestOFPGroupStatsRequest(unittest.TestCase): eq_(res[0], ofproto_v1_2.OFP_VERSION) eq_(res[1], ofproto_v1_2.OFPT_STATS_REQUEST) - eq_(res[2], ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ - + ofproto_v1_2.OFP_GROUP_STATS_REQUEST_SIZE) + size = ofproto_v1_2.OFP_STATS_REQUEST_SIZE \ + + ofproto_v1_2.OFP_GROUP_STATS_REQUEST_SIZE + eq_(res[2], size) eq_(res[3], 0) eq_(res[4], ofproto_v1_2.OFPST_GROUP) eq_(res[5], 0) @@ -2861,7 +2866,7 @@ class TestOFPGroupStats(unittest.TestCase): # OFP_GROUP_STATS_PACK_STR = '!H2xII4xQQ' length = ofproto_v1_2.OFP_GROUP_STATS_SIZE \ - + ofproto_v1_2.OFP_BUCKET_COUNTER_SIZE + + ofproto_v1_2.OFP_BUCKET_COUNTER_SIZE group_id = 6606 ref_count = 2102 packet_count = 6489108735192644493 @@ -2931,8 +2936,8 @@ class TestOFPGroupDescStats(unittest.TestCase): # OFP_GROUP_DESC_STATS_PACK_STR = '!HBxI' length = ofproto_v1_2.OFP_GROUP_DESC_STATS_SIZE \ - + ofproto_v1_2.OFP_BUCKET_SIZE \ - + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE + + ofproto_v1_2.OFP_BUCKET_SIZE \ + + ofproto_v1_2.OFP_ACTION_OUTPUT_SIZE type_ = ofproto_v1_2.OFPGT_ALL group_id = 6606 @@ -3122,9 +3127,9 @@ class TestOFPQueueGetConfigRequest(unittest.TestCase): eq_(ofproto_v1_2.OFPT_QUEUE_GET_CONFIG_REQUEST, self.c.msg_type) eq_(0, self.c.xid) - fmt = '!' \ - + ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') \ - + ofproto_v1_2.OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR.replace('!', '') + a = ofproto_v1_2.OFP_HEADER_PACK_STR.replace('!', '') + b = ofproto_v1_2.OFP_QUEUE_GET_CONFIG_REQUEST_PACK_STR.replace('!', '') + fmt = '!' + a + b res = struct.unpack(fmt, str(self.c.buf)) @@ -3178,8 +3183,8 @@ class TestOFPQueueGetConfigReply(unittest.TestCase): version = ofproto_v1_2.OFP_VERSION msg_type = ofproto_v1_2.OFPT_QUEUE_GET_CONFIG_REPLY msg_len = ofproto_v1_2.OFP_QUEUE_GET_CONFIG_REPLY_SIZE \ - + ofproto_v1_2.OFP_PACKET_QUEUE_SIZE \ - + ofproto_v1_2.OFP_QUEUE_PROP_HEADER_SIZE + + ofproto_v1_2.OFP_PACKET_QUEUE_SIZE \ + + ofproto_v1_2.OFP_QUEUE_PROP_HEADER_SIZE xid = 2495926989 fmt = ofproto_v1_2.OFP_HEADER_PACK_STR @@ -3206,7 +3211,7 @@ class TestOFPQueueGetConfigReply(unittest.TestCase): queue_id = 6606 queue_port = 41186 queue_len = ofproto_v1_2.OFP_PACKET_QUEUE_SIZE \ - + ofproto_v1_2.OFP_QUEUE_PROP_HEADER_SIZE + + ofproto_v1_2.OFP_QUEUE_PROP_HEADER_SIZE queues = [OFPPacketQueue(queue_id, queue_port, queue_len, properties)] fmt = ofproto_v1_2.OFP_PACKET_QUEUE_PACK_STR |