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.2 # Tue 03 Dec 2024 15:27:49 +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.2Show output
Dec 03 15:27:58.308188 osdx systemd-journald[367964]: Runtime Journal (/run/log/journal/d3b584433ca54f4e84c38003c593de3f) is 3.8M, max 15.3M, 11.4M free. Dec 03 15:27:58.308637 osdx systemd-journald[367964]: Received client request to rotate journal, rotating. Dec 03 15:27:58.308676 osdx systemd-journald[367964]: Vacuuming done, freed 0B of archived journals from /run/log/journal/d3b584433ca54f4e84c38003c593de3f. Dec 03 15:27:58.321441 osdx OSDxCLI[367824]: User 'admin' executed a new command: 'system journal clear'. Dec 03 15:27:58.673170 osdx osdx-coredump[369943]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Dec 03 15:27:58.682796 osdx OSDxCLI[367824]: User 'admin' executed a new command: 'system coredump delete all'. Dec 03 15:27:59.294804 osdx OSDxCLI[367824]: User 'admin' entered the configuration menu. Dec 03 15:27:59.471012 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Dec 03 15:27:59.587502 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Dec 03 15:27:59.698712 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Dec 03 15:27:59.795805 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Dec 03 15:27:59.905485 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Dec 03 15:27:59.964436 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command show version'. Dec 03 15:28:00.074030 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command license show'. Dec 03 15:28:00.147277 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'show working'. Dec 03 15:28:00.245965 osdx modulelauncher[1473]: + Received data: ['367824', 'osdx.utils.xos', 'set_console_log_level', 'info'] Dec 03 15:28:00.262075 osdx OSDxCLI[367824]: Signal 10 received Dec 03 15:28:00.271802 osdx ifmon[1475]: Changed log-level to info Dec 03 15:28:00.304615 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Dec 03 15:28:00.371587 osdx cfgd[1634]: [367824]Completed change to active configuration Dec 03 15:28:00.396218 osdx OSDxCLI[367824]: User 'admin' committed the configuration. Dec 03 15:28:00.415301 osdx OSDxCLI[367824]: User 'admin' left the configuration menu. Dec 03 15:28:00.664911 osdx OSDxCLI[367824]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Dec 03 15:28:00.665352 osdx OSDxCLI[367824]: pam_unix(cli:session): session closed for user admin Dec 03 15:28:00.665562 osdx OSDxCLI[367824]: User 'admin' entered the configuration menu. Dec 03 15:28:00.778990 osdx OSDxCLI[367824]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Dec 03 15:28:00.779179 osdx cfgd[1634]: Execute action [syntax] for node [system advisor ADVISOR1] Dec 03 15:28:00.779463 osdx OSDxCLI[367824]: pam_unix(cli:session): session closed for user admin Dec 03 15:28:00.779674 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Dec 03 15:28:00.853864 osdx OSDxCLI[367824]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Dec 03 15:28:00.862435 osdx OSDxCLI[367824]: pam_unix(cli:session): session closed for user admin Dec 03 15:28:00.862700 osdx OSDxCLI[367824]: User 'admin' added a new cfg line: 'show changes'. Dec 03 15:28:01.033147 osdx OSDxCLI[367824]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Dec 03 15:28:01.040896 osdx cfgd[1634]: [367824]must validation for [system login user admin role] was skipped Dec 03 15:28:01.040975 osdx cfgd[1634]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Dec 03 15:28:01.047434 osdx cfgd[1634]: Execute action [end] for node [system advisor ADVISOR1] Dec 03 15:28:01.053840 osdx cfgd[1634]: [367824]Completed change to active configuration Dec 03 15:28:01.055593 osdx OSDxCLI[367824]: pam_unix(cli:session): session closed for user admin Dec 03 15:28:01.055847 osdx OSDxCLI[367824]: User 'admin' committed the configuration. Dec 03 15:28:01.058168 osdx INFO[370093]: SCRIPT SCRIPT_1 operations: Dec 03 15:28:01.063202 osdx OSDxCLI[370101]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.063208 osdx OSDxCLI[370101]: User 'admin' has logged in. Dec 03 15:28:01.075658 osdx OSDxCLI[370101]: User 'admin' executed a new command: 'show version'. Dec 03 15:28:01.076882 osdx OSDxCLI[370101]: User 'admin' has logged out. Dec 03 15:28:01.076888 osdx OSDxCLI[370101]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.077538 osdx INFO[370093]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.1.2 OS Linux kernel: 6.1.90 OS built by: jenkins@daphne OS build date: Tue Dec 3 11:56:29 UTC 2024 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: 25e1e4f6-d652-51f2-aa7e-7ae3d1e0da19 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 03 Dec 2024 15:28:00 +00:00 Uptime: 2:43:39 CPU load (1m, 5m, 15m): 0.22 0.18 0.12 CPU usage % (1m): 8.22 Storage usage (kB): 368036/8144384 Memory usage (kB): 436340/1570524 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Dec 03 15:28:01.083908 osdx OSDxCLI[367824]: User 'admin' left the configuration menu. Dec 03 15:28:01.085497 osdx OSDxCLI[370107]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.085502 osdx OSDxCLI[370107]: User 'admin' has logged in. Dec 03 15:28:01.087658 osdx OSDxCLI[370107]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.089760 osdx OSDxCLI[370107]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.089914 osdx OSDxCLI[370107]: User 'admin' executed a new command: 'license show'. Dec 03 15:28:01.090805 osdx OSDxCLI[370107]: User 'admin' has logged out. Dec 03 15:28:01.090810 osdx OSDxCLI[370107]: Tecla::GetLine tcgetattr error Dec 03 15:28:01.091387 osdx INFO[370093]: Operation 2 'license show ': License: VM_BASE Firewall eth-Rate-Permit-Full +-----------------+---------+----------+ | License Item | Status | Validity | +-----------------+---------+----------+ | Firewall | Enabled | Forever | | eth-Rate-Permit | Full | Forever | +-----------------+---------+----------+ Dec 03 15:28:01.204098 osdx OSDxCLI[367824]: 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::e81d:5aff:febd:82d5/64 up up dum1 fe80::4ca1:dff:fe11:7c9d/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.2 # Tue 03 Dec 2024 15:28:25 +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.2 # Tue 03 Dec 2024 15:28:26 +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.2 # Tue 03 Dec 2024 15:28:28 +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