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.4.2 # Thu 10 Apr 2025 16:33:36 +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.4.2Show output
Apr 10 16:33:40.304068 osdx systemd-journald[1983]: Runtime Journal (/run/log/journal/1b38a2acfb83465bb2abfbc9ee1b5d42) is 2.1M, max 15.3M, 13.1M free. Apr 10 16:33:40.304922 osdx systemd-journald[1983]: Received client request to rotate journal, rotating. Apr 10 16:33:40.304965 osdx systemd-journald[1983]: Vacuuming done, freed 0B of archived journals from /run/log/journal/1b38a2acfb83465bb2abfbc9ee1b5d42. Apr 10 16:33:40.315521 osdx OSDxCLI[104854]: User 'admin' executed a new command: 'system journal clear'. Apr 10 16:33:40.645816 osdx osdx-coredump[107022]: Deleting all coredumps in /opt/vyatta/etc/config/coredump... Apr 10 16:33:40.653434 osdx OSDxCLI[104854]: User 'admin' executed a new command: 'system coredump delete all'. Apr 10 16:33:41.156961 osdx OSDxCLI[104854]: User 'admin' entered the configuration menu. Apr 10 16:33:41.233589 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Apr 10 16:33:41.319310 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Apr 10 16:33:41.419706 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Apr 10 16:33:41.476705 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Apr 10 16:33:41.593094 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Apr 10 16:33:41.649828 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'. Apr 10 16:33:41.760647 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'. Apr 10 16:33:41.837789 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'show working'. Apr 10 16:33:41.936123 osdx ubnt-cfgd[107049]: inactive Apr 10 16:33:41.992611 osdx INFO[107059]: FRR daemons did not change Apr 10 16:33:41.993401 osdx modulelauncher[1487]: + Received data: ['104854', 'osdx.utils.xos', 'set_console_log_level', 'info'] Apr 10 16:33:42.012603 osdx OSDxCLI[104854]: Signal 10 received Apr 10 16:33:42.056948 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Apr 10 16:33:42.117066 osdx cfgd[1673]: [104854]Completed change to active configuration Apr 10 16:33:42.132128 osdx OSDxCLI[104854]: User 'admin' committed the configuration. Apr 10 16:33:42.149184 osdx OSDxCLI[104854]: User 'admin' left the configuration menu. Apr 10 16:33:42.343918 osdx OSDxCLI[104854]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Apr 10 16:33:42.344384 osdx OSDxCLI[104854]: pam_unix(cli:session): session closed for user admin Apr 10 16:33:42.344562 osdx OSDxCLI[104854]: User 'admin' entered the configuration menu. Apr 10 16:33:42.420963 osdx OSDxCLI[104854]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Apr 10 16:33:42.421377 osdx cfgd[1673]: Execute action [syntax] for node [system advisor ADVISOR1] Apr 10 16:33:42.421830 osdx OSDxCLI[104854]: pam_unix(cli:session): session closed for user admin Apr 10 16:33:42.422302 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Apr 10 16:33:42.526350 osdx OSDxCLI[104854]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Apr 10 16:33:42.535873 osdx OSDxCLI[104854]: pam_unix(cli:session): session closed for user admin Apr 10 16:33:42.536230 osdx OSDxCLI[104854]: User 'admin' added a new cfg line: 'show changes'. Apr 10 16:33:42.603234 osdx OSDxCLI[104854]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Apr 10 16:33:42.615269 osdx ubnt-cfgd[107194]: inactive Apr 10 16:33:42.694504 osdx cfgd[1673]: [104854]must validation for [system login user admin role] was skipped Apr 10 16:33:42.694531 osdx cfgd[1673]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Apr 10 16:33:42.710397 osdx INFO[107202]: FRR daemons did not change Apr 10 16:33:42.711215 osdx cfgd[1673]: Execute action [end] for node [system advisor ADVISOR1] Apr 10 16:33:42.724669 osdx cfgd[1673]: [104854]Completed change to active configuration Apr 10 16:33:42.729241 osdx OSDxCLI[104854]: pam_unix(cli:session): session closed for user admin Apr 10 16:33:42.729808 osdx OSDxCLI[104854]: User 'admin' committed the configuration. Apr 10 16:33:42.734750 osdx INFO[107211]: SCRIPT SCRIPT_1 operations: Apr 10 16:33:42.745051 osdx OSDxCLI[107219]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.745373 osdx OSDxCLI[107219]: User 'admin' has logged in. Apr 10 16:33:42.755588 osdx OSDxCLI[107219]: User 'admin' executed a new command: 'show version'. Apr 10 16:33:42.756554 osdx OSDxCLI[107219]: User 'admin' has logged out. Apr 10 16:33:42.756600 osdx OSDxCLI[107219]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.757183 osdx INFO[107211]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.4.2 OS Linux kernel: 6.1.128 OS built by: jenkins@daphne OS build date: Mon Apr 7 12:04:24 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: 736d14fa-a089-59eb-bd9c-dcadf3e7e626 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: Power Failure Date: Thu 10 Apr 2025 16:33:42 +00:00 Uptime: 1:08:21 CPU load (1m, 5m, 15m): 0.09 0.13 0.15 CPU usage % (1m): 1.67 Storage usage (kB): 365720/8144384 Memory usage (kB): 390160/1570512 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Apr 10 16:33:42.760663 osdx OSDxCLI[104854]: User 'admin' left the configuration menu. Apr 10 16:33:42.761816 osdx OSDxCLI[107225]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.761953 osdx OSDxCLI[107225]: User 'admin' has logged in. Apr 10 16:33:42.763856 osdx OSDxCLI[107225]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.765742 osdx OSDxCLI[107225]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.765937 osdx OSDxCLI[107225]: User 'admin' executed a new command: 'license show'. Apr 10 16:33:42.766804 osdx OSDxCLI[107225]: User 'admin' has logged out. Apr 10 16:33:42.766851 osdx OSDxCLI[107225]: Tecla::GetLine tcgetattr error Apr 10 16:33:42.767353 osdx INFO[107211]: Operation 2 'license show ': License: VM_BASE Firewall eth-Rate-Permit-Full +-----------------+---------+----------+ | License Item | Status | Validity | +-----------------+---------+----------+ | Firewall | Enabled | Forever | | eth-Rate-Permit | Full | Forever | +-----------------+---------+----------+ Apr 10 16:33:42.901747 osdx OSDxCLI[104854]: 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::9c94:78ff:fef3:63c0/64 up up dum1 fe80::d0d0:40ff:feba:976a/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.4.2 # Thu 10 Apr 2025 16:33:56 +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.4.2 # Thu 10 Apr 2025 16:33:57 +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.4.2 # Thu 10 Apr 2025 16:33:58 +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