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.8
# Tue 25 Nov 2025 13:35:56 +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.8
Show output
Nov 25 13:36:00.332388 osdx systemd-journald[542263]: Runtime Journal (/run/log/journal/3dabd6c33b8e497d9fdbc41689ab0c32) is 2.0M, max 13.8M, 11.7M free.
Nov 25 13:36:00.334994 osdx systemd-journald[542263]: Received client request to rotate journal, rotating.
Nov 25 13:36:00.335041 osdx systemd-journald[542263]: Vacuuming done, freed 0B of archived journals from /run/log/journal/3dabd6c33b8e497d9fdbc41689ab0c32.
Nov 25 13:36:00.336459 osdx sudo[574476]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Nov 25 13:36:00.345531 osdx OSDxCLI[573994]: User 'admin' executed a new command: 'system journal clear'.
Nov 25 13:36:00.567337 osdx OSDxCLI[573994]: User 'admin' executed a new command: 'system coredump delete all'.
Nov 25 13:36:00.814550 osdx OSDxCLI[573994]: User 'admin' entered the configuration menu.
Nov 25 13:36:00.877813 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Nov 25 13:36:00.979504 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Nov 25 13:36:01.038826 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Nov 25 13:36:01.129416 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Nov 25 13:36:01.204428 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Nov 25 13:36:01.298458 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Nov 25 13:36:01.356760 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Nov 25 13:36:01.471246 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'show working'.
Nov 25 13:36:01.540322 osdx ubnt-cfgd[574510]: inactive
Nov 25 13:36:01.563801 osdx INFO[574520]: FRR daemons did not change
Nov 25 13:36:01.564742 osdx modulelauncher[1478]: + Received data: ['573994', 'osdx.utils.xos', 'set_console_log_level', 'info']
Nov 25 13:36:01.583174 osdx OSDxCLI[573994]: Signal 10 received
Nov 25 13:36:01.626998 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Nov 25 13:36:01.677928 osdx cfgd[1655]: [573994]Completed change to active configuration
Nov 25 13:36:01.692382 osdx OSDxCLI[573994]: User 'admin' committed the configuration.
Nov 25 13:36:01.711715 osdx OSDxCLI[573994]: User 'admin' left the configuration menu.
Nov 25 13:36:01.921144 osdx OSDxCLI[573994]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 25 13:36:01.921757 osdx OSDxCLI[573994]: pam_unix(cli:session): session closed for user admin
Nov 25 13:36:01.921958 osdx OSDxCLI[573994]: User 'admin' entered the configuration menu.
Nov 25 13:36:02.020825 osdx OSDxCLI[573994]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 25 13:36:02.021378 osdx cfgd[1655]: Execute action [syntax] for node [system advisor ADVISOR1]
Nov 25 13:36:02.021856 osdx OSDxCLI[573994]: pam_unix(cli:session): session closed for user admin
Nov 25 13:36:02.022188 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Nov 25 13:36:02.131047 osdx OSDxCLI[573994]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 25 13:36:02.136725 osdx OSDxCLI[573994]: pam_unix(cli:session): session closed for user admin
Nov 25 13:36:02.137074 osdx OSDxCLI[573994]: User 'admin' added a new cfg line: 'show changes'.
Nov 25 13:36:02.206081 osdx OSDxCLI[573994]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Nov 25 13:36:02.215139 osdx ubnt-cfgd[574653]: inactive
Nov 25 13:36:02.227194 osdx cfgd[1655]: [573994]must validation for [system login user admin role] was skipped
Nov 25 13:36:02.227204 osdx cfgd[1655]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Nov 25 13:36:02.239673 osdx INFO[574661]: FRR daemons did not change
Nov 25 13:36:02.240328 osdx cfgd[1655]: Execute action [end] for node [system advisor ADVISOR1]
Nov 25 13:36:02.245561 osdx cfgd[1655]: [573994]Completed change to active configuration
Nov 25 13:36:02.247617 osdx OSDxCLI[573994]: pam_unix(cli:session): session closed for user admin
Nov 25 13:36:02.247902 osdx OSDxCLI[573994]: User 'admin' committed the configuration.
Nov 25 13:36:02.249056 osdx INFO[574669]: SCRIPT SCRIPT_1 operations:
Nov 25 13:36:02.254514 osdx OSDxCLI[574676]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.254708 osdx OSDxCLI[574676]: User 'admin' has logged in.
Nov 25 13:36:02.264102 osdx OSDxCLI[574676]: User 'admin' executed a new command: 'show version'.
Nov 25 13:36:02.265142 osdx OSDxCLI[574676]: User 'admin' has logged out.
Nov 25 13:36:02.265195 osdx OSDxCLI[574676]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.265777 osdx INFO[574669]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.4.8
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Tue Nov 25 08:03:20 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-5.2
                                            Hardware UUID:             abba5d4e-c798-511c-952a-cbb4adcdb7d9
                                            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:        Panic

                                            Date:                      Tue 25 Nov 2025 13:36:02 +00:00
                                            Uptime:                    3:58:59
                                            CPU load (1m, 5m, 15m):    0.10 0.12 0.14
                                            CPU usage % (1m):          6.36
                                            Storage usage (kB):        377836/8144384
                                            Memory usage (kB):         444412/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Nov 25 13:36:02.270516 osdx OSDxCLI[574683]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.270688 osdx OSDxCLI[574683]: User 'admin' has logged in.
Nov 25 13:36:02.273019 osdx OSDxCLI[574683]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.274931 osdx OSDxCLI[574683]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.275111 osdx OSDxCLI[574683]: User 'admin' executed a new command: 'license show'.
Nov 25 13:36:02.276005 osdx OSDxCLI[574683]: User 'admin' has logged out.
Nov 25 13:36:02.276008 osdx OSDxCLI[574683]: Tecla::GetLine tcgetattr error
Nov 25 13:36:02.276494 osdx INFO[574669]: 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 25 13:36:02.286768 osdx OSDxCLI[573994]: User 'admin' left the configuration menu.
Nov 25 13:36:02.441043 osdx OSDxCLI[573994]: 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::4426:82ff:fe81:24a2/64  up     up
dum1  fe80::fc14:1eff:feb6:f4d9/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.8
# Tue 25 Nov 2025 13:36:14 +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.8
# Tue 25 Nov 2025 13:36:16 +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.8
# Tue 25 Nov 2025 13:36:17 +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