X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_l2xc_multi_instance.py;h=2a6e41c8791e7e8fc2e2a809fa6800e74fdba79d;hb=7c0eb56f4;hp=6c28cebbcbce25e01ae5c2821862cdf4f75076bc;hpb=dab231a11ec96e829b22ff80c612333edc5a93e6;p=vpp.git diff --git a/test/test_l2xc_multi_instance.py b/test/test_l2xc_multi_instance.py index 6c28cebbcbc..2a6e41c8791 100644 --- a/test/test_l2xc_multi_instance.py +++ b/test/test_l2xc_multi_instance.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """L2XC Multi-instance Test Case HLD: **NOTES:** - - higher number (more than 15) of pg-l2 interfaces causes problems => only \ - 14 pg-l2 interfaces and 10 cross-connects are tested - - jumbo packets in configuration with 14 l2-pg interfaces leads to \ - problems too + - higher number (more than 15) of pg-l2 interfaces causes problems => only + 14 pg-l2 interfaces and 10 cross-connects are tested + - jumbo packets in configuration with 14 l2-pg interfaces leads to + problems too **config 1** - add 14 pg-l2 interfaces @@ -15,7 +15,8 @@ - send L2 MAC frames between all pairs of pg-l2 interfaces **verify 1** - - all packets received correctly in case of cross-connected l2-pg interfaces + - all packets received correctly in case of cross-connected l2-pg + interfaces - no packet received in case of not cross-connected l2-pg interfaces **config 2** @@ -25,7 +26,8 @@ - send L2 MAC frames between all pairs of pg-l2 interfaces **verify 2** - - all packets received correctly in case of cross-connected l2-pg interfaces + - all packets received correctly in case of cross-connected l2-pg + interfaces - no packet received in case of not cross-connected l2-pg interfaces **config 3** @@ -35,7 +37,8 @@ - send L2 MAC frames between all pairs of pg-l2 interfaces **verify 3** - - all packets received correctly in case of cross-connected l2-pg interfaces + - all packets received correctly in case of cross-connected l2-pg + interfaces - no packet received in case of not cross-connected l2-pg interfaces **config 4** @@ -79,7 +82,8 @@ class TestL2xcMultiInst(VppTestCase): cls.flows = dict() for i in range(len(cls.pg_interfaces)): delta = 1 if i % 2 == 0 else -1 - cls.flows[cls.pg_interfaces[i]] = [cls.pg_interfaces[i + delta]] + cls.flows[cls.pg_interfaces[i]] =\ + [cls.pg_interfaces[i + delta]] # Mapping between packet-generator index and lists of test hosts cls.hosts_by_pg_idx = dict() @@ -108,6 +112,10 @@ class TestL2xcMultiInst(VppTestCase): super(TestL2xcMultiInst, cls).tearDownClass() raise + @classmethod + def tearDownClass(cls): + super(TestL2xcMultiInst, cls).tearDownClass() + def setUp(self): """ Clear trace and packet infos before running each test. @@ -120,8 +128,9 @@ class TestL2xcMultiInst(VppTestCase): Show various debug prints after each test. """ super(TestL2xcMultiInst, self).tearDown() - if not self.vpp_dead: - self.logger.info(self.vapi.ppcli("show l2patch")) + + def show_commands_at_teardown(self): + self.logger.info(self.vapi.ppcli("show l2patch")) @classmethod def create_hosts(cls, count): @@ -132,7 +141,7 @@ class TestL2xcMultiInst(VppTestCase): :param int count: Number of hosts to create MAC/IPv4 addresses for. """ n_int = len(cls.pg_interfaces) - macs_per_if = count / n_int + macs_per_if = count // n_int i = -1 for pg_if in cls.pg_interfaces: i += 1 @@ -231,7 +240,7 @@ class TestL2xcMultiInst(VppTestCase): last_info[i.sw_if_index] = None dst_sw_if_index = pg_if.sw_if_index for packet in capture: - payload_info = self.payload_to_info(str(packet[Raw])) + payload_info = self.payload_to_info(packet[Raw]) try: ip = packet[IP] udp = packet[UDP]