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.1
# Fri 20 Jun 2025 13:02:59 +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.1
Show output
Jun 20 13:03:03.434837 osdx systemd-journald[1762]: Runtime Journal (/run/log/journal/a9538f26f6924eb58d28105803b55de8) is 2.2M, max 15.3M, 13.1M free.
Jun 20 13:03:03.437440 osdx systemd-journald[1762]: Received client request to rotate journal, rotating.
Jun 20 13:03:03.437504 osdx systemd-journald[1762]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a9538f26f6924eb58d28105803b55de8.
Jun 20 13:03:03.446157 osdx OSDxCLI[163149]: User 'admin' executed a new command: 'system journal clear'.
Jun 20 13:03:03.701937 osdx OSDxCLI[163149]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 20 13:03:03.961079 osdx OSDxCLI[163149]: User 'admin' entered the configuration menu.
Jun 20 13:03:04.023232 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 20 13:03:04.139797 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Jun 20 13:03:04.222613 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Jun 20 13:03:04.329611 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 20 13:03:04.408673 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Jun 20 13:03:04.495274 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Jun 20 13:03:04.599459 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Jun 20 13:03:04.702223 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'show working'.
Jun 20 13:03:04.795935 osdx ubnt-cfgd[170407]: inactive
Jun 20 13:03:04.818872 osdx INFO[170417]: FRR daemons did not change
Jun 20 13:03:04.819947 osdx modulelauncher[1283]: + Received data: ['163149', 'osdx.utils.xos', 'set_console_log_level', 'info']
Jun 20 13:03:04.843622 osdx OSDxCLI[163149]: Signal 10 received
Jun 20 13:03:04.893426 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 20 13:03:04.947592 osdx cfgd[1460]: [163149]Completed change to active configuration
Jun 20 13:03:04.961889 osdx OSDxCLI[163149]: User 'admin' committed the configuration.
Jun 20 13:03:04.980866 osdx OSDxCLI[163149]: User 'admin' left the configuration menu.
Jun 20 13:03:05.195317 osdx OSDxCLI[163149]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 20 13:03:05.196073 osdx OSDxCLI[163149]: pam_unix(cli:session): session closed for user admin
Jun 20 13:03:05.196328 osdx OSDxCLI[163149]: User 'admin' entered the configuration menu.
Jun 20 13:03:05.268932 osdx OSDxCLI[163149]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 20 13:03:05.269260 osdx cfgd[1460]: Execute action [syntax] for node [system advisor ADVISOR1]
Jun 20 13:03:05.269651 osdx OSDxCLI[163149]: pam_unix(cli:session): session closed for user admin
Jun 20 13:03:05.269899 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Jun 20 13:03:05.368674 osdx OSDxCLI[163149]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 20 13:03:05.381315 osdx OSDxCLI[163149]: pam_unix(cli:session): session closed for user admin
Jun 20 13:03:05.381706 osdx OSDxCLI[163149]: User 'admin' added a new cfg line: 'show changes'.
Jun 20 13:03:05.450657 osdx OSDxCLI[163149]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 20 13:03:05.467245 osdx ubnt-cfgd[170552]: inactive
Jun 20 13:03:05.481552 osdx cfgd[1460]: [163149]must validation for [system login user admin role] was skipped
Jun 20 13:03:05.481566 osdx cfgd[1460]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Jun 20 13:03:05.489785 osdx INFO[170560]: FRR daemons did not change
Jun 20 13:03:05.490173 osdx cfgd[1460]: Execute action [end] for node [system advisor ADVISOR1]
Jun 20 13:03:05.496636 osdx cfgd[1460]: [163149]Completed change to active configuration
Jun 20 13:03:05.498349 osdx OSDxCLI[163149]: pam_unix(cli:session): session closed for user admin
Jun 20 13:03:05.498596 osdx OSDxCLI[163149]: User 'admin' committed the configuration.
Jun 20 13:03:05.501728 osdx INFO[170570]: SCRIPT SCRIPT_1 operations:
Jun 20 13:03:05.507755 osdx OSDxCLI[170577]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.507759 osdx OSDxCLI[170577]: User 'admin' has logged in.
Jun 20 13:03:05.517346 osdx OSDxCLI[170577]: User 'admin' executed a new command: 'show version'.
Jun 20 13:03:05.518572 osdx OSDxCLI[170577]: User 'admin' has logged out.
Jun 20 13:03:05.518578 osdx OSDxCLI[170577]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.519334 osdx INFO[170570]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.5.1
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Fri Jun 20 10:50: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-5.2
                                            Hardware UUID:             7e903208-dcaf-5fa8-bbff-1faf838edf07
                                            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:        Power Failure

                                            Date:                      Fri 20 Jun 2025 13:03:05 +00:00
                                            Uptime:                    1:39:02
                                            CPU load (1m, 5m, 15m):    0.11 0.23 0.19
                                            CPU usage % (1m):          2.17
                                            Storage usage (kB):        348408/8144384
                                            Memory usage (kB):         385664/1574492
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Jun 20 13:03:05.525174 osdx OSDxCLI[170583]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.525421 osdx OSDxCLI[170583]: User 'admin' has logged in.
Jun 20 13:03:05.528038 osdx OSDxCLI[170583]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.528762 osdx OSDxCLI[163149]: User 'admin' left the configuration menu.
Jun 20 13:03:05.530571 osdx OSDxCLI[170583]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.530759 osdx OSDxCLI[170583]: User 'admin' executed a new command: 'license show'.
Jun 20 13:03:05.531675 osdx OSDxCLI[170583]: User 'admin' has logged out.
Jun 20 13:03:05.531719 osdx OSDxCLI[170583]: Tecla::GetLine tcgetattr error
Jun 20 13:03:05.532230 osdx INFO[170570]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Jun 20 13:03:05.671707 osdx OSDxCLI[163149]: 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::986f:31ff:fe7b:53ea/64  up     up
dum1  fe80::101a:72ff:fe91:1b65/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.1
# Fri 20 Jun 2025 13:03:18 +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.1
# Fri 20 Jun 2025 13:03:19 +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.1
# Fri 20 Jun 2025 13:03:21 +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