-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TC-DEMM-1_2 python test #37621
Open
juandediosg
wants to merge
6
commits into
project-chip:master
Choose a base branch
from
juandediosg:TC_DEMM_1_2_PythonTest
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
TC-DEMM-1_2 python test #37621
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ae0c486
Implement TC_DEMM_1_2 with Python
juandediosg f4e8976
Implemented functionality to validate DEMM in tests
juandediosg c40f74c
Update functionality to validate DEMM in tests
juandediosg 3738da4
Fixed: Updated CI test arguments and Removed DEMM Arguments implemeta…
juandediosg 56d2a50
Fixed: Renamed CLUSTER to cluster_demm_mode for clarity.
juandediosg d104bc4
Fixed: Remove 'kDeviceOptimization' tag, leaving only 'kNoOptimizatio…
juandediosg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# | ||
# Copyright (c) 2025 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# === BEGIN CI TEST ARGUMENTS === | ||
# test-runner-runs: | ||
# run1: | ||
# app: ${ALL_CLUSTERS_APP} | ||
# app-args: > | ||
# --discriminator 1234 | ||
# --KVS kvs1 | ||
# --trace-to json:${TRACE_APP}.json | ||
# script-args: > | ||
# --storage-path admin_storage.json | ||
# --commissioning-method on-network | ||
# --discriminator 1234 | ||
# --passcode 20202021 | ||
# --endpoint 1 | ||
# --trace-to json:${TRACE_TEST_JSON}.json | ||
# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto | ||
# factory-reset: true | ||
# quiet: true | ||
# === END CI TEST ARGUMENTS === | ||
|
||
|
||
import chip.clusters as Clusters | ||
from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main | ||
from modebase_cluster_check import ModeBaseClusterChecks | ||
|
||
cluster_demm_mode = Clusters.DeviceEnergyManagementMode | ||
|
||
|
||
class TC_DEMM_1_2(MatterBaseTest, ModeBaseClusterChecks): | ||
|
||
def __init__(self, *args): | ||
MatterBaseTest.__init__(self, *args) | ||
ModeBaseClusterChecks.__init__(self, | ||
modebase_derived_cluster=cluster_demm_mode) | ||
|
||
def desc_TC_DEMM_1_2(self) -> str: | ||
return "[TC-DEMM-1.2] Cluster attributes with DUT as Server" | ||
|
||
def steps_TC_DEMM_1_2(self) -> list[TestStep]: | ||
steps = [ | ||
TestStep(1, "Commissioning, already done", is_commissioning=True), | ||
TestStep(2, "TH reads from the DUT the SupportedModes attribute."), | ||
TestStep(3, "TH reads from the DUT the CurrentMode attribute."), | ||
] | ||
return steps | ||
|
||
def pics_TC_DEMM_1_2(self) -> list[str]: | ||
pics = [ | ||
"DEMM.S" | ||
] | ||
return pics | ||
|
||
@async_test_body | ||
async def test_TC_DEMM_1_2(self): | ||
|
||
# Setup common mode check | ||
endpoint = self.get_endpoint(default=1) | ||
|
||
self.step(1) | ||
|
||
self.step(2) | ||
# Verify common checks for Mode Base as described in the TC-DEMM-1.2 | ||
supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) | ||
# According to the spec, there should be at least on like | ||
# No Optimization, Device Optimization, Local Optimization, or Grid Optimization | ||
# tag in the ones supported. | ||
additional_tags = [cluster_demm_mode.Enums.ModeTag.kNoOptimization, | ||
cluster_demm_mode.Enums.ModeTag.kDeviceOptimization] | ||
self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) | ||
|
||
self.step(3) | ||
# Verify that the CurrentMode attribute has a valid value. | ||
mode = self.cluster.Attributes.CurrentMode | ||
await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) | ||
|
||
|
||
if __name__ == "__main__": | ||
default_matter_test_main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this meant to run against all clusters or the energy management app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed: Updated to run against the energy management app as
app: ${ENERGY_MANAGEMENT_APP}
."