python3: encode from string to bytes for s type of pack format

Signed-off-by: Fumihiko Kakuma <kakuma@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
fumihiko kakuma 2015-06-29 16:00:58 +09:00 committed by FUJITA Tomonori
parent 4099aec69a
commit 8c8be53de6
2 changed files with 10 additions and 11 deletions

View File

@ -1513,8 +1513,6 @@ class TestOFPPort(unittest.TestCase):
max_speed = 1797291672
fmt = ofproto.OFP_PORT_PACK_STR
buf = pack(fmt, port_no, hw_addr, name, config, state, curr,
advertised, supported, peer, curr_speed, max_speed)
c = OFPPort(port_no, hw_addr, name, config, state, curr,
advertised, supported, peer, curr_speed, max_speed)
@ -1533,7 +1531,7 @@ class TestOFPPort(unittest.TestCase):
def _test_parser(self, port_no, hw_addr, config, state, curr, advertised,
supported, peer, curr_speed, max_speed):
name = 'name'.ljust(16)
name = b'name'.ljust(16)
fmt = ofproto.OFP_PORT_PACK_STR
buf = pack(fmt, port_no, addrconv.mac.text_to_bin(hw_addr), name,
config, state, curr,
@ -2348,7 +2346,7 @@ class TestOFPPortStatus(unittest.TestCase):
# name, config, state, curr, advertised,
# peer, curr_speed, max_speed
hw_addr = '80:ff:9a:e3:72:85'
name = 'name'.ljust(16)
name = b'name'.ljust(16)
fmt = ofproto.OFP_PORT_STATUS_PACK_STR
buf += pack(fmt, reason, port_no, addrconv.mac.text_to_bin(hw_addr),
@ -4977,7 +4975,8 @@ class TestOFPTableStats(unittest.TestCase):
# instructions, config, max_entries,
# active_count, lookup_count, matched_count
fmt = ofproto.OFP_TABLE_STATS_PACK_STR
buf = pack(fmt, table_id, name, match, wildcards, write_actions,
buf = pack(fmt, table_id, name,
match, wildcards, write_actions,
apply_actions, write_setfields, apply_setfields,
metadata_match, metadata_write, instructions, config,
max_entries, active_count, lookup_count, matched_count)
@ -5003,7 +5002,7 @@ class TestOFPTableStats(unittest.TestCase):
def test_parser_mid(self):
table_id = 91
name = 'name'
name = b'name'
match = 1270985291017894273
wildcards = 3316608530
write_actions = 2484712402
@ -5028,7 +5027,7 @@ class TestOFPTableStats(unittest.TestCase):
def test_parser_max(self):
# '!B7x32sQQIIQQQQIIIIQQ'
table_id = 0xff
name = 'a' * 32
name = b'a' * 32
match = 0xffffffffffffffff
wildcards = 0xffffffffffffffff
write_actions = 0xffffffff
@ -5052,7 +5051,7 @@ class TestOFPTableStats(unittest.TestCase):
def test_parser_min(self):
table_id = 0
name = ''
name = b''
match = 0
wildcards = 0
write_actions = 0
@ -5076,7 +5075,7 @@ class TestOFPTableStats(unittest.TestCase):
def _test_parser_p(self, ofpxmt, ofpit, ofptc):
table_id = 91
name = 'name'
name = b'name'
match = ofpxmt
wildcards = ofpxmt
write_actions = 2484712402

View File

@ -111,7 +111,7 @@ class Test_slow(unittest.TestCase):
self.actor_tag,
self.actor_length,
self.actor_system_priority,
self.actor_system,
addrconv.mac.text_to_bin(self.actor_system),
self.actor_key,
self.actor_port_priority,
self.actor_port,
@ -120,7 +120,7 @@ class Test_slow(unittest.TestCase):
self.partner_tag,
self.partner_length,
self.partner_system_priority,
self.partner_system,
addrconv.mac.text_to_bin(self.partner_system),
self.partner_key,
self.partner_port_priority,
self.partner_port,