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.5.2
# Fri 05 Sep 2025 14:06:29 +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.5.2
Show output
Sep 05 14:06:33.308394 osdx systemd-journald[132215]: Runtime Journal (/run/log/journal/277fa7f754984f629482974adff2eda9) is 1.9M, max 13.8M, 11.8M free.
Sep 05 14:06:33.310292 osdx systemd-journald[132215]: Received client request to rotate journal, rotating.
Sep 05 14:06:33.310361 osdx systemd-journald[132215]: Vacuuming done, freed 0B of archived journals from /run/log/journal/277fa7f754984f629482974adff2eda9.
Sep 05 14:06:33.312808 osdx sudo[136638]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Sep 05 14:06:33.321265 osdx OSDxCLI[132067]: User 'admin' executed a new command: 'system journal clear'.
Sep 05 14:06:33.546863 osdx OSDxCLI[132067]: User 'admin' executed a new command: 'system coredump delete all'.
Sep 05 14:06:33.770374 osdx OSDxCLI[132067]: User 'admin' entered the configuration menu.
Sep 05 14:06:33.839390 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Sep 05 14:06:33.944604 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Sep 05 14:06:34.000504 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Sep 05 14:06:34.099958 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Sep 05 14:06:34.179875 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Sep 05 14:06:34.270950 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Sep 05 14:06:34.336635 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Sep 05 14:06:34.438837 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'show working'.
Sep 05 14:06:34.502308 osdx ubnt-cfgd[136672]: inactive
Sep 05 14:06:34.526127 osdx INFO[136682]: FRR daemons did not change
Sep 05 14:06:34.527126 osdx modulelauncher[1286]: + Received data: ['132067', 'osdx.utils.xos', 'set_console_log_level', 'info']
Sep 05 14:06:34.548171 osdx OSDxCLI[132067]: Signal 10 received
Sep 05 14:06:34.602319 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Sep 05 14:06:34.675577 osdx cfgd[1463]: [132067]Completed change to active configuration
Sep 05 14:06:34.686427 osdx OSDxCLI[132067]: User 'admin' committed the configuration.
Sep 05 14:06:34.710417 osdx OSDxCLI[132067]: User 'admin' left the configuration menu.
Sep 05 14:06:34.871932 osdx OSDxCLI[132067]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Sep 05 14:06:34.872494 osdx OSDxCLI[132067]: pam_unix(cli:session): session closed for user admin
Sep 05 14:06:34.872751 osdx OSDxCLI[132067]: User 'admin' entered the configuration menu.
Sep 05 14:06:34.940524 osdx OSDxCLI[132067]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Sep 05 14:06:34.940906 osdx cfgd[1463]: Execute action [syntax] for node [system advisor ADVISOR1]
Sep 05 14:06:34.941224 osdx OSDxCLI[132067]: pam_unix(cli:session): session closed for user admin
Sep 05 14:06:34.941439 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Sep 05 14:06:35.032863 osdx OSDxCLI[132067]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Sep 05 14:06:35.041981 osdx OSDxCLI[132067]: pam_unix(cli:session): session closed for user admin
Sep 05 14:06:35.042295 osdx OSDxCLI[132067]: User 'admin' added a new cfg line: 'show changes'.
Sep 05 14:06:35.091469 osdx OSDxCLI[132067]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Sep 05 14:06:35.104720 osdx ubnt-cfgd[136817]: inactive
Sep 05 14:06:35.171545 osdx cfgd[1463]: [132067]must validation for [system login user admin role] was skipped
Sep 05 14:06:35.171679 osdx cfgd[1463]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Sep 05 14:06:35.187553 osdx INFO[136825]: FRR daemons did not change
Sep 05 14:06:35.188583 osdx cfgd[1463]: Execute action [end] for node [system advisor ADVISOR1]
Sep 05 14:06:35.202127 osdx cfgd[1463]: [132067]Completed change to active configuration
Sep 05 14:06:35.205995 osdx OSDxCLI[132067]: pam_unix(cli:session): session closed for user admin
Sep 05 14:06:35.206468 osdx OSDxCLI[132067]: User 'admin' committed the configuration.
Sep 05 14:06:35.211915 osdx INFO[136834]: SCRIPT SCRIPT_1 operations:
Sep 05 14:06:35.219207 osdx OSDxCLI[136842]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.219373 osdx OSDxCLI[136842]: User 'admin' has logged in.
Sep 05 14:06:35.229406 osdx OSDxCLI[136842]: User 'admin' executed a new command: 'show version'.
Sep 05 14:06:35.230727 osdx OSDxCLI[136842]: User 'admin' has logged out.
Sep 05 14:06:35.230793 osdx OSDxCLI[136842]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.231345 osdx OSDxCLI[132067]: User 'admin' left the configuration menu.
Sep 05 14:06:35.231573 osdx INFO[136834]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.5.2
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Fri Sep 5 09:02:33 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:             c3b6b610-c48e-5303-b335-b0f7eac16af6
                                            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:                      Fri 05 Sep 2025 14:06:35 +00:00
                                            Uptime:                    0:58:27
                                            CPU load (1m, 5m, 15m):    0.21 0.28 0.20
                                            CPU usage % (1m):          6.14
                                            Storage usage (kB):        377864/8144384
                                            Memory usage (kB):         405260/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Sep 05 14:06:35.236605 osdx OSDxCLI[136848]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.236761 osdx OSDxCLI[136848]: User 'admin' has logged in.
Sep 05 14:06:35.240169 osdx OSDxCLI[136848]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.242131 osdx OSDxCLI[136848]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.242329 osdx OSDxCLI[136848]: User 'admin' executed a new command: 'license show'.
Sep 05 14:06:35.243564 osdx OSDxCLI[136848]: User 'admin' has logged out.
Sep 05 14:06:35.243606 osdx OSDxCLI[136848]: Tecla::GetLine tcgetattr error
Sep 05 14:06:35.244112 osdx INFO[136834]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Sep 05 14:06:35.358684 osdx OSDxCLI[132067]: 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::58e6:4aff:fe61:b2fb/64  up     up
dum1  fe80::6ce4:48ff:fe51:c64/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.5.2
# Fri 05 Sep 2025 14:06:48 +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.5.2
# Fri 05 Sep 2025 14:06:49 +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.5.2
# Fri 05 Sep 2025 14:06:51 +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