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.6.1 # Tue 24 Jun 2025 12:45:05 +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.6.1Show output
Jun 24 12:45:10.298429 osdx systemd-journald[1663]: Runtime Journal (/run/log/journal/a9c8f5b24ca148a6b10e0198640df300) is 2.0M, max 15.3M, 13.3M free. Jun 24 12:45:10.301098 osdx systemd-journald[1663]: Received client request to rotate journal, rotating. Jun 24 12:45:10.301162 osdx systemd-journald[1663]: Vacuuming done, freed 0B of archived journals from /run/log/journal/a9c8f5b24ca148a6b10e0198640df300. Jun 24 12:45:10.303207 osdx sudo[152380]: pam_limits(sudo:session): invalid line '@200:215 hard maxlogins ' - skipped Jun 24 12:45:10.310108 osdx OSDxCLI[147500]: User 'admin' executed a new command: 'system journal clear'. Jun 24 12:45:10.591342 osdx OSDxCLI[147500]: User 'admin' executed a new command: 'system coredump delete all'. Jun 24 12:45:10.879799 osdx OSDxCLI[147500]: User 'admin' entered the configuration menu. Jun 24 12:45:10.945135 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Jun 24 12:45:11.068477 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test false'. Jun 24 12:45:11.168448 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system cli configuration logging global info'. Jun 24 12:45:11.331369 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 advisor ADVISOR1'. Jun 24 12:45:11.470474 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set interfaces ethernet eth0 address 10.215.200.50/24'. Jun 24 12:45:11.571298 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 1 command "show version"'. Jun 24 12:45:11.699412 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system script SCRIPT_1 operational 2 command "license show"'. Jun 24 12:45:11.808365 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'show working'. Jun 24 12:45:11.884112 osdx ubnt-cfgd[152414]: inactive Jun 24 12:45:11.910160 osdx INFO[152424]: FRR daemons did not change Jun 24 12:45:11.911276 osdx modulelauncher[1283]: + Received data: ['147500', 'osdx.utils.xos', 'set_console_log_level', 'info'] Jun 24 12:45:11.934966 osdx OSDxCLI[147500]: Signal 10 received Jun 24 12:45:11.985092 osdx kernel: 8021q: adding VLAN 0 to HW filter on device eth0 Jun 24 12:45:12.034128 osdx cfgd[1460]: [147500]Completed change to active configuration Jun 24 12:45:12.048117 osdx OSDxCLI[147500]: User 'admin' committed the configuration. Jun 24 12:45:12.086450 osdx OSDxCLI[147500]: User 'admin' left the configuration menu. Jun 24 12:45:12.252824 osdx OSDxCLI[147500]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Jun 24 12:45:12.253335 osdx OSDxCLI[147500]: pam_unix(cli:session): session closed for user admin Jun 24 12:45:12.253538 osdx OSDxCLI[147500]: User 'admin' entered the configuration menu. Jun 24 12:45:12.320736 osdx OSDxCLI[147500]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Jun 24 12:45:12.321101 osdx cfgd[1460]: Execute action [syntax] for node [system advisor ADVISOR1] Jun 24 12:45:12.321490 osdx OSDxCLI[147500]: pam_unix(cli:session): session closed for user admin Jun 24 12:45:12.321678 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'set system advisor ADVISOR1 test true'. Jun 24 12:45:12.415752 osdx OSDxCLI[147500]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Jun 24 12:45:12.429618 osdx OSDxCLI[147500]: pam_unix(cli:session): session closed for user admin Jun 24 12:45:12.430000 osdx OSDxCLI[147500]: User 'admin' added a new cfg line: 'show changes'. Jun 24 12:45:12.538811 osdx OSDxCLI[147500]: pam_unix(cli:session): session opened for user admin(uid=1000) by admin(uid=1000) Jun 24 12:45:12.552499 osdx ubnt-cfgd[152559]: inactive Jun 24 12:45:12.567483 osdx cfgd[1460]: [147500]must validation for [system login user admin role] was skipped Jun 24 12:45:12.567495 osdx cfgd[1460]: Execute action [commit-subtree] for node [system advisor ADVISOR1] Jun 24 12:45:12.575259 osdx INFO[152567]: FRR daemons did not change Jun 24 12:45:12.575668 osdx cfgd[1460]: Execute action [end] for node [system advisor ADVISOR1] Jun 24 12:45:12.582734 osdx cfgd[1460]: [147500]Completed change to active configuration Jun 24 12:45:12.584869 osdx OSDxCLI[147500]: pam_unix(cli:session): session closed for user admin Jun 24 12:45:12.585168 osdx OSDxCLI[147500]: User 'admin' committed the configuration. Jun 24 12:45:12.588017 osdx INFO[152576]: SCRIPT SCRIPT_1 operations: Jun 24 12:45:12.594060 osdx OSDxCLI[152584]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.594259 osdx OSDxCLI[152584]: User 'admin' has logged in. Jun 24 12:45:12.606591 osdx OSDxCLI[152584]: User 'admin' executed a new command: 'show version'. Jun 24 12:45:12.608032 osdx OSDxCLI[152584]: User 'admin' has logged out. Jun 24 12:45:12.608103 osdx OSDxCLI[152584]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.608852 osdx INFO[152576]: Operation 1 'show version ': OS vendor: Teldat OS name: OSDx OS version: v4.2.6.1 OS Linux kernel: 6.1.128 OS built by: jenkins@daphne OS build date: Tue Jun 24 10:36:00 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: 3ae56e40-671e-5ba3-bee0-72c1d527e6ef 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 24 Jun 2025 12:45:12 +00:00 Uptime: 1:10:12 CPU load (1m, 5m, 15m): 0.01 0.08 0.12 CPU usage % (1m): 1.66 Storage usage (kB): 348460/8144384 Memory usage (kB): 398144/1574492 Users logged in: 1 Mode (current/next boot): user/user Hostname: osdx Jun 24 12:45:12.614043 osdx OSDxCLI[152590]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.614254 osdx OSDxCLI[152590]: User 'admin' has logged in. Jun 24 12:45:12.617319 osdx OSDxCLI[147500]: User 'admin' left the configuration menu. Jun 24 12:45:12.620435 osdx OSDxCLI[152590]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.622478 osdx OSDxCLI[152590]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.622673 osdx OSDxCLI[152590]: User 'admin' executed a new command: 'license show'. Jun 24 12:45:12.623918 osdx OSDxCLI[152590]: User 'admin' has logged out. Jun 24 12:45:12.623960 osdx OSDxCLI[152590]: Tecla::GetLine tcgetattr error Jun 24 12:45:12.624520 osdx INFO[152576]: Operation 2 'license show ': License: VM_BASE Firewall eth-Rate-Permit-Full +-----------------+---------+----------+ | License Item | Status | Validity | +-----------------+---------+----------+ | Firewall | Enabled | Forever | | eth-Rate-Permit | Full | Forever | +-----------------+---------+----------+ Jun 24 12:45:12.787874 osdx OSDxCLI[147500]: 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::d8af:37ff:fee9:1836/64 up up dum1 fe80::88e8:a8ff:fe58:525b/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.6.1 # Tue 24 Jun 2025 12:45:24 +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.6.1 # Tue 24 Jun 2025 12:45: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 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.6.1 # Tue 24 Jun 2025 12:45:27 +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