python3: Partially revert b'str' conversion
This patch partially reverts75e8c58916
and536a42d8c1
. dhcp.sname is ascii. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
e86e8c88b0
commit
ed5b3edd27
@ -149,7 +149,7 @@ class dhcp(packet_base.PacketBase):
|
||||
def __init__(self, op, chaddr, options, htype=_HARDWARE_TYPE_ETHERNET,
|
||||
hlen=0, hops=0, xid=None, secs=0, flags=0,
|
||||
ciaddr='0.0.0.0', yiaddr='0.0.0.0', siaddr='0.0.0.0',
|
||||
giaddr='0.0.0.0', sname=b'', boot_file=b''):
|
||||
giaddr='0.0.0.0', sname='', boot_file=b''):
|
||||
super(dhcp, self).__init__()
|
||||
self.op = op
|
||||
self.htype = htype
|
||||
|
@ -41,7 +41,7 @@ class Test_dhcp_offer(unittest.TestCase):
|
||||
yiaddr = '192.168.20.20'
|
||||
siaddr = '192.168.30.30'
|
||||
giaddr = '192.168.40.40'
|
||||
sname = b'abc'
|
||||
sname = 'abc'
|
||||
boot_file = b''
|
||||
|
||||
option_list = [
|
||||
@ -124,7 +124,7 @@ class Test_dhcp_offer(unittest.TestCase):
|
||||
eq_(self.giaddr, res.giaddr)
|
||||
eq_(self.chaddr, res.chaddr)
|
||||
# sname is 64 byte length. rest of data is filled by '\x00'.
|
||||
eq_(self.sname.ljust(64, b'\x00'), res.sname)
|
||||
eq_(self.sname.ljust(64, '\x00'), res.sname)
|
||||
# boof_file is 128 byte length. rest of data is filled by '\x00'.
|
||||
eq_(self.boot_file.ljust(128, b'\x00'), res.boot_file)
|
||||
eq_(str(self.options), str(res.options))
|
||||
@ -153,7 +153,7 @@ class Test_dhcp_offer(unittest.TestCase):
|
||||
eq_(self.giaddr, addrconv.ipv4.bin_to_text(res[10]))
|
||||
eq_(self.chaddr, addrconv.mac.bin_to_text(res[11][:6]))
|
||||
# sname is 64 byte length. rest of data is filled by '\x00'.
|
||||
eq_(self.sname.ljust(64, b'\x00'), res[12])
|
||||
eq_(self.sname.ljust(64, '\x00'), res[12].decode('ascii'))
|
||||
# boof_file is 128 byte length. rest of data is filled by '\x00'.
|
||||
eq_(self.boot_file.ljust(128, b'\x00'), res[13])
|
||||
options = dhcp.options.parser(
|
||||
|
Loading…
Reference in New Issue
Block a user