X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_classify_l2_acl.py;h=8ba7181aef1d5ffe131e58706ddd3922738bbf56;hb=e41fd65381128642803677a6272f9eb02a46ece6;hp=d9557ee7ef2213572e584a4ac76f73f3b18e192c;hpb=059d1d0e01a59769d2c3f3f978f50120d64a6976;p=vpp.git diff --git a/test/test_classify_l2_acl.py b/test/test_classify_l2_acl.py index d9557ee7ef2..8ba7181aef1 100644 --- a/test/test_classify_l2_acl.py +++ b/test/test_classify_l2_acl.py @@ -105,8 +105,8 @@ class TestClassifyAcl(VppTestCase): cls.vapi.bridge_domain_add_del(bd_id=cls.bd_id, uu_flood=1, learn=1) for pg_if in cls.pg_interfaces: - cls.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id) # Set up all interfaces for i in cls.pg_interfaces: @@ -132,6 +132,10 @@ class TestClassifyAcl(VppTestCase): super(TestClassifyAcl, cls).tearDownClass() raise + @classmethod + def tearDownClass(cls): + super(TestClassifyAcl, cls).tearDownClass() + def setUp(self): super(TestClassifyAcl, self).setUp() @@ -143,11 +147,6 @@ class TestClassifyAcl(VppTestCase): Show various debug prints after each test. """ if not self.vpp_dead: - self.logger.info(self.vapi.ppcli("show inacl type l2")) - self.logger.info(self.vapi.ppcli("show outacl type l2")) - self.logger.info(self.vapi.ppcli("show classify tables verbose")) - self.logger.info(self.vapi.ppcli("show bridge-domain %s detail" - % self.bd_id)) if self.acl_active_table == 'mac_inout': self.output_acl_set_interface( self.pg1, self.acl_tbl_idx.get(self.acl_active_table), 0) @@ -165,6 +164,13 @@ class TestClassifyAcl(VppTestCase): super(TestClassifyAcl, self).tearDown() + def show_commands_at_teardown(self): + self.logger.info(self.vapi.ppcli("show inacl type l2")) + self.logger.info(self.vapi.ppcli("show outacl type l2")) + self.logger.info(self.vapi.ppcli("show classify tables verbose")) + self.logger.info(self.vapi.ppcli("show bridge-domain %s detail" + % self.bd_id)) + @staticmethod def build_mac_mask(dst_mac='', src_mac='', ether_type=''): """Build MAC ACL mask data with hexstring format @@ -174,8 +180,8 @@ class TestClassifyAcl(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=''): @@ -190,8 +196,8 @@ class TestClassifyAcl(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, is_add=1): """Create Classify Table @@ -209,7 +215,7 @@ class TestClassifyAcl(VppTestCase): miss_next_index=0, current_data_flag=1, current_data_offset=data_offset) - self.assertIsNotNone(r, msg='No response msg for add_del_table') + self.assertIsNotNone(r, 'No response msg for add_del_table') self.acl_tbl_idx[key] = r.new_table_index def create_classify_session(self, intf, table_index, match, @@ -229,7 +235,7 @@ class TestClassifyAcl(VppTestCase): table_index, binascii.unhexlify(match), hit_next_index=hit_next_index) - self.assertIsNotNone(r, msg='No response msg for add_del_session') + self.assertIsNotNone(r, 'No response msg for add_del_session') def input_acl_set_interface(self, intf, table_index, is_add=1): """Configure Input ACL interface @@ -243,7 +249,7 @@ class TestClassifyAcl(VppTestCase): is_add, intf.sw_if_index, l2_table_index=table_index) - self.assertIsNotNone(r, msg='No response msg for acl_set_interface') + self.assertIsNotNone(r, 'No response msg for acl_set_interface') def output_acl_set_interface(self, intf, table_index, is_add=1): """Configure Output ACL interface @@ -257,7 +263,7 @@ class TestClassifyAcl(VppTestCase): is_add, intf.sw_if_index, l2_table_index=table_index) - self.assertIsNotNone(r, msg='No response msg for acl_set_interface') + self.assertIsNotNone(r, 'No response msg for acl_set_interface') def create_hosts(self, count, start=0): """ @@ -396,7 +402,7 @@ class TestClassifyAcl(VppTestCase): packet[ICMPv6EchoRequest].data) payload = packet[ICMPv6EchoRequest] else: - payload_info = self.payload_to_info(str(packet[Raw])) + payload_info = self.payload_to_info(packet[Raw]) payload = packet[self.proto_map[payload_info.proto]] except: self.logger.error(ppp("Unexpected or invalid packet "