[Create Test Module] Finalize and Refactor TC_IDM_2_2 Python3 Test Module (#39644)
* [Adding] Add TC_IDM_2_2 test module - Update of Austin's module
* [TC_IDM_2_2] Refactor data version filter steps to use ReadAttribute and updated test steps to work with TH:
- updated test step logic to using self.step()
- Switched data version filter operations (steps 13–14) to use `ReadAttribute` instead of `Read` for consistency and correct response handling.
- Updated data version extraction to use `Clusters.Attribute.DataVersion` instead of hardcoded attribute IDs.
- Adjusted test assertions to expect an empty dict `{}` when the DataVersion matches, aligning with Matter SDK and Austin's implementation.
- Simplified and unified response handling for filtered reads.
- Ensured test steps 13 and 14 now function as expected per the test plan and Matter spec.
This brings the test logic in line with a proven working pattern and resolves issues with response type mismatches and assertion failures.
* Updating IDM_2_2 python3 test module:
- Got test step 14-22 working as expected using the following logic:
- Fixed WriteAttribute API usage: Updated from deprecated 4-parameter format to correct 2-parameter format (endpoint, attribute(value=...)) for data version filter operations and ACL modifications
- Corrected non-global attribute testing: Use attribute_id and expect ChipStackError with code 0x580 for proper error handling
- Updated events/attributes reading: Changed from subscription approach to Read(nodeid=..., attributes=[()], events=[()]) for proper response object handling
* Updating Test Step 18 logic and removed some unneeded debug commits
- Updated test step 18 to using the ListLongOctetString attribute from the UnitTesting cluster as mentioned by Gemini bot, however we do not get a SuppressResponse field in the respond back currently
- Removed some previous debug comments in the code that are no longer needed
* Minor update to logic for test step 18
* Updating _test_read_operation() in TC_IDM_2_2 python3 test module:
- _test_read_operation method and all its operation types have now been refactored into individual async methods
- A dictionary maps each operation type to its handler.
- main _test_read_operation method is now clean and simply dispatches to the correct handler.
* Updating TC_IDM_2_2 python3 test module:
- Updated test step 11 to resolve issue with unsupported attribute with for-loop having false positive when not finding an unsupported attribute
- Updated test step 18 to using new logic copied from TCP_Tests.py for sending large data over TCP during testing
- Removed Exception error handling and now using more specific defined exceptions
* autopep8 and isort fixes
* Resolving linting errors
* Resolving further style issues
* Updating TC_IDM_2_2 python3 test module:
- Updated to using setup_class_method instead of using prior debugging setup class method()
* Resolving further linting errors
* autopep8 fix
* resolving more linting errors; Odd ChipStackError requires # chipstack-ok now to pass linter
* resolving more autopep8 errors
* sorting endpoint lists for test steps 1 and 2
* Update TC_IDM_2_2.py
Removing some unnecessary comments from the code
* applying isort and autopep8 to latest changes
* Updated TC_IDM_2_2 python3 test module to resolve comments from Cecille:
- Removed timeout_ms parameter from read_attribute()
- Removed manual discovery functions for endpoints, clusters, and attributes as already gathered with setup_class_helper(allow_pase=False) at the start of the test
- Removed string map established for operation_type dictionary and now passing directly to the functions established in the dictionary, no more string maps.
- Changed to using direct unpacking of endpoint, cluster, and attributes in attribute read and expect error scenarios.
- Parts list is always present, but added assertion instead of a if block for quick and simple verification.
- Updated _verify_single_endpoint_path() to include type
- Removed kwargs in private functions to now pass in the variables directly. String maps are dangerous and should be avoided.
- Updated to remove cluster_obj var and parameter from async function _verify_single_endpoint_path() as we know this test currently only uses the Descriptor cluster with this function, so we can just set the cluster in the function itself and remove any complexities using the YAGNI principle
* Update TC_IDM_2_2.py to resolve comments from Cecille
- Removed the timeout_ms from the read_attribute async function
* Resolving linting issues
* Updating chip -> matter for imports
* Restylized by isort
* Refactor TC_IDM_2_2:
- Remove unnecessary vars from test initialization
- Removed prior function mapping that was previously mapping functions to themselves
- Remove unnecessary async from verification functions by converting verification functions to sync (verify_read_response, verify_all_endpoints_clusters, verify_specific_path, _verify_single_endpoint_path, verify_cluster_path, verify_attribute_path, _verify_empty_tuple)
- Keep async only for functions that make device controller calls
- Fix misleading comment in _verify_single_endpoint_path
- Update docstring to clarify AttributePath vs tuple parameters
- Add type checking for AttributePath vs tuple in verify_attribute_read
* Restylizing TC_IDM_2_2 python3 test module
* Update TC_IDM_2_2 python3 test module:
- Simplifies _read_single_attribute by adding cluster parameter and removing unnecessary cluster detection logic
- Updated _read_unsupported_attribute to skip gracefully when no unsupported attributes found (expected with chip-all-clusters-app)
- Added verification logic to _read_repeat_attribute to ensure repeated reads return consistent values
- Removed problematic fallback code that could fail if no thermostat cluster
* Restylizing TC_IDM_2_2 python3 test module
* Updating test step 5 ret and exp attrs due to CI failure on Clusters.UnitTesting.Attributes.WriteOnlyInt8u.attribute_id
* Restylizing TC_IDM_2_2 python3 test module
* Update src/python_testing/TC_IDM_2_2.py
Co-authored-by: C Freeman <cecille@google.com>
* autopep8 restyles TC_IDM_2_2 test module
* Updating TC_IDM_2_2 test module:
- Changed function name from _verify_empty_tuple to _verify_empty_wildcard as suggested by Cecille
- Updated function calls to reflect name change for _verify_empty_wildcard
- Updated read_request arg name to read_response for verify_read_response function call
* Updating read_request var name to read_response where needed
* Removing test step 18 to comply with test plan PR #[5467](https://github.com/CHIP-Specifications/chip-test-plans/pull/5467)
* Resolving linting errors
* Refactor TC_IDM_2_2 test module based on Cecille's feedback:
- Remove read_attribute function and replace with direct controller.Read calls
- Fix KeyError in unsupported endpoint/cluster tests by using read_single_attribute_expect_error directly instead of verify_attribute_read
- Add comprehensive logic for unsupported cluster validation that iterates through all standard clusters across all endpoints to find actual unsupported ones
- Implement dynamic unsupported endpoint detection using Austin's approach (find endpoints beyond max+2)
- Simplify verify_attribute_read to only accept AttributePath objects:
* Remove support for tuple and type formats
* Standardize all test calls to use AttributePath objects
* Delete unused verification methods (verify_specific_path, verify_cluster_path)
* Make API cleaner and more maintainable
- Fix circular logic in verify_all_endpoints_clusters by properly validating that read response contains data for all endpoints listed in EP0's parts list
- Update verify_all_endpoints_clusters docstring to clarify it's only for full wildcard reads (test step 5)
- Remove some intermediary wrapper functions, now calling verify_attribute_read with AttributePath objects directly
* isort and autopep8 stylized
* Updating TC_IDM_2_2 PR test module:
- Removed verify_read_response function entirely - now calls verify_attribute_path directly
- Added comprehensive verification for server list, endpoints, and attribute lists
- Created shared _verify_attributes_match_list function to handle attribute verification across multiple response formats (Read() vs ReadAttribute())
- Updated code to only verify spec-defined clusters using global_attribute_ids.cluster_id_type() to skip clusters that may have write-only attributes
- Fixed response format handling to support both .tlvAttributes (Read) and direct dict (ReadAttribute) formats
- Fixed cluster object vs cluster ID handling in shared verification function
- Added missing endpoint verification to _read_cluster_all_endpoints
- Added missing ServerList verification to _read_endpoint_all_clusters
- Changed function name from _read_non_global_attribute to _read_non_global_attribute_across_all_clusters
* stylized
* Updating TC_IDM_2_2 test module::
- Fixed global attribute verification logic to check presence in ALL clusters instead of just ANY cluster (lines 182-185)
- Added DataVersion filtering in _read_cluster_all_endpoints to prevent AttributeError when accessing .attribute_id (lines 216-217)
- Fixed AttributeList access logic to properly handle different response formats and prevent KeyError (lines 211-219)
- Updated _read_unsupported_attribute to fail test instead of skipping when no unsupported attributes found, as all clusters should have at least one unsupported attribute (lines 331-332)
* Restylized by autopep8
* Fix attribute verification logic and add clarifying comment:
- Removed conditional check for standard clusters in verify_attribute_path since targeted reads don't have write-only attribute issues and should verify all cluster types including MEI clusters
- Added comment explaining that global attribute verification checks for specific global attributes across all clusters
* Removing sleep and docstring from test step 14
* Resolving linting error with unused impoart time
* Update src/python_testing/TC_IDM_2_2.py
Changing copyright date from Sergio's suggestion.
Co-authored-by: Sergio Soares <sergiosoares@google.com>
* Add comment and spec reference for catching 0x580 (GENERAL_ERROR + INVALID_ACTION)
* Fix TC_IDM_2_2 Test Step 15 to read all cluster attributes with data version filter
* Update TC_IDM_2_2 Fix Step 16 to send 2 DataVersionIB filters
* Update TC_IDM_2_2 test step 16 to remove prior print and exit logic from debugging
* Create second controller (TH2) with limited View access to properly test access control enforcement
* Updated asserts in test step 20 to more specifically verify we got the correct cluster returned during this test step
* Restyled by autopep8
* Added check for Clusters.BasicInformation before running test steps 14-17 and test step 20
* Update TC_IDM_2_2.py
Updated to include running for a longer time due to possible timeout in highly congested lab networks since this pull all attributes/clusters/endpoints for testing.
* Restyled by autopep8
* Restyled by autopep8
* Updating TC_IDM_2_2 python3 test module to respond to Raju's comments:
- Additional assertion added to ensure cluster_id exists at line 183
- Added try-finally clause to make sure that ACL restoration and TH2 controller occurs even if exceptions happen in _read_limited_access()
* Restyled by autopep8
---------
Co-authored-by: C Freeman <cecille@google.com>
Co-authored-by: Sergio Soares <sergiosoares@google.com>Builds
Tests
Tools
Documentation
Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
Matter is a unified, open-source application-layer connectivity standard built to enable developers and device manufacturers to connect and build reliable, and secure ecosystems and increase compatibility among connected home devices. It is built with market-proven technologies using Internet Protocol (IP) and is compatible with Thread and Wi-Fi network transports. Matter was developed by a Working Group within the Connectivity Standards Alliance (Alliance). This Working Group develops and promotes the adoption of the Matter standard, a royalty-free connectivity standard to increase compatibility among smart home products, with security as a fundamental design tenet. The vision that led major industry players to come together to build Matter is that smart connectivity should be simple, reliable, and interoperable.
Matter simplifies development for manufacturers and increases compatibility for consumers.
The standard was built around a shared belief that smart home devices should be secure, reliable, and seamless to use. By building upon Internet Protocol (IP), Matter enables communication across smart home devices, mobile apps, and cloud services and defines a specific set of IP-based networking technologies for device certification.
The Matter specification details everything necessary to implement a Matter application and transport layer stack. It is intended to be used by implementers as a complete specification.
The Alliance officially opened the Matter Working Group on January 17, 2020, and the specification is available for adoption now.
Visit buildwithmatter.com to learn more and read the latest news and updates about the project.
Matter is developed with the following goals and principles in mind:
Unifying: Matter is built with and on top of market-tested, existing technologies.
Interoperable: The specification permits communication between any Matter-certified device, subject to users’ permission.
Secure: The specification leverages modern security practices and protocols.
User Control: The end user controls authorization for interaction with devices.
Federated: No single entity serves as a throttle or a single point of failure for root of trust.
Robust: The set of protocols specifies a complete lifecycle of a device — starting with the seamless out-of-box experience, through operational protocols, to device and system management specifications required for proper function in the presence of change.
Low Overhead: The protocols are practically implementable on low compute-resource devices, such as MCUs.
Pervasive: The protocols are broadly deployable and accessible, by leveraging IP and being implementable on low-capability devices.
Ecosystem-Flexible: The protocol is flexible enough to accommodate deployment in ecosystems with differing policies.
Easy to Use: The protocol provides smooth, cohesive, integrated provisioning and out-of-box experience.
Open: The Project’s design and technical processes are open and transparent to the general public, including non-members wherever possible.
Matter aims to build a universal IPv6-based communication protocol for smart home devices. The protocol defines the application layer that will be deployed on devices and the different link layers to help maintain interoperability. The following diagram illustrates the normal operational mode of the stack:
The architecture is divided into layers to help separate the different responsibilities and introduce a good level of encapsulation among the various pieces of the protocol stack. The vast majority of interactions flow through the stack captured in the following Figure:
Security: An encoded action frame is then sent down to the Security Layer to encrypt and sign the payload to ensure that data is secured and authenticated by both sender and receiver of a packet.
Message Framing & Routing: With an interaction encrypted and signed, the Message Layer constructs the payload format with required and optional header fields; which specify the message's properties and some routing information.
Matter’s design and technical processes are intended to be open and transparent to the general public, including to Working Group non-members wherever possible. The availability of this GitHub repository and its source code under an Apache v2 license is an important and demonstrable step to achieving this commitment. Matter endeavors to bring together the best aspects of market-tested technologies and redeploy them as a unified and cohesive whole-system solution. The overall goal of this approach is to bring the benefits of Matter to consumers and manufacturers as quickly as possible. As a result, what you observe in this repository is an implementation-first approach to the technical specification, vetting integrations in practice. The Matter repository is growing and evolving to implement the overall architecture. The repository currently contains the security foundations, message framing and dispatch, and an implementation of the interaction model and data model. The code examples show simple interactions, and are supported on multiple transports -- Wi-Fi and Thread -- starting with resource-constrained (i.e., memory, processing) silicon platforms to help ensure Matter’s scalability.
We welcome your contributions to Matter. Read our contribution guidelines here.
Instructions about how to build Matter can be found here .
The Matter repository is structured as follows:
| File/Folder | Content |
|---|---|
| build | Build system support content and built output directories |
| build_overrides | Build system parameter customization for different platforms |
| config | Project configurations |
| credentials | Development and test credentials |
| docs | Documentation, including guides. Visit the Matter SDK documentation page to read it. |
| examples | Example firmware applications that demonstrate use of Matter |
| integrations | 3rd party integrations |
| scripts | Scripts needed to work with the Matter repository |
| src | Implementation of Matter |
| third_party | 3rd party code used by Matter |
| zzz_generated | ZAP generated template code - Revolving around cluster information |
| BUILD.gn | Build file for the GN build system |
| CODE_OF_CONDUCT.md | Code of conduct for Matter and contribution to it |
| CONTRIBUTING.md | Guidelines for contributing to Matter |
| LICENSE | Matter license file |
| REVIEWERS.md | PR reviewers |
| gn_build.sh | Build script for specific projects such as Android, EFR32, etc. |
| README.md | This file |
Matter is released under the Apache 2.0 license.