aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_dhcp.py23
-rw-r--r--test/vpp_papi_provider.py16
2 files changed, 33 insertions, 6 deletions
diff --git a/test/test_dhcp.py b/test/test_dhcp.py
index c5b1fa5fe3b..39133a35bd1 100644
--- a/test/test_dhcp.py
+++ b/test/test_dhcp.py
@@ -1422,6 +1422,29 @@ class TestDHCP(VppTestCase):
mactobinary(self.pg3.remote_mac),
self.pg3.remote_ip4,
is_add=0)
+
+ #
+ # read the DHCP client details from a dump
+ #
+ clients = self.vapi.dhcp_client_dump()
+
+ self.assertEqual(clients[0].client.sw_if_index,
+ self.pg3.sw_if_index)
+ self.assertEqual(clients[0].lease.sw_if_index,
+ self.pg3.sw_if_index)
+ self.assertEqual(clients[0].client.hostname.rstrip('\0'),
+ hostname)
+ self.assertEqual(clients[0].lease.hostname.rstrip('\0'),
+ hostname)
+ self.assertEqual(clients[0].lease.is_ipv6, 0)
+ # 0 = DISCOVER, 1 = REQUEST, 2 = BOUND
+ self.assertEqual(clients[0].lease.state, 2)
+ self.assertEqual(clients[0].lease.mask_width, 24)
+ self.assertEqual(clients[0].lease.router_address.rstrip('\0'),
+ self.pg3.remote_ip4n)
+ self.assertEqual(clients[0].lease.host_address.rstrip('\0'),
+ self.pg3.local_ip4n)
+
#
# remove the DHCP config
#
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 6dbed297de7..d13508ba4e8 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -2298,6 +2298,9 @@ class VppPapiProvider(object):
'is_ipv6': is_ip6,
})
+ def dhcp_client_dump(self):
+ return self.api(self.papi.dhcp_client_dump, {})
+
def dhcp_client(self,
sw_if_index,
hostname,
@@ -2308,13 +2311,14 @@ class VppPapiProvider(object):
return self.api(
self.papi.dhcp_client_config,
{
- 'sw_if_index': sw_if_index,
- 'hostname': hostname,
- 'client_id': client_id,
'is_add': is_add,
- 'want_dhcp_event': want_dhcp_events,
- 'set_broadcast_flag': set_broadcast_flag,
- 'pid': os.getpid(),
+ 'client': {
+ 'sw_if_index': sw_if_index,
+ 'hostname': hostname,
+ 'id': client_id,
+ 'want_dhcp_event': want_dhcp_events,
+ 'set_broadcast_flag': set_broadcast_flag,
+ 'pid': os.getpid()}
})
def ip_mroute_add_del(self,