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.9.1
# Mon 23 Mar 2026 07:32:35 +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.9.1
Show output
Mar 23 07:32:39.295136 osdx systemd-journald[2224]: Runtime Journal (/run/log/journal/9342df493a59479ea19be04fa8920e8f) is 1.8M, max 13.8M, 11.9M free.
Mar 23 07:32:39.296363 osdx systemd-journald[2224]: Received client request to rotate journal, rotating.
Mar 23 07:32:39.296421 osdx systemd-journald[2224]: Vacuuming done, freed 0B of archived journals from /run/log/journal/9342df493a59479ea19be04fa8920e8f.
Mar 23 07:32:39.304558 osdx OSDxCLI[48065]: User 'admin' executed a new command: 'system journal clear'.
Mar 23 07:32:39.496781 osdx OSDxCLI[48065]: User 'admin' executed a new command: 'system coredump delete all'.
Mar 23 07:32:39.698352 osdx OSDxCLI[48065]: User 'admin' entered the configuration menu.
Mar 23 07:32:39.755298 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 23 07:32:39.857071 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Mar 23 07:32:39.911408 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Mar 23 07:32:40.014015 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 23 07:32:40.093596 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Mar 23 07:32:40.165162 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Mar 23 07:32:40.258734 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Mar 23 07:32:40.324663 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'show working'.
Mar 23 07:32:40.425154 osdx ubnt-cfgd[48491]: inactive
Mar 23 07:32:40.448565 osdx INFO[48499]: FRR daemons did not change
Mar 23 07:32:40.450900 osdx modulelauncher[1669]: + Received data: ['48065', 'osdx.utils.xos', 'set_console_log_level', 'info']
Mar 23 07:32:40.470465 osdx OSDxCLI[48065]: Signal 10 received
Mar 23 07:32:40.544372 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Mar 23 07:32:40.589482 osdx WARNING[48593]: No supported link modes on interface eth0
Mar 23 07:32:40.590848 osdx modulelauncher[48593]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on
Mar 23 07:32:40.590860 osdx modulelauncher[48593]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76.
Mar 23 07:32:40.592007 osdx modulelauncher[48593]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --
Mar 23 07:32:40.592014 osdx modulelauncher[48593]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75.
Mar 23 07:32:40.603246 osdx cfgd[1860]: [48065]Completed change to active configuration
Mar 23 07:32:40.617199 osdx OSDxCLI[48065]: User 'admin' committed the configuration.
Mar 23 07:32:40.634800 osdx OSDxCLI[48065]: User 'admin' left the configuration menu.
Mar 23 07:32:40.796686 osdx OSDxCLI[48065]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 23 07:32:40.797297 osdx OSDxCLI[48065]: pam_unix(cli:session): session closed for user admin
Mar 23 07:32:40.797596 osdx OSDxCLI[48065]: User 'admin' entered the configuration menu.
Mar 23 07:32:40.856053 osdx OSDxCLI[48065]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 23 07:32:40.856282 osdx cfgd[1860]: Execute action [syntax] for node [system advisor ADVISOR1]
Mar 23 07:32:40.856594 osdx OSDxCLI[48065]: pam_unix(cli:session): session closed for user admin
Mar 23 07:32:40.856795 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Mar 23 07:32:40.958887 osdx OSDxCLI[48065]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 23 07:32:40.964166 osdx OSDxCLI[48065]: pam_unix(cli:session): session closed for user admin
Mar 23 07:32:40.964380 osdx OSDxCLI[48065]: User 'admin' added a new cfg line: 'show changes'.
Mar 23 07:32:41.037286 osdx OSDxCLI[48065]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 23 07:32:41.046696 osdx ubnt-cfgd[48643]: inactive
Mar 23 07:32:41.092103 osdx cfgd[1860]: [48065]must validation for [system login user admin role] was skipped
Mar 23 07:32:41.092117 osdx cfgd[1860]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Mar 23 07:32:41.098921 osdx INFO[48651]: FRR daemons did not change
Mar 23 07:32:41.099110 osdx cfgd[1860]: Execute action [end] for node [system advisor ADVISOR1]
Mar 23 07:32:41.104558 osdx cfgd[1860]: [48065]Completed change to active configuration
Mar 23 07:32:41.106321 osdx OSDxCLI[48065]: pam_unix(cli:session): session closed for user admin
Mar 23 07:32:41.106612 osdx OSDxCLI[48065]: User 'admin' committed the configuration.
Mar 23 07:32:41.107376 osdx INFO[48659]: SCRIPT SCRIPT_1 operations:
Mar 23 07:32:41.112455 osdx OSDxCLI[48665]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.112460 osdx OSDxCLI[48665]: User 'admin' has logged in.
Mar 23 07:32:41.121547 osdx OSDxCLI[48665]: User 'admin' executed a new command: 'show version'.
Mar 23 07:32:41.122430 osdx OSDxCLI[48665]: User 'admin' has logged out.
Mar 23 07:32:41.122435 osdx OSDxCLI[48665]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.122986 osdx INFO[48659]: Operation 1 'show version
                                         ':

                                           OS vendor:                 Teldat
                                           OS name:                   OSDx
                                           OS version:                v4.2.9.1
                                           OS Linux kernel:           6.12.73
                                           OS built by:               jenkins@diana
                                           OS build date:             Mon Mar 23 06:33:00 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-7.2
                                           Hardware UUID:             c1d5b9be-9b61-5d4e-8c8f-639e01e0b1e5
                                           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:                      Mon 23 Mar 2026 07:32:41 +00:00
                                           Uptime:                    0:33:10
                                           CPU load (1m, 5m, 15m):    0.06 0.11 0.09
                                           CPU usage % (1m):          0.50
                                           Storage usage (kB):        418092/8144384
                                           Memory usage (kB):         398108/1572692
                                           Users logged in:           1
                                           Mode (current/next boot):  user/user

                                           Hostname:                  osdx
