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.3
# Wed 14 May 2025 08:48:51 +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.3
Show output
May 14 08:49:01.312648 osdx systemd-journald[1882]: Runtime Journal (/run/log/journal/d54fa6ddd60f4e688f2f72800dcfecac) is 2.0M, max 15.3M, 13.2M free.
May 14 08:49:01.314924 osdx systemd-journald[1882]: Received client request to rotate journal, rotating.
May 14 08:49:01.314974 osdx systemd-journald[1882]: Vacuuming done, freed 0B of archived journals from /run/log/journal/d54fa6ddd60f4e688f2f72800dcfecac.
May 14 08:49:01.322893 osdx OSDxCLI[13216]: User 'admin' executed a new command: 'system journal clear'.
May 14 08:49:01.668177 osdx osdx-coredump[35755]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
May 14 08:49:01.678557 osdx OSDxCLI[13216]: User 'admin' executed a new command: 'system coredump delete all'.
May 14 08:49:02.234310 osdx OSDxCLI[13216]: User 'admin' entered the configuration menu.
May 14 08:49:02.348825 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 14 08:49:02.405745 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
May 14 08:49:02.508994 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
May 14 08:49:02.594116 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
May 14 08:49:02.712653 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
May 14 08:49:02.784988 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
May 14 08:49:02.887440 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
May 14 08:49:02.955609 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'show working'.
May 14 08:49:03.053283 osdx ubnt-cfgd[35785]: inactive
May 14 08:49:03.077403 osdx INFO[35795]: FRR daemons did not change
May 14 08:49:03.078557 osdx modulelauncher[1487]: + Received data: ['13216', 'osdx.utils.xos', 'set_console_log_level', 'info']
May 14 08:49:03.097252 osdx OSDxCLI[13216]: Signal 10 received
May 14 08:49:03.142935 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0
May 14 08:49:03.194088 osdx cfgd[1680]: [13216]Completed change to active configuration
May 14 08:49:03.206008 osdx OSDxCLI[13216]: User 'admin' committed the configuration.
May 14 08:49:03.248760 osdx OSDxCLI[13216]: User 'admin' left the configuration menu.
May 14 08:49:03.441450 osdx OSDxCLI[13216]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 14 08:49:03.442012 osdx OSDxCLI[13216]: pam_unix(cli:session): session closed for user admin
May 14 08:49:03.442217 osdx OSDxCLI[13216]: User 'admin' entered the configuration menu.
May 14 08:49:03.539215 osdx OSDxCLI[13216]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 14 08:49:03.539751 osdx cfgd[1680]: Execute action [syntax] for node [system advisor ADVISOR1]
May 14 08:49:03.540235 osdx OSDxCLI[13216]: pam_unix(cli:session): session closed for user admin
May 14 08:49:03.540604 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
May 14 08:49:03.620867 osdx OSDxCLI[13216]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 14 08:49:03.632422 osdx OSDxCLI[13216]: pam_unix(cli:session): session closed for user admin
May 14 08:49:03.632849 osdx OSDxCLI[13216]: User 'admin' added a new cfg line: 'show changes'.
May 14 08:49:03.725118 osdx OSDxCLI[13216]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
May 14 08:49:03.741977 osdx ubnt-cfgd[35930]: inactive
May 14 08:49:03.759006 osdx cfgd[1680]: [13216]must validation for [system login user admin role] was skipped
May 14 08:49:03.759020 osdx cfgd[1680]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
May 14 08:49:03.768557 osdx INFO[35938]: FRR daemons did not change
May 14 08:49:03.769166 osdx cfgd[1680]: Execute action [end] for node [system advisor ADVISOR1]
May 14 08:49:03.778640 osdx cfgd[1680]: [13216]Completed change to active configuration
May 14 08:49:03.781344 osdx OSDxCLI[13216]: pam_unix(cli:session): session closed for user admin
May 14 08:49:03.781661 osdx OSDxCLI[13216]: User 'admin' committed the configuration.
May 14 08:49:03.785288 osdx INFO[35947]: SCRIPT SCRIPT_1 operations:
May 14 08:49:03.792699 osdx OSDxCLI[35955]: Tecla::GetLine tcgetattr error
May 14 08:49:03.792919 osdx OSDxCLI[35955]: User 'admin' has logged in.
May 14 08:49:03.804663 osdx OSDxCLI[35955]: User 'admin' executed a new command: 'show version'.
May 14 08:49:03.806169 osdx OSDxCLI[35955]: User 'admin' has logged out.
May 14 08:49:03.806236 osdx OSDxCLI[35955]: Tecla::GetLine tcgetattr error
May 14 08:49:03.807086 osdx INFO[35947]: Operation 1 'show version
                                         ':

                                           OS vendor:                 Teldat
                                           OS name:                   OSDx
                                           OS version:                v4.2.4.3
                                           OS Linux kernel:           6.1.128
                                           OS built by:               jenkins@daphne
                                           OS build date:             Tue May 13 13:24:24 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:             5d7ffe89-7aeb-5bbe-9c78-c3b515e7b2c9
                                           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 14 May 2025 08:49:03 +00:00
                                           Uptime:                    0:20:14
                                           CPU load (1m, 5m, 15m):    0.27 0.23 0.13
                                           CPU usage % (1m):          2.13
                                           Storage usage (kB):        365928/8144384
                                           Memory usage (kB):         359360/1570512
                                           Users logged in:           1
                                           Mode (current/next boot):  user/user

                                           Hostname:                  osdx
May 14 08:49:03.813223 osdx OSDxCLI[35961]: Tecla::GetLine tcgetattr error
May 14 08:49:03.813509 osdx OSDxCLI[35961]: User 'admin' has logged in.
May 14 08:49:03.815890 osdx OSDxCLI[13216]: User 'admin' left the configuration menu.
May 14 08:49:03.817944 osdx OSDxCLI[35961]: Tecla::GetLine tcgetattr error
May 14 08:49:03.820444 osdx OSDxCLI[35961]: Tecla::GetLine tcgetattr error
May 14 08:49:03.820727 osdx OSDxCLI[35961]: User 'admin' executed a new command: 'license show'.
May 14 08:49:03.822315 osdx OSDxCLI[35961]: User 'admin' has logged out.
May 14 08:49:03.822405 osdx OSDxCLI[35961]: Tecla::GetLine tcgetattr error
May 14 08:49:03.823281 osdx INFO[35947]: 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 14 08:49:03.958288 osdx OSDxCLI[13216]: 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::9857:45ff:feec:8955/64  up     up
dum1  fe80::2cce:8cff:fe3e:210c/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.3
# Wed 14 May 2025 08:49:21 +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.3
# Wed 14 May 2025 08:49:22 +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.3
# Wed 14 May 2025 08:49:23 +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