.. _example_service_dhcp-client_timeout:
#######
Timeout
#######
Test suite to validate DHCP client timeout and retry behavior.
The ISC DHCP client has specific timeout and retry behavior:
- Sends DHCPDISCOVER with exponential backoff (10s → 20s → 40s → 120s)
- Times out after 60 seconds if no DHCPOFFER received
- Retries after 30 seconds (OSDx configuration)
- Loops indefinitely until server responds
This test suite verifies:
- Client properly times out when no server is available
- Client recovers when server becomes available
- Fallback IP is applied when configured and DHCP fails
Note: These tests are intentionally slow due to DHCP timeout values.
**********************************
Test Client Timeout Without Server
**********************************
Description
===========
This scenario verifies that the DHCP client properly handles
the case when no DHCP server is available on the network.
Expected behavior:
- Client sends DHCPDISCOVER packets
- Client times out after ~60 seconds
- Client does NOT obtain an IP address
- Client continues retrying (loop)
Note: This test waits 70 seconds to ensure timeout occurs.
Scenario
========
.. include:: timeout/testclienttimeoutwithoutserver
.. raw:: html
****************************************
Test Client Recovery After Server Starts
****************************************
Description
===========
This scenario verifies that the DHCP client successfully
obtains an IP address when the server becomes available
after the client has already started requesting.
Expected behavior:
- Client starts without server, times out
- Server is started during client retry phase
- Client successfully obtains IP from server
Note: This test waits for initial timeout then starts server.
Scenario
========
.. include:: timeout/testclientrecoveryafterserverstarts
.. raw:: html
*******************************
Test Client Retry After Timeout
*******************************
Description
===========
This scenario verifies that the DHCP client continues
to retry after timeout, demonstrating the infinite retry loop.
Expected behavior:
- Client times out at 60s
- Client retries after 30s (OSDx retry interval)
- Second retry cycle begins
We verify by capturing DHCP traffic during retry phase.
Scenario
========
.. include:: timeout/testclientretryaftertimeout
.. raw:: html
***********************************
Test Fallback IP Applied On Timeout
***********************************
Description
===========
This scenario verifies that when a fallback IP is configured
and DHCP times out, the fallback IP is applied to the interface.
This is a single-DUT test (DUT0 only) - no server is needed.
Configuration:
- set interfaces ethernet eth0 address dhcp
- set interfaces ethernet eth0 dhcp client fallback 10.96.0.99/24
Expected behavior:
- Client sends DHCPDISCOVER
- No server responds, timeout occurs
- Fallback IP (10.96.0.99/24) is applied
Note: This tests the fallback mechanism on initial timeout.
Scenario
========
.. include:: timeout/testfallbackipappliedontimeout
.. raw:: html