VPP-1508: Python3 tests. Explicitly specify string formatting.
.format() doesn't understand what to do with binary values by default. Specify that we expect coersion to string. Change-Id: Ic4b697f70852124dc85ab231f76b7934d0d71f4d Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:

committed by
Ole Trøan

parent
4a4cea02ef
commit
ea2450fa2d
@ -202,7 +202,7 @@ class TestClassifier(VppTestCase):
|
||||
:param str dst_port: destination port number <0-ffff>
|
||||
"""
|
||||
|
||||
return ('{:0>20}{:0>12}{:0>8}{:0>4}{:0>4}'.format(
|
||||
return ('{!s:0>20}{!s:0>12}{!s:0>8}{!s:0>4}{!s:0>4}'.format(
|
||||
proto, src_ip, dst_ip, src_port, dst_port)).rstrip('0')
|
||||
|
||||
@staticmethod
|
||||
@ -221,7 +221,7 @@ class TestClassifier(VppTestCase):
|
||||
if dst_ip:
|
||||
dst_ip = binascii.hexlify(socket.inet_aton(dst_ip))
|
||||
|
||||
return ('{:0>20}{:0>12}{:0>8}{:0>4}{:0>4}'.format(
|
||||
return ('{!s:0>20}{!s:0>12}{!s:0>8}{!s:0>4}{!s:0>4}'.format(
|
||||
hex(proto)[2:], src_ip, dst_ip, hex(src_port)[2:],
|
||||
hex(dst_port)[2:])).rstrip('0')
|
||||
|
||||
@ -234,8 +234,8 @@ class TestClassifier(VppTestCase):
|
||||
:param str ether_type: ethernet type <0-ffff>
|
||||
"""
|
||||
|
||||
return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac,
|
||||
ether_type)).rstrip('0')
|
||||
return ('{!s:0>12}{!s:0>12}{!s:0>4}'.format(
|
||||
dst_mac, src_mac, ether_type)).rstrip('0')
|
||||
|
||||
@staticmethod
|
||||
def build_mac_match(dst_mac='', src_mac='', ether_type=''):
|
||||
@ -250,8 +250,8 @@ class TestClassifier(VppTestCase):
|
||||
if src_mac:
|
||||
src_mac = src_mac.replace(':', '')
|
||||
|
||||
return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac,
|
||||
ether_type)).rstrip('0')
|
||||
return ('{!s:0>12}{!s:0>12}{!s:0>4}'.format(
|
||||
dst_mac, src_mac, ether_type)).rstrip('0')
|
||||
|
||||
def create_classify_table(self, key, mask, data_offset=0):
|
||||
"""Create Classify Table
|
||||
|
Reference in New Issue
Block a user