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.3.1
# Wed 19 Feb 2025 20:44:34 +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.3.1
Show output
Feb 19 20:44:42.651400 osdx systemd-journald[466950]: Runtime Journal (/run/log/journal/88d6d46990514354af95198d86011406) is 3.9M, max 15.3M, 11.4M free.
Feb 19 20:44:42.652654 osdx systemd-journald[466950]: Received client request to rotate journal, rotating.
Feb 19 20:44:42.652727 osdx systemd-journald[466950]: Vacuuming done, freed 0B of archived journals from /run/log/journal/88d6d46990514354af95198d86011406.
Feb 19 20:44:42.710987 osdx OSDxCLI[484200]: User 'admin' executed a new command: 'system journal clear'.
Feb 19 20:44:43.512889 osdx osdx-coredump[488284]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Feb 19 20:44:43.530000 osdx OSDxCLI[484200]: User 'admin' executed a new command: 'system coredump delete all'.
Feb 19 20:44:44.396749 osdx OSDxCLI[484200]: User 'admin' entered the configuration menu.
Feb 19 20:44:44.554145 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Feb 19 20:44:44.674842 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Feb 19 20:44:44.793598 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Feb 19 20:44:44.927805 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Feb 19 20:44:45.068476 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Feb 19 20:44:45.178198 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Feb 19 20:44:45.277726 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Feb 19 20:44:45.442216 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'show working'.
Feb 19 20:44:45.594806 osdx INFO[488319]: FRR daemons did not change
Feb 19 20:44:45.596932 osdx modulelauncher[1289]: + Received data: ['484200', 'osdx.utils.xos', 'set_console_log_level', 'info']
Feb 19 20:44:45.640758 osdx OSDxCLI[484200]: Signal 10 received
Feb 19 20:44:45.757111 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Feb 19 20:44:45.912737 osdx cfgd[1448]: [484200]Completed change to active configuration
Feb 19 20:44:46.002805 osdx OSDxCLI[484200]: User 'admin' committed the configuration.
Feb 19 20:44:46.057976 osdx OSDxCLI[484200]: User 'admin' left the configuration menu.
Feb 19 20:44:46.312422 osdx OSDxCLI[484200]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Feb 19 20:44:46.313339 osdx OSDxCLI[484200]: pam_unix(cli:session): session closed for user admin
Feb 19 20:44:46.313938 osdx OSDxCLI[484200]: User 'admin' entered the configuration menu.
Feb 19 20:44:46.454863 osdx OSDxCLI[484200]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Feb 19 20:44:46.455294 osdx cfgd[1448]: Execute action [syntax] for node [system advisor ADVISOR1]
Feb 19 20:44:46.455888 osdx OSDxCLI[484200]: pam_unix(cli:session): session closed for user admin
Feb 19 20:44:46.456257 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Feb 19 20:44:46.607165 osdx OSDxCLI[484200]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Feb 19 20:44:46.626678 osdx OSDxCLI[484200]: pam_unix(cli:session): session closed for user admin
Feb 19 20:44:46.627427 osdx OSDxCLI[484200]: User 'admin' added a new cfg line: 'show changes'.
Feb 19 20:44:46.758377 osdx OSDxCLI[484200]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Feb 19 20:44:46.776377 osdx cfgd[1448]: [484200]must validation for [system login user admin role] was skipped
Feb 19 20:44:46.776403 osdx cfgd[1448]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Feb 19 20:44:46.794592 osdx INFO[488434]: FRR daemons did not change
Feb 19 20:44:46.795475 osdx cfgd[1448]: Execute action [end] for node [system advisor ADVISOR1]
Feb 19 20:44:46.808228 osdx cfgd[1448]: [484200]Completed change to active configuration
Feb 19 20:44:46.811680 osdx OSDxCLI[484200]: pam_unix(cli:session): session closed for user admin
Feb 19 20:44:46.812039 osdx OSDxCLI[484200]: User 'admin' committed the configuration.
Feb 19 20:44:46.817181 osdx INFO[488443]: SCRIPT SCRIPT_1 operations:
Feb 19 20:44:46.826403 osdx OSDxCLI[488451]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.826745 osdx OSDxCLI[488451]: User 'admin' has logged in.
Feb 19 20:44:46.867879 osdx OSDxCLI[488451]: User 'admin' executed a new command: 'show version'.
Feb 19 20:44:46.867899 osdx OSDxCLI[484200]: User 'admin' left the configuration menu.
Feb 19 20:44:46.870945 osdx OSDxCLI[488451]: User 'admin' has logged out.
Feb 19 20:44:46.870954 osdx OSDxCLI[488451]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.875622 osdx INFO[488443]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.3.1
                                            OS Linux kernel:           6.1.119
                                            OS built by:               jenkins@daphne
                                            OS build date:             Wed Feb 19 09:13:25 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:             136f41fb-0c9d-5e82-94bf-46edf187e895
                                            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:                      Wed 19 Feb 2025 20:44:46 +00:00
                                            Uptime:                    5:48:56
                                            CPU load (1m, 5m, 15m):    0.21 0.18 0.18
                                            CPU usage % (1m):          8.37
                                            Storage usage (kB):        368380/8144384
                                            Memory usage (kB):         448588/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
Feb 19 20:44:46.886005 osdx OSDxCLI[488466]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.886395 osdx OSDxCLI[488466]: User 'admin' has logged in.
Feb 19 20:44:46.896337 osdx OSDxCLI[488466]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.904441 osdx OSDxCLI[488466]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.905005 osdx OSDxCLI[488466]: User 'admin' executed a new command: 'license show'.
Feb 19 20:44:46.907172 osdx OSDxCLI[488466]: User 'admin' has logged out.
Feb 19 20:44:46.907281 osdx OSDxCLI[488466]: Tecla::GetLine tcgetattr error
Feb 19 20:44:46.917075 osdx INFO[488443]: Operation 2 'license show
                                          ':
                                          License: VM_BASE Firewall eth-Rate-Permit-Full

                                          +-----------------+---------+----------+
                                          | License Item    | Status  | Validity |
                                          +-----------------+---------+----------+
                                          | Firewall        | Enabled | Forever  |
                                          | eth-Rate-Permit | Full    | Forever  |
                                          +-----------------+---------+----------+
Feb 19 20:44:47.067511 osdx OSDxCLI[484200]: 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::3433:4cff:fed1:1e95/64  up     up
dum1  fe80::d85e:fbff:fe91:7187/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.3.1
# Wed 19 Feb 2025 20:45: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 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.3.1
# Wed 19 Feb 2025 20:45:13 +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.3.1
# Wed 19 Feb 2025 20:45:15 +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