|
1 | 1 | # PICS and PIXITs
|
2 | 2 |
|
3 |
| -Placeholder file for PICS and PIXIT info |
4 |
| - |
5 |
| -- PICS formats - XML vs. test harness |
6 |
| -- PICS in CI |
7 |
| -- PICS tool and how we practically use it in Matter |
8 |
| -- PICS checker test |
9 |
| -- PIXITs in tests and how to set them |
10 |
| -- Why you should avoid using both of these things. |
| 3 | +## What are PICS |
| 4 | + |
| 5 | +In many Standards Defining Organizations including the CSA, the concept of a |
| 6 | +“Protocol Implementation Conformance Statement” or “PICS” code is introduced to |
| 7 | +simplify description of protocol elements. |
| 8 | + |
| 9 | +Each PICS code is a binary value that describes the presence or absence of a |
| 10 | +particular element or capability on a device. Each cluster has a defined PICS |
| 11 | +prefix string and defines a set of PICS codes to describe whether the cluster is |
| 12 | +present, and the presence of each feature, attribute, command, and event for |
| 13 | +both the server and client side. |
| 14 | + |
| 15 | +For example if there was a cluster ANeatCluster with the PICS code ANC, two |
| 16 | +features (bit 0 and 1), two attributes (0x0000 and 0x0001), two accepted |
| 17 | +commands (0x00 and 0x01), a single command response (0x02) and one event (0x00), |
| 18 | +the following PICS codes would be defined |
| 19 | + |
| 20 | +| CODE | Desc | |
| 21 | +| ------------- | -------------------------------------------------------------------------- | |
| 22 | +| ANC.S | Device implements the ANC cluster as a server | |
| 23 | +| ANC.S.F00 | Device implements ANC feature at bit 0 on the ANC server cluster | |
| 24 | +| ANC.S.F01 | Device implements ANC feature at bit 1 on the ANC server cluster | |
| 25 | +| ANC.S.A0000 | Device implements ANC attribute 0x0000 on the ANC server cluster | |
| 26 | +| ANC.S.A0001 | Device implements ANC attribute 0x0001 on the ANC server cluster | |
| 27 | +| ANC.S.C00.Rsp | Device accepts ANC command 0x00 on the ANC server cluster | |
| 28 | +| ANC.S.C01.Rsp | Device accepts ANC command 0x00 on the ANC server cluster | |
| 29 | +| ANC.S.C02.Tx | Device generates ANC command response 0x02 on the ANC server cluster | |
| 30 | +| ANC.S.E00 | Device generates ANC event 0x00 on the ANC server cluster | |
| 31 | +| ANC.C | Device supports an ANC client | |
| 32 | +| ANC.C.F00 | Device ANC client is capable of understanding the feature with bit 0 | |
| 33 | +| ANC.C.F01 | Device ANC client is capable of understanding the feature with bit 0 | |
| 34 | +| ANC.C.A0000 | Device ANC client is capable of reading or subscribing to attribute 0x0000 | |
| 35 | +| ANC.C.A0001 | Device ANC client is capable of reading or subscribing to attribute 0x0001 | |
| 36 | +| ANC.C.C00.Rsp | Device ANC client is capable of sending the command with id 0x00 | |
| 37 | +| ANC.C.C01.Rsp | Device ANC client is capable of sending the command with id 0x01 | |
| 38 | +| ANC.C.C02.Tx | Device ANC client understands the command response with id 0x02 | |
| 39 | +| ANC.C.E00 | Device ANC client understands the event with id 0x00 | |
| 40 | + |
| 41 | +More information about the PICS code format can be found at |
| 42 | +[PICS Guidelines](https://github.com/CHIP-Specifications/chip-test-plans/blob/master/docs/PICS%20Guidelines.md). |
| 43 | + |
| 44 | +In addition to these standard cluster PICS, other PICS may be defined to |
| 45 | +describe capabilities that are not directly expressed via the data model. For |
| 46 | +example, whether the device responds to manual operations that affect the Matter |
| 47 | +data model. |
| 48 | + |
| 49 | +Additionally, there are node-level PICS, which appear as a part of the MCORE |
| 50 | +PICS set. These PICS codes describe node level support such as the radio, |
| 51 | +whether the device is commissionable, whether the device comes with a QR code |
| 52 | +etc. |
| 53 | + |
| 54 | +PICS are used in testing in two ways. "Top level" PICS appear at the top of the |
| 55 | +test plan and indicate whether an entire test case should be run. For example, a |
| 56 | +test case for ANeatCluster would have a top-level PICS of ANC.S to indicate that |
| 57 | +the test would only be run if the ANC cluster is present on the endpoint. Test |
| 58 | +cases also use PICS to gate individual steps of the test which are not |
| 59 | +applicable if a certain element or capability is not implemented. |
| 60 | + |
| 61 | +The entire collection of PICS codes for a specification release is provided as a |
| 62 | +set of PICS XML files. These files are loaded into the PICS tool, which is used |
| 63 | +to manually set all the PICS codes for a device. The PICS XML files and the PICS |
| 64 | +tool are distributed as part of the official specification release package and |
| 65 | +are available on |
| 66 | +[Causeway](https://groups.csa-iot.org/wg/members-all/document/folder/2269). |
| 67 | + |
| 68 | +### PIXITs |
| 69 | + |
| 70 | +PIXIT stands for Protocol Implementation eXtra Information for Testing. A PIXIT |
| 71 | +value provides an implementation-defined condition or value that is required by |
| 72 | +the test. |
| 73 | + |
| 74 | +PIXIT values are used to convey information that is required for testing, but |
| 75 | +not normally available to a client interacting with the device. For example, the |
| 76 | +key for a test event trigger on the device, or the network credentials for the |
| 77 | +test harness. |
| 78 | + |
| 79 | +More information on PIXITs and the PIXIT format can be found in the |
| 80 | +[PICS Guidelines](https://github.com/CHIP-Specifications/chip-test-plans/blob/master/docs/PICS%20Guidelines.md). |
| 81 | + |
| 82 | +## Creating PICS conformance statements for Matter devices |
| 83 | + |
| 84 | +Because Matter devices may contain multiple, differing instances of the same |
| 85 | +cluster on multiple endpoints, it it not possible to unambiguously describe a |
| 86 | +Matter device with a single set of cluster-based PICS files. Instead, Matter |
| 87 | +devices use a full set of PICS XML files to describe each endpoint. |
| 88 | + |
| 89 | +To create a conformance statement for a Matter device, for each endpoint, load |
| 90 | +the full set of PICS XML files into the |
| 91 | +[PICS tool](https://picstool.csa-iot.org/), and select each of the PICS elements |
| 92 | +present for the endpoint being described. Documentation on how to use the PICS |
| 93 | +tool can be found in the PICS tool readme in the tool menu. |
| 94 | + |
| 95 | +Some of of the full-node MCORE elements really only apply to the root node, |
| 96 | +while others apply across all endpoints. For example, the entire device is |
| 97 | +commissionable, but commissioning tests only need to be run against EP0, so |
| 98 | +MCORE PICS should be set on the EP0 PICS set. Things like MCORE.IDM apply to |
| 99 | +every endpoint. |
| 100 | + |
| 101 | +### Helper scripts |
| 102 | + |
| 103 | +The official tooling for CSA certification is the PICS tool provided as a part |
| 104 | +of the release. PICS files need to pass validation on the PICS tool to be valid |
| 105 | +for certification. |
| 106 | + |
| 107 | +However, in Matter, many of the PICS codes correspond directly to elements that |
| 108 | +are exposed directly on the device. For example, cluster presence is determined |
| 109 | +from the server list on an endpoint, feature maps, attribute and command lists |
| 110 | +correspond directly to the PICS.S.Fxx, PICS.S.Axxxx and PICS.S.Cxx.Xx PICS |
| 111 | +codes. The Matter SDK provides a tool to pre-fill these values in the PICS XML |
| 112 | +files so they do not have to be individually, manually filled in the PICS tool. |
| 113 | + |
| 114 | +- [PICS Generator](https://github.com/project-chip/connectedhomeip/tree/master/src/tools/PICS-generator) |
| 115 | + |
| 116 | +PICS codes filled using this tool still need to be validated by the PICS tool. |
| 117 | +Note that due to device limitations, the tool will NOT fill the following |
| 118 | +categories of PICS codes, and these will need to be filled manually in the PICS |
| 119 | +tool: |
| 120 | + |
| 121 | +- Event PICS (PICS.S.Exx) |
| 122 | +- Client PICS |
| 123 | +- MCORE (base.xml) PICS |
| 124 | +- Manual or other non-element PICS |
| 125 | +- PICS describing whether optionally-writable attributes are writable |
| 126 | +- any other non-element PICS |
| 127 | + |
| 128 | +It is important to note that this script is NOT the official tool for PICS |
| 129 | +generation, just a helper to assist with this manual process. It is very |
| 130 | +important to go back and check that the values are as expected and to fill in |
| 131 | +the other PICS. |
| 132 | + |
| 133 | +### Verifying PICS using the IDM-10.4 certification test |
| 134 | + |
| 135 | +While not all PICS are verifiable on the device, we do have tests that verify |
| 136 | +the declared PICS against the device. This is one of the first tests that should |
| 137 | +be run at certification, as the PICS files are what determine which set of tests |
| 138 | +are required. |
| 139 | + |
| 140 | +To run these tests locally, follow the instructions at |
| 141 | +[Running Python tests locally](./python.md#running-tests-locally). The PICS |
| 142 | +checker test is TC-IDM-10.4, implemented in |
| 143 | +[TC_pics_checker.py](https://github.com/project-chip/connectedhomeip/blob/master/src/python_testing/TC_pics_checker.py). |
| 144 | +These tests run a single set of PICS XML files against an endpoint. The |
| 145 | +`--endpoint` and `--PICS` flags are therefore required. |
| 146 | + |
| 147 | +Note that you can run tests locally against the PICS XMLs for an endpoint by |
| 148 | +supplying the name of the directory containing the set of PICS XML files for |
| 149 | +that endpoint. |
| 150 | + |
| 151 | +## Setting PIXITs for Matter devices |
| 152 | + |
| 153 | +Matter tests do not currently have support to read PIXIT values from the PICS |
| 154 | +XML files. Instead, tests implement PIXITs as test-specific flags. When running |
| 155 | +locally, these are specified on the command line. When running in the test |
| 156 | +harness, these are specified in the test parameters section of the test |
| 157 | +configuration. |
| 158 | + |
| 159 | +## PICS for test selection |
| 160 | + |
| 161 | +The official source that the CSA certification team uses to determine if all the |
| 162 | +required tests have been run at certification is the submitted set of PICS XML |
| 163 | +files and the PICS tool. |
| 164 | + |
| 165 | +To generate this set of tests for each endpoint, load all the filled PICS XML |
| 166 | +files for a single endpoint into the PICS tool and validate the PICS files. The |
| 167 | +PICS files should validate properly. This will also generate the list of test |
| 168 | +cases. |
| 169 | + |
| 170 | +Note that the TH will also guide test selection by pre-selecting the required |
| 171 | +tests based on the PICS file, but it is the responsibility of the testers and |
| 172 | +the ATL to ensure that all the required tests are run and the results are |
| 173 | +submitted. |
| 174 | + |
| 175 | +## Creating PICS / PIXITs for new cluster and use in test plans |
| 176 | + |
| 177 | +Placeholder for more information coming in a subsequent PR. Needs to cover |
| 178 | + |
| 179 | +- formatting (link out to test plans doc) |
| 180 | +- requirement to have all the elements listed |
| 181 | +- how to do conformance in a way the PICS tool can handle - (note - special |
| 182 | + attention to choice conformance, otherwise conformance) |
| 183 | +- why you shouldn't use PICS values in tests other than at the top level |
| 184 | + |
| 185 | +## Using PICS in test scripts |
| 186 | + |
| 187 | +Placeholder for more information coming in a subsequent PR. Needs to cover |
| 188 | +top-level and step-wise pics in yaml and python and also where they should NOT |
| 189 | +be used. |
| 190 | + |
| 191 | +## CI PICS format |
| 192 | + |
| 193 | +Placeholder for information about the CI PICS format, CI-only PICS and the |
| 194 | +gotchas there. |
0 commit comments