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.5
# Wed 25 Jun 2025 12:24:52 +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.5
Show output
Jun 25 12:24:56.292064 osdx systemd-journald[56122]: Runtime Journal (/run/log/journal/af01d4ed6eb1488ea817da6aeebe5df1) is 2.1M, max 15.3M, 13.2M free.
Jun 25 12:24:56.295996 osdx systemd-journald[56122]: Received client request to rotate journal, rotating.
Jun 25 12:24:56.296043 osdx systemd-journald[56122]: Vacuuming done, freed 0B of archived journals from /run/log/journal/af01d4ed6eb1488ea817da6aeebe5df1.
Jun 25 12:24:56.296124 osdx sudo[71439]: pam_limits(sudo:session): invalid line '@200:215        hard        maxlogins        ' - skipped
Jun 25 12:24:56.302429 osdx OSDxCLI[59138]: User 'admin' executed a new command: 'system journal clear'.
Jun 25 12:24:56.517267 osdx OSDxCLI[59138]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 25 12:24:56.748838 osdx OSDxCLI[59138]: User 'admin' entered the configuration menu.
Jun 25 12:24:56.806959 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 25 12:24:56.902306 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Jun 25 12:24:56.960751 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Jun 25 12:24:57.059292 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 25 12:24:57.131169 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Jun 25 12:24:57.218361 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Jun 25 12:24:57.278354 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Jun 25 12:24:57.384933 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'show working'.
Jun 25 12:24:57.446012 osdx ubnt-cfgd[71473]: inactive
Jun 25 12:24:57.467665 osdx INFO[71483]: FRR daemons did not change
Jun 25 12:24:57.468710 osdx modulelauncher[1287]: + Received data: ['59138', 'osdx.utils.xos', 'set_console_log_level', 'info']
Jun 25 12:24:57.486348 osdx OSDxCLI[59138]: Signal 10 received
Jun 25 12:24:57.532009 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 25 12:24:57.581548 osdx cfgd[1464]: [59138]Completed change to active configuration
Jun 25 12:24:57.592094 osdx OSDxCLI[59138]: User 'admin' committed the configuration.
Jun 25 12:24:57.611254 osdx OSDxCLI[59138]: User 'admin' left the configuration menu.
Jun 25 12:24:57.782048 osdx OSDxCLI[59138]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 25 12:24:57.782492 osdx OSDxCLI[59138]: pam_unix(cli:session): session closed for user admin
Jun 25 12:24:57.782679 osdx OSDxCLI[59138]: User 'admin' entered the configuration menu.
Jun 25 12:24:57.843210 osdx OSDxCLI[59138]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 25 12:24:57.843532 osdx cfgd[1464]: Execute action [syntax] for node [system advisor ADVISOR1]
Jun 25 12:24:57.843895 osdx OSDxCLI[59138]: pam_unix(cli:session): session closed for user admin
Jun 25 12:24:57.844114 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Jun 25 12:24:57.942684 osdx OSDxCLI[59138]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 25 12:24:57.956376 osdx OSDxCLI[59138]: pam_unix(cli:session): session closed for user admin
Jun 25 12:24:57.956688 osdx OSDxCLI[59138]: User 'admin' added a new cfg line: 'show changes'.
Jun 25 12:24:58.006738 osdx OSDxCLI[59138]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 25 12:24:58.018589 osdx ubnt-cfgd[71618]: inactive
Jun 25 12:24:58.071167 osdx cfgd[1464]: [59138]must validation for [system login user admin role] was skipped
Jun 25 12:24:58.071179 osdx cfgd[1464]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Jun 25 12:24:58.078179 osdx INFO[71626]: FRR daemons did not change
Jun 25 12:24:58.078584 osdx cfgd[1464]: Execute action [end] for node [system advisor ADVISOR1]
Jun 25 12:24:58.085025 osdx cfgd[1464]: [59138]Completed change to active configuration
Jun 25 12:24:58.086744 osdx OSDxCLI[59138]: pam_unix(cli:session): session closed for user admin
Jun 25 12:24:58.086968 osdx OSDxCLI[59138]: User 'admin' committed the configuration.
Jun 25 12:24:58.089272 osdx INFO[71635]: SCRIPT SCRIPT_1 operations:
Jun 25 12:24:58.094468 osdx OSDxCLI[71643]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.094651 osdx OSDxCLI[71643]: User 'admin' has logged in.
Jun 25 12:24:58.103014 osdx OSDxCLI[59138]: User 'admin' left the configuration menu.
Jun 25 12:24:58.103731 osdx OSDxCLI[71643]: User 'admin' executed a new command: 'show version'.
Jun 25 12:24:58.104949 osdx OSDxCLI[71643]: User 'admin' has logged out.
Jun 25 12:24:58.105035 osdx OSDxCLI[71643]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.105765 osdx INFO[71635]: Operation 1 'show version
                                         ':

                                           OS vendor:                 Teldat
                                           OS name:                   OSDx
                                           OS version:                v4.2.4.5
                                           OS Linux kernel:           6.1.128
                                           OS built by:               jenkins@daphne
                                           OS build date:             Tue Jun 24 11:22:06 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:             d313abde-3f9a-52f7-a0c4-4740d23b1f95
                                           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 25 Jun 2025 12:24:58 +00:00
                                           Uptime:                    0:32:12
                                           CPU load (1m, 5m, 15m):    0.22 0.22 0.16
                                           CPU usage % (1m):          2.15
                                           Storage usage (kB):        353156/8144384
                                           Memory usage (kB):         392880/1574492
                                           Users logged in:           1
                                           Mode (current/next boot):  user/user

                                           Hostname:                  osdx
Jun 25 12:24:58.110486 osdx OSDxCLI[71649]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.110663 osdx OSDxCLI[71649]: User 'admin' has logged in.
Jun 25 12:24:58.112827 osdx OSDxCLI[71649]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.114789 osdx OSDxCLI[71649]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.114961 osdx OSDxCLI[71649]: User 'admin' executed a new command: 'license show'.
Jun 25 12:24:58.115833 osdx OSDxCLI[71649]: User 'admin' has logged out.
Jun 25 12:24:58.115876 osdx OSDxCLI[71649]: Tecla::GetLine tcgetattr error
Jun 25 12:24:58.116370 osdx INFO[71635]: 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 25 12:24:58.230054 osdx OSDxCLI[59138]: 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::9064:4bff:fe06:bc9/64   up     up
dum1  fe80::589c:bfff:feed:c60d/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.5
# Wed 25 Jun 2025 12:25:10 +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.5
# Wed 25 Jun 2025 12:25:11 +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.5
# Wed 25 Jun 2025 12:25:12 +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