Skip to content

Commit

Permalink
Merge branch 'master' into plauric/fix-rvc-tc-3-2-add-precondition-check
Browse files Browse the repository at this point in the history
  • Loading branch information
plauric authored Sep 1, 2023
2 parents 0ec570f + 8bd7e08 commit 29593f6
Show file tree
Hide file tree
Showing 104 changed files with 5,095 additions and 5,901 deletions.
104 changes: 104 additions & 0 deletions credentials/development/gen_commissioner_dut_test_plan_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env -S python3 -B
#
# Copyright (c) 2023 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 argparse
import json
import os
from dataclasses import dataclass


@dataclass
class TestInfo:
desc: str
dir: str
pid: int


CHIP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..'))
RUNNER_SCRIPT_DIR = os.path.join(CHIP_ROOT, 'scripts/tests')


def write_test_plan_output(filename: str, cases: TestInfo, test_num: str):
with open(filename, "w") as output:
output.write(f'[[ref:da-{test_num}-certs]]\n')
output.write(f'Certificates for TC-DA-{test_num}\n')
output.write('|===\n')
output.write('|#| Cert Description| Example certs\n')
for i, f in enumerate(cases):
output.write(f'|{i+1}|{f.desc} | {f.dir} (pid={f.pid})\n')
output.write('|===\n')


def write_validation_steps(filename: str, cases: TestInfo):
with open(filename, "w") as output:
for f in cases:
cmd = f'./chip-all-clusters-app --trace_decode 1 --dac_provider $CHIP_ROOT/credentials/development/commissioner_dut/{f.dir}/test_case_vector.json --product-id {f.pid}'
output.write(f'{f.desc.replace(",","")}, {f.dir}, {f.pid}, {cmd}\n')


def main():

argparser = argparse.ArgumentParser()

argparser.add_argument("--failure_table", default="failure_table")
argparser.add_argument("--success_table", default="success_table")
argparser.add_argument("--success_vs", default="success_vs.csv")
argparser.add_argument("--failure_vs", default="failure_vs.csv")
args = argparser.parse_args()

cred_path = 'credentials/development/commissioner_dut'
cert_path = os.path.abspath(os.path.join(CHIP_ROOT, cred_path))

# The following test vectors are success conditions for an SDK commissioner for the following reasons:
# struct_cd_device_type_id_mismatch - requires DCL access, which the SDK does not have and is not required
# struct_cd_security_info_wrong - while devices are required to set this to 0, commissioners are required to ignore it
# (see 6.3.1)
# hence this is marked as a failure for devices, but should be a success case for
# commissioners
# struct_cd_security_level_wrong - as with security info, commissioners are required to ignore this value (see 6.3.1)
# struct_cd_version_number_wrong - this value is not meant to be interpreted by commissioners, so errors here should be
# ignored (6.3.1)
# struct_cd_cert_id_mismatch - requires DCL access, which the SDK does not have and is not required.
skip_cases = ['struct_cd_device_type_id_mismatch', 'struct_cd_security_info_wrong',
'struct_cd_security_level_wrong', 'struct_cd_version_number_wrong', 'struct_cd_cert_id_mismatch']

success_cases = []
failure_cases = []
for p in os.listdir(cert_path):
if p in skip_cases:
continue
path = str(os.path.join(cert_path, p, 'test_case_vector.json'))
with open(path, 'r') as f:
j = json.loads(f.read())
success_expected = j['is_success_case'].lower() == 'true'
pid = 177 if 'fallback_encoding' in p else 32768
desc = TestInfo(desc=j['description'], dir=p, pid=pid)
if success_expected:
success_cases.append(desc)
else:
failure_cases.append(desc)

write_test_plan_output(args.failure_table, failure_cases, '1.4')
write_test_plan_output(args.success_table, success_cases, '1.8')

write_validation_steps(args.failure_vs, failure_cases)
write_validation_steps(args.success_vs, success_cases)


if __name__ == '__main__':
main()
Original file line number Diff line number Diff line change
Expand Up @@ -2983,6 +2983,10 @@ server cluster DishwasherAlarm = 93 {
kWaterLevelError = 0x20;
}

bitmap Feature : BITMAP32 {
kReset = 0x1;
}

info event Notify = 0 {
AlarmMap active = 0;
AlarmMap inactive = 1;
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ def _GetChipReplUnsupportedTests() -> Set[str]:
"Test_TC_DGGEN_2_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_LWM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_G_2_4.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_RVCRUNM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
"Test_TC_RVCCLEANM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ bool DishwasherAlarmServer::HasResetFeature(EndpointId endpoint)
return false;
}

if (featureMap & 1)
if (featureMap & to_underlying(Feature::kReset))
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ void DoorLockServer::getWeekDayScheduleCommandHandler(chip::app::CommandHandler
{
ChipLogProgress(Zcl, "[GetWeekDaySchedule] User does not exist [endpointId=%d,weekDayIndex=%d,userIndex=%d]", endpointId,
weekDayIndex, userIndex);
sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kFailure);
sendGetWeekDayScheduleResponse(commandObj, commandPath, weekDayIndex, userIndex, DlStatus::kNotFound);
return;
}

