Send-Options

Test suite to validate DHCP client send options and identifier persistence.

The DHCP client can send identification information to the server: - DHCP Client Identifier: Uniquely identifies the client device - Hostname: Sends the system hostname for logging and identification

This test suite focuses on functionality NOT covered by existing tests: - Hostname send (zero coverage) - Identifier persistence (verifies same ID = same IP across releases)

Note: Basic client identifier functionality is already tested in tests/service/dhcp-server/class.robot (class matching scenarios).

Test Client Sends Hostname

Description

This scenario verifies that the DHCP client automatically sends the system hostname to the DHCP server. When a system hostname is configured, the DHCP client includes it in DHCP requests without requiring additional interface-specific configuration. The hostname appears in the server’s journal logs in DHCP messages like DHCPREQUEST/DHCPACK. When viewing DHCP logs, seeing “test-router” is more informative than seeing only MAC addresses. This aids in troubleshooting and network documentation. Verification includes packet capture to confirm hostname in DHCP packets.

Scenario

Step 1: Run the command system journal clear on DUT0 and expect the following output:

Show output
Vacuuming done, freed 0B of archived journals from /run/log/journal.
Vacuuming done, freed 0B of archived journals from /run/log/journal/7ab9d0c6c88d486ab30f6cca192546c5.
Vacuuming done, freed 0B of archived journals from /var/log/journal.

Step 2: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Set the following configuration in DUT1 :

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

Step 4: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Step 5: Run the command system journal show | cat on DUT0 and expect the following output:

Show output
Sep 16 21:59:13.293374 osdx systemd-journald[303514]: Runtime Journal (/run/log/journal/7ab9d0c6c88d486ab30f6cca192546c5) is 1.8M, max 13.8M, 11.9M free.
Sep 16 21:59:13.296179 osdx systemd-journald[303514]: Received client request to rotate journal, rotating.
Sep 16 21:59:13.296243 osdx systemd-journald[303514]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7ab9d0c6c88d486ab30f6cca192546c5.
Sep 16 21:59:13.304479 osdx OSDxCLI[303337]: User 'admin' executed a new command: 'system journal clear'.
Sep 16 21:59:13.541195 osdx OSDxCLI[303337]: User 'admin' executed a new command: 'system coredump delete all'.
Sep 16 21:59:13.770350 osdx systemd-journald[303514]: Runtime Journal (/run/log/journal/7ab9d0c6c88d486ab30f6cca192546c5) is 1.8M, max 13.8M, 11.9M free.
Sep 16 21:59:13.772175 osdx systemd-journald[303514]: Received client request to rotate journal, rotating.
Sep 16 21:59:13.772248 osdx systemd-journald[303514]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7ab9d0c6c88d486ab30f6cca192546c5.
Sep 16 21:59:13.780378 osdx OSDxCLI[303337]: User 'admin' executed a new command: 'system journal clear'.
Sep 16 21:59:13.997405 osdx OSDxCLI[303337]: User 'admin' entered the configuration menu.
Sep 16 21:59:14.137062 osdx OSDxCLI[303337]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 172.16.0.1/24'.
Sep 16 21:59:14.202296 osdx OSDxCLI[303337]: User 'admin' added a new cfg line: 'set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10'.
Sep 16 21:59:14.301426 osdx OSDxCLI[303337]: User 'admin' added a new cfg line: 'show working'.
Sep 16 21:59:14.361404 osdx ubnt-cfgd[362371]: inactive
Sep 16 21:59:14.395539 osdx INFO[362385]: FRR daemons did not change
Sep 16 21:59:14.428176 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Sep 16 21:59:14.483019 osdx WARNING[362458]: No supported link modes on interface eth0
Sep 16 21:59:14.484611 osdx modulelauncher[362458]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on
Sep 16 21:59:14.484629 osdx modulelauncher[362458]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76.
Sep 16 21:59:14.485927 osdx modulelauncher[362458]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off --
Sep 16 21:59:14.485936 osdx modulelauncher[362458]: Command '/sbin/ethtool -s eth0 autoneg on advertise Pause off Asym_Pause off --' returned non-zero exit status 75.
Sep 16 21:59:14.548627 osdx systemd[1]: Started dhcpd@main.service - "DHCP Server Service instance main".
Sep 16 21:59:14.551660 osdx dhcpd[362479]: Wrote 0 leases to leases file.
Sep 16 21:59:14.580379 osdx dhcpd[362479]: Server starting service.
Sep 16 21:59:14.729247 osdx cfgd[1899]: [303337]Completed change to active configuration
Sep 16 21:59:14.729826 osdx OSDxCLI[303337]: User 'admin' committed the configuration.
Sep 16 21:59:14.756319 osdx OSDxCLI[303337]: User 'admin' left the configuration menu.
Sep 16 21:59:14.925269 osdx OSDxCLI[303337]: User 'admin' executed a new command: 'interfaces ethernet eth0 show'.
Sep 16 21:59:15.825233 osdx dhcpd[362479]: DHCPDISCOVER from de:ad:be:ef:6c:10 via eth0
Sep 16 21:59:16.825546 osdx dhcpd[362479]: DHCPOFFER on 172.16.0.5 to de:ad:be:ef:6c:10 (test-router) via eth0
Sep 16 21:59:16.825957 osdx dhcpd[362479]: DHCPREQUEST for 172.16.0.5 (172.16.0.1) from de:ad:be:ef:6c:10 (test-router) via eth0
Sep 16 21:59:16.837432 osdx dhcpd[362479]: DHCPACK on 172.16.0.5 to de:ad:be:ef:6c:10 (test-router) via eth0

