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.9
# Tue 24 Mar 2026 09:46:07 +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.9
Show output
Mar 24 09:46:11.356809 osdx systemd-journald[1775]: Runtime Journal (/run/log/journal/7e3c4dd6c8d74b1c9c9747e610a7f242) is 2.6M, max 13.8M, 11.1M free.
Mar 24 09:46:11.357576 osdx systemd-journald[1775]: Received client request to rotate journal, rotating.
Mar 24 09:46:11.357624 osdx systemd-journald[1775]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7e3c4dd6c8d74b1c9c9747e610a7f242.
Mar 24 09:46:11.361479 osdx sudo[65988]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Mar 24 09:46:11.368320 osdx OSDxCLI[53154]: User 'admin' executed a new command: 'system journal clear'.
Mar 24 09:46:11.594048 osdx OSDxCLI[53154]: User 'admin' executed a new command: 'system coredump delete all'.
Mar 24 09:46:11.852194 osdx OSDxCLI[53154]: User 'admin' entered the configuration menu.
Mar 24 09:46:11.913414 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 24 09:46:12.007956 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Mar 24 09:46:12.066503 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Mar 24 09:46:12.162979 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 24 09:46:12.242046 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Mar 24 09:46:12.317663 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Mar 24 09:46:12.418440 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Mar 24 09:46:12.479094 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'show working'.
Mar 24 09:46:12.577875 osdx ubnt-cfgd[66022]: inactive
Mar 24 09:46:12.605746 osdx INFO[66032]: FRR daemons did not change
Mar 24 09:46:12.606999 osdx modulelauncher[1297]: + Received data: ['53154', 'osdx.utils.xos', 'set_console_log_level', 'info']
Mar 24 09:46:12.624446 osdx OSDxCLI[53154]: Signal 10 received
Mar 24 09:46:12.669612 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Mar 24 09:46:12.712547 osdx cfgd[1474]: [53154]Completed change to active configuration
Mar 24 09:46:12.723164 osdx OSDxCLI[53154]: User 'admin' committed the configuration.
Mar 24 09:46:12.740142 osdx OSDxCLI[53154]: User 'admin' left the configuration menu.
Mar 24 09:46:12.907715 osdx OSDxCLI[53154]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 24 09:46:12.908410 osdx OSDxCLI[53154]: pam_unix(cli:session): session closed for user admin
Mar 24 09:46:12.908678 osdx OSDxCLI[53154]: User 'admin' entered the configuration menu.
Mar 24 09:46:12.971186 osdx OSDxCLI[53154]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 24 09:46:12.971629 osdx cfgd[1474]: Execute action [syntax] for node [system advisor ADVISOR1]
Mar 24 09:46:12.971954 osdx OSDxCLI[53154]: pam_unix(cli:session): session closed for user admin
Mar 24 09:46:12.972177 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Mar 24 09:46:13.091354 osdx OSDxCLI[53154]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 24 09:46:13.096685 osdx OSDxCLI[53154]: pam_unix(cli:session): session closed for user admin
Mar 24 09:46:13.096957 osdx OSDxCLI[53154]: User 'admin' added a new cfg line: 'show changes'.
Mar 24 09:46:13.188285 osdx OSDxCLI[53154]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 24 09:46:13.196916 osdx ubnt-cfgd[66165]: inactive
Mar 24 09:46:13.208781 osdx cfgd[1474]: [53154]must validation for [system login user admin role] was skipped
Mar 24 09:46:13.208791 osdx cfgd[1474]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Mar 24 09:46:13.216573 osdx INFO[66173]: FRR daemons did not change
Mar 24 09:46:13.216988 osdx cfgd[1474]: Execute action [end] for node [system advisor ADVISOR1]
Mar 24 09:46:13.221894 osdx cfgd[1474]: [53154]Completed change to active configuration
Mar 24 09:46:13.223806 osdx OSDxCLI[53154]: pam_unix(cli:session): session closed for user admin
Mar 24 09:46:13.224100 osdx OSDxCLI[53154]: User 'admin' committed the configuration.
Mar 24 09:46:13.224879 osdx INFO[66181]: SCRIPT SCRIPT_1 operations:
Mar 24 09:46:13.229420 osdx OSDxCLI[66187]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.229594 osdx OSDxCLI[66187]: User 'admin' has logged in.
Mar 24 09:46:13.238329 osdx OSDxCLI[66187]: User 'admin' executed a new command: 'show version'.
Mar 24 09:46:13.239827 osdx OSDxCLI[66187]: User 'admin' has logged out.
Mar 24 09:46:13.239831 osdx OSDxCLI[66187]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.240088 osdx OSDxCLI[53154]: User 'admin' left the configuration menu.
Mar 24 09:46:13.240487 osdx INFO[66181]: Operation 1 'show version
                                         ':

                                           OS vendor:                 Teldat
                                           OS name:                   OSDx
                                           OS version:                v4.2.4.9
                                           OS Linux kernel:           6.1.128
                                           OS built by:               jenkins@diana
                                           OS build date:             Tue Mar 24 08:45:54 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:             27218310-d9a0-596a-9c06-3a0bbdaaff7d
                                           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 24 Mar 2026 09:46:13 +00:00
                                           Uptime:                    0:38:14
                                           CPU load (1m, 5m, 15m):    0.02 0.07 0.08
                                           CPU usage % (1m):          1.59
                                           Storage usage (kB):        372988/8144384
                                           Memory usage (kB):         394000/1570512
                                           Users logged in:           1
                                           Mode (current/next boot):  user/user

                                           Hostname:                  osdx
Mar 24 09:46:13.244745 osdx OSDxCLI[66195]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.244894 osdx OSDxCLI[66195]: User 'admin' has logged in.
Mar 24 09:46:13.246799 osdx OSDxCLI[66195]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.248681 osdx OSDxCLI[66195]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.248840 osdx OSDxCLI[66195]: User 'admin' executed a new command: 'license show'.
Mar 24 09:46:13.249661 osdx OSDxCLI[66195]: User 'admin' has logged out.
Mar 24 09:46:13.249697 osdx OSDxCLI[66195]: Tecla::GetLine tcgetattr error
Mar 24 09:46:13.250163 osdx INFO[66181]: Operation 2 'license show
                                         ':
                                         License: VM_BASE Firewall eth-Rate-Permit-Full

                                         +-----------------+---------+----------+
                                         | License Item    | Status  | Validity |
                                         +-----------------+---------+----------+
                                         | Firewall        | Enabled | Forever  |
                                         | eth-Rate-Permit | Full    | Forever  |
                                         +-----------------+---------+----------+
Mar 24 09:46:13.371112 osdx OSDxCLI[53154]: 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::783a:43ff:fe55:11db/64  up     up
dum1  fe80::60e3:71ff:fefc:d8df/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.9
# Tue 24 Mar 2026 09:46:25 +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.9
# Tue 24 Mar 2026 09:46:26 +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.9
# Tue 24 Mar 2026 09:46:27 +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