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.1.3 # Mon 03 Feb 2025 15:21:12 +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.1.3Show output
Feb 03 15:21:18.450182 osdx systemd-journald[1840]: Runtime Journal (/run/log/journal/e118f5d6299342f2993b92de73c9a6c7) is 2.1M, max 15.3M, 13.1M free. Feb 03 15:21:18.452736 osdx systemd-journald[1840]: Received client request to rotate journal, rotating. Feb 03 15:21:18.452816 osdx systemd-journald[1840]: Vacuuming done, freed 0B of archived journals from /run/log/journal/e118f5d6299342f2993b92de73c9a6c7. Feb 03 15:21:18.466331 osdx OSDxCLI[34781]: User 'admin' executed a new command: 'system journal clear'. Feb 03 15:21:19.024027 osdx osdx-coredump[35254]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Feb 03 15:21:19.038419 osdx OSDxCLI[34781]: User 'admin' executed a new command: 'system coredump delete all'. Feb 03 15:21:19.778328 osdx OSDxCLI[34781]: User 'admin' entered the configuration menu. Feb 03 15:21:19.883402 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Feb 03 15:21:20.007758 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Feb 03 15:21:20.140616 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Feb 03 15:21:20.267571 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Feb 03 15:21:20.396087 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Feb 03 15:21:20.491768 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command show version'. Feb 03 15:21:20.595624 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command license show'. Feb 03 15:21:20.727526 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'show working'. Feb 03 15:21:20.843147 osdx INFO[35286]: FRR daemons did not change Feb 03 15:21:20.844697 osdx modulelauncher[1477]: + Received data: ['34781', 'osdx.utils.xos', 'set_console_log_level', 'info'] Feb 03 15:21:20.864510 osdx OSDxCLI[34781]: Signal 10 received Feb 03 15:21:20.876863 osdx ifmon[1479]: Changed log-level to info Feb 03 15:21:21.017566 osdx cfgd[1642]: [34781]Completed change to active configuration Feb 03 15:21:21.057088 osdx OSDxCLI[34781]: User 'admin' committed the configuration. Feb 03 15:21:21.087872 osdx OSDxCLI[34781]: User 'admin' left the configuration menu. Feb 03 15:21:21.331962 osdx OSDxCLI[34781]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Feb 03 15:21:21.332652 osdx OSDxCLI[34781]: pam_unix(cli:session): session closed for user admin Feb 03 15:21:21.333114 osdx OSDxCLI[34781]: User 'admin' entered the configuration menu. Feb 03 15:21:21.448417 osdx OSDxCLI[34781]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Feb 03 15:21:21.448787 osdx cfgd[1642]: Execute action [syntax] for node [system advisor ADVISOR1] Feb 03 15:21:21.449377 osdx OSDxCLI[34781]: pam_unix(cli:session): session closed for user admin Feb 03 15:21:21.449689 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Feb 03 15:21:21.547239 osdx OSDxCLI[34781]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Feb 03 15:21:21.561062 osdx OSDxCLI[34781]: pam_unix(cli:session): session closed for user admin Feb 03 15:21:21.561483 osdx OSDxCLI[34781]: User 'admin' added a new cfg line: 'show changes'. Feb 03 15:21:21.648769 osdx OSDxCLI[34781]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Feb 03 15:21:21.667820 osdx cfgd[1642]: [34781]must validation for [system login user admin role] was skipped Feb 03 15:21:21.667853 osdx cfgd[1642]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Feb 03 15:21:21.680356 osdx INFO[35395]: FRR daemons did not change Feb 03 15:21:21.680610 osdx cfgd[1642]: Execute action [end] for node [system advisor ADVISOR1] Feb 03 15:21:21.690627 osdx cfgd[1642]: [34781]Completed change to active configuration Feb 03 15:21:21.693033 osdx OSDxCLI[34781]: pam_unix(cli:session): session closed for user admin Feb 03 15:21:21.693325 osdx OSDxCLI[34781]: User 'admin' committed the configuration. Feb 03 15:21:21.697654 osdx INFO[35404]: SCRIPT SCRIPT_1 operations: Feb 03 15:21:21.706938 osdx OSDxCLI[35412]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.707271 osdx OSDxCLI[35412]: User 'admin' has logged in. Feb 03 15:21:21.721014 osdx OSDxCLI[34781]: User 'admin' left the configuration menu. Feb 03 15:21:21.726271 osdx OSDxCLI[35412]: User 'admin' executed a new command: 'show version'. Feb 03 15:21:21.727711 osdx OSDxCLI[35412]: User 'admin' has logged out. Feb 03 15:21:21.727721 osdx OSDxCLI[35412]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.728516 osdx INFO[35404]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.1.3 OS Linux kernel: 6.1.90 OS built by: jenkins@daphne OS build date: Mon Feb 3 09:56:32 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: 7a780778-3d0e-5b06-b590-0789705af61d 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 03 Feb 2025 15:21:20 +00:00 Uptime: 0:26:31 CPU load (1m, 5m, 15m): 0.25 0.16 0.11 CPU usage % (1m): 6.79 Storage usage (kB): 368256/8144384 Memory usage (kB): 379472/1570524 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Feb 03 15:21:21.736635 osdx OSDxCLI[35418]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.736646 osdx OSDxCLI[35418]: User 'admin' has logged in. Feb 03 15:21:21.740877 osdx OSDxCLI[35418]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.743667 osdx OSDxCLI[35418]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.743876 osdx OSDxCLI[35418]: User 'admin' executed a new command: 'license show'. Feb 03 15:21:21.745244 osdx OSDxCLI[35418]: User 'admin' has logged out. Feb 03 15:21:21.745250 osdx OSDxCLI[35418]: Tecla::GetLine tcgetattr error Feb 03 15:21:21.745947 osdx INFO[35404]: 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 03 15:21:21.875448 osdx OSDxCLI[34781]: 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::5c4b:3cff:fed4:7d71/64 up up dum1 fe80::84d4:f9ff:fe9b:4a49/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.1.3 # Mon 03 Feb 2025 15:21:40 +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.1.3 # Mon 03 Feb 2025 15:21:41 +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.1.3 # Mon 03 Feb 2025 15:21:43 +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