Client

Test suite to validate DHCP client functionality.

This test suite verifies that the DHCP client can: - Obtain IP addresses automatically from a DHCP server - Renew existing DHCP leases - Maintain network connectivity through DHCP operations

Test DHCP Client Lease

Description

This test verifies that the DHCP client can obtain an IP address automatically from the DHCP server and that the lease is properly registered in both the client and server.

Scenario

Step 1: Set the following configuration in DUT1 :

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

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 10.0.0.100/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.0.0.5 from DUT0:

admin@DUT0$ ping 10.0.0.5 count 1 size 56 timeout 1
Show output
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=0.231 ms

--- 10.0.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.231/0.231/0.231/0.000 ms

Step 4: Run command service dhcp-client show leases at DUT1 and expect this output:

Show output
Interface:     eth2
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    10.0.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   10.0.0.100
Lease time:    43200
Expiry date:   Fri Dec 12 07:52:46 2025
Reason:        BOUND


Interface:     eth0.102
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE

Test DHCP Client Renew

Description

This test verifies that the DHCP client can successfully renew its existing lease, ensuring continuous network connectivity without losing the assigned IP address.

Scenario

Step 1: Set the following configuration in DUT1 :

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

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 10.0.0.100/24
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.0.0.5 from DUT0:

admin@DUT0$ ping 10.0.0.5 count 1 size 56 timeout 1
Show output
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=399 ms

--- 10.0.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 398.615/398.615/398.615/0.000 ms

Step 4: Run command service dhcp-client show leases at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
Interface:     eth2
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    10.0.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   10.0.0.100
Lease time:    43200
Expiry date:   Fri Dec 12 07:53:01 2025
Reason:        BOUND


Interface:     eth0.102
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE

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

10.0.0.5
Show output
Instance main:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
 10.0.0.5   de:ad:be:ef:6c:10  2025/12/11 19:53:01  2025/12/12 07:53:01  2025/12/11 19:53:01

Step 6: Run command service dhcp-client renew interface eth0.100 at DUT1 and expect this output:

Show output
Renewing DHCP lease on interface eth0.100...

Step 7: Ping IP address 10.0.0.5 from DUT0:

admin@DUT0$ ping 10.0.0.5 count 1 size 56 timeout 1
Show output
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=0.271 ms

--- 10.0.0.5 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.271/0.271/0.271/0.000 ms

Step 8: Run command service dhcp-client show leases at DUT1 and check if output contains the following tokens:

10.0.0.5
Show output
Interface:     eth2
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.101
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE


Interface:     eth0.100
IP address:    10.0.0.5
Subnet mask:   255.255.255.0
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:   10.0.0.100
Lease time:    43198
Expiry date:   Fri Dec 12 07:53:01 2025
Reason:        REBOOT


Interface:     eth0.102
IP address:
Subnet mask:
Routers:
Name-servers:
Domain-name:
NTP servers:
DHCP server:
Lease time:
Expiry date:
Reason:        RELEASE