Skip to content
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

Power Topology: add test scripts #32114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bcc8cc4
Initial XML for Power Topology cluster
hasty Jan 25, 2024
c83b8ba
Regen
hasty Jan 25, 2024
2b89532
Restyled really wants newlines at the end of every JSON file
hasty Jan 26, 2024
65fe626
Rename LeafTopology to TreeTopology
hasty Jan 29, 2024
8ecdacc
[Feature] Power Topology server & all-clusters-app stub
hasty Jan 31, 2024
1f084fe
Merge branch 'master' into granbery/power_topology_all_clusters
hasty Feb 7, 2024
ea4e4aa
Make endpointId a constructor arg for PowerTopologyDelegate
hasty Feb 7, 2024
b288048
Change PowerTopologyDelegate to not return std::vectors
hasty Feb 7, 2024
64b7740
Remove unneeded entries in attributeAccessInterfaceAttributes for Pow…
hasty Feb 7, 2024
4011bb7
Typo in python/chip/clusters/__init__.py
hasty Feb 7, 2024
5a8ed23
Format zcl.json
hasty Feb 7, 2024
820ecb2
Add DynamicPowerFlow feature to PowerTopology stub
hasty Feb 7, 2024
3f99452
Merge branch 'master' into granbery/power_topology_all_clusters
hasty Feb 7, 2024
23be5da
Add Power Topology to client
hasty Feb 10, 2024
de3e0a6
Merge branch 'master' into granbery/power_topology_all_clusters
hasty Feb 10, 2024
28768f6
Merge branch 'granbery/power_topology_all_clusters' into granbery/pow…
hasty Feb 10, 2024
87b0b43
Set CI PICS values
hasty Feb 11, 2024
a870594
Python test script for Power Topology
hasty Feb 13, 2024
5904796
Linted python script
hasty Feb 14, 2024
e38ed6d
Add Power Topology python script test
hasty Feb 14, 2024
f8467b1
Add PWRTL_1_1 to ciTests.json
hasty Feb 14, 2024
248e9a9
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 14, 2024
319fb68
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 14, 2024
67db64e
Restyled
hasty Feb 14, 2024
f8b5388
Regen
hasty Feb 14, 2024
6606217
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 16, 2024
97d2f3f
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 16, 2024
ea2524b
Format PICS.yaml
hasty Feb 16, 2024
f8f2877
Merge branch 'granbery/power_topology_test_scripts' of github.com:has…
hasty Feb 16, 2024
101bb17
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 16, 2024
dafeb87
Merge branch 'master' into granbery/power_topology_test_scripts
hasty Feb 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ jobs:
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_4_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--int-arg PIXIT_ENDPOINT:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"'
Expand Down
33 changes: 33 additions & 0 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10160,3 +10160,36 @@ PICS:

- label: "Can the mode change be manually controlled?"
id: EEVSEM.S.M.CAN_MANUALLY_CONTROLLED

#
# Power Topology Cluster
#
- label: "Does the device implement the Power Topology Cluster as a server?"
id: PWRTL.S

# Features

- label:
"Does the associated endpoint provide or consume power for the entire
node?"
id: PWRTL.S.F00

- label:
"Does the associated endpoint provide or consume power for itself and
its child endpoints?"
id: PWRTL.S.F01

- label:
"Does the associated endpoint provide or consume power for a provided
set of endpoints?"
id: PWRTL.S.F02

- label: "Can the provided set of endpoints change?"
id: PWRTL.S.F03

#Server attributes
- label: "Does the device implement the AvailableEndpoints attribute?"
id: PWRTL.S.A0000

- label: "Does the device implement the ActiveEndpoints attribute?"
id: PWRTL.S.A0001
119 changes: 119 additions & 0 deletions src/app/tests/suites/certification/Test_TC_PWRTL_1_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Copyright (c) 2021 Project CHIP Authors
#
# 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.
# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default

name: 44.1.1. [TC-PWRTL-1.1] Global Attributes with DUT as Server

PICS:
- PWRTL.S

config:
nodeId: 0x12344321
cluster: "Power Topology"
endpoint: 1

tests:
- label: "Step 1: Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId

- label: "Step 2: TH reads the ClusterRevision from DUT"
command: "readAttribute"
attribute: "ClusterRevision"
response:
value: 1
constraints:
type: int16u

- label:
"Step 3a: Given PWRTL.S.F00(Node) ensure featuremap has the correct
bit set"
PICS: PWRTL.S.F00
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x1]
hasMasksClear: [0x2, 0x4, 0x8]

- label:
"Step 3b: Given PWRTL.S.F01(Leaf) ensure featuremap has the correct
bit set"
PICS: PWRTL.S.F01
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x2]
hasMasksClear: [0x1, 0x4, 0x8]

- label:
"Step 3c: Given PWRTL.S.F02(Set) ensure featuremap has the correct bit
set"
PICS: PWRTL.S.F02
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x4]
hasMasksClear: [0x1, 0x2]

- label:
"Step 3d: Given PWRTL.S.F03(Dynamic Power Flow) ensure featuremap has
the correct bit set"
PICS: PWRTL.S.F03
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x4, 0x8]

