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.1
# Wed 12 Nov 2025 13:10:25 +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.1
Show output
Nov 12 13:10:29.347446 osdx systemd-journald[1959]: Runtime Journal (/run/log/journal/5e4ed8d3546348e58126c9438c4a827c) is 1.8M, max 13.8M, 11.9M free.
Nov 12 13:10:29.348082 osdx systemd-journald[1959]: Received client request to rotate journal, rotating.
Nov 12 13:10:29.348143 osdx systemd-journald[1959]: Vacuuming done, freed 0B of archived journals from /run/log/journal/5e4ed8d3546348e58126c9438c4a827c.
Nov 12 13:10:29.359115 osdx OSDxCLI[239385]: User 'admin' executed a new command: 'system journal clear'.
Nov 12 13:10:29.584943 osdx OSDxCLI[239385]: User 'admin' executed a new command: 'system coredump delete all'.
Nov 12 13:10:29.827949 osdx OSDxCLI[239385]: User 'admin' entered the configuration menu.
Nov 12 13:10:29.892935 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Nov 12 13:10:29.998497 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Nov 12 13:10:30.054282 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Nov 12 13:10:30.139992 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Nov 12 13:10:30.210908 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Nov 12 13:10:30.295477 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Nov 12 13:10:30.346846 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Nov 12 13:10:30.460959 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'show working'.
Nov 12 13:10:30.529363 osdx ubnt-cfgd[241681]: inactive
Nov 12 13:10:30.549444 osdx INFO[241689]: FRR daemons did not change
Nov 12 13:10:30.551943 osdx modulelauncher[1476]: + Received data: ['239385', 'osdx.utils.xos', 'set_console_log_level', 'info']
Nov 12 13:10:30.585512 osdx OSDxCLI[239385]: Signal 10 received
Nov 12 13:10:30.652081 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Nov 12 13:10:30.701669 osdx WARNING[241782]: No supported link modes on interface eth0
Nov 12 13:10:30.703363 osdx modulelauncher[241782]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on
Nov 12 13:10:30.703374 osdx modulelauncher[241782]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76.
Nov 12 13:10:30.704818 osdx modulelauncher[241782]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --
Nov 12 13:10:30.704826 osdx modulelauncher[241782]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75.
Nov 12 13:10:30.716658 osdx cfgd[1656]: [239385]Completed change to active configuration
Nov 12 13:10:30.727685 osdx OSDxCLI[239385]: User 'admin' committed the configuration.
Nov 12 13:10:30.769847 osdx OSDxCLI[239385]: User 'admin' left the configuration menu.
Nov 12 13:10:30.931090 osdx OSDxCLI[239385]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 12 13:10:30.931585 osdx OSDxCLI[239385]: pam_unix(cli:session): session closed for user admin
Nov 12 13:10:30.931833 osdx OSDxCLI[239385]: User 'admin' entered the configuration menu.
Nov 12 13:10:30.984039 osdx OSDxCLI[239385]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 12 13:10:30.984248 osdx cfgd[1656]: Execute action [syntax] for node [system advisor ADVISOR1]
Nov 12 13:10:30.984544 osdx OSDxCLI[239385]: pam_unix(cli:session): session closed for user admin
Nov 12 13:10:30.984718 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Nov 12 13:10:31.085098 osdx OSDxCLI[239385]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 12 13:10:31.092875 osdx OSDxCLI[239385]: pam_unix(cli:session): session closed for user admin
Nov 12 13:10:31.093097 osdx OSDxCLI[239385]: User 'admin' added a new cfg line: 'show changes'.
Nov 12 13:10:31.141388 osdx OSDxCLI[239385]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 12 13:10:31.152258 osdx ubnt-cfgd[241832]: inactive
Nov 12 13:10:31.166921 osdx cfgd[1656]: [239385]must validation for [system login user admin role] was skipped
Nov 12 13:10:31.166936 osdx cfgd[1656]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Nov 12 13:10:31.174726 osdx INFO[241840]: FRR daemons did not change
Nov 12 13:10:31.174893 osdx cfgd[1656]: Execute action [end] for node [system advisor ADVISOR1]
Nov 12 13:10:31.180157 osdx cfgd[1656]: [239385]Completed change to active configuration
Nov 12 13:10:31.181813 osdx OSDxCLI[239385]: pam_unix(cli:session): session closed for user admin
Nov 12 13:10:31.182038 osdx OSDxCLI[239385]: User 'admin' committed the configuration.
Nov 12 13:10:31.183521 osdx INFO[241848]: SCRIPT SCRIPT_1 operations:
Nov 12 13:10:31.188077 osdx OSDxCLI[241856]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.188081 osdx OSDxCLI[241856]: User 'admin' has logged in.
Nov 12 13:10:31.196459 osdx OSDxCLI[241856]: User 'admin' executed a new command: 'show version'.
Nov 12 13:10:31.197961 osdx OSDxCLI[241856]: User 'admin' has logged out.
Nov 12 13:10:31.197967 osdx OSDxCLI[241856]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.198344 osdx OSDxCLI[239385]: User 'admin' left the configuration menu.
Nov 12 13:10:31.198473 osdx INFO[241848]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.7.1
                                            OS Linux kernel:           6.1.140
                                            OS built by:               jenkins@daphne
                                            OS build date:             Wed Nov 12 09:58:13 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:             fa84db82-14d9-5c4a-9149-f1dcac08c05f
                                            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:        Power Failure

                                            Date:                      Wed 12 Nov 2025 13:10:31 +00:00
                                            Uptime:                    2:38:10
                                            CPU load (1m, 5m, 15m):    0.20 0.16 0.16
                                            CPU usage % (1m):          4.40
                                            Storage usage (kB):        385696/8144384
                                            Memory usage (kB):         384544/1570504
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Nov 12 13:10:31.203162 osdx OSDxCLI[241862]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.203168 osdx OSDxCLI[241862]: User 'admin' has logged in.
Nov 12 13:10:31.207101 osdx OSDxCLI[241862]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.209623 osdx OSDxCLI[241862]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.209813 osdx OSDxCLI[241862]: User 'admin' executed a new command: 'license show'.
Nov 12 13:10:31.210962 osdx OSDxCLI[241862]: User 'admin' has logged out.
Nov 12 13:10:31.210968 osdx OSDxCLI[241862]: Tecla::GetLine tcgetattr error
Nov 12 13:10:31.211520 osdx INFO[241848]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Nov 12 13:10:31.322230 osdx OSDxCLI[239385]: 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::9865:f1ff:fe83:79/64    up     up
dum1  fe80::a865:1bff:fe67:a67e/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.1
# Wed 12 Nov 2025 13:10:43 +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.1
# Wed 12 Nov 2025 13:10:45 +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.1
# Wed 12 Nov 2025 13:10:46 +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]