X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_l2_fib.py;h=d4ef3f4a3730ffeb984612fc0aae12d72a0682ed;hb=refs%2Fchanges%2F52%2F4452%2F5;hp=eb4f4e32d1bcb3a70e900248385917d95096fdbe;hpb=4af521d2972af7efcf8ed0678293d2f0e2ce1b45;p=vpp.git diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py index eb4f4e32d1b..d4ef3f4a373 100644 --- a/test/test_l2_fib.py +++ b/test/test_l2_fib.py @@ -68,7 +68,7 @@ from scapy.layers.l2 import Ether from scapy.layers.inet import IP, UDP from framework import VppTestCase, VppTestRunner -from util import Host +from util import Host, ppp class TestL2fib(VppTestCase): @@ -130,11 +130,8 @@ class TestL2fib(VppTestCase): raise def setUp(self): - """ - Clear trace and packet infos before running each test. - """ super(TestL2fib, self).setUp() - self.packet_infos = {} + self.reset_packet_infos() def tearDown(self): """ @@ -236,8 +233,7 @@ class TestL2fib(VppTestCase): for i in range(0, n_int): dst_host = dst_hosts[i] src_host = random.choice(src_hosts) - pkt_info = self.create_packet_info( - src_if.sw_if_index, dst_if.sw_if_index) + pkt_info = self.create_packet_info(src_if, dst_if) payload = self.info_to_payload(pkt_info) p = (Ether(dst=dst_host.mac, src=src_host.mac) / IP(src=src_host.ip4, dst=dst_host.ip4) / @@ -282,8 +278,7 @@ class TestL2fib(VppTestCase): self.assertEqual(udp.sport, saved_packet[UDP].sport) self.assertEqual(udp.dport, saved_packet[UDP].dport) except: - self.logger.error("Unexpected or invalid packet:") - self.logger.error(packet.show()) + self.logger.error(ppp("Unexpected or invalid packet:", packet)) raise for i in self.pg_interfaces: remaining_packet = self.get_next_packet_info_for_interface2( @@ -315,7 +310,7 @@ class TestL2fib(VppTestCase): # Test # Create incoming packet streams for packet-generator interfaces for # deleted MAC addresses - self.packet_infos = {} + self.reset_packet_infos() for i in self.pg_interfaces: pkts = self.create_stream(i, self.pg_if_packet_sizes, deleted=True) i.add_stream(pkts) @@ -327,14 +322,7 @@ class TestL2fib(VppTestCase): # Verify # Verify outgoing packet streams per packet-generator interface for i in self.pg_interfaces: - capture = i.get_capture() - self.logger.info("Verifying capture on interface %s" % i.name) - try: - self.assertEqual(len(capture), 0) - except AssertionError: - self.logger.error("The capture on interface %s is not empty!" - % i.name) - raise AssertionError("%d != 0" % len(capture)) + i.assert_nothing_captured(remark="outgoing interface") def test_l2_fib_01(self): """ L2 FIB test 1 - program 100 MAC addresses