This folder contains a machine-readable representation of matter clusters.
These files are currently used for certification testing and documentation. The data model files represent the official specification data model at a certain revision. The files in these directories are maintained by the data model tiger team (DMTT) and are updated when new official specifications or specification ballots are released.
The data model files in this directory are not used with zap or for SDK codegen and should not be updated manually by cluster or device type implementers.
If the files exist in the data_model directory already and you are trying to update either the revision or the alchemy release, use scripts/spec_xml/generate_spec_xml.py. More information on the use of the script can be found by using the --help flag for that script.
Perform the following steps
Check out the specification repo at the desired sha/tag/branch (https://github.com/CHIP-Specifications/connectedhomeip-spec)
Determine the desired include level (current ballot includes, no in-progress includes or all in-progress includes). If you are generating files using “Current”, be sure to double-check the include list inside the script against the ballot email.
Run the script and check in all the file changes.
Example script invocation (adjust environment variables to reflect your proper paths and spec revisions)
ALCHEMY=/path/to/alchemy SPEC_ROOT=/path/to/spec/repo DM_DIR=1.3 IN_PROGRESS=None ./scripts/spec_xml/generate_spec_xml.py --scraper $ALCHEMY --spec-root $SPEC_ROOT --include-in-progress $IN_PROGRESS --output-dir data_model/$DM_DIR
You can use the scripts/spec_xml/spec_revision_diff_summary.py script to create a summary with the differences between the data model files for two different directories
Be sure to double-check the summary and generated ID files to ensure the provisional markings are as expected
If you are updating both the spec SHA and the scraper version, it is best to do this in two separate commits so reviewers can see which changes come from the spec and which changes come from the scraper additions
Before pushing the PR, run build_python.sh, activate the venv and run all the TestSpec* tests in src/python_testing. These are unit tests of the data model files.
To do this (set VENV to your desired path), paths set as if you're running from the chip root
. scripts/activate.sh VENV=out/py ./scripts/build_python.sh -i $VENV source $VENV/bin/activate python3 src/python_testing/TestSpecParsingSupport.py python3 src/python_testing/TestSpecParsingSelection.py python3 src/python_testing/TestSpecParsingDeviceType.py
As with existing files, new data model files are created using scripts/spec_xml/generate_spec_xml.py. More information on the use of the script can be found by using the --help flag for that script.
Best practices for creating PRs for new data model revisions
To do this, perform the following steps:
Copy the last revision data model directory into the new directory name and commit the changes. This allows reviewers to see a diff between the last and current spec revision.
Check out the specification repo at the desired sha/tag/branch (https://github.com/CHIP-Specifications/connectedhomeip-spec)
Determine the desired include level (current ballot includes, no in-progress includes or all in-progress includes). If you are generating files using “Current”, be sure to double-check the include list inside the script against the ballot email.
Create the new data model files using scripts/spec_xml/generate_spec_xml.py. More information on the use of the script can be found by using the --help flag for that script.
Example script invocation (adjust environment variables to reflect your proper paths and spec revisions)
ALCHEMY=/path/to/alchemy SPEC_ROOT=/path/to/spec/repo DM_DIR=1.5 IN_PROGRESS=Current ./scripts/spec_xml/generate_spec_xml.py --scraper $ALCHEMY --spec-root $SPEC_ROOT --include-in-progress $IN_PROGRESS --output-dir data_model/$DM_DIR
Run build_python.sh, activate the venv and run all the TestSpec* tests in src/python_testing. These are unit tests of the data model files.
If there are errors, prefer to correct them in the spec, or by updating the errata file in the spec repo
Once the files have been properly generated, commit all the changes
Generate a PR description using scripts/spec_xml/spec_revision_diff_summary.py script to create a summary with the differences between the data model files for two different directories.
In the summary generated from spec_revision_diff_summary.py, be sure to double-check the following
Be sure to double-check the summary and generated ID files to ensure the provisional markings are as expected
To update the parsing support to use the new data model files:
To update the SDK to the new spec revision, update src/app/SpecificationDefinedRevisions.h
Add the new data model files to the github CI data model revision checker in .github/workflows/check-data-model-directory-updates.yaml