Schedule

The following scenario shows how to configure alarm schedules to be able to program custom actions in the system triggered by a timer. Timers can be executed periodically or just once, depending on the configuration.

Periodic Schedule

Description

In this example, a schedule is configured in DUT0 to enable and disable an alarm every minute.

Scenario

Step 1: Set the following configuration in DUT0 :

set system alarm ALARM
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system schedule SCHED alarm ALARM
set system schedule SCHED disable second 3
set system schedule SCHED enable second 58

Step 2: Run command system schedule show at DUT0 and check if output matches the following regular expressions:

SCHED\s+(enable|disable).*left
Show output
----------------------------------------------------------------------
Schedule  State    Next                         Left      Last  Passed
----------------------------------------------------------------------
SCHED     enable   Tue 2025-05-13 15:49:58 UTC  9s left   -     -
SCHED     disable  Tue 2025-05-13 15:50:03 UTC  14s left  -     -

Note

The output of the above command should show the “enable” and “disable” entries in the table with a “Left” value, since the schedule is pending.

Step 3: Run command system alarm ALARM show at DUT0 and check if output contains the following tokens:

true
Show output
--------------------------------------------------------------------------------------------
Alarm  Status                Toggled                 Prev-toggled  Toggle-count  Time up (%)
--------------------------------------------------------------------------------------------
ALARM  true    2025-05-13 15:49:58.889870969 +00:00                           1         5.71

Step 4: Run command system alarm ALARM show at DUT0 and check if output contains the following tokens:

false
Show output
--------------------------------------------------------------------------------------------------------------------
Alarm  Status                Toggled                             Prev-toggled              Toggle-count  Time up (%)
--------------------------------------------------------------------------------------------------------------------
ALARM  false   2025-05-13 15:50:03.889509601 +00:00  2025-05-13 15:49:58.889870969 +00:00             2        29.34

Step 5: Run command system schedule show at DUT0 and check if output matches the following regular expressions:

SCHED\s+(enable|disable).*left
Show output
---------------------------------------------------------------------------------------------
Schedule  State    Next                         Left      Last                         Passed
---------------------------------------------------------------------------------------------
SCHED     enable   Tue 2025-05-13 15:50:58 UTC  52s left  Tue 2025-05-13 15:49:58 UTC  7s ago
SCHED     disable  Tue 2025-05-13 15:51:03 UTC  57s left  Tue 2025-05-13 15:50:03 UTC  2s ago

Note

The output of the above command should show the “enable” and “disable” entries in the table with a “Left” value, since the schedule is periodic.


Schedule Script Execution

Description

In this example, a schedule is configured in DUT0 to program the execution of a script that automatically changes the system configuration.

Scenario

Step 1: Set the following configuration in DUT0 :

set system advisor ADVISOR1 test ALARM
set system advisor ADVISOR2 test 'not ALARM'
set system alarm ALARM
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system schedule SCHED alarm ALARM
set system schedule SCHED disable day 13
set system schedule SCHED disable hour 15
set system schedule SCHED disable minute 50
set system schedule SCHED disable month 5
set system schedule SCHED disable second 26
set system schedule SCHED disable year 2025
set system schedule SCHED enable day 13
set system schedule SCHED enable hour 15
set system schedule SCHED enable minute 50
set system schedule SCHED enable month 5
set system schedule SCHED enable second 21
set system schedule SCHED enable year 2025
set system script SCRIPT1 advisor ADVISOR1
set system script SCRIPT1 configuration 'set system description \'Test Description\''
set system script SCRIPT2 advisor ADVISOR2
set system script SCRIPT2 configuration 'delete system description \'Test Description\''

Step 2: Run command system alarm ALARM show at DUT0 and check if output contains the following tokens:

true
Show output
--------------------------------------------------------------------------------------------
Alarm  Status                Toggled                 Prev-toggled  Toggle-count  Time up (%)
--------------------------------------------------------------------------------------------
ALARM  true    2025-05-13 15:50:21.897511737 +00:00                           1        17.67

Note

The output of the above command should show that the alarm was activated according to the “enable” time configured.

