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

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.96.0.1/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  fe80::dcad:beff:feef:6c10/64  up     up

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

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.96.0.1/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command interfaces ethernet eth0 show at DUT1 and expect this output:

Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  fe80::dcad:beff:feef:6c10/64  up     up

Step 4: Modify the following configuration lines in DUT0 :

set service dhcp-server shared-network dhcp subnet 10.96.0.0/24 start 10.96.0.5 stop 10.96.0.10

Step 5: Run command interfaces ethernet eth0 show at DUT1 and check if output contains the following tokens:

10.96.0.
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.96.0.5/24                  up     up
      fe80::dcad:beff:feef:6c10/64

Step 6: Run command service dhcp-server show leases at DUT0 and check if output contains the following tokens:

10.96.0.
Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
10.96.0.5   de:ad:be:ef:6c:10  2026/03/05 21:05:45  2026/03/06 09:05:45  2026/03/05 21:05:45

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

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.96.0.1/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address dhcp
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run command traffic dump monitor detail interface eth0 filter "port 67 or port 68" packets 5 at DUT0.


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

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 dhcp client fallback 10.96.0.99/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Run command interfaces ethernet eth0 show at DUT0 and check if output contains the following tokens:

10.96.0.99
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
eth0  10.96.0.99/24                 up     up
      fe80::dcad:beff:feef:6c00/64