Skip to content

Commit

Permalink
Unit localization cluster constraints (project-chip#21003)
Browse files Browse the repository at this point in the history
* Attempt to automate unit localization test case

* Restyle

* Update name of attribute to the correct value

* ZAP regen (tests)

* Add pre-attribute support and source file for unit localization

* zap regen

* Make the localization compile
  • Loading branch information
andy31415 authored and isiu-apple committed Sep 16, 2022
1 parent a357d19 commit f12ed21
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 205 deletions.
177 changes: 53 additions & 124 deletions src/app/tests/suites/certification/Test_TC_LUNIT_3_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,150 +19,79 @@ name:

config:
nodeId: 0x12344321
cluster: "Basic"
cluster: "Unit Localization"
endpoint: 0

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

- label: "TH reads TemperatureUnit attribute from DUT"
PICS: LUNIT.S.A0000
verification: |
Verify in TH log:
./chip-tool unitlocalization read temperature-unit 1 0
[1651186538224] [11210:117238] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_0000 DataVersion: 486381485
[1651186538224] [11210:117238] CHIP: [TOO] TemperatureUnit: 0
disabled: true
command: "readAttribute"
attribute: "TemperatureUnit"
response:
constraints:
type: uint8

- label: "TH writes 0 to TemperatureUnit attribute"
- label: "TH writes 0 (Fahrenheit) to TemperatureUnit attribute"
PICS: LUNIT.C.A0000.Fahrenheit
verification: |
Verify in TH log:
./chip-tool unitlocalization write temperature-unit 0 1 0
[1651191017267] [13215:170815] CHIP: [DMG] WriteResponseMessage =
[1651191017267] [13215:170815] CHIP: [DMG] {
[1651191017267] [13215:170815] CHIP: [DMG] AttributeStatusIBs =
[1651191017267] [13215:170815] CHIP: [DMG] [
[1651191017267] [13215:170815] CHIP: [DMG] AttributeStatusIB =
[1651191017267] [13215:170815] CHIP: [DMG] {
[1651191017267] [13215:170815] CHIP: [DMG] AttributePathIB =
[1651191017267] [13215:170815] CHIP: [DMG] {
[1651191017267] [13215:170815] CHIP: [DMG] Endpoint = 0x0,
[1651191017267] [13215:170815] CHIP: [DMG] Cluster = 0x2d,
[1651191017267] [13215:170815] CHIP: [DMG] Attribute = 0x0000_0000,
[1651191017267] [13215:170815] CHIP: [DMG] }
[1651191017267] [13215:170815] CHIP: [DMG]
[1651191017267] [13215:170815] CHIP: [DMG] StatusIB =
[1651191017267] [13215:170815] CHIP: [DMG] {
[1651191017267] [13215:170815] CHIP: [DMG] status = 0x00 (SUCCESS),
[1651191017267] [13215:170815] CHIP: [DMG] },
[1651191017267] [13215:170815] CHIP: [DMG]
[1651191017267] [13215:170815] CHIP: [DMG] },
[1651191017267] [13215:170815] CHIP: [DMG]
[1651191017267] [13215:170815] CHIP: [DMG] ],
[1651191017267] [13215:170815] CHIP: [DMG]
[1651191017267] [13215:170815] CHIP: [DMG] InteractionModelRevision = 1
disabled: true
cluster: "Unit Localization"
command: "writeAttribute"
attribute: "TemperatureUnit"
arguments:
value: 0

- label: "TH reads TemperatureUnit attribute"
PICS: LUNIT.C.A0000
verification: |
Verify in TH log:
command: "readAttribute"
attribute: "TemperatureUnit"
response:
value: 0

./chip-tool unitlocalization read temperature-unit 1 0
[1651190135534] [12868:159849] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_0000 DataVersion: 486381486
[1651190135534] [12868:159849] CHIP: [TOO] TemperatureUnit: 0
disabled: true

- label: "TH writes 1 to TemperatureUnit attribute"
- label: "TH writes 1 (Celsius) to TemperatureUnit attribute"
PICS: LUNIT.C.A0000.Celsius
verification: |
Verify in TH log:
./chip-tool unitlocalization write temperature-unit 1 1 0
[1651190221003] [12900:161139] CHIP: [DMG] WriteResponseMessage =
[1651190221003] [12900:161139] CHIP: [DMG] {
[1651190221003] [12900:161139] CHIP: [DMG] AttributeStatusIBs =
[1651190221003] [12900:161139] CHIP: [DMG] [
[1651190221003] [12900:161139] CHIP: [DMG] AttributeStatusIB =
[1651190221003] [12900:161139] CHIP: [DMG] {
[1651190221003] [12900:161139] CHIP: [DMG] AttributePathIB =
[1651190221003] [12900:161139] CHIP: [DMG] {
[1651190221003] [12900:161139] CHIP: [DMG] Endpoint = 0x0,
[1651190221003] [12900:161139] CHIP: [DMG] Cluster = 0x2d,
[1651190221003] [12900:161139] CHIP: [DMG] Attribute = 0x0000_0000,
[1651190221003] [12900:161139] CHIP: [DMG] }
[1651190221003] [12900:161139] CHIP: [DMG]
[1651190221003] [12900:161139] CHIP: [DMG] StatusIB =
[1651190221003] [12900:161139] CHIP: [DMG] {
[1651190221003] [12900:161139] CHIP: [DMG] status = 0x00 (SUCCESS),
[1651190221003] [12900:161139] CHIP: [DMG] },
[1651190221003] [12900:161139] CHIP: [DMG]
[1651190221003] [12900:161139] CHIP: [DMG] },
[1651190221003] [12900:161139] CHIP: [DMG]
[1651190221003] [12900:161139] CHIP: [DMG] ],
[1651190221003] [12900:161139] CHIP: [DMG]
[1651190221003] [12900:161139] CHIP: [DMG] InteractionModelRevision = 1
[1651190221003] [12900:161139] CHIP: [DMG] }
disabled: true
cluster: "Unit Localization"
command: "writeAttribute"
attribute: "TemperatureUnit"
arguments:
value: 1

- label: "TH reads TemperatureUnit attribute"
PICS: LUNIT.C.A0000
verification: |
Verify in TH log:
./chip-tool unitlocalization read temperature-unit 1 0
[1651190800434] [13122:167909] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_0000 DataVersion: 486381489
[1651190800434] [13122:167909] CHIP: [TOO] TemperatureUnit: 1
disabled: true
command: "readAttribute"
attribute: "TemperatureUnit"
response:
value: 1

- label: "TH writes 2 to TemperatureUnit attribute"
- label: "TH writes 2 (Kelvin) to TemperatureUnit attribute"
PICS: LUNIT.C.A0000.Kelvin
verification: |
Verify in TH log:
./chip-tool unitlocalization write temperature-unit 2 1 0
[1651190829573] [13133:168303] CHIP: [DMG] WriteResponseMessage =
[1651190829573] [13133:168303] CHIP: [DMG] {
[1651190829573] [13133:168303] CHIP: [DMG] AttributeStatusIBs =
[1651190829573] [13133:168303] CHIP: [DMG] [
[1651190829573] [13133:168303] CHIP: [DMG] AttributeStatusIB =
[1651190829573] [13133:168303] CHIP: [DMG] {
[1651190829573] [13133:168303] CHIP: [DMG] AttributePathIB =
[1651190829573] [13133:168303] CHIP: [DMG] {
[1651190829573] [13133:168303] CHIP: [DMG] Endpoint = 0x0,
[1651190829573] [13133:168303] CHIP: [DMG] Cluster = 0x2d,
[1651190829573] [13133:168303] CHIP: [DMG] Attribute = 0x0000_0000,
[1651190829573] [13133:168303] CHIP: [DMG] }
[1651190829573] [13133:168303] CHIP: [DMG]
[1651190829573] [13133:168303] CHIP: [DMG] StatusIB =
[1651190829573] [13133:168303] CHIP: [DMG] {
[1651190829573] [13133:168303] CHIP: [DMG] status = 0x00 (SUCCESS),
[1651190829573] [13133:168303] CHIP: [DMG] },
[1651190829573] [13133:168303] CHIP: [DMG]
[1651190829573] [13133:168303] CHIP: [DMG] },
[1651190829573] [13133:168303] CHIP: [DMG]
[1651190829573] [13133:168303] CHIP: [DMG] ],
[1651190829573] [13133:168303] CHIP: [DMG]
[1651190829573] [13133:168303] CHIP: [DMG] InteractionModelRevision = 1
[1651190829573] [13133:168303] CHIP: [DMG] }
disabled: true
cluster: "Unit Localization"
command: "writeAttribute"
attribute: "TemperatureUnit"
arguments:
value: 2

- label: "TH reads TemperatureUnit attribute"
PICS: LUNIT.C.A0000
verification: |
Verify in TH log:
./chip-tool unitlocalization read temperature-unit 1 0
[1651190908005] [13164:169492] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_002D Attribute 0x0000_0000 DataVersion: 486381490
[1651190908005] [13164:169492] CHIP: [TOO] TemperatureUnit: 2
disabled: true
command: "readAttribute"
attribute: "TemperatureUnit"
response:
value: 2

- label: "TH writes 5 to TemperatureUnit attribute"
PICS: LUNIT.C.A0000
verification: |
Verify in TH log:
Verify that the write request fails with 0x87 (Constraint Error)
disabled: true
cluster: "Unit Localization"
command: "writeAttribute"
attribute: "TemperatureUnit"
arguments:
# Per spec, if [TEMP] feature is enabled, then this attribute can be
# one of 0 (Farenheit), 1 (Celsius) or 2 (Kelvin)
value: 5 # INVALID
response:
error: CONSTRAINT_ERROR
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ limitations under the License.
mechanism by which they can be configured to use a user’s preferred unit.</description>
<globalAttribute side="either" code="0xFFFD" value="1"/>
<!-- Base data types -->
<attribute side="server" code="0x00" define="TEMPERATURE_UNIT" type="TempUnit" writable="true" optional="true">TemperatureUnit</attribute>
<attribute side="server" code="0x00" define="TEMPERATURE_UNIT" type="TempUnit" min="0" max="2" writable="true" optional="true">TemperatureUnit</attribute>
</cluster>
<bitmap name="UnitLocalizationFeature" type="BITMAP32">
<cluster code="0x002d"/>
Expand Down
Loading

0 comments on commit f12ed21

Please sign in to comment.