Expand Down Expand Up @@ -1246,7 +1246,7 @@ void DoorLockServer::getYearDayScheduleCommandHandler(chip::app::CommandHandler
{
ChipLogProgress(Zcl, "[GetYearDaySchedule] User does not exist [endpointId=%d,yearDayIndex=%d,userIndex=%d]", endpointId,
yearDayIndex, userIndex);
sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kFailure);
sendGetYearDayScheduleResponse(commandObj, commandPath, yearDayIndex, userIndex, DlStatus::kNotFound);
return;
}

Expand Down
12 changes: 6 additions & 6 deletions src/app/tests/suites/DL_Schedules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

#
# Excercise SetYearDay schedules with invalid parameters
Expand Down Expand Up @@ -686,7 +686,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

#
# Excercise Set Holiday schedules with invalid parameters
Expand Down Expand Up @@ -1799,7 +1799,7 @@ tests:
- name: "UserIndex"
value: 1
- name: "Status"
value: 0x01
value: 0x8B

- label: "Make sure clearing first user also cleared year day schedules"
command: "GetYearDaySchedule"
Expand All @@ -1816,7 +1816,7 @@ tests:
- name: "UserIndex"
value: 1
- name: "Status"
value: 0x01
value: 0x8B

- label: "Make sure clearing second user also cleared week day schedules"
command: "GetWeekDaySchedule"
Expand All @@ -1833,7 +1833,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

- label: "Make sure clearing second user also cleared year day schedules"
command: "GetYearDaySchedule"
Expand All @@ -1850,7 +1850,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "Status"
value: 0x01
value: 0x8B

# Make sure that all the manipulations did not affect the holiday schedules
- label: "Make sure that first holiday schedule was not deleted"
Expand Down
84 changes: 40 additions & 44 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2664,67 +2664,60 @@ PICS:
#
# Server write attributes
#
- label: "Does the device implement simulation of a Not Fully Locked State?"
id: DRLK.S.M.SimulateNotFullyLocked

- label: "Does the DUT(server) support the DoorOpen Events attribute?"
id: DRLK.S.A0004.Write

- label: "Does the DUT(server) support the DoorClosedEvents attribute?"
id: DRLK.S.A0005.Write

- label: "Does the DUT(server) support the OpenPeriod attribute?"
id: DRLK.S.A0006.Write

- label: "Does the DUT(server) support the Language attribute?"
id: DRLK.S.A0021.Write

- label: "Does the DUT(server) support the LEDSettings attribute?"
id: DRLK.S.A0022.Write

- label: "Does the DUT(server) support the AutoRelockTime attribute?"
id: DRLK.S.A0023.Write

- label: "Does the DUT(server) support the SoundVolume attribute?"
id: DRLK.S.A0024.Write
- label: "Does the device implement detection of a LockJammed State?"
id: DRLK.S.M.DetectLockJammed

- label: "Does the DUT(server) support the OperatingMode attribute?"
id: DRLK.S.A0025.Write
- label: "Does the device implement Language attribute with write access?"
id: DRLK.S.M.LanguageAttributeWritable

- label:
"Does the DUT(server) support the EnableLocalProgramming attribute?"
id: DRLK.S.A0028.Write
"Does the device implement LEDSettings attribute with write access?"
id: DRLK.S.M.LEDSettingsAttributeWritable

- label: "Does the DUT(server) support the EnableOneTouchLocking attribute?"
id: DRLK.S.A0029.Write
- label:
"Does the device implement AutoRelockTime attribute with write access?"
id: DRLK.S.M.AutoRelockTimeAttributeWritable

- label: "Does the DUT(server) support the EnableInsideStatusLED attribute?"
id: DRLK.S.A002a.Write
- label:
"Does the device implement SoundVolume attribute with write access?"
id: DRLK.S.M.SoundVolumeAttributeWritable

- label:
"Does the DUT(server) support the EnablePrivacyModeButton attribute?"
id: DRLK.S.A002b.Write
"Does the device implement OperatingMode attribute with write access?"
id: DRLK.S.M.OperatingModeAttributeWritable

- label:
"Does the DUT(server) support the LocalProgrammingFeatures attribute?"
id: DRLK.S.A002c.Write
"Does the device implement EnableLocalProgramming attribute with write
access?"
id: DRLK.S.M.EnableLocalProgrammingAttributeWritable

- label: "Does the DUT(server) support the WrongCodeEntryLimit attribute?"
id: DRLK.S.A0030.Write
- label:
"Does the device implement LocalProgrammingFeatures attribute with
write access?"
id: DRLK.S.M.LocalProgrammingFeaturesAttributeWritable

- label:
"Does the DUT(server) support the UserCodedTemporaryDisableTime
attribute?"
id: DRLK.S.A0031.Write
"Does the device implement WrongCodeEntryLimit attribute with write
access?"
id: DRLK.S.M.WrongCodeEntryLimitAttributeWritable

- label: "Does the DUT(server) support the SendPINOverTheAir attribute?"
id: DRLK.S.A0032.Write
- label:
"Does the device implement UserCodedTemporaryDisableTime attribute
with write access?"
id: DRLK.S.M.UserCodedTemporaryDisableTimeAttributeWritable

