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.7.0
# Fri 10 Oct 2025 18:32:49 +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.7.0
Show output
Oct 10 18:32:57.314877 osdx systemd-journald[1670]: Runtime Journal (/run/log/journal/d6792964fe7547c9a60a3d774aa97dac) is 1.8M, max 13.8M, 11.9M free.
Oct 10 18:32:57.315464 osdx systemd-journald[1670]: Received client request to rotate journal, rotating.
Oct 10 18:32:57.315506 osdx systemd-journald[1670]: Vacuuming done, freed 0B of archived journals from /run/log/journal/d6792964fe7547c9a60a3d774aa97dac.
Oct 10 18:32:57.325010 osdx OSDxCLI[110106]: User 'admin' executed a new command: 'system journal clear'.
Oct 10 18:32:57.536347 osdx OSDxCLI[110106]: User 'admin' executed a new command: 'system coredump delete all'.
Oct 10 18:32:57.760059 osdx OSDxCLI[110106]: User 'admin' entered the configuration menu.
Oct 10 18:32:57.866508 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Oct 10 18:32:57.943527 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Oct 10 18:32:58.046938 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Oct 10 18:32:58.111421 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Oct 10 18:32:58.232046 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Oct 10 18:32:58.293800 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Oct 10 18:32:58.378772 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Oct 10 18:32:58.450281 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'show working'.
Oct 10 18:32:58.538058 osdx ubnt-cfgd[112105]: inactive
Oct 10 18:32:58.557260 osdx INFO[112113]: FRR daemons did not change
Oct 10 18:32:58.559316 osdx modulelauncher[1284]: + Received data: ['110106', 'osdx.utils.xos', 'set_console_log_level', 'info']
Oct 10 18:32:58.581040 osdx OSDxCLI[110106]: Signal 10 received
Oct 10 18:32:58.639351 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Oct 10 18:32:58.688102 osdx WARNING[112208]: No supported link modes on interface eth0
Oct 10 18:32:58.689756 osdx modulelauncher[112208]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on
Oct 10 18:32:58.689769 osdx modulelauncher[112208]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76.
Oct 10 18:32:58.691145 osdx modulelauncher[112208]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --
Oct 10 18:32:58.691154 osdx modulelauncher[112208]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75.
Oct 10 18:32:58.702406 osdx cfgd[1464]: [110106]Completed change to active configuration
Oct 10 18:32:58.713133 osdx OSDxCLI[110106]: User 'admin' committed the configuration.
Oct 10 18:32:58.731492 osdx OSDxCLI[110106]: User 'admin' left the configuration menu.
Oct 10 18:32:58.916347 osdx OSDxCLI[110106]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 10 18:32:58.916849 osdx OSDxCLI[110106]: pam_unix(cli:session): session closed for user admin
Oct 10 18:32:58.917043 osdx OSDxCLI[110106]: User 'admin' entered the configuration menu.
Oct 10 18:32:58.970765 osdx OSDxCLI[110106]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 10 18:32:58.970943 osdx cfgd[1464]: Execute action [syntax] for node [system advisor ADVISOR1]
Oct 10 18:32:58.971233 osdx OSDxCLI[110106]: pam_unix(cli:session): session closed for user admin
Oct 10 18:32:58.971421 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Oct 10 18:32:59.073397 osdx OSDxCLI[110106]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 10 18:32:59.082877 osdx OSDxCLI[110106]: pam_unix(cli:session): session closed for user admin
Oct 10 18:32:59.083085 osdx OSDxCLI[110106]: User 'admin' added a new cfg line: 'show changes'.
Oct 10 18:32:59.148181 osdx OSDxCLI[110106]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Oct 10 18:32:59.160656 osdx ubnt-cfgd[112258]: inactive
Oct 10 18:32:59.207927 osdx cfgd[1464]: [110106]must validation for [system login user admin role] was skipped
Oct 10 18:32:59.207940 osdx cfgd[1464]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Oct 10 18:32:59.215430 osdx INFO[112266]: FRR daemons did not change
Oct 10 18:32:59.215558 osdx cfgd[1464]: Execute action [end] for node [system advisor ADVISOR1]
Oct 10 18:32:59.221621 osdx cfgd[1464]: [110106]Completed change to active configuration
Oct 10 18:32:59.223121 osdx OSDxCLI[110106]: pam_unix(cli:session): session closed for user admin
Oct 10 18:32:59.223358 osdx OSDxCLI[110106]: User 'admin' committed the configuration.
Oct 10 18:32:59.225722 osdx INFO[112275]: SCRIPT SCRIPT_1 operations:
Oct 10 18:32:59.230165 osdx OSDxCLI[112283]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.230170 osdx OSDxCLI[112283]: User 'admin' has logged in.
Oct 10 18:32:59.240501 osdx OSDxCLI[110106]: User 'admin' left the configuration menu.
Oct 10 18:32:59.241037 osdx OSDxCLI[112283]: User 'admin' executed a new command: 'show version'.
Oct 10 18:32:59.242035 osdx OSDxCLI[112283]: User 'admin' has logged out.
Oct 10 18:32:59.242040 osdx OSDxCLI[112283]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.242614 osdx INFO[112275]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.7.0
                                            OS Linux kernel:           6.1.140
                                            OS built by:               jenkins@daphne
                                            OS build date:             Thu Oct 9 11:26:14 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-7.2
                                            Hardware UUID:             b368803b-0686-591d-a2b1-8aa07ee54efe
                                            Hardware architecture:     amd64
                                            Hardware fwid:             iso
                                            Hardware base MAC:         de:ad:be:ef:6c:00
                                            Hardware cpu:              1 x QEMU Virtual CPU version 2.5+ (4 cores)

                                            Last reboot reason:        Panic

                                            Date:                      Fri 10 Oct 2025 18:32:59 +00:00
                                            Uptime:                    0:53:49
                                            CPU load (1m, 5m, 15m):    0.13 0.19 0.17
                                            CPU usage % (1m):          3.51
                                            Storage usage (kB):        385260/8144384
                                            Memory usage (kB):         402184/1570504
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Oct 10 18:32:59.247281 osdx OSDxCLI[112289]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.247286 osdx OSDxCLI[112289]: User 'admin' has logged in.
Oct 10 18:32:59.250759 osdx OSDxCLI[112289]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.252757 osdx OSDxCLI[112289]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.252944 osdx OSDxCLI[112289]: User 'admin' executed a new command: 'license show'.
Oct 10 18:32:59.253827 osdx OSDxCLI[112289]: User 'admin' has logged out.
Oct 10 18:32:59.253832 osdx OSDxCLI[112289]: Tecla::GetLine tcgetattr error
Oct 10 18:32:59.254327 osdx INFO[112275]: 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 10 18:32:59.368874 osdx OSDxCLI[110106]: 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::e08e:83ff:fe14:8920/64  up     up
dum1  fe80::488a:feff:fec1:8834/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.7.0
# Fri 10 Oct 2025 18:33:11 +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.7.0
# Fri 10 Oct 2025 18:33:12 +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.7.0
# Fri 10 Oct 2025 18:33:13 +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

Script Invalid Paths

Description

Test that checks invalid configurational and operational commands script execution on an advisor

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

Step 2: Expect a failure in the following command: Run command set system script SCRIPT_1 configuration 'set potato' at DUT0 and expect this output:

Show output
Value validation failed
CLI Error: Command error

Step 3: Expect a failure in the following command: Run command set system script SCRIPT_1 configuration 'set potato' at DUT0 and expect this output:

Show output
Value validation failed
CLI Error: Command error

Step 4: Expect a failure in the following command: Run command set system script SCRIPT_1 configuration 'set potato' at DUT0 and expect this output:

Show output
Value validation failed
CLI Error: Command error

Step 5: 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 operational 1 command 'system potato'

Step 6: Run command system script SCRIPT_1 activate at DUT0 and expect this output: Step 7: Run command system journal show | grep "CLI Error: Invalid token *" at DUT0 and check if output contains the following tokens:

CLI Error: Invalid token [potato]
Show output
CLI Error: Invalid token [potato]