Step 3: Run command show version at DUT0 and check if output matches the following regular expressions:

Description:.*Test Description
Show output
OS vendor:                 Teldat
OS name:                   OSDx
OS version:                v4.2.5.0
OS Linux kernel:           6.1.128
OS built by:               jenkins@daphne
OS build date:             Mon May 12 11:45:19 UTC 2025
OS installation:           physical
OS boot mode:              user
License:                   VM_BASE Firewall eth-Rate-Permit-Full

Hardware vendor:           QEMU
Hardware model:            VM
Hardware OEM model:        Standard PC (i440FX + PIIX, 1996)
Hardware version:          pc-i440fx-5.2
Hardware UUID:             94338cf1-2e79-52d8-afb2-8c812dcbea77
Hardware architecture:     amd64
Hardware fwid:             iso
Hardware base MAC:         de:ad:be:ef:6c:00
Hardware cpu:              4 x QEMU Virtual CPU version 2.5+ (4 cores)

Last reboot reason:        Panic

Date:                      Tue 13 May 2025 15:50:23 +00:00
Uptime:                    2:08:39
CPU load (1m, 5m, 15m):    0.09 0.12 0.13
CPU usage % (1m):          2.53
Storage usage (kB):        372992/8144384
Memory usage (kB):         402820/1570512
Users logged in:           1
Mode (current/next boot):  user/user

Hostname:                  osdx
Description:               Test Description

Note

The output of the above command should show the system description configured by the script.

Step 4: Run command system alarm ALARM show at DUT0 and check if output contains the following tokens:

false
Show output
--------------------------------------------------------------------------------------------------------------------
Alarm  Status                Toggled                             Prev-toggled              Toggle-count  Time up (%)
--------------------------------------------------------------------------------------------------------------------
ALARM  false   2025-05-13 15:50:26.888667816 +00:00  2025-05-13 15:50:21.897511737 +00:00             2        33.29

Note

The output of the above command should show that the alarm was deactivated according to the “disable” time configured.

Step 5: Run command system schedule show at DUT0 and check if output matches the following regular expressions:

SCHED\s+(enable|disable)\s+-\s+-\s+[a-zA-Z]{3}
Show output
------------------------------------------------------------------
Schedule  State    Next  Left  Last                         Passed
------------------------------------------------------------------
SCHED     disable  -     -     Tue 2025-05-13 15:50:26 UTC  1s ago
SCHED     enable   -     -     Tue 2025-05-13 15:50:21 UTC  6s ago

Note

The output of the above command should show the “enable” and “disable” entries in the table without a “Next” or “Left” value, since the schedule is configured to be executed just once.

Step 6: Run command show version at DUT0 and check if output does not match the following regular expressions:

Description:.*Test Description
Show output
OS vendor:                 Teldat
OS name:                   OSDx
OS version:                v4.2.5.0
OS Linux kernel:           6.1.128
OS built by:               jenkins@daphne
OS build date:             Mon May 12 11:45:19 UTC 2025
OS installation:           physical
OS boot mode:              user
License:                   VM_BASE Firewall eth-Rate-Permit-Full

Hardware vendor:           QEMU
Hardware model:            VM
Hardware OEM model:        Standard PC (i440FX + PIIX, 1996)
Hardware version:          pc-i440fx-5.2
Hardware UUID:             94338cf1-2e79-52d8-afb2-8c812dcbea77
Hardware architecture:     amd64
Hardware fwid:             iso
Hardware base MAC:         de:ad:be:ef:6c:00
Hardware cpu:              4 x QEMU Virtual CPU version 2.5+ (4 cores)

Last reboot reason:        Panic

Date:                      Tue 13 May 2025 15:50:28 +00:00
Uptime:                    2:08:44
CPU load (1m, 5m, 15m):    0.08 0.12 0.13
CPU usage % (1m):          2.53
Storage usage (kB):        372992/8144384
Memory usage (kB):         410124/1570512
Users logged in:           1
Mode (current/next boot):  user/user

Hostname:                  osdx

Note

The output of the above command should show the script has removed the system description.