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.3
# Mon 19 May 2025 18:06:32 +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.3
Show output
May 19 18:06:37.316015 osdx systemd-journald[1859]: Runtime Journal (/run/log/journal/dd53a6d251524eaf96fe5f49da605cd5) is 2.4M, max 15.3M, 12.8M free.
May 19 18:06:37.318719 osdx systemd-journald[1859]: Received client request to rotate journal, rotating.
May 19 18:06:37.318778 osdx systemd-journald[1859]: Vacuuming done, freed 0B of archived journals from /run/log/journal/dd53a6d251524eaf96fe5f49da605cd5.
May 19 18:06:37.326491 osdx OSDxCLI[334642]: User 'admin' executed a new command: 'system journal clear'.
May 19 18:06:37.660501 osdx osdx-coredump[429238]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
May 19 18:06:37.669894 osdx OSDxCLI[334642]: User 'admin' executed a new command: 'system coredump delete all'.
May 19 18:06:38.218143 osdx OSDxCLI[334642]: User 'admin' entered the configuration menu.
May 19 18:06:38.327086 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 19 18:06:38.404161 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
May 19 18:06:38.509131 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
May 19 18:06:38.580715 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 19 18:06:38.690429 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
May 19 18:06:38.769515 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
May 19 18:06:38.890277 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
May 19 18:06:38.960497 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'show working'.
May 19 18:06:39.066245 osdx INFO[429269]: FRR daemons did not change
May 19 18:06:39.067053 osdx modulelauncher[1483]: + Received data: ['334642', 'osdx.utils.xos', 'set_console_log_level', 'info']
May 19 18:06:39.088547 osdx OSDxCLI[334642]: Signal 10 received
May 19 18:06:39.138698 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
May 19 18:06:39.209488 osdx cfgd[1649]: [334642]Completed change to active configuration
May 19 18:06:39.236436 osdx OSDxCLI[334642]: User 'admin' committed the configuration.
May 19 18:06:39.258352 osdx OSDxCLI[334642]: User 'admin' left the configuration menu.
May 19 18:06:39.426429 osdx OSDxCLI[334642]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 19 18:06:39.427044 osdx OSDxCLI[334642]: pam_unix(cli:session): session closed for user admin
May 19 18:06:39.427298 osdx OSDxCLI[334642]: User 'admin' entered the configuration menu.
May 19 18:06:39.494034 osdx OSDxCLI[334642]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 19 18:06:39.494354 osdx cfgd[1649]: Execute action [syntax] for node [system advisor ADVISOR1]
May 19 18:06:39.494672 osdx OSDxCLI[334642]: pam_unix(cli:session): session closed for user admin
May 19 18:06:39.494927 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
May 19 18:06:39.597485 osdx OSDxCLI[334642]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 19 18:06:39.609662 osdx OSDxCLI[334642]: pam_unix(cli:session): session closed for user admin
May 19 18:06:39.609956 osdx OSDxCLI[334642]: User 'admin' added a new cfg line: 'show changes'.
May 19 18:06:39.662583 osdx OSDxCLI[334642]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 19 18:06:39.674465 osdx cfgd[1649]: [334642]must validation for [system login user admin role] was skipped
May 19 18:06:39.674481 osdx cfgd[1649]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
May 19 18:06:39.682567 osdx INFO[429385]: FRR daemons did not change
May 19 18:06:39.682766 osdx cfgd[1649]: Execute action [end] for node [system advisor ADVISOR1]
May 19 18:06:39.689363 osdx cfgd[1649]: [334642]Completed change to active configuration
May 19 18:06:39.690982 osdx OSDxCLI[334642]: pam_unix(cli:session): session closed for user admin
May 19 18:06:39.691225 osdx OSDxCLI[334642]: User 'admin' committed the configuration.
May 19 18:06:39.693680 osdx INFO[429394]: SCRIPT SCRIPT_1 operations:
May 19 18:06:39.700838 osdx OSDxCLI[429402]: Tecla::GetLine tcgetattr error
May 19 18:06:39.701100 osdx OSDxCLI[429402]: User 'admin' has logged in.
May 19 18:06:39.712372 osdx OSDxCLI[429402]: User 'admin' executed a new command: 'show version'.
May 19 18:06:39.713436 osdx OSDxCLI[429402]: User 'admin' has logged out.
May 19 18:06:39.713440 osdx OSDxCLI[429402]: Tecla::GetLine tcgetattr error
May 19 18:06:39.714035 osdx INFO[429394]: Operation 1 'show version
                                          ':

                                            OS vendor:                 Teldat
                                            OS name:                   OSDx
                                            OS version:                v4.2.3.3
                                            OS Linux kernel:           6.1.119
                                            OS built by:               jenkins@daphne
                                            OS build date:             Mon May 19 13:39:44 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:             ccdb694b-3755-5817-978e-4501d701fcfa
                                            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:                      Mon 19 May 2025 18:06:38 +00:00
                                            Uptime:                    3:50:20
                                            CPU load (1m, 5m, 15m):    0.31 0.16 0.11
                                            CPU usage % (1m):          4.93
                                            Storage usage (kB):        368340/8144384
                                            Memory usage (kB):         427608/1570512
                                            Users logged in:           1
                                            Mode (current/next boot):  user/user

                                            Hostname:                  osdx
May 19 18:06:39.718524 osdx OSDxCLI[429408]: Tecla::GetLine tcgetattr error
May 19 18:06:39.718710 osdx OSDxCLI[429408]: User 'admin' has logged in.
May 19 18:06:39.720832 osdx OSDxCLI[429408]: Tecla::GetLine tcgetattr error
May 19 18:06:39.723238 osdx OSDxCLI[429408]: Tecla::GetLine tcgetattr error
May 19 18:06:39.723429 osdx OSDxCLI[429408]: User 'admin' executed a new command: 'license show'.
May 19 18:06:39.724360 osdx OSDxCLI[429408]: User 'admin' has logged out.
May 19 18:06:39.724425 osdx OSDxCLI[429408]: Tecla::GetLine tcgetattr error
May 19 18:06:39.724939 osdx INFO[429394]: 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 19 18:06:39.736504 osdx OSDxCLI[334642]: User 'admin' left the configuration menu.
May 19 18:06:39.865351 osdx OSDxCLI[334642]: 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::74db:6eff:fe41:6c55/64  up     up
dum1  fe80::c855:70ff:fed6:efb7/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.3
# Mon 19 May 2025 18:06:53 +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.3
# Mon 19 May 2025 18:06: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.3.3
# Mon 19 May 2025 18:06:55 +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