- label: "Step 4a: TH reads AttributeList from DUT"
PICS: "!PICS_SF_SET && !PICS_SF_DYPF"
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: []

- label:
"Step 4b: TH reads feature dependent attribute(AvailableEndpoints)
AttributeList from DUT"
PICS: "PICS_SF_SET && !PICS_SF_DYPF"
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [0]

- label:
"Step 4c: TH reads feature dependent attribute(ActiveEndpoints)
AttributeList from DUT"
PICS: "PICS_SF_SET && PICS_SF_DYPF"
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [0, 1]
12 changes: 12 additions & 0 deletions src/app/tests/suites/certification/ci-pics-values
Original file line number Diff line number Diff line change
Expand Up @@ -2939,3 +2939,15 @@ DEMM.S.C01.Tx=1
#Manual controllable
DEMM.S.M.CAN_TEST_MODE_FAILURE=1
DEMM.S.M.CAN_MANUALLY_CONTROLLED=1

#Power Topology Cluster
# Server
PWRTL.S=1
PWRTL.S.A0000=1
PWRTL.S.A0001=1

#Features
PWRTL.S.F00=0
PWRTL.S.F01=0
PWRTL.S.F02=1
PWRTL.S.F03=1
1 change: 1 addition & 0 deletions src/app/tests/suites/ciTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"Test_TC_OO_2_4"
],
"PowerSource": ["Test_TC_PS_1_1", "Test_TC_PS_2_1"],
"PowerTopology": ["Test_TC_PWRTL_1_1"],
"PressureMeasurement": [
"Test_TC_PRS_1_1",
"Test_TC_PRS_2_1",
Expand Down
2 changes: 2 additions & 0 deletions src/app/tests/suites/manualTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"AccessControlEnforcement": [],
"OvenMode": ["Test_TC_OTCCM_1_1", "Test_TC_OTCCM_1_2"],
"EnergyEVSE": ["Test_TC_EEVSE_1_1", "Test_TC_EEVSE_2_1"],
"PowerTopology": ["Test_TC_PWRTL_1_1"],
"collection": [
"DeviceDiscovery",
"Groups",
Expand Down Expand Up @@ -338,6 +339,7 @@
"ModeSelect",
"OTASoftwareUpdate",
"PowerSourceConfiguration",
"PowerTopology",
"PressureMeasurement",
"SecureChannel",
"SoftwareDiagnostics",
Expand Down
2 changes: 1 addition & 1 deletion src/app/zap_cluster_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"MESSAGES_CLUSTER": [],
"MODE_SELECT_CLUSTER": [],
"NETWORK_COMMISSIONING_CLUSTER": [],
"POWER_TOPOLOGY_CLUSTER": [],
"SAMPLE_MEI_CLUSTER": [],
"NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [],
"OCCUPANCY_SENSING_CLUSTER": ["occupancy-sensor-server"],
Expand All @@ -91,6 +90,7 @@
"POWER_PROFILE_CLUSTER": [],
"POWER_SOURCE_CLUSTER": [],
"POWER_SOURCE_CONFIGURATION_CLUSTER": [],
"POWER_TOPOLOGY_CLUSTER": [],
"PRESSURE_MEASUREMENT_CLUSTER": [],
"PROXY_CONFIGURATION_CLUSTER": [],
"PROXY_DISCOVERY_CLUSTER": [],
Expand Down
69 changes: 69 additions & 0 deletions src/python_testing/TC_PWRTL_2_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# Copyright (c) 2024 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.
#

import logging

import chip.clusters as Clusters
from chip.clusters.Types import NullValue
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
from mobly import asserts


class TC_PWRTL_2_1(MatterBaseTest):

def pics_TC_PWRTL_2_1(self) -> list[str]:
return ["PWRTL.S"]

@async_test_body
async def test_TC_PWRTL_2_1(self):

attributes = Clusters.PowerTopology.Attributes

endpoint = self.user_params.get("endpoint", 1)

self.print_step(1, "Commissioning, already done")

if not self.check_pics("PWRTL.S.A0000"):
logging.info("Test skipped because PICS PWRTL.S.A0000 is not set")
return

self.print_step(2, "Read AvailableAttributes attribute")
available_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.AvailableEndpoints)

if available_endpoints == NullValue:
logging.info("AvailableEndpoints is null")
else:
logging.info("AvailableEndpoints: %s" % (available_endpoints))

asserts.assert_less_equal(len(available_endpoints), 21,
"AvailableEndpoints length %d must be less than 21!" % len(available_endpoints))

if not self.check_pics("PWRTL.S.A0001"):
logging.info("Test skipped because PICS PWRTL.S.A0001 is not set")
return

self.print_step(3, "Read ActiveEndpoints attribute")
active_endpoints = await self.read_single_attribute_check_success(endpoint=endpoint, cluster=Clusters.Objects.PowerTopology, attribute=attributes.ActiveEndpoints)
logging.info("ActiveEndpoints: %s" % (active_endpoints))

if available_endpoints == NullValue:
asserts.assert_true(active_endpoints == NullValue,
"ActiveEndpoints should be null when AvailableEndpoints is null: %s" % active_endpoints)


if __name__ == "__main__":
default_matter_test_main()
Loading