Updates to AVSUM 2.3, 2.4, 2.5, and 2.6 to reflect review comments and test case update (#39066)
* Updates to AVSUM 2.3 and 2.4 to reflect review comments and test case update
* Restyled by autopep8
* Update AVSUM 2.4 and AVSUM 2.5 to address raised issues
* Update AVSUM 2.6 to address issues raised on TP review
* Restyled by autopep8
* Handle method name change -> save_preset_command
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/python_testing/TC_AVSUMTestBase.py b/src/python_testing/TC_AVSUMTestBase.py
index 33f03759..875695d 100644
--- a/src/python_testing/TC_AVSUMTestBase.py
+++ b/src/python_testing/TC_AVSUMTestBase.py
@@ -79,7 +79,7 @@
asserts.assert_equal(value, expected_value,
f"Unexpected '{attribute}' value - expected {expected_value}, was {value}")
- async def send_save_presets_command(self, endpoint, name: str, presetID: int = None, expected_status: Status = Status.Success):
+ async def send_save_preset_command(self, endpoint, name: str, presetID: int = None, expected_status: Status = Status.Success):
try:
await self.send_single_cmd(cmd=Clusters.CameraAvSettingsUserLevelManagement.Commands.MPTZSavePreset(
name=name,
@@ -175,6 +175,18 @@
panDelta = tiltDelta = None
await self.send_mptz_relative_move_command(endpoint, panDelta, tiltDelta, zoomDelta, expected_status)
+ async def send_null_mptz_relative_move_command(self, endpoint, expected_status: Status = Status.Success):
+ panDelta = tiltDelta = zoomDelta = None
+ try:
+ await self.send_single_cmd(cmd=Clusters.CameraAvSettingsUserLevelManagement.Commands.MPTZRelativeMove(
+ panDelta=panDelta, tiltDelta=tiltDelta, zoomDelta=zoomDelta),
+ 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_mptz_relative_move_command(self, endpoint, panDelta, tiltDelta, zoomDelta, expected_status: Status = Status.Success):
try:
await self.send_single_cmd(cmd=Clusters.CameraAvSettingsUserLevelManagement.Commands.MPTZRelativeMove(
diff --git a/src/python_testing/TC_AVSUM_2_1.py b/src/python_testing/TC_AVSUM_2_1.py
index 74253e1..e4f43bd 100644
--- a/src/python_testing/TC_AVSUM_2_1.py
+++ b/src/python_testing/TC_AVSUM_2_1.py
@@ -158,7 +158,7 @@
"MaxPresets attribute is a mandatory attribute if MPRESETS.")
# For now force a preset to be present so there is something to read
- await self.send_save_presets_command(endpoint, name="newpreset")
+ await self.send_save_preset_command(endpoint, name="newpreset")
max_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MaxPresets)
diff --git a/src/python_testing/TC_AVSUM_2_3.py b/src/python_testing/TC_AVSUM_2_3.py
index ec3ca97..2f6afff 100644
--- a/src/python_testing/TC_AVSUM_2_3.py
+++ b/src/python_testing/TC_AVSUM_2_3.py
@@ -28,6 +28,7 @@
# --discriminator 1234
# --passcode 20202021
# --PICS src/app/tests/suites/certification/ci-pics-values
+# --bool-arg PIXIT.CANBEMADEBUSY:False
# --trace-to json:${TRACE_TEST_JSON}.json
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto
# --endpoint 1
@@ -38,6 +39,7 @@
import random
import chip.clusters as Clusters
+from chip.interaction_model import Status
from chip.testing.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, run_if_endpoint_matches
from mobly import asserts
from TC_AVSUMTestBase import AVSUMTestBase
@@ -52,27 +54,32 @@
steps = [
TestStep(1, "Commissioning, already done", is_commissioning=True),
TestStep(2, "Read and verify MPTZPosition attribute."),
- TestStep(3, "If Pan is supported, read and verify PanMin and PanMax attributes. If not skip to step 10"),
- TestStep(4, "Create a valid value for a Pan, calculate the relative distance from the current Pan."),
- TestStep(5, "Set via MPTZRelativeMove command the relative Pan. Verify success response."),
- TestStep(6, "Read MPTZPosition. Verify the Pan value is that set in Step 5."),
- TestStep(7, "Create an invalid value for a relative Pan that would exceed PanMax."),
- TestStep(8, "Set via MPTZSetRelativeMove command the relative Pan. Verify success response."),
- TestStep(9, "Read MPTZPosition. Verify the Pan value is set to PanMax."),
- TestStep(10, "If Tilt is supported, read and verify TiltMin and TiltMax attributes. If not skip to step 17"),
- TestStep(11, "Create a valid value for a Tilt, calculate the relative distance from the current Tilt."),
- TestStep(12, "Set via MPTZRelativeMove command the relative Tilt. Verify success response."),
- TestStep(13, "Read MPTZPosition. Verify the Tilt value is that set in Step 12."),
- TestStep(14, "Create an invalid value for a relative Tilt that would exceed TiltMax."),
- TestStep(15, "Set via MPTZSetRelativeMove command the relative Tilt. Verify success response."),
- TestStep(16, "Read MPTZPosition. Verify the Tilt value is set to TiltMax."),
- TestStep(17, "If Zoom is supported, read and verify the ZoomMax attribute."),
- TestStep(18, "Create a valid value for a Zoom, calculate the relative distance from the current Zoom."),
- TestStep(19, "Set via MPTZRelativeMove command the relative Zoom. Verify success response."),
- TestStep(20, "Read MPTZPosition. Verify the Zoom value is that set in Step 19."),
- TestStep(21, "Create an invalid value for a relative Zoom that would exceed ZoomMax."),
- TestStep(22, "Set via MPTZSetRelativeMove command the relative Zoom. Verify success response."),
- TestStep(23, "Read MPTZPosition. Verify the Zoom value is set to ZoomMax."),
+ TestStep(3, "Send an MPTZRelativeMove command with no fields. Verify failure response"),
+ TestStep(4, "If Pan is supported, read and verify the PanMin attribute. If not skip to step 14"),
+ TestStep(5, "Read and verify the PanMax attribute."),
+ TestStep(6, "Create a valid value for a Pan, calculate the relative distance from the current Pan."),
+ TestStep(7, "Set via MPTZRelativeMove command the relative Pan. Verify success response."),
+ TestStep(8, "Read MPTZPosition. Verify the Pan value is that set in Step 6."),
+ TestStep(9, "Create an invalid value for a relative Pan that would exceed PanMax."),
+ TestStep(10, "Set via MPTZSetRelativeMove command the invalid relative Pan. Verify success response."),
+ TestStep(11, "Read MPTZPosition. Verify the Pan value is set to PanMax."),
+ TestStep(12, "If Tilt is supported, read and verify the TiltMin attribute. If not skip to step 22"),
+ TestStep(13, "Read and verify the TiltMax attribute."),
+ TestStep(14, "Create a valid value for a Tilt, calculate the relative distance from the current Tilt."),
+ TestStep(15, "Set via MPTZRelativeMove command the relative Tilt. Verify success response."),
+ TestStep(16, "Read MPTZPosition. Verify the Tilt value is that set in Step 17."),
+ TestStep(17, "Create an invalid value for a relative Tilt that would exceed TiltMax."),
+ TestStep(18, "Set via MPTZSetRelativeMove command the relative Tilt. Verify success response."),
+ TestStep(19, "Read MPTZPosition. Verify the Tilt value is set to TiltMax."),
+ TestStep(20, "If Zoom is supported, read and verify the ZoomMax attribute."),
+ TestStep(21, "Create a valid value for a Zoom, calculate the relative distance from the current Zoom."),
+ TestStep(22, "Set via MPTZRelativeMove command the relative Zoom. Verify success response."),
+ TestStep(23, "Read MPTZPosition. Verify the Zoom value is that set in Step 24."),
+ TestStep(24, "Create an invalid value for a relative Zoom that would exceed ZoomMax."),
+ TestStep(25, "Set via MPTZSetRelativeMove command the relative Zoom. Verify success response."),
+ TestStep(26, "Read MPTZPosition. Verify the Zoom value is set to ZoomMax."),
+ TestStep(27, "If PIXIT.CANBEMADEBUSY is set, place the DUT into a state where it cannot accept a command. Else end the test cse."),
+ TestStep(28, "Send an MPTZRelativeMove Command with any previously set relative value. Verify busy failure response."),
]
return steps
@@ -107,21 +114,27 @@
initialTilt = mptzposition_dut.tilt
initialZoom = mptzposition_dut.zoom
+ self.step(3)
+ await self.send_null_mptz_relative_move_command(endpoint, expected_status=Status.InvalidCommand)
+
+ relativePan = relativeTilt = relativeZoom = None
+
if self.has_feature_mpan:
- self.step(3)
+ self.step(4)
asserts.assert_in(attributes.PanMin.attribute_id, attribute_list,
"PanMin attribute is a mandatory attribute if MPAN.")
pan_min_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.PanMin)
asserts.assert_less_equal(pan_min_dut, 179, "PanMin is not in valid range.")
asserts.assert_greater_equal(pan_min_dut, -180, "PanMin is not in valid range.")
+ self.step(5)
asserts.assert_in(attributes.PanMax.attribute_id, attribute_list,
"PanMax attribute is a mandatory attribute if MPAN.")
pan_max_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.PanMax)
asserts.assert_less_equal(pan_max_dut, 180, "PanMax is not in valid range.")
asserts.assert_greater_equal(pan_max_dut, -179, "PanMax is not in valid range.")
- self.step(4)
+ self.step(6)
# Create new Value for Pan
while True:
newPan = random.randint(pan_min_dut+1, pan_max_dut)
@@ -131,49 +144,51 @@
# Calulate the difference, this is the relative move
relativePan = abs(initialPan - newPan) if (initialPan < newPan) else -abs(newPan - initialPan)
- self.step(5)
+ self.step(7)
# Invoke the command with the new Pan value
await self.send_mptz_relative_move_pan_command(endpoint, relativePan)
- self.step(6)
+ self.step(8)
# Read the attribute back and make sure it was set
newpan_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newpan_mptzposition_dut.pan, newPan, "Received Pan does not match set Pan")
- self.step(7)
+ self.step(9)
# Create an out of range value for Pan, verify it's clipped to PanMax
newPanFail = abs(pan_max_dut - pan_min_dut)
- self.step(8)
+ self.step(10)
await self.send_mptz_relative_move_pan_command(endpoint, newPanFail)
- self.step(9)
+ self.step(11)
newpan_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newpan_mptzposition_dut.pan, pan_max_dut, "Received Pan does not match PanMax")
else:
- self.skip_step(3)
self.skip_step(4)
self.skip_step(5)
self.skip_step(6)
self.skip_step(7)
self.skip_step(8)
self.skip_step(9)
+ self.skip_step(10)
+ self.skip_step(11)
if self.has_feature_mtilt:
- self.step(10)
+ self.step(12)
asserts.assert_in(attributes.TiltMin.attribute_id, attribute_list,
"TiltMin attribute is a mandatory attribute if MTILT.")
tilt_min_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.TiltMin)
asserts.assert_less_equal(tilt_min_dut, 179, "TiltMin is not in valid range.")
asserts.assert_greater_equal(tilt_min_dut, -180, "TiltMin is not in valid range.")
+ self.step(13)
asserts.assert_in(attributes.TiltMax.attribute_id, attribute_list,
"TiltMax attribute is a mandatory attribute if MTILT.")
tilt_max_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.TiltMax)
asserts.assert_less_equal(tilt_max_dut, 180, "TiltMax is not in valid range.")
asserts.assert_greater_equal(tilt_max_dut, -179, "TiltMax is not in valid range.")
- self.step(11)
+ self.step(14)
# Create new Value for Tilt
while True:
newTilt = random.randint(tilt_min_dut+1, tilt_max_dut)
@@ -182,43 +197,44 @@
relativeTilt = abs(initialTilt - newTilt) if (initialTilt < newTilt) else -abs(newTilt - initialTilt)
- self.step(12)
+ self.step(15)
# Invoke the command with the new Tilt value
await self.send_mptz_relative_move_tilt_command(endpoint, relativeTilt)
- self.step(13)
+ self.step(16)
# Read the attribute back and make sure it was set
newtilt_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newtilt_mptzposition_dut.tilt, newTilt, "Received Tilt does not match set Tilt")
- self.step(14)
+ self.step(17)
# Create an out of range value for Tilt, verify it's clipped to TiltMax
newTiltFail = abs(tilt_max_dut - tilt_min_dut)
- self.step(15)
+ self.step(18)
await self.send_mptz_relative_move_tilt_command(endpoint, newTiltFail)
- self.step(16)
+ self.step(19)
newtilt_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newtilt_mptzposition_dut.tilt, tilt_max_dut, "Received Tilt does not match TiltMax")
else:
- self.skip_step(10)
- self.skip_step(11)
self.skip_step(12)
self.skip_step(13)
self.skip_step(14)
self.skip_step(15)
self.skip_step(16)
+ self.skip_step(17)
+ self.skip_step(18)
+ self.skip_step(19)
if self.has_feature_mzoom:
- self.step(17)
+ self.step(20)
asserts.assert_in(attributes.ZoomMax.attribute_id, attribute_list,
"ZoomMax attribute is a mandatory attribute if MZOOM.")
zoom_max_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.ZoomMax)
asserts.assert_less_equal(zoom_max_dut, 100, "ZoomMax is not in valid range.")
asserts.assert_greater_equal(zoom_max_dut, 2, "ZoomMax is not in valid range.")
- self.step(18)
+ self.step(21)
# Create new Value for Zoom
while True:
newZoom = random.randint(2, zoom_max_dut)
@@ -227,33 +243,46 @@
relativeZoom = abs(initialZoom - newZoom) if (initialZoom < newZoom) else -abs(newZoom - initialZoom)
- self.step(19)
+ self.step(22)
# Invoke the command with the new Zoom value
await self.send_mptz_relative_move_zoom_command(endpoint, relativeZoom)
- self.step(20)
+ self.step(23)
# Read the attribute back and make sure it was set
newzoom_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newzoom_mptzposition_dut.zoom, newZoom, "Received Zoom does not match set Zoom")
- self.step(21)
+ self.step(24)
# Create an out of range value for Zoom, verify it's clipped to ZoomMax
newZoomFail = zoom_max_dut - 1
- self.step(22)
+ self.step(25)
await self.send_mptz_relative_move_zoom_command(endpoint, newZoomFail)
- self.step(23)
+ self.step(26)
newzoom_mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
asserts.assert_equal(newzoom_mptzposition_dut.zoom, zoom_max_dut, "Received Zoom does not match ZoomMax")
else:
- self.skip_step(17)
- self.skip_step(18)
- self.skip_step(19)
self.skip_step(20)
self.skip_step(21)
self.skip_step(22)
self.skip_step(23)
+ self.skip_step(24)
+ self.skip_step(25)
+ self.skip_step(26)
+
+ self.step(27)
+ # PIXIT check
+ canbemadebusy = self.user_params.get("PIXIT.CANBEMADEBUSY", False)
+
+ if canbemadebusy:
+ self.step(28)
+ # Busy response check
+ if not self.is_ci:
+ self.wait_for_user_input(prompt_msg="Place device into a busy state. Hit ENTER once ready.")
+ await self.send_mptz_relative_move_command(endpoint, relativePan, relativeTilt, relativeZoom, expected_status=Status.Busy)
+ else:
+ self.skip_step(28)
if __name__ == "__main__":
diff --git a/src/python_testing/TC_AVSUM_2_4.py b/src/python_testing/TC_AVSUM_2_4.py
index a3ef9ae..1d464e0 100644
--- a/src/python_testing/TC_AVSUM_2_4.py
+++ b/src/python_testing/TC_AVSUM_2_4.py
@@ -36,6 +36,7 @@
# === END CI TEST ARGUMENTS ===
import chip.clusters as Clusters
+from chip.interaction_model import Status
from chip.testing.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_feature, run_if_endpoint_matches
from mobly import asserts
from TC_AVSUMTestBase import AVSUMTestBase
@@ -61,15 +62,21 @@
TestStep(1, "Commissioning, already done", is_commissioning=True),
TestStep(2, "Read the value of MaxPresets, fail if unsupported."),
TestStep(3, "Read the value of MPTZPresets, fail if unsupported"),
- TestStep(4, "If MPTZPresets is empty, jump to step 9"),
- TestStep(5, "Verify that the size of the Presets List is not greater than MaxPresets"),
- TestStep(6, "Loop over the supported presets, for each verify the PresetID and Name are in range"),
- TestStep(7, "For each found preset, invoke MoveToPreset with the PresetID. Verify that the MPTZPosition is that from the Preset"),
- TestStep(8, "Exit the testcase"),
- TestStep(9, "Create a new saved preset with PresetID of MaxPresets"),
- TestStep(10, "Move to a new MPTZPosition that is the mid-point of all support PTZ attributes"),
- TestStep(11, "Move to the newly saved preset"),
- TestStep(12, "Verify that the MPTZPosition is that of the preset"),
+ TestStep(4, "Send a MPTZMovePreset command with a presetID of MaxPresets+1. Verify Constraint Error failure response."),
+ TestStep(5, "If MPTZPresets is empty, jump to step 11"),
+ TestStep(6, "Verify that the size of the Presets List is not greater than MaxPresets"),
+ TestStep(7, "Loop over the supported presets, for each verify the PresetID and Name are in range"),
+ TestStep(8, "For each found preset, invoke MoveToPreset with the PresetID. Verify that the MPTZPosition is that from the Preset"),
+ TestStep(9, "If PIXIT.CANBEMADEBUSY is set, place the DUT into a state where it cannot accept a command. Else exit the test case."),
+ TestStep(10, "Send an MPTZMoveToPreset Command with a valid presetID. Verify busy failure response. End the text case"),
+ TestStep(11, "Send a MPTZMovePreset command with a presetID of MaxPresets. Verify Not Found failure response."),
+ TestStep(12, "Create a new saved preset with PresetID of MaxPresets"),
+ TestStep(13, "Create a new MPTZPosition that is the mid-point of all support PTZ attributes"),
+ TestStep(14, "Move to a the MPTZPosition created in step 13."),
+ TestStep(15, "Move to the saved preset from step 12"),
+ TestStep(16, "Verify that the MPTZPosition is that of the preset"),
+ TestStep(17, "If PIXIT.CANBEMADEBUSY is set, place the DUT into a state where it cannot accept a command. Else exit the test case."),
+ TestStep(18, "Send an MPTZMoveToPreset Command with a valid presetID. Verify busy failure response."),
]
return steps
@@ -85,6 +92,8 @@
cluster = Clusters.Objects.CameraAvSettingsUserLevelManagement
attributes = cluster.Attributes
endpoint = self.get_endpoint(default=1)
+ # PIXIT check
+ canbemadebusy = self.user_params.get("PIXIT.CANBEMADEBUSY", False)
tilt_min_dut = tilt_max_dut = pan_min_dut = pan_max_dut = zoom_max_dut = None
@@ -125,13 +134,16 @@
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
self.step(4)
+ await self.send_move_to_preset_command(endpoint, max_presets_dut+1, expected_status=Status.ConstraintError)
+
+ self.step(5)
if mptz_presets_dut:
- self.step(5)
+ self.step(6)
asserts.assert_less_equal(len(mptz_presets_dut), max_presets_dut,
"MPTZPresets size is greater than the allowed max.")
- self.step(6)
self.step(7)
+ self.step(8)
for mptzpreset in mptz_presets_dut:
asserts.assert_less_equal(mptzpreset.presetID, max_presets_dut, "PresetID is out of range")
asserts.assert_less_equal(len(mptzpreset.name), 32, "Preset name is too long")
@@ -141,17 +153,33 @@
await self.send_move_to_preset_command(endpoint, mptzpreset.presetID)
mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
self.verify_preset_matches(mptzpreset, mptzposition_dut)
- self.step(8)
- self.skip_all_remaining_tests(9)
+
+ self.step(9)
+ if canbemadebusy:
+ self.step(10)
+ # Busy response check
+ if not self.is_ci:
+ self.wait_for_user_input(prompt_msg="Place device into a busy state. Hit ENTER once ready.")
+ await self.send_move_to_preset_command(endpoint, mptz_presets_dut[0].presetID, expected_status=Status.Busy)
+ else:
+ self.skip_step(10)
+ self.skip_all_remaining_steps(11)
else:
- self.skip_step(5)
self.skip_step(6)
self.skip_step(7)
self.skip_step(8)
- self.step(9)
+ self.skip_step(9)
+ self.skip_step(10)
+ self.step(11)
+ # Empty list, expect Not Found
+ await self.send_move_to_preset_command(endpoint, max_presets_dut, expected_status=Status.NotFound)
+
# For now force a preset to be present so there is something to read
- await self.send_save_presets_command(endpoint, name="newpreset", presetID=max_presets_dut)
+ self.step(12)
+ await self.send_save_preset_command(endpoint, name="newpreset", presetID=max_presets_dut)
stored_preset = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
+
+ self.step(13)
newPan = newTilt = newZoom = None
if self.has_feature_mpan:
newPan = (pan_max_dut - pan_min_dut)//2
@@ -160,16 +188,26 @@
if self.has_feature_mzoom:
newZoom = (zoom_max_dut)//2
- self.step(10)
+ self.step(14)
await self.send_mptz_set_position_command(endpoint, newPan, newTilt, newZoom)
- self.step(11)
+ self.step(15)
await self.send_move_to_preset_command(endpoint, max_presets_dut)
mptzposition_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPosition)
- self.step(12)
+ self.step(16)
self.verify_preset_matches(stored_preset[0], mptzposition_dut)
+ self.step(17)
+ if canbemadebusy:
+ self.step(18)
+ # Busy response check
+ if not self.is_ci:
+ self.wait_for_user_input(prompt_msg="Place device into a busy state. Hit ENTER once ready.")
+ await self.send_move_to_preset_command(endpoint, max_presets_dut, expected_status=Status.Busy)
+ else:
+ self.skip_step(18)
+
if __name__ == "__main__":
default_matter_test_main()
diff --git a/src/python_testing/TC_AVSUM_2_5.py b/src/python_testing/TC_AVSUM_2_5.py
index 767d158..e437ebd 100644
--- a/src/python_testing/TC_AVSUM_2_5.py
+++ b/src/python_testing/TC_AVSUM_2_5.py
@@ -36,6 +36,7 @@
# === END CI TEST ARGUMENTS ===
import chip.clusters as Clusters
+from chip.interaction_model import Status
from chip.testing.matter_testing import MatterBaseTest, TestStep, default_matter_test_main, has_feature, run_if_endpoint_matches
from mobly import asserts
from TC_AVSUMTestBase import AVSUMTestBase
@@ -55,9 +56,11 @@
TestStep(5, "If the size of MPTZPresets is greater than MaxPresets, fail"),
TestStep(6, "Via the MPTZSavePreset command, create a new saved preset with PresetID of MaxPresets, name of 'newpreset'"),
TestStep(7, "Read the value of MPTZPresets. Ensure it has an entry for a PresetID of MaxPresets with a name 'newpreset' that matches the saved MPTZPosition"),
- TestStep(8, "Verify there is space in the preset list, if not, end the test case"),
- TestStep(9, "save a new Preset via the MPTZSavePreset command, name 'newpreset-2', do not provide a PresetID"),
+ TestStep(8, "Verify there is space in the preset list, if not, skip to step 12"),
+ TestStep(9, "Save a new Preset via the MPTZSavePreset command, name 'newpreset-2', do not provide a PresetID"),
TestStep(10, "Read the value of MPTZPresets. Ensure it has an entry with a name 'newpreset-2' that matches the saved MPTZPosition"),
+ TestStep(11, "Repeatedly send MPTZSavePreset commands till the number of presets equals MaxPresets"),
+ TestStep(12, "Save a new Preset via the MPTZSavePreset command, name 'newpreset-fail', do not provide a PresetID. Verify Resource Exhausted failure. End the test case."),
]
return steps
@@ -97,7 +100,7 @@
self.step(6)
name = "newpreset"
- await self.send_save_presets_command(endpoint, name, presetID=max_presets_dut)
+ await self.send_save_preset_command(endpoint, name, presetID=max_presets_dut)
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
match_found = False
@@ -118,7 +121,7 @@
if len(mptz_presets_dut) < max_presets_dut:
name = "newpreset-2"
self.step(9)
- await self.send_save_presets_command(endpoint, name)
+ await self.send_save_preset_command(endpoint, name)
self.step(10)
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
@@ -134,9 +137,23 @@
if not match_found:
asserts.assert_fail("No matching preset found for saved preset")
+
+ # fill the preset list to its max allowed number of values
+ self.step(11)
+ count = len(mptz_presets_dut)
+ while count < max_presets_dut:
+ name = "newpreset-"+str(count)
+ await self.send_save_preset_command(endpoint, name)
+ count += 1
else:
self.skip_step(9)
self.skip_step(10)
+ self.skip_step(11)
+
+ # presets should now be full
+ name = "newpreset-fail"
+ self.step(12)
+ await self.send_save_preset_command(endpoint, name, expected_status=Status.ResourceExhausted)
if __name__ == "__main__":
diff --git a/src/python_testing/TC_AVSUM_2_6.py b/src/python_testing/TC_AVSUM_2_6.py
index eb36338..6778f39 100644
--- a/src/python_testing/TC_AVSUM_2_6.py
+++ b/src/python_testing/TC_AVSUM_2_6.py
@@ -53,10 +53,14 @@
TestStep(2, "Read the value of MaxPresets, fail if unsupported."),
TestStep(3, "Read the value of MPTZPresets, fail if unsupported"),
TestStep(4, "Send a MPTZRemovePreset for a value larger than MaxPresets, verify failure"),
- TestStep(5, "If MPTZPresets is not empty, send MPTZRemovePreset for the first item in the list. Verify it has been removed. End the test case"),
- TestStep(6, "If MPTZPresets is empty, via the MPTZSavePreset command, create a new saved preset with PresetID of MaxPresets, name of 'newpreset'"),
- TestStep(7, "Read the value of MPTZPresets. Ensure it has an entry for a PresetID of MaxPresets with a name 'newpreset' that matches the saved MPTZPosition"),
- TestStep(8, "Via MPTZRemovePreset remove the saved preset. Verify that this is no longer present in MPTZPresets. "),
+ TestStep(5, "If MPTZPresets is not empty, send MPTZRemovePreset for the first item in the list. Verify it has been removed. Otherwise skip to step 8."),
+ TestStep(6, "Read MPTZPresets, verify the entry has been removed."),
+ TestStep(7, "Repeat step 5, sending a MPTZRemovePreset command for the already removed preset. Verify failurre. End the test case."),
+ TestStep(8, "If MPTZPresets is empty, via the MPTZSavePreset command, create a new saved preset with PresetID of MaxPresets, name of 'newpreset'"),
+ TestStep(9, "Read the value of MPTZPresets. Ensure it has an entry for a PresetID of MaxPresets with a name 'newpreset' that matches the saved MPTZPosition"),
+ TestStep(10, "Via MPTZRemovePreset remove the saved preset."),
+ TestStep(11, "Read MPTZPresets, verify this is empty."),
+ TestStep(12, "Repeat step 10, sending a MPTZRemovePreset command for a PresetID of MaxPresets. Verify failure."),
]
return steps
@@ -89,15 +93,16 @@
self.step(4)
await self.send_remove_preset_command(endpoint, max_presets_dut+1, expected_status=Status.ConstraintError)
- self.step(5)
if mptz_presets_dut:
# Save the presetID of the first preset in the list
presetID = mptz_presets_dut[0].presetID
+ self.step(5)
# Remove that preset
await self.send_remove_preset_command(endpoint, presetID)
# Re-read the attribute
+ self.step(6)
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
notFound = True
for mptzpreset in mptz_presets_dut:
@@ -106,24 +111,38 @@
break
asserts.assert_true(notFound, "Preset not removed despite invocation of MPTZRemovePreset")
- self.skip_all_remaining_steps(6)
+
+ # Repeat removal of already removed value, verify Not Found
+ self.step(7)
+ await self.send_remove_preset_command(endpoint, presetID, expected_status=Status.NotFound)
+
+ self.skip_all_remaining_steps(8)
return
- self.step(6)
+ self.skip_step(5)
+ self.skip_step(6)
+ self.skip_step(7)
+ self.step(8)
# No existing values, create one and then make sure we can delete it
- await self.send_save_presets_command(endpoint, name="newpreset", presetID=max_presets_dut)
+ await self.send_save_preset_command(endpoint, name="newpreset", presetID=max_presets_dut)
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
- self.step(7)
+ self.step(9)
# Verify the first entry is what we sent
asserts.assert_equal(mptz_presets_dut[0].presetID, max_presets_dut, "Saved Preset ID does not natch the provided preset")
- self.step(8)
+ self.step(10)
# Remove and verify empty
await self.send_remove_preset_command(endpoint, max_presets_dut)
mptz_presets_dut = await self.read_avsum_attribute_expect_success(endpoint, attributes.MPTZPresets)
+
+ self.step(11)
asserts.assert_true(not mptz_presets_dut, "Added Preset not removed despite invocation of MPTZRemovePreset")
+ # Repeat removal of already removed value, verify Not Found
+ self.step(12)
+ await self.send_remove_preset_command(endpoint, max_presets_dut, expected_status=Status.NotFound)
+
if __name__ == "__main__":
default_matter_test_main()