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.7
# Wed 20 Aug 2025 13:45:15 +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.7
Show output
Aug 20 13:45:19.358620 osdx systemd-journald[82189]: Runtime Journal (/run/log/journal/c36516c5c29741ae91520d0cd389ea90) is 2.2M, max 15.3M, 13.1M free.
Aug 20 13:45:19.361276 osdx systemd-journald[82189]: Received client request to rotate journal, rotating.
Aug 20 13:45:19.361332 osdx systemd-journald[82189]: Vacuuming done, freed 0B of archived journals from /run/log/journal/c36516c5c29741ae91520d0cd389ea90.
Aug 20 13:45:19.363910 osdx sudo[144462]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Aug 20 13:45:19.372945 osdx OSDxCLI[91826]: User 'admin' executed a new command: 'system journal clear'.
Aug 20 13:45:19.609820 osdx OSDxCLI[91826]: User 'admin' executed a new command: 'system coredump delete all'.
Aug 20 13:45:19.871185 osdx OSDxCLI[91826]: User 'admin' entered the configuration menu.
Aug 20 13:45:20.009787 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Aug 20 13:45:20.109023 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Aug 20 13:45:20.168280 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Aug 20 13:45:20.269330 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Aug 20 13:45:20.346961 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Aug 20 13:45:20.439244 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Aug 20 13:45:20.496698 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Aug 20 13:45:20.614692 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'show working'.
Aug 20 13:45:20.688188 osdx ubnt-cfgd[144498]: inactive
Aug 20 13:45:20.714512 osdx INFO[144508]: FRR daemons did not change
Aug 20 13:45:20.715625 osdx modulelauncher[1479]: + Received data: ['91826', 'osdx.utils.xos', 'set_console_log_level', 'info']
Aug 20 13:45:20.737411 osdx OSDxCLI[91826]: Signal 10 received
Aug 20 13:45:20.793280 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Aug 20 13:45:20.847751 osdx cfgd[1656]: [91826]Completed change to active configuration
Aug 20 13:45:20.862782 osdx OSDxCLI[91826]: User 'admin' committed the configuration.
Aug 20 13:45:20.907289 osdx OSDxCLI[91826]: User 'admin' left the configuration menu.
Aug 20 13:45:21.088428 osdx OSDxCLI[91826]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Aug 20 13:45:21.089174 osdx OSDxCLI[91826]: pam_unix(cli:session): session closed for user admin
Aug 20 13:45:21.089633 osdx OSDxCLI[91826]: User 'admin' entered the configuration menu.
Aug 20 13:45:21.158915 osdx OSDxCLI[91826]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Aug 20 13:45:21.159257 osdx cfgd[1656]: Execute action [syntax] for node [system advisor ADVISOR1]
Aug 20 13:45:21.159560 osdx OSDxCLI[91826]: pam_unix(cli:session): session closed for user admin
Aug 20 13:45:21.159791 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Aug 20 13:45:21.257105 osdx OSDxCLI[91826]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Aug 20 13:45:21.266549 osdx OSDxCLI[91826]: pam_unix(cli:session): session closed for user admin
Aug 20 13:45:21.266881 osdx OSDxCLI[91826]: User 'admin' added a new cfg line: 'show changes'.
Aug 20 13:45:21.350976 osdx OSDxCLI[91826]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Aug 20 13:45:21.362941 osdx ubnt-cfgd[144643]: inactive
Aug 20 13:45:21.374357 osdx cfgd[1656]: [91826]must validation for [system login user admin role] was skipped
Aug 20 13:45:21.374377 osdx cfgd[1656]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Aug 20 13:45:21.381822 osdx INFO[144651]: FRR daemons did not change
Aug 20 13:45:21.382219 osdx cfgd[1656]: Execute action [end] for node [system advisor ADVISOR1]
Aug 20 13:45:21.388369 osdx cfgd[1656]: [91826]Completed change to active configuration
Aug 20 13:45:21.390182 osdx OSDxCLI[91826]: pam_unix(cli:session): session closed for user admin
Aug 20 13:45:21.390484 osdx OSDxCLI[91826]: User 'admin' committed the configuration.
Aug 20 13:45:21.394631 osdx INFO[144660]: SCRIPT SCRIPT_1 operations:
Aug 20 13:45:21.399274 osdx OSDxCLI[144668]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.399443 osdx OSDxCLI[144668]: User 'admin' has logged in.
Aug 20 13:45:21.408018 osdx OSDxCLI[144668]: User 'admin' executed a new command: 'show version'.
Aug 20 13:45:21.408908 osdx OSDxCLI[144668]: User 'admin' has logged out.
Aug 20 13:45:21.408912 osdx OSDxCLI[144668]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.409031 osdx OSDxCLI[91826]: User 'admin' left the configuration menu.
Aug 20 13:45:21.409476 osdx INFO[144660]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.4.7
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Wed Aug 20 09:11:02 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:             0cc9bf55-04b9-542b-9246-516f1bd76dc7
                                            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:                      Wed 20 Aug 2025 13:45:21 +00:00
                                            Uptime:                    0:58:23
                                            CPU load (1m, 5m, 15m):    0.35 0.19 0.12
                                            CPU usage % (1m):          2.07
                                            Storage usage (kB):        377692/8144384
                                            Memory usage (kB):         399572/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Aug 20 13:45:21.413762 osdx OSDxCLI[144674]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.413922 osdx OSDxCLI[144674]: User 'admin' has logged in.
Aug 20 13:45:21.415799 osdx OSDxCLI[144674]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.417722 osdx OSDxCLI[144674]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.417896 osdx OSDxCLI[144674]: User 'admin' executed a new command: 'license show'.
Aug 20 13:45:21.418765 osdx OSDxCLI[144674]: User 'admin' has logged out.
Aug 20 13:45:21.418805 osdx OSDxCLI[144674]: Tecla::GetLine tcgetattr error
Aug 20 13:45:21.419289 osdx INFO[144660]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Aug 20 13:45:21.557457 osdx OSDxCLI[91826]: 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::6cfb:8ff:feae:2828/64   up     up
dum1  fe80::d4aa:44ff:fea0:f143/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.7
# Wed 20 Aug 2025 13:45:34 +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.7
# Wed 20 Aug 2025 13:45:35 +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.7
# Wed 20 Aug 2025 13:45:36 +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