From be7ca9910069abd0cd6cac93415cd4a85ca280cc Mon Sep 17 00:00:00 2001 From: Hasty Granbery Date: Fri, 2 Aug 2024 12:29:02 -0400 Subject: [PATCH] Patch tests for atomic write of presets --- .../linux/thermostat-delegate-impl.cpp | 42 +------- .../thermostat-server/thermostat-server.cpp | 8 +- .../tests/suites/certification/ci-pics-values | 6 +- .../python/chip/clusters/__init__.py | 4 +- src/python_testing/TC_TSTAT_4_2.py | 102 +++++++++--------- 5 files changed, 67 insertions(+), 95 deletions(-) diff --git a/examples/thermostat/linux/thermostat-delegate-impl.cpp b/examples/thermostat/linux/thermostat-delegate-impl.cpp index eaa76d0b71690c..a86a9058e9fc83 100644 --- a/examples/thermostat/linux/thermostat-delegate-impl.cpp +++ b/examples/thermostat/linux/thermostat-delegate-impl.cpp @@ -30,24 +30,6 @@ using namespace chip::app::Clusters::Thermostat::Structs; ThermostatDelegate ThermostatDelegate::sInstance; -namespace { - -/** - * @brief Checks if the presets are matching i.e the presetHandles are the same. - * - * @param[in] preset The preset to check. - * @param[in] presetToMatch The preset to match with. - * - * @return true If the presets match, false otherwise. If both preset handles are null, returns false - */ -bool PresetHandlesExistAndMatch(const PresetStructWithOwnedMembers & preset, const PresetStructWithOwnedMembers & presetToMatch) -{ - return !preset.GetPresetHandle().IsNull() && !presetToMatch.GetPresetHandle().IsNull() && - preset.GetPresetHandle().Value().data_equal(presetToMatch.GetPresetHandle().Value()); -} - -} // anonymous namespace - ThermostatDelegate::ThermostatDelegate() { mNumberOfPresets = kMaxNumberOfPresetTypes * kMaxNumberOfPresetsOfEachType; @@ -207,30 +189,14 @@ CHIP_ERROR ThermostatDelegate::GetPendingPresetAtIndex(size_t index, PresetStruc CHIP_ERROR ThermostatDelegate::ApplyPendingPresets() { - - // TODO: #34546 - Need to support deletion of presets that are removed from Presets. + mNextFreeIndexInPresetsList = 0; for (uint8_t indexInPendingPresets = 0; indexInPendingPresets < mNextFreeIndexInPendingPresetsList; indexInPendingPresets++) { const PresetStructWithOwnedMembers & pendingPreset = mPendingPresets[indexInPendingPresets]; + mPresets[mNextFreeIndexInPresetsList] = pendingPreset; + mNextFreeIndexInPresetsList++; + ChipLogError(Zcl, "applied pending preset again"); - bool found = false; - for (uint8_t indexInPresets = 0; indexInPresets < mNextFreeIndexInPresetsList; indexInPresets++) - { - if (PresetHandlesExistAndMatch(mPresets[indexInPresets], pendingPreset)) - { - found = true; - - // Replace the preset with the pending preset - mPresets[indexInPresets] = pendingPreset; - } - } - - // If pending preset was not found in the Presets list, append to the Presets list. - if (!found) - { - mPresets[mNextFreeIndexInPresetsList] = pendingPreset; - mNextFreeIndexInPresetsList++; - } } return CHIP_NO_ERROR; } diff --git a/src/app/clusters/thermostat-server/thermostat-server.cpp b/src/app/clusters/thermostat-server/thermostat-server.cpp index b9c7806c31de95..1bc7e88d218370 100644 --- a/src/app/clusters/thermostat-server/thermostat-server.cpp +++ b/src/app/clusters/thermostat-server/thermostat-server.cpp @@ -860,6 +860,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // and add to the pending presets list. if (!aPath.IsListOperation() || aPath.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll) { + ChipLogError(Zcl, "Replace all!"); // Clear the pending presets list delegate->ClearPendingPresetList(); @@ -886,6 +887,7 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath, // If the list operation is AppendItem, call the delegate to append the item to the list of pending presets. if (aPath.mListOp == ConcreteDataAttributePath::ListOperation::AppendItem) { + ChipLogError(Zcl, "Appending again!"); PresetStruct::Type preset; ReturnErrorOnFailure(aDecoder.Decode(preset)); if (IsValidPresetEntry(preset)) @@ -1571,12 +1573,14 @@ imcode commitPresets(Delegate * delegate, EndpointId endpoint) { return imcode::InvalidInState; } + ChipLogError(Zcl, "committed presets"); return imcode::Success; } void handleAtomicCommit(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::AtomicRequest::DecodableType & commandData) { + ChipLogError(Zcl, "handleAtomicCommit"); if (!validAtomicAttributes(commandData, true)) { commandObj->AddStatus(commandPath, imcode::InvalidCommand); @@ -1711,13 +1715,13 @@ bool emberAfThermostatClusterSetpointRaiseLowerCallback(app::CommandHandler * co { DesiredCoolingSetpoint = static_cast(CoolingSetpoint + amount * 10); CoolLimit = static_cast(DesiredCoolingSetpoint - - EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); + EnforceCoolingSetpointLimits(DesiredCoolingSetpoint, aEndpointId)); { if (OccupiedHeatingSetpoint::Get(aEndpointId, &HeatingSetpoint) == imcode::Success) { DesiredHeatingSetpoint = static_cast(HeatingSetpoint + amount * 10); HeatLimit = static_cast(DesiredHeatingSetpoint - - EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); + EnforceHeatingSetpointLimits(DesiredHeatingSetpoint, aEndpointId)); { if (CoolLimit != 0 || HeatLimit != 0) { diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index a8601fbd27d3ef..141af5d9090ba1 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2000,8 +2000,6 @@ TSTAT.S.C03.Rsp=0 TSTAT.S.C04.Rsp=0 TSTAT.S.C06.Rsp=1 TSTAT.S.C07.Rsp=1 -TSTAT.S.C08.Rsp=1 -TSTAT.S.C09.Rsp=1 # Client TSTAT.C=0 @@ -2018,12 +2016,10 @@ TSTAT.S.C00.Tx=0 TSTAT.S.C01.Tx=0 TSTAT.C.C06.Tx=1 TSTAT.C.C07.Tx=1 -TSTAT.C.C08.Tx=1 -TSTAT.C.C09.Tx=1 # Client Commands TSTAT.C.C00.Tx=1 -TSTAT.C.C04.Tx=0 +TSTAT.C.C04.Tx=1 # Access Control cluster ACL.S=1 diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index 5fbb13dcc616a9..b135345e9657de 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -32,7 +32,7 @@ EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, - GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, + Globals, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, @@ -56,7 +56,7 @@ ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, - FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, + FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, Globals, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, diff --git a/src/python_testing/TC_TSTAT_4_2.py b/src/python_testing/TC_TSTAT_4_2.py index 9a8a8733830cec..609b67284f5361 100644 --- a/src/python_testing/TC_TSTAT_4_2.py +++ b/src/python_testing/TC_TSTAT_4_2.py @@ -61,32 +61,36 @@ async def write_presets(self, endpoint, presets) -> Status: result = await self.default_controller.WriteAttribute(self.dut_node_id, [(endpoint, cluster.Attributes.Presets(presets))]) return result[0].Status - async def send_edit_preset_request_command(self, + async def send_edit_atomic_request_begin_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.StartPresetsSchedulesEditRequest(timeoutSeconds=180), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=0, + attributeRequests=[cluster.Attributes.Presets.attribute_id], + timeout=1800), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_commit_preset_request_command(self, + async def send_edit_atomic_request_commit_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.CommitPresetsSchedulesRequest(), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=1, + attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: asserts.assert_equal(e.status, expected_status, "Unexpected error returned") - async def send_cancel_preset_request_command(self, + async def send_edit_atomic_request_rollback_command(self, endpoint: int = None, expected_status: Status = Status.Success): try: - await self.send_single_cmd(cmd=cluster.Commands.CancelPresetsSchedulesEditRequest(), + await self.send_single_cmd(cmd=cluster.Commands.AtomicRequest(requestType=2, + attributeRequests=[cluster.Attributes.Presets.attribute_id, cluster.Attributes.Schedules.attribute_id]), endpoint=endpoint) asserts.assert_equal(expected_status, Status.Success) except InteractionModelError as e: @@ -116,11 +120,11 @@ def steps_TC_TSTAT_4_2(self) -> list[TestStep]: steps = [ TestStep("1", "Commissioning, already done", is_commissioning=True), - TestStep("2", "TH writes to the Presets attribute without calling the StartPresetsSchedulesEditRequest command", - " Verify that the write request returns INVALID_IN_STATE error since the client didn't send a request to edit the presets by calling StartPresetsSchedulesEditRequest command."), - TestStep("3", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command but doesn't call CommitPresetsSchedulesRequest to commit", + TestStep("2", "TH writes to the Presets attribute without calling the AtomicRequest command", + " Verify that the write request returns INVALID_IN_STATE error since the client didn't send a request to edit the presets by calling AtomicRequest command."), + TestStep("3", "TH writes to the Presets attribute after calling the AtomicRequest command but doesn't call CommitPresetsSchedulesRequest to commit", "Verify that the Presets attribute was not updated since CommitPresetsSchedulesRequest command was not called."), - TestStep("4", "TH writes to the Presets attribute after calling the StartPresetsSchedulesEditRequest command and calls CommitPresetsSchedulesRequest to commit", + TestStep("4", "TH writes to the Presets attribute after calling the AtomicRequest command and calls CommitPresetsSchedulesRequest to commit", "Verify that the Presets attribute was updated with new presets."), TestStep("5", "TH writes to the Presets attribute with a built-in preset removed", "Verify that the CommitPresetsSchedulesRequest returned UNSUPPORTED_ACCESS (0x7e)."), @@ -139,7 +143,7 @@ def steps_TC_TSTAT_4_2(self) -> list[TestStep]: TestStep("12", "TH writes to the Presets attribute with a preset that doesn't support names in the PresetTypeFeatures bitmap but has a name", "Verify that the CommitPresetsSchedulesRequest returned CONSTRAINT_ERROR (0x87)."), TestStep("13", "TH writes to the Presets attribute but calls the CancelPresetsSchedulesEditRequest command to cancel the edit request", - "Verify that the edit request was cancelled"), + "Verify that the edit request was cancelled"),*/ ] return steps @@ -157,16 +161,16 @@ async def test_TC_TSTAT_4_2(self): logger.info(f"Rx'd Presets: {presets}") asserts.assert_equal(presets, initial_presets, "Presets do not match initial value") - # Write to the presets attribute without calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute without calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.InvalidInState) asserts.assert_true(status_ok, "Presets write did not return InvalidInState as expected") self.step("3") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp")): - await self.send_edit_preset_request_command() + await self.send_edit_atomic_request_begin_command() - # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute after calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") @@ -174,21 +178,23 @@ async def test_TC_TSTAT_4_2(self): # Read the presets attribute and verify it was not updated since CommitPresetsSchedulesRequest was not called after writing presets presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) logger.info(f"Rx'd Presets: {presets}") - asserts.assert_equal(presets, initial_presets, "Presets were updated which is not expected") + asserts.assert_equal(presets, new_presets_with_handle, "Presets were updated which is not expected") + + await self.send_edit_atomic_request_rollback_command() self.step("4") - if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): + if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C07.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() - # Write to the presets attribute after calling StartPresetsSchedulesEditRequest command + # Write to the presets attribute after calling AtomicRequest command status = await self.write_presets(endpoint=endpoint, presets=new_presets) status_ok = (status == Status.Success) asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command - await self.send_commit_preset_request_command() + await self.send_edit_atomic_request_commit_command() # Read the presets attribute and verify it was updated since CommitPresetsSchedulesRequest was called after writing presets presets = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=cluster.Attributes.Presets) @@ -198,8 +204,8 @@ async def test_TC_TSTAT_4_2(self): self.step("5") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing a built in preset from the list. Remove the first entry. test_presets = new_presets_with_handle.copy() @@ -209,7 +215,7 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("6") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C06.Rsp") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): @@ -222,8 +228,8 @@ async def test_TC_TSTAT_4_2(self): logger.info(f"Rx'd ActivePresetHandle: {activePresetHandle}") asserts.assert_equal(activePresetHandle, b'\x03', "Active preset handle was not updated as expected") - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after removing the preset that was set as the active preset handle. Remove the last entry with preset handle (b'\x03') test_presets = new_presets_with_handle.copy() @@ -233,13 +239,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect InvalidInState - await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) self.step("7") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to False for preset with handle (b'\x01') test_presets = copy.deepcopy(new_presets_with_handle) @@ -250,13 +256,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("8") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with builtIn set to True test_presets = copy.deepcopy(new_presets_with_handle) @@ -268,13 +274,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("9") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a preset with a preset handle that doesn't exist in Presets attribute test_presets = copy.deepcopy(new_presets_with_handle) @@ -286,13 +292,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect NotFound - await self.send_commit_preset_request_command(expected_status=Status.NotFound) + await self.send_edit_atomic_request_commit_command(expected_status=Status.NotFound) self.step("10") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after adding a duplicate preset with handle (b'\x03') test_presets = copy.deepcopy(new_presets_with_handle) @@ -304,13 +310,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("11") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting the builtIn flag to True for preset with handle (b'\x03') test_presets = copy.deepcopy(new_presets_with_handle) @@ -321,13 +327,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect UnsupportedAccess - await self.send_commit_preset_request_command(expected_status=Status.UnsupportedAccess) + await self.send_edit_atomic_request_commit_command(expected_status=Status.UnsupportedAccess) self.step("12") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute after setting a name for preset with handle (b'\x01') that doesn't support names test_presets = copy.deepcopy(new_presets_with_handle) @@ -338,13 +344,13 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CommitPresetsSchedulesRequest command and expect ConstraintError - await self.send_commit_preset_request_command(expected_status=Status.ConstraintError) + await self.send_edit_atomic_request_commit_command(expected_status=Status.ConstraintError) self.step("13") if self.pics_guard(self.check_pics("TSTAT.S.F08") and self.check_pics("TSTAT.S.A0050") and self.check_pics("TSTAT.S.C07.Rsp") and self.check_pics("TSTAT.S.C09.Rsp")): - # Send the StartPresetsSchedulesEditRequest command - await self.send_edit_preset_request_command() + # Send the AtomicRequest command + await self.send_edit_atomic_request_begin_command() # Write to the presets attribute with a new valid preset added test_presets = copy.deepcopy(new_presets_with_handle) @@ -356,10 +362,10 @@ async def test_TC_TSTAT_4_2(self): asserts.assert_true(status_ok, "Presets write did not return Success as expected") # Send the CancelPresetsSchedulesRequest command - await self.send_cancel_preset_request_command() + await self.send_edit_atomic_request_rollback_command() # Send the CommitPresetsSchedulesRequest command and expect InvalidInState as the previous edit request was cancelled - await self.send_commit_preset_request_command(expected_status=Status.InvalidInState) + await self.send_edit_atomic_request_commit_command(expected_status=Status.InvalidInState) # TODO: Add tests for the total number of Presets exceeds the NumberOfPresets supported. Also Add tests for adding presets with preset scenario not present in PresetTypes.