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.5 # Mon 26 May 2025 10:38:16 +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.5Show output
May 26 10:38:20.304444 osdx systemd-journald[1847]: Runtime Journal (/run/log/journal/667813271fde4661bfa43dd3fe9abe5e) is 2.1M, max 15.3M, 13.2M free. May 26 10:38:20.305086 osdx systemd-journald[1847]: Received client request to rotate journal, rotating. May 26 10:38:20.305128 osdx systemd-journald[1847]: Vacuuming done, freed 0B of archived journals from /run/log/journal/667813271fde4661bfa43dd3fe9abe5e. May 26 10:38:20.316335 osdx OSDxCLI[16023]: User 'admin' executed a new command: 'system journal clear'. May 26 10:38:20.649181 osdx osdx-coredump[20073]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... May 26 10:38:20.656794 osdx OSDxCLI[16023]: User 'admin' executed a new command: 'system coredump delete all'. May 26 10:38:21.160993 osdx OSDxCLI[16023]: User 'admin' entered the configuration menu. May 26 10:38:21.243525 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. May 26 10:38:21.340359 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. May 26 10:38:21.415867 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. May 26 10:38:21.515359 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. May 26 10:38:21.587718 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. May 26 10:38:21.673886 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'. May 26 10:38:21.730760 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'. May 26 10:38:21.848556 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'show working'. May 26 10:38:21.920793 osdx INFO[20104]: FRR daemons did not change May 26 10:38:21.921868 osdx modulelauncher[1485]: + Received data: ['16023', 'osdx.utils.xos', 'set_console_log_level', 'info'] May 26 10:38:21.940606 osdx OSDxCLI[16023]: Signal 10 received May 26 10:38:22.053969 osdx cfgd[1651]: [16023]Completed change to active configuration May 26 10:38:22.081770 osdx OSDxCLI[16023]: User 'admin' committed the configuration. May 26 10:38:22.108748 osdx OSDxCLI[16023]: User 'admin' left the configuration menu. May 26 10:38:22.308794 osdx OSDxCLI[16023]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) May 26 10:38:22.309327 osdx OSDxCLI[16023]: pam_unix(cli:session): session closed for user admin May 26 10:38:22.309575 osdx OSDxCLI[16023]: User 'admin' entered the configuration menu. May 26 10:38:22.373438 osdx OSDxCLI[16023]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) May 26 10:38:22.373712 osdx cfgd[1651]: Execute action [syntax] for node [system advisor ADVISOR1] May 26 10:38:22.374130 osdx OSDxCLI[16023]: pam_unix(cli:session): session closed for user admin May 26 10:38:22.374405 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. May 26 10:38:22.535473 osdx OSDxCLI[16023]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) May 26 10:38:22.548541 osdx OSDxCLI[16023]: pam_unix(cli:session): session closed for user admin May 26 10:38:22.548810 osdx OSDxCLI[16023]: User 'admin' added a new cfg line: 'show changes'. May 26 10:38:22.599102 osdx OSDxCLI[16023]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) May 26 10:38:22.612320 osdx cfgd[1651]: [16023]must validation for [system login user admin role] was skipped May 26 10:38:22.612337 osdx cfgd[1651]: Execute action [commit-subtree] for node [system advisor ADVISOR1] May 26 10:38:22.620373 osdx INFO[20219]: FRR daemons did not change May 26 10:38:22.620771 osdx cfgd[1651]: Execute action [end] for node [system advisor ADVISOR1] May 26 10:38:22.627852 osdx cfgd[1651]: [16023]Completed change to active configuration May 26 10:38:22.629633 osdx OSDxCLI[16023]: pam_unix(cli:session): session closed for user admin May 26 10:38:22.629919 osdx OSDxCLI[16023]: User 'admin' committed the configuration. May 26 10:38:22.632435 osdx INFO[20228]: SCRIPT SCRIPT_1 operations: May 26 10:38:22.637426 osdx OSDxCLI[20236]: Tecla::GetLine tcgetattr error May 26 10:38:22.637432 osdx OSDxCLI[20236]: User 'admin' has logged in. May 26 10:38:22.647671 osdx OSDxCLI[20236]: User 'admin' executed a new command: 'show version'. May 26 10:38:22.648942 osdx OSDxCLI[20236]: User 'admin' has logged out. May 26 10:38:22.648948 osdx OSDxCLI[20236]: Tecla::GetLine tcgetattr error May 26 10:38:22.649683 osdx INFO[20228]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.2.5 OS Linux kernel: 6.1.119 OS built by: jenkins@daphne OS build date: Mon May 26 08:22:48 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: 2f24fbf0-e576-50ef-b22c-d49f09028531 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 26 May 2025 10:38:21 +00:00 Uptime: 0:12:22 CPU load (1m, 5m, 15m): 0.09 0.13 0.09 CPU usage % (1m): 6.61 Storage usage (kB): 363728/8144384 Memory usage (kB): 333544/1570512 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx May 26 10:38:22.656246 osdx OSDxCLI[20242]: Tecla::GetLine tcgetattr error May 26 10:38:22.656254 osdx OSDxCLI[20242]: User 'admin' has logged in. May 26 10:38:22.660349 osdx OSDxCLI[20242]: Tecla::GetLine tcgetattr error May 26 10:38:22.662335 osdx OSDxCLI[20242]: Tecla::GetLine tcgetattr error May 26 10:38:22.662532 osdx OSDxCLI[20242]: User 'admin' executed a new command: 'license show'. May 26 10:38:22.664003 osdx OSDxCLI[20242]: User 'admin' has logged out. May 26 10:38:22.664010 osdx OSDxCLI[20242]: Tecla::GetLine tcgetattr error May 26 10:38:22.664685 osdx INFO[20228]: 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 26 10:38:22.674587 osdx OSDxCLI[16023]: User 'admin' left the configuration menu. May 26 10:38:22.808863 osdx OSDxCLI[16023]: 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.*\ndum1Show output
----------------------------------------------------------------- Name IP Address Admin Oper Vrf Description ----------------------------------------------------------------- dum0 fe80::640b:28ff:fe7d:9172/64 up up dum1 fe80::f058:8dff:fe78:174e/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.5 # Mon 26 May 2025 10:38:35 +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.5 # Mon 26 May 2025 10:38:37 +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.5 # Mon 26 May 2025 10:38:38 +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