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.6
# Mon 28 Jul 2025 11:32: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.6
Show output
Jul 28 11:32:23.000296 osdx systemd-timedated[420382]: Changed local time to Mon 2025-07-28 11:32:23 UTC
Jul 28 11:32:23.003425 osdx systemd-journald[340421]: Time jumped backwards, rotating.
Jul 28 11:32:23.006121 osdx OSDxCLI[417935]: User 'admin' executed a new command: 'set date 2025-07-28 11:32:23'.
Jul 28 11:32:23.562488 osdx sudo[420598]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Jul 28 11:32:23.568954 osdx systemd-journald[340421]: Runtime Journal (/run/log/journal/a46937b51a3a4c469575696f63c9d620) is 2.0M, max 15.3M, 13.2M free.
Jul 28 11:32:23.571266 osdx systemd-journald[340421]: Received client request to rotate journal, rotating.
Jul 28 11:32:23.571392 osdx systemd-journald[340421]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a46937b51a3a4c469575696f63c9d620.
Jul 28 11:32:23.576241 osdx sudo[420597]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Jul 28 11:32:23.586167 osdx OSDxCLI[417935]: User 'admin' executed a new command: 'system journal clear'.
Jul 28 11:32:24.113182 osdx OSDxCLI[417935]: User 'admin' executed a new command: 'system coredump delete all'.
Jul 28 11:32:24.701359 osdx OSDxCLI[417935]: User 'admin' entered the configuration menu.
Jul 28 11:32:24.841674 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jul 28 11:32:24.956963 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Jul 28 11:32:25.112917 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Jul 28 11:32:25.264206 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jul 28 11:32:25.422816 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Jul 28 11:32:25.566444 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Jul 28 11:32:25.711219 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Jul 28 11:32:25.844144 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'show working'.
Jul 28 11:32:25.955975 osdx ubnt-cfgd[420631]: inactive
Jul 28 11:32:26.000650 osdx INFO[420641]: FRR daemons did not change
Jul 28 11:32:26.002448 osdx modulelauncher[1296]: + Received data: ['417935', 'osdx.utils.xos', 'set_console_log_level', 'info']
Jul 28 11:32:26.041071 osdx OSDxCLI[417935]: Signal 10 received
Jul 28 11:32:26.127188 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 28 11:32:26.217666 osdx cfgd[1473]: [417935]Completed change to active configuration
Jul 28 11:32:26.237122 osdx OSDxCLI[417935]: User 'admin' committed the configuration.
Jul 28 11:32:26.286294 osdx OSDxCLI[417935]: User 'admin' left the configuration menu.
Jul 28 11:32:26.577656 osdx OSDxCLI[417935]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jul 28 11:32:26.578784 osdx OSDxCLI[417935]: pam_unix(cli:session): session closed for user admin
Jul 28 11:32:26.579494 osdx OSDxCLI[417935]: User 'admin' entered the configuration menu.
Jul 28 11:32:26.696947 osdx OSDxCLI[417935]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jul 28 11:32:26.697386 osdx cfgd[1473]: Execute action [syntax] for node [system advisor ADVISOR1]
Jul 28 11:32:26.697942 osdx OSDxCLI[417935]: pam_unix(cli:session): session closed for user admin
Jul 28 11:32:26.698374 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Jul 28 11:32:26.801931 osdx OSDxCLI[417935]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jul 28 11:32:26.816178 osdx OSDxCLI[417935]: pam_unix(cli:session): session closed for user admin
Jul 28 11:32:26.816629 osdx OSDxCLI[417935]: User 'admin' added a new cfg line: 'show changes'.
Jul 28 11:32:26.931651 osdx OSDxCLI[417935]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jul 28 11:32:26.953869 osdx ubnt-cfgd[420776]: inactive
Jul 28 11:32:27.005523 osdx cfgd[1473]: [417935]must validation for [system login user admin role] was skipped
Jul 28 11:32:27.005623 osdx cfgd[1473]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Jul 28 11:32:27.021475 osdx INFO[420784]: FRR daemons did not change
Jul 28 11:32:27.022194 osdx cfgd[1473]: Execute action [end] for node [system advisor ADVISOR1]
Jul 28 11:32:27.035480 osdx cfgd[1473]: [417935]Completed change to active configuration
Jul 28 11:32:27.040431 osdx OSDxCLI[417935]: pam_unix(cli:session): session closed for user admin
Jul 28 11:32:27.040931 osdx OSDxCLI[417935]: User 'admin' committed the configuration.
Jul 28 11:32:27.054997 osdx INFO[420793]: SCRIPT SCRIPT_1 operations:
Jul 28 11:32:27.063125 osdx OSDxCLI[420801]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.063580 osdx OSDxCLI[420801]: User 'admin' has logged in.
Jul 28 11:32:27.081611 osdx OSDxCLI[417935]: User 'admin' left the configuration menu.
Jul 28 11:32:27.083366 osdx OSDxCLI[420801]: User 'admin' executed a new command: 'show version'.
Jul 28 11:32:27.085470 osdx OSDxCLI[420801]: User 'admin' has logged out.
Jul 28 11:32:27.085482 osdx OSDxCLI[420801]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.086572 osdx INFO[420793]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.4.6
                                            OS Linux kernel:           6.1.128
                                            OS built by:               jenkins@daphne
                                            OS build date:             Wed Jul 23 15:28:43 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:             5cfa0afb-bf3a-5cd2-9123-058c9f4cc81e
                                            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:                      Mon 28 Jul 2025 11:32:26 +00:00
                                            Uptime:                    4:14:28
                                            CPU load (1m, 5m, 15m):    0.56 0.34 0.27
                                            CPU usage % (1m):          12.95
                                            Storage usage (kB):        377608/8144384
                                            Memory usage (kB):         439244/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Jul 28 11:32:27.096096 osdx OSDxCLI[420807]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.096432 osdx OSDxCLI[420807]: User 'admin' has logged in.
Jul 28 11:32:27.101658 osdx OSDxCLI[420807]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.106447 osdx OSDxCLI[420807]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.106959 osdx OSDxCLI[420807]: User 'admin' executed a new command: 'license show'.
Jul 28 11:32:27.109162 osdx OSDxCLI[420807]: User 'admin' has logged out.
Jul 28 11:32:27.109294 osdx OSDxCLI[420807]: Tecla::GetLine tcgetattr error
Jul 28 11:32:27.110371 osdx INFO[420793]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Jul 28 11:32:27.264974 osdx OSDxCLI[417935]: 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::306c:cdff:fe5b:e424/64  up     up
dum1  fe80::c841:92ff:fee8:29b2/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.6
# Mon 28 Jul 2025 11:32:52 +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.6
# Mon 28 Jul 2025 11:32:54 +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.6
# Mon 28 Jul 2025 11:32:56 +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