Script

Test to check advisor scripts

Configuration Script

Description

In this scenario, an advisor is triggered to activate the automatic script. When the advisor is changed to true, the automatic script associated with the advisor is executed, aplying the commands in the active configuration.

Scenario

Step 1: Set the following configuration in DUT0 :

set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''

Step 2: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test true

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

set system description 'advisor applied'
Show output
# Teldat OSDx VM version v4.2.4.10
# Tue 02 Jun 2026 08:51:24 +00:00
# Warning: Configuration has not been saved
set system advisor ADVISOR1 test true
set system cli configuration logging global info
set system description 'advisor applied'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''

Operational Script

Description

In this scenario, an advisor is triggered to activate the automatic script. When the advisor is changed to true, the automatic script associated with the advisor is executed, proccessing the operational commands in the specified order.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.215.200.50/24
set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 operational 1 command 'show version'
set system script SCRIPT_1 operational 2 command 'license show'

Step 2: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test true

Step 3: Run command system journal show | cat at DUT0 and check if output contains the following tokens:

v4.2.4.10
Show output
Jun 02 08:51:28.000157 osdx systemd-timedated[150720]: Changed local time to Tue 2026-06-02 08:51:28 UTC
Jun 02 08:51:28.001362 osdx systemd-journald[148515]: Time jumped backwards, rotating.
Jun 02 08:51:28.001704 osdx OSDxCLI[151553]: User 'admin' executed a new command: 'set date 2026-06-02 08:51:28'.
Jun 02 08:51:28.302924 osdx sudo[153645]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Jun 02 08:51:28.306125 osdx systemd-journald[148515]: Runtime Journal (/run/log/journal/a0363f0a73514b24b35c4ba7ae73dc6e) is 1.9M, max 13.8M, 11.8M free.
Jun 02 08:51:28.309387 osdx systemd-journald[148515]: Received client request to rotate journal, rotating.
Jun 02 08:51:28.309463 osdx systemd-journald[148515]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a0363f0a73514b24b35c4ba7ae73dc6e.
Jun 02 08:51:28.310028 osdx sudo[153644]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Jun 02 08:51:28.316377 osdx OSDxCLI[151553]: User 'admin' executed a new command: 'system journal clear'.
Jun 02 08:51:28.535255 osdx OSDxCLI[151553]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 02 08:51:28.751899 osdx OSDxCLI[151553]: User 'admin' entered the configuration menu.
Jun 02 08:51:28.811766 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 02 08:51:28.910791 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Jun 02 08:51:28.970656 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Jun 02 08:51:29.069332 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 02 08:51:29.154130 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Jun 02 08:51:29.235771 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Jun 02 08:51:29.294332 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Jun 02 08:51:29.405392 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'show working'.
Jun 02 08:51:29.466196 osdx ubnt-cfgd[153680]: inactive
Jun 02 08:51:29.488268 osdx INFO[153690]: FRR daemons did not change
Jun 02 08:51:29.489231 osdx modulelauncher[1486]: + Received data: ['151553', 'osdx.utils.xos', 'set_console_log_level', 'info']
Jun 02 08:51:29.506859 osdx OSDxCLI[151553]: Signal 10 received
Jun 02 08:51:29.561372 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 02 08:51:29.614225 osdx cfgd[1665]: [151553]Completed change to active configuration
Jun 02 08:51:29.628277 osdx OSDxCLI[151553]: User 'admin' committed the configuration.
Jun 02 08:51:29.645653 osdx OSDxCLI[151553]: User 'admin' left the configuration menu.
Jun 02 08:51:29.809478 osdx OSDxCLI[151553]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 02 08:51:29.810011 osdx OSDxCLI[151553]: pam_unix(cli:session): session closed for user admin
Jun 02 08:51:29.810190 osdx OSDxCLI[151553]: User 'admin' entered the configuration menu.
Jun 02 08:51:29.875478 osdx OSDxCLI[151553]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 02 08:51:29.875948 osdx cfgd[1665]: Execute action [syntax] for node [system advisor ADVISOR1]
Jun 02 08:51:29.876291 osdx OSDxCLI[151553]: pam_unix(cli:session): session closed for user admin
Jun 02 08:51:29.876525 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Jun 02 08:51:29.970448 osdx OSDxCLI[151553]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 02 08:51:29.978048 osdx OSDxCLI[151553]: pam_unix(cli:session): session closed for user admin
Jun 02 08:51:29.978401 osdx OSDxCLI[151553]: User 'admin' added a new cfg line: 'show changes'.
Jun 02 08:51:30.028994 osdx OSDxCLI[151553]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 02 08:51:30.037784 osdx ubnt-cfgd[153825]: inactive
Jun 02 08:51:30.051991 osdx cfgd[1665]: [151553]must validation for [system login user admin role] was skipped
Jun 02 08:51:30.052005 osdx cfgd[1665]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Jun 02 08:51:30.060536 osdx INFO[153833]: FRR daemons did not change
Jun 02 08:51:30.061092 osdx cfgd[1665]: Execute action [end] for node [system advisor ADVISOR1]
Jun 02 08:51:30.068953 osdx cfgd[1665]: [151553]Completed change to active configuration
Jun 02 08:51:30.071168 osdx OSDxCLI[151553]: pam_unix(cli:session): session closed for user admin
Jun 02 08:51:30.071432 osdx OSDxCLI[151553]: User 'admin' committed the configuration.
Jun 02 08:51:30.072497 osdx INFO[153841]: SCRIPT SCRIPT_1 operations:
Jun 02 08:51:30.078436 osdx OSDxCLI[153847]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.078441 osdx OSDxCLI[153847]: User 'admin' has logged in.
Jun 02 08:51:30.087272 osdx OSDxCLI[153847]: User 'admin' executed a new command: 'show version'.
Jun 02 08:51:30.088246 osdx OSDxCLI[153847]: User 'admin' has logged out.
Jun 02 08:51:30.088251 osdx OSDxCLI[153847]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.088840 osdx INFO[153841]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.4.10
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@diana
                                            OS build date:             Tue Jun 2 07:13:09 UTC 2026
                                            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:             ad970fa3-ca84-5fe7-8115-648d67888fcd
                                            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:        Power Failure

                                            Date:                      Tue 02 Jun 2026 08:51:30 +00:00
                                            Uptime:                    1:14:17
                                            CPU load (1m, 5m, 15m):    0.18 0.31 0.25
                                            CPU usage % (1m):          4.63
                                            Storage usage (kB):        373016/8144384
                                            Memory usage (kB):         388432/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Jun 02 08:51:30.093334 osdx OSDxCLI[153855]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.093585 osdx OSDxCLI[153855]: User 'admin' has logged in.
Jun 02 08:51:30.095753 osdx OSDxCLI[153855]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.097713 osdx OSDxCLI[153855]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.097867 osdx OSDxCLI[153855]: User 'admin' executed a new command: 'license show'.
Jun 02 08:51:30.098770 osdx OSDxCLI[153855]: User 'admin' has logged out.
Jun 02 08:51:30.098774 osdx OSDxCLI[153855]: Tecla::GetLine tcgetattr error
Jun 02 08:51:30.099328 osdx INFO[153841]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Jun 02 08:51:30.102717 osdx OSDxCLI[151553]: User 'admin' left the configuration menu.
Jun 02 08:51:30.236212 osdx OSDxCLI[151553]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)

Simple Script Execution

Description

In this scenario, an automatic script is activated directly without any advisor triggering. The script is activated using the system script <txt> activate command.

Scenario

Step 1: Set the following configuration in DUT0 :

set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set interfaces dummy dum0'
set system script SCRIPT_1 configuration 'set interfaces dummy dum1'

Step 2: Run command system script SCRIPT_1 activate at DUT0.

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

dum0.*\ndum1
Show output
-----------------------------------------------------------------
Name           IP Address           Admin  Oper  Vrf  Description
-----------------------------------------------------------------
dum0  fe80::c8d0:59ff:fe9a:cb5/64   up     up
dum1  fe80::9cc0:3cff:fe8c:da46/64  up     up

Multiple Triggers Script

Description

In this scenario, an advisor is triggered multiple times to activate the automatic script. When the advisor is changed to true, the automatic script associated with the advisor is executed, proccessing the operational commands in the specified order.

Scenario

Step 1: Set the following configuration in DUT0 :

set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''
set system script SCRIPT_1 number-of-triggers 3

Note

Wait for the advisor to turn on. After that, wait for the advisor to turn off. This produces only one trigger.

Step 2: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test true

Step 3: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test false

Step 4: Expect a failure in the following command: Run command show running at DUT0 and check if output contains the following tokens:

set system description 'advisor applied'
Show output
# Teldat OSDx VM version v4.2.4.10
# Tue 02 Jun 2026 08:51:44 +00:00
# Warning: Configuration has not been saved
set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''
set system script SCRIPT_1 number-of-triggers 3

Note

Wait for the advisor to turn on. After that, wait for the advisor to turn off. This produces only one trigger.

Step 5: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test true

Step 6: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test false

Step 7: Expect a failure in the following command: Run command show running at DUT0 and check if output contains the following tokens:

set system description 'advisor applied'
Show output
# Teldat OSDx VM version v4.2.4.10
# Tue 02 Jun 2026 08:51:47 +00:00
# Warning: Configuration has not been saved
set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''
set system script SCRIPT_1 number-of-triggers 3

Note

Wait for the advisor to turn on. After that, wait for the advisor to turn off. This produces only one trigger.

Step 8: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test true

Step 9: Modify the following configuration lines in DUT0 :

set system advisor ADVISOR1 test false

Step 10: Run command show running at DUT0 and check if output contains the following tokens:

set system description 'advisor applied'
Show output
# Teldat OSDx VM version v4.2.4.10
# Tue 02 Jun 2026 08:51:49 +00:00
# Warning: Configuration has not been saved
set system advisor ADVISOR1 test false
set system cli configuration logging global info
set system description 'advisor applied'
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
set system script SCRIPT_1 advisor ADVISOR1
set system script SCRIPT_1 configuration 'set system description \'advisor applied\''
set system script SCRIPT_1 number-of-triggers 3