Mar 23 07:32:41.126510 osdx OSDxCLI[48065]: User 'admin' left the configuration menu.
Mar 23 07:32:41.128092 osdx OSDxCLI[48673]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.128099 osdx OSDxCLI[48673]: User 'admin' has logged in.
Mar 23 07:32:41.132570 osdx OSDxCLI[48673]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.135230 osdx OSDxCLI[48673]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.135389 osdx OSDxCLI[48673]: User 'admin' executed a new command: 'license show'.
Mar 23 07:32:41.136253 osdx OSDxCLI[48673]: User 'admin' has logged out.
Mar 23 07:32:41.136258 osdx OSDxCLI[48673]: Tecla::GetLine tcgetattr error
Mar 23 07:32:41.136851 osdx INFO[48659]: Operation 2 'license show
                                         ':
                                         License: VM_BASE Firewall eth-Rate-Permit-Full

                                         +-----------------+----------+----------+
                                         | License Item    | Status   | Validity |
                                         +-----------------+----------+----------+
                                         | CELL            | Disabled | -        |
                                         | Firewall        | Enabled  | Forever  |
                                         | RD-ETSI         | Disabled | -        |
                                         | RD-FCC          | Disabled | -        |
                                         | RD-NOM          | Disabled | -        |
                                         | RD-ROW          | Disabled | -        |
                                         | WLAN            | Disabled | -        |
                                         | Windbit         | Disabled | -        |
                                         | eth-Rate-Permit | Full     | Forever  |
                                         +-----------------+----------+----------+
Mar 23 07:32:41.289305 osdx OSDxCLI[48065]: 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::18a1:9ff:fe39:421b/64   up     up
dum1  fe80::b49a:f5ff:fe9b:f086/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.9.1
# Mon 23 Mar 2026 07:32:53 +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.9.1
# Mon 23 Mar 2026 07:32:54 +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.9.1
# Mon 23 Mar 2026 07:32:55 +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: 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 4: Run command system script SCRIPT_1 activate at DUT0 and expect this output: Step 5: 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]