X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_lb.py;h=3e7f5e13faf78fd083e396b6f1c322bdb16180e7;hb=7bb873a4cc068a6cc3c9d0e1d32987c5f8003904;hp=76fdd6933976bf0046e5bfdb0aad81c078520df8;hpb=f62ae1288a776527c7f7ba3951531fbd07bc63da;p=vpp.git diff --git a/test/test_lb.py b/test/test_lb.py index 76fdd693397..3e7f5e13faf 100644 --- a/test/test_lb.py +++ b/test/test_lb.py @@ -1,6 +1,4 @@ import socket -import unittest -from logging import * from scapy.layers.inet import IP, UDP from scapy.layers.inet6 import IPv6 @@ -8,6 +6,7 @@ from scapy.layers.l2 import Ether, GRE from scapy.packet import Raw from framework import VppTestCase +from util import ppp """ TestLB is a subclass of VPPTestCase classes. @@ -58,7 +57,7 @@ class TestLB(VppTestCase): def tearDown(self): super(TestLB, self).tearDown() if not self.vpp_dead: - info(self.vapi.cli("show lb vip verbose")) + self.logger.info(self.vapi.cli("show lb vip verbose")) def getIPv4Flow(self, id): return (IP(dst="90.0.%u.%u" % (id / 255, id % 255), @@ -70,6 +69,7 @@ class TestLB(VppTestCase): UDP(sport=10000 + id, dport=20000 + id)) def generatePackets(self, src_if, isv4): + self.packet_infos = {} pkts = [] for pktid in self.packets: info = self.create_packet_info(src_if.sw_if_index, pktid) @@ -90,10 +90,8 @@ class TestLB(VppTestCase): self.assertEqual(gre.version, 0) inner = IPver(str(gre.payload)) payload_info = self.payload_to_info(str(inner[Raw])) - packet_index = payload_info.index - self.info = self.get_next_packet_info_for_interface2(self.pg0.sw_if_index, - payload_info.dst, - self.info) + self.info = self.get_next_packet_info_for_interface2( + self.pg0.sw_if_index, payload_info.dst, self.info) self.assertEqual(str(inner), str(self.info.data[IPver])) def checkCapture(self, gre4, isv4): @@ -141,8 +139,7 @@ class TestLB(VppTestCase): self.checkInner(gre, isv4) load[asid] += 1 except: - error("Unexpected or invalid packet:") - p.show() + self.logger.error(ppp("Unexpected or invalid packet:", p)) raise # This is just to roughly check that the balancing algorithm @@ -199,9 +196,6 @@ class TestLB(VppTestCase): self.pg_enable_capture(self.pg_interfaces) self.pg_start() - # Scapy fails parsing GRE over IPv6. - # This check is therefore disabled for now. - # One can easily patch layers/inet6.py to fix the issue. self.checkCapture(gre4=False, isv4=True) finally: for asid in self.ass: