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.5.3
# Mon 20 Oct 2025 14:42:13 +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.5.3
Show output
Oct 20 14:42:18.353449 osdx systemd-journald[1859]: Runtime Journal (/run/log/journal/82a9756ca47e4d589aa55e1b1a6b94de) is 1.9M, max 13.8M, 11.8M free.
Oct 20 14:42:18.355184 osdx systemd-journald[1859]: Received client request to rotate journal, rotating.
Oct 20 14:42:18.355254 osdx systemd-journald[1859]: Vacuuming done, freed 0B of archived journals from /run/log/journal/82a9756ca47e4d589aa55e1b1a6b94de.
Oct 20 14:42:18.365597 osdx OSDxCLI[162126]: User 'admin' executed a new command: 'system journal clear'.
Oct 20 14:42:18.580031 osdx OSDxCLI[162126]: User 'admin' executed a new command: 'system coredump delete all'.
Oct 20 14:42:18.812624 osdx OSDxCLI[162126]: User 'admin' entered the configuration menu.
Oct 20 14:42:18.882782 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Oct 20 14:42:18.972650 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Oct 20 14:42:19.036027 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Oct 20 14:42:19.144177 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Oct 20 14:42:19.223066 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Oct 20 14:42:19.309622 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Oct 20 14:42:19.372612 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Oct 20 14:42:19.482478 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'show working'.
Oct 20 14:42:19.551938 osdx ubnt-cfgd[167344]: inactive
Oct 20 14:42:19.577135 osdx INFO[167354]: FRR daemons did not change
Oct 20 14:42:19.578320 osdx modulelauncher[1477]: + Received data: ['162126', 'osdx.utils.xos', 'set_console_log_level', 'info']
Oct 20 14:42:19.596797 osdx OSDxCLI[162126]: Signal 10 received
Oct 20 14:42:19.647194 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Oct 20 14:42:19.697402 osdx cfgd[1655]: [162126]Completed change to active configuration
Oct 20 14:42:19.708827 osdx OSDxCLI[162126]: User 'admin' committed the configuration.
Oct 20 14:42:19.734890 osdx OSDxCLI[162126]: User 'admin' left the configuration menu.
Oct 20 14:42:19.909256 osdx OSDxCLI[162126]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 20 14:42:19.910143 osdx OSDxCLI[162126]: pam_unix(cli:session): session closed for user admin
Oct 20 14:42:19.910609 osdx OSDxCLI[162126]: User 'admin' entered the configuration menu.
Oct 20 14:42:20.037075 osdx OSDxCLI[162126]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 20 14:42:20.037656 osdx cfgd[1655]: Execute action [syntax] for node [system advisor ADVISOR1]
Oct 20 14:42:20.038124 osdx OSDxCLI[162126]: pam_unix(cli:session): session closed for user admin
Oct 20 14:42:20.038431 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Oct 20 14:42:20.095562 osdx OSDxCLI[162126]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 20 14:42:20.102680 osdx OSDxCLI[162126]: pam_unix(cli:session): session closed for user admin
Oct 20 14:42:20.102979 osdx OSDxCLI[162126]: User 'admin' added a new cfg line: 'show changes'.
Oct 20 14:42:20.198168 osdx OSDxCLI[162126]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 20 14:42:20.207124 osdx ubnt-cfgd[167488]: inactive
Oct 20 14:42:20.257534 osdx cfgd[1655]: [162126]must validation for [system login user admin role] was skipped
Oct 20 14:42:20.257546 osdx cfgd[1655]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Oct 20 14:42:20.264679 osdx INFO[167496]: FRR daemons did not change
Oct 20 14:42:20.265027 osdx cfgd[1655]: Execute action [end] for node [system advisor ADVISOR1]
Oct 20 14:42:20.273025 osdx cfgd[1655]: [162126]Completed change to active configuration
Oct 20 14:42:20.274906 osdx OSDxCLI[162126]: pam_unix(cli:session): session closed for user admin
Oct 20 14:42:20.275203 osdx OSDxCLI[162126]: User 'admin' committed the configuration.
Oct 20 14:42:20.276416 osdx INFO[167505]: SCRIPT SCRIPT_1 operations:
Oct 20 14:42:20.282080 osdx OSDxCLI[167511]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.282086 osdx OSDxCLI[167511]: User 'admin' has logged in.
Oct 20 14:42:20.292878 osdx OSDxCLI[167511]: User 'admin' executed a new command: 'show version'.
Oct 20 14:42:20.293922 osdx OSDxCLI[167511]: User 'admin' has logged out.
Oct 20 14:42:20.293927 osdx OSDxCLI[167511]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.294482 osdx INFO[167505]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.5.3
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Mon Oct 20 11:57:57 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:             73d909c9-82f0-5114-a5eb-517e02fb93b8
                                            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:                      Mon 20 Oct 2025 14:42:20 +00:00
                                            Uptime:                    1:32:40
                                            CPU load (1m, 5m, 15m):    0.17 0.12 0.10
                                            CPU usage % (1m):          1.66
                                            Storage usage (kB):        373084/8144384
                                            Memory usage (kB):         409388/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Oct 20 14:42:20.300208 osdx OSDxCLI[167519]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.300215 osdx OSDxCLI[167519]: User 'admin' has logged in.
Oct 20 14:42:20.302655 osdx OSDxCLI[167519]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.306100 osdx OSDxCLI[162126]: User 'admin' left the configuration menu.
Oct 20 14:42:20.306299 osdx OSDxCLI[167519]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.306480 osdx OSDxCLI[167519]: User 'admin' executed a new command: 'license show'.
Oct 20 14:42:20.307404 osdx OSDxCLI[167519]: User 'admin' has logged out.
Oct 20 14:42:20.307454 osdx OSDxCLI[167519]: Tecla::GetLine tcgetattr error
Oct 20 14:42:20.308060 osdx INFO[167505]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Oct 20 14:42:20.524872 osdx OSDxCLI[162126]: 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::d409:a4ff:fe23:1c25/64  up     up
dum1  fe80::9c91:79ff:fe1f:e48e/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.5.3
# Mon 20 Oct 2025 14:42:32 +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.5.3
# Mon 20 Oct 2025 14:42:33 +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.5.3
# Mon 20 Oct 2025 14:42:34 +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