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 202503211214.a3e79e6-master-snapshot # Fri 21 Mar 2025 23:33:34 +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:
202503211214.a3e79e6-master-snapshotShow output
Mar 21 23:33:49.422923 osdx systemd-journald[135576]: Runtime Journal (/run/log/journal/4aed3ffce77740a989e5dd98f632940c) is 3.2M, max 15.3M, 12.1M free. Mar 21 23:33:49.430666 osdx systemd-journald[135576]: Received client request to rotate journal, rotating. Mar 21 23:33:49.430835 osdx systemd-journald[135576]: Vacuuming done, freed 0B of archived journals from /run/log/journal/4aed3ffce77740a989e5dd98f632940c. Mar 21 23:33:49.437303 osdx sudo[241066]: pam_limits(sudo:session): invalid line '@200:215 hard maxlogins ' - skipped Mar 21 23:33:49.447178 osdx OSDxCLI[237619]: User 'admin' executed a new command: 'system journal clear'. Mar 21 23:33:49.920632 osdx sudo[241074]: pam_limits(sudo:session): invalid line '@200:215 hard maxlogins ' - skipped Mar 21 23:33:50.070971 osdx sudo[241079]: pam_limits(sudo:session): invalid line '@200:215 hard maxlogins ' - skipped Mar 21 23:33:50.155467 osdx osdx-coredump[241081]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Mar 21 23:33:50.169174 osdx OSDxCLI[237619]: User 'admin' executed a new command: 'system coredump delete all'. Mar 21 23:33:50.978555 osdx OSDxCLI[237619]: User 'admin' entered the configuration menu. Mar 21 23:33:51.154946 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Mar 21 23:33:51.271477 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Mar 21 23:33:51.466581 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Mar 21 23:33:51.684860 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Mar 21 23:33:51.843628 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Mar 21 23:33:51.973581 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'. Mar 21 23:33:52.100161 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'. Mar 21 23:33:52.265427 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'show working'. Mar 21 23:33:52.369167 osdx ubnt-cfgd[241112]: inactive Mar 21 23:33:53.701082 osdx INFO[241126]: FRR daemons did not change Mar 21 23:33:53.702837 osdx modulelauncher[1483]: + Received data: ['237619', 'osdx.utils.xos', 'set_console_log_level', 'info'] Mar 21 23:33:53.741491 osdx OSDxCLI[237619]: Signal 10 received Mar 21 23:33:53.820264 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Mar 21 23:33:53.907775 osdx cfgd[1728]: [237619]Completed change to active configuration Mar 21 23:33:53.931173 osdx OSDxCLI[237619]: User 'admin' committed the configuration. Mar 21 23:33:53.970021 osdx OSDxCLI[237619]: User 'admin' left the configuration menu. Mar 21 23:33:54.257905 osdx OSDxCLI[237619]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 21 23:33:54.259036 osdx OSDxCLI[237619]: pam_unix(cli:session): session closed for user admin Mar 21 23:33:54.259638 osdx OSDxCLI[237619]: User 'admin' entered the configuration menu. Mar 21 23:33:54.396260 osdx OSDxCLI[237619]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 21 23:33:54.396866 osdx cfgd[1728]: Execute action [syntax] for node [system advisor ADVISOR1] Mar 21 23:33:54.397403 osdx OSDxCLI[237619]: pam_unix(cli:session): session closed for user admin Mar 21 23:33:54.397899 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Mar 21 23:33:54.534826 osdx OSDxCLI[237619]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 21 23:33:54.557221 osdx OSDxCLI[237619]: pam_unix(cli:session): session closed for user admin Mar 21 23:33:54.557776 osdx OSDxCLI[237619]: User 'admin' added a new cfg line: 'show changes'. Mar 21 23:33:54.657052 osdx OSDxCLI[237619]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Mar 21 23:33:54.678185 osdx ubnt-cfgd[241261]: inactive Mar 21 23:33:55.827774 osdx cfgd[1728]: [237619]must validation for [system login user admin role] was skipped Mar 21 23:33:55.827792 osdx cfgd[1728]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Mar 21 23:33:55.842263 osdx INFO[241273]: FRR daemons did not change Mar 21 23:33:55.842928 osdx cfgd[1728]: Execute action [end] for node [system advisor ADVISOR1] Mar 21 23:33:55.855192 osdx cfgd[1728]: [237619]Completed change to active configuration Mar 21 23:33:55.859401 osdx OSDxCLI[237619]: pam_unix(cli:session): session closed for user admin Mar 21 23:33:55.860989 osdx OSDxCLI[237619]: User 'admin' committed the configuration. Mar 21 23:33:55.869929 osdx INFO[241283]: SCRIPT SCRIPT_1 operations: Mar 21 23:33:55.879981 osdx OSDxCLI[241290]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.880285 osdx OSDxCLI[241290]: User 'admin' has logged in. Mar 21 23:33:55.911303 osdx OSDxCLI[241290]: User 'admin' executed a new command: 'show version'. Mar 21 23:33:55.913412 osdx OSDxCLI[241290]: User 'admin' has logged out. Mar 21 23:33:55.913423 osdx OSDxCLI[241290]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.914441 osdx INFO[241283]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: 202503211214.a3e79e6-master-snapshot OS Linux kernel: 6.1.128 OS built by: jenkins@daphne OS build date: Fri Mar 21 12:03:06 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: f7686e6c-6b42-5e91-a0f3-4fb1819a4502 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: Fri 21 Mar 2025 23:33:55 +00:00 Uptime: 3:03:20 CPU load (1m, 5m, 15m): 0.48 0.43 0.36 CPU usage % (1m): 8.10 Storage usage (kB): 370592/8144384 Memory usage (kB): 413536/1570512 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Mar 21 23:33:55.922511 osdx OSDxCLI[241305]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.922521 osdx OSDxCLI[241305]: User 'admin' has logged in. Mar 21 23:33:55.927351 osdx OSDxCLI[241305]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.931475 osdx OSDxCLI[241305]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.931840 osdx OSDxCLI[241305]: User 'admin' executed a new command: 'license show'. Mar 21 23:33:55.934265 osdx OSDxCLI[241305]: User 'admin' has logged out. Mar 21 23:33:55.934284 osdx OSDxCLI[241305]: Tecla::GetLine tcgetattr error Mar 21 23:33:55.935293 osdx INFO[241283]: 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 21 23:33:55.955969 osdx OSDxCLI[237619]: User 'admin' left the configuration menu. Mar 21 23:33:56.107080 osdx OSDxCLI[237619]: 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::8fe:62ff:fe1e:8f36/64 up up dum1 fe80::58fb:b5ff:fe57:7023/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 202503211214.a3e79e6-master-snapshot # Fri 21 Mar 2025 23:34: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 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 202503211214.a3e79e6-master-snapshot # Fri 21 Mar 2025 23:34:28 +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 202503211214.a3e79e6-master-snapshot # Fri 21 Mar 2025 23:34:31 +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