- label:
"Does the DUT(server) support the RequirePINForRemoteOperation
attribute?"
id: DRLK.S.A0033.Write
"Does the device implement RequirePINForRemoteOperation attribute with
write access?"
id: DRLK.S.M.RequirePINForRemoteOperationAttributeWritable

- label: "Does the DUT(server) support the ExpiringUserTimeOut attribute?"
id: DRLK.S.A0035.Write
- label:
"Does the device implement ExpiringUserTimeOut attribute with write
access?"
id: DRLK.S.M.ExpiringUserTimeOutAttributeWritable

#
# server / commandsReceived
Expand Down Expand Up @@ -9237,6 +9230,9 @@ PICS:
"Can the Rinse attribute changed by physical control at the device?"
id: WASHERCTRL.S.M.ManuallyControlledRinse

- label: "Can the device be controlled manually?"
id: WASHERCTRL.S.M.ManuallyControlled

#
#RVC Run Mode
#
Expand Down
5 changes: 3 additions & 2 deletions src/app/tests/suites/certification/Test_TC_ACL_2_10.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -557,13 +557,14 @@ tests:
verification: |
./chip-tool accesscontrol read extension 2 0 --commissioner-name beta --commissioner-nodeid 223344
On TH2(Chiptool) , Verify AccessControlExtensionStruct containing 1 element, and MUST NOT contain an element with FabricIndex F1
Via the TH2(chip-tool), Verify the AccessControlExtensionStruct containing 1 element, and MUST NOT contain an element with FabricIndex F1
[1657289746.737641][19293:19298] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_001F Attribute 0x0000_0001 DataVersion: 1884338152
[1657289746.737713][19293:19298] CHIP:TOO: Extension: 1 entries
[1657289746.737778][19293:19298] CHIP:TOO: [1]: {
[1657289746.737803][19293:19298] CHIP:TOO: Data: 17D00000F1FF01003D48656C6C6F20576F726C642E205468697320697320612073696E676C6520656C656D656E74206C6976696E6720617320612063686172737472696E670018
[1657289746.737844][19293:19298] CHIP:TOO: Fab
[1657289746.737844][19293:19298] CHIP:TOO: FabricIndex: 2
[1657289746.737862][19293:19298] CHIP:TOO: }
cluster: "LogCommands"
command: "UserPrompt"
PICS: PICS_SKIP_SAMPLE_APP && ACL.S.A0001
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_ACL_2_7.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ tests:
#Issue https://github.com/CHIP-Specifications/chip-certification-tool/issues/768
- label: "TH2 writes Extension attribute value as empty list"
verification: |
./chip-tool accesscontrol write extension '[{}]' 2 0 --commissioner-name beta --commissioner-nodeid 223344
./chip-tool accesscontrol write extension '[]' 2 0 --commissioner-name beta --commissioner-nodeid 223344
cluster: "LogCommands"
command: "UserPrompt"
PICS: PICS_SKIP_SAMPLE_APP && ACL.S.A0001
Expand Down
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_ACT_2_1.yaml
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ tests:
disabled: true

- label:
"Step 6d: Verify SetupURL appended by '?/a='' and the decimal numeric
"Step 6d: Verify SetupURL appended by '?/a=' and the decimal numeric
value of one of the exposed ActionIDs (see step 5a) points to a site
providing information about the action"
PICS: ACT.S.A0002 && ACT.S.M.SetupURLWithSuffix
Expand Down
10 changes: 6 additions & 4 deletions src/app/tests/suites/certification/Test_TC_ALOGIN_12_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# 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: 3.14.1. [TC-ALOGIN-12.1] Account Login Verification

Expand Down Expand Up @@ -60,10 +59,11 @@ tests:
- name: "Status"
value: 0

#Issue: https://github.com/project-chip/connectedhomeip/issues/28992
- label:
"Step 1: TH sends a GetSetupPIN command to the DUT with test values
provided by the product maker."
PICS: ALOGIN.S.C00.Rsp
PICS: ALOGIN.S.C00.Rsp && PICS_SKIP_SAMPLE_APP
command: "GetSetupPIN"
timedInteractionTimeoutMs: 10000
arguments:
Expand All @@ -74,11 +74,13 @@ tests:
values:
- name: "SetupPIN"
saveAs: setupPIN
constraints:
minLength: 11

- label:
"Step 2: TH sends a Login command to the DUT with test values provided
by the product maker."
PICS: ALOGIN.S.C02.Rsp
PICS: ALOGIN.S.C02.Rsp && PICS_SKIP_SAMPLE_APP
command: "Login"
timedInteractionTimeoutMs: 10000
arguments:
Expand All @@ -91,6 +93,6 @@ tests:
- label:
"Step 3: TH sends a Logout command to the DUT with test values
provided by the product maker."
PICS: ALOGIN.S.C03.Rsp
PICS: ALOGIN.S.C03.Rsp && PICS_SKIP_SAMPLE_APP
command: "Logout"
timedInteractionTimeoutMs: 10000
Loading

0 comments on commit 29593f6

Please sign in to comment.