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.3
# Tue 18 Mar 2025 13:56:45 +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.3
Show output
Mar 18 13:56:50.370960 osdx systemd-journald[1661]: Runtime Journal (/run/log/journal/7658cc7836d34fbaba4948b42da24d1a) is 2.1M, max 15.3M, 13.2M free.
Mar 18 13:56:50.372146 osdx systemd-journald[1661]: Received client request to rotate journal, rotating.
Mar 18 13:56:50.372201 osdx systemd-journald[1661]: Vacuuming done, freed 0B of archived journals from /run/log/journal/7658cc7836d34fbaba4948b42da24d1a.
Mar 18 13:56:50.387355 osdx OSDxCLI[22287]: User 'admin' executed a new command: 'system journal clear'.
Mar 18 13:56:50.857091 osdx osdx-coredump[22670]: Deleting all coredumps in /opt/vyatta/etc/config/coredump...
Mar 18 13:56:50.868326 osdx OSDxCLI[22287]: User 'admin' executed a new command: 'system coredump delete all'.
Mar 18 13:56:51.525011 osdx OSDxCLI[22287]: User 'admin' entered the configuration menu.
Mar 18 13:56:51.722678 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 18 13:56:51.822367 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'.
Mar 18 13:56:51.945891 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'.
Mar 18 13:56:52.043952 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'.
Mar 18 13:56:52.160187 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'.
Mar 18 13:56:52.241695 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'.
Mar 18 13:56:52.333580 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'.
Mar 18 13:56:52.443334 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'show working'.
Mar 18 13:56:52.546132 osdx INFO[22705]: FRR daemons did not change
Mar 18 13:56:52.547562 osdx modulelauncher[1295]: + Received data: ['22287', 'osdx.utils.xos', 'set_console_log_level', 'info']
Mar 18 13:56:52.576794 osdx OSDxCLI[22287]: Signal 10 received
Mar 18 13:56:52.746341 osdx cfgd[1459]: [22287]Completed change to active configuration
Mar 18 13:56:52.784513 osdx OSDxCLI[22287]: User 'admin' committed the configuration.
Mar 18 13:56:52.829617 osdx OSDxCLI[22287]: User 'admin' left the configuration menu.
Mar 18 13:56:53.055406 osdx OSDxCLI[22287]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 18 13:56:53.056067 osdx OSDxCLI[22287]: pam_unix(cli:session): session closed for user admin
Mar 18 13:56:53.056554 osdx OSDxCLI[22287]: User 'admin' entered the configuration menu.
Mar 18 13:56:53.156244 osdx OSDxCLI[22287]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 18 13:56:53.156696 osdx cfgd[1459]: Execute action [syntax] for node [system advisor ADVISOR1]
Mar 18 13:56:53.157167 osdx OSDxCLI[22287]: pam_unix(cli:session): session closed for user admin
Mar 18 13:56:53.157591 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'.
Mar 18 13:56:53.249766 osdx OSDxCLI[22287]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 18 13:56:53.263223 osdx OSDxCLI[22287]: pam_unix(cli:session): session closed for user admin
Mar 18 13:56:53.263625 osdx OSDxCLI[22287]: User 'admin' added a new cfg line: 'show changes'.
Mar 18 13:56:53.345242 osdx OSDxCLI[22287]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000)
Mar 18 13:56:53.364819 osdx cfgd[1459]: [22287]must validation for [system login user admin role] was skipped
Mar 18 13:56:53.364838 osdx cfgd[1459]: Execute action [commit-subtree] for node [system advisor ADVISOR1]
Mar 18 13:56:53.377702 osdx INFO[22820]: FRR daemons did not change
Mar 18 13:56:53.378028 osdx cfgd[1459]: Execute action [end] for node [system advisor ADVISOR1]
Mar 18 13:56:53.388336 osdx cfgd[1459]: [22287]Completed change to active configuration
Mar 18 13:56:53.391269 osdx OSDxCLI[22287]: pam_unix(cli:session): session closed for user admin
Mar 18 13:56:53.391591 osdx OSDxCLI[22287]: User 'admin' committed the configuration.
Mar 18 13:56:53.398734 osdx INFO[22829]: SCRIPT SCRIPT_1 operations:
Mar 18 13:56:53.405887 osdx OSDxCLI[22837]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.405908 osdx OSDxCLI[22837]: User 'admin' has logged in.
Mar 18 13:56:53.421890 osdx OSDxCLI[22837]: User 'admin' executed a new command: 'show version'.
Mar 18 13:56:53.422218 osdx OSDxCLI[22287]: User 'admin' left the configuration menu.
Mar 18 13:56:53.423480 osdx OSDxCLI[22837]: User 'admin' has logged out.
Mar 18 13:56:53.423488 osdx OSDxCLI[22837]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.424246 osdx INFO[22829]: Operation 1 'show version
                                         ':

                                           OS vendor:                 Teldat
                                           OS name:                   OSDx
                                           OS version:                v4.2.2.3
                                           OS Linux kernel:           6.1.119
                                           OS built by:               jenkins@daphne
                                           OS build date:             Thu Mar 13 10:57:50 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:             3250dd5d-2e62-5f5c-8f74-9901036be81c
                                           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:                      Tue 18 Mar 2025 13:56:52 +00:00
                                           Uptime:                    0:13:36
                                           CPU load (1m, 5m, 15m):    0.32 0.26 0.16
                                           CPU usage % (1m):          4.95
                                           Storage usage (kB):        368396/8144384
                                           Memory usage (kB):         366016/1570512
                                           Users logged in:           1
                                           Mode (current/next boot):  user/user

                                           Hostname:                  osdx
Mar 18 13:56:53.433110 osdx OSDxCLI[22843]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.433119 osdx OSDxCLI[22843]: User 'admin' has logged in.
Mar 18 13:56:53.437090 osdx OSDxCLI[22843]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.440778 osdx OSDxCLI[22843]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.441092 osdx OSDxCLI[22843]: User 'admin' executed a new command: 'license show'.
Mar 18 13:56:53.442655 osdx OSDxCLI[22843]: User 'admin' has logged out.
Mar 18 13:56:53.442668 osdx OSDxCLI[22843]: Tecla::GetLine tcgetattr error
Mar 18 13:56:53.443443 osdx INFO[22829]: Operation 2 'license show
                                         ':
                                         License: VM_BASE Firewall eth-Rate-Permit-Full

                                         +-----------------+---------+----------+
                                         | License Item    | Status  | Validity |
                                         +-----------------+---------+----------+
                                         | Firewall        | Enabled | Forever  |
                                         | eth-Rate-Permit | Full    | Forever  |
                                         +-----------------+---------+----------+
Mar 18 13:56:53.583022 osdx OSDxCLI[22287]: 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::540b:d6ff:fe66:998f/64  up     up
dum1  fe80::cc54:cbff:fe9f:59fb/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.3
# Tue 18 Mar 2025 13:57: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.2.3
# Tue 18 Mar 2025 13:57:12 +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.3
# Tue 18 Mar 2025 13:57:13 +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