Skip to content

Commit

Permalink
Add check DEM feature map step + add event registration step if neces…
Browse files Browse the repository at this point in the history
…sary and renumber test cases
  • Loading branch information
PeterC1965 committed Aug 20, 2024
1 parent 0c66ca8 commit 4a6c876
Show file tree
Hide file tree
Showing 8 changed files with 790 additions and 806 deletions.
224 changes: 114 additions & 110 deletions src/python_testing/TC_DEM_2_2.py

Large diffs are not rendered by default.

208 changes: 102 additions & 106 deletions src/python_testing/TC_DEM_2_3.py

Large diffs are not rendered by default.

270 changes: 137 additions & 133 deletions src/python_testing/TC_DEM_2_4.py

Large diffs are not rendered by default.

218 changes: 107 additions & 111 deletions src/python_testing/TC_DEM_2_5.py

Large diffs are not rendered by default.

204 changes: 100 additions & 104 deletions src/python_testing/TC_DEM_2_6.py

Large diffs are not rendered by default.

224 changes: 110 additions & 114 deletions src/python_testing/TC_DEM_2_7.py

Large diffs are not rendered by default.

204 changes: 100 additions & 104 deletions src/python_testing/TC_DEM_2_8.py

Large diffs are not rendered by default.

44 changes: 20 additions & 24 deletions src/python_testing/TC_DEM_2_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import logging

import chip.clusters as Clusters
from matter_testing_support import EventChangeCallback, MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main
from mobly import asserts
from TC_DEMTestBase import DEMTestBase

Expand All @@ -58,18 +58,19 @@ def pics_TC_DEM_2_9(self):
def steps_TC_DEM_2_9(self) -> list[TestStep]:
"""Execute the test steps."""
steps = [
TestStep("1", "Commissioning, already done",
is_commissioning=True),
TestStep("2", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster.",
"Verify that TestEventTriggersEnabled attribute has a value of 1 (True)"),
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",
"Verify DUT responds with status SUCCESS(0x00)"),
TestStep("3a", "TH reads Forecast attribute.",
TestStep("1", "Commission DUT to TH (can be skipped if done in a preceding test)"),
TestStep("2", "TH reads from the DUT the _Featuremap_ attribute",
"Verify that the DUT response contains the _Featuremap_ attribute. Verify one of PowerForecastReporting or StateForecastReporting is supported but not both."),
TestStep("3", "TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster",
"Value has to be 1 (True)"),
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",
"Verify DUT responds w/ status SUCCESS(0x00)"),
TestStep("4a", "TH reads from the DUT the Forecast",
"Value has to include a valid slots[0].ManufacturerESAState"),
TestStep("3b", "TH reads Forecast attribute.",
TestStep("4b", "TH reads from the DUT the Forecast",
"Value has to include valid slots[0].NominalPower, slots[0].MinPower, slots[0].MaxPower, slots[0].NominalEnergy"),
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",
"Verify DUT responds with status SUCCESS(0x00)"),
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",
"Verify DUT responds w/ status SUCCESS(0x00)"),
]

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

self.step("2")
await self.validate_pfr_or_sfr_in_feature_map()

# Subscribe to Events and when they are sent push them to a queue for checking later
events_callback = EventChangeCallback(Clusters.DeviceEnergyManagement)
await events_callback.start(self.default_controller,
self.dut_node_id,
self.matter_test_config.endpoint)

self.step("2")
self.step("3")
await self.check_test_event_triggers_enabled()

self.step("3")
self.step("4")
await self.send_test_event_trigger_forecast()

self.step("3a")
self.step("4a")
feature_map = await self.read_dem_attribute_expect_success(attribute="FeatureMap")
if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kStateForecastReporting:
forecast = await self.read_dem_attribute_expect_success(attribute="Forecast")
asserts.assert_is_not_none(forecast.slots[0].manufacturerESAState)
else:
logging.info('Device does not support StateForecastReporting. Skipping step 3a')
logging.info('Device does not support StateForecastReporting. Skipping step 4a')

self.step("3b")
self.step("4b")
if feature_map & Clusters.DeviceEnergyManagement.Bitmaps.Feature.kPowerForecastReporting:
forecast = await self.read_dem_attribute_expect_success(attribute="Forecast")

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

self.step("4")
self.step("5")
await self.send_test_event_trigger_forecast_clear()


Expand Down

0 comments on commit 4a6c876

Please sign in to comment.