Revert "ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums"
[vpp.git] / test / framework.py
index dd4774d..f90197b 100644 (file)
@@ -25,7 +25,6 @@ from vpp_papi_provider import VppPapiProvider
 from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \
     getLogger, colorize
 from vpp_object import VppObjectRegistry
-from util import ppp
 from scapy.layers.inet import IPerror, TCPerror, UDPerror, ICMPerror
 from scapy.layers.inet6 import ICMPv6DestUnreach, ICMPv6EchoRequest
 from scapy.layers.inet6 import ICMPv6EchoReply
@@ -558,16 +557,18 @@ class VppTestCase(unittest.TestCase):
         return result
 
     @classmethod
-    def create_loopback_interfaces(cls, count):
+    def create_loopback_interfaces(cls, interfaces):
         """
         Create loopback interfaces.
 
-        :param count: number of interfaces created.
+        :param interfaces: iterable indexes of the interfaces.
         :returns: List of created interfaces.
         """
-        result = [VppLoInterface(cls) for i in range(count)]
-        for intf in result:
+        result = []
+        for i in interfaces:
+            intf = VppLoInterface(cls, i)
             setattr(cls, intf.name, intf)
+            result.append(intf)
         cls.lo_interfaces = result
         return result
 
@@ -734,14 +735,11 @@ class VppTestCase(unittest.TestCase):
 
     def assert_packet_checksums_valid(self, packet,
                                       ignore_zero_udp_checksums=True):
-        received = packet.__class__(str(packet))
-        self.logger.debug(
-            ppp("Verifying packet checksums for packet:", received))
         udp_layers = ['UDP', 'UDPerror']
         checksum_fields = ['cksum', 'chksum']
         checksums = []
         counter = 0
-        temp = received.__class__(str(received))
+        temp = packet.__class__(str(packet))
         while True:
             layer = temp.getlayer(counter)
             if layer:
@@ -756,17 +754,12 @@ class VppTestCase(unittest.TestCase):
             else:
                 break
             counter = counter + 1
-        if 0 == len(checksums):
-            return
         temp = temp.__class__(str(temp))
         for layer, cf in checksums:
-            calc_sum = getattr(temp[layer], cf)
-            self.assert_equal(
-                getattr(received[layer], cf), calc_sum,
-                "packet checksum on layer #%d: %s" % (layer, temp[layer].name))
-            self.logger.debug(
-                "Checksum field `%s` on `%s` layer has correct value `%s`" %
-                (cf, temp[layer].name, calc_sum))
+            self.assert_equal(getattr(packet[layer], cf),
+                              getattr(temp[layer], cf),
+                              "packet checksum on layer #%d: %s" % (
+                                  layer, temp[layer].name))
 
     def assert_checksum_valid(self, received_packet, layer,
                               field_name='chksum',