Maintainers list update
[vpp.git] / test / test_dhcp.py
index 3d00f1b..d1af9fd 100644 (file)
@@ -360,6 +360,16 @@ class TestDHCP(VppTestCase):
         # not sure why this is not decoding
         # adv = pkt[DHCP6_Advertise]
 
+    def wait_for_no_route(self, address, length,
+                          n_tries=50, s_time=1):
+        while (n_tries):
+            if not find_route(self, address, length):
+                return True
+            n_tries = n_tries - 1
+            self.sleep(s_time)
+
+        return False
+
     def test_dhcp_proxy(self):
         """ DHCPv4 Proxy """
 
@@ -1052,8 +1062,7 @@ class TestDHCP(VppTestCase):
         nd_entry = VppNeighbor(self,
                                self.pg1.sw_if_index,
                                self.pg1.remote_hosts[1].mac,
-                               self.pg1.remote_hosts[1].ip6,
-                               af=AF_INET6)
+                               self.pg1.remote_hosts[1].ip6)
         nd_entry.add_vpp_config()
 
         #
@@ -1267,9 +1276,10 @@ class TestDHCP(VppTestCase):
 
         # remove the left over ARP entry
         self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
-                                      mac_pton(self.pg3.remote_mac),
+                                      self.pg3.remote_mac,
                                       self.pg3.remote_ip4,
                                       is_add=0)
+
         #
         # remove the DHCP config
         #
@@ -1423,7 +1433,7 @@ class TestDHCP(VppTestCase):
 
         # remove the left over ARP entry
         self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
-                                      mac_pton(self.pg3.remote_mac),
+                                      self.pg3.remote_mac,
                                       self.pg3.remote_ip4,
                                       is_add=0)
 
@@ -1530,20 +1540,15 @@ class TestDHCP(VppTestCase):
 
         # remove the left over ARP entry
         self.vapi.ip_neighbor_add_del(self.pg3.sw_if_index,
-                                      mac_pton(self.pg3.remote_mac),
+                                      self.pg3.remote_mac,
                                       self.pg3.remote_ip4,
                                       is_add=0)
 
         #
-        # Sleep for the lease time
-        #
-        self.sleep(lease_time+1)
-
-        #
-        # And now the route should be gone
+        # the route should be gone after the lease expires
         #
-        self.assertFalse(find_route(self, self.pg3.local_ip4, 32))
-        self.assertFalse(find_route(self, self.pg3.local_ip4, 24))
+        self.assertTrue(self.wait_for_no_route(self.pg3.local_ip4, 32))
+        self.assertTrue(self.wait_for_no_route(self.pg3.local_ip4, 24))
 
         #
         # remove the DHCP config