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.3.2 # Mon 10 Mar 2025 09:56:23 +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.3.2Show output
Mar 10 09:56:27.319688 osdx systemd-journald[1668]: Runtime Journal (/run/log/journal/8c78421431714dc5b42d4f61b2ec278e) is 2.1M, max 15.3M, 13.2M free. Mar 10 09:56:27.322429 osdx systemd-journald[1668]: Received client request to rotate journal, rotating. Mar 10 09:56:27.322486 osdx systemd-journald[1668]: Vacuuming done, freed 0B of archived journals from /run/log/journal/8c78421431714dc5b42d4f61b2ec278e. Mar 10 09:56:27.331446 osdx OSDxCLI[54267]: User 'admin' executed a new command: 'system journal clear'. Mar 10 09:56:27.671928 osdx osdx-coredump[95090]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Mar 10 09:56:27.680743 osdx OSDxCLI[54267]: User 'admin' executed a new command: 'system coredump delete all'. Mar 10 09:56:28.144866 osdx OSDxCLI[54267]: User 'admin' entered the configuration menu. Mar 10 09:56:28.204965 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Mar 10 09:56:28.300006 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Mar 10 09:56:28.358016 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Mar 10 09:56:28.456741 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Mar 10 09:56:28.534179 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Mar 10 09:56:28.623982 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'. Mar 10 09:56:28.686819 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'. Mar 10 09:56:28.790181 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'show working'. Mar 10 09:56:28.861521 osdx INFO[95125]: FRR daemons did not change Mar 10 09:56:28.862595 osdx modulelauncher[1291]: + Received data: ['54267', 'osdx.utils.xos', 'set_console_log_level', 'info'] Mar 10 09:56:28.882554 osdx OSDxCLI[54267]: Signal 10 received Mar 10 09:56:28.926434 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Mar 10 09:56:28.994272 osdx cfgd[1455]: [54267]Completed change to active configuration Mar 10 09:56:29.023986 osdx OSDxCLI[54267]: User 'admin' committed the configuration. Mar 10 09:56:29.040971 osdx OSDxCLI[54267]: User 'admin' left the configuration menu. Mar 10 09:56:29.204187 osdx OSDxCLI[54267]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 10 09:56:29.204666 osdx OSDxCLI[54267]: pam_unix(cli:session): session closed for user admin Mar 10 09:56:29.204870 osdx OSDxCLI[54267]: User 'admin' entered the configuration menu. Mar 10 09:56:29.264535 osdx OSDxCLI[54267]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 10 09:56:29.264722 osdx cfgd[1455]: Execute action [syntax] for node [system advisor ADVISOR1] Mar 10 09:56:29.265003 osdx OSDxCLI[54267]: pam_unix(cli:session): session closed for user admin Mar 10 09:56:29.265203 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Mar 10 09:56:29.361550 osdx OSDxCLI[54267]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 10 09:56:29.373918 osdx OSDxCLI[54267]: pam_unix(cli:session): session closed for user admin Mar 10 09:56:29.374141 osdx OSDxCLI[54267]: User 'admin' added a new cfg line: 'show changes'. Mar 10 09:56:29.423809 osdx OSDxCLI[54267]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 10 09:56:29.431775 osdx cfgd[1455]: [54267]must validation for [system login user admin role] was skipped Mar 10 09:56:29.431785 osdx cfgd[1455]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Mar 10 09:56:29.439635 osdx INFO[95240]: FRR daemons did not change Mar 10 09:56:29.439778 osdx cfgd[1455]: Execute action [end] for node [system advisor ADVISOR1] Mar 10 09:56:29.446966 osdx cfgd[1455]: [54267]Completed change to active configuration Mar 10 09:56:29.448835 osdx OSDxCLI[54267]: pam_unix(cli:session): session closed for user admin Mar 10 09:56:29.449127 osdx OSDxCLI[54267]: User 'admin' committed the configuration. Mar 10 09:56:29.453868 osdx INFO[95250]: SCRIPT SCRIPT_1 operations: Mar 10 09:56:29.458637 osdx OSDxCLI[95257]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.458809 osdx OSDxCLI[95257]: User 'admin' has logged in. Mar 10 09:56:29.468698 osdx OSDxCLI[95257]: User 'admin' executed a new command: 'show version'. Mar 10 09:56:29.469726 osdx OSDxCLI[95257]: User 'admin' has logged out. Mar 10 09:56:29.469732 osdx OSDxCLI[95257]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.470269 osdx INFO[95250]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.3.2 OS Linux kernel: 6.1.119 OS built by: jenkins@daphne OS build date: Tue Mar 4 16:14:54 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: c2668594-89f3-51ac-b196-6c7cc9c6e73b 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 10 Mar 2025 09:56:28 +00:00 Uptime: 1:03:19 CPU load (1m, 5m, 15m): 0.47 0.26 0.19 CPU usage % (1m): 3.74 Storage usage (kB): 363644/8144384 Memory usage (kB): 393640/1570512 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Mar 10 09:56:29.474529 osdx OSDxCLI[95263]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.474719 osdx OSDxCLI[95263]: User 'admin' has logged in. Mar 10 09:56:29.476685 osdx OSDxCLI[95263]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.479269 osdx OSDxCLI[95263]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.479490 osdx OSDxCLI[95263]: User 'admin' executed a new command: 'license show'. Mar 10 09:56:29.480435 osdx OSDxCLI[95263]: User 'admin' has logged out. Mar 10 09:56:29.480488 osdx OSDxCLI[95263]: Tecla::GetLine tcgetattr error Mar 10 09:56:29.481003 osdx INFO[95250]: 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 10 09:56:29.488877 osdx OSDxCLI[54267]: User 'admin' left the configuration menu. Mar 10 09:56:29.618851 osdx OSDxCLI[54267]: 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::e0a2:abff:feb1:27e8/64 up up dum1 fe80::68bc:5aff:feba:9445/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.3.2 # Mon 10 Mar 2025 09:56:42 +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.3.2 # Mon 10 Mar 2025 09:56:43 +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.3.2 # Mon 10 Mar 2025 09:56:44 +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