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.2.6
# Mon 23 Jun 2025 10:40:31 +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.2.6
Show output
Jun 23 10:40:36.322833 osdx systemd-journald[391062]: Runtime Journal (/run/log/journal/76ff399027db4a3db160ed8651bac52f) is 2.1M, max 15.3M, 13.2M free.
Jun 23 10:40:36.325764 osdx systemd-journald[391062]: Received client request to rotate journal, rotating.
Jun 23 10:40:36.325817 osdx systemd-journald[391062]: Vacuuming done, freed 0B of archived journals from /run/log/journal/76ff399027db4a3db160ed8651bac52f.
Jun 23 10:40:36.333793 osdx OSDxCLI[421688]: User 'admin' executed a new command: 'system journal clear'.
Jun 23 10:40:36.548731 osdx OSDxCLI[421688]: User 'admin' executed a new command: 'system coredump delete all'.
Jun 23 10:40:36.772597 osdx OSDxCLI[421688]: User 'admin' entered the configuration menu.
Jun 23 10:40:36.831450 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 23 10:40:36.930132 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Jun 23 10:40:36.995166 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Jun 23 10:40:37.109316 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Jun 23 10:40:37.182463 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Jun 23 10:40:37.282333 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Jun 23 10:40:37.339872 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Jun 23 10:40:37.446302 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'show working'.
Jun 23 10:40:37.518937 osdx INFO[423843]: FRR daemons did not change
Jun 23 10:40:37.519877 osdx modulelauncher[1302]: + Received data: ['421688', 'osdx.utils.xos', 'set_console_log_level', 'info']
Jun 23 10:40:37.537598 osdx OSDxCLI[421688]: Signal 10 received
Jun 23 10:40:37.585761 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jun 23 10:40:37.664012 osdx cfgd[1453]: [421688]Completed change to active configuration
Jun 23 10:40:37.689895 osdx OSDxCLI[421688]: User 'admin' committed the configuration.
Jun 23 10:40:37.707545 osdx OSDxCLI[421688]: User 'admin' left the configuration menu.
Jun 23 10:40:37.915006 osdx OSDxCLI[421688]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 23 10:40:37.915568 osdx OSDxCLI[421688]: pam_unix(cli:session): session closed for user admin
Jun 23 10:40:37.915771 osdx OSDxCLI[421688]: User 'admin' entered the configuration menu.
Jun 23 10:40:38.013864 osdx OSDxCLI[421688]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 23 10:40:38.014338 osdx cfgd[1453]: Execute action [syntax] for node [system advisor ADVISOR1]
Jun 23 10:40:38.014687 osdx OSDxCLI[421688]: pam_unix(cli:session): session closed for user admin
Jun 23 10:40:38.014911 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Jun 23 10:40:38.123314 osdx OSDxCLI[421688]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 23 10:40:38.132096 osdx OSDxCLI[421688]: pam_unix(cli:session): session closed for user admin
Jun 23 10:40:38.132393 osdx OSDxCLI[421688]: User 'admin' added a new cfg line: 'show changes'.
Jun 23 10:40:38.181284 osdx OSDxCLI[421688]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Jun 23 10:40:38.189228 osdx cfgd[1453]: [421688]must validation for [system login user admin role] was skipped
Jun 23 10:40:38.189331 osdx cfgd[1453]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Jun 23 10:40:38.197522 osdx INFO[423958]: FRR daemons did not change
Jun 23 10:40:38.197817 osdx cfgd[1453]: Execute action [end] for node [system advisor ADVISOR1]
Jun 23 10:40:38.205628 osdx cfgd[1453]: [421688]Completed change to active configuration
Jun 23 10:40:38.208138 osdx OSDxCLI[421688]: pam_unix(cli:session): session closed for user admin
Jun 23 10:40:38.208464 osdx OSDxCLI[421688]: User 'admin' committed the configuration.
Jun 23 10:40:38.214227 osdx INFO[423968]: SCRIPT SCRIPT_1 operations:
Jun 23 10:40:38.219879 osdx OSDxCLI[423975]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.220097 osdx OSDxCLI[423975]: User 'admin' has logged in.
Jun 23 10:40:38.229152 osdx OSDxCLI[423975]: User 'admin' executed a new command: 'show version'.
Jun 23 10:40:38.230175 osdx OSDxCLI[423975]: User 'admin' has logged out.
Jun 23 10:40:38.230180 osdx OSDxCLI[423975]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.230756 osdx INFO[423968]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.2.6
                                            OS Linux kernel:           6.1.119
                                            OS built by:               jenkins@daphne
                                            OS build date:             Fri Jun 20 11:08:54 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:             b63abdad-07ee-505f-9bbe-98e2688f1d6a
                                            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 23 Jun 2025 10:40:37 +00:00
                                            Uptime:                    3:30:44
                                            CPU load (1m, 5m, 15m):    0.18 0.17 0.17
                                            CPU usage % (1m):          5.50
                                            Storage usage (kB):        368484/8144384
                                            Memory usage (kB):         419700/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Jun 23 10:40:38.235421 osdx OSDxCLI[423981]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.235426 osdx OSDxCLI[423981]: User 'admin' has logged in.
Jun 23 10:40:38.237417 osdx OSDxCLI[423981]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.239292 osdx OSDxCLI[423981]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.239474 osdx OSDxCLI[423981]: User 'admin' executed a new command: 'license show'.
Jun 23 10:40:38.240427 osdx OSDxCLI[423981]: User 'admin' has logged out.
Jun 23 10:40:38.240431 osdx OSDxCLI[423981]: Tecla::GetLine tcgetattr error
Jun 23 10:40:38.240964 osdx INFO[423968]: 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 23 10:40:38.260163 osdx OSDxCLI[421688]: User 'admin' left the configuration menu.
Jun 23 10:40:38.350324 osdx OSDxCLI[421688]: 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::1c39:2aff:fedf:22c3/64  up     up
dum1  fe80::1801:14ff:fe92:3917/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.2.6
# Mon 23 Jun 2025 10:40:50 +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.2.6
# Mon 23 Jun 2025 10:40:51 +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.2.6
# Mon 23 Jun 2025 10:40:52 +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