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.8.1
# Thu 11 Dec 2025 15:03:32 +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.8.1
Show output
Dec 11 15:03:36.279465 osdx systemd-journald[1970]: Runtime Journal (/run/log/journal/ff8de1b7feed4cd0a923a6e53f75b1b9) is 1.8M, max 13.8M, 11.9M free.
Dec 11 15:03:36.280543 osdx systemd-journald[1970]: Received client request to rotate journal, rotating.
Dec 11 15:03:36.280586 osdx systemd-journald[1970]: Vacuuming done, freed 0B of archived journals from /run/log/journal/ff8de1b7feed4cd0a923a6e53f75b1b9.
Dec 11 15:03:36.289135 osdx OSDxCLI[124329]: User 'admin' executed a new command: 'system journal clear'.
Dec 11 15:03:36.538063 osdx OSDxCLI[124329]: User 'admin' executed a new command: 'system coredump delete all'.
Dec 11 15:03:36.791072 osdx OSDxCLI[124329]: User 'admin' entered the configuration menu.
Dec 11 15:03:36.873718 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Dec 11 15:03:36.987099 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Dec 11 15:03:37.102470 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Dec 11 15:03:37.217284 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Dec 11 15:03:37.309949 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Dec 11 15:03:37.405094 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Dec 11 15:03:37.485850 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Dec 11 15:03:37.606046 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'show working'.
Dec 11 15:03:37.679587 osdx ubnt-cfgd[124749]: inactive
Dec 11 15:03:37.699163 osdx INFO[124757]: FRR daemons did not change
Dec 11 15:03:37.700711 osdx modulelauncher[1456]: + Received data: ['124329', 'osdx.utils.xos', 'set_console_log_level', 'info']
Dec 11 15:03:37.721751 osdx OSDxCLI[124329]: Signal 10 received
Dec 11 15:03:37.792541 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Dec 11 15:03:37.836125 osdx WARNING[124851]: No supported link modes on interface eth0
Dec 11 15:03:37.837826 osdx modulelauncher[124851]: osdx.utils.xos cmd error: /sbin/ethtool -A eth0 autoneg on
Dec 11 15:03:37.837839 osdx modulelauncher[124851]: Command '/sbin/ethtool -A eth0 autoneg on' returned non-zero exit status 76.
Dec 11 15:03:37.839265 osdx modulelauncher[124851]: osdx.utils.xos cmd error: /sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --
Dec 11 15:03:37.839275 osdx modulelauncher[124851]: Command '/sbin/ethtool -s eth0 autoneg on advertise Asym_Pause off Pause off --' returned non-zero exit status 75.
Dec 11 15:03:37.851385 osdx cfgd[1647]: [124329]Completed change to active configuration
Dec 11 15:03:37.865399 osdx OSDxCLI[124329]: User 'admin' committed the configuration.
Dec 11 15:03:37.887805 osdx OSDxCLI[124329]: User 'admin' left the configuration menu.
Dec 11 15:03:38.061211 osdx OSDxCLI[124329]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Dec 11 15:03:38.061754 osdx OSDxCLI[124329]: pam_unix(cli:session): session closed for user admin
Dec 11 15:03:38.061964 osdx OSDxCLI[124329]: User 'admin' entered the configuration menu.
Dec 11 15:03:38.120570 osdx OSDxCLI[124329]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Dec 11 15:03:38.120841 osdx cfgd[1647]: Execute action [syntax] for node [system advisor ADVISOR1]
Dec 11 15:03:38.121243 osdx OSDxCLI[124329]: pam_unix(cli:session): session closed for user admin
Dec 11 15:03:38.121496 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Dec 11 15:03:38.210901 osdx OSDxCLI[124329]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Dec 11 15:03:38.216169 osdx OSDxCLI[124329]: pam_unix(cli:session): session closed for user admin
Dec 11 15:03:38.216425 osdx OSDxCLI[124329]: User 'admin' added a new cfg line: 'show changes'.
Dec 11 15:03:38.291194 osdx OSDxCLI[124329]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Dec 11 15:03:38.300269 osdx ubnt-cfgd[124901]: inactive
Dec 11 15:03:38.327588 osdx cfgd[1647]: [124329]must validation for [system login user admin role] was skipped
Dec 11 15:03:38.327601 osdx cfgd[1647]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Dec 11 15:03:38.335662 osdx INFO[124909]: FRR daemons did not change
Dec 11 15:03:38.335839 osdx cfgd[1647]: Execute action [end] for node [system advisor ADVISOR1]
Dec 11 15:03:38.341207 osdx cfgd[1647]: [124329]Completed change to active configuration
Dec 11 15:03:38.343316 osdx OSDxCLI[124329]: pam_unix(cli:session): session closed for user admin
Dec 11 15:03:38.343575 osdx OSDxCLI[124329]: User 'admin' committed the configuration.
Dec 11 15:03:38.344399 osdx INFO[124917]: SCRIPT SCRIPT_1 operations:
Dec 11 15:03:38.350273 osdx OSDxCLI[124923]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.350281 osdx OSDxCLI[124923]: User 'admin' has logged in.
Dec 11 15:03:38.363097 osdx OSDxCLI[124923]: User 'admin' executed a new command: 'show version'.
Dec 11 15:03:38.364391 osdx OSDxCLI[124923]: User 'admin' has logged out.
Dec 11 15:03:38.364397 osdx OSDxCLI[124923]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.365134 osdx INFO[124917]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.8.1
                                            OS Linux kernel:           6.1.140
                                            OS built by:               jenkins@daphne
                                            OS build date:             Thu Dec 11 11:54:01 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:             3b6b022f-0626-5c71-898a-a40286f774ff
                                            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:                      Thu 11 Dec 2025 15:03:38 +00:00
                                            Uptime:                    1:42:27
                                            CPU load (1m, 5m, 15m):    0.07 0.20 0.17
                                            CPU usage % (1m):          1.05
                                            Storage usage (kB):        390472/8144384
                                            Memory usage (kB):         364880/1570504
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Dec 11 15:03:38.370690 osdx OSDxCLI[124931]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.370697 osdx OSDxCLI[124931]: User 'admin' has logged in.
Dec 11 15:03:38.374768 osdx OSDxCLI[124931]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.375755 osdx OSDxCLI[124329]: User 'admin' left the configuration menu.
Dec 11 15:03:38.377282 osdx OSDxCLI[124931]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.377476 osdx OSDxCLI[124931]: User 'admin' executed a new command: 'license show'.
Dec 11 15:03:38.378526 osdx OSDxCLI[124931]: User 'admin' has logged out.
Dec 11 15:03:38.378534 osdx OSDxCLI[124931]: Tecla::GetLine tcgetattr error
Dec 11 15:03:38.379178 osdx INFO[124917]: 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  |
                                          +-----------------+----------+----------+
Dec 11 15:03:38.492556 osdx OSDxCLI[124329]: 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::9c66:73ff:fe60:d646/64  up     up
dum1  fe80::4c0d:e5ff:fe20:dfaa/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.8.1
# Thu 11 Dec 2025 15:03:51 +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.8.1
# Thu 11 Dec 2025 15:03:52 +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.8.1
# Thu 11 Dec 2025 15:03:54 +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]