VPP-1508: Python3 tests. Explicitly specify string formatting.
[vpp.git] / test / test_ip4.py
index 685d089..b6553db 100644 (file)
@@ -395,7 +395,7 @@ class TestIPv4FibCrud(VppTestCase):
 
         for ip in ips:
             self.assertTrue(_ip_in_route_dump(ip, fib_dump),
-                            'IP {} is not in fib dump.'.format(ip))
+                            'IP {!s} is not in fib dump.'.format(ip))
 
     def verify_not_in_route_dump(self, fib_dump, ips):
 
@@ -406,7 +406,7 @@ class TestIPv4FibCrud(VppTestCase):
 
         for ip in ips:
             self.assertFalse(_ip_in_route_dump(ip, fib_dump),
-                             'IP {} is in fib dump.'.format(ip))
+                             'IP {!s} is in fib dump.'.format(ip))
 
     @classmethod
     def setUpClass(cls):
@@ -441,6 +441,9 @@ class TestIPv4FibCrud(VppTestCase):
         super(TestIPv4FibCrud, self).setUp()
         self.reset_packet_infos()
 
+        self.configured_routes = []
+        self.deleted_routes = []
+
     def test_1_add_routes(self):
         """ Add 1k routes
 
@@ -471,6 +474,9 @@ class TestIPv4FibCrud(VppTestCase):
 
         - delete 10 routes check with traffic script.
         """
+        # config 1M FIB entries
+        self.configured_routes.extend(self.config_fib_many_to_one(
+            "10.0.0.0", self.pg0.remote_ip4, 100))
         self.deleted_routes.extend(self.unconfig_fib_many_to_one(
             "10.0.0.10", self.pg0.remote_ip4, 10))
         for x in self.deleted_routes:
@@ -501,6 +507,14 @@ class TestIPv4FibCrud(VppTestCase):
         - re-add 5 routes check with traffic script.
         - add 100 routes check with traffic script.
         """
+        # config 1M FIB entries
+        self.configured_routes.extend(self.config_fib_many_to_one(
+            "10.0.0.0", self.pg0.remote_ip4, 100))
+        self.deleted_routes.extend(self.unconfig_fib_many_to_one(
+            "10.0.0.10", self.pg0.remote_ip4, 10))
+        for x in self.deleted_routes:
+            self.configured_routes.remove(x)
+
         tmp = self.config_fib_many_to_one(
             "10.0.0.10", self.pg0.remote_ip4, 5)
         self.configured_routes.extend(tmp)
@@ -790,9 +804,9 @@ class TestIPSubNets(VppTestCase):
         #
         ip_addr_n = socket.inet_pton(socket.AF_INET, "10.10.10.10")
 
-        self.vapi.sw_interface_add_del_address(self.pg0.sw_if_index,
-                                               ip_addr_n,
-                                               16)
+        self.vapi.sw_interface_add_del_address(
+            sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+            address_length=16)
 
         pn = (Ether(src=self.pg1.remote_mac,
                     dst=self.pg1.local_mac) /
@@ -809,10 +823,9 @@ class TestIPSubNets(VppTestCase):
         self.send_and_assert_no_replies(self.pg1, pb, "IP Broadcast address")
 
         # remove the sub-net and we are forwarding via the cover again
-        self.vapi.sw_interface_add_del_address(self.pg0.sw_if_index,
-                                               ip_addr_n,
-                                               16,
-                                               is_add=0)
+        self.vapi.sw_interface_add_del_address(
+            sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+            address_length=16, is_add=0)
         self.pg1.add_stream(pn)
         self.pg_enable_capture(self.pg_interfaces)
         self.pg_start()
@@ -828,9 +841,9 @@ class TestIPSubNets(VppTestCase):
         #
         ip_addr_n = socket.inet_pton(socket.AF_INET, "10.10.10.10")
 
-        self.vapi.sw_interface_add_del_address(self.pg0.sw_if_index,
-                                               ip_addr_n,
-                                               31)
+        self.vapi.sw_interface_add_del_address(
+            sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+            address_length=31)
 
         pn = (Ether(src=self.pg1.remote_mac,
                     dst=self.pg1.local_mac) /
@@ -845,10 +858,9 @@ class TestIPSubNets(VppTestCase):
         rx[ARP]
 
         # remove the sub-net and we are forwarding via the cover again
-        self.vapi.sw_interface_add_del_address(self.pg0.sw_if_index,
-                                               ip_addr_n,
-                                               31,
-                                               is_add=0)
+        self.vapi.sw_interface_add_del_address(
+            sw_if_index=self.pg0.sw_if_index, address=ip_addr_n,
+            address_length=31, is_add=0)
         self.pg1.add_stream(pn)
         self.pg_enable_capture(self.pg_interfaces)
         self.pg_start()