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.0
# Tue 13 May 2025 15:11:17 +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.0
Show output
May 13 15:11:21.000165 osdx systemd-timedated[175778]: Changed local time to Tue 2025-05-13 15:11:21 UTC
May 13 15:11:21.001827 osdx OSDxCLI[182032]: User 'admin' executed a new command: 'set date 2025-05-13 15:11:21'.
May 13 15:11:21.003664 osdx systemd-journald[1688]: Time jumped backwards, rotating.
May 13 15:11:21.308927 osdx sudo[182421]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
May 13 15:11:21.312988 osdx systemd-journald[1688]: Runtime Journal (/run/log/journal/78d6c860b8a549a191d002c20b18506e) is 2.1M, max 15.3M, 13.2M free.
May 13 15:11:21.315667 osdx systemd-journald[1688]: Received client request to rotate journal, rotating.
May 13 15:11:21.315725 osdx systemd-journald[1688]: Vacuuming done, freed 0B of archived journals from /run/log/journal/78d6c860b8a549a191d002c20b18506e.
May 13 15:11:21.318588 osdx sudo[182420]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
May 13 15:11:21.326765 osdx OSDxCLI[182032]: User 'admin' executed a new command: 'system journal clear'.
May 13 15:11:21.552211 osdx sudo[182428]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
May 13 15:11:21.642858 osdx sudo[182433]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
May 13 15:11:21.690876 osdx osdx-coredump[182435]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
May 13 15:11:21.698740 osdx OSDxCLI[182032]: User 'admin' executed a new command: 'system coredump delete all'.
May 13 15:11:22.182875 osdx OSDxCLI[182032]: User 'admin' entered the configuration menu.
May 13 15:11:22.271261 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 13 15:11:22.368065 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
May 13 15:11:22.428064 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
May 13 15:11:22.545892 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 13 15:11:22.628945 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
May 13 15:11:22.715294 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
May 13 15:11:22.774183 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
May 13 15:11:22.890282 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'show working'.
May 13 15:11:22.951617 osdx ubnt-cfgd[182462]: inactive
May 13 15:11:22.981693 osdx INFO[182472]: FRR daemons did not change
May 13 15:11:22.983093 osdx modulelauncher[1273]: + Received data: ['182032', 'osdx.utils.xos', 'set_console_log_level', 'info']
May 13 15:11:23.007725 osdx OSDxCLI[182032]: Signal 10 received
May 13 15:11:23.055674 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
May 13 15:11:23.107052 osdx cfgd[1466]: [182032]Completed change to active configuration
May 13 15:11:23.118199 osdx OSDxCLI[182032]: User 'admin' committed the configuration.
May 13 15:11:23.143483 osdx OSDxCLI[182032]: User 'admin' left the configuration menu.
May 13 15:11:23.308181 osdx OSDxCLI[182032]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 13 15:11:23.308632 osdx OSDxCLI[182032]: pam_unix(cli:session): session closed for user admin
May 13 15:11:23.308812 osdx OSDxCLI[182032]: User 'admin' entered the configuration menu.
May 13 15:11:23.367256 osdx OSDxCLI[182032]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 13 15:11:23.367547 osdx cfgd[1466]: Execute action [syntax] for node [system advisor ADVISOR1]
May 13 15:11:23.367842 osdx OSDxCLI[182032]: pam_unix(cli:session): session closed for user admin
May 13 15:11:23.368064 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
May 13 15:11:23.476025 osdx OSDxCLI[182032]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 13 15:11:23.487738 osdx OSDxCLI[182032]: pam_unix(cli:session): session closed for user admin
May 13 15:11:23.488094 osdx OSDxCLI[182032]: User 'admin' added a new cfg line: 'show changes'.
May 13 15:11:23.547910 osdx OSDxCLI[182032]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 13 15:11:23.560410 osdx ubnt-cfgd[182607]: inactive
May 13 15:11:23.572177 osdx cfgd[1466]: [182032]must validation for [system login user admin role] was skipped
May 13 15:11:23.572188 osdx cfgd[1466]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
May 13 15:11:23.580856 osdx INFO[182615]: FRR daemons did not change
May 13 15:11:23.581259 osdx cfgd[1466]: Execute action [end] for node [system advisor ADVISOR1]
May 13 15:11:23.589354 osdx cfgd[1466]: [182032]Completed change to active configuration
May 13 15:11:23.591586 osdx OSDxCLI[182032]: pam_unix(cli:session): session closed for user admin
May 13 15:11:23.591833 osdx OSDxCLI[182032]: User 'admin' committed the configuration.
May 13 15:11:23.594016 osdx INFO[182624]: SCRIPT SCRIPT_1 operations:
May 13 15:11:23.599247 osdx OSDxCLI[182631]: Tecla::GetLine tcgetattr error
May 13 15:11:23.599252 osdx OSDxCLI[182631]: User 'admin' has logged in.
May 13 15:11:23.609121 osdx OSDxCLI[182631]: User 'admin' executed a new command: 'show version'.
May 13 15:11:23.610344 osdx OSDxCLI[182631]: User 'admin' has logged out.
May 13 15:11:23.610350 osdx OSDxCLI[182631]: Tecla::GetLine tcgetattr error
May 13 15:11:23.611083 osdx INFO[182624]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.5.0
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Mon May 12 11:45:19 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:             94338cf1-2e79-52d8-afb2-8c812dcbea77
                                            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 13 May 2025 15:11:23 +00:00
                                            Uptime:                    1:29:40
                                            CPU load (1m, 5m, 15m):    0.37 0.24 0.19
                                            CPU usage % (1m):          4.69
                                            Storage usage (kB):        372968/8144384
                                            Memory usage (kB):         383996/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
May 13 15:11:23.615326 osdx OSDxCLI[182638]: Tecla::GetLine tcgetattr error
May 13 15:11:23.615505 osdx OSDxCLI[182638]: User 'admin' has logged in.
May 13 15:11:23.617467 osdx OSDxCLI[182638]: Tecla::GetLine tcgetattr error
May 13 15:11:23.620588 osdx OSDxCLI[182638]: Tecla::GetLine tcgetattr error
May 13 15:11:23.620799 osdx OSDxCLI[182638]: User 'admin' executed a new command: 'license show'.
May 13 15:11:23.621807 osdx OSDxCLI[182638]: User 'admin' has logged out.
May 13 15:11:23.621860 osdx OSDxCLI[182638]: Tecla::GetLine tcgetattr error
May 13 15:11:23.623182 osdx INFO[182624]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
May 13 15:11:23.671844 osdx OSDxCLI[182032]: User 'admin' left the configuration menu.
May 13 15:11:23.816900 osdx OSDxCLI[182032]: 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::188d:a5ff:feb4:66c4/64  up     up
dum1  fe80::ac71:f1ff:fe93:2694/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.0
# Tue 13 May 2025 15:11:38 +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.0
# Tue 13 May 2025 15:11:39 +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.0
# Tue 13 May 2025 15:11:40 +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