Check Commit Validation
The following scenario shows how to configure the system to activate or deactivate previously defined alarms based on the results of executing the “commit” command.
Test Commit Validation
Description
In this scenario an alarm is configured in DUT0 to be activated or deactivated based on the results of executing the “commit” command. First, the alarm is activated when the “commit” command fails. Then the alarm is deactivated when the “commit” command is successful.
Scenario
Step 1: Set the following configuration in DUT0
:
set system alarm ALARM_COMMIT set system cli configuration commit alarm ALARM_COMMIT set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'
Step 2: Run command system alarm ALARM_COMMIT show
at DUT0
and check if output matches the following regular expressions:
(ALARM_COMMIT)\s+(false)Show output
---------------------------------------------------------------------- Alarm Status Toggled Prev-toggled Toggle-count Time up (%) ---------------------------------------------------------------------- ALARM_COMMIT false 0 0.00
Note
The output of the above command should show that the alarm was created successfully and is currently deactivated, since the last executed “commit” was successful.
Step 3: Expect a failure in the following command:
Modify the following configuration lines in DUT0
:
set interfaces ethernet eth0 address 10.0.0.1/24 set interfaces ethernet eth0 alarm down ALARM_TO_TEST
Note
In the above command, the “commit” should fail as it is trying to adjust a wrong configuration.
Step 4: Run command system alarm ALARM_COMMIT show
at DUT0
and check if output matches the following regular expressions:
(ALARM_COMMIT)\s+(true)Show output
----------------------------------------------------------------------------------------- Alarm Status Toggled Prev-toggled Toggle-count Time up (%) ----------------------------------------------------------------------------------------- ALARM_COMMIT true 2024-07-17 16:18:42.915435 1 18.96
Note
The output of the above command should show that the alarm is activated, since the last executed “commit” failed.
Step 5: Modify the following configuration lines in DUT0
:
set interfaces ethernet eth0 address 10.0.0.1/24 set interfaces ethernet eth0 alarm down ALARM_TO_TEST set system alarm ALARM_TO_TEST
Note
In the above command, the “commit” should be successful as it is trying to adjust a correct configuration.
Step 6: Run command system alarm ALARM_COMMIT show
at DUT0
and check if output matches the following regular expressions:
(ALARM_COMMIT)\s+(false)Show output
------------------------------------------------------------------------------------------------------- Alarm Status Toggled Prev-toggled Toggle-count Time up (%) ------------------------------------------------------------------------------------------------------- ALARM_COMMIT false 2024-07-17 16:18:43.654216 2024-07-17 16:18:42.915435 2 49.38
Note
The output of the above command should show that the alarm is deactivated, since the last executed “commit” was successful.