Step 6: Run the command traffic dump monitor detail interface eth0 filter "port 67 or port 68" packets 10 on DUT0.

Step 7: Run the command service dhcp-client renew interface eth0 on DUT1 and expect the following output:

Show output
Renewing DHCP lease on interface eth0...

Test Serial Number Identifier Persistence

Description

This scenario verifies that using a serial number as the client identifier ensures IP address persistence across DHCP renewals and releases. When a client uses its serial number as identifier, the DHCP server associates the lease with this unique hardware ID rather than the MAC address. Even if the client releases and re-requests its IP, it should receive the same IP address as long as it uses the same serial number identifier. This is critical for maintaining consistent IP addressing in environments where devices may have changing MAC addresses or multiple network interfaces.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
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 interfaces ethernet eth0 dhcp client send dhcp-client-identifier serial-number
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Step 4: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 5: Modify the following configuration lines in DUT1 :

delete interfaces ethernet eth0 address

Step 6: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 7: Modify the following configuration lines in DUT1 :

set interfaces ethernet eth0 address dhcp

Step 8: Modify the following configuration lines in DUT1 : Step 9: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 10: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Test Base-MAC Identifier Persistence

Description

This scenario verifies that using the base MAC address as the client identifier ensures IP address persistence. The base MAC is the primary hardware address of the device, independent of any VLAN or virtual interface configurations. When a client uses base-mac as its identifier, it maintains the same lease even when reconnecting through different sub-interfaces or after configuration changes. This is particularly useful in VLAN environments where each sub-interface has a different MAC but all share the same base MAC.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
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 interfaces ethernet eth0 dhcp client send dhcp-client-identifier base-mac
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Step 4: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 5: Modify the following configuration lines in DUT1 :

delete interfaces ethernet eth0 address

Step 6: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 7: Modify the following configuration lines in DUT1 :

set interfaces ethernet eth0 address dhcp

Step 8: Modify the following configuration lines in DUT1 : Step 9: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 10: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Test String Identifier Persistence

Description

This scenario verifies that using a custom string as the client identifier ensures IP address persistence across DHCP operations. Custom string identifiers allow administrators to assign logical, human-readable names to devices (e.g., “router-branch-office-01”) independent of any hardware identifiers. This provides flexible device identification that survives hardware replacements - if a device is replaced but configured with the same string identifier, it will receive the same IP address. This test verifies that the server correctly tracks leases by the custom string identifier and maintains address consistency.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 172.16.0.1/24
set service dhcp-server shared-network dhcp subnet 172.16.0.0/24 start 172.16.0.5 stop 172.16.0.10
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 interfaces ethernet eth0 dhcp client send dhcp-client-identifier string my-persistent-device
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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

Step 4: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 5: Modify the following configuration lines in DUT1 :

delete interfaces ethernet eth0 address

Step 6: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 7: Modify the following configuration lines in DUT1 :

set interfaces ethernet eth0 address dhcp

Step 8: Modify the following configuration lines in DUT1 : Step 9: Run the command interfaces ethernet eth0 show on DUT1 and expect the following output:

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

Step 10: Run the command interfaces ethernet eth0 show on DUT1 and check whether the output contains the following tokens:

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