Skip to content

Commit 4a6c876

Browse files
committed
Add check DEM feature map step + add event registration step if necessary and renumber test cases
1 parent 0c66ca8 commit 4a6c876

8 files changed

+790
-806
lines changed

src/python_testing/TC_DEM_2_2.py

+114-110
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_3.py

+102-106
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_4.py

+137-133
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_5.py

+107-111
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_6.py

+100-104
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_7.py

+110-114
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_8.py

+100-104
Large diffs are not rendered by default.

src/python_testing/TC_DEM_2_9.py

+20-24
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import logging
3434

3535
import chip.clusters as Clusters
36-
from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main
36+
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
3737
from mobly import asserts
3838
from TC_DEMTestBase import DEMTestBase
3939

@@ -58,18 +58,19 @@ def pics_TC_DEM_2_9(self):
5858
def steps_TC_DEM_2_9(self) -> list[TestStep]:
5959
"""Execute the test steps."""
6060
steps = [
61-
TestStep("1", "Commissioning, already done",
62-
is_commissioning=True),
63-
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.",
64-
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
65-
TestStep("3", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event",
66-
"Verify DUT responds with status SUCCESS(0x00)"),
67-
TestStep("3a", "TH reads Forecast attribute.",
61+
TestStep("1", "Commission DUT to TH (can be skipped if done in a preceding test)"),
62+
TestStep("2", "TH reads from the DUT the _Featuremap_ attribute",
63+
"Verify that the DUT response contains the _Featuremap_ attribute. Verify one of PowerForecastReporting or StateForecastReporting is supported but not both."),
64+
TestStep("3", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
65+
"Value has to be 1 (True)"),
66+
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event",
67+
"Verify DUT responds w/ status SUCCESS(0x00)"),
68+
TestStep("4a", "TH reads from the DUT the Forecast",
6869
"Value has to include a valid slots[0].ManufacturerESAState"),
69-
TestStep("3b", "TH reads Forecast attribute.",
70+
TestStep("4b", "TH reads from the DUT the Forecast",
7071
"Value has to include valid slots[0].NominalPower, slots[0].MinPower, slots[0].MaxPower, slots[0].NominalEnergy"),
71-
TestStep("4", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event Clear",
72-
"Verify DUT responds with status SUCCESS(0x00)"),
72+
TestStep("5", "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to PIXIT.DEM.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.DEM.TEST_EVENT_TRIGGER for Forecast Test Event Clear",
73+
"Verify DUT responds w/ status SUCCESS(0x00)"),
7374
]
7475

7576
return steps
@@ -81,29 +82,24 @@ async def test_TC_DEM_2_9(self):
8182
self.step("1")
8283
# Commission DUT - already done
8384

85+
self.step("2")
8486
await self.validate_pfr_or_sfr_in_feature_map()
8587

86-
# Subscribe to Events and when they are sent push them to a queue for checking later
87-
events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement)
88-
await events_callback.start(self.default_controller,
89-
self.dut_node_id,
90-
self.matter_test_config.endpoint)
91-
92-
self.step("2")
88+
self.step("3")
9389
await self.check_test_event_triggers_enabled()
9490

95-
self.step("3")
91+
self.step("4")
9692
await self.send_test_event_trigger_forecast()
9793

98-
self.step("3a")
94+
self.step("4a")
9995
feature_map = await self.read_dem_attribute_expect_success(attribute="FeatureMap")
10096
if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kStateForecastReporting:
10197
forecast = await self.read_dem_attribute_expect_success(attribute="Forecast")
10298
asserts.assert_is_not_none(forecast.slots[0].manufacturerESAState)
10399
else:
104-
logging.info('Device does not support StateForecastReporting. Skipping step 3a')
100+
logging.info('Device does not support StateForecastReporting. Skipping step 4a')
105101

106-
self.step("3b")
102+
self.step("4b")
107103
if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPowerForecastReporting:
108104
forecast = await self.read_dem_attribute_expect_success(attribute="Forecast")
109105

@@ -112,9 +108,9 @@ async def test_TC_DEM_2_9(self):
112108
asserts.assert_is_not_none(forecast.slots[0].maxPower)
113109
asserts.assert_is_not_none(forecast.slots[0].nominalEnergy)
114110
else:
115-
logging.info('Device does not support StateForecastReporting. Skipping step 3b')
111+
logging.info('Device does not support StateForecastReporting. Skipping step 4b')
116112

117-
self.step("4")
113+
self.step("5")
118114
await self.send_test_event_trigger_forecast_clear()
119115

120116

0 commit comments

Comments
 (0)