Advisor

These scenarios check that the advisor DHCP functions operate correctly, including lease preservation when the advisor toggles.

Test DHCP Server Advisor

Description

This scenario configures and checks that an advisor for the DHCP-server works correctly. First, you should configure at least one server (for this scenario, there are 2). Then configure the alarm and the advisor linked to the alarm and the server. Alarms are configured as false by default, meaning 'not al' will be true. The advisor will then become true and the process will start running. Next, the value of the advisor is changed to 'al', so the process will not be running. Finally, the advisor returns to its previous value, so the process will be running.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set interfaces ethernet eth0 vif 100 address 11.0.0.1/24
set service dhcp-server shared-network dhcp advisor adv
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set service dhcp-server shared-network dhcp-2 advisor adv
set service dhcp-server shared-network dhcp-2 subnet 11.0.0.0/24 start 11.0.0.5 stop 11.0.0.5
set system advisor adv test 'not al'
set system alarm al
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Run command system processes show | grep dhcpd at DUT0 and check if output contains the following tokens:

/usr/sbin/dhcpd
Show output
815358 ?        Ss     0:00 /usr/sbin/dhcpd -f -q -pf /run/dhcpd_main.pid -cf /etc/dhcp/dhcpd_main.conf -lf /config/dhcpd_main.leases eth0.100 eth0
815385 ttyS0    S+     0:00 sh -c set -- system processes show; declare -x -r LESSSECURE=1; (ps ax ) |& grep dhcpd
815387 ttyS0    S+     0:00 grep dhcpd

Step 3: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 4: Run command system processes show | grep dhcpd at DUT0 and check if output does not contain the following tokens:

/usr/sbin/dhcpd
Show output
815420 ttyS0    S+     0:00 sh -c set -- system processes show; declare -x -r LESSSECURE=1; (ps ax ) |& grep dhcpd
815422 ttyS0    S+     0:00 grep dhcpd

Step 5: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 6: Run command system processes show | grep dhcpd at DUT0 and check if output contains the following tokens:

/usr/sbin/dhcpd
Show output
815455 ?        Ss     0:00 /usr/sbin/dhcpd -f -q -pf /run/dhcpd_main.pid -cf /etc/dhcp/dhcpd_main.conf -lf /config/dhcpd_main.leases eth0.100 eth0
815458 ttyS0    S+     0:00 sh -c set -- system processes show; declare -x -r LESSSECURE=1; (ps ax ) |& grep dhcpd
815460 ttyS0    S+     0:00 grep dhcpd

Test Advisor Toggle Preserves Leases

Description

This scenario verifies that DHCP server leases are preserved when the server is stopped and restarted due to advisor status changes. When an advisor linked to a shared-network changes to false, the server stops but should preserve existing lease information. When the advisor returns to true, the server restarts and the previous lease entries should still be available.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network dhcp advisor adv
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 advisor adv test 'not al'
set system alarm al
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 check if output contains the following tokens:

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

Step 4: 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  2026/03/05 20:36:57  2026/03/06 08:36:57  2026/03/05 20:36:57

Step 5: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 6: 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  2026/03/05 20:36:57  2026/03/06 08:36:57  2026/03/05 20:36:57

Step 7: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 8: 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  2026/03/05 20:36:57  2026/03/06 08:36:57  2026/03/05 20:36:57

Test Multiple Shared Networks Advisor Preserves All Leases

Description

This scenario verifies that when multiple shared-networks are linked to the same advisor, all leases from all networks are preserved when the advisor toggles. This ensures the lease preservation works correctly with multiple DHCP pools.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 vif 100 address 10.0.0.1/24
set interfaces ethernet eth0 vif 101 address 11.0.0.1/24
set service dhcp-server shared-network dhcp advisor adv
set service dhcp-server shared-network dhcp subnet 10.0.0.0/24 start 10.0.0.5 stop 10.0.0.5
set service dhcp-server shared-network dhcp-2 advisor adv
set service dhcp-server shared-network dhcp-2 subnet 11.0.0.0/24 start 11.0.0.5 stop 11.0.0.5
set system advisor adv test 'not al'
set system alarm al
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: 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 3: Run command interfaces ethernet eth0 vif 100 show at DUT1 and check if output contains the following tokens:

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

Step 4: 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  2026/03/05 20:37:17  2026/03/06 08:37:17  2026/03/05 20:37:17

Step 5: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 6: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 7: 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  2026/03/05 20:37:17  2026/03/06 08:37:17  2026/03/05 20:37:17

Test Advisor Toggle VRF Preserves Leases

Description

This scenario verifies that lease preservation works correctly when the DHCP server is configured within a VRF context. Each VRF has its own separate lease storage, and this test ensures that advisor-triggered restarts preserve VRF-specific leases.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set interfaces ethernet eth0 vrf VRF0
set service dhcp-server shared-network dhcp advisor adv
set service dhcp-server shared-network dhcp local-vrf VRF0
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 advisor adv test 'not al'
set system alarm al
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system vrf VRF0

Step 2: Set the following configuration in DUT1 :

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

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

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

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

10.0.0.5
Show output
Instance VRF0:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
 10.0.0.5   de:ad:be:ef:6c:10  2026/03/05 20:37:38  2026/03/06 08:37:38  2026/03/05 20:37:38

Step 5: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 6: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

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

10.0.0.5
Show output
Instance VRF0:

--------------------------------------------------------------------------------------------
IP Address     MAC Address         Start Time         Expiration Time     Last Transaction
--------------------------------------------------------------------------------------------
 10.0.0.5   de:ad:be:ef:6c:10  2026/03/05 20:37:38  2026/03/06 08:37:38  2026/03/05 20:37:38

Test Rapid Advisor Toggles Preserve Leases

Description

This scenario verifies that rapid consecutive advisor state changes do not corrupt or lose lease information. The server may be started and stopped multiple times in quick succession, and lease data should remain intact throughout.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.0.0.1/24
set service dhcp-server shared-network dhcp advisor adv
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 advisor adv test 'not al'
set system alarm al
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 check if output contains the following tokens:

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

Step 4: 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  2026/03/05 20:37:59  2026/03/06 08:37:59  2026/03/05 20:37:59

Step 5: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 6: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 7: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 8: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 9: Modify the following configuration lines in DUT0 :

set system advisor adv test al

Step 10: Modify the following configuration lines in DUT0 :

set system advisor adv test 'not al'

Step 11: 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  2026/03/05 20:37:59  2026/03/06 08:37:59  2026/03/05 20:37:59