X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_classifier.py;h=f62a76ded6fb14b85a0ea24336d20ae9fd7c39e8;hb=d3a9be2ca0b527bfeac808a822319e69e0d7fe76;hp=8d4bde8e730d9c5adb7b628a928bbc45c15674ba;hpb=8d991d923b52a2692370bfa33902d29ff5d2f826;p=vpp.git diff --git a/test/test_classifier.py b/test/test_classifier.py index 8d4bde8e730..f62a76ded6f 100644 --- a/test/test_classifier.py +++ b/test/test_classifier.py @@ -141,7 +141,7 @@ class TestClassifier(VppTestCase): try: ip_received = packet[IP] proto_received = packet[proto_l] - payload_info = self.payload_to_info(str(packet[Raw])) + payload_info = self.payload_to_info(packet[Raw]) packet_index = payload_info.index self.assertEqual(payload_info.dst, dst_sw_if_index) self.logger.debug( @@ -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