From 2feb25f062a1ee303c85eec8739c3e4feabb56d7 Mon Sep 17 00:00:00 2001 From: yeaissa <133245269+yeaissa@users.noreply.github.com> Date: Tue, 4 Jun 2024 11:48:56 +0200 Subject: [PATCH 01/78] Fix Zephyr WiFIManager build (#33707) * Fix Zephyr WiFIManager build * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/Zephyr/wifi/WiFiManager.cpp | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/platform/Zephyr/wifi/WiFiManager.cpp b/src/platform/Zephyr/wifi/WiFiManager.cpp index 69d2943235cdbd..11187a7cef1655 100644 --- a/src/platform/Zephyr/wifi/WiFiManager.cpp +++ b/src/platform/Zephyr/wifi/WiFiManager.cpp @@ -159,33 +159,33 @@ void WiFiManager::WifiMgmtEventHandler(net_mgmt_event_callback * cb, uint32_t mg CHIP_ERROR WiFiManager::Init() { // TODO: consider moving these to ConnectivityManagerImpl to be prepared for handling multiple interfaces on a single device. - Inet::UDPEndPointImplSockets::SetMulticastGroupHandler( - [](Inet::InterfaceId interfaceId, const Inet::IPAddress & address, UDPEndPointImplSockets::MulticastOperation operation) { - const in6_addr addr = InetUtils::ToZephyrAddr(address); - net_if * iface = InetUtils::GetInterface(interfaceId); - VerifyOrReturnError(iface != nullptr, INET_ERROR_UNKNOWN_INTERFACE); + Inet::UDPEndPointImplSockets::SetMulticastGroupHandler([](Inet::InterfaceId interfaceId, const Inet::IPAddress & address, + Inet::UDPEndPointImplSockets::MulticastOperation operation) { + const in6_addr addr = InetUtils::ToZephyrAddr(address); + net_if * iface = InetUtils::GetInterface(interfaceId); + VerifyOrReturnError(iface != nullptr, INET_ERROR_UNKNOWN_INTERFACE); - if (operation == UDPEndPointImplSockets::MulticastOperation::kJoin) - { - net_if_mcast_addr * maddr = net_if_ipv6_maddr_add(iface, &addr); + if (operation == Inet::UDPEndPointImplSockets::MulticastOperation::kJoin) + { + net_if_mcast_addr * maddr = net_if_ipv6_maddr_add(iface, &addr); - if (maddr && !net_if_ipv6_maddr_is_joined(maddr) && !net_ipv6_is_addr_mcast_link_all_nodes(&addr)) - { - net_if_ipv6_maddr_join(iface, maddr); - } - } - else if (operation == UDPEndPointImplSockets::MulticastOperation::kLeave) - { - VerifyOrReturnError(net_ipv6_is_addr_mcast_link_all_nodes(&addr) || net_if_ipv6_maddr_rm(iface, &addr), - CHIP_ERROR_INVALID_ADDRESS); - } - else + if (maddr && !net_if_ipv6_maddr_is_joined(maddr) && !net_ipv6_is_addr_mcast_link_all_nodes(&addr)) { - return CHIP_ERROR_INCORRECT_STATE; + net_if_ipv6_maddr_join(iface, maddr); } + } + else if (operation == Inet::UDPEndPointImplSockets::MulticastOperation::kLeave) + { + VerifyOrReturnError(net_ipv6_is_addr_mcast_link_all_nodes(&addr) || net_if_ipv6_maddr_rm(iface, &addr), + CHIP_ERROR_INVALID_ADDRESS); + } + else + { + return CHIP_ERROR_INCORRECT_STATE; + } - return CHIP_NO_ERROR; - }); + return CHIP_NO_ERROR; + }); net_mgmt_init_event_callback(&mWiFiMgmtClbk, WifiMgmtEventHandler, kWifiManagementEvents); net_mgmt_add_event_callback(&mWiFiMgmtClbk); From a63cf029243d847747355fdc8685d16fb10db107 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel Date: Tue, 4 Jun 2024 08:42:33 -0400 Subject: [PATCH 02/78] Streamline bloat reports, part 2 of 2 (#33716) * Streamline bloat reports, part 2 Remove the early attempt to aggregate FLASH vs RAM based on whether ELF segments are writable or not, which turned out not to be useful because several platforms mark flash segments as writable. Now that explicit section groups are in use (#33642), there is no additional value to segment aggregation even on platforms that mark them accurately. * Streamline bloat reports, part 2 Remove the early attempt to aggregate FLASH vs RAM based on whether ELF segments are writable or not, which turned out not to be useful because several platforms mark flash segments as writable. Now that explicit section groups are in use (#33642), there is no additional value to segment aggregation even on platforms that mark them accurately. * Filter down to region reports only. --- scripts/tools/memory/gh_report.py | 4 ++++ scripts/tools/memory/gh_sizes.py | 35 ++++++++-------------------- scripts/tools/memory/memdf/sizedb.py | 12 +++------- 3 files changed, 17 insertions(+), 34 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index a9315f7c628cbd..22d35e76375aa1 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -276,6 +276,10 @@ def report_matching_commits(self) -> Dict[str, pd.DataFrame]: continue df = pd.DataFrame(changes.rows, columns=changes.columns) + + # Filter down to region reports only. + df = df[df['kind'] == 'region'].drop('kind', axis=1) + df.attrs = { 'name': f'{pr},{parent},{commit}', 'title': (f'PR #{pr}: ' if pr else '') + diff --git a/scripts/tools/memory/gh_sizes.py b/scripts/tools/memory/gh_sizes.py index 4a32809de8bb40..012d5904517147 100755 --- a/scripts/tools/memory/gh_sizes.py +++ b/scripts/tools/memory/gh_sizes.py @@ -58,9 +58,9 @@ {"section": ".data", "size": 1648}, {"section": ".text", "size": 740236} ], - "wr": [ - {"wr": 0, "size": 262144}, - {"wr": 1, "size": 74023} + "region": [ + {"region": "FLASH", "size": 262144}, + {"region": "RAM", "size": 74023} ] } } @@ -77,8 +77,7 @@ import memdf.report import memdf.select import memdf.util -import numpy as np # type: ignore -from memdf import Config, ConfigDescription, DFs, SectionDF, SegmentDF +from memdf import Config, ConfigDescription, DFs, SectionDF PLATFORM_CONFIG_DIR = pathlib.Path('scripts/tools/memory/platform') @@ -162,7 +161,8 @@ def main(argv): **CONFIG, } # In case there is no platform configuration file, default to using a popular set of section names. - config_desc['section.select']['default'] = ['.text', '.rodata', '.data', '.bss'] + config_desc['section.select']['default'] = [ + '.text', '.rodata', '.data', '.bss'] config = Config().init(config_desc) config.put('output.file', output) @@ -197,32 +197,17 @@ def main(argv): collected: DFs = memdf.collect.collect_files(config, [binary]) - # Aggregate loaded segments, by writable (RAM) or not (flash). - segments = collected[SegmentDF.name] - segments['segment'] = segments.index - segments['wr'] = ((segments['flags'] & 2) != 0).convert_dtypes( - convert_boolean=False, convert_integer=True) - segment_summary = segments[segments['type'] == 'PT_LOAD'][[ - 'wr', 'size' - ]].groupby('wr').aggregate(np.sum).reset_index().astype( - {'size': np.int64}) - segment_summary.attrs['name'] = "wr" - sections = collected[SectionDF.name] - sections = sections.join(on='segment', - how='left', - other=segments, - rsuffix='-segment') - section_summary = sections[['section', 'size', - 'wr']].sort_values(by='section') + section_summary = sections[['section', + 'size']].sort_values(by='section') section_summary.attrs['name'] = "section" - region_summary = memdf.select.groupby(config, collected['section'], 'region') + region_summary = memdf.select.groupby( + config, collected['section'], 'region') region_summary.attrs['name'] = "region" summaries = { 'section': section_summary, - 'memory': segment_summary, 'region': region_summary, } diff --git a/scripts/tools/memory/memdf/sizedb.py b/scripts/tools/memory/memdf/sizedb.py index c3b221a963babf..12289694e3dc2b 100644 --- a/scripts/tools/memory/memdf/sizedb.py +++ b/scripts/tools/memory/memdf/sizedb.py @@ -109,13 +109,6 @@ def add_sizes_from_json(self, s: Union[bytes, str], origin: Dict): 'size': i['size'], 'kind': frame }) - # Add segment sizes. - for i in r['frames'].get('wr', []): - r['sizes'].append({ - 'name': ('(read only)', '(read/write)')[int(i['wr'])], - 'size': i['size'], - 'kind': 'wr' - }) self.add_sizes(**r) def add_sizes_from_zipfile(self, f: Union[IO, Path], origin: Dict): @@ -182,6 +175,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: pb.id AS parent_build, cb.id AS commit_build, t.platform, t.config, t.target, + cs.kind AS kind, cs.name AS name, ps.size AS parent_size, cs.size AS commit_size, @@ -196,7 +190,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: cs.name, cb.time DESC, pb.time DESC ''', (commit, parent)) - keep = ('platform', 'target', 'config', 'name', 'parent_size', + keep = ('platform', 'target', 'config', 'kind', 'name', 'parent_size', 'commit_size') things: set[int] = set() artifacts: set[int] = set() @@ -229,7 +223,7 @@ def select_changes(self, parent: str, commit: str) -> ChangeInfo: artifacts.add(row['artifact']) builds.add(row['commit_build']) - return ChangeInfo(('platform', 'target', 'config', 'section', + return ChangeInfo(('platform', 'target', 'config', 'kind', 'section', parent[:8], commit[:8], 'change', '% change'), rows, things, builds, stale_builds, artifacts, stale_artifacts) From f350172eb6cb73b0cc3867c41ced2a3477f0c28e Mon Sep 17 00:00:00 2001 From: C Freeman Date: Tue, 4 Jun 2024 10:14:25 -0400 Subject: [PATCH 03/78] DM XML: Update to latest 1.3 branch (#33679) * Update DM XMLs - removes clusters and data types that were ifdef'd at the index level - updates to the latest 1.3 branch which marks scenes as provisional and fixes the name on the offonly feature - adds in a couple of provisional clusters from the main spec that were previously not scraped - removes some empty cluster files * DM XMLs: Remove cluster fix --- data_model/clusters/ACL-Cluster.xml | 2 +- data_model/clusters/AccountLogin.xml | 2 +- .../clusters/AdminCommissioningCluster.xml | 2 +- data_model/clusters/AirQuality.xml | 2 +- data_model/clusters/AlarmBase.xml | 2 +- data_model/clusters/ApplicationBasic.xml | 2 +- data_model/clusters/ApplicationLauncher.xml | 2 +- data_model/clusters/AudioOutput.xml | 2 +- data_model/clusters/BallastConfiguration.xml | 2 +- .../clusters/BasicInformationCluster.xml | 2 +- data_model/clusters/Binding-Cluster.xml | 2 +- data_model/clusters/BooleanState.xml | 2 +- .../clusters/BooleanStateConfiguration.xml | 2 +- data_model/clusters/Channel.xml | 2 +- data_model/clusters/ColorControl.xml | 2 +- data_model/clusters/ContentAppObserver.xml | 2 +- data_model/clusters/ContentControl.xml | 2 +- data_model/clusters/ContentLauncher.xml | 2 +- .../clusters/DemandResponseLoadControl.xml | 554 ------------------ data_model/clusters/Descriptor-Cluster.xml | 2 +- .../clusters/DeviceEnergyManagement.xml | 2 +- data_model/clusters/DiagnosticLogsCluster.xml | 2 +- data_model/clusters/DiagnosticsEthernet.xml | 2 +- data_model/clusters/DiagnosticsGeneral.xml | 2 +- data_model/clusters/DiagnosticsSoftware.xml | 2 +- data_model/clusters/DiagnosticsThread.xml | 2 +- data_model/clusters/DiagnosticsWiFi.xml | 2 +- data_model/clusters/DishwasherAlarm.xml | 2 +- data_model/clusters/DoorLock.xml | 2 +- .../clusters/ElectricalEnergyMeasurement.xml | 2 +- .../clusters/ElectricalPowerMeasurement.xml | 2 +- data_model/clusters/EnergyCalendar.xml | 301 ---------- data_model/clusters/EnergyEVSE.xml | 2 +- data_model/clusters/EnergyPreference.xml | 2 +- data_model/clusters/EnergyPrice.xml | 233 -------- data_model/clusters/FanControl.xml | 2 +- data_model/clusters/FlowMeasurement.xml | 2 +- .../clusters/GeneralCommissioningCluster.xml | 2 +- .../clusters/Group-Key-Management-Cluster.xml | 2 +- data_model/clusters/Groups.xml | 2 +- data_model/clusters/ICDManagement.xml | 2 +- data_model/clusters/Identify.xml | 2 +- .../clusters/IlluminanceMeasurement.xml | 2 +- data_model/clusters/KeypadInput.xml | 2 +- .../Label-Cluster-FixedLabelCluster.xml | 2 +- .../clusters/Label-Cluster-LabelCluster.xml | 2 +- .../Label-Cluster-UserLabelCluster.xml | 2 +- data_model/clusters/LaundryDryerControls.xml | 2 +- data_model/clusters/LaundryWasherControls.xml | 2 +- data_model/clusters/LevelControl.xml | 2 +- .../clusters/LocalizationConfiguration.xml | 2 +- .../clusters/LocalizationTimeFormat.xml | 2 +- data_model/clusters/LocalizationUnit.xml | 2 +- data_model/clusters/LowPower.xml | 2 +- data_model/clusters/MediaInput.xml | 2 +- data_model/clusters/MediaPlayback.xml | 2 +- data_model/clusters/Messages.xml | 2 +- data_model/clusters/MicrowaveOvenControl.xml | 2 +- data_model/clusters/ModeBase.xml | 2 +- data_model/clusters/ModeSelect.xml | 2 +- .../clusters/Mode_DeviceEnergyManagement.xml | 2 +- data_model/clusters/Mode_Dishwasher.xml | 2 +- data_model/clusters/Mode_EVSE.xml | 2 +- data_model/clusters/Mode_LaundryWasher.xml | 2 +- data_model/clusters/Mode_MicrowaveOven.xml | 2 +- data_model/clusters/Mode_Oven.xml | 2 +- data_model/clusters/Mode_RVCClean.xml | 2 +- data_model/clusters/Mode_RVCRun.xml | 2 +- data_model/clusters/Mode_Refrigerator.xml | 2 +- .../clusters/NetworkCommissioningCluster.xml | 2 +- .../clusters/NetworkIdentityManagement.xml | 169 ------ data_model/clusters/OTAProvider.xml | 2 +- data_model/clusters/OTARequestor.xml | 2 +- data_model/clusters/OTASoftwareUpdate.xml | 58 -- data_model/clusters/OccupancySensing.xml | 2 +- data_model/clusters/OnOff.xml | 2 +- .../clusters/OperationalCredentialCluster.xml | 2 +- data_model/clusters/OperationalState.xml | 2 +- data_model/clusters/OperationalState_Oven.xml | 2 +- data_model/clusters/OperationalState_RVC.xml | 2 +- data_model/clusters/PowerSourceCluster.xml | 2 +- .../PowerSourceConfigurationCluster.xml | 2 +- data_model/clusters/PowerTopology.xml | 2 +- data_model/clusters/PressureMeasurement.xml | 2 +- ...ent.xml => ProxyConfiguration-Cluster.xml} | 46 +- ...nostics.xml => ProxyDiscovery-Cluster.xml} | 54 +- .../clusters/PumpConfigurationControl.xml | 2 +- data_model/clusters/RefrigeratorAlarm.xml | 2 +- data_model/clusters/Scenes.xml | 2 +- data_model/clusters/SmokeCOAlarm.xml | 2 +- data_model/clusters/Switch.xml | 2 +- data_model/clusters/TargetNavigator.xml | 2 +- data_model/clusters/TemperatureControl.xml | 2 +- .../clusters/TemperatureMeasurement.xml | 2 +- data_model/clusters/Thermostat.xml | 2 +- .../ThermostatUserInterfaceConfiguration.xml | 2 +- data_model/clusters/TimeSync.xml | 2 +- ...terHeater.xml => ValidProxies-Cluster.xml} | 40 +- .../clusters/ValveConfigurationControl.xml | 2 +- data_model/clusters/WakeOnLAN.xml | 2 +- data_model/clusters/WaterHeaterManagement.xml | 164 ------ .../clusters/WiFiPerDeviceCredentials.xml | 58 -- data_model/clusters/WindowCovering.xml | 2 +- .../bridge-clusters-ActionsCluster.xml | 2 +- ...s-BridgedDeviceBasicInformationCluster.xml | 2 +- data_model/clusters/cluster_ids.json | 10 +- data_model/clusters/energy_management.xml | 60 -- .../clusters/network_infrastructure.xml | 64 -- data_model/device_types/BooleanSensor.xml | 72 --- data_model/device_types/ColorDimmerSwitch.xml | 5 +- .../device_types/ColorTemperatureLight.xml | 10 +- data_model/device_types/ControlBridge.xml | 5 +- data_model/device_types/DimmableLight.xml | 10 +- .../device_types/DimmablePlug-InUnit.xml | 10 +- data_model/device_types/DimmerSwitch.xml | 5 +- .../device_types/DoorLockController.xml | 5 +- data_model/device_types/EnergyTariff.xml | 64 -- .../device_types/EnergyTariffCalendar.xml | 64 -- .../device_types/ExtendedColorLight.xml | 10 +- .../device_types/HeatingCoolingUnit.xml | 92 --- .../NetworkInfraIntro-CommonRequirements.xml | 58 -- .../NetworkInfraIntro-Introduction.xml | 58 -- data_model/device_types/NetworkInfraIntro.xml | 58 -- .../device_types/NetworkInfraManager.xml | 72 --- data_model/device_types/OnOffLight.xml | 12 +- data_model/device_types/OnOffLightSwitch.xml | 5 +- data_model/device_types/OnOffPlug-inUnit.xml | 12 +- data_model/device_types/OnOffSensor.xml | 5 +- data_model/device_types/Pump.xml | 5 +- data_model/device_types/PumpController.xml | 5 +- .../device_types/RoomAirConditioner.xml | 5 +- data_model/device_types/Thermostat.xml | 5 +- .../device_types/ThreadBorderRouter.xml | 80 --- .../device_types/ThreePhasePowerSource.xml | 82 --- data_model/device_types/Valve.xml | 72 --- data_model/device_types/WaterHeater.xml | 100 ---- data_model/device_types/WindowCovering.xml | 1 + .../device_types/WindowCoveringController.xml | 1 + data_model/spec_sha | 2 +- docs/spec_clusters.md | 10 +- scripts/spec_xml/generate_spec_xml.py | 10 - 141 files changed, 279 insertions(+), 2732 deletions(-) delete mode 100644 data_model/clusters/DemandResponseLoadControl.xml delete mode 100644 data_model/clusters/EnergyCalendar.xml delete mode 100644 data_model/clusters/EnergyPrice.xml delete mode 100644 data_model/clusters/NetworkIdentityManagement.xml delete mode 100644 data_model/clusters/OTASoftwareUpdate.xml rename data_model/clusters/{WiFiNetworkManagement.xml => ProxyConfiguration-Cluster.xml} (75%) rename data_model/clusters/{ThreadBorderRouterDiagnostics.xml => ProxyDiscovery-Cluster.xml} (73%) rename data_model/clusters/{Mode_WaterHeater.xml => ValidProxies-Cluster.xml} (70%) delete mode 100644 data_model/clusters/WaterHeaterManagement.xml delete mode 100644 data_model/clusters/WiFiPerDeviceCredentials.xml delete mode 100644 data_model/clusters/energy_management.xml delete mode 100644 data_model/clusters/network_infrastructure.xml delete mode 100644 data_model/device_types/BooleanSensor.xml delete mode 100644 data_model/device_types/EnergyTariff.xml delete mode 100644 data_model/device_types/EnergyTariffCalendar.xml delete mode 100644 data_model/device_types/HeatingCoolingUnit.xml delete mode 100644 data_model/device_types/NetworkInfraIntro-CommonRequirements.xml delete mode 100644 data_model/device_types/NetworkInfraIntro-Introduction.xml delete mode 100644 data_model/device_types/NetworkInfraIntro.xml delete mode 100644 data_model/device_types/NetworkInfraManager.xml delete mode 100644 data_model/device_types/ThreadBorderRouter.xml delete mode 100644 data_model/device_types/ThreePhasePowerSource.xml delete mode 100644 data_model/device_types/Valve.xml delete mode 100644 data_model/device_types/WaterHeater.xml diff --git a/data_model/clusters/ACL-Cluster.xml b/data_model/clusters/ACL-Cluster.xml index b965eb84234e0d..a193ef2ac3206f 100644 --- a/data_model/clusters/ACL-Cluster.xml +++ b/data_model/clusters/ACL-Cluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/AccountLogin.xml b/data_model/clusters/AccountLogin.xml index db87d05dc74902..8a9ed7d9389f40 100644 --- a/data_model/clusters/AccountLogin.xml +++ b/data_model/clusters/AccountLogin.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AdminCommissioningCluster.xml b/data_model/clusters/AdminCommissioningCluster.xml index eea41bc65b6e2c..ccbb579134dc00 100644 --- a/data_model/clusters/AdminCommissioningCluster.xml +++ b/data_model/clusters/AdminCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/AirQuality.xml b/data_model/clusters/AirQuality.xml index 2e188b97d23336..c05717863c5ff4 100644 --- a/data_model/clusters/AirQuality.xml +++ b/data_model/clusters/AirQuality.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AlarmBase.xml b/data_model/clusters/AlarmBase.xml index f4ffc6344a8b90..fd0ccb5bc19d46 100644 --- a/data_model/clusters/AlarmBase.xml +++ b/data_model/clusters/AlarmBase.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ApplicationBasic.xml b/data_model/clusters/ApplicationBasic.xml index fa197a8d1e5cca..ee39b8a421209d 100644 --- a/data_model/clusters/ApplicationBasic.xml +++ b/data_model/clusters/ApplicationBasic.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ApplicationLauncher.xml b/data_model/clusters/ApplicationLauncher.xml index 6b84436e73d42d..57d6858dd8ce14 100644 --- a/data_model/clusters/ApplicationLauncher.xml +++ b/data_model/clusters/ApplicationLauncher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/AudioOutput.xml b/data_model/clusters/AudioOutput.xml index 468ba2750152a6..27bb5a20bb7952 100644 --- a/data_model/clusters/AudioOutput.xml +++ b/data_model/clusters/AudioOutput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BallastConfiguration.xml b/data_model/clusters/BallastConfiguration.xml index f25bef22cb4b6c..0f37d86067e994 100644 --- a/data_model/clusters/BallastConfiguration.xml +++ b/data_model/clusters/BallastConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BasicInformationCluster.xml b/data_model/clusters/BasicInformationCluster.xml index 82b9283b0d21d6..137e8b70408bf8 100644 --- a/data_model/clusters/BasicInformationCluster.xml +++ b/data_model/clusters/BasicInformationCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Binding-Cluster.xml b/data_model/clusters/Binding-Cluster.xml index 937b9164e2a4f8..444c99b315348d 100644 --- a/data_model/clusters/Binding-Cluster.xml +++ b/data_model/clusters/Binding-Cluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BooleanState.xml b/data_model/clusters/BooleanState.xml index 9205310c58f2be..5bb29f53ae0c3e 100644 --- a/data_model/clusters/BooleanState.xml +++ b/data_model/clusters/BooleanState.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/BooleanStateConfiguration.xml b/data_model/clusters/BooleanStateConfiguration.xml index a9c370b95fe15c..01444d565294b3 100644 --- a/data_model/clusters/BooleanStateConfiguration.xml +++ b/data_model/clusters/BooleanStateConfiguration.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Channel.xml b/data_model/clusters/Channel.xml index 1809f5262e7166..17144c9032c3e5 100644 --- a/data_model/clusters/Channel.xml +++ b/data_model/clusters/Channel.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ColorControl.xml b/data_model/clusters/ColorControl.xml index b913009f852761..456b3ff14cfff9 100644 --- a/data_model/clusters/ColorControl.xml +++ b/data_model/clusters/ColorControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ContentAppObserver.xml b/data_model/clusters/ContentAppObserver.xml index 184cce14924cda..d6808baf982215 100644 --- a/data_model/clusters/ContentAppObserver.xml +++ b/data_model/clusters/ContentAppObserver.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ContentControl.xml b/data_model/clusters/ContentControl.xml index 14996a7c28011a..b2539cf445c289 100644 --- a/data_model/clusters/ContentControl.xml +++ b/data_model/clusters/ContentControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/ContentLauncher.xml b/data_model/clusters/ContentLauncher.xml index b8f80de2e51ea7..9a5674efa8eb64 100644 --- a/data_model/clusters/ContentLauncher.xml +++ b/data_model/clusters/ContentLauncher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DemandResponseLoadControl.xml b/data_model/clusters/DemandResponseLoadControl.xml deleted file mode 100644 index 206201b347612c..00000000000000 --- a/data_model/clusters/DemandResponseLoadControl.xml +++ /dev/null @@ -1,554 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/Descriptor-Cluster.xml b/data_model/clusters/Descriptor-Cluster.xml index 1b17fb4fdfdaea..659b2ffaa5ddc0 100644 --- a/data_model/clusters/Descriptor-Cluster.xml +++ b/data_model/clusters/Descriptor-Cluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DeviceEnergyManagement.xml b/data_model/clusters/DeviceEnergyManagement.xml index e493c5b332182e..f74d7e572550cc 100644 --- a/data_model/clusters/DeviceEnergyManagement.xml +++ b/data_model/clusters/DeviceEnergyManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/DiagnosticLogsCluster.xml b/data_model/clusters/DiagnosticLogsCluster.xml index 5b67564b18f298..38520e81a85e16 100644 --- a/data_model/clusters/DiagnosticLogsCluster.xml +++ b/data_model/clusters/DiagnosticLogsCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsEthernet.xml b/data_model/clusters/DiagnosticsEthernet.xml index 9d4822479ef5a6..dfcd3d11c41f52 100644 --- a/data_model/clusters/DiagnosticsEthernet.xml +++ b/data_model/clusters/DiagnosticsEthernet.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsGeneral.xml b/data_model/clusters/DiagnosticsGeneral.xml index 1141123c83b6be..4da912b03dc3df 100644 --- a/data_model/clusters/DiagnosticsGeneral.xml +++ b/data_model/clusters/DiagnosticsGeneral.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsSoftware.xml b/data_model/clusters/DiagnosticsSoftware.xml index 2c0b0b8a91a6ae..7cb3c9ff39ad2f 100644 --- a/data_model/clusters/DiagnosticsSoftware.xml +++ b/data_model/clusters/DiagnosticsSoftware.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsThread.xml b/data_model/clusters/DiagnosticsThread.xml index a05d5dc1b2d2fc..120efaddf8c08e 100644 --- a/data_model/clusters/DiagnosticsThread.xml +++ b/data_model/clusters/DiagnosticsThread.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DiagnosticsWiFi.xml b/data_model/clusters/DiagnosticsWiFi.xml index 49ef964da7a545..b3951d967dc31f 100644 --- a/data_model/clusters/DiagnosticsWiFi.xml +++ b/data_model/clusters/DiagnosticsWiFi.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/DishwasherAlarm.xml b/data_model/clusters/DishwasherAlarm.xml index b3b67e2bffb500..bdc399f9399486 100644 --- a/data_model/clusters/DishwasherAlarm.xml +++ b/data_model/clusters/DishwasherAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/DoorLock.xml b/data_model/clusters/DoorLock.xml index 16d26420fe2009..fcf86f3a95aa24 100644 --- a/data_model/clusters/DoorLock.xml +++ b/data_model/clusters/DoorLock.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ElectricalEnergyMeasurement.xml b/data_model/clusters/ElectricalEnergyMeasurement.xml index 98020764397116..f8bbec4c03db95 100644 --- a/data_model/clusters/ElectricalEnergyMeasurement.xml +++ b/data_model/clusters/ElectricalEnergyMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ElectricalPowerMeasurement.xml b/data_model/clusters/ElectricalPowerMeasurement.xml index c695e8db031790..cfb8ce9018e73c 100644 --- a/data_model/clusters/ElectricalPowerMeasurement.xml +++ b/data_model/clusters/ElectricalPowerMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyCalendar.xml b/data_model/clusters/EnergyCalendar.xml deleted file mode 100644 index 8d3f1b343bb4a7..00000000000000 --- a/data_model/clusters/EnergyCalendar.xml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/EnergyEVSE.xml b/data_model/clusters/EnergyEVSE.xml index d7786da5cda99d..4b881f5a1135a4 100644 --- a/data_model/clusters/EnergyEVSE.xml +++ b/data_model/clusters/EnergyEVSE.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyPreference.xml b/data_model/clusters/EnergyPreference.xml index c3676520ed6d01..eafb527a868b22 100644 --- a/data_model/clusters/EnergyPreference.xml +++ b/data_model/clusters/EnergyPreference.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/EnergyPrice.xml b/data_model/clusters/EnergyPrice.xml deleted file mode 100644 index 1683fe1bbc13cf..00000000000000 --- a/data_model/clusters/EnergyPrice.xml +++ /dev/null @@ -1,233 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/FanControl.xml b/data_model/clusters/FanControl.xml index 756a7bd27466b3..224f811261f68b 100644 --- a/data_model/clusters/FanControl.xml +++ b/data_model/clusters/FanControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/FlowMeasurement.xml b/data_model/clusters/FlowMeasurement.xml index 29f9d9d7ae58f9..71178874d57c14 100644 --- a/data_model/clusters/FlowMeasurement.xml +++ b/data_model/clusters/FlowMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/GeneralCommissioningCluster.xml b/data_model/clusters/GeneralCommissioningCluster.xml index e7877635bbac68..e440222780ea02 100644 --- a/data_model/clusters/GeneralCommissioningCluster.xml +++ b/data_model/clusters/GeneralCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Group-Key-Management-Cluster.xml b/data_model/clusters/Group-Key-Management-Cluster.xml index 8867a395299bbd..c1819628e34d7b 100644 --- a/data_model/clusters/Group-Key-Management-Cluster.xml +++ b/data_model/clusters/Group-Key-Management-Cluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/Groups.xml b/data_model/clusters/Groups.xml index 72902e878cbe9f..1f168e13fad933 100644 --- a/data_model/clusters/Groups.xml +++ b/data_model/clusters/Groups.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ICDManagement.xml b/data_model/clusters/ICDManagement.xml index 534b8340143083..512dfd119efef7 100644 --- a/data_model/clusters/ICDManagement.xml +++ b/data_model/clusters/ICDManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA // Update Name --> - + diff --git a/data_model/clusters/Identify.xml b/data_model/clusters/Identify.xml index 1cdc33aa0df727..8044ceb33dc3bd 100644 --- a/data_model/clusters/Identify.xml +++ b/data_model/clusters/Identify.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/IlluminanceMeasurement.xml b/data_model/clusters/IlluminanceMeasurement.xml index c39daa0e6bdc4d..d3228b845ca058 100644 --- a/data_model/clusters/IlluminanceMeasurement.xml +++ b/data_model/clusters/IlluminanceMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/KeypadInput.xml b/data_model/clusters/KeypadInput.xml index 4cfb509b06d0be..57d6ef4650e013 100644 --- a/data_model/clusters/KeypadInput.xml +++ b/data_model/clusters/KeypadInput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-FixedLabelCluster.xml b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml index e73bfc274a9da4..98106b6fc33e40 100644 --- a/data_model/clusters/Label-Cluster-FixedLabelCluster.xml +++ b/data_model/clusters/Label-Cluster-FixedLabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-LabelCluster.xml b/data_model/clusters/Label-Cluster-LabelCluster.xml index f107a0a7b3f12b..0ca5566f0dc132 100644 --- a/data_model/clusters/Label-Cluster-LabelCluster.xml +++ b/data_model/clusters/Label-Cluster-LabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Label-Cluster-UserLabelCluster.xml b/data_model/clusters/Label-Cluster-UserLabelCluster.xml index f7e809ab785c00..eba0099ffb59d2 100644 --- a/data_model/clusters/Label-Cluster-UserLabelCluster.xml +++ b/data_model/clusters/Label-Cluster-UserLabelCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/LaundryDryerControls.xml b/data_model/clusters/LaundryDryerControls.xml index a3f7b911fc9e9c..af4f787c0432b7 100644 --- a/data_model/clusters/LaundryDryerControls.xml +++ b/data_model/clusters/LaundryDryerControls.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LaundryWasherControls.xml b/data_model/clusters/LaundryWasherControls.xml index 16879842721473..6c4f4bc0b0c3a5 100644 --- a/data_model/clusters/LaundryWasherControls.xml +++ b/data_model/clusters/LaundryWasherControls.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LevelControl.xml b/data_model/clusters/LevelControl.xml index 5cacf7e89a5162..fa6cbe397a672a 100644 --- a/data_model/clusters/LevelControl.xml +++ b/data_model/clusters/LevelControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + + diff --git a/data_model/clusters/LocalizationTimeFormat.xml b/data_model/clusters/LocalizationTimeFormat.xml index fb8ceea3ee17a8..db8b809b0341a9 100644 --- a/data_model/clusters/LocalizationTimeFormat.xml +++ b/data_model/clusters/LocalizationTimeFormat.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LocalizationUnit.xml b/data_model/clusters/LocalizationUnit.xml index be7ea6a0aa2d78..2c6e1ecbd648e6 100644 --- a/data_model/clusters/LocalizationUnit.xml +++ b/data_model/clusters/LocalizationUnit.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/LowPower.xml b/data_model/clusters/LowPower.xml index 4c228d3154dfa1..cf75cb0c680164 100644 --- a/data_model/clusters/LowPower.xml +++ b/data_model/clusters/LowPower.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MediaInput.xml b/data_model/clusters/MediaInput.xml index b7d9d2ef017035..a92985ff924a75 100644 --- a/data_model/clusters/MediaInput.xml +++ b/data_model/clusters/MediaInput.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MediaPlayback.xml b/data_model/clusters/MediaPlayback.xml index e9194b6854c569..03175277dc12c5 100644 --- a/data_model/clusters/MediaPlayback.xml +++ b/data_model/clusters/MediaPlayback.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Messages.xml b/data_model/clusters/Messages.xml index 61f21bef9c95f3..402310c4b92eea 100644 --- a/data_model/clusters/Messages.xml +++ b/data_model/clusters/Messages.xml @@ -96,7 +96,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/MicrowaveOvenControl.xml b/data_model/clusters/MicrowaveOvenControl.xml index 27f31dcba966b7..ecc9d23b143d4b 100644 --- a/data_model/clusters/MicrowaveOvenControl.xml +++ b/data_model/clusters/MicrowaveOvenControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/ModeBase.xml b/data_model/clusters/ModeBase.xml index 2a11f85d343b39..dcd6cf1c448028 100644 --- a/data_model/clusters/ModeBase.xml +++ b/data_model/clusters/ModeBase.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + + diff --git a/data_model/clusters/Mode_DeviceEnergyManagement.xml b/data_model/clusters/Mode_DeviceEnergyManagement.xml index 592c7d4290a342..e167e8649650ba 100644 --- a/data_model/clusters/Mode_DeviceEnergyManagement.xml +++ b/data_model/clusters/Mode_DeviceEnergyManagement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Dishwasher.xml b/data_model/clusters/Mode_Dishwasher.xml index 4ff6e78714f648..40a19828d44ebb 100644 --- a/data_model/clusters/Mode_Dishwasher.xml +++ b/data_model/clusters/Mode_Dishwasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_EVSE.xml b/data_model/clusters/Mode_EVSE.xml index de88cb3717c8bf..27a1adcfcd5a2a 100644 --- a/data_model/clusters/Mode_EVSE.xml +++ b/data_model/clusters/Mode_EVSE.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_LaundryWasher.xml b/data_model/clusters/Mode_LaundryWasher.xml index c59b2c3fef9051..5d3cce891790e1 100644 --- a/data_model/clusters/Mode_LaundryWasher.xml +++ b/data_model/clusters/Mode_LaundryWasher.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_MicrowaveOven.xml b/data_model/clusters/Mode_MicrowaveOven.xml index 6e8a129444b9fd..6f1e8ed895f489 100644 --- a/data_model/clusters/Mode_MicrowaveOven.xml +++ b/data_model/clusters/Mode_MicrowaveOven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Oven.xml b/data_model/clusters/Mode_Oven.xml index f6c7111bb844cd..9c596e01467418 100644 --- a/data_model/clusters/Mode_Oven.xml +++ b/data_model/clusters/Mode_Oven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_RVCClean.xml b/data_model/clusters/Mode_RVCClean.xml index 0738d20c0c23dd..eed508072f6460 100644 --- a/data_model/clusters/Mode_RVCClean.xml +++ b/data_model/clusters/Mode_RVCClean.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_RVCRun.xml b/data_model/clusters/Mode_RVCRun.xml index b5811a0a6cfe05..314afe1be2a984 100644 --- a/data_model/clusters/Mode_RVCRun.xml +++ b/data_model/clusters/Mode_RVCRun.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Mode_Refrigerator.xml b/data_model/clusters/Mode_Refrigerator.xml index d51e30b68d1320..b4550283daf9e5 100644 --- a/data_model/clusters/Mode_Refrigerator.xml +++ b/data_model/clusters/Mode_Refrigerator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/NetworkCommissioningCluster.xml b/data_model/clusters/NetworkCommissioningCluster.xml index f9810212a79659..855947e5dda349 100644 --- a/data_model/clusters/NetworkCommissioningCluster.xml +++ b/data_model/clusters/NetworkCommissioningCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/NetworkIdentityManagement.xml b/data_model/clusters/NetworkIdentityManagement.xml deleted file mode 100644 index 20e264277a4330..00000000000000 --- a/data_model/clusters/NetworkIdentityManagement.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/OTAProvider.xml b/data_model/clusters/OTAProvider.xml index baf3996d3b911f..2a5be10961f02c 100644 --- a/data_model/clusters/OTAProvider.xml +++ b/data_model/clusters/OTAProvider.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OTARequestor.xml b/data_model/clusters/OTARequestor.xml index 592e900ff6720b..f6a5ff0365abed 100644 --- a/data_model/clusters/OTARequestor.xml +++ b/data_model/clusters/OTARequestor.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OTASoftwareUpdate.xml b/data_model/clusters/OTASoftwareUpdate.xml deleted file mode 100644 index 16389bd7fe9b67..00000000000000 --- a/data_model/clusters/OTASoftwareUpdate.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/OccupancySensing.xml b/data_model/clusters/OccupancySensing.xml index 9479f2041d6c6b..48756121d24769 100644 --- a/data_model/clusters/OccupancySensing.xml +++ b/data_model/clusters/OccupancySensing.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OnOff.xml b/data_model/clusters/OnOff.xml index 0b1e32af50cddb..9366985e5ce35e 100644 --- a/data_model/clusters/OnOff.xml +++ b/data_model/clusters/OnOff.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OperationalCredentialCluster.xml b/data_model/clusters/OperationalCredentialCluster.xml index 1a2becd5c478a2..2aa070f96b2573 100644 --- a/data_model/clusters/OperationalCredentialCluster.xml +++ b/data_model/clusters/OperationalCredentialCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OperationalState.xml b/data_model/clusters/OperationalState.xml index 98990eac3ded4d..3648a8c81ec8f4 100644 --- a/data_model/clusters/OperationalState.xml +++ b/data_model/clusters/OperationalState.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/OperationalState_Oven.xml b/data_model/clusters/OperationalState_Oven.xml index c44ac37b7ccac9..fbcc634330faa7 100644 --- a/data_model/clusters/OperationalState_Oven.xml +++ b/data_model/clusters/OperationalState_Oven.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/OperationalState_RVC.xml b/data_model/clusters/OperationalState_RVC.xml index 7e37a6b5f6f01b..f33791fcf86407 100644 --- a/data_model/clusters/OperationalState_RVC.xml +++ b/data_model/clusters/OperationalState_RVC.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/PowerSourceCluster.xml b/data_model/clusters/PowerSourceCluster.xml index 28a9154116ed7c..1c01cc548bfdee 100644 --- a/data_model/clusters/PowerSourceCluster.xml +++ b/data_model/clusters/PowerSourceCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PowerSourceConfigurationCluster.xml b/data_model/clusters/PowerSourceConfigurationCluster.xml index 11e3bd47dd9186..6a47ce1b54cdbd 100644 --- a/data_model/clusters/PowerSourceConfigurationCluster.xml +++ b/data_model/clusters/PowerSourceConfigurationCluster.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PowerTopology.xml b/data_model/clusters/PowerTopology.xml index dac690fdcc465d..4ebdda614a4aec 100644 --- a/data_model/clusters/PowerTopology.xml +++ b/data_model/clusters/PowerTopology.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/PressureMeasurement.xml b/data_model/clusters/PressureMeasurement.xml index d9c4a4584404fe..a46e911253941f 100644 --- a/data_model/clusters/PressureMeasurement.xml +++ b/data_model/clusters/PressureMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WiFiNetworkManagement.xml b/data_model/clusters/ProxyConfiguration-Cluster.xml similarity index 75% rename from data_model/clusters/WiFiNetworkManagement.xml rename to data_model/clusters/ProxyConfiguration-Cluster.xml index 1a3fceec2747d3..8ad566ec8527b2 100644 --- a/data_model/clusters/WiFiNetworkManagement.xml +++ b/data_model/clusters/ProxyConfiguration-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + + + + + + + + + + + + + + + + - - - + + + + - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/ThreadBorderRouterDiagnostics.xml b/data_model/clusters/ProxyDiscovery-Cluster.xml similarity index 73% rename from data_model/clusters/ThreadBorderRouterDiagnostics.xml rename to data_model/clusters/ProxyDiscovery-Cluster.xml index 5527c486a0cc51..6fa4a9eb6f3a06 100644 --- a/data_model/clusters/ThreadBorderRouterDiagnostics.xml +++ b/data_model/clusters/ProxyDiscovery-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + - - - - - + + - - - - - + + + + + + + + + + - - - - - + + - - - - - + + + + + + + + + + diff --git a/data_model/clusters/PumpConfigurationControl.xml b/data_model/clusters/PumpConfigurationControl.xml index cfd2971a395ecb..79fafe659c95e2 100644 --- a/data_model/clusters/PumpConfigurationControl.xml +++ b/data_model/clusters/PumpConfigurationControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/RefrigeratorAlarm.xml b/data_model/clusters/RefrigeratorAlarm.xml index caad94da1f6fad..a3a75011813cd1 100644 --- a/data_model/clusters/RefrigeratorAlarm.xml +++ b/data_model/clusters/RefrigeratorAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: short --> - + diff --git a/data_model/clusters/Scenes.xml b/data_model/clusters/Scenes.xml index d9c0ee76fe37d2..bf68f8528fa159 100644 --- a/data_model/clusters/Scenes.xml +++ b/data_model/clusters/Scenes.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/SmokeCOAlarm.xml b/data_model/clusters/SmokeCOAlarm.xml index d3d35f13f15f25..25c034ac94082c 100644 --- a/data_model/clusters/SmokeCOAlarm.xml +++ b/data_model/clusters/SmokeCOAlarm.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Switch.xml b/data_model/clusters/Switch.xml index e7170049ac051f..c7b607c637c74c 100644 --- a/data_model/clusters/Switch.xml +++ b/data_model/clusters/Switch.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TargetNavigator.xml b/data_model/clusters/TargetNavigator.xml index cfb3a0c17a6f99..c5fb59919585c1 100644 --- a/data_model/clusters/TargetNavigator.xml +++ b/data_model/clusters/TargetNavigator.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/TemperatureControl.xml b/data_model/clusters/TemperatureControl.xml index 70fc100d83bbab..3f5fa9c00332d6 100644 --- a/data_model/clusters/TemperatureControl.xml +++ b/data_model/clusters/TemperatureControl.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance + 508 Second Street, Suite 206 + Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TemperatureMeasurement.xml b/data_model/clusters/TemperatureMeasurement.xml index 540af82bcedd18..176fad6b246a60 100644 --- a/data_model/clusters/TemperatureMeasurement.xml +++ b/data_model/clusters/TemperatureMeasurement.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/Thermostat.xml b/data_model/clusters/Thermostat.xml index 71a0c48c6a8eb8..75640c697e0478 100644 --- a/data_model/clusters/Thermostat.xml +++ b/data_model/clusters/Thermostat.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml index 63fdba001c67a9..b4ecd49f93ae4a 100644 --- a/data_model/clusters/ThermostatUserInterfaceConfiguration.xml +++ b/data_model/clusters/ThermostatUserInterfaceConfiguration.xml @@ -55,7 +55,7 @@ Connectivity Standards Alliance 508 Second Street, Suite 206 Davis, CA 95616, USA --> - + diff --git a/data_model/clusters/TimeSync.xml b/data_model/clusters/TimeSync.xml index 68e98a1bf427fe..9d4057db8bdb85 100644 --- a/data_model/clusters/TimeSync.xml +++ b/data_model/clusters/TimeSync.xml @@ -58,7 +58,7 @@ Davis, CA 95616, USA :imagesdir: service_device_management/images :xrefstyle: full --> - + diff --git a/data_model/clusters/Mode_WaterHeater.xml b/data_model/clusters/ValidProxies-Cluster.xml similarity index 70% rename from data_model/clusters/Mode_WaterHeater.xml rename to data_model/clusters/ValidProxies-Cluster.xml index 56f1a1e9a66951..b9db8e1762647f 100644 --- a/data_model/clusters/Mode_WaterHeater.xml +++ b/data_model/clusters/ValidProxies-Cluster.xml @@ -1,6 +1,6 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data_model/clusters/ValveConfigurationControl.xml b/data_model/clusters/ValveConfigurationControl.xml index 548fed7d7357c2..b0f2ec91b0fa95 100644 --- a/data_model/clusters/ValveConfigurationControl.xml +++ b/data_model/clusters/ValveConfigurationControl.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WakeOnLAN.xml b/data_model/clusters/WakeOnLAN.xml index deb5af5a75ac7d..4f6e032c084b38 100644 --- a/data_model/clusters/WakeOnLAN.xml +++ b/data_model/clusters/WakeOnLAN.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/WaterHeaterManagement.xml b/data_model/clusters/WaterHeaterManagement.xml deleted file mode 100644 index cc641c8269fb3c..00000000000000 --- a/data_model/clusters/WaterHeaterManagement.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/clusters/WiFiPerDeviceCredentials.xml b/data_model/clusters/WiFiPerDeviceCredentials.xml deleted file mode 100644 index 807ea27c64053b..00000000000000 --- a/data_model/clusters/WiFiPerDeviceCredentials.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/WindowCovering.xml b/data_model/clusters/WindowCovering.xml index 7b0afd461fcb96..af59da5a9f72de 100644 --- a/data_model/clusters/WindowCovering.xml +++ b/data_model/clusters/WindowCovering.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :xrefstyle: basic --> - + diff --git a/data_model/clusters/bridge-clusters-ActionsCluster.xml b/data_model/clusters/bridge-clusters-ActionsCluster.xml index e02b12e43d64a4..5b9b54429b9429 100644 --- a/data_model/clusters/bridge-clusters-ActionsCluster.xml +++ b/data_model/clusters/bridge-clusters-ActionsCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :sectnums: --> - + diff --git a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml index db85cc296b8922..a7c990182a7dde 100644 --- a/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml +++ b/data_model/clusters/bridge-clusters-BridgedDeviceBasicInformationCluster.xml @@ -57,7 +57,7 @@ Davis, CA 95616, USA :sectnums: --> - + diff --git a/data_model/clusters/cluster_ids.json b/data_model/clusters/cluster_ids.json index be7c9464690ea8..40a46edd00722e 100644 --- a/data_model/clusters/cluster_ids.json +++ b/data_model/clusters/cluster_ids.json @@ -32,6 +32,9 @@ "63": "GroupKeyManagement", "64": "Fixed Label", "65": "User Label", + "66": "ProxyConfiguration", + "67": "ProxyDiscovery", + "68": "ValidProxies", "69": "Boolean State", "70": "ICDManagement", "72": "Oven Cavity Operational State", @@ -60,17 +63,12 @@ "129": "Valve Configuration and Control", "144": "Electrical Power Measurement", "145": "Electrical Energy Measurement", - "148": "Water Heater Management", - "149": "Energy Price", - "150": "Demand Response and Load Control", "151": "Messages", "152": "Device Energy Management", "153": "Energy EVSE", - "154": "Energy Calendar", "155": "Energy Preference", "156": "Power Topology", "157": "Energy EVSE Mode", - "158": "Water Heater Mode", "159": "Device Energy Management Mode", "257": "Door Lock", "258": "Window Covering", @@ -96,8 +94,6 @@ "1069": "PM10 Concentration Measurement", "1070": "Total Volatile Organic Compounds Concentration Measurement", "1071": "Radon Concentration Measurement", - "1104": "Network Identity Management", - "1105": "Wi", "1283": "Wake on LAN", "1284": "Channel", "1285": "Target Navigator", diff --git a/data_model/clusters/energy_management.xml b/data_model/clusters/energy_management.xml deleted file mode 100644 index 93858d1d1b3c89..00000000000000 --- a/data_model/clusters/energy_management.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/clusters/network_infrastructure.xml b/data_model/clusters/network_infrastructure.xml deleted file mode 100644 index 8045740d5de0b6..00000000000000 --- a/data_model/clusters/network_infrastructure.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/BooleanSensor.xml b/data_model/device_types/BooleanSensor.xml deleted file mode 100644 index 185fdc47176813..00000000000000 --- a/data_model/device_types/BooleanSensor.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ColorDimmerSwitch.xml b/data_model/device_types/ColorDimmerSwitch.xml index e391700918e1c4..190ab6c7fc8b7e 100644 --- a/data_model/device_types/ColorDimmerSwitch.xml +++ b/data_model/device_types/ColorDimmerSwitch.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/ColorTemperatureLight.xml b/data_model/device_types/ColorTemperatureLight.xml index e782dd24f58f4f..4f7cf64a9fd0a2 100644 --- a/data_model/device_types/ColorTemperatureLight.xml +++ b/data_model/device_types/ColorTemperatureLight.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/ControlBridge.xml b/data_model/device_types/ControlBridge.xml index 27e00f69403728..04ff66db808cc9 100644 --- a/data_model/device_types/ControlBridge.xml +++ b/data_model/device_types/ControlBridge.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/DimmableLight.xml b/data_model/device_types/DimmableLight.xml index ec66b81a610451..059a0802f77906 100644 --- a/data_model/device_types/DimmableLight.xml +++ b/data_model/device_types/DimmableLight.xml @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/DimmablePlug-InUnit.xml b/data_model/device_types/DimmablePlug-InUnit.xml index bbd043912ab6d7..4d344bfc9fb89c 100644 --- a/data_model/device_types/DimmablePlug-InUnit.xml +++ b/data_model/device_types/DimmablePlug-InUnit.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/DimmerSwitch.xml b/data_model/device_types/DimmerSwitch.xml index 008e54eee8efc3..0ad9f23638349a 100644 --- a/data_model/device_types/DimmerSwitch.xml +++ b/data_model/device_types/DimmerSwitch.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + \ No newline at end of file diff --git a/data_model/device_types/DoorLockController.xml b/data_model/device_types/DoorLockController.xml index 30342b95a126bd..4d031a37be1eec 100644 --- a/data_model/device_types/DoorLockController.xml +++ b/data_model/device_types/DoorLockController.xml @@ -68,7 +68,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/EnergyTariff.xml b/data_model/device_types/EnergyTariff.xml deleted file mode 100644 index bf27554ff281db..00000000000000 --- a/data_model/device_types/EnergyTariff.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/EnergyTariffCalendar.xml b/data_model/device_types/EnergyTariffCalendar.xml deleted file mode 100644 index ee3a6b9347db38..00000000000000 --- a/data_model/device_types/EnergyTariffCalendar.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ExtendedColorLight.xml b/data_model/device_types/ExtendedColorLight.xml index 75988addc3f8cd..b4057d6b5bc997 100644 --- a/data_model/device_types/ExtendedColorLight.xml +++ b/data_model/device_types/ExtendedColorLight.xml @@ -107,10 +107,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/HeatingCoolingUnit.xml b/data_model/device_types/HeatingCoolingUnit.xml deleted file mode 100644 index 39fbb766111b31..00000000000000 --- a/data_model/device_types/HeatingCoolingUnit.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml b/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml deleted file mode 100644 index 454dc857f0b8db..00000000000000 --- a/data_model/device_types/NetworkInfraIntro-CommonRequirements.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro-Introduction.xml b/data_model/device_types/NetworkInfraIntro-Introduction.xml deleted file mode 100644 index e5bc56b1f095ac..00000000000000 --- a/data_model/device_types/NetworkInfraIntro-Introduction.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraIntro.xml b/data_model/device_types/NetworkInfraIntro.xml deleted file mode 100644 index 22d91b6f459c6d..00000000000000 --- a/data_model/device_types/NetworkInfraIntro.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - \ No newline at end of file diff --git a/data_model/device_types/NetworkInfraManager.xml b/data_model/device_types/NetworkInfraManager.xml deleted file mode 100644 index 67c3ee49f75f92..00000000000000 --- a/data_model/device_types/NetworkInfraManager.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/OnOffLight.xml b/data_model/device_types/OnOffLight.xml index fe98ac6b6d7028..f71c0bf77fa42c 100644 --- a/data_model/device_types/OnOffLight.xml +++ b/data_model/device_types/OnOffLight.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/OnOffLightSwitch.xml b/data_model/device_types/OnOffLightSwitch.xml index 9896264d5b9e4f..d6ac7f79520d26 100644 --- a/data_model/device_types/OnOffLightSwitch.xml +++ b/data_model/device_types/OnOffLightSwitch.xml @@ -77,7 +77,10 @@ Davis, CA 95616, USA - + + + + \ No newline at end of file diff --git a/data_model/device_types/OnOffPlug-inUnit.xml b/data_model/device_types/OnOffPlug-inUnit.xml index dbcb7f7e739629..3be1ed0f9eb13d 100644 --- a/data_model/device_types/OnOffPlug-inUnit.xml +++ b/data_model/device_types/OnOffPlug-inUnit.xml @@ -86,7 +86,7 @@ Davis, CA 95616, USA - + @@ -106,10 +106,16 @@ Davis, CA 95616, USA - + + + + - + + + + diff --git a/data_model/device_types/OnOffSensor.xml b/data_model/device_types/OnOffSensor.xml index cdd59585119fa2..935a438fb0bbef 100644 --- a/data_model/device_types/OnOffSensor.xml +++ b/data_model/device_types/OnOffSensor.xml @@ -80,7 +80,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/Pump.xml b/data_model/device_types/Pump.xml index f8c0ce92b1229d..461725136abaec 100644 --- a/data_model/device_types/Pump.xml +++ b/data_model/device_types/Pump.xml @@ -77,7 +77,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/PumpController.xml b/data_model/device_types/PumpController.xml index 3b27f35737197b..3dcb36899ec908 100644 --- a/data_model/device_types/PumpController.xml +++ b/data_model/device_types/PumpController.xml @@ -82,7 +82,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/RoomAirConditioner.xml b/data_model/device_types/RoomAirConditioner.xml index 7f3acd50eb2c91..305a893dabc0fe 100644 --- a/data_model/device_types/RoomAirConditioner.xml +++ b/data_model/device_types/RoomAirConditioner.xml @@ -78,7 +78,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/Thermostat.xml b/data_model/device_types/Thermostat.xml index 16c0efe75620a0..49ba4b6779f084 100644 --- a/data_model/device_types/Thermostat.xml +++ b/data_model/device_types/Thermostat.xml @@ -95,7 +95,10 @@ Davis, CA 95616, USA - + + + + diff --git a/data_model/device_types/ThreadBorderRouter.xml b/data_model/device_types/ThreadBorderRouter.xml deleted file mode 100644 index a0aee3bfeb0433..00000000000000 --- a/data_model/device_types/ThreadBorderRouter.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/ThreePhasePowerSource.xml b/data_model/device_types/ThreePhasePowerSource.xml deleted file mode 100644 index 726af1a16c10a4..00000000000000 --- a/data_model/device_types/ThreePhasePowerSource.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/Valve.xml b/data_model/device_types/Valve.xml deleted file mode 100644 index 4ce864b01ab246..00000000000000 --- a/data_model/device_types/Valve.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/WaterHeater.xml b/data_model/device_types/WaterHeater.xml deleted file mode 100644 index eeebfee95ea300..00000000000000 --- a/data_model/device_types/WaterHeater.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/data_model/device_types/WindowCovering.xml b/data_model/device_types/WindowCovering.xml index e647e8aa005959..a2d54453b7337f 100644 --- a/data_model/device_types/WindowCovering.xml +++ b/data_model/device_types/WindowCovering.xml @@ -77,6 +77,7 @@ Davis, CA 95616, USA + diff --git a/data_model/device_types/WindowCoveringController.xml b/data_model/device_types/WindowCoveringController.xml index 406953630947ea..c48f327754c599 100644 --- a/data_model/device_types/WindowCoveringController.xml +++ b/data_model/device_types/WindowCoveringController.xml @@ -80,6 +80,7 @@ Davis, CA 95616, USA + diff --git a/data_model/spec_sha b/data_model/spec_sha index cb39a57acee19b..274f0d55122714 100644 --- a/data_model/spec_sha +++ b/data_model/spec_sha @@ -1 +1 @@ -5cf986ac3980bb2b658bae7bf13df8aeec021999 +ab9cf4653d40fe9193bbc7fe9febf74c08bf7dfa diff --git a/docs/spec_clusters.md b/docs/spec_clusters.md index 02715424bbb5d8..976b9f85e42c19 100644 --- a/docs/spec_clusters.md +++ b/docs/spec_clusters.md @@ -36,6 +36,9 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |63 |0x003F |GroupKeyManagement | |64 |0x0040 |Fixed Label | |65 |0x0041 |User Label | +|66 |0x0042 |ProxyConfiguration | +|67 |0x0043 |ProxyDiscovery | +|68 |0x0044 |ValidProxies | |69 |0x0045 |Boolean State | |70 |0x0046 |ICDManagement | |72 |0x0048 |Oven Cavity Operational State | @@ -64,17 +67,12 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |129 |0x0081 |Valve Configuration and Control | |144 |0x0090 |Electrical Power Measurement | |145 |0x0091 |Electrical Energy Measurement | -|148 |0x0094 |Water Heater Management | -|149 |0x0095 |Energy Price | -|150 |0x0096 |Demand Response and Load Control | |151 |0x0097 |Messages | |152 |0x0098 |Device Energy Management | |153 |0x0099 |Energy EVSE | -|154 |0x009A |Energy Calendar | |155 |0x009B |Energy Preference | |156 |0x009C |Power Topology | |157 |0x009D |Energy EVSE Mode | -|158 |0x009E |Water Heater Mode | |159 |0x009F |Device Energy Management Mode | |257 |0x0101 |Door Lock | |258 |0x0102 |Window Covering | @@ -100,8 +98,6 @@ This file was **AUTOMATICALLY** generated by `python scripts/generate_spec_xml.p |1069 |0x042D |PM10 Concentration Measurement | |1070 |0x042E |Total Volatile Organic Compounds Concentration Measurement| |1071 |0x042F |Radon Concentration Measurement | -|1104 |0x0450 |Network Identity Management | -|1105 |0x0451 |Wi | |1283 |0x0503 |Wake on LAN | |1284 |0x0504 |Channel | |1285 |0x0505 |Target Navigator | diff --git a/scripts/spec_xml/generate_spec_xml.py b/scripts/spec_xml/generate_spec_xml.py index ecdd47e6a6904f..bb33c13533991d 100755 --- a/scripts/spec_xml/generate_spec_xml.py +++ b/scripts/spec_xml/generate_spec_xml.py @@ -140,16 +140,6 @@ def scrape_all_clusters(dir: str, exclude_list: list[str] = []) -> None: print(f'Removing file {xml_path} as it does not include any cluster definitions') os.remove(xml_path) continue - # For now, we're going to manually remove the word "Cluster" from the cluster name field - # to make the diff easier. The update to 1.2.4 of the scraper added this. - # TODO: submit a separate PR with JUST this change revered and remove this code. - with open(xml_path, 'rb') as input: - xml_str = input.read() - - original_name = bytes(cluster.attrib['name'], 'utf-8') - replacement_name = bytes(cluster.attrib['name'].removesuffix(" Cluster"), 'utf-8') - with open(xml_path, 'wb') as output: - output.write(xml_str.replace(original_name, replacement_name)) def scrape_device_types(scraper, spec_root, output_dir, dry_run, include_in_progress): From 3cc96a14bede4b757fc457c919809af92e8794a2 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Tue, 4 Jun 2024 16:14:51 +0200 Subject: [PATCH 04/78] Replace nl-unit-test with pigweed for protocols/secure_channel (#33499) * secure channel tests to pigweed * Remove nlunit tests dependency * Update conversion to pigweed * Relocate class * Revert old implementation * Restore * Move definition of TEST_F_FROM_FIXTURE to UnitTest * Fix test error * Add missing deps * Revert order change * Restyle * Revert * Add missing header * Add UnitTestPigweedUtils * IoT SDK update tests list * Remove unused define * Change target type * license * Assert * rollback * cleanup * Change function to method * Restyle * Fix dependency between tests * Fix merge * Fix * Review fix * Fix typo * Fix review issues * Fix review issues --- src/BUILD.gn | 1 - src/lib/support/tests/BUILD.gn | 9 + src/lib/support/tests/ExtraPwTestMacros.h | 56 ++ src/protocols/secure_channel/tests/BUILD.gn | 38 +- .../secure_channel/tests/TestCASESession.cpp | 620 ++++++++---------- .../tests/TestCheckInCounter.cpp | 2 - .../TestDefaultSessionResumptionStorage.cpp | 234 +++---- .../tests/TestMessageCounterManager.cpp | 117 +--- .../secure_channel/tests/TestPASESession.cpp | 370 +++++------ .../tests/TestPairingSession.cpp | 115 +--- .../TestSimpleSessionResumptionStorage.cpp | 97 +-- .../secure_channel/tests/TestStatusReport.cpp | 137 ++-- src/system/tests/BUILD.gn | 1 + src/system/tests/TestSystemPacketBuffer.cpp | 11 +- .../unit-tests/test_components_nl.txt | 3 +- 15 files changed, 694 insertions(+), 1117 deletions(-) create mode 100644 src/lib/support/tests/ExtraPwTestMacros.h diff --git a/src/BUILD.gn b/src/BUILD.gn index 5f7d6cc95ab6ba..d455a596b4e346 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -101,7 +101,6 @@ if (chip_build_tests) { "${chip_root}/src/lib/format/tests", "${chip_root}/src/lib/support/tests", "${chip_root}/src/protocols/secure_channel/tests", - "${chip_root}/src/protocols/secure_channel/tests:tests_nltest", "${chip_root}/src/system/tests", "${chip_root}/src/transport/tests", ] diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 565eb85097d133..b8cdcfeb2e059f 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -19,6 +19,15 @@ import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") +pw_source_set("pw-test-macros") { + output_dir = "${root_out_dir}/lib" + public_deps = [ + "$dir_pw_log:impl", + "$dir_pw_unit_test", + ] + sources = [ "ExtraPwTestMacros.h" ] +} + chip_test_suite("tests") { output_name = "libSupportTests" diff --git a/src/lib/support/tests/ExtraPwTestMacros.h b/src/lib/support/tests/ExtraPwTestMacros.h new file mode 100644 index 00000000000000..ab592800716592 --- /dev/null +++ b/src/lib/support/tests/ExtraPwTestMacros.h @@ -0,0 +1,56 @@ +/* + * + * Copyright (c) 2024 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. + */ +#pragma once + +/* + * Run Fixture's class function as a test. + * It is used to execute test cases that need to use private members of a particular class. + * Unlike the pigweed macro `FRIEND_TEST`, this approach allows you to define the entire + * test_fixture class as a friend, rather than having to define each testcase as a friend. + * + * @param test_fixture - the fixture class. + * + * @param test_name - the name of the test function. + * + * Example: + * class Foo // class to be tested + * { + * friend class TestCtx; + * private: + * bool privateFunction(); + * }; + * + * class TestCtx: public ::testing::Test + * { + * public: + * void testFunction(); + * }; + * + * TEST_F_FROM_FIXTURE(TestCtx, testFunction) + * { + * Foo foo; + * EXPECT_TRUE(foo.privateFunction()); + * } + * + */ +#define TEST_F_FROM_FIXTURE(test_fixture, test_name) \ + TEST_F(test_fixture, test_name) \ + { \ + test_name(); \ + } \ + void test_fixture::test_name() diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index 371937c4297b7b..0760998e818422 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -1,6 +1,5 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") @@ -8,32 +7,9 @@ chip_test_suite("tests") { output_name = "libSecureChannelTests" test_sources = [ + "TestCASESession.cpp", "TestCheckInCounter.cpp", "TestCheckinMsg.cpp", - ] - - sources = [ "CheckIn_Message_test_vectors.h" ] - - cflags = [ "-Wconversion" ] - public_deps = [ - "${chip_root}/src/app/icd/server:icd-server-config", - "${chip_root}/src/credentials/tests:cert_test_vectors", - "${chip_root}/src/lib/core", - "${chip_root}/src/lib/support", - "${chip_root}/src/lib/support:test_utils", - "${chip_root}/src/lib/support:testing", - "${chip_root}/src/protocols/secure_channel", - "${chip_root}/src/protocols/secure_channel:check-in-counter", - "${dir_pw_unit_test}", - ] -} - -chip_test_suite_using_nltest("tests_nltest") { - # Renamed ouput during the transition away from nltest - output_name = "libSecureChannelTestsNL" - - test_sources = [ - "TestCASESession.cpp", "TestDefaultSessionResumptionStorage.cpp", "TestPASESession.cpp", "TestPairingSession.cpp", @@ -44,22 +20,26 @@ chip_test_suite_using_nltest("tests_nltest") { # "TestMessageCounterManager.cpp", ] + sources = [ "CheckIn_Message_test_vectors.h" ] + + cflags = [ "-Wconversion" ] public_deps = [ + "${chip_root}/src/app/icd/server:icd-server-config", + "${chip_root}/src/credentials/tests:cert_test_vectors", "${chip_root}/src/crypto/tests:tests.lib", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/lib/support:testing", - "${chip_root}/src/lib/support:testing_nlunit", + "${chip_root}/src/lib/support/tests:pw-test-macros", "${chip_root}/src/messaging/tests:helpers", "${chip_root}/src/protocols", "${chip_root}/src/protocols/secure_channel", + "${chip_root}/src/protocols/secure_channel:check-in-counter", "${chip_root}/src/transport/raw/tests:helpers", - "${nlunit_test_root}:nlunit-test", + "${dir_pw_unit_test}", ] - cflags = [ "-Wconversion" ] - if (chip_enable_icd_server) { public_deps += [ "${chip_root}/src/app/icd/server:configuration-data" ] } diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 68d6ddd177eeb8..24aaffce0dbcb4 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -34,10 +35,8 @@ #include #include #include -#include -#include +#include #include -#include #include #include #include @@ -55,9 +54,9 @@ using namespace chip::Protocols; using namespace chip::Crypto; namespace chip { -namespace { +class TestCASESecurePairingDelegate; -class TestContext : public Test::LoopbackMessagingContext +class TestCASESession : public Test::LoopbackMessagingContext, public ::testing::Test { public: // Performs shared setup for all tests in the test suite @@ -70,16 +69,23 @@ class TestContext : public Test::LoopbackMessagingContext ConfigInitializeNodes(false); chip::Test::LoopbackMessagingContext::SetUp(); } + virtual void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } + + void ServiceEvents(); + void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, CASESession & pairingCommissioner, + TestCASESecurePairingDelegate & delegateCommissioner); + + void SimulateUpdateNOCInvalidatePendingEstablishment(); }; -void ServiceEvents(TestContext & ctx) +void TestCASESession::ServiceEvents() { // Takes a few rounds of this because handling IO messages may schedule work, // and scheduled work may queue messages for sending... for (int i = 0; i < 3; ++i) { - ctx.DrainAndServiceIO(); + DrainAndServiceIO(); chip::DeviceLayer::PlatformMgr().ScheduleWork( [](intptr_t) -> void { chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); }, (intptr_t) nullptr); @@ -90,12 +96,11 @@ void ServiceEvents(TestContext & ctx) class TemporarySessionManager { public: - TemporarySessionManager(nlTestSuite * suite, TestContext & ctx) : mCtx(ctx) + TemporarySessionManager(TestCASESession & ctx) : mCtx(ctx) { - NL_TEST_ASSERT(suite, - CHIP_NO_ERROR == - mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), - &mStorage, &ctx.GetFabricTable(), ctx.GetSessionKeystore())); + EXPECT_EQ(CHIP_NO_ERROR, + mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), &mStorage, + &ctx.GetFabricTable(), ctx.GetSessionKeystore())); // The setup here is really weird: we are using one session manager for // the actual messages we send (the PASE handshake, so the // unauthenticated sessions) and a different one for allocating the PASE @@ -115,7 +120,7 @@ class TemporarySessionManager operator SessionManager &() { return mSessionManager; } private: - TestContext & mCtx; + TestCASESession & mCtx; TestPersistentStorageDelegate mStorage; SessionManager mSessionManager; }; @@ -334,22 +339,22 @@ CHIP_ERROR InitCredentialSets() return CHIP_NO_ERROR; } -void TestContext::SetUpTestSuite() +void TestCASESession::SetUpTestSuite() { - CHIP_ERROR err = CHIP_NO_ERROR; LoopbackMessagingContext::SetUpTestSuite(); - // TODO: use ASSERT_EQ, once transition to pw_unit_test is complete - VerifyOrDieWithMsg((err = chip::DeviceLayer::PlatformMgr().InitChipStack()) == CHIP_NO_ERROR, AppServer, - "Init CHIP stack failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = InitFabricTable(gCommissionerFabrics, &gCommissionerStorageDelegate, /* opKeyStore = */ nullptr, - &gCommissionerOpCertStore)) == CHIP_NO_ERROR, - AppServer, "InitFabricTable failed: %" CHIP_ERROR_FORMAT, err.Format()); - VerifyOrDieWithMsg((err = InitCredentialSets()) == CHIP_NO_ERROR, AppServer, "InitCredentialSets failed: %" CHIP_ERROR_FORMAT, - err.Format()); + + ASSERT_EQ(chip::DeviceLayer::PlatformMgr().InitChipStack(), CHIP_NO_ERROR); + + ASSERT_EQ( + InitFabricTable(gCommissionerFabrics, &gCommissionerStorageDelegate, /* opKeyStore = */ nullptr, &gCommissionerOpCertStore), + CHIP_NO_ERROR); + + ASSERT_EQ(InitCredentialSets(), CHIP_NO_ERROR); + chip::DeviceLayer::SetSystemLayerForTesting(&GetSystemLayer()); } -void TestContext::TearDownTestSuite() +void TestCASESession::TearDownTestSuite() { chip::DeviceLayer::SetSystemLayerForTesting(nullptr); gDeviceOperationalKeystore.Shutdown(); @@ -362,52 +367,27 @@ void TestContext::TearDownTestSuite() LoopbackMessagingContext::TearDownTestSuite(); } -} // anonymous namespace - -// Specifically for SimulateUpdateNOCInvalidatePendingEstablishment, we need it to be static so that the class below can -// be a friend to CASESession so that test can get access to CASESession::State and test method that are not public. To -// keep the rest of this file consistent we brought all other tests into this class. -class TestCASESession +TEST_F(TestCASESession, SecurePairingWaitTest) { -public: - static void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext); - static void SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inContext); - static void ClientReceivesBusyTest(nlTestSuite * inSuite, void * inContext); - static void Sigma1ParsingTest(nlTestSuite * inSuite, void * inContext); - static void DestinationIdTest(nlTestSuite * inSuite, void * inContext); - static void SessionResumptionStorage(nlTestSuite * inSuite, void * inContext); -#if CONFIG_BUILD_FOR_HOST_UNIT_TEST - static void SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuite * inSuite, void * inContext); -#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST - static void Sigma1BadDestinationIdTest(nlTestSuite * inSuite, void * inContext); -}; - -void TestCASESession::SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext) -{ - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegate; - FabricTable fabrics; + // Making this static to reduce stack usage, as some platforms have limits on stack size. + static FabricTable fabrics; CASESession caseSession; - NL_TEST_ASSERT(inSuite, caseSession.GetSecureSessionType() == SecureSession::Type::kCASE); + EXPECT_EQ(caseSession.GetSecureSessionType(), SecureSession::Type::kCASE); caseSession.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, nullptr, ScopedNodeId(), - Optional::Missing()) == - CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, &delegate, ScopedNodeId(), - Optional::Missing()) == - CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - caseSession.PrepareForSessionEstablishment(sessionManager, &fabrics, nullptr, nullptr, &delegate, ScopedNodeId(), - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, nullptr, ScopedNodeId(), + Optional::Missing()), + CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, nullptr, nullptr, nullptr, &delegate, ScopedNodeId(), + Optional::Missing()), + CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, &fabrics, nullptr, nullptr, &delegate, ScopedNodeId(), + Optional::Missing()), + CHIP_NO_ERROR); // Calling Clear() here since ASAN will have an issue if FabricTable destructor is called before CASESession's // destructor. We could reorder FabricTable and CaseSession, but this makes it a little more clear what we are @@ -415,42 +395,37 @@ void TestCASESession::SecurePairingWaitTest(nlTestSuite * inSuite, void * inCont caseSession.Clear(); } -void TestCASESession::SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingStartTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegate; CASESession pairing; pairing.SetGroupDataProvider(&gCommissionerGroupDataProvider); - ExchangeContext * context = ctx.NewUnauthenticatedExchangeToBob(&pairing); + ExchangeContext * context = NewUnauthenticatedExchangeToBob(&pairing); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, nullptr, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, - nullptr, nullptr, nullptr, - Optional::Missing()) != CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_NE(pairing.EstablishSession(sessionManager, nullptr, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, + nullptr, nullptr, nullptr, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, nullptr, nullptr, nullptr, nullptr, - Optional::Missing()) != CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_NE(pairing.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + nullptr, nullptr, nullptr, nullptr, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, - pairing.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, context, nullptr, nullptr, - &delegate, Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairing.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + context, nullptr, nullptr, &delegate, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); // There should have been two message sent: Sigma1 and an ack. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == 2); + EXPECT_EQ(loopback.mSentMessageCount, 2u); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); - NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); + EXPECT_EQ(rm->TestGetCountRetransTable(), 0); loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; @@ -459,22 +434,19 @@ void TestCASESession::SecurePairingStartTest(nlTestSuite * inSuite, void * inCon loopback.mSentMessageCount = 0; loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; - ExchangeContext * context1 = ctx.NewUnauthenticatedExchangeToBob(&pairing1); + ExchangeContext * context1 = NewUnauthenticatedExchangeToBob(&pairing1); - NL_TEST_ASSERT(inSuite, - pairing1.EstablishSession( - sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, context1, - nullptr, nullptr, &delegate, Optional::Missing()) == CHIP_ERROR_BAD_REQUEST); - ServiceEvents(ctx); + EXPECT_EQ(pairing1.EstablishSession(sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + context1, nullptr, nullptr, &delegate, Optional::Missing()), + CHIP_ERROR_BAD_REQUEST); + ServiceEvents(); loopback.mMessageSendError = CHIP_NO_ERROR; } -void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, SessionManager & sessionManager, - CASESession & pairingCommissioner, TestCASESecurePairingDelegate & delegateCommissioner) +void TestCASESession::SecurePairingHandshakeTestCommon(SessionManager & sessionManager, CASESession & pairingCommissioner, + TestCASESecurePairingDelegate & delegateCommissioner) { - TestContext & ctx = *reinterpret_cast(inContext); - // Test all combinations of invalid parameters TestCASESecurePairingDelegate delegateAccessory; CASESession pairingAccessory; @@ -483,39 +455,36 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S ReliableMessageProtocolConfig nonSleepyCommissionerRmpConfig( System::Clock::Milliseconds32(5000), System::Clock::Milliseconds32(300), System::Clock::Milliseconds16(4000)); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, - &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, + &pairingAccessory), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); pairingAccessory.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, - &delegateAccessory, ScopedNodeId(), - MakeOptional(verySleepyAccessoryRmpConfig)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - MakeOptional(nonSleepyCommissionerRmpConfig)) == CHIP_NO_ERROR); - ServiceEvents(ctx); - - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout == System::Clock::Milliseconds32(5000)); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout == System::Clock::Milliseconds32(300)); - NL_TEST_ASSERT(inSuite, pairingAccessory.GetRemoteMRPConfig().mActiveThresholdTime == System::Clock::Milliseconds16(4000)); - NL_TEST_ASSERT(inSuite, pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout == System::Clock::Milliseconds32(360000)); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout == System::Clock::Milliseconds32(100000)); - NL_TEST_ASSERT(inSuite, pairingCommissioner.GetRemoteMRPConfig().mActiveThresholdTime == System::Clock::Milliseconds16(300)); + EXPECT_EQ(pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, + ScopedNodeId(), MakeOptional(verySleepyAccessoryRmpConfig)), + CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner.EstablishSession( + sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, + nullptr, nullptr, &delegateCommissioner, MakeOptional(nonSleepyCommissionerRmpConfig)), + CHIP_NO_ERROR); + ServiceEvents(); + + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout, System::Clock::Milliseconds32(5000)); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout, System::Clock::Milliseconds32(300)); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveThresholdTime, System::Clock::Milliseconds16(4000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout, System::Clock::Milliseconds32(360000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout, System::Clock::Milliseconds32(100000)); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveThresholdTime, System::Clock::Milliseconds16(300)); #if CONFIG_BUILD_FOR_HOST_UNIT_TEST // Confirming that FabricTable sending a notification that fabric was updated doesn't affect // already established connections. @@ -523,26 +492,24 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S // This is compiled for host tests which is enough test coverage gCommissionerFabrics.SendUpdateFabricNotificationForTest(gCommissionerFabricIndex); gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } -void TestCASESession::SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingHandshakeTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner; CASESession pairingCommissioner; pairingCommissioner.SetGroupDataProvider(&gCommissionerGroupDataProvider); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, delegateCommissioner); + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, delegateCommissioner); } -void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SecurePairingHandshakeServerTest) { // TODO: Add cases for mismatching IPK config between initiator/responder @@ -551,47 +518,43 @@ void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, vo auto * pairingCommissioner = chip::Platform::New(); pairingCommissioner->SetGroupDataProvider(&gCommissionerGroupDataProvider); - TestContext & ctx = *reinterpret_cast(inContext); - - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; // Use the same session manager on both CASE client and server sides to validate that both // components may work simultaneously on a single device. - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, nullptr, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + nullptr, nullptr, &gDeviceGroupDataProvider), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(pairingCommissioner); - NL_TEST_ASSERT(inSuite, - pairingCommissioner->EstablishSession(ctx.GetSecureSessionManager(), &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairingCommissioner->EstablishSession( + GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + contextCommissioner, nullptr, nullptr, &delegateCommissioner, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); // Validate that secure session is created SessionHolder & holder = delegateCommissioner.GetSessionHolder(); - NL_TEST_ASSERT(inSuite, bool(holder)); + EXPECT_TRUE(bool(holder)); - NL_TEST_ASSERT(inSuite, (holder->GetPeer() == chip::ScopedNodeId{ Node01_01, gCommissionerFabricIndex })); + EXPECT_EQ(holder->GetPeer(), (chip::ScopedNodeId{ Node01_01, gCommissionerFabricIndex })); auto * pairingCommissioner1 = chip::Platform::New(); pairingCommissioner1->SetGroupDataProvider(&gCommissionerGroupDataProvider); - ExchangeContext * contextCommissioner1 = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner1); + ExchangeContext * contextCommissioner1 = NewUnauthenticatedExchangeToBob(pairingCommissioner1); - NL_TEST_ASSERT(inSuite, - pairingCommissioner1->EstablishSession(ctx.GetSecureSessionManager(), &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner1->EstablishSession(GetSecureSessionManager(), &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, + nullptr, nullptr, &delegateCommissioner, + Optional::Missing()), + CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); chip::Platform::Delete(pairingCommissioner); chip::Platform::Delete(pairingCommissioner1); @@ -599,52 +562,49 @@ void TestCASESession::SecurePairingHandshakeServerTest(nlTestSuite * inSuite, vo gPairingServer.Shutdown(); } -void TestCASESession::ClientReceivesBusyTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, ClientReceivesBusyTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner1, delegateCommissioner2; CASESession pairingCommissioner1, pairingCommissioner2; pairingCommissioner1.SetGroupDataProvider(&gCommissionerGroupDataProvider); pairingCommissioner2.SetGroupDataProvider(&gCommissionerGroupDataProvider); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, nullptr, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + nullptr, nullptr, &gDeviceGroupDataProvider), + CHIP_NO_ERROR); - ExchangeContext * contextCommissioner1 = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner1); - ExchangeContext * contextCommissioner2 = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner2); + ExchangeContext * contextCommissioner1 = NewUnauthenticatedExchangeToBob(&pairingCommissioner1); + ExchangeContext * contextCommissioner2 = NewUnauthenticatedExchangeToBob(&pairingCommissioner2); - NL_TEST_ASSERT(inSuite, - pairingCommissioner1.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, - nullptr, nullptr, &delegateCommissioner1, NullOptional) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingCommissioner2.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner2, - nullptr, nullptr, &delegateCommissioner2, NullOptional) == CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner1.EstablishSession(sessionManager, &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner1, + nullptr, nullptr, &delegateCommissioner1, NullOptional), + CHIP_NO_ERROR); + EXPECT_EQ(pairingCommissioner2.EstablishSession(sessionManager, &gCommissionerFabrics, + ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner2, + nullptr, nullptr, &delegateCommissioner2, NullOptional), + CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); // We should have one full handshake and one Sigma1 + Busy + ack. If that // ever changes (e.g. because our server starts supporting multiple parallel // handshakes), this test needs to be fixed so that the server is still // responding BUSY to the client. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == sTestCaseMessageCount + 3); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumPairingComplete == 0); + EXPECT_EQ(loopback.mSentMessageCount, sTestCaseMessageCount + 3); + EXPECT_EQ(delegateCommissioner1.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner2.mNumPairingComplete, 0u); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumPairingErrors == 1); + EXPECT_EQ(delegateCommissioner1.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner2.mNumPairingErrors, 1u); - NL_TEST_ASSERT(inSuite, delegateCommissioner1.mNumBusyResponses == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner2.mNumBusyResponses == 1); + EXPECT_EQ(delegateCommissioner1.mNumBusyResponses, 0u); + EXPECT_EQ(delegateCommissioner2.mNumBusyResponses, 1u); gPairingServer.Shutdown(); } @@ -673,7 +633,7 @@ struct Sigma1Params static constexpr bool expectSuccess = true; }; -void TestCASESession::DestinationIdTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, DestinationIdTest) { // Validate example test vector from CASE section of spec @@ -708,20 +668,20 @@ void TestCASESession::DestinationIdTest(nlTestSuite * inSuite, void * inContext) CHIP_ERROR err = GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, kNodeIdFromSpec, destinationIdSpan); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, destinationIdSpan.size() == sizeof(destinationIdBuf)); - NL_TEST_ASSERT(inSuite, destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(destinationIdSpan.size(), sizeof(destinationIdBuf)); + EXPECT_TRUE(destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); memset(destinationIdSpan.data(), 0, destinationIdSpan.size()); // Test changing input: should yield different - err = GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), - ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, - kNodeIdFromSpec + 1, // <--- Change node ID - destinationIdSpan); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, destinationIdSpan.size() == sizeof(destinationIdBuf)); - NL_TEST_ASSERT(inSuite, !destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); + EXPECT_EQ(GenerateCaseDestinationId(ByteSpan(kIpkOperationalGroupKeyFromSpec), ByteSpan(kInitiatorRandomFromSpec), + ByteSpan(kRootPubKeyFromSpec), kFabricIdFromSpec, + kNodeIdFromSpec + 1, // <--- Change node ID + destinationIdSpan), + CHIP_NO_ERROR); + EXPECT_EQ(destinationIdSpan.size(), sizeof(destinationIdBuf)); + EXPECT_FALSE(destinationIdSpan.data_equal(ByteSpan(kExpectedDestinationIdFromSpec))); } template @@ -776,12 +736,11 @@ static CHIP_ERROR EncodeSigma1(MutableByteSpan & buf) } // A macro, so we can tell which test failed based on line number. -#define TestSigma1Parsing(inSuite, mem, bufferSize, params) \ +#define TestSigma1Parsing(mem, bufferSize, params) \ do \ { \ MutableByteSpan buf(mem.Get(), bufferSize); \ - CHIP_ERROR err = EncodeSigma1(buf); \ - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); \ + EXPECT_EQ(EncodeSigma1(buf), CHIP_NO_ERROR); \ \ TLV::ContiguousBufferTLVReader reader; \ reader.Init(buf); \ @@ -794,12 +753,12 @@ static CHIP_ERROR EncodeSigma1(MutableByteSpan & buf) ByteSpan resumptionId; \ ByteSpan initiatorResumeMIC; \ CASESession session; \ - err = session.ParseSigma1(reader, initiatorRandom, initiatorSessionId, destinationId, initiatorEphPubKey, \ - resumptionRequested, resumptionId, initiatorResumeMIC); \ - NL_TEST_ASSERT(inSuite, (err == CHIP_NO_ERROR) == params::expectSuccess); \ + EXPECT_EQ(session.ParseSigma1(reader, initiatorRandom, initiatorSessionId, destinationId, initiatorEphPubKey, \ + resumptionRequested, resumptionId, initiatorResumeMIC) == CHIP_NO_ERROR, \ + params::expectSuccess); \ if (params::expectSuccess) \ { \ - NL_TEST_ASSERT(inSuite, resumptionRequested == (params::resumptionIdLen != 0 && params::initiatorResumeMICLen != 0)); \ + EXPECT_EQ(resumptionRequested, params::resumptionIdLen != 0 && params::initiatorResumeMICLen != 0); \ /* Add other verification tests here as desired */ \ } \ } while (0) @@ -889,30 +848,29 @@ struct Sigma1SessionIdTooBig : public BadSigma1ParamsBase static constexpr uint32_t initiatorSessionId = UINT16_MAX + 1; }; -void TestCASESession::Sigma1ParsingTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, Sigma1ParsingTest) { // 1280 bytes must be enough by definition. constexpr size_t bufferSize = 1280; chip::Platform::ScopedMemoryBuffer mem; - NL_TEST_ASSERT(inSuite, mem.Calloc(bufferSize)); - - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1Params); - - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1NoStructEnd); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1WrongTags); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongRandom); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortRandom); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongDest); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortDest); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongPubkey); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortPubkey); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1WithResumption); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongResumptionId); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortResumptionId); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooLongResumeMIC); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1TooShortResumeMIC); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1SessionIdMax); - TestSigma1Parsing(inSuite, mem, bufferSize, Sigma1SessionIdTooBig); + EXPECT_TRUE(mem.Calloc(bufferSize)); + + TestSigma1Parsing(mem, bufferSize, Sigma1Params); + TestSigma1Parsing(mem, bufferSize, Sigma1NoStructEnd); + TestSigma1Parsing(mem, bufferSize, Sigma1WrongTags); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongRandom); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortRandom); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongDest); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortDest); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongPubkey); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortPubkey); + TestSigma1Parsing(mem, bufferSize, Sigma1WithResumption); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongResumptionId); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortResumptionId); + TestSigma1Parsing(mem, bufferSize, Sigma1TooLongResumeMIC); + TestSigma1Parsing(mem, bufferSize, Sigma1TooShortResumeMIC); + TestSigma1Parsing(mem, bufferSize, Sigma1SessionIdMax); + TestSigma1Parsing(mem, bufferSize, Sigma1SessionIdTooBig); } struct SessionResumptionTestStorage : SessionResumptionStorage @@ -962,7 +920,7 @@ struct SessionResumptionTestStorage : SessionResumptionStorage Crypto::P256ECDHDerivedSecret * mSharedSecret = nullptr; }; -void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, SessionResumptionStorage) { // Test the SessionResumptionStorage external interface. // @@ -973,7 +931,6 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC // if the peers have mismatched session resumption information, we should // fall back to CASE. - TestContext & ctx = *reinterpret_cast(inContext); TestCASESecurePairingDelegate delegateCommissioner; chip::SessionResumptionStorage::ResumptionIdStorage resumptionIdA; chip::SessionResumptionStorage::ResumptionIdStorage resumptionIdB; @@ -982,19 +939,19 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC // Create our fabric-scoped node IDs. const FabricInfo * fabricInfo = gCommissionerFabrics.FindFabricWithIndex(gCommissionerFabricIndex); - NL_TEST_ASSERT(inSuite, fabricInfo != nullptr); + ASSERT_NE(fabricInfo, nullptr); ScopedNodeId initiator = fabricInfo->GetScopedNodeIdForNode(Node01_02); ScopedNodeId responder = fabricInfo->GetScopedNodeIdForNode(Node01_01); // Generate a resumption IDs. - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionIdA.data(), resumptionIdA.size())); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionIdB.data(), resumptionIdB.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionIdA.data(), resumptionIdA.size()), CHIP_NO_ERROR); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionIdB.data(), resumptionIdB.size()), CHIP_NO_ERROR); // Generate a shared secrets. sharedSecretA.SetLength(sharedSecretA.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecretA.Bytes(), sharedSecretA.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecretA.Bytes(), sharedSecretA.Length()), CHIP_NO_ERROR); sharedSecretB.SetLength(sharedSecretB.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecretB.Bytes(), sharedSecretB.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecretB.Bytes(), sharedSecretB.Length()), CHIP_NO_ERROR); struct { @@ -1034,38 +991,37 @@ void TestCASESession::SessionResumptionStorage(nlTestSuite * inSuite, void * inC }, }; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); for (size_t i = 0; i < sizeof(testVectors) / sizeof(testVectors[0]); ++i) { auto * pairingCommissioner = chip::Platform::New(); pairingCommissioner->SetGroupDataProvider(&gCommissionerGroupDataProvider); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetSecureSessionManager(), - &gDeviceFabrics, &testVectors[i].responderStorage, nullptr, - &gDeviceGroupDataProvider) == CHIP_NO_ERROR); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner); + EXPECT_EQ(gPairingServer.ListenForSessionEstablishment(&GetExchangeManager(), &GetSecureSessionManager(), &gDeviceFabrics, + &testVectors[i].responderStorage, nullptr, + &gDeviceGroupDataProvider), + CHIP_NO_ERROR); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(pairingCommissioner); auto establishmentReturnVal = pairingCommissioner->EstablishSession( - ctx.GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, + GetSecureSessionManager(), &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, &testVectors[i].initiatorStorage, nullptr, &delegateCommissioner, Optional::Missing()); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, establishmentReturnVal == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == testVectors[i].expectedSentMessageCount); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == i + 1); + ServiceEvents(); + EXPECT_EQ(establishmentReturnVal, CHIP_NO_ERROR); + EXPECT_EQ(loopback.mSentMessageCount, testVectors[i].expectedSentMessageCount); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, i + 1); SessionHolder & holder = delegateCommissioner.GetSessionHolder(); - NL_TEST_ASSERT(inSuite, bool(holder)); - NL_TEST_ASSERT(inSuite, holder->GetPeer() == fabricInfo->GetScopedNodeIdForNode(Node01_01)); + EXPECT_TRUE(bool(holder)); + EXPECT_EQ(holder->GetPeer(), fabricInfo->GetScopedNodeIdForNode(Node01_01)); chip::Platform::Delete(pairingCommissioner); + gPairingServer.Shutdown(); } } #if CONFIG_BUILD_FOR_HOST_UNIT_TEST -void TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuite * inSuite, void * inContext) +TEST_F_FROM_FIXTURE(TestCASESession, SimulateUpdateNOCInvalidatePendingEstablishment) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); - + TemporarySessionManager sessionManager(*this); TestCASESecurePairingDelegate delegateCommissioner; CASESession pairingCommissioner; pairingCommissioner.SetGroupDataProvider(&gCommissionerGroupDataProvider); @@ -1073,70 +1029,65 @@ void TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment(nlTestSuit TestCASESecurePairingDelegate delegateAccessory; CASESession pairingAccessory; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.mSentMessageCount = 0; - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, - &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::CASE_Sigma1, + &pairingAccessory), + CHIP_NO_ERROR); // In order for all the test iterations below, we need to stop the CASE sigma handshake in the middle such // that the CASE session is in the process of being established. pairingCommissioner.SetStopSigmaHandshakeAt(MakeOptional(CASESession::State::kSentSigma1)); - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); pairingAccessory.SetGroupDataProvider(&gDeviceGroupDataProvider); - NL_TEST_ASSERT(inSuite, - pairingAccessory.PrepareForSessionEstablishment( - sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, ScopedNodeId(), - Optional::Missing()) == CHIP_NO_ERROR); + EXPECT_EQ(pairingAccessory.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &delegateAccessory, + ScopedNodeId(), Optional::Missing()), + CHIP_NO_ERROR); gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.EstablishSession(sessionManager, &gCommissionerFabrics, - ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, - nullptr, nullptr, &delegateCommissioner, - Optional::Missing()) == CHIP_NO_ERROR); - ServiceEvents(ctx); + EXPECT_EQ(pairingCommissioner.EstablishSession( + sessionManager, &gCommissionerFabrics, ScopedNodeId{ Node01_01, gCommissionerFabricIndex }, contextCommissioner, + nullptr, nullptr, &delegateCommissioner, Optional::Missing()), + CHIP_NO_ERROR); + ServiceEvents(); // At this point the CASESession is in the process of establishing. Confirm that there are no errors and there are session // has not been established. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); // Simulating an update to the Fabric NOC for gCommissionerFabrics fabric table. // Confirm that CASESession on commisioner side has reported an error. gCommissionerFabrics.SendUpdateFabricNotificationForTest(gCommissionerFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); // Simulating an update to the Fabric NOC for gDeviceFabrics fabric table. // Confirm that CASESession on accessory side has reported an error. gDeviceFabrics.SendUpdateFabricNotificationForTest(gDeviceFabricIndex); - ServiceEvents(ctx); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + ServiceEvents(); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); // Sanity check that pairing did not complete. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); } #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST -namespace { class ExpectErrorExchangeDelegate : public ExchangeDelegate { public: - ExpectErrorExchangeDelegate(nlTestSuite * suite, uint16_t expectedProtocolCode) : - mSuite(suite), mExpectedProtocolCode(expectedProtocolCode) - {} + ExpectErrorExchangeDelegate(uint16_t expectedProtocolCode) : mExpectedProtocolCode(expectedProtocolCode) {} private: CHIP_ERROR OnMessageReceived(ExchangeContext * ec, const PayloadHeader & payloadHeader, @@ -1144,15 +1095,14 @@ class ExpectErrorExchangeDelegate : public ExchangeDelegate { using namespace SecureChannel; - NL_TEST_ASSERT(mSuite, payloadHeader.HasMessageType(MsgType::StatusReport)); + EXPECT_TRUE(payloadHeader.HasMessageType(MsgType::StatusReport)); SecureChannel::StatusReport statusReport; - CHIP_ERROR err = statusReport.Parse(std::move(buf)); - NL_TEST_ASSERT(mSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(statusReport.Parse(std::move(buf)), CHIP_NO_ERROR); - NL_TEST_ASSERT(mSuite, statusReport.GetProtocolId() == SecureChannel::Id); - NL_TEST_ASSERT(mSuite, statusReport.GetGeneralCode() == GeneralStatusCode::kFailure); - NL_TEST_ASSERT(mSuite, statusReport.GetProtocolCode() == mExpectedProtocolCode); + EXPECT_EQ(statusReport.GetProtocolId(), SecureChannel::Id); + EXPECT_EQ(statusReport.GetGeneralCode(), GeneralStatusCode::kFailure); + EXPECT_EQ(statusReport.GetProtocolCode(), mExpectedProtocolCode); return CHIP_NO_ERROR; } @@ -1160,105 +1110,49 @@ class ExpectErrorExchangeDelegate : public ExchangeDelegate Messaging::ExchangeMessageDispatch & GetMessageDispatch() override { return SessionEstablishmentExchangeDispatch::Instance(); } - nlTestSuite * mSuite; uint16_t mExpectedProtocolCode; }; -} // anonymous namespace -void TestCASESession::Sigma1BadDestinationIdTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestCASESession, Sigma1BadDestinationIdTest) { using SecureChannel::MsgType; - TestContext & ctx = *reinterpret_cast(inContext); - - SessionManager & sessionManager = ctx.GetSecureSessionManager(); + SessionManager & sessionManager = GetSecureSessionManager(); constexpr size_t bufferSize = 600; System::PacketBufferHandle data = chip::System::PacketBufferHandle::New(bufferSize); - NL_TEST_ASSERT(inSuite, !data.IsNull()); + ASSERT_FALSE(data.IsNull()); MutableByteSpan buf(data->Start(), data->AvailableDataLength()); // This uses a bogus destination id that is not going to match anything in practice. - CHIP_ERROR err = EncodeSigma1(buf); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(EncodeSigma1(buf), CHIP_NO_ERROR); data->SetDataLength(static_cast(buf.size())); - Optional session = sessionManager.CreateUnauthenticatedSession(ctx.GetAliceAddress(), GetDefaultMRPConfig()); - NL_TEST_ASSERT(inSuite, session.HasValue()); + Optional session = sessionManager.CreateUnauthenticatedSession(GetAliceAddress(), GetDefaultMRPConfig()); + EXPECT_TRUE(session.HasValue()); TestCASESecurePairingDelegate caseDelegate; CASESession caseSession; caseSession.SetGroupDataProvider(&gDeviceGroupDataProvider); - err = caseSession.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &caseDelegate, - ScopedNodeId(), NullOptional); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(caseSession.PrepareForSessionEstablishment(sessionManager, &gDeviceFabrics, nullptr, nullptr, &caseDelegate, + ScopedNodeId(), NullOptional), + CHIP_NO_ERROR); - err = ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1, &caseSession); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1, &caseSession), CHIP_NO_ERROR); - ExpectErrorExchangeDelegate delegate(inSuite, SecureChannel::kProtocolCodeNoSharedRoot); - ExchangeContext * exchange = ctx.GetExchangeManager().NewContext(session.Value(), &delegate); - NL_TEST_ASSERT(inSuite, exchange != nullptr); + ExpectErrorExchangeDelegate delegate(SecureChannel::kProtocolCodeNoSharedRoot); + ExchangeContext * exchange = GetExchangeManager().NewContext(session.Value(), &delegate); + ASSERT_NE(exchange, nullptr); - err = exchange->SendMessage(MsgType::CASE_Sigma1, std::move(data), SendMessageFlags::kExpectResponse); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(exchange->SendMessage(MsgType::CASE_Sigma1, std::move(data), SendMessageFlags::kExpectResponse), CHIP_NO_ERROR); - ServiceEvents(ctx); + ServiceEvents(); - NL_TEST_ASSERT(inSuite, caseDelegate.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, caseDelegate.mNumPairingComplete == 0); + EXPECT_EQ(caseDelegate.mNumPairingErrors, 1u); + EXPECT_EQ(caseDelegate.mNumPairingComplete, 0u); - ctx.GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1); + GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(MsgType::CASE_Sigma1); caseSession.Clear(); } } // namespace chip - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("WaitInit", chip::TestCASESession::SecurePairingWaitTest), - NL_TEST_DEF("Start", chip::TestCASESession::SecurePairingStartTest), - NL_TEST_DEF("Handshake", chip::TestCASESession::SecurePairingHandshakeTest), - NL_TEST_DEF("ServerHandshake", chip::TestCASESession::SecurePairingHandshakeServerTest), - NL_TEST_DEF("ClientReceivesBusy", chip::TestCASESession::ClientReceivesBusyTest), - NL_TEST_DEF("Sigma1Parsing", chip::TestCASESession::Sigma1ParsingTest), - NL_TEST_DEF("DestinationId", chip::TestCASESession::DestinationIdTest), - NL_TEST_DEF("SessionResumptionStorage", chip::TestCASESession::SessionResumptionStorage), -#if CONFIG_BUILD_FOR_HOST_UNIT_TEST - // This is compiled for host tests which is enough test coverage to ensure updating NOC invalidates - // CASESession that are in the process of establishing. - NL_TEST_DEF("InvalidatePendingSessionEstablishment", chip::TestCASESession::SimulateUpdateNOCInvalidatePendingEstablishment), -#endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST - NL_TEST_DEF("Sigma1BadDestinationId", chip::TestCASESession::Sigma1BadDestinationIdTest), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SecurePairing-CASE", - &sTests[0], - NL_TEST_WRAP_FUNCTION(TestContext::SetUpTestSuite), - NL_TEST_WRAP_FUNCTION(TestContext::TearDownTestSuite), - NL_TEST_WRAP_METHOD(TestContext, SetUp), - NL_TEST_WRAP_METHOD(TestContext, TearDown), -}; -// clang-format on - -/** - * Main - */ -int TestCASESessionTest() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestCASESessionTest) diff --git a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp index e4a71777d17b97..57dbd4b3496cdd 100644 --- a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp +++ b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp @@ -56,7 +56,6 @@ void VerifyCheckInCounterValues(uint32_t startValue, uint32_t expectedValue, Che EXPECT_EQ(counter.GetValue(), startValue); // Test operation - CHIP_ERROR err = CHIP_NO_ERROR; switch (operation) { case CheckInCounterOperations::kInvalidateHalf: { @@ -68,7 +67,6 @@ void VerifyCheckInCounterValues(uint32_t startValue, uint32_t expectedValue, Che break; } default: { - err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; FAIL(); } }; diff --git a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp index 82e755b783b4b8..59dcf3080a8ec3 100644 --- a/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestDefaultSessionResumptionStorage.cpp @@ -15,16 +15,15 @@ * limitations under the License. */ +#include #include #include -#include -#include // DefaultSessionResumptionStorage is a partial implementation. // Use SimpleSessionResumptionStorage, which extends it, to test. #include -void TestSave(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestSave) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -40,14 +39,11 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the FindByResumptionId call vectors[i].sharedSecret.SetLength(vectors[i].sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length()), CHIP_NO_ERROR); vectors[i].node = chip::ScopedNodeId(static_cast(i + 1), static_cast(i + 1)); vectors[i].cats.values[0] = static_cast(rand()); vectors[i].cats.values[1] = static_cast(rand()); @@ -57,9 +53,8 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // Fill storage. for (size_t i = 0; i < CHIP_CONFIG_CASE_SESSION_RESUME_CACHE_SIZE; ++i) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats) == - CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats), + CHIP_NO_ERROR); } // Verify behavior for over-fill. @@ -69,9 +64,9 @@ void TestSave(nlTestSuite * inSuite, void * inContext) // case should be modified to match. { size_t last = ArraySize(vectors) - 1; - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[last].node, vectors[last].resumptionId, vectors[last].sharedSecret, - vectors[last].cats) == CHIP_NO_ERROR); + EXPECT_EQ( + sessionStorage.Save(vectors[last].node, vectors[last].resumptionId, vectors[last].sharedSecret, vectors[last].cats), + CHIP_NO_ERROR); // Copy our data to our test vector index 0 to match // what is now in storage. vectors[0].node = vectors[last].node; @@ -89,28 +84,24 @@ void TestSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(vector.resumptionId.data(), outResumptionId.data(), vector.resumptionId.size()) == 0); - NL_TEST_ASSERT(inSuite, - memcmp(vector.sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vector.cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vector.cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vector.cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vector.resumptionId.data(), outResumptionId.data(), vector.resumptionId.size()), 0); + EXPECT_EQ(memcmp(vector.sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()), 0); + EXPECT_EQ(vector.cats.values[0], outCats.values[0]); + EXPECT_EQ(vector.cats.values[1], outCats.values[1]); + EXPECT_EQ(vector.cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vector.node == outNode); - NL_TEST_ASSERT(inSuite, - memcmp(vector.sharedSecret.Bytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vector.cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vector.cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vector.cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vector.node, outNode); + EXPECT_EQ(memcmp(vector.sharedSecret.Bytes(), outSharedSecret.ConstBytes(), vector.sharedSecret.Length()), 0); + EXPECT_EQ(vector.cats.values[0], outCats.values[0]); + EXPECT_EQ(vector.cats.values[1], outCats.values[1]); + EXPECT_EQ(vector.cats.values[2], outCats.values[2]); } } -void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestInPlaceSave) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -139,14 +130,11 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the FindByResumptionId call vectors[i].sharedSecret.SetLength(vectors[i].sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].sharedSecret.Bytes(), vectors[i].sharedSecret.Length()), CHIP_NO_ERROR); vectors[i].node = nodes[i % ArraySize(nodes)]; vectors[i].cats.values[0] = static_cast(rand()); vectors[i].cats.values[1] = static_cast(rand()); @@ -156,9 +144,8 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) // Add one entry for each node. for (size_t i = 0; i < ArraySize(nodes); ++i) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats) == - CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vectors[i].node, vectors[i].resumptionId, vectors[i].sharedSecret, vectors[i].cats), + CHIP_NO_ERROR); } // Read back and verify values. @@ -170,37 +157,27 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()) == 0); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()), 0); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vectors[i].node == outNode); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vectors[i].node, outNode); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); } // Now add all test vectors. This should overwrite each node's record // many times. for (auto & vector : vectors) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vector.node, vector.resumptionId, vector.sharedSecret, vector.cats) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vector.node, vector.resumptionId, vector.sharedSecret, vector.cats), CHIP_NO_ERROR); } // Read back and verify that only the last record for each node was retained. @@ -212,36 +189,27 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify retrieval by node. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()) == 0); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(vectors[i].node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(vectors[i].resumptionId.data(), outResumptionId.data(), vectors[i].resumptionId.size()), 0); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); // Validate retrieval by resumption ID. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, vectors[i].node == outNode); - NL_TEST_ASSERT( - inSuite, - memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()) == 0); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[0] == outCats.values[0]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[1] == outCats.values[1]); - NL_TEST_ASSERT(inSuite, vectors[i].cats.values[2] == outCats.values[2]); + EXPECT_EQ(sessionStorage.FindByResumptionId(vectors[i].resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_EQ(vectors[i].node, outNode); + EXPECT_EQ(memcmp(vectors[i].sharedSecret.ConstBytes(), outSharedSecret.ConstBytes(), vectors[i].sharedSecret.Length()), 0); + EXPECT_EQ(vectors[i].cats.values[0], outCats.values[0]); + EXPECT_EQ(vectors[i].cats.values[1], outCats.values[1]); + EXPECT_EQ(vectors[i].cats.values[2], outCats.values[2]); } // Remove all records for all fabrics. If all three tables of (index, state, // links) are in sync, deleting for each fabric should clean error free. for (const auto & node : nodes) { - NL_TEST_ASSERT(inSuite, sessionStorage.DeleteAll(node.GetFabricIndex()) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.DeleteAll(node.GetFabricIndex()), CHIP_NO_ERROR); } // Verify that no entries can be located any longer for any node or @@ -254,12 +222,10 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) chip::CATValues outCats; // Verify all records for all nodes are gone. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); // Verify all records for all resumption IDs are gone. - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); } // Verify no state table persistent storage entries were leaked. @@ -267,7 +233,7 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) { uint16_t size = 0; auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } // Verify no link table persistent storage entries were leaked. for (auto & vector : vectors) @@ -275,11 +241,11 @@ void TestInPlaceSave(nlTestSuite * inSuite, void * inContext) uint16_t size = 0; auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } -void TestDelete(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestDelete) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -293,13 +259,12 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) // Create a shared secret. We can use the same one for all entries. sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); // Populate test vectors. for (size_t i = 0; i < ArraySize(vectors); ++i) { - NL_TEST_ASSERT( - inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(vectors[i].resumptionId.data(), vectors[i].resumptionId.size()), CHIP_NO_ERROR); *vectors[i].resumptionId.data() = static_cast(i); // set first byte to our index to ensure uniqueness for the delete test vectors[i].node = chip::ScopedNodeId(static_cast(i + 1), static_cast(i + 1)); @@ -308,8 +273,7 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) // Fill storage. for (auto & vector : vectors) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(vector.node, vector.resumptionId, sharedSecret, chip::CATValues{}) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(vector.node, vector.resumptionId, sharedSecret, chip::CATValues{}), CHIP_NO_ERROR); } // Delete values in turn from storage and verify they are removed. @@ -319,11 +283,9 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) chip::SessionResumptionStorage::ResumptionIdStorage outResumptionId; chip::Crypto::P256ECDHDerivedSecret outSharedSecret; chip::CATValues outCats; - NL_TEST_ASSERT(inSuite, sessionStorage.Delete(vector.node) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Delete(vector.node), CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(vector.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByResumptionId(vector.resumptionId, outNode, outSharedSecret, outCats), CHIP_NO_ERROR); } // Verify no state or link table persistent storage entries were leaked. @@ -333,17 +295,17 @@ void TestDelete(nlTestSuite * inSuite, void * inContext) { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(vector.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } } -void TestDeleteAll(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultSessionResumptionStorage, TestDeleteAll) { chip::SimpleSessionResumptionStorage sessionStorage; chip::TestPersistentStorageDelegate storage; @@ -361,7 +323,7 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) // Create a shared secret. We can use the same one for all entries. sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); // Populate test vectors. for (size_t i = 0; i < sizeof(vectors) / sizeof(vectors[0]); ++i) @@ -369,10 +331,9 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) vectors[i].fabricIndex = static_cast(i + 1); for (size_t j = 0; j < sizeof(vectors[0].nodes) / sizeof(vectors[0].nodes[0]); ++j) { - NL_TEST_ASSERT( - inSuite, - CHIP_NO_ERROR == - chip::Crypto::DRBG_get_bytes(vectors[i].nodes[j].resumptionId.data(), vectors[i].nodes[j].resumptionId.size())); + EXPECT_EQ( + chip::Crypto::DRBG_get_bytes(vectors[i].nodes[j].resumptionId.data(), vectors[i].nodes[j].resumptionId.size()), + CHIP_NO_ERROR); vectors[i].nodes[j].node = chip::ScopedNodeId(static_cast(j), vectors[i].fabricIndex); } } @@ -382,8 +343,7 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) { for (auto & node : vector.nodes) { - NL_TEST_ASSERT(inSuite, - sessionStorage.Save(node.node, node.resumptionId, sharedSecret, chip::CATValues{}) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.Save(node.node, node.resumptionId, sharedSecret, chip::CATValues{}), CHIP_NO_ERROR); } } @@ -397,16 +357,14 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) // Verify fabric node entries exist. for (const auto & node : vector.nodes) { - NL_TEST_ASSERT( - inSuite, sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); } // Delete fabric. - NL_TEST_ASSERT(inSuite, sessionStorage.DeleteAll(vector.fabricIndex) == CHIP_NO_ERROR); + EXPECT_EQ(sessionStorage.DeleteAll(vector.fabricIndex), CHIP_NO_ERROR); // Verify fabric node entries no longer exist. for (const auto & node : vector.nodes) { - NL_TEST_ASSERT( - inSuite, sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats) != CHIP_NO_ERROR); + EXPECT_NE(sessionStorage.FindByScopedNodeId(node.node, outResumptionId, outSharedSecret, outCats), CHIP_NO_ERROR); } } // Verify no state or link table persistent storage entries were leaked. @@ -418,53 +376,13 @@ void TestDeleteAll(nlTestSuite * inSuite, void * inContext) { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node.node).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } { auto rv = storage.SyncGetKeyValue(chip::SimpleSessionResumptionStorage::GetStorageKey(node.resumptionId).KeyName(), nullptr, size); - NL_TEST_ASSERT(inSuite, rv == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(rv, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } } } } - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestSave", TestSave), - NL_TEST_DEF("TestInPlaceSave", TestInPlaceSave), - NL_TEST_DEF("TestDelete", TestDelete), - NL_TEST_DEF("TestDeleteAll", TestDeleteAll), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-DefaultSessionResumptionStorage", - &sTests[0], - nullptr, - nullptr, -}; -// clang-format on - -/** - * Main - */ -int TestDefaultSessionResumptionStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestDefaultSessionResumptionStorage) diff --git a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp index c2e71591acda14..41b6539ecf0773 100644 --- a/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp +++ b/src/protocols/secure_channel/tests/TestMessageCounterManager.cpp @@ -23,8 +23,7 @@ #include #include -#include -#include + #include #include #include @@ -35,8 +34,8 @@ #include #include +#include #include -#include #include @@ -48,8 +47,6 @@ using namespace chip::Transport; using namespace chip::Messaging; using namespace chip::Protocols; -using TestContext = chip::Test::LoopbackMessagingContext; - const char PAYLOAD[] = "Hello!"; class MockAppDelegate : public ExchangeDelegate @@ -67,109 +64,55 @@ class MockAppDelegate : public ExchangeDelegate int ReceiveHandlerCallCount = 0; }; -void MessageCounterSyncProcess(nlTestSuite * inSuite, void * inContext) +struct TestMessageCounterManager : public chip::Test::LoopbackMessagingContext, public ::testing::Test { - TestContext & ctx = *reinterpret_cast(inContext); + static void SetUpTestSuite() { chip::Test::LoopbackMessagingContext::SetUpTestSuite(); } + static void TearDownTestSuite() { chip::Test::LoopbackMessagingContext::TearDownTestSuite(); } - CHIP_ERROR err = CHIP_NO_ERROR; + void SetUp() override { chip::Test::LoopbackMessagingContext::SetUp(); } + void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } +}; + +TEST_F(TestMessageCounterManager, MessageCounterSyncProcess) +{ - SessionHandle localSession = ctx.GetSessionBobToAlice(); - SessionHandle peerSession = ctx.GetSessionAliceToBob(); + SessionHandle localSession = GetSessionBobToAlice(); + SessionHandle peerSession = GetSessionAliceToBob(); - Transport::SecureSession * localState = ctx.GetSecureSessionManager().GetSecureSession(localSession); - Transport::SecureSession * peerState = ctx.GetSecureSessionManager().GetSecureSession(peerSession); + Transport::SecureSession * localState = GetSecureSessionManager().GetSecureSession(localSession); + Transport::SecureSession * peerState = GetSecureSessionManager().GetSecureSession(peerSession); localState->GetSessionMessageCounter().GetPeerMessageCounter().Reset(); - err = ctx.GetMessageCounterManager().SendMsgCounterSyncReq(localSession, localState); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(GetMessageCounterManager().SendMsgCounterSyncReq(localSession, localState), CHIP_NO_ERROR); MessageCounter & peerCounter = peerState->GetSessionMessageCounter().GetLocalMessageCounter(); PeerMessageCounter & localCounter = localState->GetSessionMessageCounter().GetPeerMessageCounter(); - NL_TEST_ASSERT(inSuite, localCounter.IsSynchronized()); - NL_TEST_ASSERT(inSuite, localCounter.GetCounter() == peerCounter.Value()); + EXPECT_TRUE(localCounter.IsSynchronized()); + EXPECT_EQ(localCounter.GetCounter(), peerCounter.Value()); } -void CheckReceiveMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestMessageCounterManager, CheckReceiveMessage) { - TestContext & ctx = *reinterpret_cast(inContext); - CHIP_ERROR err = CHIP_NO_ERROR; - - SessionHandle peerSession = ctx.GetSessionAliceToBob(); - Transport::SecureSession * peerState = ctx.GetSecureSessionManager().GetSecureSession(peerSession); + SessionHandle peerSession = GetSessionAliceToBob(); + Transport::SecureSession * peerState = GetSecureSessionManager().GetSecureSession(peerSession); peerState->GetSessionMessageCounter().GetPeerMessageCounter().Reset(); MockAppDelegate callback; - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(chip::Protocols::Echo::MsgType::EchoRequest, &callback); + GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(chip::Protocols::Echo::MsgType::EchoRequest, &callback); uint16_t payload_len = sizeof(PAYLOAD); System::PacketBufferHandle msgBuf = MessagePacketBuffer::NewWithData(PAYLOAD, payload_len); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); - Messaging::ExchangeContext * ec = ctx.NewExchangeToAlice(nullptr); - NL_TEST_ASSERT(inSuite, ec != nullptr); + Messaging::ExchangeContext * ec = NewExchangeToAlice(nullptr); + ASSERT_NE(ec, nullptr); - err = ec->SendMessage(chip::Protocols::Echo::MsgType::EchoRequest, std::move(msgBuf), - Messaging::SendFlags{ Messaging::SendMessageFlags::kNoAutoRequestAck }); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, peerState->GetSessionMessageCounter().GetPeerMessageCounter().IsSynchronized()); - NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); + EXPECT_EQ(ec->SendMessage(chip::Protocols::Echo::MsgType::EchoRequest, std::move(msgBuf), + Messaging::SendFlags{ Messaging::SendMessageFlags::kNoAutoRequestAck }), + CHIP_NO_ERROR); + EXPECT_TRUE(peerState->GetSessionMessageCounter().GetPeerMessageCounter().IsSynchronized()); + EXPECT_EQ(callback.ReceiveHandlerCallCount, 1); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Test MessageCounterManager::MessageCounterSyncProcess", MessageCounterSyncProcess), - NL_TEST_DEF("Test MessageCounterManager::ReceiveMessage", CheckReceiveMessage), - NL_TEST_SENTINEL() -}; -// clang-format on - -int Initialize(void * aContext); -int Finalize(void * aContext); - -// clang-format off -nlTestSuite sSuite = -{ - "Test-MessageCounterManager", - &sTests[0], - Initialize, - Finalize -}; -// clang-format on - -/** - * Initialize the test suite. - */ -int Initialize(void * aContext) -{ - auto * ctx = static_cast(aContext); - VerifyOrReturnError(ctx->Init(&sSuite) == CHIP_NO_ERROR, FAILURE); - - return SUCCESS; -} - -/** - * Finalize the test suite. - */ -int Finalize(void * aContext) -{ - reinterpret_cast(aContext)->Shutdown(); - return SUCCESS; -} - } // namespace - -/** - * Main - */ -int TestMessageCounterManager() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestMessageCounterManager); diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 896f721579334d..5b3f957d51bf84 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -22,15 +22,13 @@ */ #include -#include +#include #include #include #include #include #include -#include -#include #include #include #include @@ -85,7 +83,8 @@ constexpr Spake2pVerifierSerialized sTestSpake2p01_SerializedVerifier = { 0xB7, 0xC0, 0x7F, 0xCC, 0x06, 0x27, 0xA1, 0xB8, 0x57, 0x3A, 0x14, 0x9F, 0xCD, 0x1F, 0xA4, 0x66, 0xCF }; -class TestContext : public chip::Test::LoopbackMessagingContext +class TestSecurePairingDelegate; +class TestPASESession : public chip::Test::LoopbackMessagingContext, public ::testing::Test { public: // Performs shared setup for all tests in the test suite @@ -99,6 +98,11 @@ class TestContext : public chip::Test::LoopbackMessagingContext } void TearDown() override { chip::Test::LoopbackMessagingContext::TearDown(); } + + void SecurePairingHandshakeTestCommon(SessionManager & sessionManager, PASESession & pairingCommissioner, + Optional mrpCommissionerConfig, + Optional mrpAccessoryConfig, + TestSecurePairingDelegate & delegateCommissioner); }; class PASETestLoopbackTransportDelegate : public Test::LoopbackTransportDelegate @@ -134,12 +138,11 @@ class MockAppDelegate : public ExchangeDelegate class TemporarySessionManager { public: - TemporarySessionManager(nlTestSuite * suite, TestContext & ctx) : mCtx(ctx) + TemporarySessionManager(TestPASESession & ctx) : mCtx(ctx) { - NL_TEST_ASSERT(suite, - CHIP_NO_ERROR == - mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), - &mStorage, &ctx.GetFabricTable(), ctx.GetSessionKeystore())); + EXPECT_EQ(CHIP_NO_ERROR, + mSessionManager.Init(&ctx.GetSystemLayer(), &ctx.GetTransportMgr(), &ctx.GetMessageCounterManager(), &mStorage, + &ctx.GetFabricTable(), ctx.GetSessionKeystore())); // The setup here is really weird: we are using one session manager for // the actual messages we send (the PASE handshake, so the // unauthenticated sessions) and a different one for allocating the PASE @@ -159,122 +162,114 @@ class TemporarySessionManager operator SessionManager &() { return mSessionManager; } private: - TestContext & mCtx; + TestPASESession & mCtx; TestPersistentStorageDelegate mStorage; SessionManager mSessionManager; }; using namespace System::Clock::Literals; -void SecurePairingWaitTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingWaitTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestSecurePairingDelegate delegate; PASESession pairing; - NL_TEST_ASSERT(inSuite, pairing.GetSecureSessionType() == SecureSession::Type::kPASE); + EXPECT_EQ(pairing.GetSecureSessionType(), SecureSession::Type::kPASE); - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(), - Optional::Missing(), - &delegate) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(reinterpret_cast("saltSalt"), 8), - Optional::Missing(), - nullptr) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(reinterpret_cast("saltSalt"), 8), - Optional::Missing(), - &delegate) == CHIP_ERROR_INVALID_ARGUMENT); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), - &delegate) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(), + Optional::Missing(), &delegate), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(reinterpret_cast("saltSalt"), 8), + Optional::Missing(), nullptr), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(reinterpret_cast("saltSalt"), 8), + Optional::Missing(), &delegate), + CHIP_ERROR_INVALID_ARGUMENT); + DrainAndServiceIO(); + + EXPECT_EQ(pairing.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), &delegate), + CHIP_NO_ERROR); + DrainAndServiceIO(); } -void SecurePairingStartTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingStartTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); // Test all combinations of invalid parameters TestSecurePairingDelegate delegate; PASESession pairing; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - ExchangeContext * context = ctx.NewUnauthenticatedExchangeToBob(&pairing); + ExchangeContext * context = NewUnauthenticatedExchangeToBob(&pairing); - NL_TEST_ASSERT(inSuite, - pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), nullptr, - nullptr) != CHIP_NO_ERROR); + EXPECT_NE( + pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), nullptr, nullptr), + CHIP_NO_ERROR); loopback.Reset(); - NL_TEST_ASSERT(inSuite, - pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context, - &delegate) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairing.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context, + &delegate), + CHIP_NO_ERROR); + DrainAndServiceIO(); // There should have been two messages sent: PBKDFParamRequest and an ack. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount == 2); + EXPECT_EQ(loopback.mSentMessageCount, 2u); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); - NL_TEST_ASSERT(inSuite, rm->TestGetCountRetransTable() == 0); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); + EXPECT_EQ(rm->TestGetCountRetransTable(), 0); loopback.Reset(); loopback.mSentMessageCount = 0; loopback.mMessageSendError = CHIP_ERROR_BAD_REQUEST; PASESession pairing1; - ExchangeContext * context1 = ctx.NewUnauthenticatedExchangeToBob(&pairing1); - NL_TEST_ASSERT(inSuite, - pairing1.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), - context1, &delegate) == CHIP_ERROR_BAD_REQUEST); - ctx.DrainAndServiceIO(); + ExchangeContext * context1 = NewUnauthenticatedExchangeToBob(&pairing1); + EXPECT_EQ(pairing1.Pair(sessionManager, sTestSpake2p01_PinCode, Optional::Missing(), context1, + &delegate), + CHIP_ERROR_BAD_REQUEST); + DrainAndServiceIO(); loopback.mMessageSendError = CHIP_NO_ERROR; } -void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, SessionManager & sessionManager, - PASESession & pairingCommissioner, - Optional mrpCommissionerConfig, - Optional mrpAccessoryConfig, - TestSecurePairingDelegate & delegateCommissioner) +void TestPASESession::SecurePairingHandshakeTestCommon(SessionManager & sessionManager, PASESession & pairingCommissioner, + Optional mrpCommissionerConfig, + Optional mrpAccessoryConfig, + TestSecurePairingDelegate & delegateCommissioner) { - TestContext & ctx = *reinterpret_cast(inContext); TestSecurePairingDelegate delegateAccessory; PASESession pairingAccessory; PASETestLoopbackTransportDelegate delegate; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.SetLoopbackTransportDelegate(&delegate); loopback.mSentMessageCount = 0; - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); if (loopback.mNumMessagesToDrop != 0) { - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); ReliableMessageContext * rc = contextCommissioner->GetReliableMessageContext(); - NL_TEST_ASSERT(inSuite, rm != nullptr); - NL_TEST_ASSERT(inSuite, rc != nullptr); + ASSERT_NE(rm, nullptr); + ASSERT_NE(rc, nullptr); // Adding an if-else to avoid affecting non-ICD tests #if CHIP_CONFIG_ENABLE_ICD_SERVER == 1 @@ -293,20 +288,19 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S #endif // CHIP_CONFIG_ENABLE_ICD_SERVER } - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( - Protocols::SecureChannel::MsgType::PBKDFParamRequest, &pairingAccessory) == CHIP_NO_ERROR); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, - ByteSpan(sTestSpake2p01_Salt), mrpAccessoryConfig, - &delegateAccessory) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), mrpAccessoryConfig, &delegateAccessory), + CHIP_NO_ERROR); + DrainAndServiceIO(); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.Pair(sessionManager, sTestSpake2p01_PinCode, mrpCommissionerConfig, contextCommissioner, - &delegateCommissioner) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); + EXPECT_EQ(pairingCommissioner.Pair(sessionManager, sTestSpake2p01_PinCode, mrpCommissionerConfig, contextCommissioner, + &delegateCommissioner), + CHIP_NO_ERROR); + DrainAndServiceIO(); while (delegate.mMessageDropped) { @@ -323,145 +317,127 @@ void SecurePairingHandshakeTestCommon(nlTestSuite * inSuite, void * inContext, S // Wait some time so the dropped message will be retransmitted when we drain the IO. chip::test_utils::SleepMillis(waitTimeout.count()); delegate.mMessageDropped = false; - ReliableMessageMgr::Timeout(&ctx.GetSystemLayer(), ctx.GetExchangeManager().GetReliableMessageMgr()); - ctx.DrainAndServiceIO(); + ReliableMessageMgr::Timeout(&GetSystemLayer(), GetExchangeManager().GetReliableMessageMgr()); + DrainAndServiceIO(); }; // Standalone acks also increment the mSentMessageCount. But some messages could be acked // via piggybacked acks. So we cannot check for a specific value of mSentMessageCount. // Let's make sure atleast number is >= than the minimum messages required to complete the // handshake. - NL_TEST_ASSERT(inSuite, loopback.mSentMessageCount >= sTestPaseMessageCount); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_GE(loopback.mSentMessageCount, sTestPaseMessageCount); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); if (mrpCommissionerConfig.HasValue()) { - NL_TEST_ASSERT(inSuite, - pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout == - mrpCommissionerConfig.Value().mIdleRetransTimeout); - NL_TEST_ASSERT(inSuite, - pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout == - mrpCommissionerConfig.Value().mActiveRetransTimeout); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mIdleRetransTimeout, mrpCommissionerConfig.Value().mIdleRetransTimeout); + EXPECT_EQ(pairingAccessory.GetRemoteMRPConfig().mActiveRetransTimeout, mrpCommissionerConfig.Value().mActiveRetransTimeout); } if (mrpAccessoryConfig.HasValue()) { - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout == - mrpAccessoryConfig.Value().mIdleRetransTimeout); - NL_TEST_ASSERT(inSuite, - pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout == - mrpAccessoryConfig.Value().mActiveRetransTimeout); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mIdleRetransTimeout, mrpAccessoryConfig.Value().mIdleRetransTimeout); + EXPECT_EQ(pairingCommissioner.GetRemoteMRPConfig().mActiveRetransTimeout, mrpAccessoryConfig.Value().mActiveRetransTimeout); } // Now evict the PASE sessions. auto session = pairingCommissioner.CopySecureSession(); - NL_TEST_ASSERT(inSuite, session.HasValue()); + EXPECT_TRUE(session.HasValue()); session.Value()->AsSecureSession()->MarkForEviction(); session = pairingAccessory.CopySecureSession(); - NL_TEST_ASSERT(inSuite, session.HasValue()); + EXPECT_TRUE(session.HasValue()); session.Value()->AsSecureSession()->MarkForEviction(); // Evicting a session async notifies the PASESession's delegate. Normally // that notification is what would delete the PASESession, but in our case // that will happen as soon as things come off the stack. So make sure to // process the async bits before that happens. - ctx.DrainAndServiceIO(); + DrainAndServiceIO(); // And check that this did not result in any new notifications. - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 1); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 1u); loopback.SetLoopbackTransportDelegate(nullptr); } -void SecurePairingHandshakeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Missing(), delegateCommissioner); } -void SecurePairingHandshakeWithCommissionerMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithCommissionerMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig config(1000_ms32, 10000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Value(config), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Value(config), Optional::Missing(), delegateCommissioner); } -void SecurePairingHandshakeWithDeviceMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithDeviceMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig config(1000_ms32, 10000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Value(config), delegateCommissioner); } -void SecurePairingHandshakeWithAllMRPTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithAllMRPTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); ReliableMessageProtocolConfig commissionerConfig(1000_ms32, 10000_ms32, 4000_ms16); ReliableMessageProtocolConfig deviceConfig(2000_ms32, 7000_ms32, 4000_ms16); - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Value(commissionerConfig), Optional::Value(deviceConfig), delegateCommissioner); } -void SecurePairingHandshakeWithPacketLossTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingHandshakeWithPacketLossTest) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); loopback.mNumMessagesToDrop = 2; - SecurePairingHandshakeTestCommon(inSuite, inContext, sessionManager, pairingCommissioner, - Optional::Missing(), + SecurePairingHandshakeTestCommon(sessionManager, pairingCommissioner, Optional::Missing(), Optional::Missing(), delegateCommissioner); - NL_TEST_ASSERT(inSuite, loopback.mDroppedMessageCount == 2); - NL_TEST_ASSERT(inSuite, loopback.mNumMessagesToDrop == 0); + EXPECT_EQ(loopback.mDroppedMessageCount, 2u); + EXPECT_EQ(loopback.mNumMessagesToDrop, 0u); } -void SecurePairingFailedHandshake(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, SecurePairingFailedHandshake) { - TestContext & ctx = *reinterpret_cast(inContext); - TemporarySessionManager sessionManager(inSuite, ctx); + TemporarySessionManager sessionManager(*this); TestSecurePairingDelegate delegateCommissioner; PASESession pairingCommissioner; @@ -469,98 +445,60 @@ void SecurePairingFailedHandshake(nlTestSuite * inSuite, void * inContext) TestSecurePairingDelegate delegateAccessory; PASESession pairingAccessory; - auto & loopback = ctx.GetLoopback(); + auto & loopback = GetLoopback(); loopback.Reset(); loopback.mSentMessageCount = 0; - ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(&pairingCommissioner); + ExchangeContext * contextCommissioner = NewUnauthenticatedExchangeToBob(&pairingCommissioner); - ReliableMessageMgr * rm = ctx.GetExchangeManager().GetReliableMessageMgr(); + ReliableMessageMgr * rm = GetExchangeManager().GetReliableMessageMgr(); ReliableMessageContext * rc = contextCommissioner->GetReliableMessageContext(); - NL_TEST_ASSERT(inSuite, rm != nullptr); - NL_TEST_ASSERT(inSuite, rc != nullptr); + ASSERT_NE(rm, nullptr); + ASSERT_NE(rc, nullptr); contextCommissioner->GetSessionHandle()->AsUnauthenticatedSession()->SetRemoteSessionParameters(ReliableMessageProtocolConfig({ 64_ms32, // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL 64_ms32, // CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL })); - NL_TEST_ASSERT(inSuite, - ctx.GetExchangeManager().RegisterUnsolicitedMessageHandlerForType( - Protocols::SecureChannel::MsgType::PBKDFParamRequest, &pairingAccessory) == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, - pairingAccessory.WaitForPairing( - sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, ByteSpan(sTestSpake2p01_Salt), - Optional::Missing(), &delegateAccessory) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, - pairingCommissioner.Pair(sessionManager, 4321, Optional::Missing(), - contextCommissioner, &delegateCommissioner) == CHIP_NO_ERROR); - ctx.DrainAndServiceIO(); - - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateAccessory.mNumPairingErrors == 1); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingComplete == 0); - NL_TEST_ASSERT(inSuite, delegateCommissioner.mNumPairingErrors == 1); + EXPECT_EQ(GetExchangeManager().RegisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest, + &pairingAccessory), + CHIP_NO_ERROR); + + EXPECT_EQ(pairingAccessory.WaitForPairing(sessionManager, sTestSpake2p01_PASEVerifier, sTestSpake2p01_IterationCount, + ByteSpan(sTestSpake2p01_Salt), Optional::Missing(), + &delegateAccessory), + CHIP_NO_ERROR); + DrainAndServiceIO(); + + EXPECT_EQ(pairingCommissioner.Pair(sessionManager, 4321, Optional::Missing(), + contextCommissioner, &delegateCommissioner), + CHIP_NO_ERROR); + DrainAndServiceIO(); + + EXPECT_EQ(delegateAccessory.mNumPairingComplete, 0u); + EXPECT_EQ(delegateAccessory.mNumPairingErrors, 1u); + EXPECT_EQ(delegateCommissioner.mNumPairingComplete, 0u); + EXPECT_EQ(delegateCommissioner.mNumPairingErrors, 1u); } -void PASEVerifierSerializeTest(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPASESession, PASEVerifierSerializeTest) { Spake2pVerifier verifier; - NL_TEST_ASSERT(inSuite, verifier.Deserialize(ByteSpan(sTestSpake2p01_SerializedVerifier)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&verifier, &sTestSpake2p01_PASEVerifier, sizeof(Spake2pVerifier)) == 0); + EXPECT_EQ(verifier.Deserialize(ByteSpan(sTestSpake2p01_SerializedVerifier)), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&verifier, &sTestSpake2p01_PASEVerifier, sizeof(Spake2pVerifier)), 0); Spake2pVerifierSerialized serializedVerifier; MutableByteSpan serializedVerifierSpan(serializedVerifier); - NL_TEST_ASSERT(inSuite, verifier.Serialize(serializedVerifierSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, serializedVerifierSpan.size() == kSpake2p_VerifierSerialized_Length); - NL_TEST_ASSERT(inSuite, memcmp(serializedVerifier, sTestSpake2p01_SerializedVerifier, kSpake2p_VerifierSerialized_Length) == 0); + EXPECT_EQ(verifier.Serialize(serializedVerifierSpan), CHIP_NO_ERROR); + EXPECT_EQ(serializedVerifierSpan.size(), kSpake2p_VerifierSerialized_Length); + EXPECT_EQ(memcmp(serializedVerifier, sTestSpake2p01_SerializedVerifier, kSpake2p_VerifierSerialized_Length), 0); Spake2pVerifierSerialized serializedVerifier2; MutableByteSpan serializedVerifier2Span(serializedVerifier2); - NL_TEST_ASSERT(inSuite, chip::Crypto::DRBG_get_bytes(serializedVerifier, kSpake2p_VerifierSerialized_Length) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, verifier.Deserialize(ByteSpan(serializedVerifier)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, verifier.Serialize(serializedVerifier2Span) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(serializedVerifier, serializedVerifier2, kSpake2p_VerifierSerialized_Length) == 0); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(serializedVerifier, kSpake2p_VerifierSerialized_Length), CHIP_NO_ERROR); + EXPECT_EQ(verifier.Deserialize(ByteSpan(serializedVerifier)), CHIP_NO_ERROR); + EXPECT_EQ(verifier.Serialize(serializedVerifier2Span), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(serializedVerifier, serializedVerifier2, kSpake2p_VerifierSerialized_Length), 0); } - -// Test Suite - -static const nlTest sTests[] = { - NL_TEST_DEF("WaitInit", SecurePairingWaitTest), - NL_TEST_DEF("Start", SecurePairingStartTest), - NL_TEST_DEF("Handshake", SecurePairingHandshakeTest), - NL_TEST_DEF("Handshake with Commissioner MRP Parameters", SecurePairingHandshakeWithCommissionerMRPTest), - NL_TEST_DEF("Handshake with Device MRP Parameters", SecurePairingHandshakeWithDeviceMRPTest), - NL_TEST_DEF("Handshake with Both MRP Parameters", SecurePairingHandshakeWithAllMRPTest), - NL_TEST_DEF("Handshake with packet loss", SecurePairingHandshakeWithPacketLossTest), - NL_TEST_DEF("Failed Handshake", SecurePairingFailedHandshake), - NL_TEST_DEF("PASE Verifier Serialize", PASEVerifierSerializeTest), - NL_TEST_SENTINEL(), -}; - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SecurePairing-PASE", - &sTests[0], - NL_TEST_WRAP_FUNCTION(TestContext::SetUpTestSuite), - NL_TEST_WRAP_FUNCTION(TestContext::TearDownTestSuite), - NL_TEST_WRAP_METHOD(TestContext, SetUp), - NL_TEST_WRAP_METHOD(TestContext, TearDown), -}; -// clang-format on - -} // anonymous namespace - -/** - * Main - */ -int TestPASESession() -{ - return chip::ExecuteTestsWithContext(&sSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestPASESession) +} // namespace diff --git a/src/protocols/secure_channel/tests/TestPairingSession.cpp b/src/protocols/secure_channel/tests/TestPairingSession.cpp index 4a3fe88d55c7aa..5a12f61fc5c69e 100644 --- a/src/protocols/secure_channel/tests/TestPairingSession.cpp +++ b/src/protocols/secure_channel/tests/TestPairingSession.cpp @@ -22,11 +22,11 @@ */ #include -#include +#include #include #include -#include + #include #include #include @@ -36,9 +36,16 @@ using namespace chip; using namespace chip::System::Clock; -class TestPairingSession : public PairingSession +class TestPairingSession : public PairingSession, public ::testing::Test { public: + static void SetUpTestSuite() + { + CHIP_ERROR error = chip::Platform::MemoryInit(); + ASSERT_EQ(error, CHIP_NO_ERROR); + } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + Transport::SecureSession::Type GetSecureSessionType() const override { return Transport::SecureSession::Type::kPASE; } ScopedNodeId GetPeer() const override { return ScopedNodeId(); } ScopedNodeId GetLocalScopedNodeId() const override { return ScopedNodeId(); } @@ -56,10 +63,8 @@ class TestPairingSession : public PairingSession } }; -void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPairingSession, PairingSessionEncodeDecodeMRPParams) { - TestPairingSession session; - ReliableMessageProtocolConfig config(Milliseconds32(100), Milliseconds32(200), Milliseconds16(4000)); System::PacketBufferHandle buf = System::PacketBufferHandle::New(64, 0); @@ -67,108 +72,48 @@ void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext writer.Init(buf.Retain()); TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, PairingSession::EncodeSessionParameters(TLV::ContextTag(1), config, writer) == CHIP_NO_ERROR); + EXPECT_EQ(PairingSession::EncodeSessionParameters(TLV::ContextTag(1), config, writer), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Finalize(&buf), CHIP_NO_ERROR); System::PacketBufferTLVReader reader; TLV::TLVType containerType = TLV::kTLVType_Structure; reader.Init(std::move(buf)); - NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag()) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(containerType, TLV::AnonymousTag()), CHIP_NO_ERROR); + EXPECT_EQ(reader.EnterContainer(containerType), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(1), reader) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(), CHIP_NO_ERROR); + EXPECT_EQ(DecodeMRPParametersIfPresent(TLV::ContextTag(1), reader), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.GetRemoteMRPConfig() == config); + EXPECT_EQ(GetRemoteMRPConfig(), config); } -void PairingSessionTryDecodeMissingMRPParams(nlTestSuite * inSuite, void * inContext) +TEST_F(TestPairingSession, PairingSessionTryDecodeMissingMRPParams) { - TestPairingSession session; - System::PacketBufferHandle buf = System::PacketBufferHandle::New(64, 0); System::PacketBufferTLVWriter writer; writer.Init(buf.Retain()); TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; - NL_TEST_ASSERT(inSuite, - writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Put(TLV::ContextTag(1), static_cast(0x1234)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); + EXPECT_EQ(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Put(TLV::ContextTag(1), static_cast(0x1234)), CHIP_NO_ERROR); + EXPECT_EQ(writer.EndContainer(outerContainerType), CHIP_NO_ERROR); + EXPECT_EQ(writer.Finalize(&buf), CHIP_NO_ERROR); System::PacketBufferTLVReader reader; TLV::TLVType containerType = TLV::kTLVType_Structure; reader.Init(std::move(buf)); - NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag()) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(2), reader) == CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(containerType, TLV::AnonymousTag()), CHIP_NO_ERROR); + EXPECT_EQ(reader.EnterContainer(containerType), CHIP_NO_ERROR); + EXPECT_EQ(reader.Next(), CHIP_NO_ERROR); + EXPECT_EQ(DecodeMRPParametersIfPresent(TLV::ContextTag(2), reader), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.GetRemoteMRPConfig() == GetDefaultMRPConfig()); + EXPECT_EQ(GetRemoteMRPConfig(), GetDefaultMRPConfig()); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("Encode and Decode MRP params", PairingSessionEncodeDecodeMRPParams), - NL_TEST_DEF("Decode missing MRP params", PairingSessionTryDecodeMissingMRPParams), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -int TestPairingSession_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestPairingSession_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-PairingSession", - &sTests[0], - TestPairingSession_Setup, - TestPairingSession_Teardown -}; -// clang-format on - -/** - * Main - */ -int TestPairingSessionInit() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestPairingSessionInit) diff --git a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp index cb511f6993c57d..ee107f695542a9 100644 --- a/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp +++ b/src/protocols/secure_channel/tests/TestSimpleSessionResumptionStorage.cpp @@ -15,8 +15,7 @@ * limitations under the License. */ -#include -#include +#include #include #include @@ -26,27 +25,27 @@ constexpr chip::NodeId node1 = 12344321; constexpr chip::FabricIndex fabric2 = 14; constexpr chip::NodeId node2 = 11223344; -void TestLink(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestLink) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; sessionStorage.Init(&storage); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size()), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveLink(resumptionId, chip::ScopedNodeId(node1, fabric1))); + EXPECT_EQ(sessionStorage.SaveLink(resumptionId, chip::ScopedNodeId(node1, fabric1)), CHIP_NO_ERROR); chip::ScopedNodeId node; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadLink(resumptionId, node)); - NL_TEST_ASSERT(inSuite, node == chip::ScopedNodeId(node1, fabric1)); + EXPECT_EQ(sessionStorage.LoadLink(resumptionId, node), CHIP_NO_ERROR); + EXPECT_EQ(node, chip::ScopedNodeId(node1, fabric1)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.DeleteLink(resumptionId)); + EXPECT_EQ(sessionStorage.DeleteLink(resumptionId), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == sessionStorage.LoadLink(resumptionId, node)); + EXPECT_EQ(sessionStorage.LoadLink(resumptionId, node), CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } -void TestState(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestState) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; @@ -55,31 +54,30 @@ void TestState(nlTestSuite * inSuite, void * inContext) chip::ScopedNodeId node(node1, fabric1); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(resumptionId.data(), resumptionId.size()), CHIP_NO_ERROR); chip::Crypto::P256ECDHDerivedSecret sharedSecret; sharedSecret.SetLength(sharedSecret.Capacity()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length())); + EXPECT_EQ(chip::Crypto::DRBG_get_bytes(sharedSecret.Bytes(), sharedSecret.Length()), CHIP_NO_ERROR); chip::CATValues peerCATs; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveState(node, resumptionId, sharedSecret, peerCATs)); + EXPECT_EQ(sessionStorage.SaveState(node, resumptionId, sharedSecret, peerCATs), CHIP_NO_ERROR); chip::SimpleSessionResumptionStorage::ResumptionIdStorage resumptionId2; chip::Crypto::P256ECDHDerivedSecret sharedSecret2; chip::CATValues peerCATs2; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2)); - NL_TEST_ASSERT(inSuite, resumptionId == resumptionId2); - NL_TEST_ASSERT(inSuite, memcmp(sharedSecret.Bytes(), sharedSecret2.Bytes(), sharedSecret.Length()) == 0); + EXPECT_EQ(sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2), CHIP_NO_ERROR); + EXPECT_EQ(resumptionId, resumptionId2); + EXPECT_EQ(memcmp(sharedSecret.Bytes(), sharedSecret2.Bytes(), sharedSecret.Length()), 0); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.DeleteState(node)); + EXPECT_EQ(sessionStorage.DeleteState(node), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == - sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2)); + EXPECT_EQ(sessionStorage.LoadState(node, resumptionId2, sharedSecret2, peerCATs2), + CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); } -void TestIndex(nlTestSuite * inSuite, void * inContext) +TEST(TestSimpleSessionResumptionStorage, TestIndex) { chip::TestPersistentStorageDelegate storage; chip::SimpleSessionResumptionStorage sessionStorage; @@ -88,63 +86,26 @@ void TestIndex(nlTestSuite * inSuite, void * inContext) chip::ScopedNodeId node(node1, fabric1); chip::DefaultSessionResumptionStorage::SessionIndex index0o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index0o)); - NL_TEST_ASSERT(inSuite, index0o.mSize == 0); + EXPECT_EQ(sessionStorage.LoadIndex(index0o), CHIP_NO_ERROR); + EXPECT_EQ(index0o.mSize, 0u); chip::DefaultSessionResumptionStorage::SessionIndex index1; index1.mSize = 0; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveIndex(index1)); + EXPECT_EQ(sessionStorage.SaveIndex(index1), CHIP_NO_ERROR); chip::DefaultSessionResumptionStorage::SessionIndex index1o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index1o)); - NL_TEST_ASSERT(inSuite, index1o.mSize == 0); + EXPECT_EQ(sessionStorage.LoadIndex(index1o), CHIP_NO_ERROR); + EXPECT_EQ(index1o.mSize, 0u); chip::DefaultSessionResumptionStorage::SessionIndex index2; index2.mSize = 2; index2.mNodes[0] = chip::ScopedNodeId(node1, fabric1); index2.mNodes[1] = chip::ScopedNodeId(node2, fabric2); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.SaveIndex(index2)); + EXPECT_EQ(CHIP_NO_ERROR, sessionStorage.SaveIndex(index2)); chip::DefaultSessionResumptionStorage::SessionIndex index2o; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == sessionStorage.LoadIndex(index2o)); - NL_TEST_ASSERT(inSuite, index2o.mSize == 2); - NL_TEST_ASSERT(inSuite, index2o.mNodes[0] == chip::ScopedNodeId(node1, fabric1)); - NL_TEST_ASSERT(inSuite, index2o.mNodes[1] == chip::ScopedNodeId(node2, fabric2)); + EXPECT_EQ(CHIP_NO_ERROR, sessionStorage.LoadIndex(index2o)); + EXPECT_EQ(index2o.mSize, 2u); + EXPECT_EQ(index2o.mNodes[0], chip::ScopedNodeId(node1, fabric1)); + EXPECT_EQ(index2o.mNodes[1], chip::ScopedNodeId(node2, fabric2)); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestLink", TestLink), - NL_TEST_DEF("TestState", TestState), - NL_TEST_DEF("TestIndex", TestState), - - NL_TEST_SENTINEL() -}; -// clang-format on - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-SimpleSessionResumptionStorage", - &sTests[0], - nullptr, - nullptr, -}; -// clang-format on - -/** - * Main - */ -int TestSimpleSessionResumptionStorage() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSimpleSessionResumptionStorage) diff --git a/src/protocols/secure_channel/tests/TestStatusReport.cpp b/src/protocols/secure_channel/tests/TestStatusReport.cpp index 093453029b156b..65bc639dcca7c3 100644 --- a/src/protocols/secure_channel/tests/TestStatusReport.cpp +++ b/src/protocols/secure_channel/tests/TestStatusReport.cpp @@ -19,19 +19,29 @@ #include #include #include -#include + #include #include #include #include -#include +#include using namespace chip; using namespace chip::Protocols; using namespace chip::Protocols::SecureChannel; -void TestStatusReport_NoData(nlTestSuite * inSuite, void * inContext) +struct TestStatusReport : public ::testing::Test +{ + static void SetUpTestSuite() + { + CHIP_ERROR error = chip::Platform::MemoryInit(); + ASSERT_EQ(error, CHIP_NO_ERROR); + } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestStatusReport, NoData) { GeneralStatusCode generalCode = GeneralStatusCode::kSuccess; auto protocolId = SecureChannel::Id; @@ -44,20 +54,19 @@ void TestStatusReport_NoData(nlTestSuite * inSuite, void * inContext) testReport.WriteToBuffer(bbuf); System::PacketBufferHandle msgBuf = bbuf.Finalize(); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(msgBuf)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & data = reportToParse.GetProtocolData(); - NL_TEST_ASSERT(inSuite, data.IsNull()); + EXPECT_TRUE(data.IsNull()); } -void TestStatusReport_WithData(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, WithData) { GeneralStatusCode generalCode = GeneralStatusCode::kFailure; auto protocolId = SecureChannel::Id; @@ -73,39 +82,34 @@ void TestStatusReport_WithData(nlTestSuite * inSuite, void * inContext) testReport.WriteToBuffer(bbuf); System::PacketBufferHandle msgBuf = bbuf.Finalize(); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(msgBuf)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(msgBuf)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & rcvData = reportToParse.GetProtocolData(); - if (rcvData.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } - NL_TEST_ASSERT(inSuite, rcvData->DataLength() == dataLen); - NL_TEST_ASSERT(inSuite, !memcmp(rcvData->Start(), data, dataLen)); + ASSERT_FALSE(rcvData.IsNull()); + EXPECT_EQ(rcvData->DataLength(), dataLen); + EXPECT_EQ(memcmp(rcvData->Start(), data, dataLen), 0); } -void TestBadStatusReport(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, TestBadStatusReport) { StatusReport report; System::PacketBufferHandle badMsg = System::PacketBufferHandle::New(10); CHIP_ERROR err = report.Parse(std::move(badMsg)); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); StatusReport report2; badMsg = nullptr; err = report2.Parse(std::move(badMsg)); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); } -void TestMakeBusyStatusReport(nlTestSuite * inSuite, void * inContext) +TEST_F(TestStatusReport, TestMakeBusyStatusReport) { GeneralStatusCode generalCode = GeneralStatusCode::kBusy; auto protocolId = SecureChannel::Id; @@ -113,81 +117,22 @@ void TestMakeBusyStatusReport(nlTestSuite * inSuite, void * inContext) System::Clock::Milliseconds16 minimumWaitTime = System::Clock::Milliseconds16(5000); System::PacketBufferHandle handle = StatusReport::MakeBusyStatusReportMessage(minimumWaitTime); - NL_TEST_ASSERT(inSuite, !handle.IsNull()); + ASSERT_FALSE(handle.IsNull()); StatusReport reportToParse; - CHIP_ERROR err = reportToParse.Parse(std::move(handle)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == err); - NL_TEST_ASSERT(inSuite, reportToParse.GetGeneralCode() == generalCode); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolId() == protocolId); - NL_TEST_ASSERT(inSuite, reportToParse.GetProtocolCode() == protocolCode); + EXPECT_EQ(reportToParse.Parse(std::move(handle)), CHIP_NO_ERROR); + EXPECT_EQ(reportToParse.GetGeneralCode(), generalCode); + EXPECT_EQ(reportToParse.GetProtocolId(), protocolId); + EXPECT_EQ(reportToParse.GetProtocolCode(), protocolCode); const System::PacketBufferHandle & rcvData = reportToParse.GetProtocolData(); - NL_TEST_ASSERT(inSuite, !rcvData.IsNull()); - NL_TEST_ASSERT(inSuite, rcvData->DataLength() == sizeof(minimumWaitTime)); + ASSERT_FALSE(rcvData.IsNull()); + EXPECT_EQ(rcvData->DataLength(), sizeof(minimumWaitTime)); uint16_t readMinimumWaitTime = 0; Encoding::LittleEndian::Reader reader(rcvData->Start(), rcvData->DataLength()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == reader.Read16(&readMinimumWaitTime).StatusCode()); - NL_TEST_ASSERT(inSuite, System::Clock::Milliseconds16(readMinimumWaitTime) == minimumWaitTime); + EXPECT_EQ(reader.Read16(&readMinimumWaitTime).StatusCode(), CHIP_NO_ERROR); + EXPECT_EQ(System::Clock::Milliseconds16(readMinimumWaitTime), minimumWaitTime); } // Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestStatusReport_NoData", TestStatusReport_NoData), - NL_TEST_DEF("TestStatusReport_WithData", TestStatusReport_WithData), - NL_TEST_DEF("TestBadStatusReport", TestBadStatusReport), - NL_TEST_DEF("TestMakeBusyStatusReport", TestMakeBusyStatusReport), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-StatusReport", - &sTests[0], - TestSetup, - TestTeardown, -}; -// clang-format on - -/** - * Main - */ -int TestStatusReport() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestStatusReport) diff --git a/src/system/tests/BUILD.gn b/src/system/tests/BUILD.gn index 2f2fd4de0a6a6d..01965170ab9b0c 100644 --- a/src/system/tests/BUILD.gn +++ b/src/system/tests/BUILD.gn @@ -46,6 +46,7 @@ chip_test_suite("tests") { public_deps = [ "${chip_root}/src/inet", + "${chip_root}/src/lib/support/tests:pw-test-macros", "${chip_root}/src/platform", "${chip_root}/src/system", ] diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index c71ad542d6225a..bf1456487307a3 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -192,16 +193,6 @@ class TestSystemPacketBuffer : public ::testing::Test void CheckSetStart(); }; -/* - * Run fixture's class function as a test. - */ -#define TEST_F_FROM_FIXTURE(test_fixture, test_name) \ - TEST_F(test_fixture, test_name) \ - { \ - test_name(); \ - } \ - void test_fixture::test_name() - /** * Allocate memory for a test buffer and configure according to test buffer configuration. */ diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index 925be3fdd2b499..6c038b398d914f 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -1,2 +1 @@ -AppTestsNL -SecureChannelTestsNL +AppTestsNL \ No newline at end of file From a42570bfc530d47aff5936e3321ab12d78284f87 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Tue, 4 Jun 2024 19:07:53 +0200 Subject: [PATCH 05/78] Setup bloat reports for Tizen CI builds (#33729) * Setup bloat reports for Tizen CI builds * Apply suggestions from code review Co-authored-by: Andrei Litvin * Configuration for Tizen --------- Co-authored-by: Andrei Litvin --- .github/workflows/examples-tizen.yaml | 23 +++++++++ scripts/tools/memory/platform/tizen.cfg | 67 +++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 scripts/tools/memory/platform/tizen.cfg diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 17cd275e0d5b52..295f6d158c87d9 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -50,6 +50,12 @@ jobs: with: platform: tizen + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + - name: Build Tizen examples run: | ./scripts/run_in_build_env.sh \ @@ -61,3 +67,20 @@ jobs: build \ --copy-artifacts-to out/artifacts \ " + + - name: Bloat report - chip-tool + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + tizen arm chip-tool-ubsan out/tizen-arm-chip-tool-ubsan/chip-tool \ + /tmp/bloat_reports/ + - name: Bloat report - all-clusters-app + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + tizen arm all-clusters-app out/tizen-arm-all-clusters/chip-all-clusters-app \ + /tmp/bloat_reports/ + + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: Tizen diff --git a/scripts/tools/memory/platform/tizen.cfg b/scripts/tools/memory/platform/tizen.cfg new file mode 100644 index 00000000000000..294bf21386de3e --- /dev/null +++ b/scripts/tools/memory/platform/tizen.cfg @@ -0,0 +1,67 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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. + +# Memory tools default configuation for Tizen. + +{ + 'section': { + # By default, only these sections will be included + # when operating by sections. + 'default': [ + '.text', '.data', '.data.rel.ro', '.bss', '.dynamic', '.got', + '.init', '.init_array', '.rodata' + ] + }, + 'region': { + # Regions are sets of sections that can be used for aggregate reports. + 'sections': { + 'FLASH': [ + ".dynstr", + ".dynsym", + ".eh_frame_hdr", + ".eh_frame", + ".fini", + ".gcc_except_table", + ".gnu.version_d", + ".gnu.version_r", + ".gnu.version", + ".hash", + ".init", + ".interp", + ".note.ABI-tag", + ".rodata1", + ".rodata", + ".strtab", + ".symtab", + ".text", + ], + 'RAM': [ + ".bss", + ".ctors", + ".data1", + ".data.rel.ro", + ".data", + ".dtors", + ".dynamic", + ".fini_array", + ".got.plt", + ".init_array", + ".jcr", + ".preinit_array", + ".tbss", + ".tdata", + ] + } + }, +} From d8e7e43fec024800a3441762f68123b369c85164 Mon Sep 17 00:00:00 2001 From: Song GUO Date: Tue, 4 Jun 2024 17:53:30 +0000 Subject: [PATCH 06/78] [python] Add ICD support to Python binding (#33533) * [icd] Add ICD support to python * [python] Add ICD support to Python binding * Update * update * update * Update * Use ScopedNodeId in ICD commissioning callbacks * update * fix --- .../commands/pairing/PairingCommand.cpp | 14 +- .../commands/pairing/PairingCommand.h | 4 +- .../commands/pairing/PairingCommand.cpp | 16 +- .../commands/pairing/PairingCommand.h | 4 +- src/controller/CHIPDeviceController.cpp | 10 +- src/controller/DevicePairingDelegate.h | 4 +- .../java/AndroidDeviceControllerWrapper.cpp | 12 +- .../java/AndroidDeviceControllerWrapper.h | 2 +- src/controller/python/BUILD.gn | 3 + .../ChipDeviceController-ScriptBinding.cpp | 88 +++++++++- ...Controller-ScriptDevicePairingDelegate.cpp | 40 +++++ ...ceController-ScriptDevicePairingDelegate.h | 8 +- src/controller/python/OpCredsBinding.cpp | 5 + src/controller/python/chip/ChipDeviceCtrl.py | 163 +++++++++++++++++- src/controller/python/chip/ChipReplStartup.py | 4 +- .../python/chip/icd/PyChipCheckInDelegate.cpp | 33 ++++ .../python/chip/icd/PyChipCheckInDelegate.h | 42 +++++ src/controller/python/chip/internal/types.py | 6 +- 18 files changed, 419 insertions(+), 39 deletions(-) create mode 100644 src/controller/python/chip/icd/PyChipCheckInDelegate.cpp create mode 100644 src/controller/python/chip/icd/PyChipCheckInDelegate.h diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index 5f6c179779f3c2..76c8ac8a58cc19 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -436,7 +436,7 @@ void PairingCommand::OnReadCommissioningInfo(const Controller::ReadCommissioning info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); } -void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounter) +void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) { char icdSymmetricKeyHex[chip::Crypto::kAES_CCM128_Key_Length * 2 + 1]; @@ -444,7 +444,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(nodeId, CurrentCommissioner().GetFabricIndex()); + clientInfo.peer_node = nodeId; clientInfo.monitored_subject = mICDMonitoredSubject.Value(); clientInfo.start_icd_counter = icdCounter; @@ -457,7 +457,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte if (err != CHIP_NO_ERROR) { CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); - ChipLogError(chipTool, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId), + ChipLogError(chipTool, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); SetCommandExitStatus(err); return; @@ -465,18 +465,18 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte mDeviceIsICD = true; - ChipLogProgress(chipTool, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId)); + ChipLogProgress(chipTool, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); ChipLogProgress(chipTool, "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 " / Monitored Subject: " ChipLogFormatX64 " / Symmetric Key: %s / ICDCounter %u", - ChipLogValueX64(nodeId), ChipLogValueX64(mICDCheckInNodeId.Value()), + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(mICDCheckInNodeId.Value()), ChipLogValueX64(mICDMonitoredSubject.Value()), icdSymmetricKeyHex, icdCounter); } -void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) +void PairingCommand::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) { ChipLogProgress(chipTool, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", - ChipLogValueX64(deviceId), promisedActiveDuration); + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); } void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index 99b0fd0c91882e..aaa8dc714e1017 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -197,8 +197,8 @@ class PairingCommand : public CHIPCommand, void OnPairingDeleted(CHIP_ERROR error) override; void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR error) override; - void OnICDRegistrationComplete(NodeId deviceId, uint32_t icdCounter) override; - void OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) override; + void OnICDRegistrationComplete(chip::ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(chip::ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index 379b56431379e4..92754c2adaa69a 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -436,7 +436,7 @@ void PairingCommand::OnReadCommissioningInfo(const Controller::ReadCommissioning info.icd.idleModeDuration, info.icd.activeModeDuration, info.icd.activeModeThreshold); } -void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounter) +void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) { char icdSymmetricKeyHex[chip::Crypto::kAES_CCM128_Key_Length * 2 + 1]; @@ -444,7 +444,7 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(nodeId, CurrentCommissioner().GetFabricIndex()); + clientInfo.peer_node = nodeId; clientInfo.monitored_subject = mICDMonitoredSubject.Value(); clientInfo.start_icd_counter = icdCounter; @@ -457,26 +457,26 @@ void PairingCommand::OnICDRegistrationComplete(NodeId nodeId, uint32_t icdCounte if (err != CHIP_NO_ERROR) { CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); - ChipLogError(NotSpecified, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(nodeId), - err.AsString()); + ChipLogError(NotSpecified, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); SetCommandExitStatus(err); return; } mDeviceIsICD = true; - ChipLogProgress(NotSpecified, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId)); + ChipLogProgress(NotSpecified, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); ChipLogProgress(NotSpecified, "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 " / Monitored Subject: " ChipLogFormatX64 " / Symmetric Key: %s / ICDCounter %u", - ChipLogValueX64(nodeId), ChipLogValueX64(mICDCheckInNodeId.Value()), + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(mICDCheckInNodeId.Value()), ChipLogValueX64(mICDMonitoredSubject.Value()), icdSymmetricKeyHex, icdCounter); } -void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) +void PairingCommand::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) { ChipLogProgress(NotSpecified, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", - ChipLogValueX64(deviceId), promisedActiveDuration); + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); } void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.h b/examples/fabric-admin/commands/pairing/PairingCommand.h index 8de34a0ba989ed..331d177448aed5 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.h +++ b/examples/fabric-admin/commands/pairing/PairingCommand.h @@ -196,8 +196,8 @@ class PairingCommand : public CHIPCommand, void OnPairingDeleted(CHIP_ERROR error) override; void OnReadCommissioningInfo(const chip::Controller::ReadCommissioningInfo & info) override; void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR error) override; - void OnICDRegistrationComplete(NodeId deviceId, uint32_t icdCounter) override; - void OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) override; + void OnICDRegistrationComplete(chip::ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(chip::ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 1381ed3381a649..75c95ee20abc06 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1326,8 +1326,8 @@ void DeviceCommissioner::OnICDManagementRegisterClientResponse( if (commissioner->mPairingDelegate != nullptr) { - commissioner->mPairingDelegate->OnICDRegistrationComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(), - data.ICDCounter); + commissioner->mPairingDelegate->OnICDRegistrationComplete( + ScopedNodeId(commissioner->mDeviceBeingCommissioned->GetDeviceId(), commissioner->GetFabricIndex()), data.ICDCounter); } exit: @@ -1346,8 +1346,10 @@ void DeviceCommissioner::OnICDManagementStayActiveResponse( if (commissioner->mPairingDelegate != nullptr) { - commissioner->mPairingDelegate->OnICDStayActiveComplete(commissioner->mDeviceBeingCommissioned->GetDeviceId(), - data.promisedActiveDuration); + commissioner->mPairingDelegate->OnICDStayActiveComplete( + + ScopedNodeId(commissioner->mDeviceBeingCommissioned->GetDeviceId(), commissioner->GetFabricIndex()), + data.promisedActiveDuration); } exit: diff --git a/src/controller/DevicePairingDelegate.h b/src/controller/DevicePairingDelegate.h index 558a6c16a6bc2e..849df45436d9e8 100644 --- a/src/controller/DevicePairingDelegate.h +++ b/src/controller/DevicePairingDelegate.h @@ -136,7 +136,7 @@ class DLL_EXPORT DevicePairingDelegate * @param[in] icdNodeId The node id of the ICD. * @param[in] icdCounter The ICD Counter received from the device. */ - virtual void OnICDRegistrationComplete(NodeId icdNodeId, uint32_t icdCounter) {} + virtual void OnICDRegistrationComplete(ScopedNodeId icdNodeId, uint32_t icdCounter) {} /** * @brief @@ -147,7 +147,7 @@ class DLL_EXPORT DevicePairingDelegate * @param[in] promisedActiveDurationMsec The actual duration that the ICD server can stay active * from the time it receives the StayActiveRequest command. */ - virtual void OnICDStayActiveComplete(NodeId icdNodeId, uint32_t promisedActiveDurationMsec) {} + virtual void OnICDStayActiveComplete(ScopedNodeId icdNodeId, uint32_t promisedActiveDurationMsec) {} }; } // namespace Controller diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index 526f6830844f13..87f53735bcf617 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -994,13 +994,13 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationInfoRequired() env->CallVoidMethod(mJavaObjectRef.ObjectRef(), onICDRegistrationInfoRequiredMethod); } -void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdNodeId, uint32_t icdCounter) +void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::ScopedNodeId icdNodeId, uint32_t icdCounter) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; chip::app::ICDClientInfo clientInfo; - clientInfo.peer_node = ScopedNodeId(icdNodeId, Controller()->GetFabricIndex()); + clientInfo.peer_node = icdNodeId; clientInfo.monitored_subject = mAutoCommissioner.GetCommissioningParameters().GetICDMonitoredSubject().Value(); clientInfo.start_icd_counter = icdCounter; @@ -1014,13 +1014,13 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdN if (err == CHIP_NO_ERROR) { - ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(icdNodeId)); + ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(icdNodeId.GetNodeId())); } else { getICDClientStorage()->RemoveKey(clientInfo); - ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", ChipLogValueX64(icdNodeId), - err.AsString()); + ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(icdNodeId.GetNodeId()), err.AsString()); } mDeviceIsICD = true; @@ -1055,7 +1055,7 @@ void AndroidDeviceControllerWrapper::OnICDRegistrationComplete(chip::NodeId icdN icdDeviceInfoObj = env->NewObject( icdDeviceInfoClass, icdDeviceInfoStructCtor, jSymmetricKey, static_cast(mUserActiveModeTriggerHint.Raw()), jUserActiveModeTriggerInstruction, static_cast(mIdleModeDuration), static_cast(mActiveModeDuration), - static_cast(mActiveModeThreshold), static_cast(icdNodeId), static_cast(icdCounter), + static_cast(mActiveModeThreshold), static_cast(icdNodeId.GetNodeId()), static_cast(icdCounter), static_cast(mAutoCommissioner.GetCommissioningParameters().GetICDMonitoredSubject().Value()), static_cast(Controller()->GetFabricId()), static_cast(Controller()->GetFabricIndex())); diff --git a/src/controller/java/AndroidDeviceControllerWrapper.h b/src/controller/java/AndroidDeviceControllerWrapper.h index 1d26d31d112774..02d50499bbbcda 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.h +++ b/src/controller/java/AndroidDeviceControllerWrapper.h @@ -118,7 +118,7 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel const chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::DecodableType & dataResponse) override; void OnScanNetworksFailure(CHIP_ERROR error) override; void OnICDRegistrationInfoRequired() override; - void OnICDRegistrationComplete(chip::NodeId icdNodeId, uint32_t icdCounter) override; + void OnICDRegistrationComplete(chip::ScopedNodeId icdNodeId, uint32_t icdCounter) override; // PersistentStorageDelegate implementation CHIP_ERROR SyncSetKeyValue(const char * key, const void * value, uint16_t size) override; diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 4676f89b362970..9adda770125317 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -76,6 +76,8 @@ shared_library("ChipDeviceCtrl") { "chip/crypto/p256keypair.cpp", "chip/crypto/p256keypair.h", "chip/discovery/NodeResolution.cpp", + "chip/icd/PyChipCheckInDelegate.cpp", + "chip/icd/PyChipCheckInDelegate.h", "chip/interaction_model/Delegate.cpp", "chip/interaction_model/Delegate.h", "chip/internal/ChipThreadWork.cpp", @@ -121,6 +123,7 @@ shared_library("ChipDeviceCtrl") { public_deps = [ "${chip_root}/src/app", + "${chip_root}/src/app/icd/client:handler", "${chip_root}/src/app/server", "${chip_root}/src/credentials:default_attestation_verifier", "${chip_root}/src/lib", diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 728fd5801f1cb1..821b2a34e03b60 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -42,6 +42,9 @@ #include #include +#include +#include +#include #include #include #include @@ -55,7 +58,9 @@ #include #include #include +#include #include +#include #include #include @@ -101,20 +106,24 @@ chip::Platform::ScopedMemoryBuffer sDefaultNTPBuf; app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::Type sDSTBuf; app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type sTimeZoneBuf; chip::Platform::ScopedMemoryBuffer sTimeZoneNameBuf; -chip::Controller::CommissioningParameters sCommissioningParameters; - } // namespace +chip::Controller::CommissioningParameters sCommissioningParameters; +chip::app::DefaultICDClientStorage sICDClientStorage; chip::Controller::ScriptPairingDeviceDiscoveryDelegate sPairingDeviceDiscoveryDelegate; chip::Credentials::GroupDataProviderImpl sGroupDataProvider; chip::Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; chip::Crypto::RawKeySessionKeystore sSessionKeystore; +chip::app::CheckInHandler sCheckInHandler; + // NOTE: Remote device ID is in sync with the echo server device id // At some point, we may want to add an option to connect to a device without // knowing its id, because the ID can be learned on the first response that is received. +chip::Controller::PyChipCheckInDelegate sCheckInDelegate; chip::NodeId kDefaultLocalDeviceId = chip::kTestControllerNodeId; chip::NodeId kRemoteDeviceId = chip::kTestDeviceNodeId; +uint8_t sICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; extern "C" { PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter * storageAdapter, bool enableServerInteractions); @@ -126,6 +135,7 @@ PyChipError pychip_DeviceController_GetAddressAndPort(chip::Controller::DeviceCo char * outAddress, uint64_t maxAddressLen, uint16_t * outPort); PyChipError pychip_DeviceController_GetCompressedFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); PyChipError pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outFabricId); +PyChipError pychip_DeviceController_GetFabricIndex(chip::Controller::DeviceCommissioner * devCtrl, uint8_t * outFabricIndex); PyChipError pychip_DeviceController_GetNodeId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outNodeId); // Rendezvous @@ -144,6 +154,8 @@ PyChipError pychip_DeviceController_SetDSTOffset(int32_t offset, uint64_t validS PyChipError pychip_DeviceController_SetDefaultNtp(const char * defaultNTP); PyChipError pychip_DeviceController_SetTrustedTimeSource(chip::NodeId nodeId, chip::EndpointId endpoint); PyChipError pychip_DeviceController_SetCheckMatchingFabric(bool check); +struct IcdRegistrationParameters; +PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, const IcdRegistrationParameters * params); PyChipError pychip_DeviceController_ResetCommissioningParameters(); PyChipError pychip_DeviceController_CloseSession(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeid); PyChipError pychip_DeviceController_EstablishPASESessionIP(chip::Controller::DeviceCommissioner * devCtrl, const char * peerAddrStr, @@ -235,6 +247,11 @@ void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObjec chip::Controller::Python::SetGetKeyValueCb getCb, chip::Controller::Python::SyncDeleteKeyValueCb deleteCb); void pychip_Storage_ShutdownAdapter(chip::Controller::Python::StorageAdapter * storageAdapter); + +// +// ICD +// +void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback); } void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObject * context, @@ -260,6 +277,8 @@ PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter factoryParams.fabricIndependentStorage = storageAdapter; factoryParams.sessionKeystore = &sSessionKeystore; + sICDClientStorage.Init(storageAdapter, &sSessionKeystore); + sGroupDataProvider.SetStorageDelegate(storageAdapter); sGroupDataProvider.SetSessionKeystore(factoryParams.sessionKeystore); PyReturnErrorOnFailure(ToPyChipError(sGroupDataProvider.Init())); @@ -290,6 +309,11 @@ PyChipError pychip_DeviceController_StackInit(Controller::Python::StorageAdapter // DeviceControllerFactory::GetInstance().RetainSystemState(); + auto engine = chip::app::InteractionModelEngine::GetInstance(); + PyReturnErrorOnFailure(ToPyChipError(sCheckInDelegate.Init(&sICDClientStorage, engine))); + PyReturnErrorOnFailure(ToPyChipError(sCheckInHandler.Init( + DeviceControllerFactory::GetInstance().GetSystemState()->ExchangeMgr(), &sICDClientStorage, &sCheckInDelegate, engine))); + // // Finally, start up the main Matter thread. Any further interactions with the stack // will now need to happen on the Matter thread, OR protected with the stack lock. @@ -342,6 +366,12 @@ PyChipError pychip_DeviceController_GetFabricId(chip::Controller::DeviceCommissi return ToPyChipError(CHIP_NO_ERROR); } +PyChipError pychip_DeviceController_GetFabricIndex(chip::Controller::DeviceCommissioner * devCtrl, uint8_t * outFabricIndex) +{ + *outFabricIndex = devCtrl->GetFabricIndex(); + return ToPyChipError(CHIP_NO_ERROR); +} + PyChipError pychip_DeviceController_GetNodeId(chip::Controller::DeviceCommissioner * devCtrl, uint64_t * outNodeId) { *outNodeId = devCtrl->GetNodeId(); @@ -554,6 +584,55 @@ PyChipError pychip_DeviceController_SetCheckMatchingFabric(bool check) return ToPyChipError(CHIP_NO_ERROR); } +struct IcdRegistrationParameters +{ + uint8_t * symmetricKey; + size_t symmetricKeyLength; + uint64_t checkInNodeId; + uint64_t monitoredSubject; + uint32_t stayActiveMsec; +}; + +PyChipError pychip_DeviceController_SetIcdRegistrationParameters(bool enabled, const IcdRegistrationParameters * params) +{ + if (!enabled) + { + sCommissioningParameters.SetICDRegistrationStrategy(ICDRegistrationStrategy::kIgnore); + return ToPyChipError(CHIP_NO_ERROR); + } + + if (params == nullptr) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + if (params->symmetricKey == nullptr || params->symmetricKeyLength != sizeof(sICDSymmetricKey)) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + if (params->checkInNodeId == 0) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + if (params->monitoredSubject == 0) + { + return ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT); + } + + memcpy(sICDSymmetricKey, params->symmetricKey, sizeof(sICDSymmetricKey)); + sCommissioningParameters.SetICDSymmetricKey(ByteSpan(sICDSymmetricKey)); + if (params->stayActiveMsec != 0) + { + sCommissioningParameters.SetICDStayActiveDurationMsec(params->stayActiveMsec); + } + sCommissioningParameters.SetICDCheckInNodeId(params->checkInNodeId); + sCommissioningParameters.SetICDMonitoredSubject(params->monitoredSubject); + sCommissioningParameters.SetICDRegistrationStrategy(ICDRegistrationStrategy::kBeforeComplete); + + return ToPyChipError(CHIP_NO_ERROR); +} + PyChipError pychip_DeviceController_ResetCommissioningParameters() { sCommissioningParameters = CommissioningParameters(); @@ -871,3 +950,8 @@ PyChipError pychip_DeviceController_PostTaskOnChipThread(ChipThreadTaskRunnerFun PlatformMgr().ScheduleWork(callback, reinterpret_cast(pythonContext)); return ToPyChipError(CHIP_NO_ERROR); } + +void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback) +{ + chip::MainLoopWork::ExecuteInMainLoop([callback]() { sCheckInDelegate.SetOnCheckInCompleteCallback(callback); }); +} diff --git a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp index c1df8125793d02..c979e0d9cd77a3 100644 --- a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp +++ b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp @@ -19,12 +19,17 @@ #include "ChipDeviceController-ScriptDevicePairingDelegate.h" #include "lib/support/TypeTraits.h" +#include #include #include #include #include +extern chip::app::DefaultICDClientStorage sICDClientStorage; +extern chip::Controller::CommissioningParameters sCommissioningParameters; +extern uint8_t sICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; + namespace chip { namespace Controller { @@ -180,5 +185,40 @@ ScriptDevicePairingDelegate::GetOpenWindowCallback(Controller::CommissioningWind return &mOpenWindowCallback; } +void ScriptDevicePairingDelegate::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) +{ + app::ICDClientInfo clientInfo; + clientInfo.peer_node = nodeId; + clientInfo.monitored_subject = sCommissioningParameters.GetICDMonitoredSubject().Value(); + clientInfo.start_icd_counter = icdCounter; + + CHIP_ERROR err = sICDClientStorage.SetKey(clientInfo, ByteSpan(sICDSymmetricKey)); + if (err == CHIP_NO_ERROR) + { + err = sICDClientStorage.StoreEntry(clientInfo); + } + + if (err != CHIP_NO_ERROR) + { + sICDClientStorage.RemoveKey(clientInfo); + ChipLogError(Controller, "Failed to persist symmetric key for " ChipLogFormatX64 ": %s", + ChipLogValueX64(nodeId.GetNodeId()), err.AsString()); + return; + } + + ChipLogProgress(Controller, "Saved ICD Symmetric key for " ChipLogFormatX64, ChipLogValueX64(nodeId.GetNodeId())); + ChipLogProgress(Controller, + "ICD Registration Complete for device " ChipLogFormatX64 " / Check-In NodeID: " ChipLogFormatX64 + " / Monitored Subject: " ChipLogFormatX64 " / ICDCounter %u", + ChipLogValueX64(nodeId.GetNodeId()), ChipLogValueX64(sCommissioningParameters.GetICDCheckInNodeId().Value()), + ChipLogValueX64(clientInfo.monitored_subject), icdCounter); +} + +void ScriptDevicePairingDelegate::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) +{ + ChipLogProgress(Controller, "ICD Stay Active Complete for device " ChipLogFormatX64 " / promisedActiveDuration: %u", + ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); +} + } // namespace Controller } // namespace chip diff --git a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h index 2740b6eb85e983..d6665f8fb2baba 100644 --- a/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h +++ b/src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.h @@ -27,6 +27,7 @@ #include #include +#include #include namespace chip { @@ -68,11 +69,14 @@ class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelega void OnCommissioningFailure(PeerId peerId, CHIP_ERROR error, CommissioningStage stageFailed, Optional additionalErrorInfo) override; void OnCommissioningStatusUpdate(PeerId peerId, CommissioningStage stageCompleted, CHIP_ERROR error) override; + void OnICDRegistrationComplete(ScopedNodeId deviceId, uint32_t icdCounter) override; + void OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t promisedActiveDuration) override; void OnFabricCheck(NodeId matchingNodeId) override; Callback::Callback * GetOpenWindowCallback(Controller::CommissioningWindowOpener * context); void OnOpenCommissioningWindow(NodeId deviceId, CHIP_ERROR status, SetupPayload payload); void SetExpectingPairingComplete(bool value) { expectingPairingComplete = value; } + void SetFabricIndex(FabricIndex fabricIndex) { mFabricIndex = fabricIndex; } private: DevicePairingDelegate_OnPairingCompleteFunct mOnPairingCompleteCallback = nullptr; @@ -84,7 +88,9 @@ class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelega DevicePairingDelegate_OnFabricCheckFunct mOnFabricCheckCallback = nullptr; Callback::Callback mOpenWindowCallback; Controller::CommissioningWindowOpener * mWindowOpener = nullptr; - bool expectingPairingComplete = false; + + bool expectingPairingComplete = false; + FabricIndex mFabricIndex = 0; }; } // namespace Controller diff --git a/src/controller/python/OpCredsBinding.cpp b/src/controller/python/OpCredsBinding.cpp index 5fd4205d4c7ce7..427ee9be46ba3c 100644 --- a/src/controller/python/OpCredsBinding.cpp +++ b/src/controller/python/OpCredsBinding.cpp @@ -26,6 +26,7 @@ #include "controller/python/chip/crypto/p256keypair.h" #include "controller/python/chip/interaction_model/Delegate.h" +#include #include #include #include @@ -104,6 +105,7 @@ class OperationalCredentialsAdapter : public OperationalCredentialsDelegate extern chip::Credentials::GroupDataProviderImpl sGroupDataProvider; extern chip::Controller::ScriptDevicePairingDelegate sPairingDelegate; +extern chip::app::DefaultICDClientStorage sICDClientStorage; class TestCommissioner : public chip::Controller::AutoCommissioner { @@ -569,6 +571,9 @@ PyChipError pychip_OpCreds_AllocateController(OpCredsContext * context, chip::Co chip::Credentials::SetSingleIpkEpochKey(&sGroupDataProvider, devCtrl->GetFabricIndex(), defaultIpk, compressedFabricIdSpan); VerifyOrReturnError(err == CHIP_NO_ERROR, ToPyChipError(err)); + sICDClientStorage.UpdateFabricList(devCtrl->GetFabricIndex()); + pairingDelegate->SetFabricIndex(devCtrl->GetFabricIndex()); + *outDevCtrl = devCtrl.release(); *outPairingDelegate = pairingDelegate.release(); diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 4fb8fb28bcaf90..2ba7c584db927b 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -35,11 +35,12 @@ import enum import json import logging +import secrets import threading import time import typing -from ctypes import (CDLL, CFUNCTYPE, POINTER, byref, c_bool, c_char, c_char_p, c_int, c_int32, c_size_t, c_uint8, c_uint16, - c_uint32, c_uint64, c_void_p, create_string_buffer, pointer, py_object, resize, string_at) +from ctypes import (CDLL, CFUNCTYPE, POINTER, Structure, byref, c_bool, c_char, c_char_p, c_int, c_int32, c_size_t, c_uint8, + c_uint16, c_uint32, c_uint64, c_void_p, create_string_buffer, pointer, py_object, resize, string_at) from dataclasses import dataclass import dacite @@ -98,6 +99,21 @@ class NOCChain: adminSubject: int +@dataclass +class ICDRegistrationParameters: + symmetricKey: typing.Optional[bytes] + checkInNodeId: typing.Optional[int] + monitoredSubject: typing.Optional[int] + stayActiveMs: typing.Optional[int] + + class CStruct(Structure): + _fields_ = [('symmetricKey', c_char_p), ('symmetricKeyLength', c_size_t), ('checkInNodeId', + c_uint64), ('monitoredSubject', c_uint64), ('stayActiveMsec', c_uint32)] + + def to_c(self): + return ICDRegistrationParameters.CStruct(self.symmetricKey, len(self.symmetricKey), self.checkInNodeId, self.monitoredSubject, self.stayActiveMs) + + @_DeviceAvailableCallbackFunct def _DeviceAvailableCallback(closure, device, err): closure.deviceAvailable(device, err) @@ -123,6 +139,77 @@ def _IssueNOCChainCallbackPythonCallback(devCtrl, status: PyChipError, noc: c_vo nocChain = NOCChain(nocBytes, icacBytes, rcacBytes, ipkBytes, adminSubject) devCtrl.NOCChainCallback(nocChain) + +# Methods for ICD +class ScopedNodeId(Structure): + _fields_ = [("nodeId", c_uint64), ("fabricIndex", c_uint8)] + + def __hash__(self): + return self.nodeId << 8 | self.fabricIndex + + def __str__(self): + return f"({self.fabricIndex}:{self.nodeId:16x})" + + def __eq__(self, other): + return self.nodeId == other.nodeId and self.fabricIndex == other.fabricIndex + + +_OnCheckInCompleteFunct = CFUNCTYPE(None, ScopedNodeId) + +_OnCheckInCompleteWaitListLock = threading.Lock() +_OnCheckInCompleteWaitList = dict() + + +@_OnCheckInCompleteFunct +def _OnCheckInComplete(scopedNodeId: ScopedNodeId): + callbacks = [] + with _OnCheckInCompleteWaitListLock: + callbacks = list(_OnCheckInCompleteWaitList.get(scopedNodeId, set())) + + for callback in callbacks: + callback(scopedNodeId) + + +def RegisterOnActiveCallback(scopedNodeId: ScopedNodeId, callback: typing.Callable[None, [ScopedNodeId]]): + ''' Registers a callback when the device with given (fabric index, node id) becomes active. + + Does nothing if the callback is already registered. + ''' + with _OnCheckInCompleteWaitListLock: + waitList = _OnCheckInCompleteWaitList.get(scopedNodeId, set()) + waitList.add(callback) + _OnCheckInCompleteWaitList[scopedNodeId] = waitList + + +def UnregisterOnActiveCallback(scopedNodeId: ScopedNodeId, callback: typing.Callable[None, [ScopedNodeId]]): + ''' Unregisters a callback when the device with given (fabric index, node id) becomes active. + + Does nothing if the callback has not been registered. + ''' + with _OnCheckInCompleteWaitListLock: + _OnCheckInCompleteWaitList.get(scopedNodeId, set()).remove(callback) + + +async def WaitForCheckIn(scopedNodeId: ScopedNodeId, timeoutSeconds: float): + ''' Waits for a device becomes active. + + Returns: + - A future, completes when the device becomes active. + ''' + eventLoop = asyncio.get_running_loop() + future = eventLoop.create_future() + + def OnCheckInCallback(nodeid): + eventLoop.call_soon_threadsafe(lambda: future.done() or future.set_result(None)) + + RegisterOnActiveCallback(scopedNodeId, OnCheckInCallback) + + try: + async with asyncio.timeout(timeoutSeconds): + await future + finally: + UnregisterOnActiveCallback(scopedNodeId, OnCheckInCallback) + # This is a fix for WEAV-429. Jay Logue recommends revisiting this at a later # date to allow for truly multiple instances so this is temporary. @@ -269,6 +356,7 @@ def HandleCommissioningComplete(nodeid, err): else: logging.warning("Failed to commission: {}".format(err)) + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters(False, None) self.state = DCState.IDLE self._ChipStack.callbackRes = err self._ChipStack.commissioningEventRes = err @@ -347,6 +435,7 @@ def HandlePASEEstablishmentComplete(err: PyChipError): self._isActive = True # Validate FabricID/NodeID followed from NOC Chain self._fabricId = self.GetFabricIdInternal() + self._fabricIndex = self.GetFabricIndexInternal() self._nodeId = self.GetNodeIdInternal() def _finish_init(self): @@ -766,6 +855,19 @@ def GetFabricIdInternal(self): return fabricid.value + def GetFabricIndexInternal(self): + """Get the fabric index from the object. Only used to validate cached value from property.""" + self.CheckIsActive() + + fabricindex = c_uint8(0) + + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_GetFabricIndex( + self.devCtrl, pointer(fabricindex)) + ).raise_on_error() + + return fabricindex.value + def GetNodeIdInternal(self) -> int: """Get the node ID from the object. Only used to validate cached value from property.""" self.CheckIsActive() @@ -841,6 +943,18 @@ def deviceAvailable(self, device, err): return DeviceProxyWrapper(returnDevice, self._dmLib) + async def WaitForActive(self, nodeid, *, timeoutSeconds=30.0, stayActiveDurationMs=30000): + ''' Waits a LIT ICD device to become active. Will send a StayActive command to the device on active to allow human operations. + + nodeId: Node ID of the LID ICD + stayActiveDurationMs: The duration in the StayActive command, in milliseconds + + Returns: + - StayActiveResponse on success + ''' + await WaitForCheckIn(ScopedNodeId(nodeid, self._fabricIndex), timeoutSeconds=timeoutSeconds) + return await self.SendCommand(nodeid, 0, Clusters.IcdManagement.Commands.StayActiveRequest(stayActiveDuration=stayActiveDurationMs)) + async def GetConnectedDevice(self, nodeid, allowPASE: bool = True, timeoutMs: int = None): ''' Gets an OperationalDeviceProxy or CommissioneeDeviceProxy for the specified Node. @@ -1536,6 +1650,11 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_SetCheckMatchingFabric.restype = PyChipError self._dmLib.pychip_DeviceController_SetCheckMatchingFabric.argtypes = [c_bool] + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters.restype = PyChipError + self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters.argtypes = [ + c_bool, c_void_p + ] + self._dmLib.pychip_DeviceController_ResetCommissioningParameters.restype = PyChipError self._dmLib.pychip_DeviceController_ResetCommissioningParameters.argtypes = [] @@ -1722,6 +1841,9 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_GetFabricId.argtypes = [c_void_p, POINTER(c_uint64)] self._dmLib.pychip_DeviceController_GetFabricId.restype = PyChipError + self._dmLib.pychip_DeviceController_GetFabricIndex.argtypes = [c_void_p, POINTER(c_uint8)] + self._dmLib.pychip_DeviceController_GetFabricIndex.restype = PyChipError + self._dmLib.pychip_DeviceController_GetLogFilter = [None] self._dmLib.pychip_DeviceController_GetLogFilter = c_uint8 @@ -1736,6 +1858,11 @@ def _InitLib(self): self._dmLib.pychip_DeviceController_SetIpk.argtypes = [c_void_p, POINTER(c_char), c_size_t] self._dmLib.pychip_DeviceController_SetIpk.restype = PyChipError + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback.restype = None + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback.argtypes = [_OnCheckInCompleteFunct] + + self._dmLib.pychip_CheckInDelegate_SetOnCheckInCompleteCallback(_OnCheckInComplete) + class ChipDeviceController(ChipDeviceControllerBase): ''' The ChipDeviceCommissioner binding, named as ChipDeviceController @@ -1884,6 +2011,38 @@ def SetCheckMatchingFabric(self, check: bool): lambda: self._dmLib.pychip_DeviceController_SetCheckMatchingFabric(check) ).raise_on_error() + def GenerateICDRegistrationParameters(self): + ''' Generates ICD registration parameters for this controller. ''' + return ICDRegistrationParameters( + secrets.token_bytes(16), + self._nodeId, + self._nodeId, + 30) + + def EnableICDRegistration(self, parameters: ICDRegistrationParameters): + ''' Enables ICD registration for the following commissioning session. + + Args: + parameters: A ICDRegistrationParameters for the parameters used for ICD registration, or None for default arguments. + ''' + if parameters is None: + raise ValueError("ICD registration parameter required.") + if len(parameters.symmetricKey) != 16: + raise ValueError("symmetricKey should be 16 bytes") + + self.CheckIsActive() + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters( + True, pointer(parameters.to_c())) + ).raise_on_error() + + def DisableICDRegistration(self): + ''' Disables ICD registration. ''' + self.CheckIsActive() + self._ChipStack.Call( + lambda: self._dmLib.pychip_DeviceController_SetIcdRegistrationParameters(False, None) + ).raise_on_error() + def GetFabricCheckResult(self) -> int: ''' Returns the fabric check result if SetCheckMatchingFabric was used.''' return self.fabricCheckNodeId diff --git a/src/controller/python/chip/ChipReplStartup.py b/src/controller/python/chip/ChipReplStartup.py index b75c77efcd5b2b..13a93a1efb453b 100644 --- a/src/controller/python/chip/ChipReplStartup.py +++ b/src/controller/python/chip/ChipReplStartup.py @@ -96,6 +96,8 @@ def main(): "-t", "--trust-store", help="Path to the PAA trust store.", action="store", default="./credentials/development/paa-root-certs") parser.add_argument( "-b", "--ble-adapter", help="Set the Bluetooth adapter index.", type=int, default=None) + parser.add_argument( + "-s", "--server-interactions", help="Enable server interactions.", action="store_true") args = parser.parse_args() if not os.path.exists(args.trust_store): @@ -139,7 +141,7 @@ def main(): ReplInit(args.debug) - chipStack = ChipStack(persistentStoragePath=args.storagepath, enableServerInteractions=False) + chipStack = ChipStack(persistentStoragePath=args.storagepath, enableServerInteractions=args.server_interactions) certificateAuthorityManager = chip.CertificateAuthority.CertificateAuthorityManager(chipStack, chipStack.GetStorageManager()) certificateAuthorityManager.LoadAuthoritiesFromStorage() diff --git a/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp b/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp new file mode 100644 index 00000000000000..03f6b7de1003e6 --- /dev/null +++ b/src/controller/python/chip/icd/PyChipCheckInDelegate.cpp @@ -0,0 +1,33 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "PyChipCheckInDelegate.h" + +using namespace ::chip; +using namespace ::chip::app; +using namespace ::chip::Controller; + +void PyChipCheckInDelegate::OnCheckInComplete(const ICDClientInfo & clientInfo) +{ + DefaultCheckInDelegate::OnCheckInComplete(clientInfo); + + if (mCallback != nullptr) + { + mCallback(clientInfo.peer_node); + } +} diff --git a/src/controller/python/chip/icd/PyChipCheckInDelegate.h b/src/controller/python/chip/icd/PyChipCheckInDelegate.h new file mode 100644 index 00000000000000..3e3a3d9871af24 --- /dev/null +++ b/src/controller/python/chip/icd/PyChipCheckInDelegate.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include + +namespace chip { +namespace Controller { + +class PyChipCheckInDelegate : public chip::app::DefaultCheckInDelegate +{ +public: + using OnCheckInCompleteCallback = void(chip::ScopedNodeId); + + virtual ~PyChipCheckInDelegate() = default; + + void OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) override; + + void SetOnCheckInCompleteCallback(OnCheckInCompleteCallback * callback) { mCallback = callback; } + +private: + OnCheckInCompleteCallback * mCallback; +}; + +} // namespace Controller +} // namespace chip diff --git a/src/controller/python/chip/internal/types.py b/src/controller/python/chip/internal/types.py index 190456969b2006..34c14737a47ff7 100644 --- a/src/controller/python/chip/internal/types.py +++ b/src/controller/python/chip/internal/types.py @@ -14,7 +14,7 @@ # limitations under the License. # -from ctypes import CFUNCTYPE, c_size_t, c_uint32, c_void_p +from ctypes import CFUNCTYPE, Structure, c_size_t, c_uint32, c_uint64, c_void_p # General callback of 'network credentials requested. No python-data # is available as the underlying callback is used internally @@ -26,3 +26,7 @@ # Notification that pairing has been coompleted PairingComplete = CFUNCTYPE(None, c_uint32) + + +class ScopedNodeId(Structure): + _fields_ = [("node_id", c_uint64), ("fabric_index", "c_uint8")] From 405a083d1235e84e033de269d4bddbcf0a472b9a Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 5 Jun 2024 04:36:01 +0900 Subject: [PATCH 07/78] Add Compare IPAddress in OndiscoveredNode (#33583) * Add Compare IPAddress in discoveredNode * Restyled by clang-format * Fix function name, pointer -> array * Restyled by clang-format * Modify from comment * Restyled by clang-format * Update from comments * Update src/controller/AbstractDnssdDiscoveryController.cpp Co-authored-by: Andrei Litvin --------- Co-authored-by: Restyled.io Co-authored-by: yunhanw-google Co-authored-by: Andrei Litvin --- .../AbstractDnssdDiscoveryController.cpp | 33 +++++- .../TestCommissionableNodeController.cpp | 101 ++++++++++++++++++ 2 files changed, 131 insertions(+), 3 deletions(-) diff --git a/src/controller/AbstractDnssdDiscoveryController.cpp b/src/controller/AbstractDnssdDiscoveryController.cpp index 3d3ca4c8097955..9d59e2dfdbca03 100644 --- a/src/controller/AbstractDnssdDiscoveryController.cpp +++ b/src/controller/AbstractDnssdDiscoveryController.cpp @@ -22,9 +22,36 @@ #include #include +#include + namespace chip { namespace Controller { +static bool SameExceptOrder(const chip::Span & v1, const chip::Span & v2) +{ + std::bitset addressUsed; + + VerifyOrDie(v1.size() <= Dnssd::CommissionNodeData::kMaxIPAddresses && v2.size() <= Dnssd::CommissionNodeData::kMaxIPAddresses); + if (v1.size() != v2.size()) + { + return false; + } + + for (size_t s = 0; s < v1.size(); s++) + { + for (size_t d = 0; d < v2.size(); d++) + { + if (!addressUsed[d] && v1[s] == v2[d]) + { + // Change the used flag so that the compared target is no longer used + addressUsed.set(d, true); + break; + } + } + } + return addressUsed.count() == v2.size(); +} + void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & discNodeData) { VerifyOrReturn(discNodeData.Is()); @@ -38,10 +65,10 @@ void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::Disco { continue; } - // TODO(#32576) Check if IP address are the same. Must account for `numIPs` in the list of `ipAddress`. - // Additionally, must NOT assume that the ordering is consistent. + chip::Span discoveredNodeIPAddressSpan(&discoveredNode.ipAddress[0], discoveredNode.numIPs); + chip::Span nodeDataIPAddressSpan(&nodeData.ipAddress[0], nodeData.numIPs); if (strcmp(discoveredNode.hostName, nodeData.hostName) == 0 && discoveredNode.port == nodeData.port && - discoveredNode.numIPs == nodeData.numIPs) + SameExceptOrder(discoveredNodeIPAddressSpan, nodeDataIPAddressSpan)) { discoveredNode = nodeData; if (mDeviceDiscoveryDelegate != nullptr) diff --git a/src/controller/tests/TestCommissionableNodeController.cpp b/src/controller/tests/TestCommissionableNodeController.cpp index b68d0748d62c42..6d9ef65db11e97 100644 --- a/src/controller/tests/TestCommissionableNodeController.cpp +++ b/src/controller/tests/TestCommissionableNodeController.cpp @@ -182,4 +182,105 @@ TEST_F(TestCommissionableNodeController, TestDiscoverCommissioners_DiscoverCommi EXPECT_NE(controller.DiscoverCommissioners(), CHIP_NO_ERROR); } +TEST_F(TestCommissionableNodeController, TestGetDiscoveredCommissioner_MultipleIPAddressDiscover) +{ + MockResolver resolver; + CommissionableNodeController controller(&resolver); + + // example 1 + chip::Dnssd::DiscoveredNodeData discNodeData1; + discNodeData1.Set(); + chip::Dnssd::CommissionNodeData & inNodeData1 = discNodeData1.Get(); + Platform::CopyString(inNodeData1.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData1.ipAddress[0]); + inNodeData1.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData1.ipAddress[1]); + inNodeData1.numIPs++; + inNodeData1.port = 5540; + + controller.OnNodeDiscovered(discNodeData1); + + // example 5 - exactly same as example 1 + chip::Dnssd::DiscoveredNodeData discNodeData5; + discNodeData5.Set(); + chip::Dnssd::CommissionNodeData & inNodeData5 = discNodeData5.Get(); + Platform::CopyString(inNodeData1.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData5.ipAddress[0]); + inNodeData5.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData5.ipAddress[1]); + inNodeData5.numIPs++; + inNodeData5.port = 5540; + + controller.OnNodeDiscovered(discNodeData5); + + // example 2 - same as example 1 (IPAdress sequence is only different.) + chip::Dnssd::DiscoveredNodeData discNodeData2; + discNodeData2.Set(); + chip::Dnssd::CommissionNodeData & inNodeData2 = discNodeData2.Get(); + Platform::CopyString(inNodeData2.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:5555", inNodeData2.ipAddress[0]); + inNodeData2.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData2.ipAddress[1]); + inNodeData2.numIPs++; + inNodeData2.port = 5540; + + controller.OnNodeDiscovered(discNodeData2); + + // example 3 - different example + chip::Dnssd::DiscoveredNodeData discNodeData3; + discNodeData3.Set(); + chip::Dnssd::CommissionNodeData & inNodeData3 = discNodeData3.Get(); + Platform::CopyString(inNodeData3.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData3.ipAddress[0]); + inNodeData3.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:6666", inNodeData3.ipAddress[1]); + inNodeData3.numIPs++; + inNodeData3.port = 5540; + + controller.OnNodeDiscovered(discNodeData3); + + // example 4 - different example (Different IP count) + chip::Dnssd::DiscoveredNodeData discNodeData4; + discNodeData4.Set(); + chip::Dnssd::CommissionNodeData & inNodeData4 = discNodeData4.Get(); + Platform::CopyString(inNodeData4.hostName, "mockHostName"); + Inet::IPAddress::FromString("fd11:1111:1122:2222:1111:2222:3333:4444", inNodeData4.ipAddress[0]); + inNodeData4.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:6666", inNodeData4.ipAddress[1]); + inNodeData4.numIPs++; + Inet::IPAddress::FromString("fd11:1111:1122:2222:2222:3333:4444:7777", inNodeData4.ipAddress[2]); + inNodeData4.numIPs++; + inNodeData4.port = 5540; + + controller.OnNodeDiscovered(discNodeData4); + + // Example 2 result - example 1 is removed. (reason : duplicate) + ASSERT_NE(controller.GetDiscoveredCommissioner(0), nullptr); + EXPECT_STREQ(inNodeData1.hostName, controller.GetDiscoveredCommissioner(0)->hostName); + EXPECT_EQ(inNodeData2.ipAddress[0], controller.GetDiscoveredCommissioner(0)->ipAddress[0]); + EXPECT_EQ(inNodeData2.ipAddress[1], controller.GetDiscoveredCommissioner(0)->ipAddress[1]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(0)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(0)->numIPs, 2u); + + // Example 3 result + ASSERT_NE(controller.GetDiscoveredCommissioner(1), nullptr); + EXPECT_STREQ(inNodeData3.hostName, controller.GetDiscoveredCommissioner(1)->hostName); + EXPECT_EQ(inNodeData3.ipAddress[0], controller.GetDiscoveredCommissioner(1)->ipAddress[0]); + EXPECT_EQ(inNodeData3.ipAddress[1], controller.GetDiscoveredCommissioner(1)->ipAddress[1]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(1)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(1)->numIPs, 2u); + + // Example 4 result + ASSERT_NE(controller.GetDiscoveredCommissioner(2), nullptr); + EXPECT_STREQ(inNodeData4.hostName, controller.GetDiscoveredCommissioner(2)->hostName); + EXPECT_EQ(inNodeData4.ipAddress[0], controller.GetDiscoveredCommissioner(2)->ipAddress[0]); + EXPECT_EQ(inNodeData4.ipAddress[1], controller.GetDiscoveredCommissioner(2)->ipAddress[1]); + EXPECT_EQ(inNodeData4.ipAddress[2], controller.GetDiscoveredCommissioner(2)->ipAddress[2]); + EXPECT_EQ(controller.GetDiscoveredCommissioner(2)->port, 5540); + EXPECT_EQ(controller.GetDiscoveredCommissioner(2)->numIPs, 3u); + + // Total is 3. (Not 4) + ASSERT_EQ(controller.GetDiscoveredCommissioner(3), nullptr); +} + } // namespace From ef280569ad8c60ee1a58acba4a090479cce3bd0b Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Tue, 4 Jun 2024 12:51:33 -0700 Subject: [PATCH 08/78] [chip-tool][ICD] Store ICDClientInfo when running icd registration independently (#33690) * Store ICDClientInfo when running icd registration independently * Restyled by clang-format * address comments --------- Co-authored-by: Restyled.io --- .../commands/clusters/ClusterCommand.h | 39 +++++++++++++++++-- .../commands/clusters/ModelCommand.cpp | 18 ++++++++- .../commands/clusters/ModelCommand.h | 4 +- .../commands/clusters/ModelCommand.cpp | 7 +++- 4 files changed, 61 insertions(+), 7 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index 171c664481c9dd..fe20f4f36b9f84 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -18,10 +18,9 @@ #pragma once -#include - #include "DataModelLogger.h" #include "ModelCommand.h" +#include class ClusterCommand : public InteractionModelCommands, public ModelCommand, public chip::app::CommandSender::Callback { @@ -64,6 +63,17 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return CHIP_NO_ERROR; } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, + chip::CommandId commandId, + const chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type & value) + { + ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value)); + mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID, device->GetSecureSession().Value()->GetFabricIndex()); + mMonitoredSubject = value.monitoredSubject; + memcpy(mICDSymmetricKey, value.key.data(), value.key.size()); + return CHIP_NO_ERROR; + } + CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::CommandId commandId, const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value) @@ -117,11 +127,32 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub mError = error; return; } + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && + (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id)) + { + chip::TLV::TLVReader counterTlvReader; + counterTlvReader.Init(*data); + chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; + CHIP_ERROR err = chip::app::DataModel::Decode(counterTlvReader, value); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format()); + return; + } + + chip::app::ICDClientInfo clientInfo; + clientInfo.peer_node = mScopedNodeId; + clientInfo.monitored_subject = mMonitoredSubject; + clientInfo.start_icd_counter = value.ICDCounter; + + StoreICDEntryWithKey(clientInfo, chip::ByteSpan(mICDSymmetricKey)); + } } + if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id)) { - ModelCommand::ClearICDEntry(mScopedNodeId); + ClearICDEntry(mScopedNodeId); } } @@ -223,6 +254,8 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub chip::ClusterId mClusterId; chip::CommandId mCommandId; chip::ScopedNodeId mScopedNodeId; + uint64_t mMonitoredSubject = static_cast(0); + uint8_t mICDSymmetricKey[chip::Crypto::kAES_CCM128_Key_Length]; CHIP_ERROR mError = CHIP_NO_ERROR; CustomArgument mPayload; }; diff --git a/examples/chip-tool/commands/clusters/ModelCommand.cpp b/examples/chip-tool/commands/clusters/ModelCommand.cpp index 2a549e62d4668b..b2e3b5616703a4 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.cpp +++ b/examples/chip-tool/commands/clusters/ModelCommand.cpp @@ -76,7 +76,7 @@ void ModelCommand::Shutdown() CHIPCommand::Shutdown(); } -void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +void ModelCommand::ClearICDEntry(const ScopedNodeId & nodeId) { CHIP_ERROR deleteEntryError = CHIPCommand::sICDClientStorage.DeleteEntry(nodeId); if (deleteEntryError != CHIP_NO_ERROR) @@ -85,6 +85,22 @@ void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) } } +void ModelCommand::StoreICDEntryWithKey(app::ICDClientInfo & clientInfo, ByteSpan key) +{ + CHIP_ERROR err = CHIPCommand::sICDClientStorage.SetKey(clientInfo, key); + if (err == CHIP_NO_ERROR) + { + err = CHIPCommand::sICDClientStorage.StoreEntry(clientInfo); + } + + if (err != CHIP_NO_ERROR) + { + CHIPCommand::sICDClientStorage.RemoveKey(clientInfo); + ChipLogError(chipTool, "Failed to persist symmetric key with error: %" CHIP_ERROR_FORMAT, err.Format()); + return; + } +} + void ModelCommand::CheckPeerICDType() { if (mIsPeerLIT.HasValue()) diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index 79c31cf865930d..635c03a2ebdf7c 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -67,8 +67,8 @@ class ModelCommand : public CHIPCommand virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; }; - virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId); - + void ClearICDEntry(const chip::ScopedNodeId & nodeId); + void StoreICDEntryWithKey(chip::app::ICDClientInfo & clientinfo, chip::ByteSpan key); void Shutdown() override; protected: diff --git a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp index dafa11f2381fed..e2d01e55d80506 100644 --- a/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp +++ b/examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp @@ -82,11 +82,16 @@ void ModelCommand::Shutdown() mOnDeviceConnectionFailureCallback.Cancel(); } -void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId) +void ModelCommand::ClearICDEntry(const ScopedNodeId & nodeId) { ChipLogError(chipTool, "ClearICDEntry is not implemented in tv-casting-app"); } +void ModelCommand::StoreICDEntryWithKey(app::ICDClientInfo & clientinfo, ByteSpan key) +{ + ChipLogError(chipTool, "StoreICDEntryWithKey is not implemented in tv-casting-app"); +} + bool ModelCommand::IsPeerLIT() { // Does not support tv-casting-app From a2dddd128c809ca692a69a79064b95a48bf7f559 Mon Sep 17 00:00:00 2001 From: paulr34 <64710345+paulr34@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:09:48 -0400 Subject: [PATCH 09/78] marking signed types as signed for ZAP to consume (#33719) --- .../zcl/data-model/chip/chip-types.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index cae3f4a87df8c0..77fcb4df6b4fe1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -37,14 +37,14 @@ limitations under the License. - - - - - - - - + + + + + + + + From 3a3b6edba6361014b3bf398f8ea99bb4b33fb930 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 4 Jun 2024 15:45:33 -0700 Subject: [PATCH 10/78] [Fabric-Sync] Add the IPC support between Fabric_Admin and Fabric_Bridge (#33603) * Add the RPC support between Fabric_Admin and Fabric_Bridge * Add bridge_enable_pw_rpc build flag * Address review comments * Add RpcClientProcessor * Update API comments --- examples/common/pigweed/BUILD.gn | 14 ++ .../pigweed/protos/fabric_admin_service.proto | 20 +++ .../protos/fabric_bridge_service.proto | 15 +++ .../common/pigweed/rpc_console/py/BUILD.gn | 2 + .../rpc_console/py/chip_rpc/console.py | 4 + .../common/pigweed/rpc_services/FabricAdmin.h | 44 +++++++ .../pigweed/rpc_services/FabricBridge.h | 44 +++++++ examples/fabric-admin/BUILD.gn | 47 +++++++ .../commands/fabric-sync/Commands.h | 33 +++++ .../fabric-sync/FabricSyncCommand.cpp | 45 +++++++ .../commands/fabric-sync/FabricSyncCommand.h | 40 ++++++ .../interactive/InteractiveCommands.cpp | 41 +++++- examples/fabric-admin/main.cpp | 18 +++ examples/fabric-admin/rpc/RpcClient.cpp | 89 +++++++++++++ examples/fabric-admin/rpc/RpcClient.h | 48 +++++++ examples/fabric-admin/rpc/RpcServer.cpp | 70 ++++++++++ examples/fabric-admin/rpc/RpcServer.h | 23 ++++ examples/fabric-admin/with_pw_rpc.gni | 42 ++++++ examples/fabric-bridge-app/linux/BUILD.gn | 51 +++++++ .../fabric-bridge-app/linux/RpcClient.cpp | 88 +++++++++++++ .../fabric-bridge-app/linux/RpcServer.cpp | 68 ++++++++++ .../linux/include/RpcClient.h | 44 +++++++ .../linux/include/RpcServer.h | 23 ++++ examples/fabric-bridge-app/linux/main.cpp | 41 +++++- .../fabric-bridge-app/linux/with_pw_rpc.gni | 42 ++++++ .../platform/linux/RpcClientProcessor.cpp | 124 ++++++++++++++++++ examples/platform/linux/RpcClientProcessor.h | 36 +++++ 27 files changed, 1149 insertions(+), 7 deletions(-) create mode 100644 examples/common/pigweed/protos/fabric_admin_service.proto create mode 100644 examples/common/pigweed/protos/fabric_bridge_service.proto create mode 100644 examples/common/pigweed/rpc_services/FabricAdmin.h create mode 100644 examples/common/pigweed/rpc_services/FabricBridge.h create mode 100644 examples/fabric-admin/commands/fabric-sync/Commands.h create mode 100644 examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp create mode 100644 examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h create mode 100644 examples/fabric-admin/rpc/RpcClient.cpp create mode 100644 examples/fabric-admin/rpc/RpcClient.h create mode 100644 examples/fabric-admin/rpc/RpcServer.cpp create mode 100644 examples/fabric-admin/rpc/RpcServer.h create mode 100644 examples/fabric-admin/with_pw_rpc.gni create mode 100644 examples/fabric-bridge-app/linux/RpcClient.cpp create mode 100644 examples/fabric-bridge-app/linux/RpcServer.cpp create mode 100644 examples/fabric-bridge-app/linux/include/RpcClient.h create mode 100644 examples/fabric-bridge-app/linux/include/RpcServer.h create mode 100644 examples/fabric-bridge-app/linux/with_pw_rpc.gni create mode 100644 examples/platform/linux/RpcClientProcessor.cpp create mode 100644 examples/platform/linux/RpcClientProcessor.h diff --git a/examples/common/pigweed/BUILD.gn b/examples/common/pigweed/BUILD.gn index c0178e419a1d5d..e523bea380c03f 100644 --- a/examples/common/pigweed/BUILD.gn +++ b/examples/common/pigweed/BUILD.gn @@ -80,6 +80,20 @@ pw_proto_library("button_service") { prefix = "button_service" } +pw_proto_library("fabric_admin_service") { + sources = [ "protos/fabric_admin_service.proto" ] + deps = [ "$dir_pw_protobuf:common_protos" ] + strip_prefix = "protos" + prefix = "fabric_admin_service" +} + +pw_proto_library("fabric_bridge_service") { + sources = [ "protos/fabric_bridge_service.proto" ] + deps = [ "$dir_pw_protobuf:common_protos" ] + strip_prefix = "protos" + prefix = "fabric_bridge_service" +} + pw_proto_library("lighting_service") { sources = [ "protos/lighting_service.proto" ] deps = [ "$dir_pw_protobuf:common_protos" ] diff --git a/examples/common/pigweed/protos/fabric_admin_service.proto b/examples/common/pigweed/protos/fabric_admin_service.proto new file mode 100644 index 00000000000000..e52fd2951ac0d7 --- /dev/null +++ b/examples/common/pigweed/protos/fabric_admin_service.proto @@ -0,0 +1,20 @@ +syntax = "proto3"; + +import 'pw_protobuf_protos/common.proto'; + +package chip.rpc; + +// Define the message for a synchronized end device with necessary fields +message DeviceInfo { + uint64 node_id = 1; +} + +// Define the response message to convey the status of the operation +message OperationStatus { + bool success = 1; +} + +service FabricAdmin { + rpc OpenCommissioningWindow(DeviceInfo) returns (OperationStatus){} +} + diff --git a/examples/common/pigweed/protos/fabric_bridge_service.proto b/examples/common/pigweed/protos/fabric_bridge_service.proto new file mode 100644 index 00000000000000..5bd4f8efd779e7 --- /dev/null +++ b/examples/common/pigweed/protos/fabric_bridge_service.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +import 'pw_protobuf_protos/common.proto'; + +package chip.rpc; + +// Define the message for a synchronized end device with necessary fields +message SynchronizedDevice { + uint64 node_id = 1; +} + +service FabricBridge { + rpc AddSynchronizedDevice(SynchronizedDevice) returns (pw.protobuf.Empty){} +} + diff --git a/examples/common/pigweed/rpc_console/py/BUILD.gn b/examples/common/pigweed/rpc_console/py/BUILD.gn index a03dc980872739..db9f22fe45fff9 100644 --- a/examples/common/pigweed/rpc_console/py/BUILD.gn +++ b/examples/common/pigweed/rpc_console/py/BUILD.gn @@ -46,6 +46,8 @@ pw_python_package("chip_rpc") { "${chip_root}/examples/common/pigweed:descriptor_service.python", "${chip_root}/examples/common/pigweed:device_service.python", "${chip_root}/examples/common/pigweed:echo_service.python", + "${chip_root}/examples/common/pigweed:fabric_admin_service.python", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.python", "${chip_root}/examples/common/pigweed:lighting_service.python", "${chip_root}/examples/common/pigweed:locking_service.python", "${chip_root}/examples/common/pigweed:ot_cli_service.python", diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 1591722bfdbeab..50f0b030f51725 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -53,6 +53,8 @@ from descriptor_service import descriptor_service_pb2 from device_service import device_service_pb2 from echo_service import echo_pb2 +from fabric_admin_service import fabric_admin_service_pb2 +from fabric_bridge_service import fabric_bridge_service_pb2 from lighting_service import lighting_service_pb2 from locking_service import locking_service_pb2 from ot_cli_service import ot_cli_service_pb2 @@ -136,6 +138,8 @@ def show_console(device: str, baudrate: int, descriptor_service_pb2, device_service_pb2, echo_pb2, + fabric_admin_service_pb2, + fabric_bridge_service_pb2, lighting_service_pb2, locking_service_pb2, ot_cli_service_pb2, diff --git a/examples/common/pigweed/rpc_services/FabricAdmin.h b/examples/common/pigweed/rpc_services/FabricAdmin.h new file mode 100644 index 00000000000000..5254b9e9054a0c --- /dev/null +++ b/examples/common/pigweed/rpc_services/FabricAdmin.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include "app/util/attribute-storage.h" +#include "fabric_admin_service/fabric_admin_service.rpc.pb.h" +#include "pigweed/rpc_services/internal/StatusUtils.h" +#include +#include +#include +#include + +namespace chip { +namespace rpc { + +class FabricAdmin : public pw_rpc::nanopb::FabricAdmin::Service +{ +public: + virtual ~FabricAdmin() = default; + + virtual pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) + { + return pw::Status::Unimplemented(); + } +}; + +} // namespace rpc +} // namespace chip diff --git a/examples/common/pigweed/rpc_services/FabricBridge.h b/examples/common/pigweed/rpc_services/FabricBridge.h new file mode 100644 index 00000000000000..bce32ebd3d99b2 --- /dev/null +++ b/examples/common/pigweed/rpc_services/FabricBridge.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include "app/util/attribute-storage.h" +#include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" +#include "pigweed/rpc_services/internal/StatusUtils.h" +#include +#include +#include +#include + +namespace chip { +namespace rpc { + +class FabricBridge : public pw_rpc::nanopb::FabricBridge::Service +{ +public: + virtual ~FabricBridge() = default; + + virtual pw::Status AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) + { + return pw::Status::Unimplemented(); + } +}; + +} // namespace rpc +} // namespace chip diff --git a/examples/fabric-admin/BUILD.gn b/examples/fabric-admin/BUILD.gn index ddaa33483257b1..ad7eb217f9914c 100644 --- a/examples/fabric-admin/BUILD.gn +++ b/examples/fabric-admin/BUILD.gn @@ -22,10 +22,18 @@ import("${chip_root}/src/lib/core/core.gni") assert(chip_build_tools) +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") +} + config("config") { include_dirs = [ ".", "${chip_root}/examples/common", + "${chip_root}/examples/platform/linux", "${chip_root}/zzz_generated/app-common/app-common", "${chip_root}/zzz_generated/chip-tool", "${chip_root}/src/lib", @@ -39,6 +47,10 @@ config("config") { } cflags = [ "-Wconversion" ] + + if (chip_enable_pw_rpc) { + defines += [ "PW_RPC_ENABLED" ] + } } static_library("fabric-admin-utils") { @@ -59,6 +71,7 @@ static_library("fabric-admin-utils") { "commands/common/HexConversion.h", "commands/common/RemoteDataModelLogger.cpp", "commands/common/RemoteDataModelLogger.h", + "commands/fabric-sync/FabricSyncCommand.cpp", "commands/pairing/OpenCommissioningWindowCommand.cpp", "commands/pairing/OpenCommissioningWindowCommand.h", "commands/pairing/PairingCommand.cpp", @@ -95,6 +108,40 @@ static_library("fabric-admin-utils") { public_configs = [ ":config" ] + if (chip_enable_pw_rpc) { + defines = [ + "PW_RPC_FABRIC_ADMIN_SERVICE=1", + "PW_RPC_FABRIC_BRIDGE_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/platform/linux/RpcClientProcessor.cpp", + "${chip_root}/examples/platform/linux/RpcClientProcessor.h", + "${chip_root}/examples/platform/linux/system_rpc_server.cc", + "rpc/RpcClient.cpp", + "rpc/RpcClient.h", + "rpc/RpcServer.cpp", + "rpc/RpcServer.h", + ] + + deps += [ + "$dir_pw_hdlc:default_addresses", + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_log", + "$dir_pw_rpc:server", + "$dir_pw_rpc/system_server:facade", + "$dir_pw_rpc/system_server:socket", + "$dir_pw_stream:socket_stream", + "$dir_pw_sync:mutex", + "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:fabric_admin_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:rpc_services", + ] + + deps += pw_build_LINK_DEPS + } + if (chip_enable_transport_trace) { public_deps += [ "${chip_root}/examples/common/tracing:trace_handlers_decoder" ] diff --git a/examples/fabric-admin/commands/fabric-sync/Commands.h b/examples/fabric-admin/commands/fabric-sync/Commands.h new file mode 100644 index 00000000000000..f2be577065b617 --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/Commands.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 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. + * + */ + +#pragma once + +#include +#include + +void registerCommandsFabricSync(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + const char * clusterName = "FabricSync"; + + commands_list clusterCommands = { + make_unique(credsIssuerConfig), + }; + + commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for fabric synchronization."); +} diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp new file mode 100644 index 00000000000000..c2a1b5df8fb80e --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 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. + * + */ + +#include "FabricSyncCommand.h" +#include +#include +#include + +#if defined(PW_RPC_ENABLED) +#include "pw_assert/check.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +#include +#endif + +using namespace ::chip; + +CHIP_ERROR FabricSyncAddDeviceCommand::RunCommand(NodeId remoteId) +{ +#if defined(PW_RPC_ENABLED) + AddSynchronizedDevice(remoteId); + return CHIP_NO_ERROR; +#else + return CHIP_ERROR_NOT_IMPLEMENTED; +#endif +} diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h new file mode 100644 index 00000000000000..cf739ccfb3a520 --- /dev/null +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 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. + * + */ + +#pragma once + +#include + +class FabricSyncAddDeviceCommand : public CHIPCommand +{ +public: + FabricSyncAddDeviceCommand(CredentialIssuerCommands * credIssuerCommands) : CHIPCommand("add-device", credIssuerCommands) + { + AddArgument("nodeid", 0, UINT64_MAX, &mNodeId); + } + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override { return RunCommand(mNodeId); } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(1); } + +private: + chip::NodeId mNodeId; + + CHIP_ERROR RunCommand(NodeId remoteId); +}; diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index aaf3c36461cffb..c5c844256f5351 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -28,11 +28,18 @@ #include #include +#if defined(PW_RPC_ENABLED) +#include +#endif + +using namespace chip; + +namespace { + constexpr char kInteractiveModePrompt[] = ">>> "; constexpr char kInteractiveModeHistoryFileName[] = "chip_tool_history"; constexpr char kInteractiveModeStopCommand[] = "quit()"; - -namespace { +constexpr uint16_t kRetryIntervalS = 5; // File pointer for the log file FILE * sLogFile = nullptr; @@ -67,7 +74,7 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, return; } - uint64_t timeMs = chip::System::SystemClock().GetMonotonicMilliseconds64().count(); + uint64_t timeMs = System::SystemClock().GetMonotonicMilliseconds64().count(); uint64_t seconds = timeMs / 1000; uint64_t milliseconds = timeMs % 1000; @@ -82,6 +89,26 @@ void ENFORCE_FORMAT(3, 0) LoggingCallback(const char * module, uint8_t category, funlockfile(sLogFile); } +#if defined(PW_RPC_ENABLED) +void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) +{ + if (InitRpcClient(kFabricBridgeServerPort) == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Connected to Fabric-Bridge"); + } + else + { + ChipLogError(NotSpecified, "Failed to connect to Fabric-Bridge, retry in %d seconds....", kRetryIntervalS); + systemLayer->StartTimer(System::Clock::Seconds16(kRetryIntervalS), AttemptRpcClientConnect, nullptr); + } +} + +void ExecuteDeferredConnect(intptr_t ignored) +{ + AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr); +} +#endif + } // namespace char * InteractiveStartCommand::GetCommand(char * command) @@ -134,9 +161,13 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() OpenLogFile(mLogFilePath.Value()); // Redirect logs to the custom logging callback - chip::Logging::SetLogRedirectCallback(LoggingCallback); + Logging::SetLogRedirectCallback(LoggingCallback); } +#if defined(PW_RPC_ENABLED) + DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0); +#endif + char * command = nullptr; int status; while (true) @@ -167,7 +198,7 @@ bool InteractiveCommand::ParseCommand(char * command, int * status) // If scheduling the cleanup fails, there is not much we can do. // But if something went wrong while the application is leaving it could be because things have // not been cleaned up properly, so it is still useful to log the failure. - LogErrorOnFailure(chip::DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredCleanups, 0)); + LogErrorOnFailure(DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredCleanups, 0)); return false; } diff --git a/examples/fabric-admin/main.cpp b/examples/fabric-admin/main.cpp index a1002d83170d5b..f5f98cc0d960db 100644 --- a/examples/fabric-admin/main.cpp +++ b/examples/fabric-admin/main.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -26,6 +27,20 @@ #include #include +#if defined(PW_RPC_ENABLED) +#include +#endif + +using namespace chip; + +void ApplicationInit() +{ +#if defined(PW_RPC_ENABLED) + InitRpcServer(kFabricAdminServerPort); + ChipLogProgress(NotSpecified, "PW_RPC initialized."); +#endif +} + // ================================================================================ // Main Code // ================================================================================ @@ -45,6 +60,7 @@ int main(int argc, char * argv[]) ExampleCredentialIssuerCommands credIssuerCommands; Commands commands; + registerCommandsFabricSync(commands, &credIssuerCommands); registerCommandsInteractive(commands, &credIssuerCommands); registerCommandsPairing(commands, &credIssuerCommands); registerClusters(commands, &credIssuerCommands); @@ -56,5 +72,7 @@ int main(int argc, char * argv[]) c_args.push_back(const_cast(arg.c_str())); } + ApplicationInit(); + return commands.Run(static_cast(c_args.size()), c_args.data()); } diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp new file mode 100644 index 00000000000000..a1a34d309ba17a --- /dev/null +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "RpcClient.h" +#include "RpcClientProcessor.h" + +#include +#include +#include + +#include "fabric_bridge_service/fabric_bridge_service.rpc.pb.h" +#include "pw_assert/check.h" +#include "pw_function/function.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +using namespace chip; + +namespace { + +// Constants +constexpr uint32_t kDefaultChannelId = 1; + +// Fabric Bridge Client +rpc::pw_rpc::nanopb::FabricBridge::Client fabricBridgeClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); +pw::rpc::NanopbUnaryReceiver<::pw_protobuf_Empty> addSynchronizedDeviceCall; + +// Callback function to be called when the RPC response is received +void OnAddDeviceResponseCompleted(const pw_protobuf_Empty & response, pw::Status status) +{ + if (status.ok()) + { + ChipLogProgress(NotSpecified, "AddSynchronizedDevice RPC call succeeded!"); + } + else + { + ChipLogProgress(NotSpecified, "AddSynchronizedDevice RPC call failed with status: %d\n", status.code()); + } +} + +} // namespace + +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) +{ + rpc::client::SetRpcServerPort(rpcServerPort); + return rpc::client::StartPacketProcessing(); +} + +CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId) +{ + ChipLogProgress(NotSpecified, "AddSynchronizedDevice"); + + if (addSynchronizedDeviceCall.active()) + { + ChipLogError(NotSpecified, "OpenCommissioningWindow is in progress\n"); + return CHIP_ERROR_BUSY; + } + + chip_rpc_SynchronizedDevice device; + device.node_id = nodeId; + + // The RPC will remain active as long as `addSynchronizedDeviceCall` is alive. + addSynchronizedDeviceCall = fabricBridgeClient.AddSynchronizedDevice(device, OnAddDeviceResponseCompleted); + + if (!addSynchronizedDeviceCall.active()) + { + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} diff --git a/examples/fabric-admin/rpc/RpcClient.h b/examples/fabric-admin/rpc/RpcClient.h new file mode 100644 index 00000000000000..efe3c24acc3b23 --- /dev/null +++ b/examples/fabric-admin/rpc/RpcClient.h @@ -0,0 +1,48 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include + +constexpr uint16_t kFabricBridgeServerPort = 33002; + +/** + * @brief Initializes the RPC client with the specified server port. + * + * This function sets the RPC server port and starts packet processing for the RPC client. + * + * @param rpcServerPort The port number on which the RPC server is running. + * @return CHIP_NO_ERROR on successful initialization, or an appropriate CHIP_ERROR on failure. + */ +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); + +/** + * @brief Adds a synchronized device to the RPC client. + * + * This function attempts to add a device identified by its `nodeId` to the synchronized device list. + * It logs the progress and checks if an `OpenCommissioningWindow` operation is already in progress. + * If an operation is in progress, it returns `CHIP_ERROR_BUSY`. + * + * @param nodeId The Node ID of the device to be added. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_BUSY: Another operation is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred while activating the RPC call. + */ +CHIP_ERROR AddSynchronizedDevice(chip::NodeId nodeId); diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp new file mode 100644 index 00000000000000..b3cbdcea05409a --- /dev/null +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -0,0 +1,70 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "pw_rpc/server.h" +#include "pw_rpc_system_server/rpc_server.h" +#include "pw_rpc_system_server/socket.h" + +#include +#include + +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE +#include "pigweed/rpc_services/FabricAdmin.h" +#endif + +namespace { + +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE +class FabricAdmin final : public chip::rpc::FabricAdmin +{ +public: + pw::Status OpenCommissioningWindow(const chip_rpc_DeviceInfo & request, chip_rpc_OperationStatus & response) override + { + chip::NodeId nodeId = request.node_id; + ChipLogProgress(NotSpecified, "Received OpenCommissioningWindow request: 0x%lx", nodeId); + response.success = false; + + return pw::OkStatus(); + } +}; + +FabricAdmin fabric_admin_service; +#endif // defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE + +void RegisterServices(pw::rpc::Server & server) +{ +#if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE + server.RegisterService(fabric_admin_service); +#endif +} + +} // namespace + +void RunRpcService() +{ + pw::rpc::system_server::Init(); + RegisterServices(pw::rpc::system_server::Server()); + pw::rpc::system_server::Start(); +} + +void InitRpcServer(uint16_t rpcServerPort) +{ + pw::rpc::system_server::set_socket_port(rpcServerPort); + std::thread rpc_service(RunRpcService); + rpc_service.detach(); +} diff --git a/examples/fabric-admin/rpc/RpcServer.h b/examples/fabric-admin/rpc/RpcServer.h new file mode 100644 index 00000000000000..bc03bc0ac4abd3 --- /dev/null +++ b/examples/fabric-admin/rpc/RpcServer.h @@ -0,0 +1,23 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +constexpr uint16_t kFabricAdminServerPort = 33001; + +void InitRpcServer(uint16_t rpcServerPort); diff --git a/examples/fabric-admin/with_pw_rpc.gni b/examples/fabric-admin/with_pw_rpc.gni new file mode 100644 index 00000000000000..abb9ac65f27e78 --- /dev/null +++ b/examples/fabric-admin/with_pw_rpc.gni @@ -0,0 +1,42 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" +pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" +pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" +pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" +pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield" +pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +chip_enable_pw_rpc = true +chip_use_pw_logging = true diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index ea7e6e0b31b331..3e82f044c047f9 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -16,8 +16,20 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/tools.gni") +import("//with_pw_rpc.gni") + assert(chip_build_tools) +declare_args() { + bridge_enable_pw_rpc = false +} + +if (bridge_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") + import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +} + executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", @@ -38,6 +50,45 @@ executable("fabric-bridge-app") { include_dirs = [ "include" ] + if (bridge_enable_pw_rpc) { + defines = [ + "PW_RPC_FABRIC_ADMIN_SERVICE=1", + "PW_RPC_FABRIC_BRIDGE_SERVICE=1", + ] + + sources += [ + "${chip_root}/examples/platform/linux/RpcClientProcessor.cpp", + "${chip_root}/examples/platform/linux/RpcClientProcessor.h", + "${chip_root}/examples/platform/linux/system_rpc_server.cc", + "RpcClient.cpp", + "RpcServer.cpp", + "include/RpcClient.h", + "include/RpcServer.h", + ] + + deps += [ + "$dir_pw_hdlc:default_addresses", + "$dir_pw_hdlc:rpc_channel_output", + "$dir_pw_log", + "$dir_pw_rpc:server", + "$dir_pw_rpc/system_server:facade", + "$dir_pw_rpc/system_server:socket", + "$dir_pw_stream:socket_stream", + "$dir_pw_sync:mutex", + "${chip_root}/config/linux/lib/pw_rpc:pw_rpc", + "${chip_root}/examples/common/pigweed:fabric_admin_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:fabric_bridge_service.nanopb_rpc", + "${chip_root}/examples/common/pigweed:rpc_services", + ] + + deps += pw_build_LINK_DEPS + + include_dirs += [ + "${chip_root}/examples/common", + "${chip_root}/examples/platform/linux", + ] + } + output_dir = root_out_dir } diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp new file mode 100644 index 00000000000000..c09a447cff28c9 --- /dev/null +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "RpcClient.h" +#include "RpcClientProcessor.h" + +#include +#include +#include + +#include "fabric_admin_service/fabric_admin_service.rpc.pb.h" +#include "pw_assert/check.h" +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_rpc/client.h" +#include "pw_stream/socket_stream.h" + +using namespace chip; + +namespace { + +// Constants +constexpr uint32_t kDefaultChannelId = 1; + +// Fabric Admin Client +rpc::pw_rpc::nanopb::FabricAdmin::Client fabricAdminClient(rpc::client::GetDefaultRpcClient(), kDefaultChannelId); +pw::rpc::NanopbUnaryReceiver<::chip_rpc_OperationStatus> openCommissioningWindowCall; + +// Callback function to be called when the RPC response is received +void OnOpenCommissioningWindowCompleted(const chip_rpc_OperationStatus & response, pw::Status status) +{ + if (status.ok()) + { + ChipLogProgress(NotSpecified, "OpenCommissioningWindow received operation status: %d", response.success); + } + else + { + ChipLogProgress(NotSpecified, "OpenCommissioningWindow RPC call failed with status: %d\n", status.code()); + } +} + +} // namespace + +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort) +{ + rpc::client::SetRpcServerPort(rpcServerPort); + return rpc::client::StartPacketProcessing(); +} + +CHIP_ERROR OpenCommissioningWindow(NodeId nodeId) +{ + ChipLogProgress(NotSpecified, "OpenCommissioningWindow\n"); + + if (openCommissioningWindowCall.active()) + { + ChipLogError(NotSpecified, "OpenCommissioningWindow is in progress\n"); + return CHIP_ERROR_BUSY; + } + + chip_rpc_DeviceInfo device; + device.node_id = nodeId; + + // The RPC will remain active as long as `openCommissioningWindowCall` is alive. + openCommissioningWindowCall = fabricAdminClient.OpenCommissioningWindow(device, OnOpenCommissioningWindowCompleted); + + if (!openCommissioningWindowCall.active()) + { + return CHIP_ERROR_INTERNAL; + } + + return CHIP_NO_ERROR; +} diff --git a/examples/fabric-bridge-app/linux/RpcServer.cpp b/examples/fabric-bridge-app/linux/RpcServer.cpp new file mode 100644 index 00000000000000..c971811b193016 --- /dev/null +++ b/examples/fabric-bridge-app/linux/RpcServer.cpp @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "pw_rpc/server.h" +#include "pw_rpc_system_server/rpc_server.h" +#include "pw_rpc_system_server/socket.h" + +#include +#include + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +#include "pigweed/rpc_services/FabricBridge.h" +#endif + +namespace { + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +class FabricBridge final : public chip::rpc::FabricBridge +{ +public: + pw::Status AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & request, pw_protobuf_Empty & response) override + { + chip::NodeId nodeId = request.node_id; + ChipLogProgress(NotSpecified, "Received AddSynchronizedDevice: " ChipLogFormatX64, ChipLogValueX64(nodeId)); + return pw::OkStatus(); + } +}; + +FabricBridge fabric_bridge_service; +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + +void RegisterServices(pw::rpc::Server & server) +{ +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + server.RegisterService(fabric_bridge_service); +#endif +} + +} // namespace + +void RunRpcService() +{ + pw::rpc::system_server::Init(); + RegisterServices(pw::rpc::system_server::Server()); + pw::rpc::system_server::Start(); +} + +void InitRpcServer(uint16_t rpcServerPort) +{ + pw::rpc::system_server::set_socket_port(rpcServerPort); + std::thread rpc_service(RunRpcService); + rpc_service.detach(); +} diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h new file mode 100644 index 00000000000000..bd424e9d275910 --- /dev/null +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include + +constexpr uint16_t kFabricAdminServerPort = 33001; + +/** + * Initializes the RPC client by setting the server port and starting packet processing. + * + * @param rpcServerPort The port number of the RPC server. + * @return CHIP_ERROR An error code indicating the success or failure of the initialization process. + * - CHIP_NO_ERROR: Initialization was successful. + * - Other error codes indicating specific failure reasons. + */ +CHIP_ERROR InitRpcClient(uint16_t rpcServerPort); + +/** + * Opens a commissioning window for a specified node. + * + * @param nodeId The identifier of the node for which the commissioning window should be opened. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_BUSY: Another commissioning window is currently in progress. + * - CHIP_ERROR_INTERNAL: An internal error occurred. + */ +CHIP_ERROR OpenCommissioningWindow(chip::NodeId nodeId); diff --git a/examples/fabric-bridge-app/linux/include/RpcServer.h b/examples/fabric-bridge-app/linux/include/RpcServer.h new file mode 100644 index 00000000000000..f86858b19bdfe3 --- /dev/null +++ b/examples/fabric-bridge-app/linux/include/RpcServer.h @@ -0,0 +1,23 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +constexpr uint16_t kFabricBridgeServerPort = 33002; + +void InitRpcServer(uint16_t rpcServerPort); diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 600d4a2a376d55..47670561430c90 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -25,19 +25,26 @@ #include #include +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +#include "RpcClient.h" +#include "RpcServer.h" +#endif + #include #include #include using namespace chip; -#define POLL_INTERVAL_MS (100) #define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u) #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u) #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u) namespace { +constexpr uint16_t kPollIntervalMs = 100; +constexpr uint16_t kRetryIntervalS = 3; + bool KeyboardHit() { int bytesWaiting; @@ -57,13 +64,38 @@ void BridgePollingThread() ChipLogProgress(NotSpecified, "Exiting....."); exit(0); } +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + else if (ch == 'o') + { + CHIP_ERROR err = OpenCommissioningWindow(0x1234); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to call OpenCommissioningWindow RPC: %" CHIP_ERROR_FORMAT, err.Format()); + } + } +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE continue; } // Sleep to avoid tight loop reading commands - usleep(POLL_INTERVAL_MS * 1000); + usleep(kPollIntervalMs * 1000); + } +} + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE +void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) +{ + if (InitRpcClient(kFabricAdminServerPort) == CHIP_NO_ERROR) + { + ChipLogProgress(NotSpecified, "Connected to Fabric-Admin"); + } + else + { + ChipLogError(NotSpecified, "Failed to connect to Fabric-Admin, retry in %d seconds....", kRetryIntervalS); + systemLayer->StartTimer(System::Clock::Seconds16(kRetryIntervalS), AttemptRpcClientConnect, nullptr); } } +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE DeviceManager gDeviceManager; @@ -71,6 +103,11 @@ DeviceManager gDeviceManager; void ApplicationInit() { +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + InitRpcServer(kFabricBridgeServerPort); + AttemptRpcClientConnect(&DeviceLayer::SystemLayer(), nullptr); +#endif + // Start a thread for bridge polling std::thread pollingThread(BridgePollingThread); pollingThread.detach(); diff --git a/examples/fabric-bridge-app/linux/with_pw_rpc.gni b/examples/fabric-bridge-app/linux/with_pw_rpc.gni new file mode 100644 index 00000000000000..e1bd567cf22db2 --- /dev/null +++ b/examples/fabric-bridge-app/linux/with_pw_rpc.gni @@ -0,0 +1,42 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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. + +# add this gni as import in your build args to use pigweed in the example +# 'import("//with_pw_rpc.gni")' + +import("//build_overrides/chip.gni") + +import("${chip_root}/config/standalone/args.gni") + +import("//build_overrides/pigweed.gni") + +pw_log_BACKEND = "$dir_pw_log_basic" +pw_assert_BACKEND = "$dir_pw_assert_log:check_backend" +pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" +pw_trace_BACKEND = "$dir_pw_trace_tokenized" +pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" +pw_rpc_system_server_BACKEND = "${chip_root}/config/linux/lib/pw_rpc:pw_rpc" +dir_pw_third_party_nanopb = "${chip_root}/third_party/nanopb/repo" +pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_stl:system_clock" +pw_sync_MUTEX_BACKEND = "$dir_pw_sync_stl:mutex_backend" +pw_thread_YIELD_BACKEND = "$dir_pw_thread_stl:yield" +pw_thread_SLEEP_BACKEND = "$dir_pw_thread_stl:sleep" + +pw_build_LINK_DEPS = [ + "$dir_pw_assert:impl", + "$dir_pw_log:impl", +] + +chip_use_pw_logging = true +bridge_enable_pw_rpc = true diff --git a/examples/platform/linux/RpcClientProcessor.cpp b/examples/platform/linux/RpcClientProcessor.cpp new file mode 100644 index 00000000000000..a2cbe5694f531d --- /dev/null +++ b/examples/platform/linux/RpcClientProcessor.cpp @@ -0,0 +1,124 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#include "RpcClientProcessor.h" + +#include +#include + +#include "pw_hdlc/decoder.h" +#include "pw_hdlc/default_addresses.h" +#include "pw_hdlc/rpc_channel.h" +#include "pw_stream/socket_stream.h" + +namespace chip { +namespace rpc { +namespace client { +namespace { + +// Constants +constexpr size_t kMaxTransmissionUnit = 256; +constexpr uint32_t kDefaultChannelId = 1; +const char * kDefaultRpcServerAddress = "127.0.0.1"; + +// RPC Stream and Channel Setup +pw::stream::SocketStream rpcSocketStream; +pw::hdlc::RpcChannelOutput hdlcChannelOutput(rpcSocketStream, pw::hdlc::kDefaultRpcAddress, "HDLC channel"); +pw::rpc::Channel channels[] = { pw::rpc::Channel::Create<1>(&hdlcChannelOutput) }; +pw::rpc::Client rpcClient(channels); + +// RPC Stream and Channel Setup +uint16_t rpcServerPort = 0; +const char * rpcServerAddress = kDefaultRpcServerAddress; + +// Function to process incoming packets +void ProcessPackets() +{ + std::array inputBuf; + pw::hdlc::Decoder decoder(inputBuf); + + while (true) + { + std::array data; + auto ret = rpcSocketStream.Read(data); + if (!ret.ok()) + { + if (ret.status() == pw::Status::OutOfRange()) + { + // Handle remote disconnect + rpcSocketStream.Close(); + return; + } + continue; + } + + for (std::byte byte : ret.value()) + { + auto result = decoder.Process(byte); + if (!result.ok()) + { + // Wait for more bytes that form a complete packet + continue; + } + pw::hdlc::Frame & frame = result.value(); + if (frame.address() != pw::hdlc::kDefaultRpcAddress) + { + // Wrong address; ignore the packet + continue; + } + + rpcClient.ProcessPacket(frame.data()).IgnoreError(); + } + } +} + +} // namespace + +void SetRpcServerAddress(const char * address) +{ + rpcServerAddress = address; +} + +void SetRpcServerPort(uint16_t port) +{ + rpcServerPort = port; +} + +pw::rpc::Client & GetDefaultRpcClient() +{ + return rpcClient; +} + +CHIP_ERROR StartPacketProcessing() +{ + if (rpcSocketStream.Connect(rpcServerAddress, rpcServerPort) != PW_STATUS_OK) + { + // Handle connection error + return CHIP_ERROR_NOT_CONNECTED; + } + + // Start a thread to process incoming packets + std::thread packet_processor(ProcessPackets); + packet_processor.detach(); + + return CHIP_NO_ERROR; +} + +} // namespace client +} // namespace rpc +} // namespace chip diff --git a/examples/platform/linux/RpcClientProcessor.h b/examples/platform/linux/RpcClientProcessor.h new file mode 100644 index 00000000000000..f2305df7aa046c --- /dev/null +++ b/examples/platform/linux/RpcClientProcessor.h @@ -0,0 +1,36 @@ +/* + * + * Copyright (c) 2024 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. + */ + +#pragma once + +#include "pw_rpc/client.h" +#include +#include + +namespace chip { +namespace rpc { +namespace client { + +void SetRpcServerAddress(const char * address); +void SetRpcServerPort(uint16_t port); +pw::rpc::Client & GetDefaultRpcClient(); +CHIP_ERROR StartPacketProcessing(); + +} // namespace client +} // namespace rpc +} // namespace chip From 994a98d5f8568b68b29ccd0e8bfedc54fcee70d2 Mon Sep 17 00:00:00 2001 From: Kiel Oleson Date: Tue, 4 Jun 2024 16:12:06 -0700 Subject: [PATCH 11/78] Darwin: add helpers for essential attributes for logging; log unexpected C-quality attributes (#33560) * add metric keys for additional metrics * add metric collection for unexpected C Quality attribute update * unwind premature optimization placeholders/comments * rename to indicate the attributes are for logging / informational use * simplify - pull attributes from cache without intermediate object, should be fast enough * revert accidental whitespace change * Restyled by whitespace * Restyled by clang-format * make `nil` case possibility more obvious --------- Co-authored-by: Restyled.io --- src/darwin/Framework/CHIP/MTRDevice.mm | 55 ++++++++++++++++++++++- src/darwin/Framework/CHIP/MTRMetricKeys.h | 6 +++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 4014bd5f6924bf..dcb6a9acd8da64 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -35,6 +35,8 @@ #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" #import "MTRLogging_Internal.h" +#import "MTRMetricKeys.h" +#import "MTRMetricsCollector.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" #import "zap-generated/MTRCommandPayloads_Internal.h" @@ -1886,9 +1888,16 @@ - (void)_setCachedAttributeValue:(MTRDeviceDataValueDictionary _Nullable)value f && isFromSubscription && !_receivingPrimingReport && AttributeHasChangesOmittedQuality(path)) { - // Do not persist new values for Changes Omitted Quality attributes unless - // they're part of a Priming Report or from a read response. + // Do not persist new values for Changes Omitted Quality (aka C Quality) + // attributes unless they're part of a Priming Report or from a read response. // (removals are OK) + + // log when a device violates expectations for Changes Omitted Quality attributes. + using namespace chip::Tracing::DarwinFramework; + MATTER_LOG_METRIC_BEGIN(kMetricUnexpectedCQualityUpdate); + [self _addInformationalAttributesToCurrentMetricScope]; + MATTER_LOG_METRIC_END(kMetricUnexpectedCQualityUpdate); + return; } @@ -3642,6 +3651,48 @@ - (void)removeClientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID [self.temporaryMetaDataCache removeObjectForKey:[NSString stringWithFormat:@"%@:%@", key, endpointID]]; } +#pragma mark Log Help + +- (nullable NSNumber *)_informationalNumberAtAttributePath:(MTRAttributePath *)attributePath +{ + auto * cachedData = [self _cachedAttributeValueForPath:attributePath]; + + auto * attrReport = [[MTRAttributeReport alloc] initWithResponseValue:@{ + MTRAttributePathKey : attributePath, + MTRDataKey : cachedData, + } + error:nil]; + + return attrReport.value; +} + +- (nullable NSNumber *)_informationalVendorID +{ + auto * vendorIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) + clusterID:@(MTRClusterIDTypeBasicInformationID) + attributeID:@(MTRClusterBasicAttributeVendorIDID)]; + + return [self _informationalNumberAtAttributePath:vendorIDPath]; +} + +- (nullable NSNumber *)_informationalProductID +{ + auto * productIDPath = [MTRAttributePath attributePathWithEndpointID:@(kRootEndpointId) + clusterID:@(MTRClusterIDTypeBasicInformationID) + attributeID:@(MTRClusterBasicAttributeProductIDID)]; + + return [self _informationalNumberAtAttributePath:productIDPath]; +} + +- (void)_addInformationalAttributesToCurrentMetricScope +{ + using namespace chip::Tracing::DarwinFramework; + MATTER_LOG_METRIC(kMetricDeviceVendorID, [self _informationalVendorID].unsignedShortValue); + MATTER_LOG_METRIC(kMetricDeviceProductID, [self _informationalProductID].unsignedShortValue); + BOOL usesThread = [self _deviceUsesThread]; + MATTER_LOG_METRIC(kMetricDeviceUsesThread, usesThread); +} + @end /* BEGIN DRAGONS: Note methods here cannot be renamed, and are used by private callers, do not rename, remove or modify behavior here */ diff --git a/src/darwin/Framework/CHIP/MTRMetricKeys.h b/src/darwin/Framework/CHIP/MTRMetricKeys.h index 5ea03da70d9752..536da36b582053 100644 --- a/src/darwin/Framework/CHIP/MTRMetricKeys.h +++ b/src/darwin/Framework/CHIP/MTRMetricKeys.h @@ -69,6 +69,9 @@ constexpr Tracing::MetricKey kMetricDeviceVendorID = "dwnfw_device_vendor_id"; // Device Product ID constexpr Tracing::MetricKey kMetricDeviceProductID = "dwnfw_device_product_id"; +// Device Uses Thread +constexpr Tracing::MetricKey kMetricDeviceUsesThread = "dwnfw_device_uses_thread_bool"; + // Counter of number of devices discovered on the network during setup constexpr Tracing::MetricKey kMetricOnNetworkDevicesAdded = "dwnfw_onnet_devices_added"; @@ -81,6 +84,9 @@ constexpr Tracing::MetricKey kMetricBLEDevicesAdded = "dwnfw_ble_devices_added"; // Counter of number of BLE devices removed during setup constexpr Tracing::MetricKey kMetricBLEDevicesRemoved = "dwnfw_ble_devices_removed"; +// Unexpected C quality attribute update outside of priming +constexpr Tracing::MetricKey kMetricUnexpectedCQualityUpdate = "dwnpm_bad_c_attr_update"; + } // namespace DarwinFramework } // namespace Tracing } // namespace chip From ca33a408fb42f6199be57aee423eacaea464de37 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 4 Jun 2024 23:26:51 -0400 Subject: [PATCH 12/78] Increase the poll rate for BDX diagnostic log downloads. (#33741) The default rate used by bdx::Responder is once every 500ms, which means you maybe manage to get 1kB/s of log through the network. We should allow this process to go faster. Switch to once every 50ms, to match all the other BDX transfers we have around that poll like this. --- src/protocols/bdx/BdxTransferDiagnosticLog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/protocols/bdx/BdxTransferDiagnosticLog.cpp b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp index 8b349fed31e8f5..51e56fba9ac254 100644 --- a/src/protocols/bdx/BdxTransferDiagnosticLog.cpp +++ b/src/protocols/bdx/BdxTransferDiagnosticLog.cpp @@ -25,6 +25,12 @@ namespace { // Max block size for the BDX transfer. constexpr uint32_t kMaxBdxBlockSize = 1024; +// How often we poll our transfer session. Sadly, we get allocated on +// unsolicited message, which makes it hard for our clients to configure this. +// But the default poll interval is 500ms, which makes log downloads extremely +// slow. +constexpr System::Clock::Timeout kBdxPollInterval = System::Clock::Milliseconds32(50); + // Timeout for the BDX transfer session.. constexpr System::Clock::Timeout kBdxTimeout = System::Clock::Seconds16(5 * 60); constexpr TransferRole kBdxRole = TransferRole::kReceiver; @@ -95,7 +101,8 @@ CHIP_ERROR BdxTransferDiagnosticLog::OnMessageReceived(Messaging::ExchangeContex mTransferProxy.SetFabricIndex(fabricIndex); mTransferProxy.SetPeerNodeId(peerNodeId); auto flags(TransferControlFlags::kSenderDrive); - ReturnLogErrorOnFailure(Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout)); + ReturnLogErrorOnFailure( + Responder::PrepareForTransfer(mSystemLayer, kBdxRole, flags, kMaxBdxBlockSize, kBdxTimeout, kBdxPollInterval)); } return TransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload)); From 24bbdf431afcec27a90f793e1c99eb65e9cadea8 Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:29:08 +0800 Subject: [PATCH 13/78] Added secondary network interface device type (#33682) --- .../all-clusters-app.matter | 2 +- .../all-clusters-common/all-clusters-app.zap | 20 +++++++++---------- .../all-clusters-minimal-app.matter | 2 +- .../all-clusters-minimal-app.zap | 20 +++++++++---------- .../ota-requestor-app.matter | 2 +- .../ota-requestor-app.zap | 20 +++++++++---------- .../zap/tests/inputs/all-clusters-app.zap | 20 +++++++++---------- .../app-templates/endpoint_config.h | 2 +- .../zcl/data-model/chip/matter-devices.xml | 11 +++++++--- .../zap-generated/MTRDeviceTypeMetadata.mm | 2 +- 10 files changed, 53 insertions(+), 48 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 804d1eae5fbd32..8c5f9766970adc 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -9211,7 +9211,7 @@ endpoint 2 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 683f2dd75658ba..14c5f68d26e89c 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -24779,27 +24779,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter index 0c9569504c7846..58e57000bae2eb 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.matter @@ -6920,7 +6920,7 @@ endpoint 2 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index 3294f430a3e337..a4d3b3858ef160 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -11837,27 +11837,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter index da7faa284f9927..3e49c28226637a 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.matter @@ -1560,7 +1560,7 @@ endpoint 1 { } } endpoint 65534 { - device type ma_secondary_network_commissioning = 4293984258, version 1; + device type ma_secondary_network_interface = 25, version 1; server cluster Descriptor { diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 686335a5b3c3b7..e4133c02918306 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -2946,27 +2946,27 @@ "id": 3, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 04f2c793285f9f..784c8dfddb7664 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -16043,27 +16043,27 @@ "id": 4, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" }, "deviceTypes": [ { - "code": 4293984258, + "code": 25, "profileId": 259, - "label": "MA-secondary-network-commissioning", - "name": "MA-secondary-network-commissioning" + "label": "MA-secondary-network-interface", + "name": "MA-secondary-network-interface" } ], "deviceVersions": [ 1 ], "deviceIdentifiers": [ - 4293984258 + 25 ], - "deviceTypeName": "MA-secondary-network-commissioning", - "deviceTypeCode": 4293984258, + "deviceTypeName": "MA-secondary-network-interface", + "deviceTypeCode": 25, "deviceTypeProfileId": 259, "clusters": [ { diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index ca2e15eedf5683..55da8ec3f3f136 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -3047,7 +3047,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, { \ { 0x00000011, 1 }, { 0x00000016, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, { 0x00000100, 1 }, { 0x00000011, 1 }, \ { \ - 0xFFF10002, 1 \ + 0x00000019, 1 \ } \ } diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 83a462c4a64a4a..2aad342ea71311 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -2590,11 +2590,13 @@ limitations under the License. - MA-secondary-network-commissioning + MA-secondary-network-interface CHIP - Matter Secondary Network Commissioning Device Type + Matter Secondary Network Interface Device Type 0x0103 - 0xFFF10002 + 0x0019 + Utility + Endpoint @@ -2603,6 +2605,9 @@ limitations under the License. CLIENT_LIST PARTS_LIST + + + diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm index 06042f32f9f1d8..1dcb80d7fd1e99 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm @@ -44,6 +44,7 @@ { 0x00000014, DeviceTypeClass::Utility, "Matter OTA Provider" }, { 0x00000015, DeviceTypeClass::Simple, "Matter Contact Sensor" }, { 0x00000016, DeviceTypeClass::Node, "Matter Root Node" }, + { 0x00000019, DeviceTypeClass::Utility, "Matter Secondary Network Interface Device Type" }, { 0x00000022, DeviceTypeClass::Simple, "Matter Speaker" }, { 0x00000023, DeviceTypeClass::Simple, "Matter Casting Video Player" }, { 0x00000024, DeviceTypeClass::Simple, "Matter Content App" }, @@ -100,7 +101,6 @@ }; static_assert(ExtractVendorFromMEI(0xFFF10001) != 0, "Must have class defined for \"Matter Orphan Clusters\" if it's a standard device type"); -static_assert(ExtractVendorFromMEI(0xFFF10002) != 0, "Must have class defined for \"Matter Secondary Network Commissioning Device Type\" if it's a standard device type"); static_assert(ExtractVendorFromMEI(0xFFF10003) != 0, "Must have class defined for \"Matter All-clusters-app Server Example\" if it's a standard device type"); } // anonymous namespace From 0050994833d1402c055fea85b4c3cfbb74f8e1b0 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 01:36:58 -0400 Subject: [PATCH 14/78] Fix advertised device type for all-clusters-app to match data model. (#33715) * Fix advertised device type for all-clusters-app to match data model. We were claiming a device type of 0x0101 in the Descriptor DeviceTypeList on endpoint 1, but claiming a device type of 0xFFFF (not even a valid value) via DNS-SD advertising. Align our advertising behavior with the data model values. Fixes https://github.com/project-chip/connectedhomeip/issues/33697 * Address review comment. --- .../all-clusters-app/linux/include/CHIPProjectAppConfig.h | 4 ++++ .../all-clusters-app/tizen/include/CHIPProjectAppConfig.h | 4 ++++ src/app/tests/suites/TestDiscovery.yaml | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h index 440ba53f4ee3ba..0285563216e706 100644 --- a/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h +++ b/examples/all-clusters-app/linux/include/CHIPProjectAppConfig.h @@ -47,3 +47,7 @@ #define CHIP_CONFIG_MAX_PATHS_PER_INVOKE 5 #define CHIP_CONFIG_ENABLE_BDX_LOG_TRANSFER 1 + +// Claim a device type while advertising that matches the device type on our +// endpoint 1. 0x0101 is the "Dimmable Light" device type. +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101 diff --git a/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h index 38f322eecaab66..3d67773217a22a 100644 --- a/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h +++ b/examples/all-clusters-app/tizen/include/CHIPProjectAppConfig.h @@ -33,3 +33,7 @@ // All clusters app has 3 group endpoints. This needs to defined here so that // CHIP_CONFIG_MAX_GROUPS_PER_FABRIC is properly configured. #define CHIP_CONFIG_MAX_GROUP_ENDPOINTS_PER_FABRIC 3 + +// Claim a device type while advertising that matches the device type on our +// endpoint 1. 0x0101 is the "Dimmable Light" device type. +#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 0x0101 diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index 77c0615a27bc8d..0cb6a033cc50ae 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -17,6 +17,9 @@ name: Test Discovery config: nodeId: 0x12344321 endpoint: 0 + # These defaults correspond to the behavior of all-clusters-app, and + # different values should be passed on the command line when testing + # against any other server. discriminator: type: int16u defaultValue: 3840 @@ -31,7 +34,7 @@ config: defaultValue: 32769 deviceType: type: int16u - defaultValue: 65535 + defaultValue: 0x0101 tests: - label: "Stop target device" From 4a8dc7371ec95e4a9c8e1210fd5757a8b8aaeeac Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Wed, 5 Jun 2024 14:35:44 +0200 Subject: [PATCH 15/78] Replace ChipBleUUID local variables for all platform (#33713) * Replace uuid for rest platform * Restyle * Update define for webos * Fix typo --- src/platform/ASR/BLEManagerImpl.cpp | 19 +++------- src/platform/Ameba/BLEManagerImpl.cpp | 13 +++---- src/platform/Beken/BLEManagerImpl.cpp | 14 +++----- .../ESP32/bluedroid/BLEManagerImpl.cpp | 20 +++++------ src/platform/ESP32/nimble/BLEManagerImpl.cpp | 22 +++++------- .../Infineon/CYW30739/BLEManagerImpl.cpp | 18 +++------- .../Infineon/PSOC6/BLEManagerImpl.cpp | 17 +++------ src/platform/Linux/BLEManagerImpl.cpp | 27 ++++++-------- src/platform/NuttX/BLEManagerImpl.cpp | 27 ++++++-------- src/platform/Zephyr/BLEManagerImpl.cpp | 14 +++----- .../bouffalolab/common/BLEManagerImpl.cpp | 13 +++---- src/platform/cc13xx_26xx/BLEManagerImpl.cpp | 8 ++--- .../cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h | 5 --- src/platform/mbed/BLEManagerImpl.cpp | 16 ++++----- src/platform/mt793x/BLEManagerImpl.cpp | 16 +++------ .../nxp/k32w/common/BLEManagerCommon.cpp | 16 ++++----- src/platform/qpg/BLEManagerImpl.cpp | 27 +++++--------- src/platform/silabs/efr32/BLEManagerImpl.cpp | 20 +++++------ src/platform/silabs/rs911x/BLEManagerImpl.cpp | 18 ++++------ src/platform/stm32/BLEManagerImpl.cpp | 14 +++----- src/platform/telink/BLEManagerImpl.cpp | 14 +++----- src/platform/webos/BLEManagerImpl.cpp | 36 ++++++++----------- 22 files changed, 136 insertions(+), 258 deletions(-) diff --git a/src/platform/ASR/BLEManagerImpl.cpp b/src/platform/ASR/BLEManagerImpl.cpp index 88f7460a962a3a..681639dda50a4a 100644 --- a/src/platform/ASR/BLEManagerImpl.cpp +++ b/src/platform/ASR/BLEManagerImpl.cpp @@ -62,15 +62,6 @@ namespace { const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -const ChipBleUUID ChipUUID_CHIPoBLEChar_C3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, - 0x8F, 0x04 } }; -#endif static constexpr System::Clock::Timeout kFastAdvertiseTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME); System::Clock::Timestamp mAdvertiseStartTime; @@ -254,7 +245,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -263,20 +254,20 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLENotifyConfirm: - HandleIndicationConfirmation(event->CHIPoBLENotifyConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLENotifyConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Ameba/BLEManagerImpl.cpp b/src/platform/Ameba/BLEManagerImpl.cpp index 2d0a6d99515367..e4e881357d95fa 100644 --- a/src/platform/Ameba/BLEManagerImpl.cpp +++ b/src/platform/Ameba/BLEManagerImpl.cpp @@ -127,11 +127,6 @@ typedef struct const ble_uuid16_t ShortUUID_CHIPoBLEService = { BLE_UUID_TYPE_16, 0xFFF6 }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - static constexpr System::Clock::Timeout kFastAdvertiseTimeout = System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME); System::Clock::Timestamp mAdvertiseStartTime; @@ -469,7 +464,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connEstEvent; connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -479,13 +474,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -498,7 +493,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/Beken/BLEManagerImpl.cpp b/src/platform/Beken/BLEManagerImpl.cpp index 37f9fea9b9106e..4cd53bd5cd2d89 100644 --- a/src/platform/Beken/BLEManagerImpl.cpp +++ b/src/platform/Beken/BLEManagerImpl.cpp @@ -73,11 +73,7 @@ enum DriveBLEExtPerfEvt_DISCONNECT = 0, }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -static const uint8_t _svc_uuid[16] = { 0xF6, 0xFF, 0, 0, 0x0, 0x0, 0, 0, 0, 0, 0x0, 0x0, 0, 0, 0, 0 }; +static const uint8_t _svc_uuid[16] = { 0xF6, 0xFF, 0, 0, 0x0, 0x0, 0, 0, 0, 0, 0x0, 0x0, 0, 0, 0, 0 }; #define UUID_CHIPoBLECharact_RX \ { \ @@ -498,7 +494,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) { // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connEstEvent; connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -508,13 +504,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -527,7 +523,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index 3e5cc6091e9314..e2fe1627812e82 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -99,10 +99,6 @@ const uint8_t UUID_CHIPoBLEChar_TX[] = { 0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F #ifdef CONFIG_ENABLE_ESP32_BLE_CONTROLLER const uint8_t ShortUUID_CHIPoBLE_CharTx_Desc[] = { 0x02, 0x29 }; #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; const uint8_t CharProps_ReadNotify = ESP_GATT_CHAR_PROP_BIT_READ | ESP_GATT_CHAR_PROP_BIT_NOTIFY; const uint8_t CharProps_Write = ESP_GATT_CHAR_PROP_BIT_WRITE; @@ -324,7 +320,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -333,16 +329,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -393,20 +389,20 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv break; case DeviceEventType::kPlatformESP32BLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformESP32BLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformESP32BLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index c153e4b592c8ea..cff25239fc6c8d 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -103,12 +103,8 @@ const ble_uuid16_t ShortUUID_CHIPoBLE_CharTx_Desc = { BLE_UUID_TYPE_16, 0x2902 } const ble_uuid128_t UUID128_CHIPoBLEChar_RX = { BLE_UUID_TYPE_128, { 0x11, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 } }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -const ble_uuid128_t UUID_CHIPoBLEChar_TX = { +const ble_uuid128_t UUID_CHIPoBLEChar_TX = { { BLE_UUID_TYPE_128 }, { 0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18 } }; @@ -374,7 +370,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -383,16 +379,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -443,20 +439,20 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv break; case DeviceEventType::kPlatformESP32BLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformESP32BLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &chipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &chipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformESP32BLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; diff --git a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp index ab4deef1f91924..cc381e131154dc 100644 --- a/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp +++ b/src/platform/Infineon/CYW30739/BLEManagerImpl.cpp @@ -49,16 +49,6 @@ namespace chip { namespace DeviceLayer { namespace Internal { -namespace { - -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -} // unnamed namespace - BLEManagerImpl BLEManagerImpl::sInstance; wiced_bt_gatt_status_t app_gatts_callback(wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t * p_data); @@ -198,7 +188,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent _event; _event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -207,17 +197,17 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp index cb2b01197669e7..cfe49953676d65 100644 --- a/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp +++ b/src/platform/Infineon/PSOC6/BLEManagerImpl.cpp @@ -60,14 +60,7 @@ namespace chip { namespace DeviceLayer { namespace Internal { -namespace { -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -} // unnamed namespace +namespace {} // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -240,7 +233,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent _event; _event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -249,16 +242,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index a61c6e2403de02..251f4f0d9261dd 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -72,11 +72,6 @@ static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_CHANGE_TIME_MS >= "The extended advertising interval change time must be greater than the fast advertising interval change time"); #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -202,7 +197,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&connectionEvent); @@ -210,16 +205,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -290,18 +285,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformLinuxBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformLinuxBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformLinuxBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: @@ -368,7 +363,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); @@ -386,7 +381,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, @@ -435,7 +430,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); diff --git a/src/platform/NuttX/BLEManagerImpl.cpp b/src/platform/NuttX/BLEManagerImpl.cpp index e472e805a1154e..980a07983018c6 100644 --- a/src/platform/NuttX/BLEManagerImpl.cpp +++ b/src/platform/NuttX/BLEManagerImpl.cpp @@ -71,11 +71,6 @@ static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_CHANGE_TIME_MS >= "The extended advertising interval change time must be greater than the fast advertising interval change time"); #endif -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - void HandleConnectTimeout(chip::System::Layer *, void * apEndpoint) { VerifyOrDie(apEndpoint != nullptr); @@ -213,7 +208,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -222,16 +217,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -272,18 +267,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformLinuxBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformLinuxBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformLinuxBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: @@ -358,7 +353,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->SubscribeCharacteristic() == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SubscribeCharacteristic() failed")); @@ -376,7 +371,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID), ChipLogError(DeviceLayer, "UnsubscribeCharacteristic() called with invalid characteristic ID")); VerifyOrExit(conId->UnsubscribeCharacteristic() == CHIP_NO_ERROR, @@ -425,7 +420,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch ChipLogError(DeviceLayer, "BLE connection is not initialized in %s", __func__)); VerifyOrExit(Ble::UUIDsMatch(svcId, &CHIP_BLE_SVC_ID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID")); - VerifyOrExit(Ble::UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX), + VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID), ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid characteristic ID")); VerifyOrExit(conId->SendWriteRequest(std::move(pBuf)) == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "SendWriteRequest() failed")); diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 09bb9c0c8d71cb..03341b59dd903e 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -75,12 +75,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - _bt_gatt_ccc CHIPoBLEChar_TX_CCC = BT_GATT_CCC_INITIALIZER(nullptr, BLEManagerImpl::HandleTXCCCWrite, nullptr); // clang-format off @@ -606,7 +600,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -622,7 +616,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -638,7 +632,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -653,7 +647,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp index 0b1679ef2aeb09..f3655fa2bf5bf5 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp @@ -57,11 +57,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_TX = BT_UUID_INIT_128(0x12, 0x9D, 0x9F, 0x42, 0x9C, 0x4F, 0x9F, 0x95, 0x59, 0x45, 0x3D, 0x26, 0xF5, 0x2E, 0xEE, 0x18); bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = BT_UUID_INIT_128(0x04, 0x8F, 0x21, 0x83, 0x8A, 0x74, 0x7D, 0xB8, 0xF2, 0x45, 0x72, 0x87, 0x38, 0x02, 0x63, 0x64); @@ -496,7 +491,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -512,7 +507,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -528,7 +523,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -543,7 +538,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index e8bb817a5ad48c..6d2b1c2f1523ed 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -223,7 +223,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -233,19 +233,19 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { BLEMGR_LOG("BLEMGR: OnPlatformEvent, kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: { diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h index 16512930e9fa88..a5e2d31abaa6c7 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h @@ -240,11 +240,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) override; - const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x11 } }; - const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, - 0x9F, 0x9D, 0x12 } }; - friend BLEManager & BLEMgr(void); friend BLEManagerImpl & BLEMgrImpl(void); diff --git a/src/platform/mbed/BLEManagerImpl.cpp b/src/platform/mbed/BLEManagerImpl.cpp index 5048a92b1c48f3..79033dc37c6b07 100644 --- a/src/platform/mbed/BLEManagerImpl.cpp +++ b/src/platform/mbed/BLEManagerImpl.cpp @@ -63,12 +63,8 @@ namespace { const UUID ShortUUID_CHIPoBLEService(0xFFF6); // RX = BleLayer::CHIP_BLE_CHAR_1_ID const UUID LongUUID_CHIPoBLEChar_RX("18EE2EF5-263D-4559-959F-4F9C429F9D11"); -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; // TX = BleLayer::CHIP_BLE_CHAR_2_ID const UUID LongUUID_CHIPoBLEChar_TX("18EE2EF5-263D-4559-959F-4F9C429F9D12"); -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; } // namespace #if _BLEMGRIMPL_USE_LEDS @@ -905,7 +901,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgrImpl().PostEventOrDie(&connEstEvent); } @@ -913,13 +909,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -932,7 +928,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -989,11 +985,11 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); // No need to do anything fancy here. Only 3 handles are used in this impl. - if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX)) + if (UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID)) { att_handle = sCHIPService.getTxHandle(); } - else if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_RX)) + else if (UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID)) { // TODO does this make sense? att_handle = sCHIPService.getRxHandle(); diff --git a/src/platform/mt793x/BLEManagerImpl.cpp b/src/platform/mt793x/BLEManagerImpl.cpp index 0a90f2e2a733ba..bc222c607833a5 100644 --- a/src/platform/mt793x/BLEManagerImpl.cpp +++ b/src/platform/mt793x/BLEManagerImpl.cpp @@ -79,11 +79,6 @@ const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. EventGroupHandle_t xBleEventGroup; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -249,7 +244,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -257,13 +252,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -277,7 +272,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnBlePlatformEvent kCHIPoBLEIndicateConfirm, ConId %04x", event->CHIPoBLEIndicateConfirm.ConId); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -346,8 +341,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ChipDeviceEvent event; bt_status_t ret; - VerifyOrExit(UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); - VerifyOrExit(UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); + VerifyOrExit(UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId), err = CHIP_ERROR_INVALID_MESSAGE_TYPE); ChipLogProgress(DeviceLayer, "SendIndication(): conId %d, len %d", conId, data->DataLength()); diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp index 4c9048a3f68192..0f70d5bb851e5b 100644 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp @@ -125,11 +125,7 @@ EventGroupHandle_t sEventGroup; TimerHandle_t connectionTimeout; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; #if defined(chip_with_low_power) && (chip_with_low_power == 1) static bool bleAppStopInProgress; @@ -319,17 +315,17 @@ void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLESubscribe: ChipDeviceEvent connEstEvent; - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; @@ -338,7 +334,7 @@ void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; default: @@ -401,7 +397,7 @@ bool BLEManagerCommon::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBle PacketBufferHandle data) { CHIP_ERROR err = CHIP_NO_ERROR; - uint16_t cId = (UUIDsMatch(&ChipUUID_CHIPoBLEChar_TX, charId) ? value_chipoble_tx : 0); + uint16_t cId = (UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId) ? value_chipoble_tx : 0); ChipDeviceEvent event; if (cId != 0) diff --git a/src/platform/qpg/BLEManagerImpl.cpp b/src/platform/qpg/BLEManagerImpl.cpp index 45d291e651146d..73b18e7046bd7f 100644 --- a/src/platform/qpg/BLEManagerImpl.cpp +++ b/src/platform/qpg/BLEManagerImpl.cpp @@ -65,17 +65,6 @@ StaticTimer_t sbleAdvTimeoutTimerBuffer; // Full service UUID - CHIP_BLE_SVC_ID - taken from BleUUID.h header const uint8_t chipUUID_CHIPoBLE_Service[CHIP_ADV_SHORT_UUID_LEN] = { 0xFF, 0xF6 }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -const ChipBleUUID chipUUID_CHIPoBLEChar_C3 = { { 0x64, 0x63, 0x02, 0x38, 0x87, 0x72, 0x45, 0xF2, 0xB8, 0x7D, 0x74, 0x8A, 0x83, 0x21, - 0x8F, 0x04 } }; -#endif /* CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING */ - } // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -104,10 +93,10 @@ CHIP_ERROR BLEManagerImpl::_Init() appCbacks.cccCallback = _handleTXCharCCCDWrite; #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, chipUUID_CHIPoBLEChar_TX.bytes, chipUUID_CHIPoBLEChar_RX.bytes, - chipUUID_CHIPoBLEChar_C3.bytes); + qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, Ble::CHIP_BLE_CHAR_2_UUID.bytes, Ble::CHIP_BLE_CHAR_1_UUID.bytes, + Ble::CHIP_BLE_CHAR_3_UUID.bytes); #else - qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, chipUUID_CHIPoBLEChar_TX.bytes, chipUUID_CHIPoBLEChar_RX.bytes, nullptr); + qvCHIP_BleSetUUIDs(chipUUID_CHIPoBLE_Service, Ble::CHIP_BLE_CHAR_2_UUID.bytes, Ble::CHIP_BLE_CHAR_1_UUID.bytes, nullptr); #endif /* CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING */ qvCHIP_BleInit(&appCbacks); @@ -211,7 +200,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -221,7 +210,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connClosedEvent; ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connClosedEvent.Type = DeviceEventType::kCHIPoBLEConnectionClosed; PlatformMgr().PostEventOrDie(&connClosedEvent); } @@ -229,7 +218,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -251,7 +240,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogDetail(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -311,7 +300,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU VerifyOrExit(IsSubscribed(conId), err = CHIP_ERROR_INVALID_ARGUMENT); ChipLogDetail(DeviceLayer, "Sending indication for CHIPoBLE Client TX (con %u, len %u)", conId, dataLen); - isRxHandle = UUIDsMatch(&chipUUID_CHIPoBLEChar_RX, charId); + isRxHandle = UUIDsMatch(&Ble::CHIP_BLE_CHAR_1_UUID, charId); cId = qvCHIP_BleGetHandle(isRxHandle); qvCHIP_BleSendIndication(conId, cId, dataLen, data->Start()); diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index 4a6d78574005c1..18d7578f8f0f76 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -100,13 +100,9 @@ namespace { TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. -const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; bd_addr randomizedAddr = { 0 }; @@ -243,7 +239,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -251,13 +247,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -270,7 +266,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; @@ -322,7 +318,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU CHIP_ERROR err = CHIP_NO_ERROR; CHIPoBLEConState * conState = GetConnectionState(conId); sl_status_t ret; - uint16_t cId = (UUIDsMatch(&ChipUUID_CHIPoBLEChar_RX, charId) ? gattdb_CHIPoBLEChar_Rx : gattdb_CHIPoBLEChar_Tx); + uint16_t cId = (UUIDsMatch(&Ble::CHIP_BLE_CHAR_1_UUID, charId) ? gattdb_CHIPoBLEChar_Rx : gattdb_CHIPoBLEChar_Tx); uint8_t timerHandle = GetTimerHandle(conId, true); VerifyOrExit(((conState != NULL) && (conState->subscribed != 0)), err = CHIP_ERROR_INVALID_ARGUMENT); diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index e7495322018170..3794eaef395318 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -255,13 +255,9 @@ namespace { TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. -const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; +const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; +const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; } // namespace @@ -413,7 +409,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipDeviceEvent connEstEvent; ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } @@ -421,13 +417,13 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEUnsubscribe: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -441,7 +437,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEIndicateConfirm: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); DeviceLayer::SystemLayer().CancelTimer(OnSendIndicationTimeout, this); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/stm32/BLEManagerImpl.cpp b/src/platform/stm32/BLEManagerImpl.cpp index 7a040a5fb93ba3..60b888d5ebc99b 100644 --- a/src/platform/stm32/BLEManagerImpl.cpp +++ b/src/platform/stm32/BLEManagerImpl.cpp @@ -63,12 +63,6 @@ TimerHandle_t sbleAdvTimeoutTimer; // Full service UUID - CHIP_BLE_SVC_ID - taken from BleUUID.h header const uint8_t chipUUID_CHIPoBLE_Service[CHIP_ADV_SHORT_UUID_LEN] = { 0xFF, 0xF6 }; -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - } // unnamed namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -198,19 +192,19 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) // Platform specific events case DeviceEventType::kCHIPoBLESubscribe: { ChipDeviceEvent connEstEvent; - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; PlatformMgr().PostEventOrDie(&connEstEvent); } break; case DeviceEventType::kCHIPoBLEUnsubscribe: { - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; case DeviceEventType::kCHIPoBLEWriteReceived: { - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); } break; @@ -230,7 +224,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEIndicateConfirm: { - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } break; diff --git a/src/platform/telink/BLEManagerImpl.cpp b/src/platform/telink/BLEManagerImpl.cpp index 69252b66a0ecef..c33de4264e1edd 100644 --- a/src/platform/telink/BLEManagerImpl.cpp +++ b/src/platform/telink/BLEManagerImpl.cpp @@ -79,12 +79,6 @@ const bt_uuid_128 UUID128_CHIPoBLEChar_C3 = bt_uuid_16 UUID16_CHIPoBLEService = BT_UUID_INIT_16(0xFFF6); -const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; - -const ChipBleUUID chipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - _bt_gatt_ccc CHIPoBLEChar_TX_CCC = BT_GATT_CCC_INITIALIZER(nullptr, BLEManagerImpl::HandleTXCCCWrite, nullptr); // clang-format off @@ -544,7 +538,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) if (writeEvent->Value == BT_GATT_CCC_INDICATE && SetSubscribed(writeEvent->BtConn)) { // Alert the BLE layer that CHIPoBLE "subscribe" has been received and increment the bt_conn reference counter. - HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); ChipLogProgress(DeviceLayer, "CHIPoBLE connection established (ConnId: 0x%02x, GATT MTU: %u)", bt_conn_index(writeEvent->BtConn), GetMTU(writeEvent->BtConn)); @@ -560,7 +554,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharCCCDWrite(const ChipDeviceEvent * event) { if (UnsetSubscribed(writeEvent->BtConn)) { - HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(writeEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); } } @@ -576,7 +570,7 @@ CHIP_ERROR BLEManagerImpl::HandleRXCharWrite(const ChipDeviceEvent * event) ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02x)", bt_conn_index(c1WriteEvent->BtConn)); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); @@ -591,7 +585,7 @@ CHIP_ERROR BLEManagerImpl::HandleTXCharComplete(const ChipDeviceEvent * event) bt_conn_index(c2IndDoneEvent->BtConn), c2IndDoneEvent->Result); // Signal the BLE Layer that the outstanding indication is complete. - HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(c2IndDoneEvent->BtConn, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); bt_conn_unref(c2IndDoneEvent->BtConn); return CHIP_NO_ERROR; diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp index 786ded0d3f4029..c488c1cf85e28a 100644 --- a/src/platform/webos/BLEManagerImpl.cpp +++ b/src/platform/webos/BLEManagerImpl.cpp @@ -56,14 +56,6 @@ namespace { static constexpr unsigned kNewConnectionScanTimeoutMs = 10000; static constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(10); -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; -#define CHIP_BLE_GATT_SERVICE "0000fff6-0000-1000-8000-00805f9b34fb" -#define CHIP_BLE_GATT_CHAR_WRITE "18ee2ef5-263d-4559-959f-4f9c429f9d11" -#define CHIP_BLE_GATT_CHAR_READ "18ee2ef5-263d-4559-959f-4f9c429f9d12" - } // namespace BLEManagerImpl BLEManagerImpl::sInstance; @@ -225,7 +217,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) switch (event->Type) { case DeviceEventType::kCHIPoBLESubscribe: - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); { ChipDeviceEvent connectionEvent; connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; @@ -234,16 +226,16 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) break; case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); break; case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kCHIPoBLEConnectionError: @@ -284,18 +276,18 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv } break; case DeviceEventType::kPlatformWebOSBLEWriteComplete: - HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX); + HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; case DeviceEventType::kPlatformWebOSBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); else HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &CHIP_BLE_SVC_ID, - &ChipUUID_CHIPoBLEChar_TX); + &Ble::CHIP_BLE_CHAR_2_UUID); break; case DeviceEventType::kPlatformWebOSBLEIndicationReceived: - HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX, + HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID, PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; case DeviceEventType::kPlatformWebOSBLEPeripheralAdvConfiguredComplete: @@ -434,9 +426,9 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin pbnjson::JValue valueForMonitor = pbnjson::JObject(); valueForMonitor.put("clientId", std::string(mClientId)); - valueForMonitor.put("service", std::string(CHIP_BLE_GATT_SERVICE)); + valueForMonitor.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); pbnjson::JValue bytesJArray = pbnjson::JArray(); - bytesJArray.append(std::string(CHIP_BLE_GATT_CHAR_READ)); + bytesJArray.append(std::string(Ble::CHIP_BLE_CHAR_2_UUID_STR)); valueForMonitor.put("characteristics", bytesJArray); valueForMonitor.put("subscribe", true); @@ -456,8 +448,8 @@ bool BLEManagerImpl::SubscribeCharacteristicToWebOS(void * bleConnObj, const uin pbnjson::JValue valueForDescriptor = pbnjson::JObject(); valueForDescriptor.put("clientId", std::string(mClientId)); - valueForDescriptor.put("service", std::string(CHIP_BLE_GATT_SERVICE)); - valueForDescriptor.put("characteristic", std::string(CHIP_BLE_GATT_CHAR_READ)); + valueForDescriptor.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); + valueForDescriptor.put("characteristic", std::string(Ble::CHIP_BLE_CHAR_2_UUID_STR)); valueForDescriptor.put("descriptor", std::string("00002902-0000-1000-8000-00805f9b34fb")); @@ -568,8 +560,8 @@ bool BLEManagerImpl::SendWriteRequestToWebOS(void * bleConnObj, const uint8_t * pbnjson::JValue param = pbnjson::JObject(); pbnjson::JValue valueParam = pbnjson::JObject(); param.put("clientId", clientId); - param.put("service", std::string(CHIP_BLE_GATT_SERVICE)); - param.put("characteristic", std::string(CHIP_BLE_GATT_CHAR_WRITE)); + param.put("service", std::string(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR)); + param.put("characteristic", std::string(Ble::CHIP_BLE_CHAR_1_UUID_STR)); if (valueType == "byte") { From e445e8a214250a297c699953c5da62d68380b190 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 5 Jun 2024 15:19:14 +0200 Subject: [PATCH 16/78] [Tizen] Allow to pass CHIP error to device event (#33744) * Create GATT service with short Bluetooth SIG UUID * Do not initialize characteristics with dummy values * Do not keep non-Matter UUIDs in BleUUID.h * Pass CHIP_ERROR to device event * Simplify ChipDeviceEvent initialization * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/ble/BleUUID.h | 1 - src/platform/Linux/CHIPDevicePlatformEvent.h | 1 + src/platform/Tizen/BLEManagerImpl.cpp | 139 +++++++++---------- src/platform/Tizen/BLEManagerImpl.h | 14 +- src/platform/Tizen/CHIPDevicePlatformEvent.h | 13 +- 5 files changed, 75 insertions(+), 93 deletions(-) diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 37e2fdc1180f5e..1c0eefd514100a 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -101,7 +101,6 @@ constexpr std::pair StringToUUID(const char (&str)[N]) // BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst // describes ServiceData as "Keys are the UUIDs in string format" however no description // on actual case required -inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902"; inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "fff6"; inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000fff6-0000-1000-8000-00805f9b34fb"; inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d11"; diff --git a/src/platform/Linux/CHIPDevicePlatformEvent.h b/src/platform/Linux/CHIPDevicePlatformEvent.h index 18ed55a1ef28d4..a70411888413c1 100644 --- a/src/platform/Linux/CHIPDevicePlatformEvent.h +++ b/src/platform/Linux/CHIPDevicePlatformEvent.h @@ -23,6 +23,7 @@ #pragma once +#include #include #include diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 209c5fb2337356..247719a9199b76 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -74,6 +74,9 @@ namespace Internal { namespace { +// Bluetooth SIG defined UUID for Client Characteristic Configuration Descriptor +constexpr const char * kClientCharacteristicConfigurationUUID = "2902"; + constexpr System::Clock::Timeout kNewConnectionScanTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(20); constexpr System::Clock::Timeout kFastAdvertiseTimeout = @@ -208,7 +211,10 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques ChipLogByteSpan(DeviceLayer, ByteSpan(Uint8::from_const_char(value.get()), len)); - ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, 0x00, value.get(), len); + char dummyValue[] = ""; + // Tizen API does not like NULLs even for zero-length values. + char * valuePtr = value ? value.get() : dummyValue; + ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, BT_ATT_ERROR_NONE, valuePtr, len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret))); } @@ -233,7 +239,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque ret = bt_gatt_set_value(gattHandle, value, len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_set_value() failed: %s", get_error_message(ret))); - ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, 0x00, nullptr, 0); + ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, BT_ATT_ERROR_NONE, nullptr, 0); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret))); @@ -265,7 +271,7 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se ChipLogProgress(DeviceLayer, "Notification State Changed %d on %s: %s", notify, __ConvertAttTypeToStr(type), StringOrNullMarker(uuid.get())); - NotifyBLESubscribed(notify ? true : false, conn); + NotifyBLESubscribed(conn, notify ? true : false); } void BLEManagerImpl::WriteCompletedCb(int result, bt_gatt_h gattHandle, void * userData) @@ -314,7 +320,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver if (advState == BT_ADAPTER_LE_ADVERTISING_STARTED) { mFlags.Set(Flags::kAdvertising); - NotifyBLEPeripheralAdvStartComplete(true, nullptr); + NotifyBLEPeripheralAdvStartComplete(CHIP_NO_ERROR); DeviceLayer::SystemLayer().ScheduleLambda([this] { // Start a timer to make sure that the fast advertising is stopped after specified timeout. DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimeout, this); @@ -323,7 +329,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver else { mFlags.Clear(Flags::kAdvertising); - NotifyBLEPeripheralAdvStopComplete(true, nullptr); + NotifyBLEPeripheralAdvStopComplete(CHIP_NO_ERROR); DeviceLayer::SystemLayer().ScheduleLambda( [this] { DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); }); } @@ -338,89 +344,73 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver } // ====== Private Functions. -void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(bool aIsSuccess, void * apAppstate) + +void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete; - event.Platform.BLEPeripheralGATTServerRegisterComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralGATTServerRegisterComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete, + .Platform = { .BLEPeripheralGATTServerRegisterComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete; - event.Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvConfiguredComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete, + .Platform = { .BLEPeripheralAdvConfiguredComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete; - event.Platform.BLEPeripheralAdvStartComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStartComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete, + .Platform = { .BLEPeripheralAdvStartComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete; - event.Platform.BLEPeripheralAdvStopComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStopComplete.mpAppstate = apAppstate; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete, + .Platform = { .BLEPeripheralAdvStopComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEWriteReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEWriteReceived; - event.CHIPoBLEWriteReceived.ConId = conId; - event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease(); + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived, + .CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLENotificationReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEIndicationReceived; - event.Platform.BLEIndicationReceived.mConnection = conId; - event.Platform.BLEIndicationReceived.mData = std::move(buf).UnsafeRelease(); + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEIndicationReceived, + .Platform = { + .BLEIndicationReceived = { .mConnection = conId, .mData = std::move(buf).UnsafeRelease() } } }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLESubscribed(bool indicationsEnabled, BLE_CONNECTION_OBJECT conId) +void BLEManagerImpl::NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled) { - ChipDeviceEvent event; - event.Type = (indicationsEnabled) ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe; - event.CHIPoBLESubscribe.ConId = conId; + ChipDeviceEvent event{ .Type = indicationsEnabled ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe, + .CHIPoBLESubscribe = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEIndicateConfirm, .CHIPoBLEIndicateConfirm = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionError; - event.CHIPoBLEConnectionError.ConId = conId; - event.CHIPoBLEConnectionError.Reason = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError, + .CHIPoBLEConnectionError = { .ConId = conId, .Reason = error } }; PlatformMgr().PostEventOrDie(&event); } @@ -429,9 +419,8 @@ void BLEManagerImpl::NotifyHandleConnectFailed(CHIP_ERROR error) ChipLogProgress(DeviceLayer, "Connection failed: %" CHIP_ERROR_FORMAT, error.Format()); if (mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed; - event.Platform.BLECentralConnectFailed.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed, + .Platform = { .BLECentralConnectFailed = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } } @@ -440,27 +429,23 @@ void BLEManagerImpl::NotifyHandleNewConnection(BLE_CONNECTION_OBJECT conId) { if (mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLECentralConnected; - event.Platform.BLECentralConnected.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnected, + .Platform = { .BLECentralConnected = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } } void BLEManagerImpl::NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLEWriteComplete; - event.Platform.BLEWriteComplete.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEWriteComplete, + .Platform = { .BLEWriteComplete = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool isSubscribed) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete; - event.Platform.BLESubscribeOpComplete.mConnection = conId; - event.Platform.BLESubscribeOpComplete.mIsSubscribed = isSubscribed; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete, + .Platform = { .BLESubscribeOpComplete = { .mConnection = conId, .mIsSubscribed = isSubscribed } } }; PlatformMgr().PostEventOrDie(&event); } @@ -574,7 +559,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_create() failed: %s", get_error_message(ret))); // Create Service (BTP Service) - ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service); + ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_create() failed: %s", get_error_message(ret))); // Create 1st Characteristic (Client TX Buffer) @@ -583,7 +568,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() BT_GATT_PROPERTY_WRITE, // Write Request is not coming if we use WITHOUT_RESPONSE property. Let's use WRITE property and // consider to use WITHOUT_RESPONSE property in the future according to the CHIP Spec 4.16.3.2. BTP // GATT Service - "CHIPoBLE_C1", strlen("CHIPoBLE_C1"), &char1); + nullptr, 0, &char1); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret))); @@ -604,8 +589,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() // Create 2nd Characteristic (Client RX Buffer) ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ, - BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, "CHIPoBLE_C2", strlen("CHIPoBLE_C2"), - &char2); + BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, nullptr, 0, &char2); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret))); @@ -618,6 +602,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() this); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_set_read_value_requested_cb() failed: %s", get_error_message(ret))); + ret = bt_gatt_server_set_characteristic_notification_state_change_cb( char2, +[](bool notify, bt_gatt_server_h gattServer, bt_gatt_h charHandle, void * self) { @@ -628,13 +613,14 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() ChipLogError(DeviceLayer, "bt_gatt_server_set_characteristic_notification_state_change_cb() failed: %s", get_error_message(ret))); - // Create CCC Descriptor - ret = bt_gatt_descriptor_create(Ble::CHIP_BLE_DESC_SHORT_UUID_STR, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, + ret = bt_gatt_descriptor_create(kClientCharacteristicConfigurationUUID, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE, desc_value, sizeof(desc_value), &desc); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_descriptor_create() failed: %s", get_error_message(ret))); + ret = bt_gatt_characteristic_add_descriptor(char2, desc); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_characteristic_add_descriptor() failed: %s", get_error_message(ret))); + ret = bt_gatt_service_add_characteristic(service, char2); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_add_characteristic() failed: %s", get_error_message(ret))); @@ -648,8 +634,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() ret = bt_gatt_server_start(); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_start() failed: %s", get_error_message(ret))); - ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Success"); - BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(true, nullptr); + BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_NO_ERROR); // Save the Local Peripheral char1 & char2 handles mGattCharC1Handle = char1; @@ -657,8 +642,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer() return CHIP_NO_ERROR; exit: - ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Failed"); - BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(false, nullptr); + BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(TizenToChipError(ret)); return TizenToChipError(ret); } @@ -727,7 +711,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising() VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_adapter_le_set_advertising_device_name() failed: %s", get_error_message(ret))); - BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_NO_ERROR); ret = bt_adapter_le_start_advertising_new( mAdvertiser, @@ -742,8 +726,9 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising() return CHIP_NO_ERROR; exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(false, nullptr); - return ret != BT_ERROR_NONE ? TizenToChipError(ret) : err; + err = ret != BT_ERROR_NONE ? TizenToChipError(ret) : err; + BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(err); + return err; } CHIP_ERROR BLEManagerImpl::StopBLEAdvertising() @@ -758,7 +743,7 @@ CHIP_ERROR BLEManagerImpl::StopBLEAdvertising() return CHIP_NO_ERROR; exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(false, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(TizenToChipError(ret)); return TizenToChipError(ret); } @@ -896,7 +881,7 @@ void BLEManagerImpl::HandleC1CharWriteEvent(BLE_CONNECTION_OBJECT conId, const u // Copy the data to a packet buffer. buf = System::PacketBufferHandle::NewWithData(value, len); VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - NotifyBLEWriteReceived(buf, conId); + NotifyBLEWriteReceived(conId, buf); return; exit: if (err != CHIP_NO_ERROR) @@ -915,7 +900,7 @@ void BLEManagerImpl::HandleRXCharChanged(BLE_CONNECTION_OBJECT conId, const uint // Copy the data to a packet buffer. buf = System::PacketBufferHandle::NewWithData(value, len); VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - NotifyBLENotificationReceived(buf, conId); + NotifyBLENotificationReceived(conId, buf); return; exit: if (err != CHIP_NO_ERROR) diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h index ed30b92aa958b7..5dfee7fba75c83 100644 --- a/src/platform/Tizen/BLEManagerImpl.h +++ b/src/platform/Tizen/BLEManagerImpl.h @@ -196,13 +196,13 @@ class BLEManagerImpl final : public BLEManager, bool IsDeviceChipPeripheral(BLE_CONNECTION_OBJECT conId); // ==== BLE Adv & GATT Server. - void NotifyBLEPeripheralGATTServerRegisterComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate); - void NotifyBLESubscribed(bool indicationsEnabled, BLE_CONNECTION_OBJECT conId); + void NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvConfiguredComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error); + void NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error); + void NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled); void NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId); - void NotifyBLEWriteReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId); + void NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf); static void HandleAdvertisingTimeout(chip::System::Layer *, void * appState); AdvertisingIntervals GetAdvertisingIntervals() const; @@ -214,7 +214,7 @@ class BLEManagerImpl final : public BLEManager, void NotifyHandleConnectFailed(CHIP_ERROR error); void NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId); void NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool isSubscribed); - void NotifyBLENotificationReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId); + void NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf); CHIP_ERROR RegisterGATTServer(); CHIP_ERROR StartBLEAdvertising(); diff --git a/src/platform/Tizen/CHIPDevicePlatformEvent.h b/src/platform/Tizen/CHIPDevicePlatformEvent.h index 2145b18b448c8f..ce606fd7f576fd 100644 --- a/src/platform/Tizen/CHIPDevicePlatformEvent.h +++ b/src/platform/Tizen/CHIPDevicePlatformEvent.h @@ -23,6 +23,7 @@ #pragma once +#include #include #include @@ -67,23 +68,19 @@ struct ChipDevicePlatformEvent { struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralGATTServerRegisterComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvConfiguredComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvStartComplete; struct { - bool mIsSuccess; - void * mpAppstate; + CHIP_ERROR mError; } BLEPeripheralAdvStopComplete; struct { From 4ec2035f2cb5f20eec8d3623d765924db050e6c9 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 5 Jun 2024 09:20:39 -0400 Subject: [PATCH 17/78] Python wheels: move template into its own gni (#33739) This will let us re-use the template later for wheels not in src/controller/python. Nothing within the template has been changed - this is just a move. Test: ran build_python.sh, it's fine still. --- build/chip/python_wheel.gni | 88 ++++++++++++++++++++++++++++++++++ src/controller/python/BUILD.gn | 70 +-------------------------- 2 files changed, 89 insertions(+), 69 deletions(-) create mode 100644 build/chip/python_wheel.gni diff --git a/build/chip/python_wheel.gni b/build/chip/python_wheel.gni new file mode 100644 index 00000000000000..ac00fe140456cc --- /dev/null +++ b/build/chip/python_wheel.gni @@ -0,0 +1,88 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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("//build_overrides/chip.gni") +import("//build_overrides/pigweed.gni") + +import("$dir_pw_build/python.gni") +import("${chip_root}/src/system/system.gni") + +declare_args() { + chip_python_version = "0.0" + chip_python_package_prefix = "chip" + chip_python_supports_stack_locking = chip_system_config_locking != "none" +} + +template("chip_python_wheel_action") { + _dist_dir = "${root_out_dir}/controller/python" + + _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json" + + pw_python_action(target_name) { + script = "build-chip-wheel.py" + forward_variables_from(invoker, "*") + + _py_manifest_files_rebased = [] + foreach(_manifest_entry, py_manifest_files) { + inputs += _manifest_entry.sources + _py_manifest_files_rebased += [ + { + src_dir = rebase_path(_manifest_entry.src_dir, + get_path_info(_py_manifest_file, "dir")) + sources = + rebase_path(_manifest_entry.sources, _manifest_entry.src_dir) + }, + ] + } + + if (defined(invoker.py_scripts)) { + _py_scripts = invoker.py_scripts + } else { + _py_scripts = [] + } + + _py_manifest = { + files = _py_manifest_files_rebased + packages = py_packages + scripts = _py_scripts + package_reqs = py_package_reqs + } + + write_file(_py_manifest_file, _py_manifest, "json") + + args = [ + "--package_name", + py_package_name, + "--build_number", + chip_python_version, + "--build_dir", + rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir), + "--dist_dir", + rebase_path(_dist_dir, root_build_dir), + "--manifest", + rebase_path(_py_manifest_file, root_build_dir), + "--plat-name", + py_platform_tag, + ] + + if (defined(invoker.lib_name)) { + args += [ + "--lib-name", + lib_name, + ] + } + + outputs = [ "${_dist_dir}/$output_name" ] + } +} diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 9adda770125317..747aa522504ca6 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -18,6 +18,7 @@ import("//build_overrides/pigweed.gni") import("$dir_pw_build/python.gni") +import("${chip_root}/build/chip/python_wheel.gni") import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/platform/python.gni") import("${chip_root}/src/system/system.gni") @@ -31,12 +32,6 @@ config("controller_wno_deprecate") { cflags = [ "-Wno-deprecated-declarations" ] } -declare_args() { - chip_python_version = "0.0" - chip_python_package_prefix = "chip" - chip_python_supports_stack_locking = chip_system_config_locking != "none" -} - shared_library("ChipDeviceCtrl") { if (chip_controller) { output_name = "_ChipDeviceCtrl" @@ -157,69 +152,6 @@ shared_library("ChipDeviceCtrl") { configs += [ ":controller_wno_deprecate" ] } -template("chip_python_wheel_action") { - _dist_dir = "${root_out_dir}/controller/python" - - _py_manifest_file = "${target_gen_dir}/${target_name}.py_manifest.json" - - pw_python_action(target_name) { - script = "build-chip-wheel.py" - forward_variables_from(invoker, "*") - - _py_manifest_files_rebased = [] - foreach(_manifest_entry, py_manifest_files) { - inputs += _manifest_entry.sources - _py_manifest_files_rebased += [ - { - src_dir = rebase_path(_manifest_entry.src_dir, - get_path_info(_py_manifest_file, "dir")) - sources = - rebase_path(_manifest_entry.sources, _manifest_entry.src_dir) - }, - ] - } - - if (defined(invoker.py_scripts)) { - _py_scripts = invoker.py_scripts - } else { - _py_scripts = [] - } - - _py_manifest = { - files = _py_manifest_files_rebased - packages = py_packages - scripts = _py_scripts - package_reqs = py_package_reqs - } - - write_file(_py_manifest_file, _py_manifest, "json") - - args = [ - "--package_name", - py_package_name, - "--build_number", - chip_python_version, - "--build_dir", - rebase_path("${target_gen_dir}/${target_name}.py_build", root_build_dir), - "--dist_dir", - rebase_path(_dist_dir, root_build_dir), - "--manifest", - rebase_path(_py_manifest_file, root_build_dir), - "--plat-name", - py_platform_tag, - ] - - if (defined(invoker.lib_name)) { - args += [ - "--lib-name", - lib_name, - ] - } - - outputs = [ "${_dist_dir}/$output_name" ] - } -} - chip_python_wheel_action("chip-core") { py_manifest_files = [ { From 6092e8a764f45371d8c48da9b254fe83f917d388 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 5 Jun 2024 16:06:15 +0200 Subject: [PATCH 18/78] [Python] Drop network lock (#33720) The network lock is not needed in the Python controller, as all calls to the SDK are made by posting to the Matter SDK event loop through ScheduleWork(), hence are guaranteed to be serialized. From how I understand ScheduleWork() works, it pushes the work to the event loop through PostEvent() which at least on POSIX is using the thread safe device queue (see GenericPlatformManagerImpl_POSIX.cpp). --- src/controller/python/chip/ChipStack.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index 06afff3ef3c380..b47c4639825da8 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -144,8 +144,6 @@ class ChipStack(object): def __init__(self, persistentStoragePath: str, enableServerInteractions=True): builtins.enableDebugMode = False - # TODO: Probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - self.networkLock = Lock() self.completeEvent = Event() self.commissioningCompleteEvent = Event() self._ChipStackLib = None @@ -212,7 +210,6 @@ def Shutdown(self): # #20437 tracks consolidating these. # self._ChipStackLib.pychip_CommonStackShutdown() - self.networkLock = None self.completeEvent = None self._ChipStackLib = None self._chipDLLPath = None @@ -226,10 +223,7 @@ def Call(self, callFunct, timeoutMs: int = None): This function is a wrapper of PostTaskOnChipThread, which includes some handling of application specific logics. Calling this function on CHIP on CHIP mainloop thread will cause deadlock. ''' - # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - with self.networkLock: - res = self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) - return res + return self.PostTaskOnChipThread(callFunct).Wait(timeoutMs) async def CallAsync(self, callFunct, timeoutMs: int = None): '''Run a Python function on CHIP stack, and wait for the response. @@ -256,9 +250,7 @@ def CallAsyncWithCompleteCallback(self, callFunct): # throw error if op in progress self.callbackRes = None self.completeEvent.clear() - # TODO: Lock probably no longer necessary, see https://github.com/project-chip/connectedhomeip/issues/33321. - with self.networkLock: - res = self.PostTaskOnChipThread(callFunct).Wait() + res = self.PostTaskOnChipThread(callFunct).Wait() if not res.is_success: self.completeEvent.set() From 92a322d391511a9fda840a72cbe571c7c6ad7c0e Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Wed, 5 Jun 2024 22:32:05 +0530 Subject: [PATCH 19/78] Adding few logs related to event ids for ESP32 platform specific events (#33751) --- src/platform/ESP32/PlatformManagerImpl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index ed9f6aca7128c9..d5ad12352dbf3a 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -119,6 +119,7 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even event.Platform.ESPSystemEvent.Id = eventId; if (eventBase == IP_EVENT) { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent: IP Event with eventId : %ld", eventId); switch (eventId) { case IP_EVENT_STA_GOT_IP: @@ -138,6 +139,7 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even #if CHIP_DEVICE_CONFIG_ENABLE_WIFI else if (eventBase == WIFI_EVENT) { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent: Wifi Event with eventId : %ld", eventId); switch (eventId) { case WIFI_EVENT_SCAN_DONE: @@ -181,7 +183,10 @@ void PlatformManagerImpl::HandleESPSystemEvent(void * arg, esp_event_base_t even } } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI - + else + { + ChipLogProgress(DeviceLayer, "Posting ESPSystemEvent with eventId : %ld", eventId); + } sInstance.PostEventOrDie(&event); } From 4c39f7e7ffdeea15c746df4e4284185d7edc7e7f Mon Sep 17 00:00:00 2001 From: Gibran Vargas <131407127+gvargas-csa@users.noreply.github.com> Date: Wed, 5 Jun 2024 10:53:19 -0700 Subject: [PATCH 20/78] TC-OPCREDS-3.2: Add (#32182) * chore(TC_OPCREDS-3.2): skeleton base class * chore(TC_OPCREDS_3.2): NOCResponse command * chore(TC_OPCREDS_3.2): get currentFabric * chore(TC_OPCREDS_3.2): print some status values * TC-OPCREDS-3.2: Re-work test This test was difficult to automate and included a factory reset. This automation start is used to generate the test plans. The intent of this test is to confirm that the returned fabric index matches the fabric index returned from the AddNOC command, and that the read of fabric-filtered attributes matches to the calling fabric. The rest of the test is covered by OPCREDS-3.1 so was removed to simplify. NOTE: test not yet implemented, uploaded for test plan generation purposes only. - Properly use Test Step and Expected outcome columns - Remove checks for NOCs matching - this is checked in OPCREDS-3.1 - Remove factory reset and commission two new fabrics - Use commissioning over CASE so we can more easily return the fabric index * chore(TC_OPCREDS_3.2): included new steps (1-6) Just need to add validation for CR3 and remove all fabrics. Also it need clean up (remove prints, unused variables, etc) * chore(TC_OPCREDS_3.2): all steps are implemtented * chore(TC_OPCREDS_3.2): restyled by isort * chore(TC_OPCREDS_3_2): fix error from python linter (code-lints) * chore(TC_OPCREDS_3.2): import restyled by isort * chore(TC_OPCREDS_3.2): fixed the vendorID for prevent fail * chore(TC_OPCREDS_3.2): add test to CI Workflow * chore(TC_OPCREDS_3.2): off auto-format and change the return values label * chore(TC_OPCREDS_3.2): remove if-else validation instead used assert_equal * chore(TC_OPCREDS_3.2): spacing adjustment for better readability * chore(TC_OPCREDS_3.2): identation adjustment for better readability * chore(TC_OPCREDS_3.2): restyled patch identation adjustment * chore(TC_OPCREDS_3.2): reverted addition of test --------- Co-authored-by: cecille --- .github/workflows/tests.yaml | 1 + .../chip/utils/CommissioningBuildingBlocks.py | 36 ++-- src/python_testing/TC_OPCREDS_3_2.py | 190 ++++++++++++++++++ src/python_testing/test_plan_support.py | 78 +++++++ 4 files changed, 290 insertions(+), 15 deletions(-) create mode 100644 src/python_testing/TC_OPCREDS_3_2.py create mode 100644 src/python_testing/test_plan_support.py diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 678b7b18195aa0..24895bf5f07e01 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -536,6 +536,7 @@ jobs: scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' diff --git a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py index 8fa80223b14316..4c3826fd6914ee 100644 --- a/src/controller/python/chip/utils/CommissioningBuildingBlocks.py +++ b/src/controller/python/chip/utils/CommissioningBuildingBlocks.py @@ -156,12 +156,14 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, newNodeId (int): Node ID to use for the target node on the new fabric. Return: - bool: True if successful, False otherwise. + tuple: (bool, Optional[nocResp], Optional[rcacResp]: True if successful, False otherwise, along with nocResp, rcacResp value. ''' + nocResp = None + resp = await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(60)) if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: - return False + return False, nocResp csrForAddNOC = await commissionerDevCtrl.SendCommand(existingNodeId, 0, opCreds.Commands.CSRRequest(CSRNonce=os.urandom(32))) @@ -171,31 +173,35 @@ async def AddNOCForNewFabricFromExisting(commissionerDevCtrl, newFabricDevCtrl, chainForAddNOC.nocBytes is None or chainForAddNOC.ipkBytes is None): # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp await commissionerDevCtrl.SendCommand(existingNodeId, 0, opCreds.Commands.AddTrustedRootCertificate(chainForAddNOC.rcacBytes)) - resp = await commissionerDevCtrl.SendCommand(existingNodeId, - 0, - opCreds.Commands.AddNOC(chainForAddNOC.nocBytes, - chainForAddNOC.icacBytes, - chainForAddNOC.ipkBytes, - newFabricDevCtrl.nodeId, - newFabricDevCtrl.fabricAdmin.vendorId)) - if resp.statusCode is not opCreds.Enums.NodeOperationalCertStatusEnum.kOk: + nocResp = await commissionerDevCtrl.SendCommand(existingNodeId, + 0, + opCreds.Commands.AddNOC(chainForAddNOC.nocBytes, + chainForAddNOC.icacBytes, + chainForAddNOC.ipkBytes, + newFabricDevCtrl.nodeId, + newFabricDevCtrl.fabricAdmin.vendorId)) + + rcacResp = chainForAddNOC.rcacBytes + + if nocResp.statusCode is not opCreds.Enums.NodeOperationalCertStatusEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp resp = await newFabricDevCtrl.SendCommand(newNodeId, 0, generalCommissioning.Commands.CommissioningComplete()) + if resp.errorCode is not generalCommissioning.Enums.CommissioningErrorEnum.kOk: # Expiring the failsafe timer in an attempt to clean up. await commissionerDevCtrl.SendCommand(existingNodeId, 0, generalCommissioning.Commands.ArmFailSafe(0)) - return False + return False, nocResp if not await _IsNodeInFabricList(newFabricDevCtrl, newNodeId): - return False + return False, nocResp - return True + return True, nocResp, rcacResp async def UpdateNOC(devCtrl, existingNodeId, newNodeId): diff --git a/src/python_testing/TC_OPCREDS_3_2.py b/src/python_testing/TC_OPCREDS_3_2.py new file mode 100644 index 00000000000000..5b7cd5bd59480e --- /dev/null +++ b/src/python_testing/TC_OPCREDS_3_2.py @@ -0,0 +1,190 @@ +# +# Copyright (c) 2024 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 chip.clusters as Clusters +from chip.tlv import TLVReader +from chip.utils import CommissioningBuildingBlocks +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts +from test_plan_support import (commission_from_existing, commission_if_required, read_attribute, remove_fabric, + verify_commissioning_successful, verify_success) + + +def verify_fabric(controller: str) -> str: + return (f"- Verify there is one entry returned. Verify FabricIndex matches `fabric_index_{controller}`.\n" + f"- Verify the RootPublicKey matches the public key for rcac_{controller}.\n" + f"- Verify the VendorID matches the vendor ID for {controller}.\n" + f"- Verify the FabricID matches the fabricID for {controller}") + + +class TC_OPCREDS_3_2(MatterBaseTest): + def desc_TC_OPCREDS_3_2(self): + return " Attribute-CurrentFabricIndex validation [DUTServer]" + + def steps_TC_OPCREDS_3_2(self): + return [TestStep(0, commission_if_required('CR1'), is_commissioning=True), + TestStep(1, f"{commission_from_existing('CR1', 'CR2')}\n. Save the FabricIndex from the NOCResponse as `fabric_index_CR2`.", + verify_commissioning_successful()), + TestStep(2, f"{commission_from_existing('CR1', 'CR3')}\n. Save the FabricIndex from the NOCResponse as `fabric_index_CR3`.", + verify_commissioning_successful()), + TestStep(3, f"CR2 {read_attribute('CurrentFabricIndex')}", + "Verify the returned value is `fabric_index_CR2`"), + TestStep(4, f"CR3 {read_attribute('CurrentFabricIndex')}", + "Verify the returned value is `fabric_index_CR3`"), + TestStep( + 5, f"CR2 {read_attribute('Fabrics')} using a fabric-filtered read", verify_fabric('CR2')), + TestStep( + 6, f"CR3 {read_attribute('Fabrics')} using a fabric-filtered read", verify_fabric('CR3')), + TestStep(7, remove_fabric( + 'fabric_index_CR2', 'CR1'), verify_success()), + TestStep(8, remove_fabric( + 'fabric_index_CR3', 'CR1'), verify_success()), + ] + + @async_test_body + async def test_TC_OPCREDS_3_2(self): + opcreds = Clusters.OperationalCredentials + + self.step(0) + + self.step(1) + dev_ctrl = self.default_controller + + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + cr2_vid = 0xFFF2 + cr2_fabricId = 2222 + cr2_new_fabric_admin = new_certificate_authority.NewFabricAdmin( + vendorId=cr2_vid, fabricId=cr2_fabricId) + cr2_nodeid = self.default_controller.nodeId+1 + cr2_dut_node_id = self.dut_node_id+1 + + cr2_new_admin_ctrl = cr2_new_fabric_admin.NewController( + nodeId=cr2_nodeid) + success, nocResp, rcacResp = await CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting( + commissionerDevCtrl=dev_ctrl, newFabricDevCtrl=cr2_new_admin_ctrl, + existingNodeId=self.dut_node_id, newNodeId=cr2_dut_node_id + ) + + fabric_index_CR2 = nocResp.fabricIndex + tlvReaderRCAC_CR2 = TLVReader(rcacResp).get()["Any"] + rcac_CR2 = tlvReaderRCAC_CR2[9] # public key is field 9 + + self.step(2) + new_certificate_authority = self.certificate_authority_manager.NewCertificateAuthority() + cr3_vid = 0xFFF3 + cr3_fabricId = 3333 + cr3_new_fabric_admin = new_certificate_authority.NewFabricAdmin( + vendorId=cr3_vid, fabricId=cr3_fabricId) + cr3_nodeid = self.default_controller.nodeId+2 + cr3_dut_node_id = self.dut_node_id+2 + + cr3_new_admin_ctrl = cr3_new_fabric_admin.NewController( + nodeId=cr3_nodeid) + success, nocResp, rcacResp = await CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting( + commissionerDevCtrl=dev_ctrl, newFabricDevCtrl=cr3_new_admin_ctrl, + existingNodeId=self.dut_node_id, newNodeId=cr3_dut_node_id + ) + + fabric_index_CR3 = nocResp.fabricIndex + tlvReaderRCAC_CR3 = TLVReader(rcacResp).get()["Any"] + rcac_CR3 = tlvReaderRCAC_CR3[9] + + self.step(3) + cr2_read_fabricIndex = await self.read_single_attribute_check_success( + dev_ctrl=cr2_new_admin_ctrl, + node_id=cr2_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.CurrentFabricIndex + ) + + asserts.assert_equal(fabric_index_CR2, cr2_read_fabricIndex, + "Fail fabric_index_CR2 is not equal to read fabricIndex from CR2") + + self.step(4) + cr3_read_fabricIndex = await self.read_single_attribute_check_success( + dev_ctrl=cr3_new_admin_ctrl, + node_id=cr3_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.CurrentFabricIndex + ) + + asserts.assert_equal(fabric_index_CR3, cr3_read_fabricIndex, + "Fail fabric_index_CR3 is not equal to read fabricIndex from CR3") + + self.step(5) + cr2_fabric = await self.read_single_attribute_check_success( + dev_ctrl=cr2_new_admin_ctrl, + node_id=cr2_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.Fabrics, + fabric_filtered=True + ) + + for fabric in cr2_fabric: + cr2_fabric_fabricIndex = fabric.fabricIndex + cr2_fabric_rootPublicKey = fabric.rootPublicKey + cr2_fabric_vendorId = fabric.vendorID + cr2_fabric_fabricId = fabric.fabricID + + asserts.assert_equal(cr2_fabric_fabricIndex, + fabric_index_CR2, "Unexpected CR2 fabric index") + asserts.assert_equal(cr2_fabric_rootPublicKey, rcac_CR2, + "Unexpected RootPublicKey does not match with rcac_CR2") + asserts.assert_equal(cr2_fabric_vendorId, cr2_vid, + "Unexpected vendorId does not match with CR2 VendorID") + asserts.assert_equal(cr2_fabric_fabricId, cr2_fabricId, + "Unexpected fabricId does not match with CR2 fabricID") + + self.step(6) + cr3_fabric = await self.read_single_attribute_check_success( + dev_ctrl=cr3_new_admin_ctrl, + node_id=cr3_dut_node_id, + cluster=opcreds, + attribute=opcreds.Attributes.Fabrics, + fabric_filtered=True + ) + + for fabric in cr3_fabric: + cr3_fabric_fabricIndex = fabric.fabricIndex + cr3_fabric_rootPublicKey = fabric.rootPublicKey + cr3_fabric_vendorId = fabric.vendorID + cr3_fabric_fabricId = fabric.fabricID + + asserts.assert_equal(cr3_fabric_fabricIndex, + fabric_index_CR3, "Unexpected CR3 fabric index") + asserts.assert_equal(cr3_fabric_rootPublicKey, rcac_CR3, + "Unexpected RootPublicKey does not match with rcac_CR3") + asserts.assert_equal(cr3_fabric_vendorId, cr3_vid, + "Unexpected vendorId does not match with CR3 VendorID") + asserts.assert_equal(cr3_fabric_fabricId, cr3_fabricId, + "Unexpected fabricId does not match with CR3 fabricID") + + self.step(7) + cmd = opcreds.Commands.RemoveFabric(fabric_index_CR2) + resp = await self.send_single_cmd(cmd=cmd) + asserts.assert_equal( + resp.statusCode, opcreds.Enums.NodeOperationalCertStatusEnum.kOk) + + self.step(8) + cmd = opcreds.Commands.RemoveFabric(fabric_index_CR3) + resp = await self.send_single_cmd(cmd=cmd) + asserts.assert_equal( + resp.statusCode, opcreds.Enums.NodeOperationalCertStatusEnum.kOk) + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/test_plan_support.py b/src/python_testing/test_plan_support.py new file mode 100644 index 00000000000000..1acb8576bdb15c --- /dev/null +++ b/src/python_testing/test_plan_support.py @@ -0,0 +1,78 @@ +# +# Copyright (c) 2024 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 typing + + +def read_attribute(attribute: str, cluster: typing.Optional[str] = None): + attr = f'reads the {attribute} attribute' + if cluster: + return f'{attr} from {cluster}' + else: + return attr + + +def save_as(val: str) -> str: + return f' and saves the value as {val}' + + +def verify_status(status: str) -> str: + return f'Verify DUT responds w/ status {status}' + + +def verify_success() -> str: + return verify_status('SUCCESS') + +# ----------------------- +# Commissioning strings +# ----------------------- + + +def commission_if_required(controller: typing.Optional[str] = None) -> str: + controller_str = f'to {controller} ' if controller is not None else '' + return f'Commission DUT {controller_str}if not already done' + + +def commission_from_existing(existing_controller_name: str, new_controller_name: str) -> str: + # NOTE to implementers: This text corresponds to the actions taken by CommissioningBuildingBlocks.AddNOCForNewFabricFromExisting. + # This function should be used in the TestSteps description when you use that function. + # AddNOCForNewFabricFromExisting is used when the generated certificates are required for use in the test. + # It written one step so we can just use the function directly without needing to annotate the sub-steps for the TH. + return (f'Create a new controller on a new fabric called {new_controller_name}.\n' + f'Commission the new controller from {existing_controller_name} as follows:\n\n' + f'- {existing_controller_name} sends an ArmFailsafe command, followed by a CSRRequest command.\n' + f'- Generate credentials on {new_controller_name} using the returned CSR.\n' + f'- Save the RCAC as `rcac_{new_controller_name}. Save the ICAC as `icac_{new_controller_name}`. Save the NOC as `noc_{new_controller_name}`. Save the IPK as ipk_{new_controller_name}.\n' + f'- {existing_controller_name} sends the AddTrustedRootCertificate command with `rcac_{new_controller_name}`' + f'- {existing_controller_name} sends the AddNOC command with the fields set as follows:\n' + f' * NOCValue: `noc_{new_controller_name}`\n' + f' * ICACValue: `icac_{new_controller_name}`\n' + f' * IPKValue: `ipk_{new_controller_name}`\n' + f' * CaseAdminSubject: {new_controller_name} node ID\n' + f' * AdminVendorId: {new_controller_name} vendor ID\n' + f'- {new_controller_name} connects over CASE and sends the commissioning complete command') + + +def open_commissioning_window(controller: str = 'TH') -> str: + return f'{controller} opens a commissioning window on the DUT' + + +def remove_fabric(index_var: str, controller: str): + return f'{controller} sends the RemoveFabric command to the Node Operational Credentials cluster with the FabricIndex set to {index_var}.' + + +def verify_commissioning_successful() -> str: + return 'Verify the commissioning is successful.' From f91b25669cc3ab53e48d0b3ef602505b8ea5cc1b Mon Sep 17 00:00:00 2001 From: Pradip De Date: Wed, 5 Jun 2024 12:05:25 -0700 Subject: [PATCH 21/78] Changes for large Packetbuffer allocation to support TCP payloads (#33308) * Changes for large Packetbuffer allocation to support TCP payloads Changes to internal checks in SystemPacketBuffer. Update the length encoding for TCP payloads during send and receive. Max size config for large packetbuffer size limit in SystemPacketBuffer.h. Define Max application payload size for large buffers Test modifications for chainedbuffer receives for TCP. - Add test for Buffer length greater than MRP max size. - Disable TCP on nrfconnect platform because of resource requirements. Stack allocations for large buffer with default size is exceeding limits. Disabling the Test file altogether for this platform would prevent all tests from running. Instead, only disabling TCP on nrfConnect for now, since it is unused. Fixes #31779. * Update src/system/SystemPacketBuffer.cpp Co-authored-by: Boris Zbarsky * Update src/transport/raw/TCP.cpp Co-authored-by: Boris Zbarsky * Restyle fix --------- Co-authored-by: Boris Zbarsky --- config/nrfconnect/chip-module/CMakeLists.txt | 2 +- src/inet/TCPEndPoint.h | 2 +- src/inet/TCPEndPointImplSockets.cpp | 5 +-- src/system/SystemConfig.h | 18 ++++++++ src/system/SystemPacketBuffer.cpp | 41 +++++++++++++----- src/system/SystemPacketBuffer.h | 24 ++++++++++- src/system/tests/TestSystemPacketBuffer.cpp | 18 ++++---- src/transport/SecureMessageCodec.cpp | 1 - src/transport/SessionManager.cpp | 9 ++++ src/transport/raw/MessageHeader.h | 11 ++++- src/transport/raw/TCP.cpp | 27 ++++++------ src/transport/raw/TCP.h | 6 +-- src/transport/raw/TCPConfig.h | 9 ---- src/transport/raw/tests/TestTCP.cpp | 44 ++++++++++++-------- 14 files changed, 145 insertions(+), 72 deletions(-) diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 51ca4689de1ca1..29560db74f38cc 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -129,7 +129,7 @@ matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NF matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) matter_add_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS) matter_add_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) -matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) +matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" FALSE) matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h index 8fc6a6338d4140..57652349cfa83a 100644 --- a/src/inet/TCPEndPoint.h +++ b/src/inet/TCPEndPoint.h @@ -522,7 +522,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis /** * Size of the largest TCP packet that can be received. */ - constexpr static size_t kMaxReceiveMessageSize = System::PacketBuffer::kMaxSizeWithoutReserve; + constexpr static size_t kMaxReceiveMessageSize = System::PacketBuffer::kMaxAllocSize; protected: friend class TCPTest; diff --git a/src/inet/TCPEndPointImplSockets.cpp b/src/inet/TCPEndPointImplSockets.cpp index d21c11b6a42865..6b8965b19d2b4b 100644 --- a/src/inet/TCPEndPointImplSockets.cpp +++ b/src/inet/TCPEndPointImplSockets.cpp @@ -947,10 +947,9 @@ void TCPEndPointImplSockets::ReceiveData() { VerifyOrDie(rcvLen > 0); size_t newDataLength = rcvBuf->DataLength() + static_cast(rcvLen); - VerifyOrDie(CanCastTo(newDataLength)); if (isNewBuf) { - rcvBuf->SetDataLength(static_cast(newDataLength)); + rcvBuf->SetDataLength(newDataLength); rcvBuf.RightSize(); if (mRcvQueue.IsNull()) { @@ -963,7 +962,7 @@ void TCPEndPointImplSockets::ReceiveData() } else { - rcvBuf->SetDataLength(static_cast(newDataLength), mRcvQueue); + rcvBuf->SetDataLength(newDataLength, mRcvQueue); } } } diff --git a/src/system/SystemConfig.h b/src/system/SystemConfig.h index e91f59298f683e..b37cfe555278dd 100644 --- a/src/system/SystemConfig.h +++ b/src/system/SystemConfig.h @@ -788,3 +788,21 @@ struct LwIPEvent; #define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD 0 #endif #endif // CHIP_SYSTEM_CONFIG_USE_ZEPHYR_EVENTFD + +/** + * @def CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES + * + * @brief Maximum buffer allocation size of a 'Large' message + * + * This is the default maximum capacity (including both data and reserve + * space) of a large PacketBuffer(exceeding the IPv6 MTU of 1280 bytes). + * This shall be used over transports, such as TCP, that support large + * payload transfers. Fetching of large command responses or wildcard + * subscription responses may leverage this increased bandwidth transfer. + * Individual systems may override this size based on their requirements. + * Data transfers over MRP should not be using this size for allocating + * buffers as they are restricted by the IPv6 MTU. + */ +#ifndef CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES +#define CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES (64000) +#endif diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index f8dda8b01ab84e..9f29d2755908cd 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -515,6 +515,21 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese // Setting a static upper bound on the maximum buffer size allocation for regular sized messages (not large). static_assert(PacketBuffer::kMaxSizeWithoutReserve <= UINT16_MAX, "kMaxSizeWithoutReserve should not exceed UINT16_MAX."); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + // Setting a static upper bound on the maximum buffer size allocation for + // large messages. +#if CHIP_SYSTEM_CONFIG_USE_LWIP + // LwIP based systems are internally limited to using a u16_t type as the size of a buffer. + static_assert(PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT16_MAX, + "In LwIP, max size for Large payload buffers cannot exceed UINT16_MAX!"); +#else + // Messages over TCP are framed using a length field that is 32 bits in + // length. + static_assert(PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT32_MAX, + "Max size for Large payload buffers cannot exceed UINT32_MAX"); +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + // Ensure that aAvailableSize is bound within a max and is not big enough to cause overflow during // subsequent addition of all the sizes. if (aAvailableSize > UINT32_MAX) @@ -547,7 +562,14 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese #if CHIP_SYSTEM_CONFIG_USE_LWIP // LwIP based APIs have a maximum buffer size of UINT16_MAX. Ensure that // limit is met during allocation. - VerifyOrDieWithMsg(sumOfAvailAndReserved < UINT16_MAX, chipSystemLayer, "LwIP based systems can handle only up to UINT16_MAX!"); + if (sumOfAvailAndReserved > UINT16_MAX) + { + ChipLogError(chipSystemLayer, + "LwIP based systems require total buffer size to be less than UINT16_MAX!" + "Attempted allocation size = " ChipLogFormatX64, + ChipLogValueX64(sumOfAvailAndReserved)); + return PacketBufferHandle(); + } #endif // CHIP_SYSTEM_CONFIG_USE_LWIP // sumOfAvailAndReserved is no larger than sumOfSizes, which we checked can be cast to @@ -557,7 +579,7 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_PacketBufferNew, return PacketBufferHandle()); - if (lAllocSize > PacketBuffer::kMaxSizeWithoutReserve) + if (lAllocSize > PacketBuffer::kMaxAllocSize) { ChipLogError(chipSystemLayer, "PacketBuffer: allocation exceeding buffer capacity limits."); return PacketBufferHandle(); @@ -621,11 +643,6 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aDataSize, size_t aAdditionalSize, uint16_t aReservedSize) { - if (aDataSize > UINT16_MAX) - { - ChipLogError(chipSystemLayer, "PacketBuffer: allocation too large."); - return PacketBufferHandle(); - } // Since `aDataSize` fits in uint16_t, the sum `aDataSize + aAdditionalSize` will not overflow. // `New()` will only return a non-null buffer if the total allocation size does not overflow. PacketBufferHandle buffer = New(aDataSize + aAdditionalSize, aReservedSize); @@ -633,6 +650,8 @@ PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aD { memcpy(buffer.mBuffer->payload, aData, aDataSize); #if CHIP_SYSTEM_CONFIG_USE_LWIP + // Checks in the New() call catch buffer allocations greater + // than UINT16_MAX for LwIP based platforms. buffer.mBuffer->len = buffer.mBuffer->tot_len = static_cast(aDataSize); #else buffer.mBuffer->len = buffer.mBuffer->tot_len = aDataSize; @@ -755,18 +774,18 @@ PacketBufferHandle PacketBufferHandle::CloneData() const size_t originalDataSize = original->MaxDataLength(); uint16_t originalReservedSize = original->ReservedSize(); - if (originalDataSize + originalReservedSize > PacketBuffer::kMaxSizeWithoutReserve) + if (originalDataSize + originalReservedSize > PacketBuffer::kMaxAllocSize) { // The original memory allocation may have provided a larger block than requested (e.g. when using a shared pool), // and in particular may have provided a larger block than we are able to request from PackBufferHandle::New(). // It is a genuine error if that extra space has been used. - if (originalReservedSize + original->DataLength() > PacketBuffer::kMaxSizeWithoutReserve) + if (originalReservedSize + original->DataLength() > PacketBuffer::kMaxAllocSize) { return PacketBufferHandle(); } // Otherwise, reduce the requested data size. This subtraction can not underflow because the above test - // guarantees originalReservedSize <= PacketBuffer::kMaxSizeWithoutReserve. - originalDataSize = PacketBuffer::kMaxSizeWithoutReserve - originalReservedSize; + // guarantees originalReservedSize <= PacketBuffer::kMaxAllocSize. + originalDataSize = PacketBuffer::kMaxAllocSize - originalReservedSize; } PacketBufferHandle clone = PacketBufferHandle::New(originalDataSize, originalReservedSize); diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 41eaef6d9e305c..5068822c7f22a4 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -119,7 +119,7 @@ class DLL_EXPORT PacketBuffer : private pbuf public: /** - * The maximum size buffer an application can allocate with no protocol header reserve. + * The maximum size of a regular buffer an application can allocate with no protocol header reserve. */ #if CHIP_SYSTEM_CONFIG_USE_LWIP static constexpr size_t kMaxSizeWithoutReserve = LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE); @@ -134,10 +134,30 @@ class DLL_EXPORT PacketBuffer : private pbuf static constexpr uint16_t kDefaultHeaderReserve = CHIP_SYSTEM_CONFIG_HEADER_RESERVE_SIZE; /** - * The maximum size buffer an application can allocate with the default protocol header reserve. + * The maximum size of a regular buffer an application can allocate with the default protocol header reserve. */ static constexpr size_t kMaxSize = kMaxSizeWithoutReserve - kDefaultHeaderReserve; + /** + * The maximum size of a large buffer(> IPv6 MTU) that an application can allocate with no protocol header reserve. + */ + static constexpr size_t kLargeBufMaxSizeWithoutReserve = CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES; + + /** + * The maximum size of a large buffer(> IPv6 MTU) that an application can allocate with the default protocol header reserve. + */ + static constexpr size_t kLargeBufMaxSize = kLargeBufMaxSizeWithoutReserve - kDefaultHeaderReserve; + + /** + * Unified constant(both regular and large buffers) for the maximum size that an application can allocate with no + * protocol header reserve. + */ +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + static constexpr size_t kMaxAllocSize = kLargeBufMaxSizeWithoutReserve; +#else + static constexpr size_t kMaxAllocSize = kMaxSizeWithoutReserve; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + /** * Return the size of the allocation including the reserved and payload data spaces but not including space * allocated for the PacketBuffer structure. diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index bf1456487307a3..e445eed17a38e9 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -300,7 +300,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckNew) { const PacketBufferHandle buffer = PacketBufferHandle::New(0, config.reserved_size); - if (config.reserved_size > PacketBuffer::kMaxSizeWithoutReserve) + if (config.reserved_size > PacketBuffer::kMaxAllocSize) { EXPECT_TRUE(buffer.IsNull()); continue; @@ -1596,7 +1596,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleRightSize) TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) { - uint8_t lPayload[2 * PacketBuffer::kMaxSizeWithoutReserve]; + uint8_t lPayload[2 * PacketBuffer::kMaxAllocSize]; + for (uint8_t & payload : lPayload) { payload = static_cast(random()); @@ -1675,7 +1676,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) // This is only testable on heap allocation configurations, where pbuf records the allocation size and we can manually // construct an oversize buffer. - constexpr uint16_t kOversizeDataSize = PacketBuffer::kMaxSizeWithoutReserve + 99; + constexpr size_t kOversizeDataSize = PacketBuffer::kMaxAllocSize + 99; PacketBuffer * p = reinterpret_cast(chip::Platform::MemoryAlloc(kStructureSize + kOversizeDataSize)); ASSERT_NE(p, nullptr); @@ -1689,15 +1690,16 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckHandleCloneData) PacketBufferHandle handle = PacketBufferHandle::Adopt(p); // Fill the buffer to maximum and verify that it can be cloned. + size_t maxSize = PacketBuffer::kMaxAllocSize; - memset(handle->Start(), 1, PacketBuffer::kMaxSizeWithoutReserve); - handle->SetDataLength(PacketBuffer::kMaxSizeWithoutReserve); - EXPECT_EQ(handle->DataLength(), PacketBuffer::kMaxSizeWithoutReserve); + memset(handle->Start(), 1, maxSize); + handle->SetDataLength(maxSize); + EXPECT_EQ(handle->DataLength(), maxSize); PacketBufferHandle clone = handle.CloneData(); ASSERT_FALSE(clone.IsNull()); - EXPECT_EQ(clone->DataLength(), PacketBuffer::kMaxSizeWithoutReserve); - EXPECT_EQ(memcmp(handle->Start(), clone->Start(), PacketBuffer::kMaxSizeWithoutReserve), 0); + EXPECT_EQ(clone->DataLength(), maxSize); + EXPECT_EQ(memcmp(handle->Start(), clone->Start(), maxSize), 0); // Overfill the buffer and verify that it can not be cloned. memset(handle->Start(), 2, kOversizeDataSize); diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp index 3b70026c5681d6..263b4e5e127a5a 100644 --- a/src/transport/SecureMessageCodec.cpp +++ b/src/transport/SecureMessageCodec.cpp @@ -41,7 +41,6 @@ CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView { VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); - VerifyOrReturnError(msgBuf->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(msgBuf)); diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index d49e66fb6f5116..00acc485d47d23 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -201,6 +201,15 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P packetHeader.SetSecureSessionControlMsg(true); } + if (sessionHandle->AllowsLargePayload()) + { + VerifyOrReturnError(message->TotalLength() <= kMaxLargeAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); + } + else + { + VerifyOrReturnError(message->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); + } + #if CHIP_PROGRESS_LOGGING NodeId destination; FabricIndex fabricIndex; diff --git a/src/transport/raw/MessageHeader.h b/src/transport/raw/MessageHeader.h index ef4f86d3993793..2752a5c86c82c2 100644 --- a/src/transport/raw/MessageHeader.h +++ b/src/transport/raw/MessageHeader.h @@ -60,7 +60,6 @@ static constexpr size_t kMaxPacketBufferApplicationPayloadAndMICSizeBytes = Syst static constexpr size_t kMaxApplicationPayloadAndMICSizeBytes = min(kMaxPerSpecApplicationPayloadAndMICSizeBytes, kMaxPacketBufferApplicationPayloadAndMICSizeBytes); - } // namespace detail static constexpr size_t kMaxTagLen = 16; @@ -74,6 +73,16 @@ static constexpr size_t kMaxAppMessageLen = detail::kMaxApplicationPayloadAndMIC static constexpr uint16_t kMsgUnicastSessionIdUnsecured = 0x0000; +// Minimum header size of TCP + IPv6 without options. +static constexpr size_t kMaxTCPAndIPHeaderSizeBytes = 60; + +// Max space for the Application Payload and MIC for large packet buffers +// This is the size _excluding_ the header reserve. +static constexpr size_t kMaxLargeApplicationPayloadAndMICSizeBytes = + System::PacketBuffer::kLargeBufMaxSize - kMaxTCPAndIPHeaderSizeBytes; + +static constexpr size_t kMaxLargeAppMessageLen = kMaxLargeApplicationPayloadAndMICSizeBytes - kMaxTagLen; + typedef int PacketHeaderFlags; namespace Header { diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index e33590a63a6fdf..b928c3e91cccae 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -39,11 +39,15 @@ namespace { using namespace chip::Encoding; -// Packets start with a 16-bit size -constexpr size_t kPacketSizeBytes = 2; +// Packets start with a 32-bit size field. +constexpr size_t kPacketSizeBytes = 4; -// TODO: Actual limit may be lower (spec issue #2119) -constexpr uint16_t kMaxMessageSize = static_cast(System::PacketBuffer::kMaxSizeWithoutReserve - kPacketSizeBytes); +static_assert(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve <= UINT32_MAX, "Cast below could truncate the value"); +static_assert(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve >= kPacketSizeBytes, + "Large buffer allocation should be large enough to hold the length field"); + +constexpr uint32_t kMaxTCPMessageSize = + static_cast(System::PacketBuffer::kLargeBufMaxSizeWithoutReserve - kPacketSizeBytes); constexpr int kListenBacklogSize = 2; @@ -197,21 +201,21 @@ ActiveTCPConnectionState * TCPBase::FindInUseConnection(const Inet::TCPEndPoint CHIP_ERROR TCPBase::SendMessage(const Transport::PeerAddress & address, System::PacketBufferHandle && msgBuf) { // Sent buffer data format is: - // - packet size as a uint16_t + // - packet size as a uint32_t // - actual data VerifyOrReturnError(address.GetTransportType() == Type::kTcp, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(mState == TCPState::kInitialized, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(kPacketSizeBytes + msgBuf->DataLength() <= std::numeric_limits::max(), + VerifyOrReturnError(kPacketSizeBytes + msgBuf->DataLength() <= System::PacketBuffer::kLargeBufMaxSizeWithoutReserve, CHIP_ERROR_INVALID_ARGUMENT); - // The check above about kPacketSizeBytes + msgBuf->DataLength() means it definitely fits in uint16_t. + static_assert(kPacketSizeBytes <= UINT16_MAX); VerifyOrReturnError(msgBuf->EnsureReservedSize(static_cast(kPacketSizeBytes)), CHIP_ERROR_NO_MEMORY); msgBuf->SetStart(msgBuf->Start() - kPacketSizeBytes); uint8_t * output = msgBuf->Start(); - LittleEndian::Write16(output, static_cast(msgBuf->DataLength() - kPacketSizeBytes)); + LittleEndian::Write32(output, static_cast(msgBuf->DataLength() - kPacketSizeBytes)); // Reuse existing connection if one exists, otherwise a new one // will be established @@ -324,10 +328,9 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe { return err; } - uint16_t messageSize = LittleEndian::Get16(messageSizeBuf); - if (messageSize >= kMaxMessageSize) + uint32_t messageSize = LittleEndian::Get32(messageSizeBuf); + if (messageSize >= kMaxTCPMessageSize) { - // This message is too long for upper layers. return CHIP_ERROR_MESSAGE_TOO_LONG; } @@ -344,7 +347,7 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe return CHIP_NO_ERROR; } -CHIP_ERROR TCPBase::ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, uint16_t messageSize) +CHIP_ERROR TCPBase::ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, size_t messageSize) { // We enter with `state->mReceived` containing at least one full message, perhaps in a chain. // `state->mReceived->Start()` currently points to the message data. diff --git a/src/transport/raw/TCP.h b/src/transport/raw/TCP.h index 783f3844d2d16d..1cb7aa9634ba16 100644 --- a/src/transport/raw/TCP.h +++ b/src/transport/raw/TCP.h @@ -258,7 +258,7 @@ class DLL_EXPORT TCPBase : public Base * is no other data). * @param[in] messageSize Size of the single message. */ - CHIP_ERROR ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, uint16_t messageSize); + CHIP_ERROR ProcessSingleMessage(const PeerAddress & peerAddress, ActiveTCPConnectionState * state, size_t messageSize); /** * Initiate a connection to the given peer. On connection completion, @@ -306,10 +306,6 @@ class DLL_EXPORT TCPBase : public Base // giving up. uint32_t mConnectTimeout = CHIP_CONFIG_TCP_CONNECT_TIMEOUT_MSECS; - // The max payload size of data over a TCP connection that is transmissible - // at a time. - uint32_t mMaxTCPPayloadSize = CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES; - // Number of active and 'pending connection' endpoints size_t mUsedEndPointCount = 0; diff --git a/src/transport/raw/TCPConfig.h b/src/transport/raw/TCPConfig.h index d54a9466b4d294..4f95978985fd63 100644 --- a/src/transport/raw/TCPConfig.h +++ b/src/transport/raw/TCPConfig.h @@ -63,15 +63,6 @@ namespace chip { #define CHIP_CONFIG_MAX_TCP_PENDING_PACKETS 4 #endif -/** - * @def CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES - * - * @brief Maximum payload size of a message over a TCP connection - */ -#ifndef CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES -#define CHIP_CONFIG_MAX_TCP_PAYLOAD_SIZE_BYTES 1000000 -#endif - /** * @def CHIP_CONFIG_TCP_CONNECT_TIMEOUT_MSECS * diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index f5e343f1a2ea79..dbce3b8ce5ef43 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -51,7 +51,7 @@ namespace { constexpr size_t kMaxTcpActiveConnectionCount = 4; constexpr size_t kMaxTcpPendingPackets = 4; -constexpr uint16_t kPacketSizeBytes = static_cast(sizeof(uint16_t)); +constexpr size_t kPacketSizeBytes = sizeof(uint32_t); uint16_t gChipTCPPort = static_cast(CHIP_PORT + chip::Crypto::GetRandU16() % 100); chip::Transport::AppTCPConnectionCallbackCtxt gAppTCPConnCbCtxt; chip::Transport::ActiveTCPConnectionState * gActiveTCPConnState = nullptr; @@ -298,7 +298,7 @@ struct TestData // the last buffer will be made larger. TestData() : mPayload(nullptr), mTotalLength(0), mMessageLength(0), mMessageOffset(0) {} ~TestData() { Free(); } - bool Init(const uint16_t sizes[]); + bool Init(const uint32_t sizes[]); void Free(); bool IsValid() { return !mHandle.IsNull() && (mPayload != nullptr); } @@ -309,7 +309,7 @@ struct TestData size_t mMessageOffset; }; -bool TestData::Init(const uint16_t sizes[]) +bool TestData::Init(const uint32_t sizes[]) { Free(); @@ -325,17 +325,17 @@ bool TestData::Init(const uint16_t sizes[]) mTotalLength += sizes[bufferCount]; } --bufferCount; - uint16_t additionalLength = 0; + uint32_t additionalLength = 0; if (headerLength + kPacketSizeBytes > mTotalLength) { - additionalLength = static_cast((headerLength + kPacketSizeBytes) - mTotalLength); + additionalLength = static_cast((headerLength + kPacketSizeBytes) - mTotalLength); mTotalLength += additionalLength; } - if (mTotalLength > UINT16_MAX) + if (mTotalLength > UINT32_MAX) { return false; } - uint16_t messageLength = static_cast(mTotalLength - kPacketSizeBytes); + uint32_t messageLength = static_cast(mTotalLength - kPacketSizeBytes); // Build the test payload. uint8_t * payload = static_cast(chip::Platform::MemoryCalloc(1, mTotalLength)); @@ -343,7 +343,7 @@ bool TestData::Init(const uint16_t sizes[]) { return false; } - chip::Encoding::LittleEndian::Put16(payload, messageLength); + chip::Encoding::LittleEndian::Put32(payload, messageLength); uint16_t headerSize; CHIP_ERROR err = header.Encode(payload + kPacketSizeBytes, messageLength, &headerSize); if (err != CHIP_NO_ERROR) @@ -363,10 +363,10 @@ bool TestData::Init(const uint16_t sizes[]) System::PacketBufferHandle head = chip::System::PacketBufferHandle::New(sizes[0], 0 /* reserve */); for (int i = 1; i <= bufferCount; ++i) { - uint16_t size = sizes[i]; + size_t size = sizes[i]; if (i == bufferCount) { - size = static_cast(size + additionalLength); + size = size + additionalLength; } chip::System::PacketBufferHandle buffer = chip::System::PacketBufferHandle::New(size, 0 /* reserve */); if (buffer.IsNull()) @@ -395,7 +395,7 @@ bool TestData::Init(const uint16_t sizes[]) if (lToWriteToCurrentBuf != 0) { memcpy(iterator->Start(), writePayload, lToWriteToCurrentBuf); - iterator->SetDataLength(static_cast(iterator->DataLength() + lToWriteToCurrentBuf), head); + iterator->SetDataLength(iterator->DataLength() + lToWriteToCurrentBuf, head); writePayload += lToWriteToCurrentBuf; writeLength -= lToWriteToCurrentBuf; } @@ -634,22 +634,22 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) // Test a single packet buffer. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 111, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 111, 0 })); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); // Test a message in a chain of three packet buffers. The message length is split across buffers. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 1, 122, 123, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 1, 122, 123, 0 })); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); // Test two messages in a chain. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 131, 0 })); - EXPECT_TRUE(testData[1].Init((const uint16_t[]){ 132, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 131, 0 })); + EXPECT_TRUE(testData[1].Init((const uint32_t[]){ 132, 0 })); testData[0].mHandle->AddToEnd(std::move(testData[1].mHandle)); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); @@ -657,17 +657,25 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) // Test a chain of two messages, each a chain. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 141, 142, 0 })); - EXPECT_TRUE(testData[1].Init((const uint16_t[]){ 143, 144, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 141, 142, 0 })); + EXPECT_TRUE(testData[1].Init((const uint32_t[]){ 143, 144, 0 })); testData[0].mHandle->AddToEnd(std::move(testData[1].mHandle)); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); EXPECT_EQ(err, CHIP_NO_ERROR); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 2); + // Test a single packet buffer that is larger than + // kMaxSizeWithoutReserve but less than CHIP_CONFIG_MAX_LARGE_PAYLOAD_SIZE_BYTES. + gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ System::PacketBuffer::kMaxSizeWithoutReserve + 1, 0 })); + err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(testData[0].mHandle)); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 1); + // Test a message that is too large to coalesce into a single packet buffer. gMockTransportMgrDelegate.mReceiveHandlerCallCount = 0; gMockTransportMgrDelegate.SetCallback(TestDataCallbackCheck, &testData[1]); - EXPECT_TRUE(testData[0].Init((const uint16_t[]){ 51, System::PacketBuffer::kMaxSizeWithoutReserve, 0 })); + EXPECT_TRUE(testData[0].Init((const uint32_t[]){ 51, CHIP_SYSTEM_CONFIG_MAX_LARGE_BUFFER_SIZE_BYTES, 0 })); // Sending only the first buffer of the long chain. This should be enough to trigger the error. System::PacketBufferHandle head = testData[0].mHandle.PopHead(); err = TestAccess::ProcessReceivedBuffer(tcp, lEndPoint, lPeerAddress, std::move(head)); From 2005be9b4ad626ffd2aa8d30df82ef2f3ec24337 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 15:30:09 -0400 Subject: [PATCH 22/78] Make subscription latency estimation in MTRDevice a bit less noisy. (#33717) Averages out the new latency with (lower weighted) previous ones. --- src/darwin/Framework/CHIP/MTRDevice.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index dcb6a9acd8da64..01f22543cde160 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -308,6 +308,13 @@ - (BOOL)isEqual:(id)object // happen more often than once every 10 minutes. #define MTRDEVICE_MIN_RESUBSCRIBE_DUE_TO_READ_INTERVAL_SECONDS (10 * 60) +// Weight of new data in determining subscription latencies. To avoid random +// outliers causing too much noise in the value, treat an existing value (if +// any) as having 2/3 weight and the new value as having 1/3 weight. These +// weights are subject to change, if it's determined that different ones give +// better behavior. +#define MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT (1.0 / 3.0) + @interface MTRDevice () @property (nonatomic, readonly) os_unfair_lock lock; // protects the caches and device state // protects against concurrent time updates by guarding timeUpdateScheduled flag which manages time updates scheduling, @@ -1014,7 +1021,12 @@ - (void)_handleSubscriptionEstablished // We want time interval from initialSubscribeStart to now, not the other // way around. NSTimeInterval subscriptionLatency = -[initialSubscribeStart timeIntervalSinceNow]; - _estimatedSubscriptionLatency = @(subscriptionLatency); + if (_estimatedSubscriptionLatency == nil) { + _estimatedSubscriptionLatency = @(subscriptionLatency); + } else { + NSTimeInterval newSubscriptionLatencyEstimate = MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT * subscriptionLatency + (1 - MTRDEVICE_SUBSCRIPTION_LATENCY_NEW_VALUE_WEIGHT) * _estimatedSubscriptionLatency.doubleValue; + _estimatedSubscriptionLatency = @(newSubscriptionLatencyEstimate); + } [self _storePersistedDeviceData]; } From d3cac0c8771ae2d7c0be89fa69e20dec0f3786e9 Mon Sep 17 00:00:00 2001 From: Philip Gregor <147669098+pgregorr-amazon@users.noreply.github.com> Date: Wed, 5 Jun 2024 13:27:44 -0700 Subject: [PATCH 23/78] Android tv-casting-app v1.3 Commissioner-Generated passcode flow (#33680) * Android tv-casting-app v1.3 Commissioner-Generated passcode flow * Fixing style issues * Fixing style issues 2 * Addressed comments by sharadb-amazon * Fixing style issue * Addressed comments by sharadb-amazon part 2 * Addressed comments by sharadb-amazon part3 * Addressed comments by sharadb-amazon and fix Darwin compile issue --- .../com/chip/casting/app/MainActivity.java | 40 ++- .../casting/ActionSelectorFragment.java | 30 +- ...ationBasicReadVendorIDExampleFragment.java | 25 +- .../casting/ConnectionExampleFragment.java | 258 ++++++++++++++++-- ...ntentLauncherLaunchURLExampleFragment.java | 25 +- .../casting/DiscoveryExampleFragment.java | 40 ++- .../casting/EndpointSelectorExample.java | 23 +- .../matter/casting/InitializationExample.java | 40 ++- ...ubscribeToCurrentStateExampleFragment.java | 24 +- .../com/matter/casting/core/CastingApp.java | 45 ++- .../matter/casting/core/CastingPlayer.java | 111 ++++++-- .../jni/com/matter/casting/core/Endpoint.java | 22 +- .../casting/core/MatterCastingPlayer.java | 132 ++++++--- .../casting/support/CommissionableData.java | 8 + .../support/CommissionerDeclaration.java | 172 ++++++++++++ .../casting/support/ConnectionCallbacks.java | 53 ++++ .../matter/casting/support/DataProvider.java | 8 +- .../IdentificationDeclarationOptions.java | 145 ++++++++++ .../matter/casting/support/TargetAppInfo.java | 25 ++ .../src/main/jni/cpp/core/CastingApp-JNI.cpp | 26 +- .../jni/cpp/core/MatterCastingPlayer-JNI.cpp | 210 +++++++++----- .../jni/cpp/core/MatterCastingPlayer-JNI.h | 20 +- .../main/jni/cpp/support/Converters-JNI.cpp | 176 ++++++++++++ .../src/main/jni/cpp/support/Converters-JNI.h | 25 ++ .../main/jni/cpp/support/MatterCallback-JNI.h | 2 + .../res/layout/custom_passcode_dialog.xml | 39 +++ .../App/app/src/main/res/values/strings.xml | 4 +- examples/tv-casting-app/android/BUILD.gn | 4 + .../linux/simple-app-helper.cpp | 23 +- .../tv-casting-common/core/CastingPlayer.cpp | 83 +++++- .../tv-casting-common/core/CastingPlayer.h | 52 ++-- .../core/ConnectionCallbacks.h | 6 +- .../core/IdentificationDeclarationOptions.h | 21 +- .../support/ChipDeviceEventHandler.cpp | 5 + .../support/ChipDeviceEventHandler.h | 5 + .../UserDirectedCommissioning.h | 1 + .../UserDirectedCommissioningClient.cpp | 12 +- 37 files changed, 1642 insertions(+), 298 deletions(-) create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java index cb04518f5c6259..685dbf2fb6426e 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java @@ -66,9 +66,11 @@ public void handleCommissioningButtonClicked(DiscoveredNodeData commissioner) { } @Override - public void handleConnectionButtonClicked(CastingPlayer castingPlayer) { - Log.i(TAG, "MainActivity.handleConnectionButtonClicked() called"); - showFragment(ConnectionExampleFragment.newInstance(castingPlayer)); + public void handleConnectionButtonClicked( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "MainActivity.handleConnectionButtonClicked()"); + showFragment( + ConnectionExampleFragment.newInstance(castingPlayer, useCommissionerGeneratedPasscode)); } @Override @@ -77,26 +79,35 @@ public void handleCommissioningComplete() { } @Override - public void handleConnectionComplete(CastingPlayer castingPlayer) { - Log.i(TAG, "MainActivity.handleConnectionComplete() called "); - showFragment(ActionSelectorFragment.newInstance(castingPlayer)); + public void handleConnectionComplete( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "MainActivity.handleConnectionComplete()"); + showFragment( + ActionSelectorFragment.newInstance(castingPlayer, useCommissionerGeneratedPasscode)); } @Override - public void handleContentLauncherLaunchURLSelected(CastingPlayer selectedCastingPlayer) { - showFragment(ContentLauncherLaunchURLExampleFragment.newInstance(selectedCastingPlayer)); + public void handleContentLauncherLaunchURLSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + showFragment( + ContentLauncherLaunchURLExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override - public void handleApplicationBasicReadVendorIDSelected(CastingPlayer selectedCastingPlayer) { - showFragment(ApplicationBasicReadVendorIDExampleFragment.newInstance(selectedCastingPlayer)); + public void handleApplicationBasicReadVendorIDSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + showFragment( + ApplicationBasicReadVendorIDExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override public void handleMediaPlaybackSubscribeToCurrentStateSelected( - CastingPlayer selectedCastingPlayer) { + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { showFragment( - MediaPlaybackSubscribeToCurrentStateExampleFragment.newInstance(selectedCastingPlayer)); + MediaPlaybackSubscribeToCurrentStateExampleFragment.newInstance( + selectedCastingPlayer, useCommissionerGeneratedPasscode)); } @Override @@ -148,7 +159,10 @@ private boolean initJni() { private void showFragment(Fragment fragment, boolean showOnBack) { Log.d( TAG, - "showFragment() called with " + fragment.getClass().getSimpleName() + " and " + showOnBack); + "showFragment() called with: " + + fragment.getClass().getSimpleName() + + ", and showOnBack: " + + showOnBack); FragmentTransaction fragmentTransaction = getSupportFragmentManager() .beginTransaction() diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java index cb5d2170e96d6d..a931d1ff3baf44 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ActionSelectorFragment.java @@ -31,14 +31,17 @@ public class ActionSelectorFragment extends Fragment { private static final String TAG = ActionSelectorFragment.class.getSimpleName(); private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener selectContentLauncherButtonClickListener; private View.OnClickListener selectApplicationBasicButtonClickListener; private View.OnClickListener selectMediaPlaybackButtonClickListener; private View.OnClickListener disconnectButtonClickListener; - public ActionSelectorFragment(CastingPlayer selectedCastingPlayer) { + public ActionSelectorFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** @@ -46,10 +49,13 @@ public ActionSelectorFragment(CastingPlayer selectedCastingPlayer) { * parameters. * * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated passcode commissioning flow. * @return A new instance of fragment SelectActionFragment. */ - public static ActionSelectorFragment newInstance(CastingPlayer selectedCastingPlayer) { - return new ActionSelectorFragment(selectedCastingPlayer); + public static ActionSelectorFragment newInstance( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new ActionSelectorFragment(selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -64,17 +70,20 @@ public View onCreateView( this.selectContentLauncherButtonClickListener = v -> { Log.d(TAG, "handle() called on selectContentLauncherButtonClickListener"); - callback.handleContentLauncherLaunchURLSelected(selectedCastingPlayer); + callback.handleContentLauncherLaunchURLSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.selectApplicationBasicButtonClickListener = v -> { Log.d(TAG, "handle() called on selectApplicationBasicButtonClickListener"); - callback.handleApplicationBasicReadVendorIDSelected(selectedCastingPlayer); + callback.handleApplicationBasicReadVendorIDSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.selectMediaPlaybackButtonClickListener = v -> { Log.d(TAG, "handle() called on selectMediaPlaybackButtonClickListener"); - callback.handleMediaPlaybackSubscribeToCurrentStateSelected(selectedCastingPlayer); + callback.handleMediaPlaybackSubscribeToCurrentStateSelected( + selectedCastingPlayer, useCommissionerGeneratedPasscode); }; this.disconnectButtonClickListener = @@ -107,13 +116,16 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { /** Interface for notifying the host. */ public interface Callback { /** Notifies listener to trigger transition on selection of Content Launcher cluster */ - void handleContentLauncherLaunchURLSelected(CastingPlayer selectedCastingPlayer); + void handleContentLauncherLaunchURLSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on selection of Application Basic cluster */ - void handleApplicationBasicReadVendorIDSelected(CastingPlayer selectedCastingPlayer); + void handleApplicationBasicReadVendorIDSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on selection of Media PLayback cluster */ - void handleMediaPlaybackSubscribeToCurrentStateSelected(CastingPlayer selectedCastingPlayer); + void handleMediaPlaybackSubscribeToCurrentStateSelected( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode); /** Notifies listener to trigger transition on click of the Disconnect button */ void handleDisconnect(); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java index 878c18019f4d09..b64d10ce811332 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java @@ -37,25 +37,32 @@ public class ApplicationBasicReadVendorIDExampleFragment extends Fragment { private static final String TAG = ApplicationBasicReadVendorIDExampleFragment.class.getSimpleName(); + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener readButtonClickListener; - public ApplicationBasicReadVendorIDExampleFragment(CastingPlayer selectedCastingPlayer) { + public ApplicationBasicReadVendorIDExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment ApplicationBasicReadVendorIDExampleFragment. */ public static ApplicationBasicReadVendorIDExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new ApplicationBasicReadVendorIDExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new ApplicationBasicReadVendorIDExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -68,8 +75,14 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.readButtonClickListener = v -> { - Endpoint endpoint = - EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java index 690a9b02e840bc..1bf95ef4a2d7eb 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ConnectionExampleFragment.java @@ -16,20 +16,27 @@ */ package com.matter.casting; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; +import android.widget.EditText; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.R; import com.matter.casting.core.CastingPlayer; -import com.matter.casting.support.EndpointFilter; +import com.matter.casting.support.CommissionerDeclaration; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterCallback; import com.matter.casting.support.MatterError; +import com.matter.casting.support.TargetAppInfo; import java.util.concurrent.Executors; /** A {@link Fragment} to Verify or establish a connection with a selected Casting Player. */ @@ -37,18 +44,28 @@ public class ConnectionExampleFragment extends Fragment { private static final String TAG = ConnectionExampleFragment.class.getSimpleName(); // Time (in sec) to keep the commissioning window open, if commissioning is required. // Must be >= 3 minutes. - private static final long MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; - private static final Integer DESIRED_ENDPOINT_VENDOR_ID = 65521; + private static final short MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; + private static final Integer DESIRED_TARGET_APP_VENDOR_ID = 65521; + // Use this Target Content Application Vendor ID, configured on the tv-app, to demonstrate the + // CastingPlayer/Commissioner-Generated passcode commissioning flow. + private static final Integer DESIRED_TARGET_APP_VENDOR_ID_FOR_CGP_FLOW = 1111; + private static final long DEFAULT_COMMISSIONER_GENERATED_PASSCODE = 12345678; + private static final int DEFAULT_DISCRIMINATOR_FOR_CGP_FLOW = 0; private final CastingPlayer targetCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private TextView connectionFragmentStatusTextView; private Button connectionFragmentNextButton; - public ConnectionExampleFragment(CastingPlayer targetCastingPlayer) { + public ConnectionExampleFragment( + CastingPlayer targetCastingPlayer, boolean useCommissionerGeneratedPasscode) { Log.i( TAG, - "ConnectionExampleFragment() called with target CastingPlayer ID: " - + targetCastingPlayer.getDeviceId()); + "ConnectionExampleFragment() Target CastingPlayer ID: " + + targetCastingPlayer.getDeviceId() + + ", useCommissionerGeneratedPasscode: " + + useCommissionerGeneratedPasscode); this.targetCastingPlayer = targetCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** @@ -57,21 +74,22 @@ public ConnectionExampleFragment(CastingPlayer targetCastingPlayer) { * * @return A new instance of fragment ConnectionExampleFragment. */ - public static ConnectionExampleFragment newInstance(CastingPlayer castingPlayer) { - Log.i(TAG, "newInstance() called"); - return new ConnectionExampleFragment(castingPlayer); + public static ConnectionExampleFragment newInstance( + CastingPlayer castingPlayer, Boolean useCommissionerGeneratedPasscode) { + Log.i(TAG, "newInstance()"); + return new ConnectionExampleFragment(castingPlayer, useCommissionerGeneratedPasscode); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - Log.i(TAG, "onCreate() called"); + Log.i(TAG, "onCreate()"); } @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Log.i(TAG, "onCreateView() called"); + Log.i(TAG, "onCreateView()"); // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_matter_connection_example, container, false); } @@ -79,23 +97,30 @@ public View onCreateView( @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - Log.i(TAG, "onViewCreated() called"); + Log.i(TAG, "onViewCreated()"); connectionFragmentStatusTextView = getView().findViewById(R.id.connectionFragmentStatusText); - connectionFragmentStatusTextView.setText( - "Verifying or establishing connection with Casting Player with device name: " - + targetCastingPlayer.getDeviceName() - + "\nSetup Passcode: " - + InitializationExample.commissionableDataProvider.get().getSetupPasscode() - + "\nDiscriminator: " - + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + if (useCommissionerGeneratedPasscode) { + connectionFragmentStatusTextView.setText( + "Verifying or establishing connection with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\n\nAttempting CastingPlayer/Commissioner-Generated passcode commissioning."); + } else { + connectionFragmentStatusTextView.setText( + "Verifying or establishing connection with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\nClient/Commissionee-Generated Setup Passcode: " + + InitializationExample.commissionableDataProvider.get().getSetupPasscode() + + "\nDiscriminator: " + + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + } connectionFragmentNextButton = getView().findViewById(R.id.connectionFragmentNextButton); Callback callback = (ConnectionExampleFragment.Callback) this.getActivity(); connectionFragmentNextButton.setOnClickListener( v -> { Log.i(TAG, "onViewCreated() NEXT clicked. Calling handleConnectionComplete()"); - callback.handleConnectionComplete(targetCastingPlayer); + callback.handleConnectionComplete(targetCastingPlayer, useCommissionerGeneratedPasscode); }); Executors.newSingleThreadExecutor() @@ -103,25 +128,42 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { () -> { Log.d(TAG, "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection()"); - EndpointFilter desiredEndpointFilter = new EndpointFilter(); - desiredEndpointFilter.vendorId = DESIRED_ENDPOINT_VENDOR_ID; + IdentificationDeclarationOptions idOptions = new IdentificationDeclarationOptions(); + TargetAppInfo targetAppInfo = new TargetAppInfo(); + targetAppInfo.vendorId = DESIRED_TARGET_APP_VENDOR_ID; - MatterError err = - targetCastingPlayer.verifyOrEstablishConnection( - MIN_CONNECTION_TIMEOUT_SEC, - desiredEndpointFilter, + if (useCommissionerGeneratedPasscode) { + idOptions.commissionerPasscode = true; + targetAppInfo.vendorId = DESIRED_TARGET_APP_VENDOR_ID_FOR_CGP_FLOW; + Log.d( + TAG, + "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection() Target Content Application Vendor ID: " + + targetAppInfo.vendorId + + ", useCommissionerGeneratedPasscode: " + + useCommissionerGeneratedPasscode); + } else { + Log.d( + TAG, + "onViewCreated() calling CastingPlayer.verifyOrEstablishConnection() Target Content Application Vendor ID: " + + targetAppInfo.vendorId); + } + + idOptions.addTargetAppInfo(targetAppInfo); + + ConnectionCallbacks connectionCallbacks = + new ConnectionCallbacks( new MatterCallback() { @Override public void handle(Void v) { Log.i( TAG, - "Connected to CastingPlayer with deviceId: " + "Successfully connected to CastingPlayer with deviceId: " + targetCastingPlayer.getDeviceId()); getActivity() .runOnUiThread( () -> { connectionFragmentStatusTextView.setText( - "Connected to Casting Player with device name: " + "Successfully connected to Casting Player with device name: " + targetCastingPlayer.getDeviceName() + "\n\n"); connectionFragmentNextButton.setEnabled(true); @@ -139,7 +181,39 @@ public void handle(MatterError err) { "Casting Player connection failed due to: " + err + "\n\n"); }); } - }); + }, + null); + + // CommissionerDeclaration is only needed for the CastingPlayer/Commissioner-Generated + // passcode commissioning flow. + if (useCommissionerGeneratedPasscode) { + connectionCallbacks.onCommissionerDeclaration = + new MatterCallback() { + @Override + public void handle(CommissionerDeclaration cd) { + Log.i(TAG, "CastingPlayer CommissionerDeclaration message received: "); + cd.logDetail(); + + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "CommissionerDeclaration message received from Casting Player: \n\n"); + if (cd.getCommissionerPasscode()) { + + displayPasscodeInputDialog(getActivity()); + + connectionFragmentStatusTextView.setText( + "CommissionerDeclaration message received from Casting Player: A passcode is now displayed for the user by the Casting Player. \n\n"); + } + }); + } + }; + } + + MatterError err = + targetCastingPlayer.verifyOrEstablishConnection( + connectionCallbacks, MIN_CONNECTION_TIMEOUT_SEC, idOptions); if (err.hasError()) { getActivity() @@ -152,9 +226,133 @@ public void handle(MatterError err) { }); } + private void displayPasscodeInputDialog(Context context) { + AlertDialog.Builder builder = new AlertDialog.Builder(context); + + LayoutInflater inflater = LayoutInflater.from(context); + View dialogView = inflater.inflate(R.layout.custom_passcode_dialog, null); + + // Set up the input dialog with the default passcode + final EditText input = dialogView.findViewById(R.id.passcode_input); + input.setText("" + DEFAULT_COMMISSIONER_GENERATED_PASSCODE); + + // Set up the buttons + builder.setPositiveButton( + "Continue Connecting", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + String passcode = input.getText().toString(); + Log.i( + TAG, + "displayPasscodeInputDialog() User entered CastingPlayer/Commissioner-Generated passcode: " + + passcode); + + // Display the user entered passcode on the screen + connectionFragmentStatusTextView.setText( + "Continue Connecting with user entered CastingPlayer/Commissioner-Generated passcode: " + + passcode + + "\n\n"); + + long passcodeLongValue = DEFAULT_COMMISSIONER_GENERATED_PASSCODE; + try { + passcodeLongValue = Long.parseLong(passcode); + Log.i( + TAG, + "displayPasscodeInputDialog() User entered CastingPlayer/Commissioner-Generated passcode: " + + passcodeLongValue); + } catch (NumberFormatException nfe) { + Log.e( + TAG, + "displayPasscodeInputDialog()User entered CastingPlayer/Commissioner-Generated passcode is not a valid integer. NumberFormatException: " + + nfe); + connectionFragmentStatusTextView.setText( + "User entered CastingPlayer/Commissioner-Generated passcode is not a valid integer: " + + passcode + + "\n\n"); + } + + // Update the CommissionableData DataProvider with the user entered + // CastingPlayer/Commissioner-Generated setup passcode. This is mandatory for + // Commissioner-Generated passcode commissioning since the commissioning session's PAKE + // verifier needs to be updated with the entered passcode. + InitializationExample.commissionableDataProvider.updateCommissionableDataSetupPasscode( + passcodeLongValue, DEFAULT_DISCRIMINATOR_FOR_CGP_FLOW); + + Log.i(TAG, "displayPasscodeInputDialog() calling continueConnecting()"); + connectionFragmentStatusTextView = + getView().findViewById(R.id.connectionFragmentStatusText); + connectionFragmentStatusTextView.setText( + "Continuing to connect with Casting Player with device name: " + + targetCastingPlayer.getDeviceName() + + "\nCastingPlayer/Commissioner-Generated Setup Passcode: " + + InitializationExample.commissionableDataProvider.get().getSetupPasscode() + + "\nDiscriminator: " + + InitializationExample.commissionableDataProvider.get().getDiscriminator()); + + MatterError err = targetCastingPlayer.continueConnecting(); + + if (err.hasError()) { + MatterError finalErr = err; + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "Casting Player CONTINUE CONNECTING failed due to: " + + finalErr + + "\n\n"); + }); + Log.e( + TAG, + "displayPasscodeInputDialog() continueConnecting() failed, calling stopConnecting() due to: " + + err); + // Since continueConnecting() failed, Attempt to cancel the connection attempt with + // the CastingPlayer/Commissioner. + err = targetCastingPlayer.stopConnecting(); + if (err.hasError()) { + Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err); + } + } + } + }); + + builder.setNegativeButton( + "Cancel", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Log.i( + TAG, + "displayPasscodeInputDialog() user cancelled the CastingPlayer/Commissioner-Generated Passcode input dialog. Calling stopConnecting()"); + connectionFragmentStatusTextView.setText( + "Connection attempt with Casting Player cancelled by the user, route back to exit. \n\n"); + MatterError err = targetCastingPlayer.stopConnecting(); + if (err.hasError()) { + MatterError finalErr = err; + getActivity() + .runOnUiThread( + () -> { + connectionFragmentStatusTextView.setText( + "Casting Player CANCEL failed due to: " + finalErr + "\n\n"); + }); + Log.e(TAG, "displayPasscodeInputDialog() stopConnecting() failed due to: " + err); + } + dialog.cancel(); + } + }); + + builder.setView(dialogView); + AlertDialog alertDialog = builder.create(); + alertDialog.show(); + alertDialog + .getWindow() + .setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); + } + /** Interface for notifying the host. */ public interface Callback { /** Notifies listener to trigger transition on completion of connection */ - void handleConnectionComplete(CastingPlayer castingPlayer); + void handleConnectionComplete( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode); } } diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java index ddf41b349d6890..e1cfc4a456112b 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java @@ -37,25 +37,32 @@ public class ContentLauncherLaunchURLExampleFragment extends Fragment { private static final String TAG = ContentLauncherLaunchURLExampleFragment.class.getSimpleName(); private static final Integer SAMPLE_ENDPOINT_VID = 65521; + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener launchUrlButtonClickListener; - public ContentLauncherLaunchURLExampleFragment(CastingPlayer selectedCastingPlayer) { + public ContentLauncherLaunchURLExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment ContentLauncherLaunchURLExampleFragment. */ public static ContentLauncherLaunchURLExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new ContentLauncherLaunchURLExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, Boolean useCommissionerGeneratedPasscode) { + return new ContentLauncherLaunchURLExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -68,8 +75,14 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.launchUrlButtonClickListener = v -> { - Endpoint endpoint = - EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java index 65d670584971aa..3dca2320b8924c 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/DiscoveryExampleFragment.java @@ -45,7 +45,7 @@ public class DiscoveryExampleFragment extends Fragment { private static final Long DISCOVERY_TARGET_DEVICE_TYPE = 35L; private static final int DISCOVERY_RUNTIME_SEC = 15; private TextView matterDiscoveryMessageTextView; - private TextView matterDiscoveryErrorMessageTextView; + public static TextView matterDiscoveryErrorMessageTextView; private static final List castingPlayerList = new ArrayList<>(); private static ArrayAdapter arrayAdapter; @@ -221,8 +221,8 @@ public void onPause() { /** Interface for notifying the host. */ public interface Callback { /** Notifies listener of Connection Button click. */ - // TODO: In following PRs. Implement CastingPlayer connection - void handleConnectionButtonClicked(CastingPlayer castingPlayer); + void handleConnectionButtonClicked( + CastingPlayer castingPlayer, boolean useCommissionerGeneratedPasscode); } private boolean startDiscovery() { @@ -320,6 +320,8 @@ public View getView(int i, View view, ViewGroup viewGroup) { Button playerDescription = view.findViewById(R.id.commissionable_player_description); playerDescription.setText(buttonText); + // OnClickListener for the CastingPLayer button, to be used for the Commissionee-Generated + // passcode commissioning flow. View.OnClickListener clickListener = v -> { CastingPlayer castingPlayer = playerList.get(i); @@ -329,9 +331,37 @@ public View getView(int i, View view, ViewGroup viewGroup) { + castingPlayer.getDeviceId()); DiscoveryExampleFragment.Callback onClickCallback = (DiscoveryExampleFragment.Callback) context; - onClickCallback.handleConnectionButtonClicked(castingPlayer); + onClickCallback.handleConnectionButtonClicked(castingPlayer, false); }; playerDescription.setOnClickListener(clickListener); + + // OnLongClickListener for the CastingPLayer button, to be used for the Commissioner-Generated + // passcode commissioning flow. + View.OnLongClickListener longClickListener = + v -> { + CastingPlayer castingPlayer = playerList.get(i); + if (!castingPlayer.getSupportsCommissionerGeneratedPasscode()) { + Log.e( + TAG, + "OnLongClickListener.onLongClick() called for CastingPlayer with deviceId " + + castingPlayer.getDeviceId() + + ". This CastingPlayer does not support Commissioner-Generated passcode commissioning."); + + DiscoveryExampleFragment.matterDiscoveryErrorMessageTextView.setText( + "The selected Casting Player does not support Commissioner-Generated passcode commissioning"); + return true; + } + Log.d( + TAG, + "OnLongClickListener.onLongClick() called for CastingPlayer with deviceId " + + castingPlayer.getDeviceId() + + ", attempting the Commissioner-Generated passcode commissioning flow."); + DiscoveryExampleFragment.Callback onClickCallback = + (DiscoveryExampleFragment.Callback) context; + onClickCallback.handleConnectionButtonClicked(castingPlayer, true); + return true; + }; + playerDescription.setOnLongClickListener(longClickListener); return view; } @@ -353,7 +383,7 @@ private String getCastingPlayerButtonText(CastingPlayer player) { aux += (aux.isEmpty() ? "" : ", ") + "Resolved IP?: " + (player.getIpAddresses().size() > 0); aux += (aux.isEmpty() ? "" : ", ") - + "Supports Commissioner Generated Passcode: " + + "Supports Commissioner-Generated Passcode: " + (player.getSupportsCommissionerGeneratedPasscode()); aux = aux.isEmpty() ? aux : "\n" + aux; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java index c2932c59117c64..5a906d7007d8b5 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/EndpointSelectorExample.java @@ -19,14 +19,33 @@ public static Endpoint selectFirstEndpointByVID(CastingPlayer selectedCastingPla if (selectedCastingPlayer != null) { List endpoints = selectedCastingPlayer.getEndpoints(); if (endpoints == null) { - Log.e(TAG, "No Endpoints found on CastingPlayer"); + Log.e(TAG, "selectFirstEndpointByVID() No Endpoints found on CastingPlayer"); } else { endpoint = endpoints .stream() .filter(e -> SAMPLE_ENDPOINT_VID.equals(e.getVendorId())) .findFirst() - .get(); + .orElse(null); + } + } + return endpoint; + } + + /** + * Returns the Endpoint with the desired endpoint Id in the list of Endpoints associated with the + * selectedCastingPlayer. + */ + public static Endpoint selectEndpointById( + CastingPlayer selectedCastingPlayer, int desiredEndpointId) { + Endpoint endpoint = null; + if (selectedCastingPlayer != null) { + List endpoints = selectedCastingPlayer.getEndpoints(); + if (endpoints == null) { + Log.e(TAG, "selectEndpointById() No Endpoints found on CastingPlayer"); + } else { + endpoint = + endpoints.stream().filter(e -> desiredEndpointId == e.getId()).findFirst().orElse(null); } } return endpoint; diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java index aa602c79a66a94..6cae9ab8326474 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/InitializationExample.java @@ -28,6 +28,10 @@ public class InitializationExample { private static final String TAG = InitializationExample.class.getSimpleName(); + // Dummy values for commissioning demonstration only. These are hard coded in the example tv-app: + // connectedhomeip/examples/tv-app/tv-common/src/AppTv.cpp + private static final long DUMMY_SETUP_PASSCODE = 20202021; + private static final int DUMMY_DISCRIMINATOR = 3874; /** * DataProvider implementation for the Unique ID that is used by the SDK to generate the Rotating @@ -48,14 +52,32 @@ public byte[] get() { * DataProvider implementation for the Commissioning Data used by the SDK when the CastingApp goes * through commissioning */ - static final DataProvider commissionableDataProvider = - new DataProvider() { - @Override - public CommissionableData get() { - // dummy values for demonstration only - return new CommissionableData(20202021, 3874); - } - }; + public static class CommissionableDataProvider implements DataProvider { + CommissionableData commissionableData = + new CommissionableData(DUMMY_SETUP_PASSCODE, DUMMY_DISCRIMINATOR); + + @Override + public CommissionableData get() { + return commissionableData; + } + + /** + * Must be implemented in the CommissionableData DataProvider if the + * CastingPlayer/Commissioner-Generated passcode commissioning flow is going to be used. In this + * flow, the setup passcode is generated by the Commissioner and entered by the user in the + * tv-casting-app CX. Once it is obtained, this function should be called with the + * Commissioner-Generated passcode to update the CommissionableData DataProvider in + * AppParameters. + */ + public void updateCommissionableDataSetupPasscode(long setupPasscode, int discriminator) { + Log.i(TAG, "DataProvider::updateCommissionableDataSetupPasscode()"); + commissionableData.setSetupPasscode(setupPasscode); + commissionableData.setDiscriminator(discriminator); + } + }; + + public static CommissionableDataProvider commissionableDataProvider = + new CommissionableDataProvider(); /** * DACProvider implementation for the Device Attestation Credentials required at the time of @@ -70,7 +92,7 @@ public CommissionableData get() { */ public static MatterError initAndStart(Context applicationContext) { // Create an AppParameters object to pass in global casting parameters to the SDK - final AppParameters appParameters = + AppParameters appParameters = new AppParameters( applicationContext, new DataProvider() { diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java index 77f5129b6b9e4d..cd5bbba14af2ed 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java @@ -40,26 +40,33 @@ public class MediaPlaybackSubscribeToCurrentStateExampleFragment extends Fragment { private static final String TAG = MediaPlaybackSubscribeToCurrentStateExampleFragment.class.getSimpleName(); + private static final int DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1; private final CastingPlayer selectedCastingPlayer; + private final boolean useCommissionerGeneratedPasscode; private View.OnClickListener subscribeButtonClickListener; private View.OnClickListener shutdownSubscriptionsButtonClickListener; - public MediaPlaybackSubscribeToCurrentStateExampleFragment(CastingPlayer selectedCastingPlayer) { + public MediaPlaybackSubscribeToCurrentStateExampleFragment( + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { this.selectedCastingPlayer = selectedCastingPlayer; + this.useCommissionerGeneratedPasscode = useCommissionerGeneratedPasscode; } /** * Use this factory method to create a new instance of this fragment using the provided * parameters. * - * @param selectedCastingPlayer CastingPlayer that the casting app connected to + * @param selectedCastingPlayer CastingPlayer that the casting app connected to. + * @param useCommissionerGeneratedPasscode Boolean indicating whether this CastingPlayer was + * commissioned using the Commissioner-Generated Passcode (CGP) commissioning flow. * @return A new instance of fragment MediaPlaybackSubscribeToCurrentStateExampleFragment. */ public static MediaPlaybackSubscribeToCurrentStateExampleFragment newInstance( - CastingPlayer selectedCastingPlayer) { - return new MediaPlaybackSubscribeToCurrentStateExampleFragment(selectedCastingPlayer); + CastingPlayer selectedCastingPlayer, boolean useCommissionerGeneratedPasscode) { + return new MediaPlaybackSubscribeToCurrentStateExampleFragment( + selectedCastingPlayer, useCommissionerGeneratedPasscode); } @Override @@ -70,7 +77,14 @@ public void onCreate(Bundle savedInstanceState) { @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - Endpoint endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + Endpoint endpoint; + if (useCommissionerGeneratedPasscode) { + endpoint = + EndpointSelectorExample.selectEndpointById( + selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); + } else { + endpoint = EndpointSelectorExample.selectFirstEndpointByVID(selectedCastingPlayer); + } if (endpoint == null) { Log.e(TAG, "No Endpoint with sample vendorID found on CastingPlayer"); return inflater.inflate( diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java index f79eab859a8ce3..8b99fefcfa50f8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingApp.java @@ -46,6 +46,7 @@ public final class CastingApp { private AppParameters appParameters; private NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState; private ChipAppServer chipAppServer; + private AndroidChipPlatform chipPlatform; private CastingApp() {} @@ -62,7 +63,7 @@ public static CastingApp getInstance() { * @param appParameters */ public MatterError initialize(AppParameters appParameters) { - Log.i(TAG, "CastingApp.initialize called"); + Log.i(TAG, "CastingApp.initialize() called"); if (mState != CastingAppState.UNINITIALIZED) { return MatterError.CHIP_ERROR_INCORRECT_STATE; } @@ -72,7 +73,7 @@ public MatterError initialize(AppParameters appParameters) { new NsdManagerServiceResolver.NsdManagerResolverAvailState(); Context applicationContext = appParameters.getApplicationContext(); - AndroidChipPlatform chipPlatform = + chipPlatform = new AndroidChipPlatform( new AndroidBleManager(), new PreferencesKeyValueStoreManager(appParameters.getApplicationContext()), @@ -83,6 +84,34 @@ public MatterError initialize(AppParameters appParameters) { new ChipMdnsCallbackImpl(), new DiagnosticDataProviderImpl(applicationContext)); + MatterError err = updateAndroidChipPlatformWithCommissionableData(); + if (err.hasError()) { + Log.e( + TAG, + "CastingApp.initialize() failed to updateCommissionableDataProviderData() on AndroidChipPlatform"); + return err; + } + + err = finishInitialization(appParameters); + + if (err.hasNoError()) { + chipAppServer = new ChipAppServer(); // get a reference to the Matter server now + mState = CastingAppState.NOT_RUNNING; // initialization done, set state to NOT_RUNNING + } + return err; + } + + /** + * Updates the Android CHIP platform with the CommissionableData. This function retrieves + * commissionable data from the AppParameters and updates the Android CHIP platform using this + * data. The commissionable data includes information such as the SPAKE2+ verifier, salt, + * iteration count, setup passcode, and discriminator. + * + * @return MatterError.NO_ERROR if the update was successful, + * MatterError.CHIP_ERROR_INVALID_ARGUMENT otherwise. + */ + MatterError updateAndroidChipPlatformWithCommissionableData() { + Log.i(TAG, "CastingApp.updateAndroidChipPlatformWithCommissionableData()"); CommissionableData commissionableData = appParameters.getCommissionableDataProvider().get(); boolean updated = chipPlatform.updateCommissionableDataProviderData( @@ -93,17 +122,11 @@ public MatterError initialize(AppParameters appParameters) { commissionableData.getDiscriminator()); if (!updated) { Log.e( - TAG, "CastingApp.initApp failed to updateCommissionableDataProviderData on chipPlatform"); + TAG, + "CastingApp.updateAndroidChipPlatformWithCommissionableData() failed to updateCommissionableDataProviderData() on AndroidChipPlatform"); return MatterError.CHIP_ERROR_INVALID_ARGUMENT; } - - MatterError err = finishInitialization(appParameters); - - if (err.hasNoError()) { - chipAppServer = new ChipAppServer(); // get a reference to the Matter server now - mState = CastingAppState.NOT_RUNNING; // initialization done, set state to NOT_RUNNING - } - return err; + return MatterError.NO_ERROR; } /** diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java index 3c3a74032bd313..d7ba6f00f9888f 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/CastingPlayer.java @@ -16,14 +16,14 @@ */ package com.matter.casting.core; -import com.matter.casting.support.EndpointFilter; -import com.matter.casting.support.MatterCallback; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterError; import java.net.InetAddress; import java.util.List; /** - * The CastingPlayer interface defines a Matter commissioner that is able to play media to a + * The CastingPlayer interface defines a Matter Commissioner that is able to play media to a * physical output or to a display screen which is part of the device (e.g. TV). It is discovered on * the local network using Matter Commissioner discovery over DNS. It contains all the information * about the service discovered/resolved. @@ -63,39 +63,92 @@ public interface CastingPlayer { int hashCode(); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. - * + * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new + * commissioning session request. If the CastingApp does not have the nodeId and fabricIndex + * of this CastingPlayer cached on disk, this will execute the User Directed Commissioning + * (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For + * certain UDC features, where a Commissioner reply is expected, this API needs to be followed + * up with the continueConnecting() API defiend below. See the Matter UDC specification or + * parameter class definitions for details on features not included in the description below. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + *

For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the + * Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed + * and CommissionerPasscode set to true. Given these Commissioner state details, the client is + * expected to perform some actions, detailed in the continueConnecting() API below, and then + * call the continueConnecting() API to complete the process. * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window - * open, if commissioning is required. Needs to be >= MIN_CONNECTION_TIMEOUT_SEC. - * @param desiredEndpointFilter (Optional) Attributes (such as VendorId) describing an Endpoint - * that the client wants to interact with after commissioning. If this value is passed in, the - * VerifyOrEstablishConnection will force User Directed Commissioning, in case the desired - * Endpoint is not found in the on device CastingStore. - * @param successCallback called when the connection is established successfully - * @param failureCallback called with MatterError when the connection is fails to establish - * @return MatterError - Matter.NO_ERROR if request submitted successfully, otherwise a - * MatterError object corresponding to the error + * open, if commissioning is required. Needs to be >= kCommissioningWindowTimeoutSec. + * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the + * Commissionee to the Commissioner. These parameters specify the information relating to the + * requested commissioning session. + *

For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning + * flow, the client would call this API with IdentificationDeclarationOptions containing + * CommissionerPasscode set to true. See IdentificationDeclarationOptions.java for a complete + * list of optional parameters. + *

Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants + * to interact with after commissioning. If this value is passed in, + * verifyOrEstablishConnection() will force UDC, in case the desired TargetApp is not found in + * the on-device CastingStore. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ MatterError verifyOrEstablishConnection( - long commissioningWindowTimeoutSec, - EndpointFilter desiredEndpointFilter, - MatterCallback successCallback, - MatterCallback failureCallback); + ConnectionCallbacks connectionCallbacks, + short commissioningWindowTimeoutSec, + IdentificationDeclarationOptions idOptions); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. + * The simplified version of the verifyOrEstablishConnection() API above. * - * @param successCallback called when the connection is established successfully - * @param failureCallback called with MatterError when the connection is fails to establish - * @return MatterError - Matter.NO_ERROR if request submitted successfully, otherwise a - * MatterError object corresponding to the error + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ - MatterError verifyOrEstablishConnection( - MatterCallback successCallback, MatterCallback failureCallback); + MatterError verifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks); + + /** + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode + * commissioning flow started via the verifyOrEstablishConnection() API above. It continues + * the UDC process by sending a second IdentificationDeclaration message to Commissioner + * containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it + * is assumed that the following have occurred: + *

1. Client (Commissionee) has sent the first IdentificationDeclaration message, via + * verifyOrEstablishConnection(), to the Commissioner containing CommissionerPasscode set to + * true. + *

2. Commissioner generated and displayed a passcode. + *

3. The Commissioner replied with a CommissionerDecelration message with + * PasscodeDialogDisplayed and CommissionerPasscode set to true. + *

4. Client has handled the Commissioner's CommissionerDecelration message. + *

5. Client prompted user to input Passcode from Commissioner. + *

6. Client has updated the CastingApp's AppParameters DataProvider + * via the following function call: DataProvider.updateCommissionableDataSetupPasscode(long + * setupPasscode, int discriminator). This allows continueConnecting() to update the + * commissioning session's PAKE verifier with the user entered passcode. + *

Note: The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed + * into verifyOrEstablishConnection() will be used. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + MatterError continueConnecting(); + + MatterError continueConnectingNative(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow + * started via the VerifyOrEstablishConnection() API above. It constructs and sends an + * IdentificationDeclaration message to the CastingPlayer/Commissioner containing + * CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the + * CastingPlayer/Commissioner can dismiss any dialogs corresponding to commissioning, such as + * a Passcode input dialog or a Passcode display dialog. + *

Note: stopConnecting() does not call the onSuccess() callback passed to the + * VerifyOrEstablishConnection() API above since no connection is established. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + MatterError stopConnecting(); /** @brief Sets the internal connection state of this CastingPlayer to "disconnected" */ void disconnect(); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java index f906b80235700c..d98ee77d5d3806 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/Endpoint.java @@ -1,20 +1,16 @@ -/* - * Copyright (c) 2024 Project CHIP Authors - * All rights reserved. +/** + * Copyright (c) 2024 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 + *

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 + *

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. + *

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. */ - package com.matter.casting.core; import chip.devicecontroller.ChipClusters; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java index a4f03a00e4f5a2..29ee17e26db8be 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayer.java @@ -16,15 +16,16 @@ */ package com.matter.casting.core; -import com.matter.casting.support.EndpointFilter; -import com.matter.casting.support.MatterCallback; +import android.util.Log; +import com.matter.casting.support.ConnectionCallbacks; +import com.matter.casting.support.IdentificationDeclarationOptions; import com.matter.casting.support.MatterError; import java.net.InetAddress; import java.util.List; import java.util.Objects; /** - * A Matter Casting Player represents a Matter commissioner that is able to play media to a physical + * A Matter Casting Player represents a Matter Commissioner that is able to play media to a physical * output or to a display screen which is part of the device (e.g. TV). It is discovered on the * local network using Matter Commissioner discovery over DNS. It contains all the information about * the service discovered/resolved. @@ -35,7 +36,7 @@ public class MatterCastingPlayer implements CastingPlayer { * Time (in sec) to keep the commissioning window open, if commissioning is required. Must be >= 3 * minutes. */ - public static final long MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; + public static final short MIN_CONNECTION_TIMEOUT_SEC = 3 * 60; private boolean connected; private String deviceId; @@ -162,49 +163,108 @@ public boolean equals(Object o) { } /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. - * + * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new + * commissioning session request. If the CastingApp does not have the nodeId and fabricIndex + * of this CastingPlayer cached on disk, this will execute the User Directed Commissioning + * (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For + * certain UDC features, where a Commissioner reply is expected, this API needs to be followed + * up with the continueConnecting() API defiend below. See the Matter UDC specification or + * parameter class definitions for details on features not included in the description below. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + *

For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the + * Commissioner replies with a CommissionerDeclaration message with PasscodeDialogDisplayed + * and CommissionerPasscode set to true. Given these Commissioner state details, the client is + * expected to perform some actions, detailed in the continueConnecting() API below, and then + * call the continueConnecting() API to complete the process. * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window - * open, if commissioning is required. Needs to be >= MIN_CONNECTION_TIMEOUT_SEC. - * @param desiredEndpointFilter (Optional) Attributes (such as VendorId) describing an Endpoint - * that the client wants to interact with after commissioning. If this value is passed in, the - * VerifyOrEstablishConnection will force User Directed Commissioning, in case the desired - * Endpoint is not found in the on device CastingStore. - * @return A CompletableFuture that completes when the VerifyOrEstablishConnection is completed. - * The CompletableFuture will be completed with a Void value if the - * VerifyOrEstablishConnection is successful. Otherwise, the CompletableFuture will be - * completed with an Exception. The Exception will be of type - * com.matter.casting.core.CastingException. If the VerifyOrEstablishConnection fails, the - * CastingException will contain the error code and message from the CastingApp. + * open, if commissioning is required. Needs to be >= kCommissioningWindowTimeoutSec. + * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the + * Commissionee to the Commissioner. These parameters specify the information relating to the + * requested commissioning session. + *

For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning + * flow, the client would call this API with IdentificationDeclarationOptions containing + * CommissionerPasscode set to true. See IdentificationDeclarationOptions.java for a complete + * list of optional parameters. + *

Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants + * to interact with after commissioning. If this value is passed in, + * verifyOrEstablishConnection() will force UDC, in case the desired TargetApp is not found in + * the on-device CastingStore. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ @Override public native MatterError verifyOrEstablishConnection( - long commissioningWindowTimeoutSec, - EndpointFilter desiredEndpointFilter, - MatterCallback successCallback, - MatterCallback failureCallback); + ConnectionCallbacks connectionCallbacks, + short commissioningWindowTimeoutSec, + IdentificationDeclarationOptions idOptions); /** - * Verifies that a connection exists with this CastingPlayer, or triggers a new session request. - * If the CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on - * disk, this will execute the user directed commissioning process. + * The simplified version of the verifyOrEstablishConnection() API above. * - * @return A CompletableFuture that completes when the VerifyOrEstablishConnection is completed. - * The CompletableFuture will be completed with a Void value if the - * VerifyOrEstablishConnection is successful. Otherwise, the CompletableFuture will be - * completed with an Exception. The Exception will be of type - * com.matter.casting.core.CastingException. If the VerifyOrEstablishConnection fails, the - * CastingException will contain the error code and message from the CastingApp. + * @param connectionCallbacks contains the onSuccess (Required), onFailure (Required) and + * onCommissionerDeclaration (Optional) callbacks defiend in ConnectCallbacks.java. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. */ @Override - public MatterError verifyOrEstablishConnection( - MatterCallback successCallback, MatterCallback failureCallback) { - return verifyOrEstablishConnection( - MIN_CONNECTION_TIMEOUT_SEC, null, successCallback, failureCallback); + public MatterError verifyOrEstablishConnection(ConnectionCallbacks connectionCallbacks) { + Log.d(TAG, "verifyOrEstablishConnection() (ConnectionCallbacks)"); + return verifyOrEstablishConnection(connectionCallbacks, MIN_CONNECTION_TIMEOUT_SEC, null); + } + + /** + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode + * commissioning flow started via the verifyOrEstablishConnection() API above. It continues + * the UDC process by sending a second IdentificationDeclaration message to Commissioner + * containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it + * is assumed that the following have occurred: + *

1. Client (Commissionee) has sent the first IdentificationDeclaration message, via + * verifyOrEstablishConnection(), to the Commissioner containing CommissionerPasscode set to + * true. + *

2. Commissioner generated and displayed a passcode. + *

3. The Commissioner replied with a CommissionerDecelration message with + * PasscodeDialogDisplayed and CommissionerPasscode set to true. + *

4. Client has handled the Commissioner's CommissionerDecelration message. + *

5. Client prompted user to input Passcode from Commissioner. + *

6. Client has updated the CastingApp's AppParameters DataProvider + * via the following function call: DataProvider.updateCommissionableDataSetupPasscode(long + * setupPasscode, int discriminator). This allows continueConnecting() to update the + * commissioning session's PAKE verifier with the user entered passcode. + *

Note: The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed + * into verifyOrEstablishConnection() will be used. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + public MatterError continueConnecting() { + Log.d(TAG, "continueConnecting()"); + // Update AndroidChipPlatform's CommissionableData with the user entered passcode. + MatterError err = CastingApp.getInstance().updateAndroidChipPlatformWithCommissionableData(); + if (err != MatterError.NO_ERROR) { + Log.e(TAG, "continueConnecting() Error updating AndroidChipPlatform with CommissionableData"); + return err; + } + Log.d(TAG, "continueConnecting() calling continueConnectingNative()"); + return continueConnectingNative(); } + public native MatterError continueConnectingNative(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow + * started via the VerifyOrEstablishConnection() API above. It constructs and sends an + * IdentificationDeclaration message to the CastingPlayer/Commissioner containing + * CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the + * CastingPlayer/Commissioner can dismiss any dialogs corresponding to commissioning, such as + * a Passcode input dialog or a Passcode display dialog. + *

Note: stopConnecting() does not call the onSuccess() callback passed to the + * VerifyOrEstablishConnection() API above since no connection is established. + * @return MatterError - MatterError.NO_ERROR if request submitted successfully, otherwise a + * MatterError object corresponding to the error. + */ + public native MatterError stopConnecting(); + @Override public native void disconnect(); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java index b436c98c533786..cafa42919a121f 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionableData.java @@ -39,10 +39,18 @@ public long getSetupPasscode() { return setupPasscode; } + public void setSetupPasscode(long setupPasscode) { + this.setupPasscode = setupPasscode; + } + public int getDiscriminator() { return discriminator; } + public void setDiscriminator(int discriminator) { + this.discriminator = discriminator; + } + @Nullable public String getSpake2pVerifierBase64() { return spake2pVerifierBase64; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java new file mode 100644 index 00000000000000..82213a3a69517d --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java @@ -0,0 +1,172 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +import android.util.Log; + +/** + * Represents the Commissioner Declaration message sent by a User Directed Commissioning server + * (CastingPlayer/Commissioner) to a UDC client (Casting Client/Commissionee). + */ +public class CommissionerDeclaration { + static final String TAG = CommissionerDeclaration.class.getSimpleName(); + + /** The allowed values for the ErrorCode field are the following */ + public enum CdError { + kNoError(0), + kCommissionableDiscoveryFailed(1), + kPaseConnectionFailed(2), + kPaseAuthFailed(3), + kDacValidationFailed(4), + kAlreadyOnFabric(5), + kOperationalDiscoveryFailed(6), + kCaseConnectionFailed(7), + kCaseAuthFailed(8), + kConfigurationFailed(9), + kBindingConfigurationFailed(10), + kCommissionerPasscodeNotSupported(11), + kInvalidIdentificationDeclarationParams(12), + kAppInstallConsentPending(13), + kAppInstalling(14), + kAppInstallFailed(15), + kAppInstalledRetryNeeded(16), + kCommissionerPasscodeDisabled(17), + kUnexpectedCommissionerPasscodeReady(18); + private final int value; + + CdError(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + /** Feature: All - Indicates errors incurred during commissioning. */ + private CdError errorCode = CdError.kNoError; + /** + * Feature: Coordinate PIN Dialogs - When NoPasscode field set to true, and the Commissioner + * determines that a Passcode code will be needed for commissioning. + */ + private boolean needsPasscode = false; + /** + * Feature: Target Content Application - No apps with AccountLogin cluster implementation were + * found for the last IdentificationDeclaration request. Only apps which provide access to the + * vendor id of the Commissionee will be considered. + */ + private boolean noAppsFound = false; + /** + * Feature: Coordinate PIN Dialogs - A Passcode input dialog is now displayed for the user on the + * Commissioner. + */ + private boolean passcodeDialogDisplayed = false; + /** + * Feature: Commissioner-Generated Passcode - A Passcode is now displayed for the user by the + * CastingPlayer/Commissioner. + */ + private boolean commissionerPasscode = false; + /** + * Feature: Commissioner-Generated Passcode - The user experience conveying a Passcode to the user + * also displays a QR code. + */ + private boolean qRCodeDisplayed = false; + + public CommissionerDeclaration( + int errorCode, + boolean needsPasscode, + boolean noAppsFound, + boolean passcodeDialogDisplayed, + boolean commissionerPasscode, + boolean qRCodeDisplayed) { + this.errorCode = CdError.values()[errorCode]; + this.needsPasscode = needsPasscode; + this.noAppsFound = noAppsFound; + this.passcodeDialogDisplayed = passcodeDialogDisplayed; + this.commissionerPasscode = commissionerPasscode; + this.qRCodeDisplayed = qRCodeDisplayed; + } + + public void setErrorCode(CdError errorCode) { + this.errorCode = errorCode; + } + + public CdError getErrorCode() { + return this.errorCode; + } + + public void setNeedsPasscode(boolean needsPasscode) { + this.needsPasscode = needsPasscode; + } + + public boolean getNeedsPasscode() { + return this.needsPasscode; + } + + public void setNoAppsFound(boolean noAppsFound) { + this.noAppsFound = noAppsFound; + } + + public boolean getNoAppsFound() { + return this.noAppsFound; + } + + public void setPasscodeDialogDisplayed(boolean passcodeDialogDisplayed) { + this.passcodeDialogDisplayed = passcodeDialogDisplayed; + } + + public boolean getPasscodeDialogDisplayed() { + return this.passcodeDialogDisplayed; + } + + public void setCommissionerPasscode(boolean commissionerPasscode) { + this.commissionerPasscode = commissionerPasscode; + } + + public boolean getCommissionerPasscode() { + return this.commissionerPasscode; + } + + public void setQRCodeDisplayed(boolean qRCodeDisplayed) { + this.qRCodeDisplayed = qRCodeDisplayed; + } + + public boolean getQRCodeDisplayed() { + return this.qRCodeDisplayed; + } + + @Override + public String toString() { + return "CommissionerDeclaration::errorCode: " + + errorCode.name() + + "\n" + + "CommissionerDeclaration::needsPasscode: " + + needsPasscode + + "\n" + + "CommissionerDeclaration::noAppsFound: " + + noAppsFound + + "\n" + + "CommissionerDeclaration::passcodeDialogDisplayed: " + + passcodeDialogDisplayed + + "\n" + + "CommissionerDeclaration:commissionerPasscode: " + + commissionerPasscode + + "\n" + + "CommissionerDeclaration::qRCodeDisplayed: " + + qRCodeDisplayed; + } + + public void logDetail() { + Log.d(TAG, "CommissionerDeclaration::logDetail()\n" + this.toString()); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java new file mode 100644 index 00000000000000..3d4152bf106cce --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +/** @brief A container struct for User Directed Commissioning (UDC) callbacks. */ +public class ConnectionCallbacks { + + /** (Required) The callback called when the connection is established successfully. */ + public final MatterCallback onSuccess; + + /** (Required) The callback called with MatterError when the connection is fails to establish. */ + public final MatterCallback onFailure; + + /** + * (Optional) The callback called when the Client/Commissionee receives a CommissionerDeclaration + * message from the CastingPlayer/Commissioner. This callback is needed to support UDC features + * where a reply from the Commissioner is expected. It provides information indicating the + * Commissioner’s pre-commissioning state. + */ + public MatterCallback onCommissionerDeclaration; + + public ConnectionCallbacks( + MatterCallback onSuccess, + MatterCallback onFailure, + MatterCallback onCommissionerDeclaration) { + this.onSuccess = onSuccess; + this.onFailure = onFailure; + this.onCommissionerDeclaration = onCommissionerDeclaration; + } + + public MatterCallback getOnSuccess() { + return onSuccess; + } + + public MatterCallback getOnFailure() { + return onFailure; + } + + public MatterCallback getOnCommissionerDeclaration() { + return onCommissionerDeclaration; + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java index eb701413bcd477..854cf76ce8aca8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/DataProvider.java @@ -19,15 +19,15 @@ import android.util.Log; -public abstract class DataProvider { - private static final String TAG = DataProvider.class.getSimpleName(); +public interface DataProvider { + public static final String TAG = DataProvider.class.getSimpleName(); - protected T _get() { + default T _get() { T val = null; try { val = get(); } catch (Throwable t) { - Log.e(TAG, "DataProvider::Caught an unhandled Throwable from the client: " + t); + Log.e(TAG, "DataProvider::_get() Caught an unhandled Throwable from the client: " + t); } return val; } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java new file mode 100644 index 00000000000000..18567374c66a17 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +import android.util.Log; +import java.util.ArrayList; +import java.util.List; + +/** + * This class contains the optional parameters used in the IdentificationDeclaration Message, sent + * by the Commissionee to the Commissioner. The options specify information relating to the + * requested UDC commissioning session. + */ +public class IdentificationDeclarationOptions { + private final String TAG = IdentificationDeclarationOptions.class.getSimpleName(); + private final short CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS = + getChipDeviceConfigUdcMaxTargetApps(); + + public IdentificationDeclarationOptions() {} + + public IdentificationDeclarationOptions( + boolean noPasscode, + boolean cdUponPasscodeDialog, + boolean commissionerPasscode, + boolean commissionerPasscodeReady, + boolean cancelPasscode, + List targetAppInfos) { + this.noPasscode = noPasscode; + this.cdUponPasscodeDialog = cdUponPasscodeDialog; + this.commissionerPasscode = commissionerPasscode; + this.commissionerPasscodeReady = commissionerPasscodeReady; + this.cancelPasscode = cancelPasscode; + this.targetAppInfos = targetAppInfos != null ? targetAppInfos : new ArrayList<>(); + } + + /** + * @brief Gets the maximum number of Target Content Apps that can be added to the + * IdentificationDeclarationOptions.java TargetAppInfo list from + * connectedhomeip/examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h. + * See this file for details. + */ + private native short getChipDeviceConfigUdcMaxTargetApps(); + + /** + * Feature: Target Content Application - Flag to instruct the Commissioner not to display a + * Passcode input dialog, and instead send a CommissionerDeclaration message if a commissioning + * Passcode is needed. + */ + public boolean noPasscode = false; + /** + * Feature: Coordinate Passcode Dialogs - Flag to instruct the Commissioner to send a + * CommissionerDeclaration message when the Passcode input dialog on the Commissioner has been + * shown to the user. + */ + public boolean cdUponPasscodeDialog = false; + /** + * Feature: Commissioner-Generated Passcode - Flag to instruct the Commissioner to use the + * Commissioner-generated Passcode for commissioning. + */ + public boolean commissionerPasscode = false; + /** + * Feature: Commissioner-Generated Passcode - Flag to indicate whether or not the Commissionee has + * obtained the Commissioner Passcode from the user and is therefore ready for commissioning. + */ + public boolean commissionerPasscodeReady = false; + /** + * Feature: Coordinate Passcode Dialogs Flag - to indicate when the Commissionee user has decided + * to exit the commissioning process. + */ + public boolean cancelPasscode = false; + /** + * Feature: Target Content Application - The set of content app Vendor IDs (and optionally, + * Product IDs) that can be used for authentication. Also, if TargetAppInfo is passed in, + * VerifyOrEstablishConnection() will force User Directed Commissioning, in case the desired + * TargetApp is not found in the on-device CastingStore. + */ + private List targetAppInfos = new ArrayList<>(); + + /** + * @brief Adds a TargetAppInfo to the IdentificationDeclarationOptions.java TargetAppInfos list, + * up to a maximum of CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS. + */ + public boolean addTargetAppInfo(TargetAppInfo targetAppInfo) { + Log.d(TAG, "addTargetAppInfo()"); + if (targetAppInfos.size() >= CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS) { + Log.e( + TAG, + "addTargetAppInfo() failed to add TargetAppInfo, max list size is: " + + CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS); + return false; + } + targetAppInfos.add(targetAppInfo); + return true; + } + + public List getTargetAppInfoList() { + return targetAppInfos; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("IdentificationDeclarationOptions::noPasscode: ") + .append(noPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::cdUponPasscodeDialog: ") + .append(cdUponPasscodeDialog) + .append("\n"); + sb.append("IdentificationDeclarationOptions::commissionerPasscode: ") + .append(commissionerPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::commissionerPasscodeReady: ") + .append(commissionerPasscodeReady) + .append("\n"); + sb.append("IdentificationDeclarationOptions::cancelPasscode: ") + .append(cancelPasscode) + .append("\n"); + sb.append("IdentificationDeclarationOptions::targetAppInfos list: \n"); + + for (TargetAppInfo targetAppInfo : targetAppInfos) { + sb.append("\t\tTargetAppInfo - Vendor ID: ") + .append(targetAppInfo.vendorId) + .append(", Product ID: ") + .append(targetAppInfo.productId) + .append("\n"); + } + + return sb.toString(); + } + + public void logDetail() { + Log.d(TAG, "IdentificationDeclarationOptions::logDetail()\n" + this.toString()); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java new file mode 100644 index 00000000000000..1f605a89833bb1 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2024 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. + */ +package com.matter.casting.support; + +/** + * Feature: Target Content Application - The set of content app Vendor IDs (and optionally, Product + * IDs) that can be used for authentication. + */ +public class TargetAppInfo { + /** Target Target Content Application Vendor ID, null means unspecified */ + public Integer vendorId; + /** Target Target Content Application Product ID, null means unspecified */ + public Integer productId; +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp index 81a42115070da7..ce8e8c0e1b77a6 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/CastingApp-JNI.cpp @@ -24,6 +24,7 @@ // from tv-casting-common #include "core/CastingApp.h" +#include "core/CommissionerDeclarationHandler.h" #include "support/ChipDeviceEventHandler.h" #include @@ -47,7 +48,7 @@ jobject extractJAppParameter(jobject jAppParameters, const char * methodName, co JNI_METHOD(jobject, finishInitialization)(JNIEnv *, jobject, jobject jAppParameters) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::finishInitialization() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::finishInitialization() called"); VerifyOrReturnValue(jAppParameters != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); CHIP_ERROR err = CHIP_NO_ERROR; @@ -81,7 +82,7 @@ JNI_METHOD(jobject, finishInitialization)(JNIEnv *, jobject, jobject jAppParamet JNI_METHOD(jobject, finishStartup)(JNIEnv *, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingAppJNI::finishStartup() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::finishStartup() called"); CHIP_ERROR err = CHIP_NO_ERROR; auto & server = chip::Server::GetInstance(); @@ -102,13 +103,28 @@ JNI_METHOD(jobject, finishStartup)(JNIEnv *, jobject) VerifyOrReturnValue(err == CHIP_NO_ERROR, support::convertMatterErrorFromCppToJava(err), ChipLogError(AppServer, "Failed to register ChipDeviceEventHandler %" CHIP_ERROR_FORMAT, err.Format())); + ChipLogProgress(AppServer, + "CastingApp-JNI::finishStartup() calling " + "GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler()"); +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + // Set a handler for Commissioner's CommissionerDeclaration messages. This is set in + // connectedhomeip/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h + chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler( + CommissionerDeclarationHandler::GetInstance()); +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); } JNI_METHOD(jobject, shutdownAllSubscriptions)(JNIEnv * env, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::shutdownAllSubscriptions called"); + ChipLogProgress(AppServer, "CastingApp-JNI::shutdownAllSubscriptions() called"); + +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + // Remove the handler previously set for Commissioner's CommissionerDeclaration messages. + chip::Server::GetInstance().GetUserDirectedCommissioningClient()->SetCommissionerDeclarationHandler(nullptr); +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->ShutdownAllSubscriptions(); return support::convertMatterErrorFromCppToJava(err); @@ -117,7 +133,7 @@ JNI_METHOD(jobject, shutdownAllSubscriptions)(JNIEnv * env, jobject) JNI_METHOD(jobject, clearCache)(JNIEnv * env, jobject) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::clearCache called"); + ChipLogProgress(AppServer, "CastingApp-JNI::clearCache called"); CHIP_ERROR err = matter::casting::core::CastingApp::GetInstance()->ClearCache(); return support::convertMatterErrorFromCppToJava(err); @@ -125,7 +141,7 @@ JNI_METHOD(jobject, clearCache)(JNIEnv * env, jobject) jobject extractJAppParameter(jobject jAppParameters, const char * methodName, const char * methodSig) { - ChipLogProgress(AppServer, "JNI_METHOD CastingApp-JNI::extractJAppParameter() called"); + ChipLogProgress(AppServer, "CastingApp-JNI::extractJAppParameter() called"); JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); jclass jAppParametersClass; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp index b2597c883406d8..b718682a17124b 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.cpp @@ -21,10 +21,12 @@ #include "../JNIDACProvider.h" #include "../support/Converters-JNI.h" #include "../support/RotatingDeviceIdUniqueIdProvider-JNI.h" -#include "core/CastingApp.h" // from tv-casting-common -#include "core/CastingPlayer.h" // from tv-casting-common -#include "core/CastingPlayerDiscovery.h" // from tv-casting-common -#include "core/ConnectionCallbacks.h" // from tv-casting-common +#include "core/CastingApp.h" // from tv-casting-common +#include "core/CastingPlayer.h" // from tv-casting-common +#include "core/CastingPlayerDiscovery.h" // from tv-casting-common +#include "core/CommissionerDeclarationHandler.h" // from tv-casting-common +#include "core/ConnectionCallbacks.h" // from tv-casting-common +#include "core/IdentificationDeclarationOptions.h" // from tv-casting-common #include #include @@ -44,87 +46,113 @@ namespace core { MatterCastingPlayerJNI MatterCastingPlayerJNI::sInstance; JNI_METHOD(jobject, verifyOrEstablishConnection) -(JNIEnv * env, jobject thiz, jlong commissioningWindowTimeoutSec, jobject desiredEndpointFilterJavaObject, jobject jSuccessCallback, - jobject jFailureCallback) +(JNIEnv * env, jobject thiz, jobject jconnectionCallbacks, jlong commissioningWindowTimeoutSec, + jobject jIdentificationDeclarationOptions) { chip::DeviceLayer::StackLock lock; - ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() called with a timeout of: %ld seconds", - static_cast(commissioningWindowTimeoutSec)); + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() called with a timeout of: %d seconds", + static_cast(commissioningWindowTimeoutSec)); CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); - matter::casting::core::IdentificationDeclarationOptions idOptions; - - // TODO: In the following PRs. Replace EndpointFilter Java class with IdentificationDeclarationOptions Java class. - matter::casting::core::EndpointFilter desiredEndpointFilter; - if (desiredEndpointFilterJavaObject != nullptr) + // Find the ConnectionCallbacks class, get the field IDs of the connection callbacks and extract the callback objects. + jclass connectionCallbacksClass = env->GetObjectClass(jconnectionCallbacks); + VerifyOrReturnValue( + connectionCallbacksClass != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() connectionCallbacksClass == nullptr ")); + + jfieldID successCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onSuccess", "Lcom/matter/casting/support/MatterCallback;"); + jfieldID failureCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onFailure", "Lcom/matter/casting/support/MatterCallback;"); + jfieldID commissionerDeclarationCallbackFieldID = + env->GetFieldID(connectionCallbacksClass, "onCommissionerDeclaration", "Lcom/matter/casting/support/MatterCallback;"); + + jobject jSuccessCallback = env->GetObjectField(jconnectionCallbacks, successCallbackFieldID); + jobject jFailureCallback = env->GetObjectField(jconnectionCallbacks, failureCallbackFieldID); + jobject jCommissionerDeclarationCallback = env->GetObjectField(jconnectionCallbacks, commissionerDeclarationCallbackFieldID); + + VerifyOrReturnValue( + jSuccessCallback != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jSuccessCallback == nullptr but is mandatory ")); + VerifyOrReturnValue( + jFailureCallback != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jFailureCallback == nullptr but is mandatory ")); + + // jIdentificationDeclarationOptions is optional + matter::casting::core::IdentificationDeclarationOptions * idOptions = nullptr; + if (jIdentificationDeclarationOptions == nullptr) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() Optional jIdentificationDeclarationOptions not " + "provided by the client"); + } + else { - chip::Protocols::UserDirectedCommissioning::TargetAppInfo targetAppInfo; - - // Convert the EndpointFilter Java class to a C++ EndpointFilter - jclass endpointFilterJavaClass = env->GetObjectClass(desiredEndpointFilterJavaObject); - jfieldID vendorIdFieldId = env->GetFieldID(endpointFilterJavaClass, "vendorId", "Ljava/lang/Integer;"); - jfieldID productIdFieldId = env->GetFieldID(endpointFilterJavaClass, "productId", "Ljava/lang/Integer;"); - jobject vendorIdIntegerObject = env->GetObjectField(desiredEndpointFilterJavaObject, vendorIdFieldId); - jobject productIdIntegerObject = env->GetObjectField(desiredEndpointFilterJavaObject, productIdFieldId); - // jfieldID requiredDeviceTypesFieldId = env->GetFieldID(endpointFilterJavaClass, "requiredDeviceTypes", - // "Ljava/util/List;"); - - // Value of 0 means unspecified - targetAppInfo.vendorId = vendorIdIntegerObject != nullptr - ? static_cast(env->CallIntMethod( - vendorIdIntegerObject, env->GetMethodID(env->GetObjectClass(vendorIdIntegerObject), "intValue", "()I"))) - : 0; - targetAppInfo.productId = productIdIntegerObject != nullptr - ? static_cast(env->CallIntMethod( - productIdIntegerObject, env->GetMethodID(env->GetObjectClass(productIdIntegerObject), "intValue", "()I"))) - : 0; - - CHIP_ERROR result = idOptions.addTargetAppInfo(targetAppInfo); - if (result != CHIP_NO_ERROR) - { - ChipLogError(AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() failed to add targetAppInfo: %" CHIP_ERROR_FORMAT, - result.Format()); - } + ChipLogProgress( + AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() jIdentificationDeclarationOptions was provided by client"); + idOptions = support::convertIdentificationDeclarationOptionsFromJavaToCpp(jIdentificationDeclarationOptions); + VerifyOrReturnValue(idOptions != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT), + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() " + "convertIdentificationDeclarationOptionsFromJavaToCpp() error")); + idOptions->LogDetail(); } MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.SetUp(env, jSuccessCallback); MatterCastingPlayerJNIMgr().mConnectionFailureHandler.SetUp(env, jFailureCallback); - auto connectCallback = [](CHIP_ERROR err, CastingPlayer * playerPtr) { - ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback()"); - if (err == CHIP_NO_ERROR) - { - ChipLogProgress(AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connected to Casting Player " - "with device ID: %s", - playerPtr->GetId()); - // The Java jSuccessCallback is expecting a Void v callback parameter which translates to a nullptr. When calling the - // Java method from C++ via JNI, passing nullptr is equivalent to passing a Void object in Java. - MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.Handle(nullptr); - } - else - { - ChipLogError( - AppServer, - "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connection error: %" CHIP_ERROR_FORMAT, - err.Format()); - MatterCastingPlayerJNIMgr().mConnectionFailureHandler.Handle(err); - } - }; - - // TODO: In the following PRs. Add optional CommissionerDeclarationHandler callback parameter for the Commissioner-Generated - // passcode commissioning flow. + // jCommissionerDeclarationCallback is optional + if (jCommissionerDeclarationCallback == nullptr) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() optional jCommissionerDeclarationCallback was not " + "provided by the client"); + } + else + { + MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.SetUp(env, jCommissionerDeclarationCallback); + } + matter::casting::core::ConnectionCallbacks connectionCallbacks; - connectionCallbacks.mOnConnectionComplete = connectCallback; + connectionCallbacks.mOnConnectionComplete = MatterCastingPlayerJNI::getInstance().getConnectCallback(); + connectionCallbacks.mCommissionerDeclarationCallback = + MatterCastingPlayerJNI::getInstance().getCommissionerDeclarationCallback(); castingPlayer->VerifyOrEstablishConnection(connectionCallbacks, static_cast(commissioningWindowTimeoutSec), - idOptions); + *idOptions); + return support::convertMatterErrorFromCppToJava(CHIP_NO_ERROR); } +JNI_METHOD(jobject, continueConnectingNative) +(JNIEnv * env, jobject thiz) +{ + chip::DeviceLayer::StackLock lock; + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::continueConnecting()"); + + CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); + VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); + + return support::convertMatterErrorFromCppToJava(castingPlayer->ContinueConnecting()); +} + +JNI_METHOD(jobject, stopConnecting) +(JNIEnv * env, jobject thiz) +{ + chip::DeviceLayer::StackLock lock; + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::stopConnecting()"); + + CastingPlayer * castingPlayer = support::convertCastingPlayerFromJavaToCpp(thiz); + VerifyOrReturnValue(castingPlayer != nullptr, support::convertMatterErrorFromCppToJava(CHIP_ERROR_INVALID_ARGUMENT)); + + return support::convertMatterErrorFromCppToJava(castingPlayer->StopConnecting()); +} + JNI_METHOD(void, disconnect) (JNIEnv * env, jobject thiz) { @@ -161,6 +189,54 @@ JNI_METHOD(jobject, getEndpoints) return jEndpointList; } +void MatterCastingPlayerJNI::ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr) +{ + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback()"); + if (err == CHIP_NO_ERROR) + { + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connected to Casting Player " + "with device ID: %s", + playerPtr->GetId()); + // The Java jSuccessCallback is expecting a Void v callback parameter which translates to a nullptr. When calling the + // Java method from C++ via JNI, passing nullptr is equivalent to passing a Void object in Java. + MatterCastingPlayerJNIMgr().mConnectionSuccessHandler.Handle(nullptr); + } + else + { + ChipLogError( + AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() ConnectCallback() Connection error: %" CHIP_ERROR_FORMAT, + err.Format()); + MatterCastingPlayerJNIMgr().mConnectionFailureHandler.Handle(err); + } +} + +void MatterCastingPlayerJNI::CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source, + chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd) +{ + ChipLogProgress(AppServer, "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback()"); + cd.DebugLog(); + + char addressStr[chip::Transport::PeerAddress::kMaxToStringSize]; + source.ToString(addressStr, sizeof(addressStr)); + ChipLogProgress(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback() source: %s", + addressStr); + + // Call the Java CommissionerDeclarationCallback if it was provided by the client. + if (!MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.IsSetUp()) + { + ChipLogError(AppServer, + "MatterCastingPlayer-JNI::verifyOrEstablishConnection() CommissionerDeclarationCallback() received from " + "but Java callback is not set"); + } + else + { + MatterCastingPlayerJNIMgr().mCommissionerDeclarationHandler.Handle(cd); + } +} + }; // namespace core }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h index 7f58162fff52b3..286d380cf7d942 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/core/MatterCastingPlayer-JNI.h @@ -27,16 +27,32 @@ namespace matter { namespace casting { namespace core { +/** + * This class is used to manage the JNI callbacks and C++ to Java conversions for the CastingPlayer. + */ class MatterCastingPlayerJNI { public: - MatterCastingPlayerJNI() : mConnectionSuccessHandler([](void *) { return nullptr; }) {} + // Member initializer list + MatterCastingPlayerJNI() : + mConnectionSuccessHandler([](void *) { return nullptr; }), + mConnectionFailureHandler(matter::casting::support::convertMatterErrorFromCppToJava), + mCommissionerDeclarationHandler(matter::casting::support::convertCommissionerDeclarationFromCppToJava) + {} support::MatterCallbackJNI mConnectionSuccessHandler; - support::MatterFailureCallbackJNI mConnectionFailureHandler; + support::MatterCallbackJNI mConnectionFailureHandler; + support::MatterCallbackJNI mCommissionerDeclarationHandler; + + static MatterCastingPlayerJNI & getInstance() { return sInstance; } + auto getConnectCallback() const { return ConnectCallback; } + auto getCommissionerDeclarationCallback() const { return CommissionerDeclarationCallback; } private: friend MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr(); static MatterCastingPlayerJNI sInstance; + static void ConnectCallback(CHIP_ERROR err, CastingPlayer * playerPtr); + static void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source, + chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration cd); }; inline class MatterCastingPlayerJNI & MatterCastingPlayerJNIMgr() diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp index 00ca47216ae804..69f70c47d1762e 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.cpp @@ -25,6 +25,17 @@ namespace support { using namespace chip; +extern "C" { + +JNIEXPORT jshort JNICALL +Java_com_matter_casting_support_IdentificationDeclarationOptions_getChipDeviceConfigUdcMaxTargetApps(JNIEnv *, jclass clazz) +{ + ChipLogProgress(AppServer, "Converters-JNI::getChipDeviceConfigUdcMaxTargetApps(), CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS: %d", + CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS); + return CHIP_DEVICE_CONFIG_UDC_MAX_TARGET_APPS; +} +} + jobject convertLongFromCppToJava(jlong value) { ChipLogProgress(AppServer, "convertLongFromCppToJava called"); @@ -366,6 +377,171 @@ jobject convertLongFromCppToJava(uint64_t responseData) return env->NewObject(responseTypeClass, constructor, responseData); } +chip::Protocols::UserDirectedCommissioning::TargetAppInfo * convertTargetAppInfoFromJavaToCpp(jobject jTargetAppInfo) +{ + ChipLogProgress(AppServer, "convertTargetAppInfoFromJavaToCpp() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue(env != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() Could not get JNIEnv for current thread")); + jclass targetAppInfoClass = env->GetObjectClass(jTargetAppInfo); + VerifyOrReturnValue(targetAppInfoClass != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() TargetAppInfo class not found!")); + + jfieldID vendorIdField = env->GetFieldID(targetAppInfoClass, "vendorId", "Ljava/lang/Integer;"); + jfieldID productIdField = env->GetFieldID(targetAppInfoClass, "productId", "Ljava/lang/Integer;"); + VerifyOrReturnValue(vendorIdField != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() vendorIdField not found!")); + VerifyOrReturnValue(productIdField != nullptr, nullptr, + ChipLogError(AppServer, "convertTargetAppInfoFromJavaToCpp() productIdField not found!")); + + jobject jVendorIdObject = env->GetObjectField(jTargetAppInfo, vendorIdField); + jobject jProductIdObject = env->GetObjectField(jTargetAppInfo, productIdField); + + jclass integerClass = env->FindClass("java/lang/Integer"); + jmethodID intValueMethod = env->GetMethodID(integerClass, "intValue", "()I"); + + jint vendorId = 0; + jint productId = 0; + if (jVendorIdObject != nullptr) + { + vendorId = env->CallIntMethod(jVendorIdObject, intValueMethod); + } + if (jProductIdObject != nullptr) + { + productId = env->CallIntMethod(jProductIdObject, intValueMethod); + } + + chip::Protocols::UserDirectedCommissioning::TargetAppInfo * cppTargetAppInfo = + new chip::Protocols::UserDirectedCommissioning::TargetAppInfo(); + + cppTargetAppInfo->vendorId = static_cast(vendorId); + cppTargetAppInfo->productId = static_cast(productId); + + env->DeleteLocalRef(targetAppInfoClass); + env->DeleteLocalRef(jVendorIdObject); + env->DeleteLocalRef(jProductIdObject); + env->DeleteLocalRef(integerClass); + + return reinterpret_cast(cppTargetAppInfo); +} + +matter::casting::core::IdentificationDeclarationOptions * convertIdentificationDeclarationOptionsFromJavaToCpp(jobject jIdOptions) +{ + ChipLogProgress(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue( + env != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() Could not get JNIEnv for current thread")); + + jclass idOptionsClass = env->GetObjectClass(jIdOptions); + VerifyOrReturnValue( + idOptionsClass != nullptr, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() IdentificationDeclarationOptions class not found!")); + + jfieldID noPasscodeField = env->GetFieldID(idOptionsClass, "noPasscode", "Z"); + jfieldID cdUponPasscodeDialogField = env->GetFieldID(idOptionsClass, "cdUponPasscodeDialog", "Z"); + jfieldID commissionerPasscodeField = env->GetFieldID(idOptionsClass, "commissionerPasscode", "Z"); + jfieldID commissionerPasscodeReadyField = env->GetFieldID(idOptionsClass, "commissionerPasscodeReady", "Z"); + jfieldID cancelPasscodeField = env->GetFieldID(idOptionsClass, "cancelPasscode", "Z"); + jfieldID targetAppInfosField = env->GetFieldID(idOptionsClass, "targetAppInfos", "Ljava/util/List;"); + VerifyOrReturnValue( + noPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() noPasscodeField not found!")); + VerifyOrReturnValue( + cdUponPasscodeDialogField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() cdUponPasscodeDialogField not found!")); + VerifyOrReturnValue( + commissionerPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() commissionerPasscodeField not found!")); + VerifyOrReturnValue( + commissionerPasscodeReadyField != nullptr, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() commissionerPasscodeReadyField not found!")); + VerifyOrReturnValue( + cancelPasscodeField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() cancelPasscodeField not found!")); + VerifyOrReturnValue( + targetAppInfosField != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() targetAppInfosField not found!")); + + matter::casting::core::IdentificationDeclarationOptions * cppIdOptions = + new matter::casting::core::IdentificationDeclarationOptions(); + + cppIdOptions->mNoPasscode = env->GetBooleanField(jIdOptions, noPasscodeField); + cppIdOptions->mCdUponPasscodeDialog = env->GetBooleanField(jIdOptions, cdUponPasscodeDialogField); + cppIdOptions->mCommissionerPasscode = env->GetBooleanField(jIdOptions, commissionerPasscodeField); + cppIdOptions->mCommissionerPasscodeReady = env->GetBooleanField(jIdOptions, commissionerPasscodeReadyField); + cppIdOptions->mCancelPasscode = env->GetBooleanField(jIdOptions, cancelPasscodeField); + + jobject targetAppInfosList = env->GetObjectField(jIdOptions, targetAppInfosField); + VerifyOrReturnValue( + targetAppInfosList != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() targetAppInfosList not found!")); + jclass listClass = env->FindClass("java/util/List"); + jmethodID sizeMethod = env->GetMethodID(listClass, "size", "()I"); + jmethodID getMethod = env->GetMethodID(listClass, "get", "(I)Ljava/lang/Object;"); + + jint size = env->CallIntMethod(targetAppInfosList, sizeMethod); + + for (jint i = 0; i < size; i++) + { + jobject jTargetAppInfo = env->CallObjectMethod(targetAppInfosList, getMethod, i); + + chip::Protocols::UserDirectedCommissioning::TargetAppInfo * cppTargetAppInfo = + convertTargetAppInfoFromJavaToCpp(jTargetAppInfo); + VerifyOrReturnValue( + cppTargetAppInfo != nullptr, nullptr, + ChipLogError(AppServer, "convertIdentificationDeclarationOptionsFromJavaToCpp() Could not convert jTargetAppInfo")); + + CHIP_ERROR err = cppIdOptions->addTargetAppInfo(*cppTargetAppInfo); + + env->DeleteLocalRef(jTargetAppInfo); + VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr, + ChipLogError(AppServer, + "convertIdentificationDeclarationOptionsFromJavaToCpp() failed to addTargetAppInfo, due " + "to err: %" CHIP_ERROR_FORMAT, + err.Format())); + } + + env->DeleteLocalRef(targetAppInfosList); + env->DeleteLocalRef(listClass); + env->DeleteLocalRef(idOptionsClass); + + return reinterpret_cast(cppIdOptions); +} + +jobject +convertCommissionerDeclarationFromCppToJava(const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration & cppCd) +{ + ChipLogProgress(AppServer, "convertCommissionerDeclarationFromCppToJava() called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + VerifyOrReturnValue( + env != nullptr, nullptr, + ChipLogError(AppServer, "convertCommissionerDeclarationFromCppToJava() Could not get JNIEnv for current thread")); + + jclass jCommissionerDeclarationClass; + CHIP_ERROR err = chip::JniReferences::GetInstance().GetLocalClassRef(env, "com/matter/casting/support/CommissionerDeclaration", + jCommissionerDeclarationClass); + VerifyOrReturnValue(err == CHIP_NO_ERROR, nullptr); + + jmethodID jCommissionerDeclarationConstructor = env->GetMethodID(jCommissionerDeclarationClass, "", "(IZZZZZ)V"); + if (jCommissionerDeclarationConstructor == nullptr) + { + ChipLogError(AppServer, + "convertCommissionerDeclarationFromCppToJava() Failed to access Java CommissionerDeclaration constructor"); + env->ExceptionClear(); + return nullptr; + } + + return env->NewObject(jCommissionerDeclarationClass, jCommissionerDeclarationConstructor, + static_cast(cppCd.GetErrorCode()), cppCd.GetNeedsPasscode(), cppCd.GetNoAppsFound(), + cppCd.GetPasscodeDialogDisplayed(), cppCd.GetCommissionerPasscode(), cppCd.GetQRCodeDisplayed()); +} + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h index aa96af0668f5d4..d5ef62e349ae61 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/Converters-JNI.h @@ -19,7 +19,10 @@ #include "core/BaseCluster.h" #include "core/CastingPlayer.h" #include "core/Command.h" +#include "core/CommissionerDeclarationHandler.h" +#include "core/ConnectionCallbacks.h" #include "core/Endpoint.h" +#include "core/IdentificationDeclarationOptions.h" #include @@ -74,6 +77,28 @@ void * convertCommandFromJavaToCpp(jobject jCommandObject); jobject convertLongFromCppToJava(uint64_t responseData); +/** + * @brief Converts a Java TargetAppInfo into a native MatterTargetAppInfo. + * + * @return pointer to the TargetAppInfo jobject if created successfully, nullptr otherwise. + */ +chip::Protocols::UserDirectedCommissioning::TargetAppInfo * convertTargetAppInfoFromJavaToCpp(jobject jTargetAppInfo); + +/** + * @brief Converts a Java IdentificationDeclarationOptions into a native IdentificationDeclarationOptions + * + * @return pointer to the IdentificationDeclarationOptions if created successfully, nullptr otherwise. + */ +matter::casting::core::IdentificationDeclarationOptions * convertIdentificationDeclarationOptionsFromJavaToCpp(jobject jIdOptions); + +/** + * @brief Converts a native CommissioningDeclaration into a MatterCommissioningDeclaration jobject + * + * @return pointer to the CommissioningDeclaration jobject if created successfully, nullptr otherwise. + */ +jobject +convertCommissionerDeclarationFromCppToJava(const chip::Protocols::UserDirectedCommissioning::CommissionerDeclaration & cppCd); + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h index 82894e075ea912..6bd185952535e7 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/support/MatterCallback-JNI.h @@ -62,6 +62,8 @@ class MatterCallbackJNI return CHIP_NO_ERROR; } + bool IsSetUp() const { return mCallbackObject.HasValidObjectRef() && mMethod != nullptr; } + void Handle(T responseData) { ChipLogProgress(AppServer, "MatterCallbackJNI::Handle called"); diff --git a/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml b/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml new file mode 100644 index 00000000000000..1b868e06b71f29 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/res/layout/custom_passcode_dialog.xml @@ -0,0 +1,39 @@ + + + + + + + + + + \ No newline at end of file diff --git a/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml b/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml index 4485b6a31ab788..21b7841a656796 100644 --- a/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml +++ b/examples/tv-casting-app/android/App/app/src/main/res/values/strings.xml @@ -33,11 +33,13 @@ Initializing Discovering Casting Players on-network: Discovery Stopped - No errors to report + Long click on a Casting Player to connect using CastingPlayer/Commissioner-Generated passcode commissioning flow (if supported). Start discovery error. - Start discovery error. Discovery ongoing, stop before starting. - Stop discovery error. - Next + Enter the Commissioner-Generated Passcode + Input the Commissioner-Generated passcode displayed on the CastingPlayer UX, or use the default provided (12345678). Select an action Content Launcher Launch URL Disconnect from Casting Player diff --git a/examples/tv-casting-app/android/BUILD.gn b/examples/tv-casting-app/android/BUILD.gn index 416570417b0794..48d68100930a91 100644 --- a/examples/tv-casting-app/android/BUILD.gn +++ b/examples/tv-casting-app/android/BUILD.gn @@ -114,12 +114,16 @@ android_library("java") { "App/app/src/main/jni/com/matter/casting/core/MatterCastingPlayerDiscovery.java", "App/app/src/main/jni/com/matter/casting/support/AppParameters.java", "App/app/src/main/jni/com/matter/casting/support/CommissionableData.java", + "App/app/src/main/jni/com/matter/casting/support/CommissionerDeclaration.java", + "App/app/src/main/jni/com/matter/casting/support/ConnectionCallbacks.java", "App/app/src/main/jni/com/matter/casting/support/DACProvider.java", "App/app/src/main/jni/com/matter/casting/support/DataProvider.java", "App/app/src/main/jni/com/matter/casting/support/DeviceTypeStruct.java", "App/app/src/main/jni/com/matter/casting/support/EndpointFilter.java", + "App/app/src/main/jni/com/matter/casting/support/IdentificationDeclarationOptions.java", "App/app/src/main/jni/com/matter/casting/support/MatterCallback.java", "App/app/src/main/jni/com/matter/casting/support/MatterError.java", + "App/app/src/main/jni/com/matter/casting/support/TargetAppInfo.java", ] javac_flags = [ "-Xlint:deprecation" ] diff --git a/examples/tv-casting-app/linux/simple-app-helper.cpp b/examples/tv-casting-app/linux/simple-app-helper.cpp index beef624eea5ff8..c961bd5adaaacb 100644 --- a/examples/tv-casting-app/linux/simple-app-helper.cpp +++ b/examples/tv-casting-app/linux/simple-app-helper.cpp @@ -344,7 +344,7 @@ void CommissionerDeclarationCallback(const chip::Transport::PeerAddress & source { ChipLogProgress(AppServer, "---- Awaiting user input ----"); ChipLogProgress(AppServer, "Input the Commissioner-Generated passcode displayed on the CastingPlayer UX."); - ChipLogProgress(AppServer, "Input 1245678 to use the default passcode."); + ChipLogProgress(AppServer, "Input 12345678 to use the default passcode."); ChipLogProgress(AppServer, "Example: cast setcommissionerpasscode 12345678"); ChipLogProgress(AppServer, "---- Awaiting user input ----"); gAwaitingCommissionerPasscodeInput = true; @@ -458,7 +458,7 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) uint32_t passcode = (uint32_t) strtol(argv[1], &eptr, 10); if (gAwaitingCommissionerPasscodeInput) { - ChipLogProgress(AppServer, "CommandHandler() setcommissionerpasscode user enterd passcode: %d", passcode); + ChipLogProgress(AppServer, "CommandHandler() setcommissionerpasscode user entered passcode: %d", passcode); gAwaitingCommissionerPasscodeInput = false; // Per connectedhomeip/examples/platform/linux/LinuxCommissionableDataProvider.h: We don't support overriding the @@ -486,7 +486,12 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) } // Continue Connecting to the target CastingPlayer with the user entered Commissioner-generated Passcode. - targetCastingPlayer->ContinueConnecting(); + err = targetCastingPlayer->ContinueConnecting(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CommandHandler() setcommissionerpasscode ContinueConnecting() err %" CHIP_ERROR_FORMAT, + err.Format()); + } } else { @@ -495,6 +500,15 @@ CHIP_ERROR CommandHandler(int argc, char ** argv) "CommandHandler() setcommissionerpasscode, no Commissioner-Generated passcode input expected at this time."); } } + if (strcmp(argv[0], "stop-connecting") == 0) + { + ChipLogProgress(AppServer, "CommandHandler() stop-connecting"); + CHIP_ERROR err = targetCastingPlayer->StopConnecting(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CommandHandler() stop-connecting, err %" CHIP_ERROR_FORMAT, err.Format()); + } + } if (strcmp(argv[0], "print-bindings") == 0) { PrintBindings(); @@ -536,6 +550,9 @@ CHIP_ERROR PrintAllCommands() " setcommissionerpasscode Set the commissioning session's passcode to the " "Commissioner-Generated passcode. Used for the the Commissioner-Generated passcode commissioning flow. Usage: " "cast setcommissionerpasscode 12345678\r\n"); + streamer_printf(sout, + " stop-connecting Stop connecting to Casting Player upon " + "Commissioner-Generated passcode commissioning flow passcode input request. Usage: cast stop-connecting\r\n"); streamer_printf(sout, "\r\n"); return CHIP_NO_ERROR; diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp index ff204923da5d40..cff903a1a1316b 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp @@ -60,6 +60,10 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa // information indicating the Commissioner's pre-commissioning state. if (connectionCallbacks.mCommissionerDeclarationCallback != nullptr) { + ChipLogProgress(AppServer, + "CastingPlayer::VerifyOrEstablishConnection() Setting CommissionerDeclarationCallback in " + "CommissionerDeclarationHandler"); + // Set the callback for handling CommissionerDeclaration messages. matter::casting::core::CommissionerDeclarationHandler::GetInstance()->SetCommissionerDeclarationCallback( connectionCallbacks.mCommissionerDeclarationCallback); } @@ -155,9 +159,9 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } else { - // We need to call OpenBasicCommissioningWindow() for both Commissionee-Generated passcode commissioning flow and - // Commissioner-Generated passcode commissioning flow. Per the Matter spec (UserDirectedCommissioning), even if the - // Commissionee sends an IdentificationDeclaration with CommissionerPasscode set to true, the Commissioner will first + // We need to call OpenBasicCommissioningWindow() for both the Client/Commissionee-Generated passcode commissioning flow and + // Casting Player/Commissioner-Generated passcode commissioning flow. Per the Matter spec (UserDirectedCommissioning), even + // if the Commissionee sends an IdentificationDeclaration with CommissionerPasscode set to true, the Commissioner will first // attempt to use AccountLogin in order to obtain Passcode using rotatingID. If no Passcode is obtained, Commissioner // displays a Passcode. ChipLogProgress(AppServer, "CastingPlayer::VerifyOrEstablishConnection() calling OpenBasicCommissioningWindow()"); @@ -178,18 +182,20 @@ void CastingPlayer::VerifyOrEstablishConnection(ConnectionCallbacks connectionCa } } -void CastingPlayer::ContinueConnecting() +CHIP_ERROR CastingPlayer::ContinueConnecting() { ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting()"); - CHIP_ERROR err = CHIP_NO_ERROR; - // Verify that mOnCompleted is not nullptr. - VerifyOrExit(mOnCompleted != nullptr, ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() mOnCompleted == nullptr")); - if (!matter::casting::core::CommissionerDeclarationHandler::GetInstance()->HasCommissionerDeclarationCallback()) - { - ChipLogProgress(AppServer, - "CastingPlayer::ContinueConnecting() CommissionerDeclaration message callback has not been set."); - } - mConnectionState = CASTING_PLAYER_CONNECTING; + VerifyOrReturnValue(mOnCompleted != nullptr, CHIP_ERROR_INVALID_ARGUMENT, + ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() mOnCompleted == nullptr");); + VerifyOrReturnValue(mConnectionState == CASTING_PLAYER_CONNECTING, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() called while not in connecting state");); + VerifyOrReturnValue( + mIdOptions.mCommissionerPasscode, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, + "CastingPlayer::ContinueConnecting() mIdOptions.mCommissionerPasscode == false, ContinueConnecting() should " + "only be called when the CastingPlayer/Commissioner-Generated passcode commissioning flow is in progress.");); + + CHIP_ERROR err = CHIP_NO_ERROR; mTargetCastingPlayer = this; ChipLogProgress(AppServer, "CastingPlayer::ContinueConnecting() calling OpenBasicCommissioningWindow()"); @@ -208,6 +214,57 @@ void CastingPlayer::ContinueConnecting() ChipLogError(AppServer, "CastingPlayer::ContinueConnecting() failed with %" CHIP_ERROR_FORMAT, err.Format()); resetState(err); } + + return err; +} + +CHIP_ERROR CastingPlayer::StopConnecting() +{ + ChipLogProgress(AppServer, "CastingPlayer::StopConnecting() called, while ChipDeviceEventHandler.sUdcInProgress: %s", + support::ChipDeviceEventHandler::isUdcInProgress() ? "true" : "false"); + VerifyOrReturnValue(mConnectionState == CASTING_PLAYER_CONNECTING, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, "CastingPlayer::StopConnecting() called while not in connecting state");); + VerifyOrReturnValue( + mIdOptions.mCommissionerPasscode, CHIP_ERROR_INCORRECT_STATE, + ChipLogError(AppServer, + "CastingPlayer::StopConnecting() mIdOptions.mCommissionerPasscode == false, ContinueConnecting() should only " + "be called when the CastingPlayer/Commissioner-Generated passcode commissioning flow is in progress.");); + + CHIP_ERROR err = CHIP_NO_ERROR; + mIdOptions.resetState(); + mIdOptions.mCancelPasscode = true; + mConnectionState = CASTING_PLAYER_NOT_CONNECTED; + mCommissioningWindowTimeoutSec = kCommissioningWindowTimeoutSec; + mTargetCastingPlayer = nullptr; + + // If a CastingPlayer::ContinueConnecting() error occurs, StopConnecting() can be called while sUdcInProgress == true. + // sUdcInProgress should be set to false before sending the CancelPasscode IdentificationDeclaration message to the + // CastingPlayer/Commissioner. + if (support::ChipDeviceEventHandler::isUdcInProgress()) + { + support::ChipDeviceEventHandler::SetUdcStatus(false); + } + + ChipLogProgress( + AppServer, + "CastingPlayer::StopConnecting() calling SendUserDirectedCommissioningRequest() to indicate user canceled passcode entry"); +#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + err = SendUserDirectedCommissioningRequest(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "CastingPlayer::StopConnecting() failed with %" CHIP_ERROR_FORMAT, err.Format()); + resetState(err); + return err; + } +#endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT + + // CastingPlayer::SendUserDirectedCommissioningRequest() calls SetUdcStatus(true) before sending the UDC + // IdentificationDeclaration message. Since StopConnecting() is attempting to cancel the commissioning process, we need to set + // the UDC status to false after sending the message. + support::ChipDeviceEventHandler::SetUdcStatus(false); + + ChipLogProgress(AppServer, "CastingPlayer::StopConnecting() User Directed Commissioning stopped"); + return err; } void CastingPlayer::resetState(CHIP_ERROR err) diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h index d5bbcd46006920..0802765bf37dd7 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.h @@ -89,7 +89,7 @@ class ConnectionContext; class CastingPlayer; /** - * @brief CastingPlayer represents a Matter commissioner that is able to play media to a physical + * @brief CastingPlayer represents a Matter Commissioner that is able to play media to a physical * output or to a display screen which is part of the device. */ class CastingPlayer : public std::enable_shared_from_this @@ -129,23 +129,18 @@ class CastingPlayer : public std::enable_shared_from_this /** * @brief Verifies that a connection exists with this CastingPlayer, or triggers a new commissioning session request. If the * CastingApp does not have the nodeId and fabricIndex of this CastingPlayer cached on disk, this will execute the User Directed - * Commissioning (UDC) process by sending an IdentificationDeclaration message to the Commissioner. For certain UDC features, - * where a Commissioner reply is expected, this API needs to be followed up with the ContinueConnecting() API defiend below. See - * the Matter UDC specification or parameter class definitions for details on features not included in the description below. + * Commissioning (UDC) process by sending an IdentificationDeclaration message to the CastingPlayer/Commissioner. For certain + * UDC features, where a Commissioner reply is expected, this API needs to be followed up with the ContinueConnecting() API + * defiend below. See the Matter UDC specification or parameter class definitions for details on features not included in the + * description below. * * @param connectionCallbacks contains the ConnectCallback (Required) and CommissionerDeclarationCallback (Optional) defiend in * ConnectCallbacks.h. * - * ConnectCallback: The callback called when the connection process has ended, regardless of whether it was successful or not. - * - * CommissionerDeclarationCallback: The callback called when the Commissionee receives a CommissionerDeclaration message from - * the Commissioner. This callback is needed to support UDC features where a reply from the Commissioner is expected. It - * provides information indicating the Commissioner’s pre-commissioning state. - * - * For example: During Commissioner-Generated passcode commissioning, the Commissioner replies with a CommissionerDeclaration - * message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner state details, the client - * is expected to perform some actions, detailed in the ContinueConnecting() API below, and then call the ContinueConnecting() - * API to complete the process. + * For example: During CastingPlayer/Commissioner-Generated passcode commissioning, the Commissioner replies with a + * CommissionerDeclaration message with PasscodeDialogDisplayed and CommissionerPasscode set to true. Given these Commissioner + * state details, the client is expected to perform some actions, detailed in the ContinueConnecting() API below, and then call + * the ContinueConnecting() API to complete the process. * * @param commissioningWindowTimeoutSec (Optional) time (in sec) to keep the commissioning window open, if commissioning is * required. Needs to be >= kCommissioningWindowTimeoutSec. @@ -153,9 +148,9 @@ class CastingPlayer : public std::enable_shared_from_this * @param idOptions (Optional) Parameters in the IdentificationDeclaration message sent by the Commissionee to the Commissioner. * These parameters specify the information relating to the requested commissioning session. * - * For example: To invoke the Commissioner-Generated passcode commissioning flow, the client would call this API with - * IdentificationDeclarationOptions containing CommissionerPasscode set to true. See IdentificationDeclarationOptions.h for a - * complete list of optional parameters. + * For example: To invoke the CastingPlayer/Commissioner-Generated passcode commissioning flow, the client would call this API + * with IdentificationDeclarationOptions containing CommissionerPasscode set to true. See IdentificationDeclarationOptions.h for + * a complete list of optional parameters. * * Furthermore, attributes (such as VendorId) describe the TargetApp that the client wants to interact with after commissioning. * If this value is passed in, VerifyOrEstablishConnection() will force UDC, in case the desired @@ -166,7 +161,7 @@ class CastingPlayer : public std::enable_shared_from_this IdentificationDeclarationOptions idOptions = IdentificationDeclarationOptions()); /** - * @brief This is a continuation of the Commissioner-Generated passcode commissioning flow started via the + * @brief This is a continuation of the CastingPlayer/Commissioner-Generated passcode commissioning flow started via the * VerifyOrEstablishConnection() API above. It continues the UDC process by sending a second IdentificationDeclaration message * to Commissioner containing CommissionerPasscode and CommissionerPasscodeReady set to true. At this point it is assumed that * the following have occurred: @@ -176,16 +171,29 @@ class CastingPlayer : public std::enable_shared_from_this * 2. Commissioner generated and displayed a passcode. * 3. The Commissioner replied with a CommissionerDecelration message with PasscodeDialogDisplayed and CommissionerPasscode set * to true. - * 3. Client has handled the Commissioner's CommissionerDecelration message. - * 4. Client prompted user to input Passcode from Commissioner. - * 5. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApps + * 4. Client has handled the Commissioner's CommissionerDecelration message. + * 5. Client prompted user to input Passcode from Commissioner. + * 6. Client has updated the commissioning session's PAKE verifier using the user input Passcode by updating the CastingApp's * CommissionableDataProvider * (matter::casting::core::CastingApp::GetInstance()->UpdateCommissionableDataProvider(CommissionableDataProvider)). * * The same connectionCallbacks and commissioningWindowTimeoutSec parameters passed into VerifyOrEstablishConnection() will be * used. + * @return CHIP_NO_ERROR if this function was called with the CastingPlayer in the correct state and an error otherwise. + */ + CHIP_ERROR ContinueConnecting(); + + /** + * @brief This cancels the CastingPlayer/Commissioner-Generated passcode commissioning flow started via the + * VerifyOrEstablishConnection() API above. It constructs and sends an IdentificationDeclaration message to the + * CastingPlayer/Commissioner containing CancelPasscode set to true. It is used to indicate that the user, and thus the + * Client/Commissionee, have cancelled the commissioning process. This indicates that the CastingPlayer/Commissioner can dismiss + * any dialogs corresponding to commissioning, such as a Passcode input dialog or a Passcode display dialog. + * Note: stopConnecting() does not call the ConnectCallback() callback passed to the VerifyOrEstablishConnection() API above + * since no connection is established. + * @return CHIP_NO_ERROR if this function was called with the CastingPlayer in the correct state and an error otherwise. */ - void ContinueConnecting(); + CHIP_ERROR StopConnecting(); /** * @brief Sets the internal connection state of this CastingPlayer to "disconnected" diff --git a/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h b/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h index 01badaaf059dad..bc03df3afee421 100644 --- a/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h +++ b/examples/tv-casting-app/tv-casting-common/core/ConnectionCallbacks.h @@ -47,11 +47,13 @@ using CommissionerDeclarationCallback = std::function getTargetAppInfoList() const { return mTargetAppInfos; } + void resetState() + { + mNoPasscode = false; + mCdUponPasscodeDialog = false; + mCommissionerPasscode = false; + mCommissionerPasscodeReady = false; + mCancelPasscode = false; + mTargetAppInfos.clear(); + } + /** * @brief Builds an IdentificationDeclaration message to be sent to a CastingPlayer, given the options state specified in this * object. @@ -107,7 +117,6 @@ class IdentificationDeclarationOptions { id.SetCommissionerPasscodeReady(true); id.SetInstanceName(mCommissioneeInstanceName); - mCommissionerPasscodeReady = false; } else { @@ -136,7 +145,7 @@ class IdentificationDeclarationOptions void LogDetail() { - ChipLogDetail(AppServer, "IdentificationDeclarationOptions::LogDetail()"); + ChipLogDetail(AppServer, "IdentificationDeclarationOptions::LogDetail() - cpp"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mNoPasscode: %s", mNoPasscode ? "true" : "false"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCdUponPasscodeDialog: %s", @@ -148,6 +157,14 @@ class IdentificationDeclarationOptions ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCancelPasscode: %s", mCancelPasscode ? "true" : "false"); ChipLogDetail(AppServer, "IdentificationDeclarationOptions::mCommissioneeInstanceName: %s", mCommissioneeInstanceName); + + ChipLogDetail(AppServer, "IdentificationDeclarationOptions::TargetAppInfos list:"); + for (size_t i = 0; i < mTargetAppInfos.size(); i++) + { + const chip::Protocols::UserDirectedCommissioning::TargetAppInfo & info = mTargetAppInfos[i]; + ChipLogDetail(AppServer, "\t\tTargetAppInfo %d, Vendor ID: %u, Product ID: %u", int(i + 1), info.vendorId, + info.productId); + } } private: diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp index fd6039d5256031..bb226a15298229 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.cpp @@ -222,6 +222,11 @@ CHIP_ERROR ChipDeviceEventHandler::SetUdcStatus(bool udcInProgress) return CHIP_NO_ERROR; } +bool ChipDeviceEventHandler::isUdcInProgress() +{ + return sUdcInProgress; +} + }; // namespace support }; // namespace casting }; // namespace matter diff --git a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h index d8660a007cc585..cdebdf698b927c 100644 --- a/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h +++ b/examples/tv-casting-app/tv-casting-common/support/ChipDeviceEventHandler.h @@ -45,6 +45,11 @@ class ChipDeviceEventHandler */ static CHIP_ERROR SetUdcStatus(bool udcInProgress); + /** + * @brief Returns true if User Directed Commissioning (UDC) is in progress, false otherwise. + */ + static bool isUdcInProgress(); + private: /** * @brief if kFailSafeTimerExpired is received and a request to connect to a CastingPlayer is pending, open a basic diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h index 7a496e5a2f0a33..cf9a55365b9191 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h @@ -535,6 +535,7 @@ class DLL_EXPORT UserDirectedCommissioningClient : public TransportMgrDelegate */ void SetCommissionerDeclarationHandler(CommissionerDeclarationHandler * commissionerDeclarationHandler) { + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::SetCommissionerDeclarationHandler()"); mCommissionerDeclarationHandler = commissionerDeclarationHandler; } diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp index 6d7c315ffb5308..aeb5691be2554c 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp @@ -242,7 +242,7 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd char addrBuffer[chip::Transport::PeerAddress::kMaxToStringSize]; source.ToString(addrBuffer); - ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived from %s", addrBuffer); + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() from %s", addrBuffer); PacketHeader packetHeader; @@ -250,14 +250,16 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd if (packetHeader.IsEncrypted()) { - ChipLogError(AppServer, "UDC encryption flag set - ignoring"); + ChipLogError(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() UDC encryption flag set - ignoring"); return; } PayloadHeader payloadHeader; ReturnOnFailure(payloadHeader.DecodeAndConsume(msg)); - ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%" PRIu32, static_cast(msg->DataLength())); + ChipLogProgress(AppServer, + "UserDirectedCommissioningClient::OnMessageReceived() CommissionerDeclaration DataLength() = %" PRIu32, + static_cast(msg->DataLength())); uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes]; size_t udcPayloadLength = std::min(msg->DataLength(), sizeof(udcPayload)); @@ -272,6 +274,10 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd { mCommissionerDeclarationHandler->OnCommissionerDeclarationMessage(source, cd); } + else + { + ChipLogProgress(AppServer, "UserDirectedCommissioningClient::OnMessageReceived() No registered handler for UDC messages"); + } } } // namespace UserDirectedCommissioning From d4d905414b47ea2da52c8719948d351331560d51 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 18:02:10 -0400 Subject: [PATCH 24/78] Fix Darwin server cluster checks for wildcard read to check received values. (#33737) This caught a bug where the synthesized descriptor clusters were not spec-compliant in the sense of requiring admin privileges to read their attributes, and the synthesized global attributes likewise required admin privileges. The changes to MTRServerAccessControl fix that. --- .../ServerEndpoint/MTRServerAccessControl.mm | 49 +++-- .../CHIPTests/MTRPerControllerStorageTests.m | 191 ++++++++++++++---- 2 files changed, 182 insertions(+), 58 deletions(-) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm index 28dacef27c2a78..e98bdc0b9e61a4 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAccessControl.mm @@ -18,6 +18,7 @@ #import #import // for MTRClusterPath +#import // For MTRClusterIDTypeDescriptorID #import #import "MTRDeviceControllerFactory_Internal.h" @@ -29,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -135,36 +138,52 @@ bool GrantSubjectMatchesDescriptor(MTRAccessGrant * grant, const SubjectDescript } // anonymous namespace -chip::Access::Privilege MatterGetAccessPrivilegeForReadEvent(ClusterId cluster, EventId event) +Privilege MatterGetAccessPrivilegeForReadEvent(ClusterId cluster, EventId event) { // We don't support any event bits yet. - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; } -chip::Access::Privilege MatterGetAccessPrivilegeForInvokeCommand(ClusterId cluster, CommandId command) +Privilege MatterGetAccessPrivilegeForInvokeCommand(ClusterId cluster, CommandId command) { // For now we only have OTA, which uses Operate. - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; } -chip::Access::Privilege MatterGetAccessPrivilegeForReadAttribute(ClusterId cluster, AttributeId attribute) +Privilege MatterGetAccessPrivilegeForReadAttribute(ClusterId cluster, AttributeId attribute) { NSNumber * _Nullable neededPrivilege = [[MTRDeviceControllerFactory sharedInstance] neededReadPrivilegeForClusterID:@(cluster) attributeID:@(attribute)]; if (neededPrivilege == nil) { - // No privileges declared for this attribute on this cluster. Treat as - // "needs admin privileges", so we fail closed. - return chip::Access::Privilege::kAdminister; + // No privileges declared for this attribute on this cluster. + + // In some cases, we know based on the spec what the answer is, and our + // API clients my not be able to provide explicit privileges for + // these cases because our API surface does not allow them to create + // custom attribute definitions for them. + + // (1) Global attributes always require View privilege to read. + if (IsGlobalAttribute(attribute)) { + return Privilege::kView; + } + + // (2) All standard descriptor attributes just require View privilege to read. + if (cluster == MTRClusterIDTypeDescriptorID && ExtractVendorFromMEI(attribute) == VendorId::Common) { + return Privilege::kView; + } + + // Treat as "needs admin privileges", so we fail closed. + return Privilege::kAdminister; } switch (neededPrivilege.unsignedLongLongValue) { case MTRAccessControlEntryPrivilegeView: - return chip::Access::Privilege::kView; + return Privilege::kView; case MTRAccessControlEntryPrivilegeOperate: - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; case MTRAccessControlEntryPrivilegeManage: - return chip::Access::Privilege::kManage; + return Privilege::kManage; case MTRAccessControlEntryPrivilegeAdminister: - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; case MTRAccessControlEntryPrivilegeProxyView: // Just treat this as an unknown value; there is no value for this in privilege-storage. FALLTHROUGH; @@ -175,13 +194,13 @@ bool GrantSubjectMatchesDescriptor(MTRAccessGrant * grant, const SubjectDescript // To be safe, treat unknown values as "needs admin privileges". That way the failure case // disallows access that maybe should be allowed, instead of allowing access that maybe // should be disallowed. - return chip::Access::Privilege::kAdminister; + return Privilege::kAdminister; } -chip::Access::Privilege MatterGetAccessPrivilegeForWriteAttribute(ClusterId cluster, AttributeId attribute) +Privilege MatterGetAccessPrivilegeForWriteAttribute(ClusterId cluster, AttributeId attribute) { // We don't have any writable attributes yet, but default to Operate. - return chip::Access::Privilege::kOperate; + return Privilege::kOperate; } void InitializeServerAccessControl() diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index fc233ffaebf93d..7b821d8648d949 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -1721,15 +1721,6 @@ - (void)testControllerServer ], }; -#if 0 - __auto_type * listOfStructsValue2 = @{ - MTRTypeKey : MTRArrayValueType, - MTRValueKey : @[ - @{ MTRDataKey: structValue2, }, - ], - }; -#endif - __auto_type responsePathFromRequestPath = ^(MTRAttributeRequestPath * path) { return [MTRAttributePath attributePathWithEndpointID:path.endpoint clusterID:path.cluster attributeID:path.attribute]; }; @@ -2007,32 +1998,60 @@ - (void)testControllerServer // Now do a wildcard read on the endpoint and check that this does the right // thing (gets the right things from descriptor, gets both clusters, etc). -#if 0 - // Unused bits ifdefed out until we doing more testing on the actual values - // we get back. __auto_type globalAttributePath = ^(NSNumber * clusterID, MTRAttributeIDType attributeID) { return [MTRAttributePath attributePathWithEndpointID:endpointId1 clusterID:clusterID attributeID:@(attributeID)]; }; + __auto_type descriptorAttributePath = ^(MTRAttributeIDType attributeID) { + return [MTRAttributePath attributePathWithEndpointID:endpointId1 clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(attributeID)]; + }; __auto_type unsignedIntValue = ^(NSUInteger value) { return @{ - MTRTypeKey: MTRUnsignedIntegerValueType, - MTRValueKey: @(value), + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(value), }; }; __auto_type arrayOfUnsignedIntegersValue = ^(NSArray * values) { __auto_type * mutableArray = [[NSMutableArray alloc] init]; for (NSNumber * value in values) { - [mutableArray addObject:@{ MTRDataKey: @{ - MTRTypeKey: MTRUnsignedIntegerValueType, - MTRValueKey: value, - }, }]; + [mutableArray addObject:@{ + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : value, + }, + }]; } return @{ - MTRTypeKey: MTRArrayValueType, - MTRValueKey: [mutableArray copy], - }; + MTRTypeKey : MTRArrayValueType, + MTRValueKey : [mutableArray copy], + }; }; -#endif + __auto_type endpoint1DeviceTypeValue = @{ + MTRTypeKey : MTRArrayValueType, + MTRValueKey : @[ + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : deviceType1.deviceTypeID, + }, + }, + @{ + MTRContextTagKey : @(1), + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : deviceType1.deviceTypeRevision, + }, + }, + ], + } + }, + ], + }; + XCTestExpectation * wildcardReadExpectation = [self expectationWithDescription:@"Wildcard read of our endpoint"]; [baseDevice readAttributePaths:@[ [MTRAttributeRequestPath requestPathWithEndpointID:endpointId1 clusterID:nil attributeID:nil] ] eventPaths:nil @@ -2042,32 +2061,118 @@ - (void)testControllerServer XCTAssertNil(error); XCTAssertNotNil(values); - // TODO: Figure out how to test that values is correct that's not - // too fragile if things get returned in different valid order. - // For now just check that every path we got has a value, not an - // error. for (NSDictionary * value in values) { XCTAssertNotNil(value[MTRAttributePathKey]); XCTAssertNil(value[MTRErrorKey]); XCTAssertNotNil(value[MTRDataKey]); } -#if 0 - XCTAssertEqualObjects(values, @[ - // cluster1 - @{ MTRAttributePathKey: attribute1ResponsePath, - MTRDataKey: unsignedIntValue2, }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeFeatureMapID), - MTRDataKey: unsignedIntValue(0), }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), - MTRDataKey: clusterRevision1, }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), - MTRDataKey: arrayOfUnsignedIntegersValue(@[]), }, - @{ MTRAttributePathKey: globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), - MTRDataKey: arrayOfUnsignedIntegersValue(@[]), }, - // etc - - ]); -#endif + + NSSet *> * receivedValues = [NSSet setWithArray:values]; + NSSet *> * expectedValues = [NSSet setWithArray:@[ + // cluster1 + @ { + MTRAttributePathKey : attribute1ResponsePath, + MTRDataKey : unsignedIntValue2, + }, + // attribute3 requires Operate privileges to read, which we do not have + // for this cluster, so it will not be present here. + @ { + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + MTRDataKey : unsignedIntValue(clusterRevision1.unsignedIntegerValue), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId1, MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + attributeId1, @(0xFFF8), @(0xFFF9), @(0xFFFB), attributeId2, @(0xFFFC), @(0xFFFD) + ]), + }, + + // cluster2 + @ { + MTRAttributePathKey : attribute2ResponsePath, + MTRDataKey : listOfStructsValue1, + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + MTRDataKey : unsignedIntValue(clusterRevision2.unsignedIntegerValue), + }, + @{MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(clusterId2, MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + @0xFFF8, @(0xFFF9), @(0xFFFB), attributeId2, @(0xFFFC), @(0xFFFD) + ]), + }, + + // descriptor + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID), + MTRDataKey : endpoint1DeviceTypeValue, + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeServerListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ clusterId1, clusterId2, @(MTRClusterIDTypeDescriptorID) ]), + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributeClientListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeClusterDescriptorAttributePartsListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + // No TagList attribute on this descriptor. + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeGlobalAttributeFeatureMapID), + MTRDataKey : unsignedIntValue(0), + }, + @ { + MTRAttributePathKey : descriptorAttributePath(MTRAttributeIDTypeGlobalAttributeClusterRevisionID), + // Would be nice if we could get the Descriptor cluster revision + // from somewhere intead of hardcoding it... + MTRDataKey : unsignedIntValue(2), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[]), + }, + @{ + MTRAttributePathKey : globalAttributePath(@(MTRClusterIDTypeDescriptorID), MTRAttributeIDTypeGlobalAttributeAttributeListID), + MTRDataKey : arrayOfUnsignedIntegersValue(@[ + @(0), @(1), @(2), @(3), @(0xFFF8), @(0xFFF9), @(0xFFFB), @(0xFFFC), @(0xFFFD) + ]), + }, + + ]]; + + XCTAssertEqualObjects(receivedValues, expectedValues); + [wildcardReadExpectation fulfill]; }]; [self waitForExpectations:@[ wildcardReadExpectation ] timeout:kTimeoutInSeconds]; From 8b8dadd92b176b6d1c7d32d70a46ab3668d30e0f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 5 Jun 2024 18:16:24 -0400 Subject: [PATCH 25/78] Fix some random Darwin test failures due to timing dependency. (#33761) Some Darwin tests failed randomly if a subscription took longer than 10s to establish. Add test-only conditionals around the relevant code so we suppress that behavior in tests. --- src/darwin/Framework/CHIP/MTRDevice.mm | 28 +++++++++++++------ .../TestHelpers/MTRDeviceTestDelegate.m | 9 ++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 01f22543cde160..8d808324fe9765 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -383,6 +383,7 @@ - (BOOL)unitTestPretendThreadEnabled:(MTRDevice *)device; - (void)unitTestSubscriptionPoolDequeue:(MTRDevice *)device; - (void)unitTestSubscriptionPoolWorkComplete:(MTRDevice *)device; - (void)unitTestClusterDataPersisted:(MTRDevice *)device; +- (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device; @end #endif @@ -2026,15 +2027,24 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason MTR_LOG("%@ setting up subscription with reason: %@", self, reason); - // Set up a timer to mark as not reachable if it takes too long to set up a subscription - MTRWeakReference * weakSelf = [MTRWeakReference weakReferenceWithObject:self]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ - MTRDevice * strongSelf = weakSelf.strongObject; - if (strongSelf != nil) { - std::lock_guard lock(strongSelf->_lock); - [strongSelf _markDeviceAsUnreachableIfNeverSubscribed]; - } - }); + bool markUnreachableAfterWait = true; +#ifdef DEBUG + if (delegate && [delegate respondsToSelector:@selector(unitTestSuppressTimeBasedReachabilityChanges:)]) { + markUnreachableAfterWait = ![delegate unitTestSuppressTimeBasedReachabilityChanges:self]; + } +#endif + + if (markUnreachableAfterWait) { + // Set up a timer to mark as not reachable if it takes too long to set up a subscription + MTRWeakReference * weakSelf = [MTRWeakReference weakReferenceWithObject:self]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, static_cast(kSecondsToWaitBeforeMarkingUnreachableAfterSettingUpSubscription) * static_cast(NSEC_PER_SEC)), self.queue, ^{ + MTRDevice * strongSelf = weakSelf.strongObject; + if (strongSelf != nil) { + std::lock_guard lock(strongSelf->_lock); + [strongSelf _markDeviceAsUnreachableIfNeverSubscribed]; + } + }); + } [_deviceController getSessionForNode:_nodeID.unsignedLongLongValue diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m b/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m index d896906fa99c01..740f5f71cf8b7c 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRDeviceTestDelegate.m @@ -103,6 +103,15 @@ - (void)unitTestClusterDataPersisted:(MTRDevice *)device } } +- (BOOL)unitTestSuppressTimeBasedReachabilityChanges:(MTRDevice *)device +{ + // Allowing time-based reachability changes just makes the tests + // non-deterministic and can lead to random failures. Suppress them + // unconditionally for now. If we ever add tests that try to exercise that + // codepath, we can make this configurable. + return YES; +} + @end @implementation MTRDeviceTestDelegateWithSubscriptionSetupOverride From 321f8951c97fe44ad2b707a97f09e0ca95c961dc Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Wed, 5 Jun 2024 16:44:03 -0700 Subject: [PATCH 26/78] Fix the icd registerClient (#33738) * Fix the icd registerClient * address comments * Update ClusterCommand.h * Update ClusterCommand.h --- .../chip-tool/commands/clusters/ClusterCommand.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ClusterCommand.h b/examples/chip-tool/commands/clusters/ClusterCommand.h index fe20f4f36b9f84..ac141fb012e259 100644 --- a/examples/chip-tool/commands/clusters/ClusterCommand.h +++ b/examples/chip-tool/commands/clusters/ClusterCommand.h @@ -118,9 +118,13 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub if (data != nullptr) { - LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, data)); - - error = DataModelLogger::LogCommand(path, data); + { + // log a snapshot to not advance the data reader. + chip::TLV::TLVReader logTlvReader; + logTlvReader.Init(*data); + LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, &logTlvReader)); + error = DataModelLogger::LogCommand(path, &logTlvReader); + } if (CHIP_NO_ERROR != error) { ChipLogError(chipTool, "Response Failure: Can not decode Data"); @@ -128,8 +132,9 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub return; } if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) && - (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id)) + (path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id)) { + // log a snapshot to not advance the data reader. chip::TLV::TLVReader counterTlvReader; counterTlvReader.Init(*data); chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value; @@ -139,7 +144,6 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format()); return; } - chip::app::ICDClientInfo clientInfo; clientInfo.peer_node = mScopedNodeId; clientInfo.monitored_subject = mMonitoredSubject; From 9c7fbe826954656c39b06c9543e75d6c3fde7082 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 6 Jun 2024 00:27:29 -0700 Subject: [PATCH 27/78] Allows Fabric Admin to process command other than console (#33765) --- .../fabric-sync/FabricSyncCommand.cpp | 7 --- .../interactive/InteractiveCommands.cpp | 44 ++++++++++++++++++- .../interactive/InteractiveCommands.h | 2 + .../pairing/OpenCommissioningWindowCommand.h | 1 + 4 files changed, 46 insertions(+), 8 deletions(-) diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index c2a1b5df8fb80e..38ea541dab5873 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -22,13 +22,6 @@ #include #if defined(PW_RPC_ENABLED) -#include "pw_assert/check.h" -#include "pw_hdlc/decoder.h" -#include "pw_hdlc/default_addresses.h" -#include "pw_hdlc/rpc_channel.h" -#include "pw_rpc/client.h" -#include "pw_stream/socket_stream.h" - #include #endif diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp index c5c844256f5351..4b767c460c1f87 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #if defined(PW_RPC_ENABLED) @@ -44,6 +45,26 @@ constexpr uint16_t kRetryIntervalS = 5; // File pointer for the log file FILE * sLogFile = nullptr; +std::queue sCommandQueue; +std::mutex sQueueMutex; +std::condition_variable sQueueCondition; + +void ReadCommandThread() +{ + char * command; + while (true) + { + command = readline(kInteractiveModePrompt); + if (command != nullptr && *command) + { + std::unique_lock lock(sQueueMutex); + sCommandQueue.push(command); + free(command); + sQueueCondition.notify_one(); + } + } +} + void OpenLogFile(const char * filePath) { sLogFile = fopen(filePath, "a"); @@ -113,13 +134,22 @@ void ExecuteDeferredConnect(intptr_t ignored) char * InteractiveStartCommand::GetCommand(char * command) { + std::unique_lock lock(sQueueMutex); + sQueueCondition.wait(lock, [&] { return !sCommandQueue.empty(); }); + + std::string cmd = sCommandQueue.front(); + sCommandQueue.pop(); + if (command != nullptr) { free(command); command = nullptr; } - command = readline(kInteractiveModePrompt); + command = new char[cmd.length() + 1]; + strcpy(command, cmd.c_str()); + + ChipLogProgress(NotSpecified, "GetCommand: %s", command); // Do not save empty lines if (command != nullptr && *command) @@ -168,6 +198,9 @@ CHIP_ERROR InteractiveStartCommand::RunCommand() DeviceLayer::PlatformMgr().ScheduleWork(ExecuteDeferredConnect, 0); #endif + std::thread readCommands(ReadCommandThread); + readCommands.detach(); + char * command = nullptr; int status; while (true) @@ -213,3 +246,12 @@ bool InteractiveCommand::NeedsOperationalAdvertising() { return mAdvertiseOperational.ValueOr(true); } + +void PushCommand(const std::string & command) +{ + std::unique_lock lock(sQueueMutex); + + ChipLogProgress(NotSpecified, "PushCommand: %s", command.c_str()); + sCommandQueue.push(command); + sQueueCondition.notify_one(); +} diff --git a/examples/fabric-admin/commands/interactive/InteractiveCommands.h b/examples/fabric-admin/commands/interactive/InteractiveCommands.h index a0b490f3b668e5..e3d28080657e26 100644 --- a/examples/fabric-admin/commands/interactive/InteractiveCommands.h +++ b/examples/fabric-admin/commands/interactive/InteractiveCommands.h @@ -64,3 +64,5 @@ class InteractiveStartCommand : public InteractiveCommand char * GetCommand(char * command); std::string GetHistoryFilePath() const; }; + +void PushCommand(const std::string & command); diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h index 2c1d62f31c566b..5bf6fd986f1947 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h @@ -43,6 +43,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override; + // We issue multiple data model operations for this command, and the default // timeout for those is 10 seconds, so default to 20 seconds. chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(20)); } From be9409098865cf2fb9358b285a35d00b59352760 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Thu, 6 Jun 2024 11:35:48 +0300 Subject: [PATCH 28/78] [Telink] Update default CI app/SoC & Update builds to docker version 54 (#33726) * [Telink] Update default CI app/SoC builds * [Telink] Update builds to docker version 54 * [Telink] disable debug part --- .github/workflows/bloat_check.yaml | 2 +- .github/workflows/build.yaml | 10 ++--- .github/workflows/chef.yaml | 10 ++--- .github/workflows/cirque.yaml | 2 +- .github/workflows/doxygen.yaml | 2 +- .github/workflows/examples-ameba.yaml | 2 +- .github/workflows/examples-asr.yaml | 2 +- .github/workflows/examples-bouffalolab.yaml | 2 +- .github/workflows/examples-cc13xx_26xx.yaml | 2 +- .github/workflows/examples-cc32xx.yaml | 2 +- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 4 +- .github/workflows/examples-infineon.yaml | 2 +- .github/workflows/examples-linux-arm.yaml | 2 +- .github/workflows/examples-linux-imx.yaml | 2 +- .../workflows/examples-linux-standalone.yaml | 2 +- .../examples-linux-tv-casting-app.yaml | 2 +- .github/workflows/examples-mbed.yaml | 2 +- .github/workflows/examples-mw320.yaml | 2 +- .github/workflows/examples-nrfconnect.yaml | 2 +- .github/workflows/examples-nuttx.yaml | 2 +- .github/workflows/examples-nxp.yaml | 2 +- .github/workflows/examples-openiotsdk.yaml | 2 +- .github/workflows/examples-qpg.yaml | 2 +- .github/workflows/examples-rw61x.yaml | 2 +- .github/workflows/examples-stm32.yaml | 2 +- .github/workflows/examples-telink.yaml | 44 +++++++++---------- .github/workflows/examples-tizen.yaml | 2 +- .github/workflows/full-android.yaml | 2 +- .github/workflows/fuzzing-build.yaml | 2 +- .github/workflows/java-tests.yaml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/minimal-build.yaml | 4 +- .github/workflows/qemu.yaml | 4 +- .github/workflows/release_artifacts.yaml | 4 +- .github/workflows/smoketest-android.yaml | 2 +- .github/workflows/tests.yaml | 4 +- .github/workflows/unit_integration_test.yaml | 2 +- .github/workflows/zap_regeneration.yaml | 2 +- .github/workflows/zap_templates.yaml | 2 +- examples/all-clusters-app/ameba/README.md | 4 +- .../all-clusters-minimal-app/ameba/README.md | 4 +- examples/light-switch-app/ameba/README.md | 4 +- examples/lighting-app/ameba/README.md | 4 +- examples/ota-requestor-app/ameba/README.md | 4 +- examples/pigweed-app/ameba/README.md | 4 +- integrations/cloudbuild/chef.yaml | 8 ++-- integrations/cloudbuild/smoke-test.yaml | 14 +++--- 48 files changed, 97 insertions(+), 97 deletions(-) diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index d4aa3a2fcc342c..a1b93c882bf64f 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 190a71f2c167dd..64e6b99a05d02a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -138,7 +138,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -281,7 +281,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -342,7 +342,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -451,7 +451,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 7531d97c00a10c..77c1a21be6b388 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --user root steps: @@ -56,7 +56,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 options: --user root steps: @@ -77,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:53 + image: ghcr.io/project-chip/chip-build-nrf-platform:54 options: --user root steps: @@ -98,7 +98,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:53 + image: ghcr.io/project-chip/chip-build-telink:54 options: --user root steps: @@ -110,7 +110,7 @@ jobs: platform: telink # - name: Update Zephyr to specific revision (for developers purpose) # shell: bash - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 0e8032dfef7e02498f34ba0b5d5d2df71a62adb1" - name: CI Examples Telink shell: bash run: | diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 1f30377b83dcf2..b3e2f9d1086ee8 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -42,7 +42,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: ghcr.io/project-chip/chip-build-cirque:53 + # image: ghcr.io/project-chip/chip-build-cirque:54 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index cdd535b382f3e5..abe0568fb9e011 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:53 + image: ghcr.io/project-chip/chip-build-doxygen:54 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index a75593e4240b81..7c098ea57f2403 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:53 + image: ghcr.io/project-chip/chip-build-ameba:54 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index bd6287b1a7c656..f238d10a5cf6b3 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:53 + image: ghcr.io/project-chip/chip-build-asr:54 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index ab1ba6acdb2360..12b033b791f900 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:53 + image: ghcr.io/project-chip/chip-build-bouffalolab:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 8d26fe6fa88adc..abdc5605ada47b 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:53 + image: ghcr.io/project-chip/chip-build-ti:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index e0509250c39a18..564cd34dddd5b2 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:53 + image: ghcr.io/project-chip/chip-build-ti:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 39d61fb09f2608..c44b24f02f49bd 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:53 + image: ghcr.io/project-chip/chip-build-efr32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index c8170de4e0fec9..92415c0ce96930 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -126,7 +126,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index a7a1fb1ab14b14..290e67273f9bd3 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-infineon:53 + image: ghcr.io/project-chip/chip-build-infineon:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index f8e7632c60e0ed..4bf103ddae4542 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:53 + image: ghcr.io/project-chip/chip-build-crosscompile:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index dd053382ccf079..ab32eef0801353 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:53 + image: ghcr.io/project-chip/chip-build-imx:54 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index b020b0cff1a1a3..eb97e63235e714 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index 84ab3bfa137c0e..d18de64382ee6a 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index a774fbf52f1ae7..3516c721fa157f 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-mbed-os:53 + image: ghcr.io/project-chip/chip-build-mbed-os:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 8b489aec59e5dd..780543a70d1f11 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 8689925c6f35f6..c8d997d5ca6631 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:53 + image: ghcr.io/project-chip/chip-build-nrf-platform:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index a074e17bedb029..5ffd19b1319ff5 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:53 + image: ghcr.io/project-chip/chip-build-nuttx:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index f437461ea8c5bb..05d434b0a67792 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:53 + image: ghcr.io/project-chip/chip-build-k32w:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index c2fbe82b806bfa..2f878ea48e4540 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:53 + image: ghcr.io/project-chip/chip-build-openiotsdk:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 29bdb3f8abae12..2bb85ad4acbfac 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml index efc56c2ec125c8..eed41f209ed61d 100644 --- a/.github/workflows/examples-rw61x.yaml +++ b/.github/workflows/examples-rw61x.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-rw61x:53 + image: ghcr.io/project-chip/chip-build-rw61x:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 050ec72a48db5a..809861cdee179e 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 331ee5543932e9..6c836294381a0f 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:53 + image: ghcr.io/project-chip/chip-build-telink:54 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -57,7 +57,7 @@ jobs: gh-context: ${{ toJson(github) }} # - name: Update Zephyr to specific revision (for developers purpose) - # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 68deadeb5c20b82d68700e720d4580e8003bf1d8" + # run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py 0e8032dfef7e02498f34ba0b5d5d2df71a62adb1" - name: Build example Telink (B92 retention) Air Quality Sensor App run: | @@ -95,13 +95,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B91) Bridge App + - name: Build example Telink (B95) Bridge App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-bridge' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9258a-bridge' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d bridge-app \ - out/telink-tlsr9518adk80d-bridge/zephyr/zephyr.elf \ + telink tlsr9258a bridge-app \ + out/telink-tlsr9258a-bridge/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output @@ -177,37 +177,37 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B91) OTA Requestor App + - name: Build example Telink (B95) OTA Requestor App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-ota-requestor' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9258a-ota-requestor' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d ota-requestor-app \ - out/telink-tlsr9518adk80d-ota-requestor/zephyr/zephyr.elf \ + telink tlsr9258a ota-requestor-app \ + out/telink-tlsr9258a-ota-requestor/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B95) Pump App + - name: Build example Telink (B91) Pump App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9258a-pump' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9258a pump-app \ - out/telink-tlsr9258a-pump/zephyr/zephyr.elf \ + telink tlsr9518adk80d pump-app \ + out/telink-tlsr9518adk80d-pump/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output run: rm -rf ./out - - name: Build example Telink (W91) Pump Controller App + - name: Build example Telink (B91) Pump Controller App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-pump-controller' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-pump-controller' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9118bdk40d pump-controller-app \ - out/telink-tlsr9118bdk40d-pump-controller/zephyr/zephyr.elf \ + telink tlsr9518adk80d pump-controller-app \ + out/telink-tlsr9518adk80d-pump-controller/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output @@ -261,13 +261,13 @@ jobs: - name: clean out build output run: rm -rf ./out - - name: Build example Telink (B95) Window Covering App + - name: Build example Telink (W91) Window Covering App run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9258a-window-covering' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9118bdk40d-window-covering' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9258a window-covering \ - out/telink-tlsr9258a-window-covering/zephyr/zephyr.elf \ + telink tlsr9118bdk40d window-covering \ + out/telink-tlsr9118bdk40d-window-covering/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 295f6d158c87d9..ae5a847026d3c1 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:53 + image: ghcr.io/project-chip/chip-build-tizen:54 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index eec019ed11b85d..c86839d8f51708 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:53 + image: ghcr.io/project-chip/chip-build-android:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 55d0ccd18c75e1..30b697c5f1f6ce 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 16bec4c8187ca3..ff734d2d4fe338 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:53 + image: ghcr.io/project-chip/chip-build-java:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bd5385580b9c22..2b5bbeff0fe465 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:50 + image: ghcr.io/project-chip/chip-build:54 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 7e2170baedf5b5..6fd9a96e151ec6 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:53 + image: ghcr.io/project-chip/chip-build-minimal:54 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:50 + image: ghcr.io/project-chip/chip-build-minimal:54 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 8129351ce9bf7c..bff12a5999586e 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:53 + image: ghcr.io/project-chip/chip-build-esp32-qemu:54 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -78,7 +78,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen-qemu:53 + image: ghcr.io/project-chip/chip-build-tizen-qemu:54 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 2605f723edf5ff..178bc028ea6b46 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:53 + image: ghcr.io/project-chip/chip-build-esp32:54 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:53 + image: ghcr.io/project-chip/chip-build-efr32:54 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 90afb58f5f06ec..014573614a0448 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:53 + image: ghcr.io/project-chip/chip-build-android:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 24895bf5f07e01..78c6d7347725ef 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -440,7 +440,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index fc209e42ea7b01..c1d3bebddde5ae 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 1ce0250f6a623e..81ffbcbb3b057a 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index fb2d2de06becfd..987cc82a2e3f06 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:53 + image: ghcr.io/project-chip/chip-build:54 defaults: run: shell: sh diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 831933d86e6d25..adf6e590593fd7 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index 12e9ff5eca1a71..b4e72ca32d02b5 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 ``` - Setup build environment: diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index 8bf606b1381042..3476d6d8cd5317 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 8d4c0fc79acc09..b170e9026325f8 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index fd262c6a029030..a5de1316eb523c 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index d997bccd5353c4..7086f7fe87e7ac 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:50 + $ docker pull ghcr.io/project-chip/chip-build-ameba:54 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:50 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 - Setup build environment: diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 220d147bce4fb5..7ff067f725d3f4 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -23,7 +23,7 @@ steps: - name: pwenv path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -38,7 +38,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index d418f9cd2ec63c..c8e49945881484 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -24,7 +24,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -45,7 +45,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -66,7 +66,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -88,7 +88,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -141,7 +141,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:50" + - name: "ghcr.io/project-chip/chip-build-vscode:54" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv From d15f6c13b68651e7724dd12deb87b57902b51bfe Mon Sep 17 00:00:00 2001 From: Sting Chang <33673360+stingchang@users.noreply.github.com> Date: Thu, 6 Jun 2024 17:50:07 +0800 Subject: [PATCH 29/78] Enable chef robotic vacuum cleaner device (#33258) * Enable chef robotic vacuum cleaner device * Restyled by whitespace * Restyled by clang-format * remove old rvc feature * Restyled by clang-format * update return status * Restyled by whitespace * Restyled by clang-format * add back ifdef; remove old feature flag * Restyled by clang-format * write read attributes into buffer * Restyled by clang-format * update readCallback write buffer * Restyled by whitespace * update buffer read in read call back * Restyled by clang-format * use static instance * Restyled by clang-format * write attribute into buffer in callback * use unique_ptr * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../chef/common/chef-rvc-mode-delegate.cpp | 155 +++++++--- examples/chef/common/chef-rvc-mode-delegate.h | 20 ++ .../chef-rvc-operational-state-delegate.cpp | 208 +++++++++---- .../chef-rvc-operational-state-delegate.h | 71 ++--- examples/chef/common/stubs.cpp | 32 ++ ...ode_roboticvacuumcleaner_1807ff0c49.matter | 276 ++++++++++++++++++ ...otnode_roboticvacuumcleaner_1807ff0c49.zap | 245 +++++++++++++++- integrations/cloudbuild/chef.yaml | 2 +- 8 files changed, 862 insertions(+), 147 deletions(-) diff --git a/examples/chef/common/chef-rvc-mode-delegate.cpp b/examples/chef/common/chef-rvc-mode-delegate.cpp index 20f3afbbd5592d..32b4cad0236899 100644 --- a/examples/chef/common/chef-rvc-mode-delegate.cpp +++ b/examples/chef/common/chef-rvc-mode-delegate.cpp @@ -18,17 +18,20 @@ #include #include +using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; using chip::Protocols::InteractionModel::Status; template using List = chip::app::DataModel::List; using ModeTagStructType = chip::app::Clusters::detail::Structs::ModeTagStruct::Type; -#ifdef ZCL_USING_RVC_RUN_MODE_CLUSTER_SERVER +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER #include using namespace chip::app::Clusters::RvcRunMode; -static RvcRunModeDelegate * gRvcRunModeDelegate = nullptr; -static ModeBase::Instance * gRvcRunModeInstance = nullptr; + +static std::unique_ptr gRvcRunModeDelegate; +static std::unique_ptr gRvcRunModeInstance; CHIP_ERROR RvcRunModeDelegate::Init() { @@ -87,40 +90,82 @@ CHIP_ERROR RvcRunModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, ListattributeId; + + switch (attributeId) { - delete gRvcRunModeInstance; - gRvcRunModeInstance = nullptr; + case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: { + uint8_t m = static_cast(buffer[0]); + ret = gRvcRunModeInstance->UpdateCurrentMode(m); + if (chip::Protocols::InteractionModel::Status::Success != ret) + { + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(ret)); + } } - if (gRvcRunModeDelegate != nullptr) + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite; + ChipLogError(DeviceLayer, "Unsupported Writng Attribute ID: %d", static_cast(attributeId)); + break; + } + + return ret; +} + +chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) { - delete gRvcRunModeDelegate; - gRvcRunModeDelegate = nullptr; + case chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id: { + *buffer = gRvcRunModeInstance->GetCurrentMode(); + ChipLogDetail(DeviceLayer, "Reading RunMode CurrentMode : %d", static_cast(attributeId)); + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedRead; + ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RvcRunMode", static_cast(attributeId)); + break; } + + return ret; } void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr); - gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate; - gRvcRunModeInstance = - new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kOnOff)); + VerifyOrDie(!gRvcRunModeDelegate && !gRvcRunModeInstance); + + gRvcRunModeDelegate = std::make_unique(); + gRvcRunModeInstance = std::make_unique(gRvcRunModeDelegate.get(), endpointId, RvcRunMode::Id, + chip::to_underlying(RvcRunMode::Feature::kNoFeatures)); gRvcRunModeInstance->Init(); } -#ifdef ZCL_USING_RVC_CLEAN_MODE_CLUSTER_SERVER +#endif // MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER #include using namespace chip::app::Clusters::RvcCleanMode; -static RvcCleanModeDelegate * gRvcCleanModeDelegate = nullptr; -static ModeBase::Instance * gRvcCleanModeInstance = nullptr; +static std::unique_ptr gRvcCleanModeDelegate; +static std::unique_ptr gRvcCleanModeInstance; CHIP_ERROR RvcCleanModeDelegate::Init() { @@ -178,33 +223,75 @@ CHIP_ERROR RvcCleanModeDelegate::GetModeTagsByIndex(uint8_t modeIndex, ListattributeId; + + switch (attributeId) { - delete gRvcCleanModeInstance; - gRvcCleanModeInstance = nullptr; + case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: { + uint8_t m = static_cast(buffer[0]); + ret = gRvcCleanModeInstance->UpdateCurrentMode(m); + if (chip::Protocols::InteractionModel::Status::Success != ret) + { + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %d", static_cast(ret)); + } + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedWrite; + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; } - if (gRvcCleanModeDelegate != nullptr) + + return ret; +} + +chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpointId, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) +{ + VerifyOrReturnValue(maxReadLength > 0, chip::Protocols::InteractionModel::Status::ResourceExhausted); + buffer[0] = gRvcCleanModeInstance->GetCurrentMode(); + + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + + switch (attributeId) { - delete gRvcCleanModeDelegate; - gRvcCleanModeDelegate = nullptr; + case chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id: { + *buffer = gRvcCleanModeInstance->GetCurrentMode(); + ChipLogDetail(DeviceLayer, "Reading CleanMode CurrentMode : %d", static_cast(attributeId)); } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedRead; + ChipLogDetail(DeviceLayer, "Unsupported attributeId %d from reading RvcCleanMode", static_cast(attributeId)); + break; + } + + return ret; } void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr); - gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate; - gRvcCleanModeInstance = - new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcCleanMode::Feature::kOnOff)); + VerifyOrDie(!gRvcCleanModeDelegate && !gRvcCleanModeInstance); + + gRvcCleanModeDelegate = std::make_unique(); + gRvcCleanModeInstance = std::make_unique(gRvcCleanModeDelegate.get(), endpointId, RvcCleanMode::Id, + chip::to_underlying(RvcCleanMode::Feature::kNoFeatures)); gRvcCleanModeInstance->Init(); } -#endif // ZCL_USING_RVC_CLEAN_MODE_CLUSTER_SERVER -#endif // ZCL_USING_RVC_RUN_MODE_CLUSTER_SERVER +#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER diff --git a/examples/chef/common/chef-rvc-mode-delegate.h b/examples/chef/common/chef-rvc-mode-delegate.h index 5f96957420a441..359c90c5a08162 100644 --- a/examples/chef/common/chef-rvc-mode-delegate.h +++ b/examples/chef/common/chef-rvc-mode-delegate.h @@ -23,6 +23,8 @@ #include #include +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace app { namespace Clusters { @@ -118,3 +120,21 @@ void Shutdown(); } // namespace Clusters } // namespace app } // namespace chip + +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER +chip::Protocols::InteractionModel::Status chefRvcRunModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcRunModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER +chip::Protocols::InteractionModel::Status chefRvcCleanModeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcCleanModeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER diff --git a/examples/chef/common/chef-rvc-operational-state-delegate.cpp b/examples/chef/common/chef-rvc-operational-state-delegate.cpp index 9ea4e610e64fb1..36ff3e88fcd181 100644 --- a/examples/chef/common/chef-rvc-operational-state-delegate.cpp +++ b/examples/chef/common/chef-rvc-operational-state-delegate.cpp @@ -17,17 +17,31 @@ */ #include #include - -#ifdef ZCL_USING_OPERATIONAL_STATE_RVC_CLUSTER_SERVER #include +#include +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; using namespace chip::app::Clusters::OperationalState; using namespace chip::app::Clusters::RvcOperationalState; +using chip::Protocols::InteractionModel::Status; + +static std::unique_ptr gRvcOperationalStateDelegate; +static std::unique_ptr gRvcOperationalStateInstance; + +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data); + +DataModel::Nullable RvcOperationalStateDelegate::GetCountdownTime() +{ + if (mRunningTime > mPhaseDuration.Value()) + return DataModel::NullNullable; -CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) + return DataModel::MakeNullable((uint32_t) (mPhaseDuration.Value() - mRunningTime)); +} + +CHIP_ERROR RvcOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) { if (index >= mOperationalStateList.size()) { @@ -37,7 +51,7 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalStateAtIndex(size_ return CHIP_NO_ERROR; } -CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) +CHIP_ERROR RvcOperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, MutableCharSpan & operationalPhase) { if (index >= mOperationalPhaseList.size()) { @@ -46,125 +60,203 @@ CHIP_ERROR GenericOperationalStateDelegateImpl::GetOperationalPhaseAtIndex(size_ return CopyCharSpanToMutableCharSpan(mOperationalPhaseList[index], operationalPhase); } -void GenericOperationalStateDelegateImpl::HandlePauseStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandlePauseStateCallback(GenericOperationalError & err) { // placeholder implementation auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleResumeStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleResumeStateCallback(GenericOperationalError & err) { // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleStartStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleStartStateCallback(GenericOperationalError & err) { + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + if (current_err.errorStateID != to_underlying(OperationalState::ErrorStateEnum::kNoError)) + { + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToStartOrResume)); + return; + } + // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kRunning)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, this); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } -void GenericOperationalStateDelegateImpl::HandleStopStateCallback(GenericOperationalError & err) +void RvcOperationalStateDelegate::HandleStopStateCallback(GenericOperationalError & err) { // placeholder implementation - auto error = GetInstance()->SetOperationalState(to_underlying(OperationalStateEnum::kStopped)); + auto error = GetInstance()->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); if (error == CHIP_NO_ERROR) { - err.Set(to_underlying(ErrorStateEnum::kNoError)); + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, this); + + OperationalState::GenericOperationalError current_err(to_underlying(OperationalState::ErrorStateEnum::kNoError)); + GetInstance()->GetCurrentOperationalError(current_err); + + Optional> totalTime((DataModel::Nullable(mRunningTime + mPausedTime))); + Optional> pausedTime((DataModel::Nullable(mPausedTime))); + + GetInstance()->OnOperationCompletionDetected(static_cast(current_err.errorStateID), totalTime, pausedTime); + + mRunningTime = 0; + mPausedTime = 0; + err.Set(to_underlying(OperationalState::ErrorStateEnum::kNoError)); } else { - err.Set(to_underlying(ErrorStateEnum::kUnableToCompleteOperation)); + err.Set(to_underlying(OperationalState::ErrorStateEnum::kUnableToCompleteOperation)); } } +static void onOperationalStateTimerTick(System::Layer * systemLayer, void * data) +{ + RvcOperationalStateDelegate * delegate = reinterpret_cast(data); -// Init Operational State cluster + OperationalState::Instance * instance = gRvcOperationalStateInstance.get(); + OperationalState::OperationalStateEnum state = + static_cast(instance->GetCurrentOperationalState()); -static OperationalState::Instance * gOperationalStateInstance = nullptr; -static OperationalStateDelegate * gOperationalStateDelegate = nullptr; + auto countdown_time = delegate->GetCountdownTime(); -void OperationalState::Shutdown() -{ - if (gOperationalStateInstance != nullptr) + if (countdown_time.ValueOr(1) > 0) { - delete gOperationalStateInstance; - gOperationalStateInstance = nullptr; + if (state == OperationalState::OperationalStateEnum::kRunning) + { + delegate->mRunningTime++; + } + else if (state == OperationalState::OperationalStateEnum::kPaused) + { + delegate->mPausedTime++; + } } - if (gOperationalStateDelegate != nullptr) + + if (state == OperationalState::OperationalStateEnum::kRunning || state == OperationalState::OperationalStateEnum::kPaused) { - delete gOperationalStateDelegate; - gOperationalStateDelegate = nullptr; + (void) DeviceLayer::SystemLayer().StartTimer(System::Clock::Seconds16(1), onOperationalStateTimerTick, delegate); + } + else + { + (void) DeviceLayer::SystemLayer().CancelTimer(onOperationalStateTimerTick, delegate); } } -void emberAfOperationalStateClusterInitCallback(chip::EndpointId endpointId) +void RvcOperationalState::Shutdown() { - VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gOperationalStateInstance == nullptr && gOperationalStateDelegate == nullptr); + gRvcOperationalStateInstance.reset(); + gRvcOperationalStateDelegate.reset(); +} - gOperationalStateDelegate = new OperationalStateDelegate; - EndpointId operationalStateEndpoint = 0x01; - gOperationalStateInstance = new OperationalState::Instance(gOperationalStateDelegate, operationalStateEndpoint); +chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpointId, + chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer) +{ + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(gRvcOperationalStateInstance != nullptr); + chip::AttributeId attributeId = attributeMetadata->attributeId; - gOperationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + switch (attributeId) + { + case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: { + uint8_t m = static_cast(buffer[0]); + DataModel::Nullable aPhase(m); + CHIP_ERROR err = gRvcOperationalStateInstance->SetCurrentPhase(aPhase); + if (CHIP_NO_ERROR == err) + { + break; + } + ret = chip::Protocols::InteractionModel::Status::ConstraintError; + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %" CHIP_ERROR_FORMAT, err.Format()); + } + break; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: { + uint8_t m = static_cast(buffer[0]); + CHIP_ERROR err = gRvcOperationalStateInstance->SetOperationalState(m); + if (CHIP_NO_ERROR == err) + { + break; + } + ret = chip::Protocols::InteractionModel::Status::ConstraintError; + ChipLogError(DeviceLayer, "Invalid Attribute Update status: %" CHIP_ERROR_FORMAT, err.Format()); + } + break; + default: + ret = chip::Protocols::InteractionModel::Status::UnsupportedAttribute; + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; + } - gOperationalStateInstance->Init(); + return ret; } -// Init RVC Operational State cluster - -static RvcOperationalState::Instance * gRvcOperationalStateInstance = nullptr; -static RvcOperationalStateDelegate * gRvcOperationalStateDelegate = nullptr; - -void RvcOperationalState::Shutdown() +chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength) { - if (gRvcOperationalStateInstance != nullptr) + chip::Protocols::InteractionModel::Status ret = chip::Protocols::InteractionModel::Status::Success; + chip::AttributeId attributeId = attributeMetadata->attributeId; + switch (attributeId) { - delete gRvcOperationalStateInstance; - gRvcOperationalStateInstance = nullptr; + case chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id: { + + app::DataModel::Nullable currentPhase = gRvcOperationalStateInstance->GetCurrentPhase(); + if (currentPhase.IsNull()) + { + ret = chip::Protocols::InteractionModel::Status::UnsupportedAttribute; + break; + } + *buffer = currentPhase.Value(); } - if (gRvcOperationalStateDelegate != nullptr) - { - delete gRvcOperationalStateDelegate; - gRvcOperationalStateDelegate = nullptr; + break; + case chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id: { + *buffer = gRvcOperationalStateInstance->GetCurrentOperationalState(); } + break; + default: + ChipLogError(DeviceLayer, "Unsupported Attribute ID: %d", static_cast(attributeId)); + break; + } + + return ret; } void emberAfRvcOperationalStateClusterInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. - VerifyOrDie(gRvcOperationalStateInstance == nullptr && gRvcOperationalStateDelegate == nullptr); - - gRvcOperationalStateDelegate = new RvcOperationalStateDelegate; - EndpointId operationalStateEndpoint = 0x01; - gRvcOperationalStateInstance = new RvcOperationalState::Instance(gRvcOperationalStateDelegate, operationalStateEndpoint); - - gRvcOperationalStateInstance->SetOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)); + VerifyOrDie(!gRvcOperationalStateDelegate && !gRvcOperationalStateInstance); + gRvcOperationalStateDelegate = std::make_unique(); + gRvcOperationalStateInstance = std::make_unique(gRvcOperationalStateDelegate.get(), endpointId); gRvcOperationalStateInstance->Init(); } #endif // MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER diff --git a/examples/chef/common/chef-rvc-operational-state-delegate.h b/examples/chef/common/chef-rvc-operational-state-delegate.h index f487e38000771d..33b01d55201466 100644 --- a/examples/chef/common/chef-rvc-operational-state-delegate.h +++ b/examples/chef/common/chef-rvc-operational-state-delegate.h @@ -23,21 +23,26 @@ #include +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER +using chip::Protocols::InteractionModel::Status; + namespace chip { namespace app { namespace Clusters { -namespace OperationalState { +namespace RvcOperationalState { // This is an application level delegate to handle operational state commands according to the specific business logic. -class GenericOperationalStateDelegateImpl : public Delegate +class RvcOperationalStateDelegate : public RvcOperationalState::Delegate { public: + RvcOperationalStateDelegate() { mOperationalStateList = Span(rvcOpStateList); } + /** * Get the countdown time. This attribute is not used in this application. * @return The current countdown time. */ - app::DataModel::Nullable GetCountdownTime() override { return {}; }; + app::DataModel::Nullable GetCountdownTime() override; /** * Fills in the provided GenericOperationalState with the state at index `index` if there is one, @@ -47,7 +52,7 @@ class GenericOperationalStateDelegateImpl : public Delegate * @param index The index of the state, with 0 representing the first state. * @param operationalState The GenericOperationalState is filled. */ - CHIP_ERROR GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) override; + CHIP_ERROR GetOperationalStateAtIndex(size_t index, OperationalState::GenericOperationalState & operationalState) override; /** * Fills in the provided MutableCharSpan with the phase at index `index` if there is one, @@ -68,59 +73,34 @@ class GenericOperationalStateDelegateImpl : public Delegate * Handle Command Callback in application: Pause * @param[out] get operational error after callback. */ - void HandlePauseStateCallback(GenericOperationalError & err) override; + void HandlePauseStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Resume * @param[out] get operational error after callback. */ - void HandleResumeStateCallback(GenericOperationalError & err) override; + void HandleResumeStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Start * @param[out] get operational error after callback. */ - void HandleStartStateCallback(GenericOperationalError & err) override; + void HandleStartStateCallback(OperationalState::GenericOperationalError & err) override; /** * Handle Command Callback in application: Stop * @param[out] get operational error after callback. */ - void HandleStopStateCallback(GenericOperationalError & err) override; + void HandleStopStateCallback(OperationalState::GenericOperationalError & err) override; -protected: - Span mOperationalStateList; - Span mOperationalPhaseList; -}; + uint32_t mRunningTime = 0; + uint32_t mPausedTime = 0; + app::DataModel::Nullable mPhaseDuration; -// This is an application level delegate to handle operational state commands according to the specific business logic. -class OperationalStateDelegate : public GenericOperationalStateDelegateImpl -{ private: - const GenericOperationalState opStateList[4] = { - GenericOperationalState(to_underlying(OperationalStateEnum::kStopped)), - GenericOperationalState(to_underlying(OperationalStateEnum::kRunning)), - GenericOperationalState(to_underlying(OperationalStateEnum::kPaused)), - GenericOperationalState(to_underlying(OperationalStateEnum::kError)), - }; - -public: - OperationalStateDelegate() - { - GenericOperationalStateDelegateImpl::mOperationalStateList = Span(opStateList); - } -}; - -void Shutdown(); - -} // namespace OperationalState - -namespace RvcOperationalState { + Span mOperationalStateList; + Span mOperationalPhaseList; -// This is an application level delegate to handle operational state commands according to the specific business logic. -class RvcOperationalStateDelegate : public OperationalState::GenericOperationalStateDelegateImpl -{ -private: const OperationalState::GenericOperationalState rvcOpStateList[7] = { OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)), OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)), @@ -131,13 +111,6 @@ class RvcOperationalStateDelegate : public OperationalState::GenericOperationalS OperationalState::GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kCharging)), OperationalState::GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kDocked)), }; - -public: - RvcOperationalStateDelegate() - { - GenericOperationalStateDelegateImpl::mOperationalStateList = - Span(rvcOpStateList); - } }; void Shutdown(); @@ -146,3 +119,11 @@ void Shutdown(); } // namespace Clusters } // namespace app } // namespace chip + +chip::Protocols::InteractionModel::Status chefRvcOperationalStateWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer); +chip::Protocols::InteractionModel::Status chefRvcOperationalStateReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + const EmberAfAttributeMetadata * attributeMetadata, + uint8_t * buffer, uint16_t maxReadLength); +#endif // MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 437dfe9e6221be..c0935df51efa7e 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -19,6 +19,14 @@ #include "chef-concentration-measurement.h" #endif +#if defined(MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER) || defined(MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER) +#include "chef-rvc-mode-delegate.h" +#endif + +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER +#include "chef-rvc-operational-state-delegate.h" +#endif + using chip::app::DataModel::Nullable; using namespace chip; @@ -56,6 +64,18 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin case chip::app::Clusters::RadonConcentrationMeasurement::Id: case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + case chip::app::Clusters::RvcRunMode::Id: + return chefRvcRunModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER + case chip::app::Clusters::RvcCleanMode::Id: + return chefRvcCleanModeReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER + case chip::app::Clusters::RvcOperationalState::Id: + return chefRvcOperationalStateReadCallback(endpoint, clusterId, attributeMetadata, buffer, maxReadLength); #endif default: break; @@ -104,6 +124,18 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi case chip::app::Clusters::RadonConcentrationMeasurement::Id: case chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id: return chefConcentrationMeasurementWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_RUN_MODE_SERVER + case chip::app::Clusters::RvcRunMode::Id: + return chefRvcRunModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_CLEAN_MODE_SERVER + case chip::app::Clusters::RvcCleanMode::Id: + return chefRvcCleanModeWriteCallback(endpoint, clusterId, attributeMetadata, buffer); +#endif +#ifdef MATTER_DM_PLUGIN_RVC_OPERATIONAL_STATE_SERVER + case chip::app::Clusters::RvcOperationalState::Id: + return chefRvcOperationalStateWriteCallback(endpoint, clusterId, attributeMetadata, buffer); #endif default: break; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter index f2ab0c354ca1cf..0d5013c6b8d29c 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.matter @@ -333,6 +333,265 @@ cluster BasicInformation = 40 { command MfgSpecificPing(): DefaultSuccess = 0; } +/** This cluster is used to describe the configuration and capabilities of a physical power source that provides power to the Node. */ +cluster PowerSource = 47 { + revision 1; // NOTE: Default/not specifically set + + enum BatApprovedChemistryEnum : enum16 { + kUnspecified = 0; + kAlkaline = 1; + kLithiumCarbonFluoride = 2; + kLithiumChromiumOxide = 3; + kLithiumCopperOxide = 4; + kLithiumIronDisulfide = 5; + kLithiumManganeseDioxide = 6; + kLithiumThionylChloride = 7; + kMagnesium = 8; + kMercuryOxide = 9; + kNickelOxyhydride = 10; + kSilverOxide = 11; + kZincAir = 12; + kZincCarbon = 13; + kZincChloride = 14; + kZincManganeseDioxide = 15; + kLeadAcid = 16; + kLithiumCobaltOxide = 17; + kLithiumIon = 18; + kLithiumIonPolymer = 19; + kLithiumIronPhosphate = 20; + kLithiumSulfur = 21; + kLithiumTitanate = 22; + kNickelCadmium = 23; + kNickelHydrogen = 24; + kNickelIron = 25; + kNickelMetalHydride = 26; + kNickelZinc = 27; + kSilverZinc = 28; + kSodiumIon = 29; + kSodiumSulfur = 30; + kZincBromide = 31; + kZincCerium = 32; + } + + enum BatChargeFaultEnum : enum8 { + kUnspecified = 0; + kAmbientTooHot = 1; + kAmbientTooCold = 2; + kBatteryTooHot = 3; + kBatteryTooCold = 4; + kBatteryAbsent = 5; + kBatteryOverVoltage = 6; + kBatteryUnderVoltage = 7; + kChargerOverVoltage = 8; + kChargerUnderVoltage = 9; + kSafetyTimeout = 10; + } + + enum BatChargeLevelEnum : enum8 { + kOK = 0; + kWarning = 1; + kCritical = 2; + } + + enum BatChargeStateEnum : enum8 { + kUnknown = 0; + kIsCharging = 1; + kIsAtFullCharge = 2; + kIsNotCharging = 3; + } + + enum BatCommonDesignationEnum : enum16 { + kUnspecified = 0; + kAAA = 1; + kAA = 2; + kC = 3; + kD = 4; + k4v5 = 5; + k6v0 = 6; + k9v0 = 7; + k12AA = 8; + kAAAA = 9; + kA = 10; + kB = 11; + kF = 12; + kN = 13; + kNo6 = 14; + kSubC = 15; + kA23 = 16; + kA27 = 17; + kBA5800 = 18; + kDuplex = 19; + k4SR44 = 20; + k523 = 21; + k531 = 22; + k15v0 = 23; + k22v5 = 24; + k30v0 = 25; + k45v0 = 26; + k67v5 = 27; + kJ = 28; + kCR123A = 29; + kCR2 = 30; + k2CR5 = 31; + kCRP2 = 32; + kCRV3 = 33; + kSR41 = 34; + kSR43 = 35; + kSR44 = 36; + kSR45 = 37; + kSR48 = 38; + kSR54 = 39; + kSR55 = 40; + kSR57 = 41; + kSR58 = 42; + kSR59 = 43; + kSR60 = 44; + kSR63 = 45; + kSR64 = 46; + kSR65 = 47; + kSR66 = 48; + kSR67 = 49; + kSR68 = 50; + kSR69 = 51; + kSR516 = 52; + kSR731 = 53; + kSR712 = 54; + kLR932 = 55; + kA5 = 56; + kA10 = 57; + kA13 = 58; + kA312 = 59; + kA675 = 60; + kAC41E = 61; + k10180 = 62; + k10280 = 63; + k10440 = 64; + k14250 = 65; + k14430 = 66; + k14500 = 67; + k14650 = 68; + k15270 = 69; + k16340 = 70; + kRCR123A = 71; + k17500 = 72; + k17670 = 73; + k18350 = 74; + k18500 = 75; + k18650 = 76; + k19670 = 77; + k25500 = 78; + k26650 = 79; + k32600 = 80; + } + + enum BatFaultEnum : enum8 { + kUnspecified = 0; + kOverTemp = 1; + kUnderTemp = 2; + } + + enum BatReplaceabilityEnum : enum8 { + kUnspecified = 0; + kNotReplaceable = 1; + kUserReplaceable = 2; + kFactoryReplaceable = 3; + } + + enum PowerSourceStatusEnum : enum8 { + kUnspecified = 0; + kActive = 1; + kStandby = 2; + kUnavailable = 3; + } + + enum WiredCurrentTypeEnum : enum8 { + kAC = 0; + kDC = 1; + } + + enum WiredFaultEnum : enum8 { + kUnspecified = 0; + kOverVoltage = 1; + kUnderVoltage = 2; + } + + bitmap Feature : bitmap32 { + kWired = 0x1; + kBattery = 0x2; + kRechargeable = 0x4; + kReplaceable = 0x8; + } + + struct BatChargeFaultChangeType { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + struct BatFaultChangeType { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + struct WiredFaultChangeType { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event WiredFaultChange = 0 { + WiredFaultEnum current[] = 0; + WiredFaultEnum previous[] = 1; + } + + info event BatFaultChange = 1 { + BatFaultEnum current[] = 0; + BatFaultEnum previous[] = 1; + } + + info event BatChargeFaultChange = 2 { + BatChargeFaultEnum current[] = 0; + BatChargeFaultEnum previous[] = 1; + } + + readonly attribute PowerSourceStatusEnum status = 0; + readonly attribute int8u order = 1; + readonly attribute char_string<60> description = 2; + readonly attribute optional nullable int32u wiredAssessedInputVoltage = 3; + readonly attribute optional nullable int16u wiredAssessedInputFrequency = 4; + readonly attribute optional WiredCurrentTypeEnum wiredCurrentType = 5; + readonly attribute optional nullable int32u wiredAssessedCurrent = 6; + readonly attribute optional int32u wiredNominalVoltage = 7; + readonly attribute optional int32u wiredMaximumCurrent = 8; + readonly attribute optional boolean wiredPresent = 9; + readonly attribute optional WiredFaultEnum activeWiredFaults[] = 10; + readonly attribute optional nullable int32u batVoltage = 11; + readonly attribute optional nullable int8u batPercentRemaining = 12; + readonly attribute optional nullable int32u batTimeRemaining = 13; + readonly attribute optional BatChargeLevelEnum batChargeLevel = 14; + readonly attribute optional boolean batReplacementNeeded = 15; + readonly attribute optional BatReplaceabilityEnum batReplaceability = 16; + readonly attribute optional boolean batPresent = 17; + readonly attribute optional BatFaultEnum activeBatFaults[] = 18; + readonly attribute optional char_string<60> batReplacementDescription = 19; + readonly attribute optional BatCommonDesignationEnum batCommonDesignation = 20; + readonly attribute optional char_string<20> batANSIDesignation = 21; + readonly attribute optional char_string<20> batIECDesignation = 22; + readonly attribute optional BatApprovedChemistryEnum batApprovedChemistry = 23; + readonly attribute optional int32u batCapacity = 24; + readonly attribute optional int8u batQuantity = 25; + readonly attribute optional BatChargeStateEnum batChargeState = 26; + readonly attribute optional nullable int32u batTimeToFullCharge = 27; + readonly attribute optional boolean batFunctionalWhileCharging = 28; + readonly attribute optional nullable int32u batChargingCurrent = 29; + readonly attribute optional BatChargeFaultEnum activeBatChargeFaults[] = 30; + readonly attribute endpoint_no endpointList[] = 31; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster is used to manage global aspects of the Commissioning flow. */ cluster GeneralCommissioning = 48 { revision 1; // NOTE: Default/not specifically set @@ -1366,6 +1625,7 @@ endpoint 0 { } } endpoint 1 { + device type ma_powersource = 17, version 1; device type ma_robotic_vacuum_cleaner = 116, version 1; @@ -1417,6 +1677,22 @@ endpoint 1 { callback attribute clusterRevision; } + server cluster PowerSource { + ram attribute status; + ram attribute order; + ram attribute description; + ram attribute batPercentRemaining default = 95; + ram attribute batPresent default = 1; + ram attribute batChargeState default = 4; + callback attribute endpointList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + server cluster RvcRunMode { callback attribute supportedModes; callback attribute currentMode; diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap index 3c058e9910c45d..15c155dbb69d12 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap @@ -1,6 +1,6 @@ { "fileFormat": 2, - "featureLevel": 100, + "featureLevel": 102, "creator": "zap", "keyValuePairs": [ { @@ -29,6 +29,7 @@ "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/app-templates.json", "type": "gen-templates-json", + "category": "matter", "version": "chip-v1" } ], @@ -1924,12 +1925,18 @@ "id": 2, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "code": 116, + "code": 17, "profileId": 259, - "label": "MA-robotic-vacuum-cleaner", - "name": "MA-robotic-vacuum-cleaner" + "label": "MA-powersource", + "name": "MA-powersource" }, "deviceTypes": [ + { + "code": 17, + "profileId": 259, + "label": "MA-powersource", + "name": "MA-powersource" + }, { "code": 116, "profileId": 259, @@ -1938,13 +1945,15 @@ } ], "deviceVersions": [ + 1, 1 ], "deviceIdentifiers": [ + 17, 116 ], - "deviceTypeName": "MA-robotic-vacuum-cleaner", - "deviceTypeCode": 116, + "deviceTypeName": "MA-powersource", + "deviceTypeCode": 17, "deviceTypeProfileId": 259, "clusters": [ { @@ -2342,7 +2351,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2358,7 +2367,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2374,7 +2383,7 @@ "singleton": 0, "bounded": 0, "defaultValue": null, - "reportable": 1, + "reportable": 0, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -2477,6 +2486,224 @@ } ] }, + { + "name": "Power Source", + "code": 47, + "mfgCode": null, + "define": "POWER_SOURCE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Status", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerSourceStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Order", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPercentRemaining", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "95", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatPresent", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "BatChargeState", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "BatChargeStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EndpointList", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "RVC Run Mode", "code": 84, diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 7ff067f725d3f4..95cba5a3730e38 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -29,7 +29,7 @@ steps: args: - >- perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && - ./examples/chef/chef.py --build_all --build_exclude noip\|roboticvacuumcleaner + ./examples/chef/chef.py --build_all id: CompileAll waitFor: - Bootstrap From 88ebdf78b11216db85f6c81928f6fabb29ecf08c Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 6 Jun 2024 17:11:34 +0200 Subject: [PATCH 30/78] [Python] Remove Python Bluetooth and ChipStack event loop integration (#33775) The Python Bluetooth implementation for Linux (`BluezManager` in ChipBluezMgr.py) and macOS (`CoreBluetoothManager` in ChipCoreBluetoothMgr.py) integrate with ChipStack to pump their event loops on long running operations such as commissioning (through `CallAsyncWithCompleteCallback()`). From what I can tell, the Python Bluetooth stack is only used for some mbed integration tests. Specifically through `scan_chip_ble_devices()` in src/test_driver/mbed/integration_tests/common/utils.py. This operation doesn't need the event loop integration. So as a first step, this PR simply breaks this tie and removes the event loop integration with the Device ChipStack/ChipDeviceController. --- src/controller/python/chip/ChipBluezMgr.py | 1 - src/controller/python/chip/ChipCoreBluetoothMgr.py | 2 -- src/controller/python/chip/ChipDeviceCtrl.py | 5 ----- src/controller/python/chip/ChipStack.py | 8 +------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/controller/python/chip/ChipBluezMgr.py b/src/controller/python/chip/ChipBluezMgr.py index e480750b600af8..bacf383710eccd 100644 --- a/src/controller/python/chip/ChipBluezMgr.py +++ b/src/controller/python/chip/ChipBluezMgr.py @@ -807,7 +807,6 @@ def __init__(self, devMgr, logger=None): self.rx = None self.setInputHook(self.readlineCB) self.devMgr = devMgr - self.devMgr.SetBlockingCB(self.devMgrCB) def __del__(self): self.disconnect() diff --git a/src/controller/python/chip/ChipCoreBluetoothMgr.py b/src/controller/python/chip/ChipCoreBluetoothMgr.py index 3f792a5a4d2425..4a65f1e2377038 100644 --- a/src/controller/python/chip/ChipCoreBluetoothMgr.py +++ b/src/controller/python/chip/ChipCoreBluetoothMgr.py @@ -184,8 +184,6 @@ def __init__(self, devCtrl, logger=None): def __del__(self): self.disconnect() self.setInputHook(self.orig_input_hook) - self.devCtrl.SetBlockingCB(None) - self.devCtrl.SetBleEventCB(None) def devMgrCB(self): """A callback used by ChipDeviceCtrl.py to drive the OSX runloop while the diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 2ba7c584db927b..aca971e5d392f1 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1591,11 +1591,6 @@ async def ReadEvent(self, nodeid: int, events: typing.List[typing.Union[ else: return res.events - def SetBlockingCB(self, blockingCB): - self.CheckIsActive() - - self._ChipStack.blockingCB = blockingCB - def SetIpk(self, ipk: bytes): self._ChipStack.Call( lambda: self._dmLib.pychip_DeviceController_SetIpk(self.devCtrl, ipk, len(ipk)) diff --git a/src/controller/python/chip/ChipStack.py b/src/controller/python/chip/ChipStack.py index b47c4639825da8..5fd0601ba204e7 100644 --- a/src/controller/python/chip/ChipStack.py +++ b/src/controller/python/chip/ChipStack.py @@ -165,8 +165,6 @@ def HandleChipThreadRun(callback): callback() self.cbHandleChipThreadRun = HandleChipThreadRun - # set by other modules(BLE) that require service by thread while thread blocks. - self.blockingCB = None # # Storage has to be initialized BEFORE initializing the stack, since the latter @@ -255,11 +253,7 @@ def CallAsyncWithCompleteCallback(self, callFunct): if not res.is_success: self.completeEvent.set() raise res.to_exception() - while not self.completeEvent.isSet(): - if self.blockingCB: - self.blockingCB() - - self.completeEvent.wait(0.05) + self.completeEvent.wait() if isinstance(self.callbackRes, ChipStackException): raise self.callbackRes return self.callbackRes From 72450e4d655ecb27120993b77b28ad6cf7298469 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 6 Jun 2024 11:48:57 -0400 Subject: [PATCH 31/78] Make `CommandHandler` a pure interface class, have actual implementation in `CommandHandlerImpl` (#33736) * First pass: renames only and moved things around. It should not yet compile * Move CommandHandler::Callback to CommandHandlerImpl::Callback * Prepare some compile fixes. Uses of preparation of responses is not ok yet * More replace fixes * More compile updates * Try to implement the addResponse properly * Many more updates for compilation * More compile tests - getting closer * Things compile * Restyle * Split out CommandHandler (the interface) from CommandHandlerImpl (actual IM implementation) * Restyle * make GetExchangeContext also be virtual * Fix some includes that were previously part of CommandHandler.h * Restyle * No need for casts and private APIs: Exchange context is actually available * Code review feedback * Restyle * Upgrading docs * Slight example fix --------- Co-authored-by: Andrei Litvin --- docs/index.md | 1 + docs/upgrading.md | 62 + .../lighting-app/tizen/src/DBusInterface.cpp | 15 +- src/app/BUILD.gn | 2 + src/app/CommandHandler.cpp | 1009 +--------------- src/app/CommandHandler.h | 617 ++-------- src/app/CommandHandlerImpl.cpp | 1057 +++++++++++++++++ src/app/CommandHandlerImpl.h | 476 ++++++++ src/app/CommandResponseSender.cpp | 6 +- src/app/CommandResponseSender.h | 16 +- src/app/InteractionModelEngine.cpp | 24 +- src/app/InteractionModelEngine.h | 8 +- src/app/tests/TestCommandInteraction.cpp | 73 +- .../java/OTAProviderDelegateBridge.cpp | 1 + 14 files changed, 1764 insertions(+), 1603 deletions(-) create mode 100644 docs/upgrading.md create mode 100644 src/app/CommandHandlerImpl.cpp create mode 100644 src/app/CommandHandlerImpl.h diff --git a/docs/index.md b/docs/index.md index b7615a476818df..1f8e806dc4cce9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,6 +22,7 @@ BUG_REPORT code_generation zap_clusters spec_clusters +upgrading ERROR_CODES ``` diff --git a/docs/upgrading.md b/docs/upgrading.md new file mode 100644 index 00000000000000..cd18b533484279 --- /dev/null +++ b/docs/upgrading.md @@ -0,0 +1,62 @@ +# Upgrading notes + +## API changes and code migration + +### `CommandHandler` + +`CommandHandler` ability to directly invoke `Prepare/TLV-Write/Finish` cycles +has been changed to only expose `AddResponse/AddStatus/AddClusterSpecific*`. + +Original versions of `CommandHandler` exposed the following low-level +implementation-specific methods: `PrepareCommand`, +`PrepareInvokeResponseCommand`, `GetCommandDataIBTLVWriter` and `FinishCommand`. +These are not exposed anymore and instead one should use `AddResponse` or +`AddResponseData`. When using an `EncodableToTLV` argument, the same +functionality should be achievable. + +Example + +Before: + +```cpp + +const CommandHandler::InvokeResponseParameters prepareParams(requestPath); +ReturnOnFailure(commandHandler->PrepareInvokeResponseCommand(path, prepareParams)); + +TLV::TLVWriter *writer = commandHandler->GetCommandDataIBTLVWriter(); +ReturnOnFailure(writer->Put(chip::TLV::ContextTag(1), 123)); +ReturnOnFailure(writer->Put(chip::TLV::ContextTag(2), 234)); +return commandHandler->FinishCommand(); +``` + +After: + +```cpp + +class ReplyEncoder : public DataModel::EncodableToTLV +{ +public: + CHIP_ERROR EncodeTo(TLV::TLVWriter & writer, TLV::Tag tag) const override + { + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outerType)); + + ReturnOnFailure(writer.Put(chip::TLV::ContextTag(1), 123)); + ReturnOnFailure(writer.Put(chip::TLV::ContextTag(2), 234)); + + return writer.EndContainer(outerType); + } +}; + +// ... +ReplyEncoder replyEncoder; +commandHandler->AddResponse(path, kReplyCommandId, replyEncoder); + +// or if error handling is implemented: +// +// ReturnErrorOnFailure(commandHandler->AddResponseData(path, kReplyCommandId, replyEncoder)); +// +// In many cases error recovery from not being able to send a reply is not easy or expected, +// so code does AddResponse rather than AddResponseData. + +``` diff --git a/examples/lighting-app/tizen/src/DBusInterface.cpp b/examples/lighting-app/tizen/src/DBusInterface.cpp index e39ca5c1e1232c..50dbd37930b47f 100644 --- a/examples/lighting-app/tizen/src/DBusInterface.cpp +++ b/examples/lighting-app/tizen/src/DBusInterface.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -36,13 +37,13 @@ using namespace chip::app; namespace example { -// Dummy class to satisfy the CommandHandler::Callback interface. -class CommandHandlerCallback : public CommandHandler::Callback +// Dummy class to satisfy the CommandHandlerImpl::Callback interface. +class CommandHandlerImplCallback : public CommandHandlerImpl::Callback { public: using Status = Protocols::InteractionModel::Status; - void OnDone(CommandHandler & apCommandObj) {} - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) {} + void OnDone(CommandHandlerImpl & apCommandObj) {} + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) {} Status CommandExists(const ConcreteCommandPath & aCommandPath) { return Status::Success; } }; @@ -188,8 +189,10 @@ gboolean DBusInterface::OnColorTemperatureChanged(LightAppColorControl * colorCo // Do not handle on-change event if it was triggered by internal set VerifyOrReturnValue(!self->mInternalSet, G_DBUS_METHOD_INVOCATION_HANDLED); - CommandHandlerCallback callback; - CommandHandler handler(&callback); + // TODO: creating such a complex object seems odd here + // as handler seems not used to send back any response back anywhere. + CommandHandlerImplCallback callback; + CommandHandlerImpl handler(&callback); ConcreteCommandPath path{ self->mEndpointId, Clusters::ColorControl::Id, 0 }; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index f49a40f398842a..55bc5f305ddd99 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -338,6 +338,8 @@ source_set("command-handler") { "CommandHandler.cpp", "CommandHandler.h", "CommandHandlerExchangeInterface.h", + "CommandHandlerImpl.cpp", + "CommandHandlerImpl.h", ] public_deps = [ diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 309685491a8d82..90ebdaa43603d7 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,802 +17,8 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - namespace chip { namespace app { -using Status = Protocols::InteractionModel::Status; - -CommandHandler::CommandHandler(Callback * apCallback) : mpCallback(apCallback), mSuppressResponse(false) {} - -CommandHandler::CommandHandler(TestOnlyOverrides & aTestOverride, Callback * apCallback) : CommandHandler(apCallback) -{ - if (aTestOverride.commandPathRegistry) - { - mMaxPathsPerInvoke = aTestOverride.commandPathRegistry->MaxSize(); - mCommandPathRegistry = aTestOverride.commandPathRegistry; - } - if (aTestOverride.commandResponder) - { - SetExchangeInterface(aTestOverride.commandResponder); - } -} - -CommandHandler::~CommandHandler() -{ - InvalidateHandles(); -} - -CHIP_ERROR CommandHandler::AllocateBuffer() -{ - // We should only allocate a buffer if we will be sending out a response. - VerifyOrReturnError(ResponsesAccepted(), CHIP_ERROR_INCORRECT_STATE); - - if (!mBufferAllocated) - { - mCommandMessageWriter.Reset(); - - System::PacketBufferHandle commandPacket = System::PacketBufferHandle::New(chip::app::kMaxSecureSduLengthBytes); - VerifyOrReturnError(!commandPacket.IsNull(), CHIP_ERROR_NO_MEMORY); - - mCommandMessageWriter.Init(std::move(commandPacket)); - ReturnErrorOnFailure(mInvokeResponseBuilder.InitWithEndBufferReserved(&mCommandMessageWriter)); - - if (mReserveSpaceForMoreChunkMessages) - { - ReturnErrorOnFailure(mInvokeResponseBuilder.ReserveSpaceForMoreChunkedMessages()); - } - - // Sending an InvokeResponse to an InvokeResponse is going to be removed from the spec soon. - // It was never implemented in the SDK, and there are no command responses that expect a - // command response. This means we will never receive an InvokeResponse Message in response - // to an InvokeResponse Message that we are sending. This means that the only response - // we are expecting to receive in response to an InvokeResponse Message that we are - // sending-out is a status when we are chunking multiple responses. As a result, to satisfy the - // condition that we don't set SuppressResponse to true while also setting - // MoreChunkedMessages to true, we are hardcoding the value to false here. - mInvokeResponseBuilder.SuppressResponse(/* aSuppressResponse = */ false); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - - mInvokeResponseBuilder.CreateInvokeResponses(/* aReserveEndBuffer = */ true); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - - mBufferAllocated = true; - MoveToState(State::NewResponseMessage); - } - - return CHIP_NO_ERROR; -} - -Status CommandHandler::OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "state should be Idle"); - - SetExchangeInterface(&commandResponder); - - // Using RAII here: if this is the only handle remaining, DecrementHoldOff will - // call the CommandHandler::OnDone callback when this function returns. - Handle workHandle(this); - - Status status = ProcessInvokeRequest(std::move(payload), isTimedInvoke); - mGoneAsync = true; - return status; -} - -CHIP_ERROR CommandHandler::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) -{ - ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, - aResponseCommandId }; - - InvokeResponseParameters prepareParams(aRequestCommandPath); - prepareParams.SetStartOrEndDataStruct(false); - - { - ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); - ReturnErrorOnFailure(PrepareInvokeResponseCommand(responseCommandPath, prepareParams)); - } - - TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); - return FinishCommand(/* aEndDataStruct = */ false); -} - -CHIP_ERROR CommandHandler::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - size_t commandCount = 0; - bool commandRefExpected = false; - InvokeRequests::Parser invokeRequests; - - ReturnErrorOnFailure(invokeRequestMessage.GetInvokeRequests(&invokeRequests)); - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - ReturnErrorOnFailure(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */)); - - // If this is a GroupRequest the only thing to check is that there is only one - // CommandDataIB. - if (IsGroupRequest()) - { - VerifyOrReturnError(commandCount == 1, CHIP_ERROR_INVALID_ARGUMENT); - return CHIP_NO_ERROR; - } - // While technically any commandCount == 1 should already be unique and does not need - // any further validation, we do need to read and populate the registry to help - // in building the InvokeResponse. - - VerifyOrReturnError(commandCount <= MaxPathsPerInvoke(), CHIP_ERROR_INVALID_ARGUMENT); - - // If there is more than one CommandDataIB, spec states that CommandRef must be provided. - commandRefExpected = commandCount > 1; - - while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) - { - VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_ARGUMENT); - CommandDataIB::Parser commandData; - ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); - - // First validate that we can get a ConcreteCommandPath. - CommandPathIB::Parser commandPath; - ConcreteCommandPath concretePath(0, 0, 0); - ReturnErrorOnFailure(commandData.GetPath(&commandPath)); - ReturnErrorOnFailure(commandPath.GetConcreteCommandPath(concretePath)); - - // Grab the CommandRef if there is one, and validate that it's there when it - // has to be. - std::optional commandRef; - uint16_t ref; - err = commandData.GetRef(&ref); - VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_END_OF_TLV, err); - if (err == CHIP_END_OF_TLV && commandRefExpected) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - if (err == CHIP_NO_ERROR) - { - commandRef.emplace(ref); - } - - // Adding can fail if concretePath is not unique, or if commandRef is a value - // and is not unique, or if we have already added more paths than we support. - ReturnErrorOnFailure(GetCommandPathRegistry().Add(concretePath, commandRef)); - } - - // It's OK/expected to have reached the end of the container without failure. - if (CHIP_END_OF_TLV == err) - { - err = CHIP_NO_ERROR; - } - ReturnErrorOnFailure(err); - return invokeRequestMessage.ExitContainer(); -} - -Status CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - System::PacketBufferTLVReader reader; - InvokeRequestMessage::Parser invokeRequestMessage; - InvokeRequests::Parser invokeRequests; - reader.Init(std::move(payload)); - VerifyOrReturnError(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, Status::InvalidAction); -#if CHIP_CONFIG_IM_PRETTY_PRINT - invokeRequestMessage.PrettyPrint(); -#endif - VerifyOrDie(mpResponder); - if (mpResponder->GetGroupId().HasValue()) - { - SetGroupRequest(true); - } - - // When updating this code, please remember to make corresponding changes to TestOnlyInvokeCommandRequestWithFaultsInjected. - VerifyOrReturnError(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(mTimedRequest == isTimedInvoke, Status::TimedRequestMismatch); - - { - InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; - VerifyOrReturnError(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, - Status::InvalidAction); - } - - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - size_t commandCount = 0; - VerifyOrReturnError(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, - Status::InvalidAction); - if (commandCount > 1) - { - mReserveSpaceForMoreChunkMessages = true; - } - - while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) - { - VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), Status::InvalidAction); - CommandDataIB::Parser commandData; - VerifyOrReturnError(commandData.Init(invokeRequestsReader) == CHIP_NO_ERROR, Status::InvalidAction); - Status status = Status::Success; - if (IsGroupRequest()) - { - status = ProcessGroupCommandDataIB(commandData); - } - else - { - status = ProcessCommandDataIB(commandData); - } - if (status != Status::Success) - { - return status; - } - } - - // if we have exhausted this container - if (CHIP_END_OF_TLV == err) - { - err = CHIP_NO_ERROR; - } - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - VerifyOrReturnError(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, Status::InvalidAction); - return Status::Success; -} - -void CommandHandler::Close() -{ - mSuppressResponse = false; - mpResponder = nullptr; - MoveToState(State::AwaitingDestruction); - - // We must finish all async work before we can shut down a CommandHandler. The actual CommandHandler MUST finish their work - // in reasonable time or there is a bug. The only case for releasing CommandHandler without CommandHandler::Handle releasing its - // reference is the stack shutting down, in which case Close() is not called. So the below check should always pass. - VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandler::Close() called with %u unfinished async work items", - static_cast(mPendingWork)); - InvalidateHandles(); - - if (mpCallback) - { - mpCallback->OnDone(*this); - } -} - -void CommandHandler::AddToHandleList(Handle * apHandle) -{ - mpHandleList.PushBack(apHandle); -} - -void CommandHandler::RemoveFromHandleList(Handle * apHandle) -{ - VerifyOrDie(mpHandleList.Contains(apHandle)); - mpHandleList.Remove(apHandle); -} - -void CommandHandler::InvalidateHandles() -{ - for (auto handle = mpHandleList.begin(); handle != mpHandleList.end(); ++handle) - { - handle->Invalidate(); - } -} - -void CommandHandler::IncrementHoldOff(Handle * apHandle) -{ - mPendingWork++; - AddToHandleList(apHandle); -} - -void CommandHandler::DecrementHoldOff(Handle * apHandle) -{ - - mPendingWork--; - ChipLogDetail(DataManagement, "Decreasing reference count for CommandHandler, remaining %u", - static_cast(mPendingWork)); - - RemoveFromHandleList(apHandle); - - if (mPendingWork != 0) - { - return; - } - - if (mpResponder == nullptr) - { - ChipLogProgress(DataManagement, "Skipping command response: response sender is null"); - } - else if (!IsGroupRequest()) - { - CHIP_ERROR err = FinalizeLastInvokeResponseMessage(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DataManagement, "Failed to finalize command response: %" CHIP_ERROR_FORMAT, err.Format()); - } - } - - Close(); -} - -namespace { -// We use this when the sender did not actually provide a CommandFields struct, -// to avoid downstream consumers having to worry about cases when there is or is -// not a struct available. We use an empty struct with anonymous tag, since we -// can't use a context tag at top level, and consumers should not care about the -// tag here). -constexpr uint8_t sNoFields[] = { - CHIP_TLV_STRUCTURE(CHIP_TLV_TAG_ANONYMOUS), - CHIP_TLV_END_OF_CONTAINER, -}; -} // anonymous namespace - -Status CommandHandler::ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - CommandPathIB::Parser commandPath; - ConcreteCommandPath concretePath(0, 0, 0); - TLV::TLVReader commandDataReader; - - // NOTE: errors may occur before the concrete command path is even fully decoded. - - err = aCommandElement.GetPath(&commandPath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - err = commandPath.GetConcreteCommandPath(concretePath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - { - Status commandExists = mpCallback->CommandExists(concretePath); - if (commandExists != Status::Success) - { - ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", - ChipLogValueMEI(concretePath.mCommandId), ChipLogValueMEI(concretePath.mClusterId), - concretePath.mEndpointId); - return FallibleAddStatus(concretePath, commandExists) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - { - Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); - Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; - Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); - err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); - if (err != CHIP_NO_ERROR) - { - if (err != CHIP_ERROR_ACCESS_DENIED) - { - return FallibleAddStatus(concretePath, Status::Failure) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - // TODO: when wildcard invokes are supported, handle them to discard rather than fail with status - return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - if (CommandNeedsTimedInvoke(concretePath.mClusterId, concretePath.mCommandId) && !IsTimedInvoke()) - { - // TODO: when wildcard invokes are supported, discard a - // wildcard-expanded path instead of returning a status. - return FallibleAddStatus(concretePath, Status::NeedsTimedInteraction) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - - if (CommandIsFabricScoped(concretePath.mClusterId, concretePath.mCommandId)) - { - // SPEC: Else if the command in the path is fabric-scoped and there is no accessing fabric, - // a CommandStatusIB SHALL be generated with the UNSUPPORTED_ACCESS Status Code. - - // Fabric-scoped commands are not allowed before a specific accessing fabric is available. - // This is mostly just during a PASE session before AddNOC. - if (GetAccessingFabricIndex() == kUndefinedFabricIndex) - { - // TODO: when wildcard invokes are supported, discard a - // wildcard-expanded path instead of returning a status. - return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - } - - err = aCommandElement.GetFields(&commandDataReader); - if (CHIP_END_OF_TLV == err) - { - ChipLogDetail(DataManagement, - "Received command without data for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); - commandDataReader.Init(sNoFields); - err = commandDataReader.Next(); - } - if (CHIP_NO_ERROR == err) - { - ChipLogDetail(DataManagement, "Received command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); - SuccessOrExit(err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())); - mpCallback->DispatchCommand(*this, concretePath, commandDataReader); - DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); - } - -exit: - if (err != CHIP_NO_ERROR) - { - return FallibleAddStatus(concretePath, Status::InvalidCommand) != CHIP_NO_ERROR ? Status::Failure : Status::Success; - } - - // We have handled the error status above and put the error status in response, now return success status so we can process - // other commands in the invoke request. - return Status::Success; -} - -Status CommandHandler::ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - CommandPathIB::Parser commandPath; - TLV::TLVReader commandDataReader; - ClusterId clusterId; - CommandId commandId; - GroupId groupId; - FabricIndex fabric; - - Credentials::GroupDataProvider::GroupEndpoint mapping; - Credentials::GroupDataProvider * groupDataProvider = Credentials::GetGroupDataProvider(); - Credentials::GroupDataProvider::EndpointIterator * iterator; - - err = aCommandElement.GetPath(&commandPath); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - err = commandPath.GetGroupCommandPath(&clusterId, &commandId); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - - VerifyOrDie(mpResponder); - // The optionalGroupId must have a value, otherwise we wouldn't have reached this code path. - groupId = mpResponder->GetGroupId().Value(); - fabric = GetAccessingFabricIndex(); - - ChipLogDetail(DataManagement, "Received group command for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - groupId, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - - err = aCommandElement.GetFields(&commandDataReader); - if (CHIP_END_OF_TLV == err) - { - ChipLogDetail(DataManagement, - "Received command without data for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, groupId, - ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - commandDataReader.Init(sNoFields); - err = commandDataReader.Next(); - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); - } - VerifyOrReturnError(err == CHIP_NO_ERROR, Status::Failure); - - // Per spec, we do the "is this a timed command?" check for every path, but - // since all paths that fail it just get silently discarded we can do it - // once up front and discard all the paths at once. Ordering with respect - // to ACL and command presence checks does not matter, because the behavior - // is the same for all of them: ignore the path. - if (CommandNeedsTimedInvoke(clusterId, commandId)) - { - // Group commands are never timed. - return Status::Success; - } - - // No check for `CommandIsFabricScoped` unlike in `ProcessCommandDataIB()` since group commands - // always have an accessing fabric, by definition. - - // Find which endpoints can process the command, and dispatch to them. - iterator = groupDataProvider->IterateEndpoints(fabric); - VerifyOrReturnError(iterator != nullptr, Status::Failure); - - while (iterator->Next(mapping)) - { - if (groupId != mapping.group_id) - { - continue; - } - - ChipLogDetail(DataManagement, - "Processing group command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, - mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); - - const ConcreteCommandPath concretePath(mapping.endpoint_id, clusterId, commandId); - - if (mpCallback->CommandExists(concretePath) != Status::Success) - { - ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", - ChipLogValueMEI(commandId), ChipLogValueMEI(clusterId), mapping.endpoint_id); - - continue; - } - - { - Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); - Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; - Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); - err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); - if (err != CHIP_NO_ERROR) - { - // NOTE: an expected error is CHIP_ERROR_ACCESS_DENIED, but there could be other unexpected errors; - // therefore, keep processing subsequent commands, and if any errors continue, those subsequent - // commands will likewise fail. - continue; - } - } - if ((err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR) - { - TLV::TLVReader dataReader(commandDataReader); - mpCallback->DispatchCommand(*this, concretePath, dataReader); - DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); - } - else - { - ChipLogError(DataManagement, - "Error when calling PreCommandReceived for Endpoint=%u Cluster=" ChipLogFormatMEI - " Command=" ChipLogFormatMEI " : %" CHIP_ERROR_FORMAT, - mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId), err.Format()); - continue; - } - } - iterator->Release(); - return Status::Success; -} - -CHIP_ERROR CommandHandler::TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) -{ - // Return early when response should not be sent out. - VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); - - ReturnErrorOnFailure(PrepareStatus(aCommandPath)); - CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); - StatusIB::Builder & statusIBBuilder = commandStatus.CreateErrorStatus(); - ReturnErrorOnFailure(commandStatus.GetError()); - statusIBBuilder.EncodeStatusIB(aStatus); - ReturnErrorOnFailure(statusIBBuilder.GetError()); - return FinishStatus(); -} - -CHIP_ERROR CommandHandler::AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) -{ - return TryAddingResponse([&]() -> CHIP_ERROR { return TryAddStatusInternal(aCommandPath, aStatus); }); -} - -void CommandHandler::AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context) -{ - - CHIP_ERROR error = FallibleAddStatus(aCommandPath, aStatus, context); - - if (error != CHIP_NO_ERROR) - { - ChipLogError(DataManagement, "Failed to add command status: %" CHIP_ERROR_FORMAT, error.Format()); - // TODO(#30453) we could call mpResponder->ResponseDropped() if err == CHIP_ERROR_NO_MEMORY. This should - // be done as a follow up so that change can be evaluated as a standalone PR. - - // Do not crash if the status has not been added due to running out of packet buffers or other resources. - // It is better to drop a single response than to go offline and lose all sessions and subscriptions. - VerifyOrDie(error == CHIP_ERROR_NO_MEMORY); - } -} - -CHIP_ERROR CommandHandler::FallibleAddStatus(const ConcreteCommandPath & path, const Protocols::InteractionModel::Status status, - const char * context) -{ - if (status != Status::Success) - { - if (context == nullptr) - { - context = "no additional context"; - } - - ChipLogError(DataManagement, - "Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " status " ChipLogFormatIMStatus " (%s)", - path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mCommandId), - ChipLogValueIMStatus(status), context); - } - - return AddStatusInternal(path, StatusIB(status)); -} - -CHIP_ERROR CommandHandler::AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) -{ - return AddStatusInternal(aCommandPath, StatusIB(Status::Success, aClusterStatus)); -} - -CHIP_ERROR CommandHandler::AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) -{ - return AddStatusInternal(aCommandPath, StatusIB(Status::Failure, aClusterStatus)); -} - -CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, - const CommandHandler::InvokeResponseParameters & aPrepareParameters) -{ - auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); - VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - - return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); -} - -CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aResponseCommandPath, bool aStartDataStruct) -{ - // Legacy code is calling the deprecated version of PrepareCommand. If we are in a case where - // there was a single command in the request, we can just assume this response is triggered by - // the single command. - size_t countOfPathRegistryEntries = GetCommandPathRegistry().Count(); - - // At this point application supports Batch Invoke Commands since CommandPathRegistry has more than 1 entry, - // but application is calling the deprecated PrepareCommand. We have no way to determine the associated CommandRef - // to put into the InvokeResponse. - VerifyOrDieWithMsg(countOfPathRegistryEntries == 1, DataManagement, - "Seemingly device supports batch commands, but is calling the deprecated PrepareCommand API"); - - auto commandPathRegistryEntry = GetCommandPathRegistry().GetFirstEntry(); - VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - - return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aStartDataStruct); -} - -CHIP_ERROR CommandHandler::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, - const ConcreteCommandPath & aCommandPath, bool aStartDataStruct) -{ - // Intentionally omitting the ResponsesAccepted early exit. Direct use of PrepareInvokeResponseCommand - // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). - // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. - ReturnErrorOnFailure(AllocateBuffer()); - - if (!mInternalCallToAddResponseData && mState == State::AddedCommand) - { - // An attempt is being made to add CommandData InvokeResponse using primitive - // CommandHandler APIs. While not recommended, as this potentially leaves the - // CommandHandler in an incorrect state upon failure, this approach is permitted - // for legacy reasons. To maximize the likelihood of success, particularly when - // handling large amounts of data, we try to obtain a new, completely empty - // InvokeResponseMessage, as the existing one already has space occupied. - ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); - } - - CreateBackupForResponseRollback(); - // - // We must not be in the middle of preparing a command, or having prepared or sent one. - // - VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - - // TODO(#30453): See if we can pass this back up the stack so caller can provide this instead of taking up - // space in CommandHanlder. - mRefForResponse = apCommandPathRegistryEntry.ref; - - MoveToState(State::Preparing); - InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); - InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); - ReturnErrorOnFailure(invokeResponses.GetError()); - - CommandDataIB::Builder & commandData = invokeResponse.CreateCommand(); - ReturnErrorOnFailure(commandData.GetError()); - CommandPathIB::Builder & path = commandData.CreatePath(); - ReturnErrorOnFailure(commandData.GetError()); - ReturnErrorOnFailure(path.Encode(aCommandPath)); - if (aStartDataStruct) - { - ReturnErrorOnFailure(commandData.GetWriter()->StartContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), - TLV::kTLVType_Structure, mDataElementContainerType)); - } - MoveToState(State::AddingCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) -{ - // Intentionally omitting the ResponsesAccepted early exit. Direct use of FinishCommand - // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). - // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. - VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - CommandDataIB::Builder & commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); - if (aStartDataStruct) - { - ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); - } - - if (mRefForResponse.has_value()) - { - ReturnErrorOnFailure(commandData.Ref(*mRefForResponse)); - } - - ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); - MoveToState(State::AddedCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPath) -{ - ReturnErrorOnFailure(AllocateBuffer()); - // - // We must not be in the middle of preparing a command, or having prepared or sent one. - // - VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - if (mState == State::AddedCommand) - { - CreateBackupForResponseRollback(); - } - - auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); - VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); - mRefForResponse = commandPathRegistryEntry->ref; - - MoveToState(State::Preparing); - InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); - InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); - ReturnErrorOnFailure(invokeResponses.GetError()); - CommandStatusIB::Builder & commandStatus = invokeResponse.CreateStatus(); - ReturnErrorOnFailure(commandStatus.GetError()); - CommandPathIB::Builder & path = commandStatus.CreatePath(); - ReturnErrorOnFailure(commandStatus.GetError()); - ReturnErrorOnFailure(path.Encode(aCommandPath)); - MoveToState(State::AddingCommand); - return CHIP_NO_ERROR; -} - -CHIP_ERROR CommandHandler::FinishStatus() -{ - VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - - CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); - if (mRefForResponse.has_value()) - { - ReturnErrorOnFailure(commandStatus.Ref(*mRefForResponse)); - } - - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); - MoveToState(State::AddedCommand); - return CHIP_NO_ERROR; -} - -void CommandHandler::CreateBackupForResponseRollback() -{ - VerifyOrReturn(mState == State::NewResponseMessage || mState == State::AddedCommand); - VerifyOrReturn(mInvokeResponseBuilder.GetInvokeResponses().GetError() == CHIP_NO_ERROR); - VerifyOrReturn(mInvokeResponseBuilder.GetError() == CHIP_NO_ERROR); - mInvokeResponseBuilder.Checkpoint(mBackupWriter); - mBackupState = mState; - mRollbackBackupValid = true; -} - -CHIP_ERROR CommandHandler::RollbackResponse() -{ - VerifyOrReturnError(mRollbackBackupValid, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mState == State::Preparing || mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - ChipLogDetail(DataManagement, "Rolling back response"); - // TODO(#30453): Rollback of mInvokeResponseBuilder should handle resetting - // InvokeResponses. - mInvokeResponseBuilder.GetInvokeResponses().ResetError(); - mInvokeResponseBuilder.Rollback(mBackupWriter); - MoveToState(mBackupState); - mRollbackBackupValid = false; - return CHIP_NO_ERROR; -} - -TLV::TLVWriter * CommandHandler::GetCommandDataIBTLVWriter() -{ - if (mState != State::AddingCommand) - { - return nullptr; - } - - return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); -} - -FabricIndex CommandHandler::GetAccessingFabricIndex() const -{ - VerifyOrDie(!mGoneAsync); - VerifyOrDie(mpResponder); - return mpResponder->GetAccessingFabricIndex(); -} void CommandHandler::Handle::Init(CommandHandler * handler) { @@ -825,7 +31,7 @@ void CommandHandler::Handle::Init(CommandHandler * handler) CommandHandler * CommandHandler::Handle::Get() { - // Not safe to work with CommandHandler in parallel with other Matter work. + // Not safe to work with CommandHandlerImpl in parallel with other Matter work. assertChipStackLockedByCurrentThread(); return mpHandler; @@ -845,216 +51,5 @@ CommandHandler::Handle::Handle(CommandHandler * handler) Init(handler); } -CHIP_ERROR CommandHandler::FinalizeInvokeResponseMessageAndPrepareNext() -{ - ReturnErrorOnFailure(FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ true)); - // After successfully finalizing InvokeResponseMessage, no buffer should remain - // allocated. - VerifyOrDie(!mBufferAllocated); - CHIP_ERROR err = AllocateBuffer(); - if (err != CHIP_NO_ERROR) - { - // TODO(#30453): Improve ResponseDropped calls to occur only when dropping is - // definitively guaranteed. - // Response dropping is not yet definitive as a subsequent call - // to AllocateBuffer might succeed. - VerifyOrDie(mpResponder); - mpResponder->ResponseDropped(); - } - return err; -} - -CHIP_ERROR CommandHandler::FinalizeInvokeResponseMessage(bool aHasMoreChunks) -{ - System::PacketBufferHandle packet; - - VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses()); - if (aHasMoreChunks) - { - // Unreserving space previously reserved for MoreChunkedMessages is done - // in the call to mInvokeResponseBuilder.MoreChunkedMessages. - mInvokeResponseBuilder.MoreChunkedMessages(aHasMoreChunks); - ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - } - ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage()); - ReturnErrorOnFailure(mCommandMessageWriter.Finalize(&packet)); - VerifyOrDie(mpResponder); - mpResponder->AddInvokeResponseToSend(std::move(packet)); - mBufferAllocated = false; - mRollbackBackupValid = false; - return CHIP_NO_ERROR; -} - -void CommandHandler::SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "CommandResponseSender can only be set in idle state"); - mpResponder = commandResponder; -} - -const char * CommandHandler::GetStateStr() const -{ -#if CHIP_DETAIL_LOGGING - switch (mState) - { - case State::Idle: - return "Idle"; - - case State::NewResponseMessage: - return "NewResponseMessage"; - - case State::Preparing: - return "Preparing"; - - case State::AddingCommand: - return "AddingCommand"; - - case State::AddedCommand: - return "AddedCommand"; - - case State::DispatchResponses: - return "DispatchResponses"; - - case State::AwaitingDestruction: - return "AwaitingDestruction"; - } -#endif // CHIP_DETAIL_LOGGING - return "N/A"; -} - -void CommandHandler::MoveToState(const State aTargetState) -{ - mState = aTargetState; - ChipLogDetail(DataManagement, "Command handler moving to [%10.10s]", GetStateStr()); -} - -#if CHIP_WITH_NLFAULTINJECTION - -namespace { - -CHIP_ERROR TestOnlyExtractCommandPathFromNextInvokeRequest(TLV::TLVReader & invokeRequestsReader, - ConcreteCommandPath & concretePath) -{ - ReturnErrorOnFailure(invokeRequestsReader.Next(TLV::AnonymousTag())); - CommandDataIB::Parser commandData; - ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); - CommandPathIB::Parser commandPath; - ReturnErrorOnFailure(commandData.GetPath(&commandPath)); - return commandPath.GetConcreteCommandPath(concretePath); -} - -[[maybe_unused]] const char * GetFaultInjectionTypeStr(CommandHandler::NlFaultInjectionType faultType) -{ - switch (faultType) - { - case CommandHandler::NlFaultInjectionType::SeparateResponseMessages: - return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be the same as the " - "original request."; - case CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder: - return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be reversed from the " - "original request."; - case CommandHandler::NlFaultInjectionType::SkipSecondResponse: - return "Single InvokeResponseMessages. Dropping response to second request"; - } - ChipLogError(DataManagement, "TH Failure: Unexpected fault type"); - chipAbort(); -} - -} // anonymous namespace - -// This method intentionally duplicates code from other sections. While code consolidation -// is generally preferred, here we prioritize generating a clear crash message to aid in -// troubleshooting test failures. -void CommandHandler::TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke, - NlFaultInjectionType faultType) -{ - VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "TH Failure: state should be Idle, issue with TH"); - SetExchangeInterface(&commandResponder); - - ChipLogProgress(DataManagement, "Response to InvokeRequestMessage overridden by fault injection"); - ChipLogProgress(DataManagement, " Injecting the following response:%s", GetFaultInjectionTypeStr(faultType)); - - Handle workHandle(this); - VerifyOrDieWithMsg(!commandResponder.GetGroupId().HasValue(), DataManagement, "DUT Failure: Unexpected Group Command"); - - System::PacketBufferTLVReader reader; - InvokeRequestMessage::Parser invokeRequestMessage; - InvokeRequests::Parser invokeRequests; - reader.Init(std::move(payload)); - VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Failed 'invokeRequestMessage.Init(reader)'"); -#if CHIP_CONFIG_IM_PRETTY_PRINT - invokeRequestMessage.PrettyPrint(); -#endif - - VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory SuppressResponse field missing"); - VerifyOrDieWithMsg(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory TimedRequest field missing"); - VerifyOrDieWithMsg(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, DataManagement, - "DUT Failure: Mandatory InvokeRequests field missing"); - VerifyOrDieWithMsg(mTimedRequest == isTimedInvoke, DataManagement, - "DUT Failure: TimedRequest value in message mismatches action"); - - { - InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; - VerifyOrDieWithMsg(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: InvokeRequestMessage contents were invalid"); - } - - TLV::TLVReader invokeRequestsReader; - invokeRequests.GetReader(&invokeRequestsReader); - - size_t commandCount = 0; - VerifyOrDieWithMsg(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, - DataManagement, - "TH Failure: Failed to get the length of InvokeRequests after InvokeRequestMessage validation"); - - // The command count check (specifically for a count of 2) is tied to IDM_1_3. This may need adjustment for - // compatibility with future test plans. - VerifyOrDieWithMsg(commandCount == 2, DataManagement, "DUT failure: We were strictly expecting exactly 2 InvokeRequests"); - mReserveSpaceForMoreChunkMessages = true; - - { - // Response path is the same as request path since we are replying with a failure message. - ConcreteCommandPath concreteResponsePath1; - ConcreteCommandPath concreteResponsePath2; - VerifyOrDieWithMsg( - TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath1) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the first request"); - VerifyOrDieWithMsg( - TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath2) == CHIP_NO_ERROR, - DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the second request"); - - if (faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) - { - ConcreteCommandPath temp(concreteResponsePath1); - concreteResponsePath1 = concreteResponsePath2; - concreteResponsePath2 = temp; - } - - VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath1, Status::Failure) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Error adding the first InvokeResponse"); - if (faultType == NlFaultInjectionType::SeparateResponseMessages || - faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) - { - VerifyOrDieWithMsg(FinalizeInvokeResponseMessageAndPrepareNext() == CHIP_NO_ERROR, DataManagement, - "TH Failure: Failed to create second InvokeResponseMessage"); - } - if (faultType != NlFaultInjectionType::SkipSecondResponse) - { - VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath2, Status::Failure) == CHIP_NO_ERROR, DataManagement, - "TH Failure: Error adding the second InvokeResponse"); - } - } - - VerifyOrDieWithMsg(invokeRequestsReader.Next() == CHIP_END_OF_TLV, DataManagement, - "DUT Failure: Unexpected TLV ending of InvokeRequests"); - VerifyOrDieWithMsg(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, DataManagement, - "DUT Failure: InvokeRequestMessage TLV is not properly terminated"); -} -#endif // CHIP_WITH_NLFAULTINJECTION - } // namespace app } // namespace chip diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index ae41ec1fe350fb..86f687c1c02466 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -15,78 +15,36 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -/** - * @file - * A handler for incoming Invoke interactions. - * - * Allows adding responses to be sent in an InvokeResponse: see the various - * "Add*" methods. - * - * Allows adding the responses asynchronously. See the documentation - * for the CommandHandler::Handle class below. - * - */ - #pragma once #include -#include #include #include #include #include -#include -#include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include -#include - -#include -#include namespace chip { namespace app { +/** + * A handler for incoming Invoke interactions. + * + * Allows adding responses to be sent in an InvokeResponse: see the various + * "Add*" methods. + * + * Allows adding the responses asynchronously when using `CommandHandler::Handle` + * (see documentation for `CommandHandler::Handle` for details) + * + * Upgrading notes: this class has moved to an interface from a previous more complex + * implementation. If upgrading code between versions, please see docs/upgrading.md + */ class CommandHandler { public: - class Callback - { - public: - virtual ~Callback() = default; - - /* - * Method that signals to a registered callback that this object - * has completed doing useful work and is now safe for release/destruction. - */ - virtual void OnDone(CommandHandler & apCommandObj) = 0; - - /* - * Upon processing of a CommandDataIB, this method is invoked to dispatch the command - * to the right server-side handler provided by the application. - */ - virtual void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, - TLV::TLVReader & apPayload) = 0; - - /* - * Check to see if a command implementation exists for a specific - * concrete command path. If it does, Success will be returned. If - * not, one of UnsupportedEndpoint, UnsupportedCluster, or - * UnsupportedCommand will be returned, depending on how the command - * fails to exist. - */ - virtual Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) = 0; - }; + virtual ~CommandHandler() = default; /** * Class that allows asynchronous command processing before sending a @@ -156,157 +114,23 @@ class CommandHandler CommandHandler * mpHandler = nullptr; }; - // Previously we kept adding arguments with default values individually as parameters. This is because there - // is legacy code outside of the SDK that would call PrepareCommand. With the new PrepareInvokeResponseCommand - // replacing PrepareCommand, we took this opportunity to create a new parameter structure to make it easier to - // add new parameters without there needing to be an ever increasing parameter list with defaults. - struct InvokeResponseParameters - { - InvokeResponseParameters(const ConcreteCommandPath & aRequestCommandPath) : mRequestCommandPath(aRequestCommandPath) {} - - InvokeResponseParameters & SetStartOrEndDataStruct(bool aStartOrEndDataStruct) - { - mStartOrEndDataStruct = aStartOrEndDataStruct; - return *this; - } - - ConcreteCommandPath mRequestCommandPath; - /** - * Whether the method this is being provided to should start/end the TLV container for the CommandFields element - * within CommandDataIB. - */ - bool mStartOrEndDataStruct = true; - }; - - struct TestOnlyOverrides - { - public: - CommandPathRegistry * commandPathRegistry = nullptr; - CommandHandlerExchangeInterface * commandResponder = nullptr; - }; - - /* - * Constructor. - * - * The callback passed in has to outlive this CommandHandler object. - */ - CommandHandler(Callback * apCallback); - - /* - * Destructor. - * - * The call will also invalidate all Handles created for this CommandHandler. - * - */ - ~CommandHandler(); - - /* - * Constructor to override the number of supported paths per invoke and command responder. - * - * The callback and any pointers passed via TestOnlyOverrides must outlive this - * CommandHandler object. - * - * For testing purposes. - */ - CommandHandler(TestOnlyOverrides & aTestOverride, Callback * apCallback); - - /* - * Main entrypoint for this class to handle an InvokeRequestMessage. - * - * This function MAY call the registered OnDone callback before returning. - * To prevent immediate OnDone invocation, callers can wrap their CommandHandler instance - * within a CommandHandler::Handle. - * - * isTimedInvoke is true if and only if this is part of a Timed Invoke - * transaction (i.e. was preceded by a Timed Request). If we reach here, - * the timer verification has already been done. - * - * commandResponder handles sending InvokeResponses, added by clusters, to the client. The - * command responder object must outlive this CommandHandler object. It is only safe to - * release after the caller of OnInvokeCommandRequest receives the OnDone callback. - */ - Protocols::InteractionModel::Status OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke); - - /** - * Checks that all CommandDataIB within InvokeRequests satisfy the spec's general - * constraints for CommandDataIB. Additionally checks that InvokeRequestMessage is - * properly formatted. - * - * This also builds a registry to ensure that all commands can be responded - * to with the data required as per spec. - */ - CHIP_ERROR ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage); - /** * Adds the given command status and returns any failures in adding statuses (e.g. out * of buffer space) to the caller */ - CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context = nullptr); + virtual CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, + const Protocols::InteractionModel::Status aStatus, const char * context = nullptr) = 0; /** * Adds a status when the caller is unable to handle any failures. Logging is performed * and failure to register the status is checked with VerifyOrDie. */ - void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, - const char * context = nullptr); + virtual void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) = 0; - CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); + virtual CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) = 0; - CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus); - - /** - * This adds a new CommandDataIB element into InvokeResponses for the associated - * aRequestCommandPath. This adds up until the `CommandFields` element within - * `CommandDataIB`. - * - * This call will fail if CommandHandler is already in the middle of building a - * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without - * calling Finish*), or is already sending InvokeResponseMessage. - * - * Upon success, the caller is expected to call `FinishCommand` once they have added - * all the fields into the CommandFields element of CommandDataIB. - * - * @param [in] aResponseCommandPath the concrete response path that we are sending to Requester. - * @param [in] aPrepareParameters struct containing paramters needs for preparing a command. Data - * such as request path, and whether this method should start the CommandFields element within - * CommandDataIB. - */ - CHIP_ERROR PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, - const InvokeResponseParameters & aPrepareParameters); - - [[deprecated("PrepareCommand now needs the requested command path. Please use PrepareInvokeResponseCommand")]] CHIP_ERROR - PrepareCommand(const ConcreteCommandPath & aCommandPath, bool aStartDataStruct = true); - - /** - * Finishes the CommandDataIB element within the InvokeResponses. - * - * Caller must have first successfully called `PrepareInvokeResponseCommand`. - * - * @param [in] aEndDataStruct end the TLV container for the CommandFields element within - * CommandDataIB. This should match the boolean passed into Prepare*. - * - * @return CHIP_ERROR_INCORRECT_STATE - * If device has not previously successfully called - * `PrepareInvokeResponseCommand`. - * @return CHIP_ERROR_BUFFER_TOO_SMALL - * If writing the values needed to finish the InvokeReponseIB - * with the current contents of the InvokeResponseMessage - * would exceed the limit. When this error occurs, it is possible - * we have already closed some of the IB Builders that were - * previously started in `PrepareInvokeResponseCommand`. - * @return CHIP_ERROR_NO_MEMORY - * If TLVWriter attempted to allocate an output buffer failed due to - * lack of memory. - * @return other Other TLVWriter related errors. Typically occurs if - * `GetCommandDataIBTLVWriter()` was called and used incorrectly. - */ - // TODO(#30453): We should be able to eliminate the chances of OOM issues with reserve. - // This will be completed in a follow up PR. - CHIP_ERROR FinishCommand(bool aEndDataStruct = true); - - TLV::TLVWriter * GetCommandDataIBTLVWriter(); + virtual CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) = 0; /** * GetAccessingFabricIndex() may only be called during synchronous command @@ -314,24 +138,7 @@ class CommandHandler * CommandHandler::Handle or equivalent) must not call this method, because * it will not work right if the session we're using was evicted. */ - FabricIndex GetAccessingFabricIndex() const; - - /** - * API for adding a data response. The template parameter T is generally - * expected to be a ClusterName::Commands::CommandName::Type struct, but any - * object that can be encoded using the DataModel::Encode machinery and - * exposes the right command id will work. - * - * @param [in] aRequestCommandPath the concrete path of the command we are - * responding to. - * @param [in] aData the data for the response. - */ - template - CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) - { - DataModel::EncodableType encoder(aData); - return AddResponseData(aRequestCommandPath, CommandData::GetCommandId(), encoder); - } + virtual FabricIndex GetAccessingFabricIndex() const = 0; /** * API for adding a data response. The `aEncodable` is generally expected to encode @@ -343,58 +150,48 @@ class CommandHandler * @param [in] aEncodable - an encodable that places the command data structure * for `aResponseCommandId` into a TLV Writer. * - * Most applications are likely to use `AddResponseData` as a more convenient - * one-call that auto-sets command ID and creates the underlying encoders. + * If you have no great way of handling the returned CHIP_ERROR, consider + * using `AddResponse` which will automatically reply with `Failure` in + * case AddResponseData fails. */ - CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) - { - // Return early when response should not be sent out. - VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); - return TryAddingResponse( - [&]() -> CHIP_ERROR { return TryAddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); }); - } + virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) = 0; /** - * API for adding a response. This will try to encode a data response (response command), and if that fails will encode a a - * Protocols::InteractionModel::Status::Failure status response instead. + * Attempts to encode a response to a command. * - * The template parameter T is generally expected to be a ClusterName::Commands::CommandName::Type struct, but any object that - * can be encoded using the DataModel::Encode machinery and exposes the right command id will work. + * `aRequestCommandPath` represents the request path (endpoint/cluster/commandid) and the reply + * will preserve the same path and switch the command id to aResponseCommandId. * - * Since the function will call AddStatus when it fails to encode the data, it cannot send any response when it fails to encode - * a status code since another AddStatus call will also fail. The error from AddStatus will just be logged. + * As this command does not return any error codes, it must try its best to encode the reply + * and if it fails, it MUST encode a `Protocols::InteractionModel::Status::Failure` as a + * reply (i.e. a reply is guaranteed to be sent). * - * @param [in] aRequestCommandPath the concrete path of the command we are - * responding to. - * @param [in] aData the data for the response. + * Above is the main difference from AddResponseData: AddResponse will auto-reply with failure while + * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. */ - template - void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) - { - DataModel::EncodableType encodable(aData); - return AddResponse(aRequestCommandPath, CommandData::GetCommandId(), encodable); - } + virtual void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) = 0; /** - * API for adding a response with a given encodable of TLV data. - * - * The encodable would generally encode a ClusterName::Commands::CommandName::Type with - * the corresponding `GetCommandId` call. + * Check whether the InvokeRequest we are handling is a timed invoke. */ - void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) - { - if (AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable) != CHIP_NO_ERROR) - { - AddStatus(aRequestCommandPath, Protocols::InteractionModel::Status::Failure); - } - } + virtual bool IsTimedInvoke() const = 0; /** - * Check whether the InvokeRequest we are handling is a timed invoke. + * @brief Flush acks right away for a slow command + * + * Some commands that do heavy lifting of storage/crypto should + * ack right away to improve reliability and reduce needless retries. This + * method can be manually called in commands that are especially slow to + * immediately schedule an acknowledgement (if needed) since the delayed + * stand-alone ack timer may actually not hit soon enough due to blocking command + * execution. + * */ - bool IsTimedInvoke() const { return mTimedRequest; } + virtual void FlushAcksRightAwayOnSlowCommand() = 0; + + virtual Access::SubjectDescriptor GetSubjectDescriptor() const = 0; /** * Gets the inner exchange context object, without ownership. @@ -407,310 +204,74 @@ class CommandHandler * exchange context has been assigned or the context * has been released. */ - Messaging::ExchangeContext * GetExchangeContext() const - { - VerifyOrDie(mpResponder); - return mpResponder->GetExchangeContext(); - } + virtual Messaging::ExchangeContext * GetExchangeContext() const = 0; /** - * @brief Flush acks right away for a slow command + * API for adding a data response. The template parameter T is generally + * expected to be a ClusterName::Commands::CommandName::Type struct, but any + * object that can be encoded using the DataModel::Encode machinery and + * exposes the right command id will work. * - * Some commands that do heavy lifting of storage/crypto should - * ack right away to improve reliability and reduce needless retries. This - * method can be manually called in commands that are especially slow to - * immediately schedule an acknowledgement (if needed) since the delayed - * stand-alone ack timer may actually not hit soon enough due to blocking command - * execution. + * If you have no great way of handling the returned CHIP_ERROR, consider + * using `AddResponse` which will automatically reply with `Failure` in + * case AddResponseData fails. + * + * @param [in] aRequestCommandPath the concrete path of the command we are + * responding to. * + * The response path will be the same as the request, except the + * reply command ID used will be `CommandData::GetCommandId()` assumed + * to be a member of the templated type + * + * @param [in] aData the data for the response. It is expected to provide + * `GetCommandData` as a STATIC on its type as well as encode the + * correct data structure for building a reply. */ - void FlushAcksRightAwayOnSlowCommand() + template + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - if (mpResponder) - { - mpResponder->HandlingSlowCommand(); - } + DataModel::EncodableType encoder(aData); + return AddResponseData(aRequestCommandPath, CommandData::GetCommandId(), encoder); } /** - * GetSubjectDescriptor() may only be called during synchronous command - * processing. Anything that runs async (while holding a - * CommandHandler::Handle or equivalent) must not call this method, because - * it might not work right if the session we're using was evicted. - */ - Access::SubjectDescriptor GetSubjectDescriptor() const - { - VerifyOrDie(!mGoneAsync); - VerifyOrDie(mpResponder); - return mpResponder->GetSubjectDescriptor(); - } - -#if CHIP_WITH_NLFAULTINJECTION - - enum class NlFaultInjectionType : uint8_t - { - SeparateResponseMessages, - SeparateResponseMessagesAndInvertedResponseOrder, - SkipSecondResponse - }; - - /** - * @brief Sends InvokeResponseMessages with injected faults for certification testing. - * - * The Test Harness (TH) uses this to simulate various server response behaviors, - * ensuring the Device Under Test (DUT) handles responses per specification. + * API for adding a response. This will try to encode a data response (response command), and if that fails + * it will encode a Protocols::InteractionModel::Status::Failure status response instead. * - * This function strictly validates the DUT's InvokeRequestMessage against the test plan. - * If deviations occur, the TH terminates with a detailed error message. + * Above is the main difference from AddResponseData: AddResponse will auto-reply with failure while + * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. * - * @param commandResponder commandResponder that will send the InvokeResponseMessages to the client. - * @param payload Payload of the incoming InvokeRequestMessage from the client. - * @param isTimedInvoke Indicates whether the interaction is timed. - * @param faultType The specific type of fault to inject into the response. - */ - // TODO(#30453): After refactoring CommandHandler for better unit testability, create a - // unit test specifically for the fault injection behavior. - void TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, - System::PacketBufferHandle && payload, bool isTimedInvoke, - NlFaultInjectionType faultType); -#endif // CHIP_WITH_NLFAULTINJECTION - -private: - friend class TestCommandInteraction; - friend class CommandHandler::Handle; - - enum class State : uint8_t - { - Idle, ///< Default state that the object starts out in, where no work has commenced - NewResponseMessage, ///< mInvokeResponseBuilder is ready, with no responses added. - Preparing, ///< We are prepaing the command or status header. - AddingCommand, ///< In the process of adding a command. - AddedCommand, ///< A command has been completely encoded and is awaiting transmission. - DispatchResponses, ///< The command response(s) are being dispatched. - AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. - }; - - /** - * @brief Best effort to add InvokeResponse to InvokeResponseMessage. + * The template parameter T is generally expected to be a ClusterName::Commands::CommandName::Type struct, but any object that + * can be encoded using the DataModel::Encode machinery and exposes the right command id will work. * - * Tries to add response using lambda. Upon failure to add response, attempts - * to rollback the InvokeResponseMessage to a known good state. If failure is due - * to insufficient space in the current InvokeResponseMessage: - * - Finalizes the current InvokeResponseMessage. - * - Allocates a new InvokeResponseMessage. - * - Reattempts to add the InvokeResponse to the new InvokeResponseMessage. + * Since the function will call AddStatus when it fails to encode the data, it cannot send any response when it fails to encode + * a status code since another AddStatus call will also fail. The error from AddStatus will just be logged. * - * @param [in] addResponseFunction A lambda function responsible for adding the - * response to the current InvokeResponseMessage. + * @param [in] aRequestCommandPath the concrete path of the command we are + * responding to. + * @param [in] aData the data for the response. */ - template - CHIP_ERROR TryAddingResponse(Function && addResponseFunction) + template + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, const CommandData & aData) { - // Invalidate any existing rollback backups. The addResponseFunction is - // expected to create a new backup during either PrepareInvokeResponseCommand - // or PrepareStatus execution. Direct invocation of - // CreateBackupForResponseRollback is avoided since the buffer used by - // InvokeResponseMessage might not be allocated until a Prepare* function - // is called. - mRollbackBackupValid = false; - CHIP_ERROR err = addResponseFunction(); - if (err == CHIP_NO_ERROR) - { - return CHIP_NO_ERROR; - } - ReturnErrorOnFailure(RollbackResponse()); - // If we failed to add a command due to lack of space in the - // packet, we will make another attempt to add the response using - // an additional InvokeResponseMessage. - if (mState != State::AddedCommand || err != CHIP_ERROR_NO_MEMORY) - { - return err; - } - ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); - err = addResponseFunction(); - if (err != CHIP_NO_ERROR) - { - // The return value of RollbackResponse is ignored, as we prioritize - // conveying the error generated by addResponseFunction to the - // caller. - RollbackResponse(); - } - return err; + DataModel::EncodableType encodable(aData); + AddResponse(aRequestCommandPath, CommandData::GetCommandId(), encodable); } - void MoveToState(const State aTargetState); - const char * GetStateStr() const; - - /** - * Create a backup to enable rolling back to the state prior to ResponseData encoding in the event of failure. - */ - void CreateBackupForResponseRollback(); - - /** - * Rollback the state to before encoding the current ResponseData (before calling PrepareInvokeResponseCommand / PrepareStatus) - * - * Requires CreateBackupForResponseRollback to be called at the start of PrepareInvokeResponseCommand / PrepareStatus - */ - CHIP_ERROR RollbackResponse(); - - /* - * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does - * not arise during normal message processing flows that all normally call Close() above. This can only - * arise due to application-initiated destruction of the object when this object is handling receiving/sending - * message payloads. - */ - void Abort(); - +protected: /** * IncrementHoldOff will increase the inner refcount of the CommandHandler. * * Users should use CommandHandler::Handle for management the lifespan of the CommandHandler. * DefRef should be released in reasonable time, and Close() should only be called when the refcount reached 0. */ - void IncrementHoldOff(Handle * apHandle); + virtual void IncrementHoldOff(Handle * apHandle) {} /** * DecrementHoldOff is used by CommandHandler::Handle for decreasing the refcount of the CommandHandler. * When refcount reached 0, CommandHandler will send the response to the peer and shutdown. */ - void DecrementHoldOff(Handle * apHandle); - - /* - * Allocates a packet buffer used for encoding an invoke response payload. - * - * This can be called multiple times safely, as it will only allocate the buffer once for the lifetime - * of this object. - */ - CHIP_ERROR AllocateBuffer(); - - /** - * This will add a new CommandStatusIB element into InvokeResponses. It will put the - * aCommandPath into the CommandPath element within CommandStatusIB. - * - * This call will fail if CommandHandler is already in the middle of building a - * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without - * calling Finish*), or is already sending InvokeResponseMessage. - * - * Upon success, the caller is expected to call `FinishStatus` once they have encoded - * StatusIB. - * - * @param [in] aCommandPath the concrete path of the command we are responding to. - */ - CHIP_ERROR PrepareStatus(const ConcreteCommandPath & aCommandPath); - - /** - * Finishes the CommandStatusIB element within the InvokeResponses. - * - * Caller must have first successfully called `PrepareStatus`. - */ - CHIP_ERROR FinishStatus(); - - CHIP_ERROR PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, - const ConcreteCommandPath & aCommandPath, bool aStartDataStruct); - - CHIP_ERROR FinalizeLastInvokeResponseMessage() { return FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ false); } - - CHIP_ERROR FinalizeInvokeResponseMessageAndPrepareNext(); - - CHIP_ERROR FinalizeInvokeResponseMessage(bool aHasMoreChunks); - - Protocols::InteractionModel::Status ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke); - - /** - * Called internally to signal the completion of all work on this object, gracefully close the - * exchange (by calling into the base class) and finally, signal to a registerd callback that it's - * safe to release this object. - */ - void Close(); - - /** - * ProcessCommandDataIB is only called when a unicast invoke command request is received - * It requires the endpointId in its command path to be able to dispatch the command - */ - Protocols::InteractionModel::Status ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement); - - /** - * ProcessGroupCommandDataIB is only called when a group invoke command request is received - * It doesn't need the endpointId in it's command path since it uses the GroupId in message metadata to find it - */ - Protocols::InteractionModel::Status ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement); - - CHIP_ERROR TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); - - CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); - - /** - * If this function fails, it may leave our TLV buffer in an inconsistent state. - * Callers should snapshot as needed before calling this function, and roll back - * as needed afterward. - * - * @param [in] aRequestCommandPath the concrete path of the command we are responding to - * @param [in] aResponseCommandId the id of the command to encode - * @param [in] aEncodable the data to encode for the given aResponseCommandId - */ - CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable); - - void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); - - /** - * Check whether the InvokeRequest we are handling is targeted to a group. - */ - bool IsGroupRequest() { return mGroupRequest; } - - bool ResponsesAccepted() { return !(mGroupRequest || mpResponder == nullptr); } - - /** - * Sets the state flag to keep the information that request we are handling is targeted to a group. - */ - void SetGroupRequest(bool isGroupRequest) { mGroupRequest = isGroupRequest; } - - CommandPathRegistry & GetCommandPathRegistry() const { return *mCommandPathRegistry; } - - size_t MaxPathsPerInvoke() const { return mMaxPathsPerInvoke; } - - void AddToHandleList(Handle * handle); - - void RemoveFromHandleList(Handle * handle); - - void InvalidateHandles(); - - bool TestOnlyIsInIdleState() const { return mState == State::Idle; } - - Callback * mpCallback = nullptr; - InvokeResponseMessage::Builder mInvokeResponseBuilder; - TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; - size_t mPendingWork = 0; - /* List to store all currently-outstanding Handles for this Command Handler.*/ - IntrusiveList mpHandleList; - - chip::System::PacketBufferTLVWriter mCommandMessageWriter; - TLV::TLVWriter mBackupWriter; - size_t mMaxPathsPerInvoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE; - // TODO(#30453): See if we can reduce this size for the default cases - // TODO Allow flexibility in registration. - BasicCommandPathRegistry mBasicCommandPathRegistry; - CommandPathRegistry * mCommandPathRegistry = &mBasicCommandPathRegistry; - std::optional mRefForResponse; - - CommandHandlerExchangeInterface * mpResponder = nullptr; - - State mState = State::Idle; - State mBackupState; - ScopedChangeOnly mInternalCallToAddResponseData{ false }; - bool mSuppressResponse = false; - bool mTimedRequest = false; - bool mGroupRequest = false; - bool mBufferAllocated = false; - bool mReserveSpaceForMoreChunkMessages = false; - // TODO(#32486): We should introduce breaking change where calls to add CommandData - // need to use AddResponse, and not CommandHandler primitives directly using - // GetCommandDataIBTLVWriter. - bool mRollbackBackupValid = false; - // If mGoneAsync is true, we have finished out initial processing of the - // incoming invoke. After this point, our session could go away at any - // time. - bool mGoneAsync = false; + virtual void DecrementHoldOff(Handle * apHandle) {} }; } // namespace app diff --git a/src/app/CommandHandlerImpl.cpp b/src/app/CommandHandlerImpl.cpp new file mode 100644 index 00000000000000..f32d6bebd49455 --- /dev/null +++ b/src/app/CommandHandlerImpl.cpp @@ -0,0 +1,1057 @@ +/* + * + * Copyright (c) 2020 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. + */ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +using Status = Protocols::InteractionModel::Status; + +CommandHandlerImpl::CommandHandlerImpl(Callback * apCallback) : mpCallback(apCallback), mSuppressResponse(false) {} + +CommandHandlerImpl::CommandHandlerImpl(TestOnlyOverrides & aTestOverride, Callback * apCallback) : CommandHandlerImpl(apCallback) +{ + if (aTestOverride.commandPathRegistry) + { + mMaxPathsPerInvoke = aTestOverride.commandPathRegistry->MaxSize(); + mCommandPathRegistry = aTestOverride.commandPathRegistry; + } + if (aTestOverride.commandResponder) + { + SetExchangeInterface(aTestOverride.commandResponder); + } +} + +CommandHandlerImpl::~CommandHandlerImpl() +{ + InvalidateHandles(); +} + +CHIP_ERROR CommandHandlerImpl::AllocateBuffer() +{ + // We should only allocate a buffer if we will be sending out a response. + VerifyOrReturnError(ResponsesAccepted(), CHIP_ERROR_INCORRECT_STATE); + + if (!mBufferAllocated) + { + mCommandMessageWriter.Reset(); + + System::PacketBufferHandle commandPacket = System::PacketBufferHandle::New(chip::app::kMaxSecureSduLengthBytes); + VerifyOrReturnError(!commandPacket.IsNull(), CHIP_ERROR_NO_MEMORY); + + mCommandMessageWriter.Init(std::move(commandPacket)); + ReturnErrorOnFailure(mInvokeResponseBuilder.InitWithEndBufferReserved(&mCommandMessageWriter)); + + if (mReserveSpaceForMoreChunkMessages) + { + ReturnErrorOnFailure(mInvokeResponseBuilder.ReserveSpaceForMoreChunkedMessages()); + } + + // Sending an InvokeResponse to an InvokeResponse is going to be removed from the spec soon. + // It was never implemented in the SDK, and there are no command responses that expect a + // command response. This means we will never receive an InvokeResponse Message in response + // to an InvokeResponse Message that we are sending. This means that the only response + // we are expecting to receive in response to an InvokeResponse Message that we are + // sending-out is a status when we are chunking multiple responses. As a result, to satisfy the + // condition that we don't set SuppressResponse to true while also setting + // MoreChunkedMessages to true, we are hardcoding the value to false here. + mInvokeResponseBuilder.SuppressResponse(/* aSuppressResponse = */ false); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + + mInvokeResponseBuilder.CreateInvokeResponses(/* aReserveEndBuffer = */ true); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + + mBufferAllocated = true; + MoveToState(State::NewResponseMessage); + } + + return CHIP_NO_ERROR; +} + +Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "state should be Idle"); + + SetExchangeInterface(&commandResponder); + + // Using RAII here: if this is the only handle remaining, DecrementHoldOff will + // call the CommandHandlerImpl::OnDone callback when this function returns. + Handle workHandle(this); + + Status status = ProcessInvokeRequest(std::move(payload), isTimedInvoke); + mGoneAsync = true; + return status; +} + +CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, + aResponseCommandId }; + + InvokeResponseParameters prepareParams(aRequestCommandPath); + prepareParams.SetStartOrEndDataStruct(false); + + { + ScopedChange internalCallToAddResponse(mInternalCallToAddResponseData, true); + ReturnErrorOnFailure(PrepareInvokeResponseCommand(responseCommandPath, prepareParams)); + } + + TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); + return FinishCommand(/* aEndDataStruct = */ false); +} + +CHIP_ERROR CommandHandlerImpl::AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + // Return early when response should not be sent out. + VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); + return TryAddingResponse( + [&]() -> CHIP_ERROR { return TryAddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); }); +} + +CHIP_ERROR CommandHandlerImpl::ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + size_t commandCount = 0; + bool commandRefExpected = false; + InvokeRequests::Parser invokeRequests; + + ReturnErrorOnFailure(invokeRequestMessage.GetInvokeRequests(&invokeRequests)); + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + ReturnErrorOnFailure(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */)); + + // If this is a GroupRequest the only thing to check is that there is only one + // CommandDataIB. + if (IsGroupRequest()) + { + VerifyOrReturnError(commandCount == 1, CHIP_ERROR_INVALID_ARGUMENT); + return CHIP_NO_ERROR; + } + // While technically any commandCount == 1 should already be unique and does not need + // any further validation, we do need to read and populate the registry to help + // in building the InvokeResponse. + + VerifyOrReturnError(commandCount <= MaxPathsPerInvoke(), CHIP_ERROR_INVALID_ARGUMENT); + + // If there is more than one CommandDataIB, spec states that CommandRef must be provided. + commandRefExpected = commandCount > 1; + + while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) + { + VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), CHIP_ERROR_INVALID_ARGUMENT); + CommandDataIB::Parser commandData; + ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); + + // First validate that we can get a ConcreteCommandPath. + CommandPathIB::Parser commandPath; + ConcreteCommandPath concretePath(0, 0, 0); + ReturnErrorOnFailure(commandData.GetPath(&commandPath)); + ReturnErrorOnFailure(commandPath.GetConcreteCommandPath(concretePath)); + + // Grab the CommandRef if there is one, and validate that it's there when it + // has to be. + std::optional commandRef; + uint16_t ref; + err = commandData.GetRef(&ref); + VerifyOrReturnError(err == CHIP_NO_ERROR || err == CHIP_END_OF_TLV, err); + if (err == CHIP_END_OF_TLV && commandRefExpected) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + if (err == CHIP_NO_ERROR) + { + commandRef.emplace(ref); + } + + // Adding can fail if concretePath is not unique, or if commandRef is a value + // and is not unique, or if we have already added more paths than we support. + ReturnErrorOnFailure(GetCommandPathRegistry().Add(concretePath, commandRef)); + } + + // It's OK/expected to have reached the end of the container without failure. + if (CHIP_END_OF_TLV == err) + { + err = CHIP_NO_ERROR; + } + ReturnErrorOnFailure(err); + return invokeRequestMessage.ExitContainer(); +} + +Status CommandHandlerImpl::ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + System::PacketBufferTLVReader reader; + InvokeRequestMessage::Parser invokeRequestMessage; + InvokeRequests::Parser invokeRequests; + reader.Init(std::move(payload)); + VerifyOrReturnError(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, Status::InvalidAction); +#if CHIP_CONFIG_IM_PRETTY_PRINT + invokeRequestMessage.PrettyPrint(); +#endif + VerifyOrDie(mpResponder); + if (mpResponder->GetGroupId().HasValue()) + { + SetGroupRequest(true); + } + + // When updating this code, please remember to make corresponding changes to TestOnlyInvokeCommandRequestWithFaultsInjected. + VerifyOrReturnError(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(mTimedRequest == isTimedInvoke, Status::TimedRequestMismatch); + + { + InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; + VerifyOrReturnError(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, + Status::InvalidAction); + } + + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + size_t commandCount = 0; + VerifyOrReturnError(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, + Status::InvalidAction); + if (commandCount > 1) + { + mReserveSpaceForMoreChunkMessages = true; + } + + while (CHIP_NO_ERROR == (err = invokeRequestsReader.Next())) + { + VerifyOrReturnError(TLV::AnonymousTag() == invokeRequestsReader.GetTag(), Status::InvalidAction); + CommandDataIB::Parser commandData; + VerifyOrReturnError(commandData.Init(invokeRequestsReader) == CHIP_NO_ERROR, Status::InvalidAction); + Status status = Status::Success; + if (IsGroupRequest()) + { + status = ProcessGroupCommandDataIB(commandData); + } + else + { + status = ProcessCommandDataIB(commandData); + } + if (status != Status::Success) + { + return status; + } + } + + // if we have exhausted this container + if (CHIP_END_OF_TLV == err) + { + err = CHIP_NO_ERROR; + } + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + VerifyOrReturnError(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, Status::InvalidAction); + return Status::Success; +} + +void CommandHandlerImpl::Close() +{ + mSuppressResponse = false; + mpResponder = nullptr; + MoveToState(State::AwaitingDestruction); + + // We must finish all async work before we can shut down a CommandHandlerImpl. The actual CommandHandlerImpl MUST finish their + // work in reasonable time or there is a bug. The only case for releasing CommandHandlerImpl without CommandHandler::Handle + // releasing its reference is the stack shutting down, in which case Close() is not called. So the below check should always + // pass. + VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandlerImpl::Close() called with %u unfinished async work items", + static_cast(mPendingWork)); + InvalidateHandles(); + + if (mpCallback) + { + mpCallback->OnDone(*this); + } +} + +void CommandHandlerImpl::AddToHandleList(Handle * apHandle) +{ + mpHandleList.PushBack(apHandle); +} + +void CommandHandlerImpl::RemoveFromHandleList(Handle * apHandle) +{ + VerifyOrDie(mpHandleList.Contains(apHandle)); + mpHandleList.Remove(apHandle); +} + +void CommandHandlerImpl::InvalidateHandles() +{ + for (auto handle = mpHandleList.begin(); handle != mpHandleList.end(); ++handle) + { + handle->Invalidate(); + } +} + +void CommandHandlerImpl::IncrementHoldOff(Handle * apHandle) +{ + mPendingWork++; + AddToHandleList(apHandle); +} + +void CommandHandlerImpl::DecrementHoldOff(Handle * apHandle) +{ + + mPendingWork--; + ChipLogDetail(DataManagement, "Decreasing reference count for CommandHandlerImpl, remaining %u", + static_cast(mPendingWork)); + + RemoveFromHandleList(apHandle); + + if (mPendingWork != 0) + { + return; + } + + if (mpResponder == nullptr) + { + ChipLogProgress(DataManagement, "Skipping command response: response sender is null"); + } + else if (!IsGroupRequest()) + { + CHIP_ERROR err = FinalizeLastInvokeResponseMessage(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Failed to finalize command response: %" CHIP_ERROR_FORMAT, err.Format()); + } + } + + Close(); +} + +namespace { +// We use this when the sender did not actually provide a CommandFields struct, +// to avoid downstream consumers having to worry about cases when there is or is +// not a struct available. We use an empty struct with anonymous tag, since we +// can't use a context tag at top level, and consumers should not care about the +// tag here). +constexpr uint8_t sNoFields[] = { + CHIP_TLV_STRUCTURE(CHIP_TLV_TAG_ANONYMOUS), + CHIP_TLV_END_OF_CONTAINER, +}; +} // anonymous namespace + +Status CommandHandlerImpl::ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CommandPathIB::Parser commandPath; + ConcreteCommandPath concretePath(0, 0, 0); + TLV::TLVReader commandDataReader; + + // NOTE: errors may occur before the concrete command path is even fully decoded. + + err = aCommandElement.GetPath(&commandPath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + err = commandPath.GetConcreteCommandPath(concretePath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + { + Status commandExists = mpCallback->CommandExists(concretePath); + if (commandExists != Status::Success) + { + ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", + ChipLogValueMEI(concretePath.mCommandId), ChipLogValueMEI(concretePath.mClusterId), + concretePath.mEndpointId); + return FallibleAddStatus(concretePath, commandExists) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + { + Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); + Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; + Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); + err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); + if (err != CHIP_NO_ERROR) + { + if (err != CHIP_ERROR_ACCESS_DENIED) + { + return FallibleAddStatus(concretePath, Status::Failure) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + // TODO: when wildcard invokes are supported, handle them to discard rather than fail with status + return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + if (CommandNeedsTimedInvoke(concretePath.mClusterId, concretePath.mCommandId) && !IsTimedInvoke()) + { + // TODO: when wildcard invokes are supported, discard a + // wildcard-expanded path instead of returning a status. + return FallibleAddStatus(concretePath, Status::NeedsTimedInteraction) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + + if (CommandIsFabricScoped(concretePath.mClusterId, concretePath.mCommandId)) + { + // SPEC: Else if the command in the path is fabric-scoped and there is no accessing fabric, + // a CommandStatusIB SHALL be generated with the UNSUPPORTED_ACCESS Status Code. + + // Fabric-scoped commands are not allowed before a specific accessing fabric is available. + // This is mostly just during a PASE session before AddNOC. + if (GetAccessingFabricIndex() == kUndefinedFabricIndex) + { + // TODO: when wildcard invokes are supported, discard a + // wildcard-expanded path instead of returning a status. + return FallibleAddStatus(concretePath, Status::UnsupportedAccess) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + } + + err = aCommandElement.GetFields(&commandDataReader); + if (CHIP_END_OF_TLV == err) + { + ChipLogDetail(DataManagement, + "Received command without data for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); + commandDataReader.Init(sNoFields); + err = commandDataReader.Next(); + } + if (CHIP_NO_ERROR == err) + { + ChipLogDetail(DataManagement, "Received command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + concretePath.mEndpointId, ChipLogValueMEI(concretePath.mClusterId), ChipLogValueMEI(concretePath.mCommandId)); + SuccessOrExit(err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())); + mpCallback->DispatchCommand(*this, concretePath, commandDataReader); + DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); + } + +exit: + if (err != CHIP_NO_ERROR) + { + return FallibleAddStatus(concretePath, Status::InvalidCommand) != CHIP_NO_ERROR ? Status::Failure : Status::Success; + } + + // We have handled the error status above and put the error status in response, now return success status so we can process + // other commands in the invoke request. + return Status::Success; +} + +Status CommandHandlerImpl::ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CommandPathIB::Parser commandPath; + TLV::TLVReader commandDataReader; + ClusterId clusterId; + CommandId commandId; + GroupId groupId; + FabricIndex fabric; + + Credentials::GroupDataProvider::GroupEndpoint mapping; + Credentials::GroupDataProvider * groupDataProvider = Credentials::GetGroupDataProvider(); + Credentials::GroupDataProvider::EndpointIterator * iterator; + + err = aCommandElement.GetPath(&commandPath); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + err = commandPath.GetGroupCommandPath(&clusterId, &commandId); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + + VerifyOrDie(mpResponder); + // The optionalGroupId must have a value, otherwise we wouldn't have reached this code path. + groupId = mpResponder->GetGroupId().Value(); + fabric = GetAccessingFabricIndex(); + + ChipLogDetail(DataManagement, "Received group command for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + groupId, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + + err = aCommandElement.GetFields(&commandDataReader); + if (CHIP_END_OF_TLV == err) + { + ChipLogDetail(DataManagement, + "Received command without data for Group=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, groupId, + ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + commandDataReader.Init(sNoFields); + err = commandDataReader.Next(); + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::InvalidAction); + } + VerifyOrReturnError(err == CHIP_NO_ERROR, Status::Failure); + + // Per spec, we do the "is this a timed command?" check for every path, but + // since all paths that fail it just get silently discarded we can do it + // once up front and discard all the paths at once. Ordering with respect + // to ACL and command presence checks does not matter, because the behavior + // is the same for all of them: ignore the path. + if (CommandNeedsTimedInvoke(clusterId, commandId)) + { + // Group commands are never timed. + return Status::Success; + } + + // No check for `CommandIsFabricScoped` unlike in `ProcessCommandDataIB()` since group commands + // always have an accessing fabric, by definition. + + // Find which endpoints can process the command, and dispatch to them. + iterator = groupDataProvider->IterateEndpoints(fabric); + VerifyOrReturnError(iterator != nullptr, Status::Failure); + + while (iterator->Next(mapping)) + { + if (groupId != mapping.group_id) + { + continue; + } + + ChipLogDetail(DataManagement, + "Processing group command for Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI, + mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId)); + + const ConcreteCommandPath concretePath(mapping.endpoint_id, clusterId, commandId); + + if (mpCallback->CommandExists(concretePath) != Status::Success) + { + ChipLogDetail(DataManagement, "No command " ChipLogFormatMEI " in Cluster " ChipLogFormatMEI " on Endpoint 0x%x", + ChipLogValueMEI(commandId), ChipLogValueMEI(clusterId), mapping.endpoint_id); + + continue; + } + + { + Access::SubjectDescriptor subjectDescriptor = GetSubjectDescriptor(); + Access::RequestPath requestPath{ .cluster = concretePath.mClusterId, .endpoint = concretePath.mEndpointId }; + Access::Privilege requestPrivilege = RequiredPrivilege::ForInvokeCommand(concretePath); + err = Access::GetAccessControl().Check(subjectDescriptor, requestPath, requestPrivilege); + if (err != CHIP_NO_ERROR) + { + // NOTE: an expected error is CHIP_ERROR_ACCESS_DENIED, but there could be other unexpected errors; + // therefore, keep processing subsequent commands, and if any errors continue, those subsequent + // commands will likewise fail. + continue; + } + } + if ((err = DataModelCallbacks::GetInstance()->PreCommandReceived(concretePath, GetSubjectDescriptor())) == CHIP_NO_ERROR) + { + TLV::TLVReader dataReader(commandDataReader); + mpCallback->DispatchCommand(*this, concretePath, dataReader); + DataModelCallbacks::GetInstance()->PostCommandReceived(concretePath, GetSubjectDescriptor()); + } + else + { + ChipLogError(DataManagement, + "Error when calling PreCommandReceived for Endpoint=%u Cluster=" ChipLogFormatMEI + " Command=" ChipLogFormatMEI " : %" CHIP_ERROR_FORMAT, + mapping.endpoint_id, ChipLogValueMEI(clusterId), ChipLogValueMEI(commandId), err.Format()); + continue; + } + } + iterator->Release(); + return Status::Success; +} + +CHIP_ERROR CommandHandlerImpl::TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) +{ + // Return early when response should not be sent out. + VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); + + ReturnErrorOnFailure(PrepareStatus(aCommandPath)); + CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); + StatusIB::Builder & statusIBBuilder = commandStatus.CreateErrorStatus(); + ReturnErrorOnFailure(commandStatus.GetError()); + statusIBBuilder.EncodeStatusIB(aStatus); + ReturnErrorOnFailure(statusIBBuilder.GetError()); + return FinishStatus(); +} + +CHIP_ERROR CommandHandlerImpl::AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus) +{ + return TryAddingResponse([&]() -> CHIP_ERROR { return TryAddStatusInternal(aCommandPath, aStatus); }); +} + +void CommandHandlerImpl::AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context) +{ + + CHIP_ERROR error = FallibleAddStatus(aCommandPath, aStatus, context); + + if (error != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Failed to add command status: %" CHIP_ERROR_FORMAT, error.Format()); + // TODO(#30453) we could call mpResponder->ResponseDropped() if err == CHIP_ERROR_NO_MEMORY. This should + // be done as a follow up so that change can be evaluated as a standalone PR. + + // Do not crash if the status has not been added due to running out of packet buffers or other resources. + // It is better to drop a single response than to go offline and lose all sessions and subscriptions. + VerifyOrDie(error == CHIP_ERROR_NO_MEMORY); + } +} + +CHIP_ERROR CommandHandlerImpl::FallibleAddStatus(const ConcreteCommandPath & path, const Protocols::InteractionModel::Status status, + const char * context) +{ + if (status != Status::Success) + { + if (context == nullptr) + { + context = "no additional context"; + } + + ChipLogError(DataManagement, + "Endpoint=%u Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " status " ChipLogFormatIMStatus " (%s)", + path.mEndpointId, ChipLogValueMEI(path.mClusterId), ChipLogValueMEI(path.mCommandId), + ChipLogValueIMStatus(status), context); + } + + return AddStatusInternal(path, StatusIB(status)); +} + +CHIP_ERROR CommandHandlerImpl::AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) +{ + return AddStatusInternal(aCommandPath, StatusIB(Status::Success, aClusterStatus)); +} + +CHIP_ERROR CommandHandlerImpl::AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) +{ + return AddStatusInternal(aCommandPath, StatusIB(Status::Failure, aClusterStatus)); +} + +CHIP_ERROR CommandHandlerImpl::PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, + const CommandHandlerImpl::InvokeResponseParameters & aPrepareParameters) +{ + auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aPrepareParameters.mRequestCommandPath); + VerifyOrReturnValue(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); + + return PrepareInvokeResponseCommand(*commandPathRegistryEntry, aResponseCommandPath, aPrepareParameters.mStartOrEndDataStruct); +} + +CHIP_ERROR CommandHandlerImpl::PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, + const ConcreteCommandPath & aCommandPath, bool aStartDataStruct) +{ + // Intentionally omitting the ResponsesAccepted early exit. Direct use of PrepareInvokeResponseCommand + // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). + // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. + ReturnErrorOnFailure(AllocateBuffer()); + + if (!mInternalCallToAddResponseData && mState == State::AddedCommand) + { + // An attempt is being made to add CommandData InvokeResponse using primitive + // CommandHandlerImpl APIs. While not recommended, as this potentially leaves the + // CommandHandlerImpl in an incorrect state upon failure, this approach is permitted + // for legacy reasons. To maximize the likelihood of success, particularly when + // handling large amounts of data, we try to obtain a new, completely empty + // InvokeResponseMessage, as the existing one already has space occupied. + ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); + } + + CreateBackupForResponseRollback(); + // + // We must not be in the middle of preparing a command, or having prepared or sent one. + // + VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + + // TODO(#30453): See if we can pass this back up the stack so caller can provide this instead of taking up + // space in CommandHanlder. + mRefForResponse = apCommandPathRegistryEntry.ref; + + MoveToState(State::Preparing); + InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); + InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); + ReturnErrorOnFailure(invokeResponses.GetError()); + + CommandDataIB::Builder & commandData = invokeResponse.CreateCommand(); + ReturnErrorOnFailure(commandData.GetError()); + CommandPathIB::Builder & path = commandData.CreatePath(); + ReturnErrorOnFailure(commandData.GetError()); + ReturnErrorOnFailure(path.Encode(aCommandPath)); + if (aStartDataStruct) + { + ReturnErrorOnFailure(commandData.GetWriter()->StartContainer(TLV::ContextTag(CommandDataIB::Tag::kFields), + TLV::kTLVType_Structure, mDataElementContainerType)); + } + MoveToState(State::AddingCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::FinishCommand(bool aStartDataStruct) +{ + // Intentionally omitting the ResponsesAccepted early exit. Direct use of FinishCommand + // is discouraged, as it often indicates incorrect usage patterns (see GitHub issue #32486). + // If you're encountering CHIP_ERROR_INCORRECT_STATE, refactoring to use AddResponse is recommended. + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + CommandDataIB::Builder & commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); + if (aStartDataStruct) + { + ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); + } + + if (mRefForResponse.has_value()) + { + ReturnErrorOnFailure(commandData.Ref(*mRefForResponse)); + } + + ReturnErrorOnFailure(commandData.EndOfCommandDataIB()); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); + MoveToState(State::AddedCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::PrepareStatus(const ConcreteCommandPath & aCommandPath) +{ + ReturnErrorOnFailure(AllocateBuffer()); + // + // We must not be in the middle of preparing a command, or having prepared or sent one. + // + VerifyOrReturnError(mState == State::NewResponseMessage || mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + if (mState == State::AddedCommand) + { + CreateBackupForResponseRollback(); + } + + auto commandPathRegistryEntry = GetCommandPathRegistry().Find(aCommandPath); + VerifyOrReturnError(commandPathRegistryEntry.has_value(), CHIP_ERROR_INCORRECT_STATE); + mRefForResponse = commandPathRegistryEntry->ref; + + MoveToState(State::Preparing); + InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); + InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); + ReturnErrorOnFailure(invokeResponses.GetError()); + CommandStatusIB::Builder & commandStatus = invokeResponse.CreateStatus(); + ReturnErrorOnFailure(commandStatus.GetError()); + CommandPathIB::Builder & path = commandStatus.CreatePath(); + ReturnErrorOnFailure(commandStatus.GetError()); + ReturnErrorOnFailure(path.Encode(aCommandPath)); + MoveToState(State::AddingCommand); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CommandHandlerImpl::FinishStatus() +{ + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + + CommandStatusIB::Builder & commandStatus = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus(); + if (mRefForResponse.has_value()) + { + ReturnErrorOnFailure(commandStatus.Ref(*mRefForResponse)); + } + + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB()); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB()); + MoveToState(State::AddedCommand); + return CHIP_NO_ERROR; +} + +void CommandHandlerImpl::CreateBackupForResponseRollback() +{ + VerifyOrReturn(mState == State::NewResponseMessage || mState == State::AddedCommand); + VerifyOrReturn(mInvokeResponseBuilder.GetInvokeResponses().GetError() == CHIP_NO_ERROR); + VerifyOrReturn(mInvokeResponseBuilder.GetError() == CHIP_NO_ERROR); + mInvokeResponseBuilder.Checkpoint(mBackupWriter); + mBackupState = mState; + mRollbackBackupValid = true; +} + +CHIP_ERROR CommandHandlerImpl::RollbackResponse() +{ + VerifyOrReturnError(mRollbackBackupValid, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Preparing || mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + ChipLogDetail(DataManagement, "Rolling back response"); + // TODO(#30453): Rollback of mInvokeResponseBuilder should handle resetting + // InvokeResponses. + mInvokeResponseBuilder.GetInvokeResponses().ResetError(); + mInvokeResponseBuilder.Rollback(mBackupWriter); + MoveToState(mBackupState); + mRollbackBackupValid = false; + return CHIP_NO_ERROR; +} + +TLV::TLVWriter * CommandHandlerImpl::GetCommandDataIBTLVWriter() +{ + if (mState != State::AddingCommand) + { + return nullptr; + } + + return mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand().GetWriter(); +} + +FabricIndex CommandHandlerImpl::GetAccessingFabricIndex() const +{ + VerifyOrDie(!mGoneAsync); + VerifyOrDie(mpResponder); + return mpResponder->GetAccessingFabricIndex(); +} + +CHIP_ERROR CommandHandlerImpl::FinalizeInvokeResponseMessageAndPrepareNext() +{ + ReturnErrorOnFailure(FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ true)); + // After successfully finalizing InvokeResponseMessage, no buffer should remain + // allocated. + VerifyOrDie(!mBufferAllocated); + CHIP_ERROR err = AllocateBuffer(); + if (err != CHIP_NO_ERROR) + { + // TODO(#30453): Improve ResponseDropped calls to occur only when dropping is + // definitively guaranteed. + // Response dropping is not yet definitive as a subsequent call + // to AllocateBuffer might succeed. + VerifyOrDie(mpResponder); + mpResponder->ResponseDropped(); + } + return err; +} + +CHIP_ERROR CommandHandlerImpl::FinalizeInvokeResponseMessage(bool aHasMoreChunks) +{ + System::PacketBufferHandle packet; + + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses()); + if (aHasMoreChunks) + { + // Unreserving space previously reserved for MoreChunkedMessages is done + // in the call to mInvokeResponseBuilder.MoreChunkedMessages. + mInvokeResponseBuilder.MoreChunkedMessages(aHasMoreChunks); + ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); + } + ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage()); + ReturnErrorOnFailure(mCommandMessageWriter.Finalize(&packet)); + VerifyOrDie(mpResponder); + mpResponder->AddInvokeResponseToSend(std::move(packet)); + mBufferAllocated = false; + mRollbackBackupValid = false; + return CHIP_NO_ERROR; +} + +void CommandHandlerImpl::SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "CommandResponseSender can only be set in idle state"); + mpResponder = commandResponder; +} + +const char * CommandHandlerImpl::GetStateStr() const +{ +#if CHIP_DETAIL_LOGGING + switch (mState) + { + case State::Idle: + return "Idle"; + + case State::NewResponseMessage: + return "NewResponseMessage"; + + case State::Preparing: + return "Preparing"; + + case State::AddingCommand: + return "AddingCommand"; + + case State::AddedCommand: + return "AddedCommand"; + + case State::DispatchResponses: + return "DispatchResponses"; + + case State::AwaitingDestruction: + return "AwaitingDestruction"; + } +#endif // CHIP_DETAIL_LOGGING + return "N/A"; +} + +void CommandHandlerImpl::MoveToState(const State aTargetState) +{ + mState = aTargetState; + ChipLogDetail(DataManagement, "Command handler moving to [%10.10s]", GetStateStr()); +} + +void CommandHandlerImpl::FlushAcksRightAwayOnSlowCommand() +{ + if (mpResponder) + { + mpResponder->HandlingSlowCommand(); + } +} + +Access::SubjectDescriptor CommandHandlerImpl::GetSubjectDescriptor() const +{ + VerifyOrDie(!mGoneAsync); + VerifyOrDie(mpResponder); + return mpResponder->GetSubjectDescriptor(); +} + +bool CommandHandlerImpl::IsTimedInvoke() const +{ + return mTimedRequest; +} + +void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) +{ + CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); + if (err != CHIP_NO_ERROR) + { + ChipLogError(DataManagement, "Adding response failed: %" CHIP_ERROR_FORMAT ". Returning failure instead.", err.Format()); + AddStatus(aRequestCommandPath, Protocols::InteractionModel::Status::Failure); + } +} + +Messaging::ExchangeContext * CommandHandlerImpl::GetExchangeContext() const +{ + VerifyOrDie(mpResponder); + return mpResponder->GetExchangeContext(); +} + +#if CHIP_WITH_NLFAULTINJECTION + +namespace { + +CHIP_ERROR TestOnlyExtractCommandPathFromNextInvokeRequest(TLV::TLVReader & invokeRequestsReader, + ConcreteCommandPath & concretePath) +{ + ReturnErrorOnFailure(invokeRequestsReader.Next(TLV::AnonymousTag())); + CommandDataIB::Parser commandData; + ReturnErrorOnFailure(commandData.Init(invokeRequestsReader)); + CommandPathIB::Parser commandPath; + ReturnErrorOnFailure(commandData.GetPath(&commandPath)); + return commandPath.GetConcreteCommandPath(concretePath); +} + +[[maybe_unused]] const char * GetFaultInjectionTypeStr(CommandHandlerImpl::NlFaultInjectionType faultType) +{ + switch (faultType) + { + case CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessages: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be the same as the " + "original request."; + case CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder: + return "Each response will be sent in a separate InvokeResponseMessage. The order of responses will be reversed from the " + "original request."; + case CommandHandlerImpl::NlFaultInjectionType::SkipSecondResponse: + return "Single InvokeResponseMessages. Dropping response to second request"; + } + ChipLogError(DataManagement, "TH Failure: Unexpected fault type"); + chipAbort(); +} + +} // anonymous namespace + +// This method intentionally duplicates code from other sections. While code consolidation +// is generally preferred, here we prioritize generating a clear crash message to aid in +// troubleshooting test failures. +void CommandHandlerImpl::TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke, + NlFaultInjectionType faultType) +{ + VerifyOrDieWithMsg(mState == State::Idle, DataManagement, "TH Failure: state should be Idle, issue with TH"); + SetExchangeInterface(&commandResponder); + + ChipLogProgress(DataManagement, "Response to InvokeRequestMessage overridden by fault injection"); + ChipLogProgress(DataManagement, " Injecting the following response:%s", GetFaultInjectionTypeStr(faultType)); + + Handle workHandle(this); + VerifyOrDieWithMsg(!commandResponder.GetGroupId().HasValue(), DataManagement, "DUT Failure: Unexpected Group Command"); + + System::PacketBufferTLVReader reader; + InvokeRequestMessage::Parser invokeRequestMessage; + InvokeRequests::Parser invokeRequests; + reader.Init(std::move(payload)); + VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed 'invokeRequestMessage.Init(reader)'"); +#if CHIP_CONFIG_IM_PRETTY_PRINT + invokeRequestMessage.PrettyPrint(); +#endif + + VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory SuppressResponse field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetTimedRequest(&mTimedRequest) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory TimedRequest field missing"); + VerifyOrDieWithMsg(invokeRequestMessage.GetInvokeRequests(&invokeRequests) == CHIP_NO_ERROR, DataManagement, + "DUT Failure: Mandatory InvokeRequests field missing"); + VerifyOrDieWithMsg(mTimedRequest == isTimedInvoke, DataManagement, + "DUT Failure: TimedRequest value in message mismatches action"); + + { + InvokeRequestMessage::Parser validationInvokeRequestMessage = invokeRequestMessage; + VerifyOrDieWithMsg(ValidateInvokeRequestMessageAndBuildRegistry(validationInvokeRequestMessage) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: InvokeRequestMessage contents were invalid"); + } + + TLV::TLVReader invokeRequestsReader; + invokeRequests.GetReader(&invokeRequestsReader); + + size_t commandCount = 0; + VerifyOrDieWithMsg(TLV::Utilities::Count(invokeRequestsReader, commandCount, false /* recurse */) == CHIP_NO_ERROR, + DataManagement, + "TH Failure: Failed to get the length of InvokeRequests after InvokeRequestMessage validation"); + + // The command count check (specifically for a count of 2) is tied to IDM_1_3. This may need adjustment for + // compatibility with future test plans. + VerifyOrDieWithMsg(commandCount == 2, DataManagement, "DUT failure: We were strictly expecting exactly 2 InvokeRequests"); + mReserveSpaceForMoreChunkMessages = true; + + { + // Response path is the same as request path since we are replying with a failure message. + ConcreteCommandPath concreteResponsePath1; + ConcreteCommandPath concreteResponsePath2; + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath1) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the first request"); + VerifyOrDieWithMsg( + TestOnlyExtractCommandPathFromNextInvokeRequest(invokeRequestsReader, concreteResponsePath2) == CHIP_NO_ERROR, + DataManagement, "DUT Failure: Issues encountered while extracting the ConcreteCommandPath from the second request"); + + if (faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + ConcreteCommandPath temp(concreteResponsePath1); + concreteResponsePath1 = concreteResponsePath2; + concreteResponsePath2 = temp; + } + + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath1, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the first InvokeResponse"); + if (faultType == NlFaultInjectionType::SeparateResponseMessages || + faultType == NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder) + { + VerifyOrDieWithMsg(FinalizeInvokeResponseMessageAndPrepareNext() == CHIP_NO_ERROR, DataManagement, + "TH Failure: Failed to create second InvokeResponseMessage"); + } + if (faultType != NlFaultInjectionType::SkipSecondResponse) + { + VerifyOrDieWithMsg(FallibleAddStatus(concreteResponsePath2, Status::Failure) == CHIP_NO_ERROR, DataManagement, + "TH Failure: Error adding the second InvokeResponse"); + } + } + + VerifyOrDieWithMsg(invokeRequestsReader.Next() == CHIP_END_OF_TLV, DataManagement, + "DUT Failure: Unexpected TLV ending of InvokeRequests"); + VerifyOrDieWithMsg(invokeRequestMessage.ExitContainer() == CHIP_NO_ERROR, DataManagement, + "DUT Failure: InvokeRequestMessage TLV is not properly terminated"); +} +#endif // CHIP_WITH_NLFAULTINJECTION + +} // namespace app +} // namespace chip diff --git a/src/app/CommandHandlerImpl.h b/src/app/CommandHandlerImpl.h new file mode 100644 index 00000000000000..fd85f35440f7cc --- /dev/null +++ b/src/app/CommandHandlerImpl.h @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2020-2024 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. + */ +#pragma once + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { + +class CommandHandlerImpl : public CommandHandler +{ +public: + class Callback + { + public: + virtual ~Callback() = default; + + /* + * Method that signals to a registered callback that this object + * has completed doing useful work and is now safe for release/destruction. + */ + virtual void OnDone(CommandHandlerImpl & apCommandObj) = 0; + + /* + * Upon processing of a CommandDataIB, this method is invoked to dispatch the command + * to the right server-side handler provided by the application. + */ + virtual void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) = 0; + + /* + * Check to see if a command implementation exists for a specific + * concrete command path. If it does, Success will be returned. If + * not, one of UnsupportedEndpoint, UnsupportedCluster, or + * UnsupportedCommand will be returned, depending on how the command + * fails to exist. + */ + virtual Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) = 0; + }; + + struct InvokeResponseParameters + { + InvokeResponseParameters(const ConcreteCommandPath & aRequestCommandPath) : mRequestCommandPath(aRequestCommandPath) {} + + InvokeResponseParameters & SetStartOrEndDataStruct(bool aStartOrEndDataStruct) + { + mStartOrEndDataStruct = aStartOrEndDataStruct; + return *this; + } + + ConcreteCommandPath mRequestCommandPath; + /** + * Whether the method this is being provided to should start/end the TLV container for the CommandFields element + * within CommandDataIB. + */ + bool mStartOrEndDataStruct = true; + }; + + struct TestOnlyOverrides + { + public: + CommandPathRegistry * commandPathRegistry = nullptr; + CommandHandlerExchangeInterface * commandResponder = nullptr; + }; + + /* + * The callback passed in has to outlive this CommandHandler object. + */ + CommandHandlerImpl(Callback * apCallback); + + /* + * The destructor will also invalidate all Handles created for this CommandHandlerImpl. + */ + virtual ~CommandHandlerImpl(); + + /* + * Constructor to override the number of supported paths per invoke and command responder. + * + * The callback and any pointers passed via TestOnlyOverrides must outlive this + * CommandHandlerImpl object. + * + * For testing purposes. + */ + CommandHandlerImpl(TestOnlyOverrides & aTestOverride, Callback * apCallback); + + /**************** CommandHandler interface implementation ***********************/ + + using CommandHandler::AddResponseData; + + void FlushAcksRightAwayOnSlowCommand() override; + + CHIP_ERROR FallibleAddStatus(const ConcreteCommandPath & aRequestCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) override; + void AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, + const char * context = nullptr) override; + CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; + CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; + + CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) override; + void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable) override; + + Access::SubjectDescriptor GetSubjectDescriptor() const override; + FabricIndex GetAccessingFabricIndex() const override; + bool IsTimedInvoke() const override; + Messaging::ExchangeContext * GetExchangeContext() const override; + + /**************** Implementation-specific logic ***********************/ + + /* + * Main entrypoint for this class to handle an InvokeRequestMessage. + * + * This function MAY call the registered OnDone callback before returning. + * To prevent immediate OnDone invocation, callers can wrap their CommandHandlerImpl instance + * within a CommandHandler::Handle. + * + * isTimedInvoke is true if and only if this is part of a Timed Invoke + * transaction (i.e. was preceded by a Timed Request). If we reach here, + * the timer verification has already been done. + * + * commandResponder handles sending InvokeResponses, added by clusters, to the client. The + * command responder object must outlive this CommandHandler object. It is only safe to + * release after the caller of OnInvokeCommandRequest receives the OnDone callback. + */ + Protocols::InteractionModel::Status OnInvokeCommandRequest(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke); + + /** + * Checks that all CommandDataIB within InvokeRequests satisfy the spec's general + * constraints for CommandDataIB. Additionally checks that InvokeRequestMessage is + * properly formatted. + * + * This also builds a registry to ensure that all commands can be responded + * to with the data required as per spec. + */ + CHIP_ERROR ValidateInvokeRequestMessageAndBuildRegistry(InvokeRequestMessage::Parser & invokeRequestMessage); + + /** + * This adds a new CommandDataIB element into InvokeResponses for the associated + * aRequestCommandPath. This adds up until the `CommandFields` element within + * `CommandDataIB`. + * + * This call will fail if CommandHandler is already in the middle of building a + * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without + * calling Finish*), or is already sending InvokeResponseMessage. + * + * Upon success, the caller is expected to call `FinishCommand` once they have added + * all the fields into the CommandFields element of CommandDataIB. + * + * @param [in] aResponseCommandPath the concrete response path that we are sending to Requester. + * @param [in] aPrepareParameters struct containing paramters needs for preparing a command. Data + * such as request path, and whether this method should start the CommandFields element within + * CommandDataIB. + */ + CHIP_ERROR PrepareInvokeResponseCommand(const ConcreteCommandPath & aResponseCommandPath, + const InvokeResponseParameters & aPrepareParameters); + + /** + * Finishes the CommandDataIB element within the InvokeResponses. + * + * Caller must have first successfully called `PrepareInvokeResponseCommand`. + * + * @param [in] aEndDataStruct end the TLV container for the CommandFields element within + * CommandDataIB. This should match the boolean passed into Prepare*. + * + * @return CHIP_ERROR_INCORRECT_STATE + * If device has not previously successfully called + * `PrepareInvokeResponseCommand`. + * @return CHIP_ERROR_BUFFER_TOO_SMALL + * If writing the values needed to finish the InvokeReponseIB + * with the current contents of the InvokeResponseMessage + * would exceed the limit. When this error occurs, it is possible + * we have already closed some of the IB Builders that were + * previously started in `PrepareInvokeResponseCommand`. + * @return CHIP_ERROR_NO_MEMORY + * If TLVWriter attempted to allocate an output buffer failed due to + * lack of memory. + * @return other Other TLVWriter related errors. Typically occurs if + * `GetCommandDataIBTLVWriter()` was called and used incorrectly. + */ + // TODO(#30453): We should be able to eliminate the chances of OOM issues with reserve. + // This will be completed in a follow up PR. + CHIP_ERROR FinishCommand(bool aEndDataStruct = true); + + TLV::TLVWriter * GetCommandDataIBTLVWriter(); + +#if CHIP_WITH_NLFAULTINJECTION + + enum class NlFaultInjectionType : uint8_t + { + SeparateResponseMessages, + SeparateResponseMessagesAndInvertedResponseOrder, + SkipSecondResponse + }; + + /** + * @brief Sends InvokeResponseMessages with injected faults for certification testing. + * + * The Test Harness (TH) uses this to simulate various server response behaviors, + * ensuring the Device Under Test (DUT) handles responses per specification. + * + * This function strictly validates the DUT's InvokeRequestMessage against the test plan. + * If deviations occur, the TH terminates with a detailed error message. + * + * @param commandResponder commandResponder that will send the InvokeResponseMessages to the client. + * @param payload Payload of the incoming InvokeRequestMessage from the client. + * @param isTimedInvoke Indicates whether the interaction is timed. + * @param faultType The specific type of fault to inject into the response. + */ + // TODO(#30453): After refactoring CommandHandler for better unit testability, create a + // unit test specifically for the fault injection behavior. + void TestOnlyInvokeCommandRequestWithFaultsInjected(CommandHandlerExchangeInterface & commandResponder, + System::PacketBufferHandle && payload, bool isTimedInvoke, + NlFaultInjectionType faultType); +#endif // CHIP_WITH_NLFAULTINJECTION + +protected: + // Lifetime management for CommandHandler::Handle + + void IncrementHoldOff(Handle * apHandle) override; + void DecrementHoldOff(Handle * apHandle) override; + +private: + friend class TestCommandInteraction; + friend class CommandHandler::Handle; + + enum class State : uint8_t + { + Idle, ///< Default state that the object starts out in, where no work has commenced + NewResponseMessage, ///< mInvokeResponseBuilder is ready, with no responses added. + Preparing, ///< We are prepaing the command or status header. + AddingCommand, ///< In the process of adding a command. + AddedCommand, ///< A command has been completely encoded and is awaiting transmission. + DispatchResponses, ///< The command response(s) are being dispatched. + AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. + }; + + /** + * @brief Best effort to add InvokeResponse to InvokeResponseMessage. + * + * Tries to add response using lambda. Upon failure to add response, attempts + * to rollback the InvokeResponseMessage to a known good state. If failure is due + * to insufficient space in the current InvokeResponseMessage: + * - Finalizes the current InvokeResponseMessage. + * - Allocates a new InvokeResponseMessage. + * - Reattempts to add the InvokeResponse to the new InvokeResponseMessage. + * + * @param [in] addResponseFunction A lambda function responsible for adding the + * response to the current InvokeResponseMessage. + */ + template + CHIP_ERROR TryAddingResponse(Function && addResponseFunction) + { + // Invalidate any existing rollback backups. The addResponseFunction is + // expected to create a new backup during either PrepareInvokeResponseCommand + // or PrepareStatus execution. Direct invocation of + // CreateBackupForResponseRollback is avoided since the buffer used by + // InvokeResponseMessage might not be allocated until a Prepare* function + // is called. + mRollbackBackupValid = false; + CHIP_ERROR err = addResponseFunction(); + if (err == CHIP_NO_ERROR) + { + return CHIP_NO_ERROR; + } + ReturnErrorOnFailure(RollbackResponse()); + // If we failed to add a command due to lack of space in the + // packet, we will make another attempt to add the response using + // an additional InvokeResponseMessage. + if (mState != State::AddedCommand || err != CHIP_ERROR_NO_MEMORY) + { + return err; + } + ReturnErrorOnFailure(FinalizeInvokeResponseMessageAndPrepareNext()); + err = addResponseFunction(); + if (err != CHIP_NO_ERROR) + { + // The return value of RollbackResponse is ignored, as we prioritize + // conveying the error generated by addResponseFunction to the + // caller. + RollbackResponse(); + } + return err; + } + + void MoveToState(const State aTargetState); + const char * GetStateStr() const; + + /** + * Create a backup to enable rolling back to the state prior to ResponseData encoding in the event of failure. + */ + void CreateBackupForResponseRollback(); + + /** + * Rollback the state to before encoding the current ResponseData (before calling PrepareInvokeResponseCommand / PrepareStatus) + * + * Requires CreateBackupForResponseRollback to be called at the start of PrepareInvokeResponseCommand / PrepareStatus + */ + CHIP_ERROR RollbackResponse(); + + /* + * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does + * not arise during normal message processing flows that all normally call Close() above. This can only + * arise due to application-initiated destruction of the object when this object is handling receiving/sending + * message payloads. + */ + void Abort(); + + /* + * Allocates a packet buffer used for encoding an invoke response payload. + * + * This can be called multiple times safely, as it will only allocate the buffer once for the lifetime + * of this object. + */ + CHIP_ERROR AllocateBuffer(); + + /** + * This will add a new CommandStatusIB element into InvokeResponses. It will put the + * aCommandPath into the CommandPath element within CommandStatusIB. + * + * This call will fail if CommandHandler is already in the middle of building a + * CommandStatusIB or CommandDataIB (i.e. something has called Prepare*, without + * calling Finish*), or is already sending InvokeResponseMessage. + * + * Upon success, the caller is expected to call `FinishStatus` once they have encoded + * StatusIB. + * + * @param [in] aCommandPath the concrete path of the command we are responding to. + */ + CHIP_ERROR PrepareStatus(const ConcreteCommandPath & aCommandPath); + + /** + * Finishes the CommandStatusIB element within the InvokeResponses. + * + * Caller must have first successfully called `PrepareStatus`. + */ + CHIP_ERROR FinishStatus(); + + CHIP_ERROR PrepareInvokeResponseCommand(const CommandPathRegistryEntry & apCommandPathRegistryEntry, + const ConcreteCommandPath & aCommandPath, bool aStartDataStruct); + + CHIP_ERROR FinalizeLastInvokeResponseMessage() { return FinalizeInvokeResponseMessage(/* aHasMoreChunks = */ false); } + + CHIP_ERROR FinalizeInvokeResponseMessageAndPrepareNext(); + + CHIP_ERROR FinalizeInvokeResponseMessage(bool aHasMoreChunks); + + Protocols::InteractionModel::Status ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke); + + /** + * Called internally to signal the completion of all work on this object, gracefully close the + * exchange (by calling into the base class) and finally, signal to a registerd callback that it's + * safe to release this object. + */ + void Close(); + + /** + * ProcessCommandDataIB is only called when a unicast invoke command request is received + * It requires the endpointId in its command path to be able to dispatch the command + */ + Protocols::InteractionModel::Status ProcessCommandDataIB(CommandDataIB::Parser & aCommandElement); + + /** + * ProcessGroupCommandDataIB is only called when a group invoke command request is received + * It doesn't need the endpointId in it's command path since it uses the GroupId in message metadata to find it + */ + Protocols::InteractionModel::Status ProcessGroupCommandDataIB(CommandDataIB::Parser & aCommandElement); + + CHIP_ERROR TryAddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); + + CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const StatusIB & aStatus); + + /** + * If this function fails, it may leave our TLV buffer in an inconsistent state. + * Callers should snapshot as needed before calling this function, and roll back + * as needed afterward. + * + * @param [in] aRequestCommandPath the concrete path of the command we are responding to + * @param [in] aResponseCommandId the id of the command to encode + * @param [in] aEncodable the data to encode for the given aResponseCommandId + */ + CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, + DataModel::EncodableToTLV & aEncodable); + + void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); + + /** + * Check whether the InvokeRequest we are handling is targeted to a group. + */ + bool IsGroupRequest() { return mGroupRequest; } + + bool ResponsesAccepted() { return !(mGroupRequest || mpResponder == nullptr); } + + /** + * Sets the state flag to keep the information that request we are handling is targeted to a group. + */ + void SetGroupRequest(bool isGroupRequest) { mGroupRequest = isGroupRequest; } + + CommandPathRegistry & GetCommandPathRegistry() const { return *mCommandPathRegistry; } + + size_t MaxPathsPerInvoke() const { return mMaxPathsPerInvoke; } + + void AddToHandleList(Handle * handle); + + void RemoveFromHandleList(Handle * handle); + + void InvalidateHandles(); + + bool TestOnlyIsInIdleState() const { return mState == State::Idle; } + + Callback * mpCallback = nullptr; + InvokeResponseMessage::Builder mInvokeResponseBuilder; + TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; + size_t mPendingWork = 0; + /* List to store all currently-outstanding Handles for this Command Handler.*/ + IntrusiveList mpHandleList; + + chip::System::PacketBufferTLVWriter mCommandMessageWriter; + TLV::TLVWriter mBackupWriter; + size_t mMaxPathsPerInvoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE; + // TODO(#30453): See if we can reduce this size for the default cases + // TODO Allow flexibility in registration. + BasicCommandPathRegistry mBasicCommandPathRegistry; + CommandPathRegistry * mCommandPathRegistry = &mBasicCommandPathRegistry; + std::optional mRefForResponse; + + CommandHandlerExchangeInterface * mpResponder = nullptr; + + State mState = State::Idle; + State mBackupState; + ScopedChangeOnly mInternalCallToAddResponseData{ false }; + bool mSuppressResponse = false; + bool mTimedRequest = false; + bool mGroupRequest = false; + bool mBufferAllocated = false; + bool mReserveSpaceForMoreChunkMessages = false; + // TODO(#32486): We should introduce breaking change where calls to add CommandData + // need to use AddResponse, and not CommandHandler primitives directly using + // GetCommandDataIBTLVWriter. + bool mRollbackBackupValid = false; + // If mGoneAsync is true, we have finished out initial processing of the + // incoming invoke. After this point, our session could go away at any + // time. + bool mGoneAsync = false; +}; +} // namespace app +} // namespace chip diff --git a/src/app/CommandResponseSender.cpp b/src/app/CommandResponseSender.cpp index d7f40caa476c8e..430fa5f0fa523b 100644 --- a/src/app/CommandResponseSender.cpp +++ b/src/app/CommandResponseSender.cpp @@ -113,7 +113,7 @@ void CommandResponseSender::StartSendingCommandResponses() } } -void CommandResponseSender::OnDone(CommandHandler & apCommandObj) +void CommandResponseSender::OnDone(CommandHandlerImpl & apCommandObj) { if (mState == State::ErrorSentDelayCloseUntilOnDone) { @@ -125,7 +125,7 @@ void CommandResponseSender::OnDone(CommandHandler & apCommandObj) StartSendingCommandResponses(); } -void CommandResponseSender::DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, +void CommandResponseSender::DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) { VerifyOrReturn(mpCommandHandlerCallback); @@ -231,7 +231,7 @@ void CommandResponseSender::OnInvokeCommandRequest(Messaging::ExchangeContext * void CommandResponseSender::TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, System::PacketBufferHandle && payload, bool isTimedInvoke, - CommandHandler::NlFaultInjectionType faultType) + CommandHandlerImpl::NlFaultInjectionType faultType) { VerifyOrDieWithMsg(ec != nullptr, DataManagement, "TH Failure: Incoming exchange context should not be null"); VerifyOrDieWithMsg(mState == State::ReadyForInvokeResponses, DataManagement, diff --git a/src/app/CommandResponseSender.h b/src/app/CommandResponseSender.h index a89970ddec6c92..1925f01b54bf8c 100644 --- a/src/app/CommandResponseSender.h +++ b/src/app/CommandResponseSender.h @@ -17,8 +17,8 @@ #pragma once -#include #include +#include #include #include #include @@ -35,7 +35,7 @@ namespace app { * CommandHandlerExchangeInterface implementation to enable sending InvokeResponseMessage(s). */ class CommandResponseSender : public Messaging::ExchangeDelegate, - public CommandHandler::Callback, + public CommandHandlerImpl::Callback, public CommandHandlerExchangeInterface { public: @@ -50,7 +50,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, virtual void OnDone(CommandResponseSender & apResponderObj) = 0; }; - CommandResponseSender(Callback * apCallback, CommandHandler::Callback * apDispatchCallback) : + CommandResponseSender(Callback * apCallback, CommandHandlerImpl::Callback * apDispatchCallback) : mpCallback(apCallback), mpCommandHandlerCallback(apDispatchCallback), mCommandHandler(this), mExchangeCtx(*this) {} @@ -59,9 +59,9 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, void OnResponseTimeout(Messaging::ExchangeContext * ec) override; - void OnDone(CommandHandler & apCommandObj) override; + void OnDone(CommandHandlerImpl & apCommandObj) override; - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) override; Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) override; @@ -149,7 +149,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, * @param faultType The specific type of fault to inject into the response. */ void TestOnlyInvokeCommandRequestWithFaultsInjected(Messaging::ExchangeContext * ec, System::PacketBufferHandle && payload, - bool isTimedInvoke, CommandHandler::NlFaultInjectionType faultType); + bool isTimedInvoke, CommandHandlerImpl::NlFaultInjectionType faultType); #endif // CHIP_WITH_NLFAULTINJECTION private: @@ -182,8 +182,8 @@ class CommandResponseSender : public Messaging::ExchangeDelegate, System::PacketBufferHandle mChunks; Callback * mpCallback; - CommandHandler::Callback * mpCommandHandlerCallback; - CommandHandler mCommandHandler; + CommandHandlerImpl::Callback * mpCommandHandlerCallback; + CommandHandlerImpl mCommandHandler; Messaging::ExchangeHolder mExchangeCtx; State mState = State::ReadyForInvokeResponses; diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 6ee2a1134594b5..132e8cdf108a72 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -389,8 +389,8 @@ void InteractionModelEngine::OnDone(CommandResponseSender & apResponderObj) mCommandResponderObjs.ReleaseObject(&apResponderObj); } -// TODO(#30453): Follow up refactor. Remove need for InteractionModelEngine::OnDone(CommandHandler). -void InteractionModelEngine::OnDone(CommandHandler & apCommandObj) +// TODO(#30453): Follow up refactor. Remove need for InteractionModelEngine::OnDone(CommandHandlerImpl). +void InteractionModelEngine::OnDone(CommandHandlerImpl & apCommandObj) { // We are no longer expecting to receive this callback. With the introduction of CommandResponseSender, it is now // responsible for receiving this callback. @@ -437,20 +437,20 @@ Status InteractionModelEngine::OnInvokeCommandRequest(Messaging::ExchangeContext ChipLogProgress(InteractionModel, "no resource for Invoke interaction"); return Status::Busy; } - CHIP_FAULT_INJECT( - FaultInjection::kFault_IMInvoke_SeparateResponses, - commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( - apExchangeContext, std::move(aPayload), aIsTimedInvoke, CommandHandler::NlFaultInjectionType::SeparateResponseMessages); - return Status::Success;); + CHIP_FAULT_INJECT(FaultInjection::kFault_IMInvoke_SeparateResponses, + commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, + CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessages); + return Status::Success;); CHIP_FAULT_INJECT(FaultInjection::kFault_IMInvoke_SeparateResponsesInvertResponseOrder, commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( apExchangeContext, std::move(aPayload), aIsTimedInvoke, - CommandHandler::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder); + CommandHandlerImpl::NlFaultInjectionType::SeparateResponseMessagesAndInvertedResponseOrder); return Status::Success;); CHIP_FAULT_INJECT( FaultInjection::kFault_IMInvoke_SkipSecondResponse, - commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected(apExchangeContext, std::move(aPayload), aIsTimedInvoke, - CommandHandler::NlFaultInjectionType::SkipSecondResponse); + commandResponder->TestOnlyInvokeCommandRequestWithFaultsInjected( + apExchangeContext, std::move(aPayload), aIsTimedInvoke, CommandHandlerImpl::NlFaultInjectionType::SkipSecondResponse); return Status::Success;); commandResponder->OnInvokeCommandRequest(apExchangeContext, std::move(aPayload), aIsTimedInvoke); return Status::Success; @@ -1674,7 +1674,7 @@ CHIP_ERROR InteractionModelEngine::PushFront(SingleLinkedListNode *& aObjectL return CHIP_NO_ERROR; } -void InteractionModelEngine::DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, +void InteractionModelEngine::DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) { CommandHandlerInterface * handler = FindCommandHandler(aCommandPath.mEndpointId, aCommandPath.mClusterId); @@ -1901,7 +1901,7 @@ void InteractionModelEngine::OnFabricRemoved(const FabricTable & fabricTable, Fa } } - // Applications may hold references to CommandHandler instances for async command processing. + // Applications may hold references to CommandHandlerImpl instances for async command processing. // Therefore we can't forcible destroy CommandHandlers here. Their exchanges will get closed by // the fabric removal, though, so they will fail when they try to actually send their command response // and will close at that point. diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 4f61cb4e464a27..69c565254f96f0 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -87,7 +87,7 @@ namespace app { class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, public Messaging::ExchangeDelegate, public CommandResponseSender::Callback, - public CommandHandler::Callback, + public CommandHandlerImpl::Callback, public ReadHandler::ManagementCallback, public FabricTable::Delegate, public SubscriptionsInfoProvider, @@ -419,7 +419,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, using Status = Protocols::InteractionModel::Status; void OnDone(CommandResponseSender & apResponderObj) override; - void OnDone(CommandHandler & apCommandObj) override; + void OnDone(CommandHandlerImpl & apCommandObj) override; void OnDone(ReadHandler & apReadObj) override; void TryToResumeSubscriptions(); @@ -499,7 +499,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, Status OnUnsolicitedReportData(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload); - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) override; Protocols::InteractionModel::Status CommandExists(const ConcreteCommandPath & aCommandPath) override; diff --git a/src/app/tests/TestCommandInteraction.cpp b/src/app/tests/TestCommandInteraction.cpp index dc6b6132341a63..2a5791ba839423 100644 --- a/src/app/tests/TestCommandInteraction.cpp +++ b/src/app/tests/TestCommandInteraction.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -310,11 +311,12 @@ class MockCommandResponder : public CommandHandlerExchangeInterface bool mResponseDropped = false; }; -class MockCommandHandlerCallback : public CommandHandler::Callback +class MockCommandHandlerCallback : public CommandHandlerImpl::Callback { public: - void OnDone(CommandHandler & apCommandHandler) final { onFinalCalledTimes++; } - void DispatchCommand(CommandHandler & apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & apPayload) final + void OnDone(CommandHandlerImpl & apCommandHandler) final { onFinalCalledTimes++; } + void DispatchCommand(CommandHandlerImpl & apCommandObj, const ConcreteCommandPath & aCommandPath, + TLV::TLVReader & apPayload) final { DispatchSingleClusterCommand(aCommandPath, apPayload, &apCommandObj); } @@ -395,17 +397,19 @@ class TestCommandInteraction * we want to test APIs that cluster code uses, we need to inject entries into the * CommandPathRegistry directly. */ - class CommandHandlerWithUnrespondedCommand : public app::CommandHandler + class CommandHandlerWithUnrespondedCommand : public app::CommandHandlerImpl { public: - CommandHandlerWithUnrespondedCommand(CommandHandler::Callback * apCallback, const ConcreteCommandPath & aRequestCommandPath, - const Optional & aRef) : - CommandHandler(apCallback) + CommandHandlerWithUnrespondedCommand(CommandHandlerImpl::Callback * apCallback, + const ConcreteCommandPath & aRequestCommandPath, const Optional & aRef) : + CommandHandlerImpl(apCallback) { GetCommandPathRegistry().Add(aRequestCommandPath, aRef.std_optional()); SetExchangeInterface(&mMockCommandResponder); } MockCommandResponder mMockCommandResponder; + + using app::CommandHandler::AddResponse; }; // Generate an invoke request. If aCommandId is kTestCommandIdWithData, a @@ -428,7 +432,7 @@ class TestCommandInteraction CommandId aRequestCommandId = kTestCommandIdWithData); static uint32_t GetAddResponseDataOverheadSizeForPath(nlTestSuite * apSuite, const ConcreteCommandPath & aRequestCommandPath, ForcedSizeBufferLengthHint aBufferSizeHint); - static void FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandler * apCommandHandler, + static void FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandlerImpl * apCommandHandler, const ConcreteCommandPath & aRequestCommandPath, uint32_t aSizeToLeaveInBuffer); static void ValidateCommandHandlerEncodeInvokeResponseMessage(nlTestSuite * apSuite, void * apContext, bool aNeedStatusCode); }; @@ -627,8 +631,8 @@ uint32_t TestCommandInteraction::GetAddResponseDataOverheadSizeForPath(nlTestSui { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; @@ -653,7 +657,7 @@ uint32_t TestCommandInteraction::GetAddResponseDataOverheadSizeForPath(nlTestSui return delta; } -void TestCommandInteraction::FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandler * apCommandHandler, +void TestCommandInteraction::FillCurrentInvokeResponseBuffer(nlTestSuite * apSuite, CommandHandlerImpl * apCommandHandler, const ConcreteCommandPath & aRequestCommandPath, uint32_t aSizeToLeaveInBuffer) { @@ -705,7 +709,7 @@ void TestCommandInteraction::TestCommandHandlerWithWrongState(nlTestSuite * apSu // be handle already acquired on the callers behalf. CommandHandler::Handle handle(&commandHandler); - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); } @@ -748,7 +752,7 @@ void TestCommandInteraction::TestCommandHandlerWithSendEmptyCommand(nlTestSuite // be handle already acquired on the callers behalf. CommandHandler::Handle handle(&commandHandler); - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); err = commandHandler.FinishCommand(); @@ -892,8 +896,8 @@ struct BadFields void TestCommandInteraction::TestCommandHandlerCommandDataEncoding(nlTestSuite * apSuite, void * apContext) { - auto path = MakeTestCommandPath(); - auto requestCommandPath = ConcreteCommandPath(path.mEndpointId, path.mClusterId, path.mCommandId); + auto path = MakeTestCommandPath(); + ConcreteCommandPath requestCommandPath(path.mEndpointId, path.mClusterId, path.mCommandId); CommandHandlerWithUnrespondedCommand commandHandler(nullptr, requestCommandPath, /* aRef = */ NullOptional); { @@ -1295,7 +1299,7 @@ void TestCommandInteraction::TestCommandHandlerEncodeSimpleStatusCode(nlTestSuit void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddStatus(nlTestSuite * apSuite, void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); commandHandler.AddStatus(requestCommandPath, Protocols::InteractionModel::Status::Failure); @@ -1307,7 +1311,7 @@ void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddStatus( void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingAddResponse(nlTestSuite * apSuite, void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); uint32_t sizeToFill = 50; // This is an arbitrary number, we need to select a non-zero value. CHIP_ERROR err = commandHandler.AddResponseData(requestCommandPath, ForcedSizeBuffer(sizeToFill)); @@ -1322,13 +1326,13 @@ void TestCommandInteraction::TestCommandHandlerWithoutResponderCallingDirectPrep void * apContext) { chip::app::ConcreteCommandPath requestCommandPath(kTestEndpointId, kTestClusterId, kTestCommandIdWithData); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); // We intentionally prevent successful calls to PrepareInvokeResponseCommand and FinishCommand when no // responder is present. This aligns with the design decision to promote AddStatus and AddResponseData // usage in such scenarios. See GitHub issue #32486 for discussions on phasing out external use of // these primitives. - const CommandHandler::InvokeResponseParameters prepareParams(requestCommandPath); + const CommandHandlerImpl::InvokeResponseParameters prepareParams(requestCommandPath); ConcreteCommandPath responseCommandPath = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; CHIP_ERROR err = commandHandler.PrepareInvokeResponseCommand(responseCommandPath, prepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_INCORRECT_STATE); @@ -1347,7 +1351,7 @@ void TestCommandInteraction::TestCommandHandlerWithOnInvokeReceivedNotExistComma // Use some invalid endpoint / cluster / command. GenerateInvokeRequest(apSuite, apContext, commandDatabuf, /* aIsTimedRequest = */ false, 0xEF /* command */, 0xADBE /* cluster */, 0xDE /* endpoint */); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); chip::isCommandDispatched = false; mockCommandHandlerDelegate.ResetCounter(); @@ -1368,7 +1372,7 @@ void TestCommandInteraction::TestCommandHandlerWithOnInvokeReceivedEmptyDataMsg( for (auto transactionIsTimed : allBooleans) { mockCommandHandlerDelegate.ResetCounter(); - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); System::PacketBufferHandle commandDatabuf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize); chip::isCommandDispatched = false; @@ -1800,8 +1804,8 @@ void TestCommandInteraction::TestCommandHandlerRejectsMultipleCommandsWithIdenti BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); // Hackery to steal the InvokeRequest buffer from commandSender. System::PacketBufferHandle commandDatabuf; @@ -1867,7 +1871,7 @@ void TestCommandInteraction::TestCommandHandlerRejectMultipleCommandsWhenHandler sendResponse = true; commandDispatchedCount = 0; - CommandHandler commandHandler(&mockCommandHandlerDelegate); + CommandHandlerImpl commandHandler(&mockCommandHandlerDelegate); MockCommandResponder mockCommandResponder; InteractionModel::Status status = commandHandler.OnInvokeCommandRequest(mockCommandResponder, std::move(commandDatabuf), false); NL_TEST_ASSERT(apSuite, status == InteractionModel::Status::InvalidAction); @@ -1918,8 +1922,8 @@ void TestCommandInteraction::TestCommandHandlerAcceptMultipleCommands(nlTestSuit BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); // Hackery to steal the InvokeRequest buffer from commandSender. System::PacketBufferHandle commandDatabuf; @@ -1941,8 +1945,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; @@ -1970,8 +1974,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; @@ -1999,8 +2003,8 @@ void TestCommandInteraction::TestCommandHandler_FillUpInvokeResponseMessageWhere { BasicCommandPathRegistry<4> basicCommandPathRegistry; MockCommandResponder mockCommandResponder; - CommandHandler::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; - CommandHandler commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); + CommandHandlerImpl::TestOnlyOverrides testOnlyOverrides{ &basicCommandPathRegistry, &mockCommandResponder }; + CommandHandlerImpl commandHandler(testOnlyOverrides, &mockCommandHandlerDelegate); commandHandler.mReserveSpaceForMoreChunkMessages = true; ConcreteCommandPath requestCommandPath1 = { kTestEndpointId, kTestClusterId, kTestCommandIdFillResponseMessage }; ConcreteCommandPath requestCommandPath2 = { kTestEndpointId, kTestClusterId, kTestCommandIdCommandSpecificResponse }; @@ -2049,9 +2053,8 @@ void TestCommandInteraction::TestCommandHandlerReleaseWithExchangeClosed(nlTestS // Mimic closure of the exchange that would happen on a session release and verify that releasing the handle there-after // is handled gracefully. - asyncCommandHandle.Get()->mpResponder->GetExchangeContext()->GetSessionHolder().Release(); - asyncCommandHandle.Get()->mpResponder->GetExchangeContext()->OnSessionReleased(); - + asyncCommandHandle.Get()->GetExchangeContext()->GetSessionHolder().Release(); + asyncCommandHandle.Get()->GetExchangeContext()->OnSessionReleased(); asyncCommandHandle = nullptr; } #endif diff --git a/src/controller/java/OTAProviderDelegateBridge.cpp b/src/controller/java/OTAProviderDelegateBridge.cpp index 4565d42416c19a..77bf3572e0f65c 100644 --- a/src/controller/java/OTAProviderDelegateBridge.cpp +++ b/src/controller/java/OTAProviderDelegateBridge.cpp @@ -18,6 +18,7 @@ #include "OTAProviderDelegateBridge.h" +#include #include #include #include From a2a25fbdd76072f27928acb97fcb06761fbcd249 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 6 Jun 2024 13:55:18 -0400 Subject: [PATCH 32/78] Make removeDevice drop the subscription for an MTRDevice. (#33767) MTRDevice uses auto-resubscribe subscriptions. We had tests that set up a device, then did removeDevice, but that did not clear the subscription, and any attempts to clear it on the server side would cause it to try to re-subscribe if the subscription drop was detected. When invalidating an MTRDevice, we should tear down its subscription. --- src/darwin/Framework/CHIP/MTRDevice.mm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 8d808324fe9765..9a9b2eb340d107 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -788,9 +788,18 @@ - (void)invalidate // attempt, since we now have no delegate. _reattemptingSubscription = NO; - // We do not change _internalDeviceState here, because we might still have a - // subscription. In that case, _internalDeviceState will update when the - // subscription is actually terminated. + [_deviceController asyncDispatchToMatterQueue:^{ + // Destroy the read client and callback (has to happen on the Matter + // queue, to avoid deleting objects that are being referenced), to + // tear down the subscription. We will get no more callbacks from + // the subscrption after this point. + std::lock_guard lock(self->_lock); + self->_currentReadClient = nullptr; + self->_currentSubscriptionCallback = nullptr; + + [self _changeInternalState:MTRInternalDeviceStateUnsubscribed]; + } + errorHandler:nil]; [self _stopConnectivityMonitoring]; From 2b6969e4a683405ff76a52bab025d2c9842cc2e5 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 6 Jun 2024 16:22:22 -0400 Subject: [PATCH 33/78] Make EncodableToTLV arguments const (#33785) --- src/app/CommandHandler.h | 4 ++-- src/app/CommandHandlerImpl.cpp | 6 +++--- src/app/CommandHandlerImpl.h | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index 86f687c1c02466..6c2af0e8cf1e1e 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -155,7 +155,7 @@ class CommandHandler * case AddResponseData fails. */ virtual CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) = 0; + const DataModel::EncodableToTLV & aEncodable) = 0; /** * Attempts to encode a response to a command. @@ -171,7 +171,7 @@ class CommandHandler * AddResponseData allows the caller to try to deal with any CHIP_ERRORs. */ virtual void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) = 0; + const DataModel::EncodableToTLV & aEncodable) = 0; /** * Check whether the InvokeRequest we are handling is a timed invoke. diff --git a/src/app/CommandHandlerImpl.cpp b/src/app/CommandHandlerImpl.cpp index f32d6bebd49455..926e5b3877c6bd 100644 --- a/src/app/CommandHandlerImpl.cpp +++ b/src/app/CommandHandlerImpl.cpp @@ -114,7 +114,7 @@ Status CommandHandlerImpl::OnInvokeCommandRequest(CommandHandlerExchangeInterfac } CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { ConcreteCommandPath responseCommandPath = { aRequestCommandPath.mEndpointId, aRequestCommandPath.mClusterId, aResponseCommandId }; @@ -134,7 +134,7 @@ CHIP_ERROR CommandHandlerImpl::TryAddResponseData(const ConcreteCommandPath & aR } CHIP_ERROR CommandHandlerImpl::AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { // Return early when response should not be sent out. VerifyOrReturnValue(ResponsesAccepted(), CHIP_NO_ERROR); @@ -909,7 +909,7 @@ bool CommandHandlerImpl::IsTimedInvoke() const } void CommandHandlerImpl::AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) + const DataModel::EncodableToTLV & aEncodable) { CHIP_ERROR err = AddResponseData(aRequestCommandPath, aResponseCommandId, aEncodable); if (err != CHIP_NO_ERROR) diff --git a/src/app/CommandHandlerImpl.h b/src/app/CommandHandlerImpl.h index fd85f35440f7cc..db7c8516bc5510 100644 --- a/src/app/CommandHandlerImpl.h +++ b/src/app/CommandHandlerImpl.h @@ -125,9 +125,9 @@ class CommandHandlerImpl : public CommandHandler CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aRequestCommandPath, ClusterStatus aClusterStatus) override; CHIP_ERROR AddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) override; + const DataModel::EncodableToTLV & aEncodable) override; void AddResponse(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable) override; + const DataModel::EncodableToTLV & aEncodable) override; Access::SubjectDescriptor GetSubjectDescriptor() const override; FabricIndex GetAccessingFabricIndex() const override; @@ -409,7 +409,7 @@ class CommandHandlerImpl : public CommandHandler * @param [in] aEncodable the data to encode for the given aResponseCommandId */ CHIP_ERROR TryAddResponseData(const ConcreteCommandPath & aRequestCommandPath, CommandId aResponseCommandId, - DataModel::EncodableToTLV & aEncodable); + const DataModel::EncodableToTLV & aEncodable); void SetExchangeInterface(CommandHandlerExchangeInterface * commandResponder); From d84f13e9bf71688a21a75d160521fce3435c0102 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 6 Jun 2024 16:29:23 -0400 Subject: [PATCH 34/78] Python testing: Conformance support for device type conditions (#33622) * Python testing: Conformance support for device type conditions * fix type * strings * simplify exception * Restyled by isort * address review comments --------- Co-authored-by: Restyled.io --- src/python_testing/TestConformanceSupport.py | 147 ++++++++++++++----- src/python_testing/conformance_support.py | 132 ++++++++++++----- 2 files changed, 206 insertions(+), 73 deletions(-) diff --git a/src/python_testing/TestConformanceSupport.py b/src/python_testing/TestConformanceSupport.py index f71eb3ed1d531f..1405e5c8c791cc 100644 --- a/src/python_testing/TestConformanceSupport.py +++ b/src/python_testing/TestConformanceSupport.py @@ -16,15 +16,23 @@ # import xml.etree.ElementTree as ElementTree +from typing import Callable -from conformance_support import ConformanceDecision, ConformanceException, ConformanceParseParameters, parse_callable_from_xml -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from conformance_support import (ConformanceDecision, ConformanceException, ConformanceParseParameters, deprecated, disallowed, + mandatory, optional, parse_basic_callable_from_xml, parse_callable_from_xml, + parse_device_type_callable_from_xml, provisional, zigbee) +from matter_testing_support import MatterBaseTest, default_matter_test_main from mobly import asserts +def basic_test(xml: str, cls: Callable) -> None: + et = ElementTree.fromstring(xml) + xml_callable = parse_basic_callable_from_xml(et) + asserts.assert_true(isinstance(xml_callable, cls), "Unexpected class parsed from basic conformance") + + class TestConformanceSupport(MatterBaseTest): - @async_test_body - async def setup_class(self): + def setup_class(self): super().setup_class() # a small feature map self.feature_names_to_bits = {'AB': 0x01, 'CD': 0x02} @@ -46,8 +54,7 @@ async def setup_class(self): self.params = ConformanceParseParameters( feature_map=self.feature_names_to_bits, attribute_map=self.attribute_names_to_values, command_map=self.command_names_to_values) - @async_test_body - async def test_conformance_mandatory(self): + def test_conformance_mandatory(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -55,8 +62,7 @@ async def test_conformance_mandatory(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.MANDATORY) asserts.assert_equal(str(xml_callable), 'M') - @async_test_body - async def test_conformance_optional(self): + def test_conformance_optional(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -64,8 +70,7 @@ async def test_conformance_optional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.OPTIONAL) asserts.assert_equal(str(xml_callable), 'O') - @async_test_body - async def test_conformance_disallowed(self): + def test_conformance_disallowed(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -80,8 +85,7 @@ async def test_conformance_disallowed(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.DISALLOWED) asserts.assert_equal(str(xml_callable), 'D') - @async_test_body - async def test_conformance_provisional(self): + def test_conformance_provisional(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -89,8 +93,7 @@ async def test_conformance_provisional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.PROVISIONAL) asserts.assert_equal(str(xml_callable), 'P') - @async_test_body - async def test_conformance_zigbee(self): + def test_conformance_zigbee(self): xml = '' et = ElementTree.fromstring(xml) xml_callable = parse_callable_from_xml(et, self.params) @@ -98,8 +101,7 @@ async def test_conformance_zigbee(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'Zigbee') - @async_test_body - async def test_conformance_mandatory_on_condition(self): + def test_conformance_mandatory_on_condition(self): xml = ('' '' '') @@ -151,8 +153,7 @@ async def test_conformance_mandatory_on_condition(self): # test command in optional and in boolean - this is the same as attribute essentially, so testing every permutation is overkill - @async_test_body - async def test_conformance_optional_on_condition(self): + def test_conformance_optional_on_condition(self): # single feature optional xml = ('' '' @@ -228,8 +229,7 @@ async def test_conformance_optional_on_condition(self): asserts.assert_equal(xml_callable(0x00, [], c), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[cmd2]') - @async_test_body - async def test_conformance_not_term_mandatory(self): + def test_conformance_not_term_mandatory(self): # single feature not mandatory xml = ('' '' @@ -288,8 +288,7 @@ async def test_conformance_not_term_mandatory(self): asserts.assert_equal(xml_callable(0x00, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '!attr2') - @async_test_body - async def test_conformance_not_term_optional(self): + def test_conformance_not_term_optional(self): # single feature not optional xml = ('' '' @@ -319,8 +318,7 @@ async def test_conformance_not_term_optional(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!CD]') - @async_test_body - async def test_conformance_and_term(self): + def test_conformance_and_term(self): # and term for features only xml = ('' '' @@ -370,8 +368,7 @@ async def test_conformance_and_term(self): asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB & attr2') - @async_test_body - async def test_conformance_or_term(self): + def test_conformance_or_term(self): # or term feature only xml = ('' '' @@ -421,8 +418,7 @@ async def test_conformance_or_term(self): asserts.assert_equal(xml_callable(f, a, []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), 'AB | attr2') - @async_test_body - async def test_conformance_and_term_with_not(self): + def test_conformance_and_term_with_not(self): # and term with not xml = ('' '' @@ -441,8 +437,7 @@ async def test_conformance_and_term_with_not(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!AB & CD]') - @async_test_body - async def test_conformance_or_term_with_not(self): + def test_conformance_or_term_with_not(self): # or term with not on second feature xml = ('' '' @@ -479,8 +474,7 @@ async def test_conformance_or_term_with_not(self): asserts.assert_equal(xml_callable(f, [], []), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[!(AB | CD)]') - @async_test_body - async def test_conformance_and_term_with_three_terms(self): + def test_conformance_and_term_with_three_terms(self): # and term with three features xml = ('' '' @@ -519,8 +513,7 @@ async def test_conformance_and_term_with_three_terms(self): asserts.assert_equal(xml_callable(f, a, c), ConformanceDecision.NOT_APPLICABLE) asserts.assert_equal(str(xml_callable), '[AB & attr1 & cmd1]') - @async_test_body - async def test_conformance_or_term_with_three_terms(self): + def test_conformance_or_term_with_three_terms(self): # or term with three features xml = ('' '' @@ -671,6 +664,92 @@ def test_conformance_greater(self): except ConformanceException: pass + def test_basic_conformance(self): + basic_test('', mandatory) + basic_test('', optional) + basic_test('', disallowed) + basic_test('', deprecated) + basic_test('', provisional) + basic_test('', zigbee) + + # feature is not basic so we should get an exception + xml = '' + et = ElementTree.fromstring(xml) + try: + parse_basic_callable_from_xml(et) + asserts.fail("Unexpected success parsing non-basic conformance") + except ConformanceException: + pass + + # mandatory tag is basic, but this one is a wrapper, so we should get a TypeError + xml = ('' + '' + '' + '' + '' + '' + '' + '') + et = ElementTree.fromstring(xml) + try: + parse_basic_callable_from_xml(et) + asserts.fail("Unexpected success parsing mandatory wrapper") + except ConformanceException: + pass + + def test_device_type_conformance(self): + msg = "Unexpected conformance returned for device type" + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'Zigbee', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + # expect no exception here + asserts.assert_equal(str(xml_callable), '[Zigbee]', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.NOT_APPLICABLE, msg) + + # otherwise conforms are allowed + xml = ('' + '' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + # expect no exception here + asserts.assert_equal(str(xml_callable), 'Zigbee, P', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.PROVISIONAL, msg) + + # Device type conditions or features don't correspond to anything in the spec, so the XML takes a best + # guess as to what they are. We should be able to parse features, conditions, attributes as the same + # thing. + # TODO: allow querying conformance for conditional device features + # TODO: adjust conformance call function to accept a list of features and evaluate based on that + xml = ('' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'CD', msg) + # Device features are always optional (at least for now), even though we didn't pass this feature in + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + + xml = ('' + '' + '' + '') + et = ElementTree.fromstring(xml) + xml_callable = parse_device_type_callable_from_xml(et) + asserts.assert_equal(str(xml_callable), 'CD, testy', msg) + asserts.assert_equal(xml_callable(0, [], []), ConformanceDecision.OPTIONAL) + if __name__ == "__main__": default_matter_test_main() diff --git a/src/python_testing/conformance_support.py b/src/python_testing/conformance_support.py index 025c1afa678995..c9bdb5830c884b 100644 --- a/src/python_testing/conformance_support.py +++ b/src/python_testing/conformance_support.py @@ -39,6 +39,7 @@ COMMAND_TAG = 'command' CONDITION_TAG = 'condition' LITERAL_TAG = 'literal' +ZIGBEE_CONDITION = 'zigbee' class ConformanceException(Exception): @@ -137,6 +138,16 @@ def __str__(self): return str(self.value) +# Conformance options that apply regardless of the element set of the cluster or device +BASIC_CONFORMANCE: dict[str, Callable] = { + MANDATORY_CONFORM: mandatory(), + OPTIONAL_CONFORM: optional(), + PROVISIONAL_CONFORM: provisional(), + DEPRECATE_CONFORM: deprecated(), + DISALLOW_CONFORM: disallowed() +} + + class feature: def __init__(self, requiredFeature: uint, code: str): self.requiredFeature = requiredFeature @@ -148,7 +159,20 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.code}' + return self.code + + +class device_feature: + ''' This is different than element feature because device types use "features" that aren't reported anywhere''' + + def __init__(self, feature: str): + self.feature = feature + + def __call__(self, feature_map: uint = 0, attribute_list: list[uint] = [], all_command_list: list[uint] = []) -> ConformanceDecision: + return ConformanceDecision.OPTIONAL + + def __str__(self): + return self.feature class attribute: @@ -162,7 +186,7 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.name}' + return self.name class command: @@ -176,7 +200,7 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li return ConformanceDecision.NOT_APPLICABLE def __str__(self): - return f'{self.name}' + return self.name def strip_outer_parentheses(inner: str) -> str: @@ -222,8 +246,11 @@ def __call__(self, feature_map: uint, attribute_list: list[uint], all_command_li # not operations also can't be used with things that are optional # ie, ![AB] doesn't make sense, nor does !O decision = self.op(feature_map, attribute_list, all_command_list) - if decision == ConformanceDecision.OPTIONAL or decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: + if decision == ConformanceDecision.DISALLOWED or decision == ConformanceDecision.PROVISIONAL: raise ConformanceException('NOT operation on optional or disallowed item') + # Features in device types degrade to optional so a not operation here is still optional because we don't have any way to verify the features since they're not exposed anywhere + elif decision == ConformanceDecision.OPTIONAL: + return ConformanceDecision.OPTIONAL elif decision == ConformanceDecision.NOT_APPLICABLE: return ConformanceDecision.MANDATORY elif decision == ConformanceDecision.MANDATORY: @@ -325,48 +352,23 @@ def __str__(self): return ', '.join(op_strs) -def parse_callable_from_xml(element: ElementTree.Element, params: ConformanceParseParameters) -> Callable: - if len(list(element)) == 0: - # no subchildren here, so this can only be mandatory, optional, provisional, deprecated, disallowed, feature or attribute - if element.tag == MANDATORY_CONFORM: - return mandatory() - elif element.tag == OPTIONAL_CONFORM: - return optional() - elif element.tag == PROVISIONAL_CONFORM: - return provisional() - elif element.tag == DEPRECATE_CONFORM: - return deprecated() - elif element.tag == DISALLOW_CONFORM: - return disallowed() - elif element.tag == FEATURE_TAG: - try: - return feature(params.feature_map[element.get('name')], element.get('name')) - except KeyError: - raise ConformanceException(f'Conformance specifies feature not in feature table: {element.get("name")}') - elif element.tag == ATTRIBUTE_TAG: - # Some command conformance tags are marked as attribute, so if this key isn't in attribute, try command - name = element.get('name') - if name in params.attribute_map: - return attribute(params.attribute_map[name], name) - elif name in params.command_map: - return command(params.command_map[name], name) - else: - raise ConformanceException(f'Conformance specifies attribute or command not in table: {name}') - elif element.tag == COMMAND_TAG: - return command(params.command_map[element.get('name')], element.get('name')) - elif element.tag == CONDITION_TAG and element.get('name').lower() == 'zigbee': +def parse_basic_callable_from_xml(element: ElementTree.Element) -> Callable: + if list(element): + raise ConformanceException("parse_basic_callable_from_xml called for XML element with children") + # This will throw a key error if this is not a basic element key. + try: + return BASIC_CONFORMANCE[element.tag] + except KeyError: + if element.tag == CONDITION_TAG and element.get('name').lower() == ZIGBEE_CONDITION: return zigbee() elif element.tag == LITERAL_TAG: return literal(element.get('value')) else: raise ConformanceException( - f'Unexpected xml conformance element with no children {str(element.tag)} {str(element.attrib)}') + f'parse_basic_callable_from_xml called for unknown element {str(element.tag)} {str(element.attrib)}') - # First build the list, then create the callable for this element - ops = [] - for sub in element: - ops.append(parse_callable_from_xml(sub, params)) +def parse_wrapper_callable_from_xml(element: ElementTree.Element, ops: list[Callable]) -> Callable: # optional can be a wrapper as well as a standalone # This can be any of the boolean operations, optional or otherwise if element.tag == OPTIONAL_CONFORM: @@ -393,3 +395,55 @@ def parse_callable_from_xml(element: ElementTree.Element, params: ConformancePar return greater_operation(ops[0], ops[1]) else: raise ConformanceException(f'Unexpected conformance tag with children {element}') + + +def parse_device_type_callable_from_xml(element: ElementTree.Element) -> Callable: + ''' Only allows basic, or wrappers over things that degrade to basic.''' + if not list(element): + try: + return parse_basic_callable_from_xml(element) + # For device types ONLY, there are conformances called "attributes" that are essentially just placeholders for conditions in the device library. + # For example, temperature controlled cabinet has conditions called "heating" and "cooling". The cluster conditions are dependent on them, but they're not + # actually exposed anywhere ON the device other than through the presence of the cluster. So for now, treat any attribute conditions that are cluster conditions + # as just optional, because it's optional to implement any device type feature. + # Device types also have some marked as "condition" that are similarly optional + except ConformanceException: + if element.tag == ATTRIBUTE_TAG or element.tag == CONDITION_TAG or element.tag == FEATURE_TAG: + return device_feature(element.attrib['name']) + raise + + ops = [parse_device_type_callable_from_xml(sub) for sub in element] + return parse_wrapper_callable_from_xml(element, ops) + + +def parse_callable_from_xml(element: ElementTree.Element, params: ConformanceParseParameters) -> Callable: + if not list(element): + try: + return parse_basic_callable_from_xml(element) + except ConformanceException: + # If we get an exception here, it wasn't a basic type, so move on and check if its + # something else. + pass + if element.tag == FEATURE_TAG: + try: + return feature(params.feature_map[element.get('name')], element.get('name')) + except KeyError: + raise ConformanceException(f'Conformance specifies feature not in feature table: {element.get("name")}') + elif element.tag == ATTRIBUTE_TAG: + # Some command conformance tags are marked as attribute, so if this key isn't in attribute, try command + name = element.get('name') + if name in params.attribute_map: + return attribute(params.attribute_map[name], name) + elif name in params.command_map: + return command(params.command_map[name], name) + else: + raise ConformanceException(f'Conformance specifies attribute or command not in table: {name}') + elif element.tag == COMMAND_TAG: + return command(params.command_map[element.get('name')], element.get('name')) + else: + raise ConformanceException( + f'Unexpected xml conformance element with no children {str(element.tag)} {str(element.attrib)}') + + # First build the list, then create the callable for this element + ops = [parse_callable_from_xml(sub, params) for sub in element] + return parse_wrapper_callable_from_xml(element, ops) From 3d7e23e8f610adcf93b40fe3d94f86f7d3819a1c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 6 Jun 2024 18:02:38 -0400 Subject: [PATCH 35/78] Add better APIs for handling FeatureMap in MTRServerAttribute. (#33760) * Add better APIs for handling FeatureMap in MTRServerAttribute. Do more sanity checks when using the initializer, and provide a factory method that makes creating FeatureMap attributes easier. * Apply suggestions from code review Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> --------- Co-authored-by: Nivi Sarkar <55898241+nivi-apple@users.noreply.github.com> --- .../CHIP/ServerEndpoint/MTRServerAttribute.h | 12 ++++++- .../CHIP/ServerEndpoint/MTRServerAttribute.mm | 28 ++++++++++++++- .../CHIPTests/MTRServerEndpointTests.m | 35 +++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h index efbbf35013c8c0..144a00c97da2af 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h @@ -41,7 +41,9 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) * Will fail if the attribute ID is not valid per the Matter specification or * the attribute value is not a valid data-value. * - * requiredPrivilege is the privilege required to read the attribute. + * requiredPrivilege is the privilege required to read the attribute. This + * initializer may fail if the provided attributeID is a global attribute and + * the provided requiredPrivilege value is not correct for that attribute ID. */ - (nullable instancetype)initReadonlyAttributeWithID:(NSNumber *)attributeID initialValue:(NSDictionary *)value requiredPrivilege:(MTRAccessControlEntryPrivilege)requiredPrivilege; @@ -53,6 +55,14 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) */ - (BOOL)setValue:(NSDictionary *)value; +/** + * Create an attribute description for a FeatureMap attribute with the provided + * value (expected to be an unsigned integer representing the value of the + * bitmap). This will automatically set requiredPrivilege to the right value + * for FeatureMap. + */ ++ (MTRServerAttribute *)newFeatureMapAttributeWithInitialValue:(NSNumber *)value; + @property (atomic, copy, readonly) NSNumber * attributeID; @property (atomic, copy, readonly) NSDictionary * value; /** diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm index 619ca98b2f4b47..359bbe1362b403 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.mm @@ -23,6 +23,7 @@ #import "MTRUnfairLock.h" #import "NSDataSpanConversion.h" +#import #import #include @@ -57,6 +58,20 @@ - (nullable instancetype)initAttributeWithID:(NSNumber *)attributeID initialValu return nil; } + if (attrId == MTRAttributeIDTypeGlobalAttributeFeatureMapID) { + // Some sanity checks: value should be an unsigned-integer NSNumber, and + // requiredReadPrivilege should be View. + if (requiredReadPrivilege != MTRAccessControlEntryPrivilegeView) { + MTR_LOG_ERROR("MTRServerAttribute for FeatureMap provided with invalid read privilege %d", requiredReadPrivilege); + return nil; + } + + if (![MTRUnsignedIntegerValueType isEqual:value[MTRTypeKey]]) { + MTR_LOG_ERROR("MTRServerAttribute for FeatureMap provided with value that is not an unsigned integer: %@", value); + return nil; + } + } + return [self initWithAttributeID:[attributeID copy] value:[value copy] requiredReadPrivilege:requiredReadPrivilege writable:writable]; } @@ -80,7 +95,8 @@ - (nullable instancetype)initWithAttributeID:(NSNumber *)attributeID value:(NSDi _writable = writable; _parentCluster = app::ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId); - // Now call setValue to store the value and its serialization. + // Now store the value and its serialization. This will also check that the + // value is serializable to TLV. if ([self setValueInternal:value logIfNotAssociated:NO] == NO) { return nil; } @@ -93,6 +109,16 @@ - (BOOL)setValue:(NSDictionary *)value return [self setValueInternal:value logIfNotAssociated:YES]; } ++ (MTRServerAttribute *)newFeatureMapAttributeWithInitialValue:(NSNumber *)value +{ + return [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) + initialValue:@{ + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : value, + } + requiredPrivilege:MTRAccessControlEntryPrivilegeView]; +} + - (BOOL)setValueInternal:(NSDictionary *)value logIfNotAssociated:(BOOL)logIfNotAssociated { id serializedValue; diff --git a/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m b/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m index 4a7c31a25a8b02..e2b070d43b76a8 100644 --- a/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m +++ b/src/darwin/Framework/CHIPTests/MTRServerEndpointTests.m @@ -126,6 +126,11 @@ - (void)testServerAttribute MTRValueKey : @(5), }; + __auto_type * signedIntValue = @{ + MTRTypeKey : MTRSignedIntegerValueType, + MTRValueKey : @(5), + }; + __auto_type * listOfStringsValue = @{ MTRTypeKey : MTRArrayValueType, MTRValueKey : @[ @@ -192,6 +197,36 @@ - (void)testServerAttribute __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:invalidID initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; XCTAssertNil(attr); } + + // Valid FeatureMap attribute + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; + XCTAssertNotNil(attr); + XCTAssertEqualObjects(attr.attributeID, @(MTRAttributeIDTypeGlobalAttributeFeatureMapID)); + XCTAssertEqualObjects(attr.value, unsignedIntValue); + XCTAssertEqual(attr.writable, NO); + } + + // FeatureMap attribute with wrong value type + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:signedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeView]; + XCTAssertNil(attr); + } + + // FeatureMap attribute with wrong permissions + { + __auto_type * attr = [[MTRServerAttribute alloc] initReadonlyAttributeWithID:@(MTRAttributeIDTypeGlobalAttributeFeatureMapID) initialValue:unsignedIntValue requiredPrivilege:MTRAccessControlEntryPrivilegeOperate]; + XCTAssertNil(attr); + } + + // FeatureMap attribute via factory + { + __auto_type * attr = [MTRServerAttribute newFeatureMapAttributeWithInitialValue:@(5)]; + XCTAssertNotNil(attr); + XCTAssertEqualObjects(attr.attributeID, @(MTRAttributeIDTypeGlobalAttributeFeatureMapID)); + XCTAssertEqualObjects(attr.value, unsignedIntValue); + XCTAssertEqual(attr.writable, NO); + } } - (void)testDeviceType From 4239c887d5751da766a866f63385d2ef8bc44452 Mon Sep 17 00:00:00 2001 From: Pradip De Date: Thu, 6 Jun 2024 20:05:42 -0700 Subject: [PATCH 36/78] Close TCP connection when received message size is too large. (#33768) When the framing length value of a received message is larger than what the local node can process, abort the connection with the peer. Sending a StatusResponse message back to the peer as a notification may not be feasible in all circumstances for reasons, such as: 1) It would require a cross-layered feedback up to the Exchange layer to generate such a message in response to a failure at the transport layer. 2) A Status Response is sent in response to a message on an ExchangeContext and that may not be the case in scnearios where this message is the first unsolicited message. The receiver could drain out the bits from the offending message and move on to the next message in the stream but that may not guarantee correct behavior and would consume resources unnecessarily. Given that the peer was already aware of the max length this node was willing to receive during its TCP advertisement, it seems prudent to fail fast and close the connection. Fixes #33307. --- src/transport/raw/TCP.cpp | 5 ++++- src/transport/raw/tests/TestTCP.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/transport/raw/TCP.cpp b/src/transport/raw/TCP.cpp index b928c3e91cccae..3c3e6da15c2b58 100644 --- a/src/transport/raw/TCP.cpp +++ b/src/transport/raw/TCP.cpp @@ -331,7 +331,10 @@ CHIP_ERROR TCPBase::ProcessReceivedBuffer(Inet::TCPEndPoint * endPoint, const Pe uint32_t messageSize = LittleEndian::Get32(messageSizeBuf); if (messageSize >= kMaxTCPMessageSize) { - // This message is too long for upper layers. + // Message is too big for this node to process. Disconnect from peer. + ChipLogError(Inet, "Received TCP message of length %" PRIu32 " exceeds limit.", messageSize); + CloseConnectionInternal(state, CHIP_ERROR_MESSAGE_TOO_LONG, SuppressCallback::No); + return CHIP_ERROR_MESSAGE_TOO_LONG; } // The subtraction will not underflow because we successfully read kPacketSizeBytes. diff --git a/src/transport/raw/tests/TestTCP.cpp b/src/transport/raw/tests/TestTCP.cpp index dbce3b8ce5ef43..4f78da5dcdce86 100644 --- a/src/transport/raw/tests/TestTCP.cpp +++ b/src/transport/raw/tests/TestTCP.cpp @@ -682,7 +682,9 @@ TEST_F(TestTCP, CheckProcessReceivedBuffer) EXPECT_EQ(err, CHIP_ERROR_MESSAGE_TOO_LONG); EXPECT_EQ(gMockTransportMgrDelegate.mReceiveHandlerCallCount, 0); - gMockTransportMgrDelegate.DisconnectTest(tcp, addr); + // The receipt of a message exceeding the allowed size should have + // closed the connection. + EXPECT_EQ(TestAccess::GetEndpoint(state), nullptr); } } // namespace From d65f85c5b25df69a7d8f08714b6c0719473d7409 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Fri, 7 Jun 2024 20:46:54 +0800 Subject: [PATCH 37/78] [Ameba] cleanup platform config (#33629) * Cleanup and allow redefinition of macro --- src/platform/Ameba/CHIPDevicePlatformConfig.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/platform/Ameba/CHIPDevicePlatformConfig.h b/src/platform/Ameba/CHIPDevicePlatformConfig.h index 647466b5970102..e10c8ddf9aefaf 100644 --- a/src/platform/Ameba/CHIPDevicePlatformConfig.h +++ b/src/platform/Ameba/CHIPDevicePlatformConfig.h @@ -25,8 +25,13 @@ #pragma once // ==================== Platform Adaptations ==================== -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 +#ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION +#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 +#endif + +#ifndef CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 +#endif #if CHIP_ENABLE_OPENTHREAD #define CHIP_DEVICE_CONFIG_ENABLE_THREAD 1 From 27abfb68d4056c3dea9b5c1e436eebb86fe4c884 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 7 Jun 2024 15:50:34 +0200 Subject: [PATCH 38/78] [Python] Add TriggerResubscribeIfScheduled to SubscriptionTransaction (#33774) Add TriggerResubscribeIfScheduled to SubscriptionTransaction. If the ReadClient currently has a resubscription attempt scheduled, This function allows to trigger that attempt immediately. This is useful when the server side is up and communicating, and it's a good time to try to resubscribe. --- src/controller/python/chip/clusters/Attribute.py | 7 +++++++ src/controller/python/chip/clusters/attribute.cpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index a1a341ed46614a..5bb8e7c8eebbc7 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -465,6 +465,13 @@ def OverrideLivenessTimeoutMs(self, timeoutMs: int): lambda: handle.pychip_ReadClient_OverrideLivenessTimeout(self._readTransaction._pReadClient, timeoutMs) ) + async def TriggerResubscribeIfScheduled(self, reason: str): + handle = chip.native.GetLibraryHandle() + await builtins.chipStack.CallAsync( + lambda: handle.pychip_ReadClient_TriggerResubscribeIfScheduled( + self._readTransaction._pReadClient, reason.encode("utf-8")) + ) + def GetReportingIntervalsSeconds(self) -> Tuple[int, int]: ''' Retrieve the reporting intervals associated with an active subscription. diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index b73b4a49b44d1f..7c5b2c906ab69c 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -464,6 +464,12 @@ void pychip_ReadClient_OverrideLivenessTimeout(ReadClient * pReadClient, uint32_ pReadClient->OverrideLivenessTimeout(System::Clock::Milliseconds32(livenessTimeoutMs)); } +void pychip_ReadClient_TriggerResubscribeIfScheduled(ReadClient * pReadClient, const char * reason) +{ + VerifyOrDie(pReadClient != nullptr); + pReadClient->TriggerResubscribeIfScheduled(reason); +} + PyChipError pychip_ReadClient_GetReportingIntervals(ReadClient * pReadClient, uint16_t * minIntervalSec, uint16_t * maxIntervalSec) { VerifyOrDie(pReadClient != nullptr); From a30f9f82df034a72ddfcefaf596696fc971b5028 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 7 Jun 2024 16:01:06 +0200 Subject: [PATCH 39/78] [Tizen] Improve memory management in BLE module (#33800) * Simplify memory management of BLE device scanner * Pass values via const refs if possible * Decouple BLE scanner and scanning timeout * Restyled by clang-format * Forward scan error to delegate * Forward BLE disconnection to CHIPoBLE layer --------- Co-authored-by: Restyled.io --- src/platform/Tizen/BLEManagerImpl.cpp | 127 ++++++++++++----------- src/platform/Tizen/BLEManagerImpl.h | 19 ++-- src/platform/Tizen/ChipDeviceScanner.cpp | 89 ++++++---------- src/platform/Tizen/ChipDeviceScanner.h | 41 +++----- 4 files changed, 123 insertions(+), 153 deletions(-) diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 247719a9199b76..31cfe3456bb934 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -401,16 +401,16 @@ void BLEManagerImpl::NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) +void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId) { ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error) +void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId) { ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError, - .CHIPoBLEConnectionError = { .ConId = conId, .Reason = error } }; + .CHIPoBLEConnectionError = { .ConId = conId, .Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED } }; PlatformMgr().PostEventOrDie(&event); } @@ -479,44 +479,50 @@ CHIP_ERROR BLEManagerImpl::ConnectChipThing(const char * address) return err; } -void BLEManagerImpl::OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info) +void BLEManagerImpl::OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) { - auto deviceInfo = reinterpret_cast(device); - VerifyOrReturn(deviceInfo != nullptr, ChipLogError(DeviceLayer, "Invalid Device Info")); - - ChipLogProgress(DeviceLayer, "New device scanned: %s", deviceInfo->remote_address); + ChipLogProgress(Ble, "New device scanned: %s", scanInfo.remote_address); if (mBLEScanConfig.mBleScanState == BleScanState::kScanForDiscriminator) { - if (!mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator())) - { - return; - } - ChipLogProgress(DeviceLayer, "Device discriminator match. Attempting to connect."); + auto isMatch = mBLEScanConfig.mDiscriminator.MatchesLongDiscriminator(info.GetDeviceDiscriminator()); + VerifyOrReturn( + isMatch, + ChipLogError(Ble, "Skip connection: Device discriminator does not match: %u != %u", info.GetDeviceDiscriminator(), + mBLEScanConfig.mDiscriminator.IsShortDiscriminator() ? mBLEScanConfig.mDiscriminator.GetShortValue() + : mBLEScanConfig.mDiscriminator.GetLongValue())); + ChipLogProgress(Ble, "Device discriminator match. Attempting to connect."); } else if (mBLEScanConfig.mBleScanState == BleScanState::kScanForAddress) { - if (strcmp(deviceInfo->remote_address, mBLEScanConfig.mAddress.c_str()) != 0) - { - return; - } - ChipLogProgress(DeviceLayer, "Device address match. Attempting to connect."); + auto isMatch = strcmp(scanInfo.remote_address, mBLEScanConfig.mAddress.c_str()) == 0; + VerifyOrReturn(isMatch, + ChipLogError(Ble, "Skip connection: Device address does not match: %s != %s", scanInfo.remote_address, + mBLEScanConfig.mAddress.c_str())); + ChipLogProgress(Ble, "Device address match. Attempting to connect."); } else { - ChipLogError(DeviceLayer, "Unknown discovery type. Ignoring scanned device."); + ChipLogError(Ble, "Unknown discovery type. Ignoring scanned device."); return; } /* Set CHIP Connecting state */ mBLEScanConfig.mBleScanState = BleScanState::kConnecting; + chip::DeviceLayer::PlatformMgr().LockChipStack(); + // We StartScan in the ChipStack thread. + // StopScan should also be performed in the ChipStack thread. + // At the same time, the scan timer also needs to be canceled in the ChipStack thread. + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + mDeviceScanner.StopScan(); + // Stop scanning and then start connecting timer DeviceLayer::SystemLayer().StartTimer(kConnectTimeout, HandleConnectionTimeout, this); chip::DeviceLayer::PlatformMgr().UnlockChipStack(); - mDeviceScanner->StopChipScan(); /* Initiate Connect */ - auto params = std::make_pair(this, deviceInfo->remote_address); + auto params = std::make_pair(this, scanInfo.remote_address); PlatformMgrImpl().GLibMatterContextInvokeSync( +[](typeof(params) * aParams) { return aParams->first->ConnectChipThing(aParams->second); }, ¶ms); } @@ -540,6 +546,7 @@ void BLEManagerImpl::OnScanComplete() void BLEManagerImpl::OnScanError(CHIP_ERROR err) { + BleConnectionDelegate::OnConnectionError(mBLEScanConfig.mAppState, err); ChipLogDetail(Ble, "BLE scan error: %" CHIP_ERROR_FORMAT, err.Format()); } @@ -866,6 +873,7 @@ void BLEManagerImpl::RemoveConnectionData(const char * remoteAddr) VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Connection does not exist for [%s]", StringOrNullMarker(remoteAddr))); + BLEManagerImpl::NotifyBLEDisconnection(conn); g_hash_table_remove(mConnectionMap, remoteAddr); ChipLogProgress(DeviceLayer, "Connection Removed"); @@ -918,7 +926,7 @@ void BLEManagerImpl::HandleConnectionEvent(bool connected, const char * remoteAd } else { - ChipLogProgress(DeviceLayer, "Device DisConnected [%s]", StringOrNullMarker(remoteAddress)); + ChipLogProgress(DeviceLayer, "Device Disconnected [%s]", StringOrNullMarker(remoteAddress)); RemoveConnectionData(remoteAddress); } } @@ -1008,6 +1016,11 @@ CHIP_ERROR BLEManagerImpl::_Init() void BLEManagerImpl::_Shutdown() { + // Make sure that timers are stopped before shutting down the BLE layer. + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); + DeviceLayer::SystemLayer().CancelTimer(HandleConnectionTimeout, this); + int ret = bt_deinitialize(); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_deinitialize() failed: %s", get_error_message(ret))); } @@ -1119,11 +1132,10 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv CleanScanConfig(); } break; - case DeviceEventType::kPlatformTizenBLEWriteComplete: { + case DeviceEventType::kPlatformTizenBLEWriteComplete: HandleWriteConfirmation(apEvent->Platform.BLEWriteComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID); break; - } - case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: { + case DeviceEventType::kPlatformTizenBLESubscribeOpComplete: if (apEvent->Platform.BLESubscribeOpComplete.mIsSubscribed) HandleSubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID); @@ -1131,13 +1143,11 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv HandleUnsubscribeComplete(apEvent->Platform.BLESubscribeOpComplete.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID); break; - } - case DeviceEventType::kPlatformTizenBLEIndicationReceived: { + case DeviceEventType::kPlatformTizenBLEIndicationReceived: HandleIndicationReceived(apEvent->Platform.BLEIndicationReceived.mConnection, &Ble::CHIP_BLE_SVC_ID, &chip::Ble::CHIP_BLE_CHAR_2_UUID, System::PacketBufferHandle::Adopt(apEvent->Platform.BLEIndicationReceived.mData)); break; - } default: break; } @@ -1151,7 +1161,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) ChipLogProgress(DeviceLayer, "CHIPoBLESubscribe"); HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &Ble::CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); - NotifyBLEConnectionEstablished(event->CHIPoBLESubscribe.ConId, CHIP_NO_ERROR); + NotifyBLEConnectionEstablished(event->CHIPoBLESubscribe.ConId); break; case DeviceEventType::kCHIPoBLEUnsubscribe: ChipLogProgress(DeviceLayer, "CHIPoBLEUnsubscribe"); @@ -1357,55 +1367,48 @@ void BLEManagerImpl::NewConnection(BleLayer * bleLayer, void * appState, const S void BLEManagerImpl::InitiateScan(BleScanState scanType) { - CHIP_ERROR err = CHIP_NO_ERROR; + CHIP_ERROR err = CHIP_ERROR_INCORRECT_STATE; ScanFilterData data = {}; - ChipLogProgress(DeviceLayer, "Initiate scan"); - - /* Check Scanning state */ - if (scanType == BleScanState::kNotScanning) - { - err = CHIP_ERROR_INCORRECT_STATE; - ChipLogError(DeviceLayer, "Invalid scan type requested"); - goto exit; - } - /* Check Tizen BLE layer is initialized or not */ - if (!mFlags.Has(Flags::kTizenBLELayerInitialized)) - { - err = CHIP_ERROR_INCORRECT_STATE; - ChipLogError(DeviceLayer, "Tizen BLE layer is not yet initialized"); - goto exit; - } - - /* Acquire Chip Device Scanner */ - if (!mDeviceScanner) - mDeviceScanner = Internal::ChipDeviceScanner::Create(this); + VerifyOrExit(scanType != BleScanState::kNotScanning, + ChipLogError(Ble, "Invalid scan type requested: %d", to_underlying(scanType))); + VerifyOrExit(mFlags.Has(Flags::kTizenBLELayerInitialized), ChipLogError(Ble, "Tizen BLE layer is not yet initialized")); - if (!mDeviceScanner) - { - err = CHIP_ERROR_INTERNAL; - ChipLogError(DeviceLayer, "Failed to create BLE device scanner"); - goto exit; - } + ChipLogProgress(Ble, "Start CHIP BLE scan: timeout=%ums", System::Clock::Milliseconds32(kNewConnectionScanTimeout).count()); - /* Send StartChipScan Request to Scanner Class */ + /* Send StartScan Request to Scanner Class */ strcpy(data.service_uuid, Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR); - err = mDeviceScanner->StartChipScan(kNewConnectionScanTimeout, ScanFilterType::kServiceData, data); - VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to start BLE scan")); + err = mDeviceScanner.StartScan(ScanFilterType::kServiceData, data); + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Ble, "Failed to start BLE scan: %" CHIP_ERROR_FORMAT, err.Format())); + + err = DeviceLayer::SystemLayer().StartTimer(kNewConnectionScanTimeout, HandleScanTimeout, this); + VerifyOrExit(err == CHIP_NO_ERROR, mDeviceScanner.StopScan(); + ChipLogError(Ble, "Failed to start BLE scan timeout: %" CHIP_ERROR_FORMAT, err.Format())); - ChipLogProgress(DeviceLayer, "BLE scan initiation successful"); mBLEScanConfig.mBleScanState = scanType; return; exit: - ChipLogError(DeviceLayer, "BLE scan initiation failed: %" CHIP_ERROR_FORMAT, err.Format()); mBLEScanConfig.mBleScanState = BleScanState::kNotScanning; BleConnectionDelegate::OnConnectionError(mBLEScanConfig.mAppState, err); } +void BLEManagerImpl::HandleScanTimeout(chip::System::Layer *, void * appState) +{ + auto * manager = static_cast(appState); + manager->OnScanError(CHIP_ERROR_TIMEOUT); + manager->mDeviceScanner.StopScan(); +} + CHIP_ERROR BLEManagerImpl::CancelConnection() { - return CHIP_ERROR_NOT_IMPLEMENTED; + // If in discovery mode, stop scan. + if (mBLEScanConfig.mBleScanState != BleScanState::kNotScanning) + { + DeviceLayer::SystemLayer().CancelTimer(HandleScanTimeout, this); + mDeviceScanner.StopScan(); + } + return CHIP_NO_ERROR; } } // namespace Internal diff --git a/src/platform/Tizen/BLEManagerImpl.h b/src/platform/Tizen/BLEManagerImpl.h index 5dfee7fba75c83..c63b68aec48ae4 100644 --- a/src/platform/Tizen/BLEManagerImpl.h +++ b/src/platform/Tizen/BLEManagerImpl.h @@ -90,6 +90,9 @@ class BLEManagerImpl final : public BLEManager, friend BLEManager; public: + BLEManagerImpl() : mDeviceScanner(this) {} + ~BLEManagerImpl() = default; + CHIP_ERROR ConfigureBle(uint32_t aAdapterId, bool aIsCentral); private: @@ -137,7 +140,8 @@ class BLEManagerImpl final : public BLEManager, CHIP_ERROR CancelConnection() override; // ===== Members that implement virtual methods on ChipDeviceScannerDelegate - void OnChipDeviceScanned(void * device, const Ble::ChipBLEDeviceIdentificationInfo & info) override; + void OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) override; void OnScanComplete() override; void OnScanError(CHIP_ERROR err) override; @@ -171,8 +175,6 @@ class BLEManagerImpl final : public BLEManager, void DriveBLEState(); - void InitiateScan(BleScanState scanType); - void AdapterStateChangedCb(int result, bt_adapter_state_e adapterState); void AdvertisingStateChangedCb(int result, bt_advertiser_h advertiser, bt_adapter_le_advertising_state_e advState); void NotificationStateChangedCb(bool notify, bt_gatt_server_h server, bt_gatt_h gattHandle); @@ -185,6 +187,10 @@ class BLEManagerImpl final : public BLEManager, static void WriteCompletedCb(int result, bt_gatt_h gattHandle, void * userData); static void CharacteristicNotificationCb(bt_gatt_h characteristic, char * value, int len, void * userData); + // ==== BLE Scan. + void InitiateScan(BleScanState scanType); + static void HandleScanTimeout(chip::System::Layer *, void * appState); + // ==== Connection. void AddConnectionData(const char * remoteAddr); void RemoveConnectionData(const char * remoteAddr); @@ -208,8 +214,8 @@ class BLEManagerImpl final : public BLEManager, // ==== Connection. CHIP_ERROR ConnectChipThing(const char * address); - void NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error); - void NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error); + void NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId); + void NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId); void NotifyHandleNewConnection(BLE_CONNECTION_OBJECT conId); void NotifyHandleConnectFailed(CHIP_ERROR error); void NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId); @@ -232,8 +238,9 @@ class BLEManagerImpl final : public BLEManager, /* Connection Hash Table Map */ GHashTable * mConnectionMap = nullptr; + ChipDeviceScanner mDeviceScanner; BLEScanConfig mBLEScanConfig; - std::unique_ptr mDeviceScanner; + bt_gatt_client_h mGattClient = nullptr; }; diff --git a/src/platform/Tizen/ChipDeviceScanner.cpp b/src/platform/Tizen/ChipDeviceScanner.cpp index 5f334535d904fc..98018bfd88c6ef 100644 --- a/src/platform/Tizen/ChipDeviceScanner.cpp +++ b/src/platform/Tizen/ChipDeviceScanner.cpp @@ -38,24 +38,12 @@ #include #include +#include "ErrorUtils.h" + namespace chip { namespace DeviceLayer { namespace Internal { -ChipDeviceScanner::ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate) {} - -ChipDeviceScanner::~ChipDeviceScanner() -{ - // In case scan is ongoing - StopChipScan(); - mDelegate = nullptr; -} - -std::unique_ptr ChipDeviceScanner::Create(ChipDeviceScannerDelegate * delegate) -{ - return std::make_unique(delegate); -} - static void __PrintLEScanData(const bt_adapter_le_service_data_s & data) { // Print Service UUID in the Service Data @@ -68,16 +56,15 @@ static void __PrintLEScanData(const bt_adapter_le_service_data_s & data) ChipLogByteSpan(DeviceLayer, ByteSpan(reinterpret_cast(data.service_data), data.service_data_len)); } -static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, - chip::Ble::ChipBLEDeviceIdentificationInfo & aDeviceInfo) +static bool __IsChipThingDevice(const bt_adapter_le_device_scan_result_info_s & scanInfo, + chip::Ble::ChipBLEDeviceIdentificationInfo & info) { - VerifyOrReturnError(info != nullptr, false); - int count = 0; bt_adapter_le_service_data_s * dataList = nullptr; bool isChipDevice = false; - if (bt_adapter_le_get_scan_result_service_data_list(info, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == BT_ERROR_NONE) + if (bt_adapter_le_get_scan_result_service_data_list(&scanInfo, BT_ADAPTER_LE_PACKET_ADVERTISING, &dataList, &count) == + BT_ERROR_NONE) { for (int i = 0; i < count; i++) { @@ -85,7 +72,7 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, strcasecmp(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0) { __PrintLEScanData(dataList[i]); - memcpy(&aDeviceInfo, dataList[i].service_data, dataList[i].service_data_len); + memcpy(&info, dataList[i].service_data, dataList[i].service_data_len); isChipDevice = true; break; } @@ -96,46 +83,31 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info, return isChipDevice; } -void ChipDeviceScanner::LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * info, void * userData) +void ChipDeviceScanner::LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * scanInfo) { - VerifyOrReturn(info != nullptr); + VerifyOrReturn(result == BT_ERROR_NONE, mDelegate->OnScanError(TizenToChipError(result))); + VerifyOrReturn(scanInfo != nullptr, mDelegate->OnScanError(CHIP_ERROR_INTERNAL)); - auto self = reinterpret_cast(userData); - chip::Ble::ChipBLEDeviceIdentificationInfo deviceInfo; + ChipLogProgress(DeviceLayer, "LE device reported: %s", scanInfo->remote_address); - ChipLogProgress(DeviceLayer, "LE device reported: %s", info->remote_address); - VerifyOrReturn(__IsChipThingDevice(info, deviceInfo), - ChipLogDetail(Ble, "Device %s does not look like a CHIP device", info->remote_address)); + chip::Ble::ChipBLEDeviceIdentificationInfo info; + VerifyOrReturn(__IsChipThingDevice(*scanInfo, info), + ChipLogDetail(Ble, "Device %s does not look like a CHIP device", scanInfo->remote_address)); // Report probable CHIP device to BLEMgrImp class - self->mDelegate->OnChipDeviceScanned(info, deviceInfo); -} - -gboolean ChipDeviceScanner::TimerExpiredCb(gpointer userData) -{ - auto self = reinterpret_cast(userData); - ChipLogProgress(DeviceLayer, "Scan Timer expired!!"); - self->StopChipScan(); - return G_SOURCE_REMOVE; + mDelegate->OnDeviceScanned(*scanInfo, info); } -CHIP_ERROR ChipDeviceScanner::TriggerScan(ChipDeviceScanner * self) +CHIP_ERROR ChipDeviceScanner::StartScanImpl() { - GAutoPtr idleSource; - int ret; - - // Trigger LE Scan - ret = bt_adapter_le_start_scan(LeScanResultCb, self); + int ret = bt_adapter_le_start_scan( + +[](int result, bt_adapter_le_device_scan_result_info_s * scanInfo, void * self) { + return reinterpret_cast(self)->LeScanResultCb(result, scanInfo); + }, + this); VerifyOrReturnValue(ret == BT_ERROR_NONE, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "bt_adapter_le_start_scan() failed: %s", get_error_message(ret))); - self->mIsScanning = true; - - // Setup timer for scan timeout - idleSource = GAutoPtr(g_timeout_source_new(self->mScanTimeoutMs)); - g_source_set_callback(idleSource.get(), TimerExpiredCb, self, nullptr); - g_source_set_priority(idleSource.get(), G_PRIORITY_HIGH_IDLE); - g_source_attach(idleSource.get(), g_main_context_get_thread_default()); - + mIsScanning = true; return CHIP_NO_ERROR; } @@ -167,35 +139,32 @@ int ChipDeviceScanner::SetupScanFilter(ScanFilterType filterType, const ScanFilt return ret; } -CHIP_ERROR ChipDeviceScanner::StartChipScan(System::Clock::Timeout timeout, ScanFilterType filterType, - const ScanFilterData & filterData) +CHIP_ERROR ChipDeviceScanner::StartScan(ScanFilterType filterType, const ScanFilterData & filterData) { CHIP_ERROR err = CHIP_NO_ERROR; - ReturnErrorCodeIf(mIsScanning, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(!mIsScanning, CHIP_ERROR_INCORRECT_STATE); // Scan Filter Setup if supported: silently bypass error & do filterless scan in case of error SetupScanFilter(filterType, filterData); - mScanTimeoutMs = System::Clock::Milliseconds32(timeout).count(); - // All set to trigger LE Scan - ChipLogProgress(DeviceLayer, "Start CHIP BLE scan: timeout=%ums", mScanTimeoutMs); - err = PlatformMgrImpl().GLibMatterContextInvokeSync(TriggerScan, this); + err = PlatformMgrImpl().GLibMatterContextInvokeSync( + +[](ChipDeviceScanner * self) { return self->StartScanImpl(); }, this); SuccessOrExit(err); return CHIP_NO_ERROR; exit: ChipLogError(DeviceLayer, "Start CHIP Scan could not succeed fully! Stop Scan..."); - StopChipScan(); + StopScan(); UnRegisterScanFilter(); return err; } -CHIP_ERROR ChipDeviceScanner::StopChipScan() +CHIP_ERROR ChipDeviceScanner::StopScan() { int ret = BT_ERROR_NONE; - ReturnErrorCodeIf(!mIsScanning, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mIsScanning, CHIP_ERROR_INCORRECT_STATE); ret = bt_adapter_le_stop_scan(); if (ret != BT_ERROR_NONE) diff --git a/src/platform/Tizen/ChipDeviceScanner.h b/src/platform/Tizen/ChipDeviceScanner.h index c8ecc5bfa8e81a..ac48176be3df1d 100644 --- a/src/platform/Tizen/ChipDeviceScanner.h +++ b/src/platform/Tizen/ChipDeviceScanner.h @@ -60,16 +60,17 @@ struct ScanFilterData class ChipDeviceScannerDelegate { public: - virtual ~ChipDeviceScannerDelegate(void) {} + virtual ~ChipDeviceScannerDelegate() {} // Called when a CHIP device was found - virtual void OnChipDeviceScanned(void * device, const chip::Ble::ChipBLEDeviceIdentificationInfo & info) = 0; + virtual void OnDeviceScanned(const bt_adapter_le_device_scan_result_info_s & scanInfo, + const Ble::ChipBLEDeviceIdentificationInfo & info) = 0; // Called when a scan was completed (stopped or timed out) - virtual void OnScanComplete(void) = 0; + virtual void OnScanComplete() = 0; // Called on scan error - virtual void OnScanError(CHIP_ERROR err) = 0; + virtual void OnScanError(CHIP_ERROR) = 0; }; /// Allows scanning for CHIP devices @@ -78,38 +79,28 @@ class ChipDeviceScannerDelegate class ChipDeviceScanner { public: - ChipDeviceScanner(void){}; + ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate){}; + ~ChipDeviceScanner() { StopScan(); } - /// NOTE: prefer to use the ::Create method instead direct constructor calling. - ChipDeviceScanner(ChipDeviceScannerDelegate * delegate); - - ~ChipDeviceScanner(void); - - /// Initiate a scan for devices, with the given timeout & scan filter data - CHIP_ERROR StartChipScan(System::Clock::Timeout timeout, ScanFilterType filterType, const ScanFilterData & filterData); + /// Initiate a scan for devices, with the given scan filter data + CHIP_ERROR StartScan(ScanFilterType filterType, const ScanFilterData & filterData); /// Stop any currently running scan - CHIP_ERROR StopChipScan(void); - - /// Create a new device scanner - /// Convenience method to allocate any required variables. - static std::unique_ptr Create(ChipDeviceScannerDelegate * delegate); + CHIP_ERROR StopScan(); private: - static void LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * info, void * userData); - static gboolean TimerExpiredCb(gpointer user_data); - static CHIP_ERROR TriggerScan(ChipDeviceScanner * userData); + void LeScanResultCb(int result, bt_adapter_le_device_scan_result_info_s * scanInfo); + CHIP_ERROR StartScanImpl(); int CreateLEScanFilter(ScanFilterType filterType); int RegisterScanFilter(ScanFilterType filterType, const ScanFilterData & filterData); int SetupScanFilter(ScanFilterType filterType, const ScanFilterData & filterData); void UnRegisterScanFilter(); - ChipDeviceScannerDelegate * mDelegate = nullptr; - bool mIsScanning = false; - bool mIsStopping = false; - unsigned int mScanTimeoutMs = 10000; - bt_scan_filter_h mScanFilter = nullptr; + ChipDeviceScannerDelegate * mDelegate; + bool mIsScanning = false; + bool mIsStopping = false; + bt_scan_filter_h mScanFilter = nullptr; }; } // namespace Internal From dad61543ed6e53f38182db01a9cc6d9ea2dd51ad Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 7 Jun 2024 10:10:19 -0400 Subject: [PATCH 40/78] Stop using MSEC_PER_SEC without directly including relevant headers. (#33795) And stop doing time math by hand, use duration_cast. Fixes https://github.com/project-chip/connectedhomeip/issues/33793 --- src/darwin/Framework/CHIP/MTRConversion.h | 7 +++++++ src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIP/MTRConversion.h b/src/darwin/Framework/CHIP/MTRConversion.h index b14f4c240f9f67..b0cf1afea40ad1 100644 --- a/src/darwin/Framework/CHIP/MTRConversion.h +++ b/src/darwin/Framework/CHIP/MTRConversion.h @@ -19,6 +19,7 @@ #import +#include #include #include #include @@ -40,6 +41,12 @@ inline NSDate * MatterEpochSecondsAsDate(uint32_t matterEpochSeconds) return [NSDate dateWithTimeIntervalSince1970:(chip::kChipEpochSecondsSinceUnixEpoch + (NSTimeInterval) matterEpochSeconds)]; } +template +inline NSTimeInterval DurationToTimeInterval(std::chrono::duration duration) +{ + return std::chrono::duration(duration).count(); +} + /** * Returns whether the conversion could be performed. Will return false if the * passed-in date is our of the range representable as a Matter epoch-s value. diff --git a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm index 3fa1c45028adcd..8f712ab76d3b6b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceConnectionBridge.mm @@ -17,6 +17,7 @@ #import "MTRDeviceConnectionBridge.h" #import "MTRBaseDevice_Internal.h" +#import "MTRConversion.h" #import "MTRError_Internal.h" void MTRDeviceConnectionBridge::OnConnected( @@ -31,7 +32,7 @@ { NSNumber * retryDelay; if (failureInfo.requestedBusyDelay.HasValue()) { - retryDelay = @(static_cast(failureInfo.requestedBusyDelay.Value().count()) / MSEC_PER_SEC); + retryDelay = @(DurationToTimeInterval(failureInfo.requestedBusyDelay.Value())); } auto * object = static_cast(context); object->mCompletionHandler(nil, chip::NullOptional, [MTRError errorForCHIPErrorCode:failureInfo.error], retryDelay); From 8f214329aa88e2d1f8f5f315fe03702b0953134f Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 10:14:40 -0400 Subject: [PATCH 41/78] Docs: Add autolinks to daily fail summary (#33791) --- docs/ci-cd/tools/daily_fail_summary.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/ci-cd/tools/daily_fail_summary.md b/docs/ci-cd/tools/daily_fail_summary.md index 8855a7a3de6086..290dfc313929c8 100644 --- a/docs/ci-cd/tools/daily_fail_summary.md +++ b/docs/ci-cd/tools/daily_fail_summary.md @@ -3,20 +3,20 @@ #### Source Workflow: -https://github.com/project-chip/connectedhomeip/blob/master/.github/workflows/recent_fail_summary.yaml + Script: -https://github.com/project-chip/connectedhomeip/blob/master/scripts/tools/summarize_fail.py + Fail Definitions: -https://github.com/project-chip/connectedhomeip/blob/master/scripts/tools/build_fail_definitions.yaml + #### Summary Runs once per day; takes inventory of the previous day's workflow runs and parses them for fail statistics. Creates temporarily cached artifacts for easy data parsing. Also saves a daily pass percentage list of all workflows at -https://github.com/project-chip/connectedhomeip/blob/daily_pass_percentage/docs/daily_pass_percentage.md. +. Fail definitions can be added to the file defined above to allow fast root cause determination of any fail with an error message. From 5db170117d3afd5b4c815c1c181cc8646779cc5a Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Fri, 7 Jun 2024 19:47:48 +0530 Subject: [PATCH 42/78] removing the 917 SoC condition for the 917 SoC (#33804) --- src/platform/silabs/SilabsConfig.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/platform/silabs/SilabsConfig.cpp b/src/platform/silabs/SilabsConfig.cpp index 356aa4c39b1703..d78fcf65b3444c 100644 --- a/src/platform/silabs/SilabsConfig.cpp +++ b/src/platform/silabs/SilabsConfig.cpp @@ -33,7 +33,6 @@ #include #include -#ifndef SLI_SI91X_MCU_INTERFACE // 917soc/wifi-sdk implements the same nvm3 lock/unlock mechanism and it currently can't be overide. #include #include // Substitute the GSDK weak nvm3_lockBegin and nvm3_lockEnd @@ -58,7 +57,6 @@ void nvm3_lockEnd(void) VerifyOrDie(nvm3_Sem != NULL); xSemaphoreGive(nvm3_Sem); } -#endif // !SLI_SI91X_MCU_INTERFACE namespace chip { namespace DeviceLayer { @@ -78,9 +76,7 @@ CHIP_ERROR SilabsConfig::Init() void SilabsConfig::DeInit() { -#ifndef SLI_SI91X_MCU_INTERFACE vSemaphoreDelete(nvm3_Sem); -#endif // !SLI_SI91X_MCU_INTERFACE nvm3_close(nvm3_defaultHandle); } From d6c29d2156e3dfcbf02b38bbec8aa88af3d0d877 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 14:19:10 -0400 Subject: [PATCH 43/78] Python test runner: Add non-printing CI option (#33740) * Python test runner: Add non-printing CI option The CI files for the REPL tests are HUGE and they make it nearly impossible to find the error you want. This PR adds a CI flag where the output is only sent in case of a test failure. * REPL tests: Add flag to tests * add test failure * Restyled by autopep8 * Revert "add test failure" This reverts commit 9ee6a2e5cbd469940c402b019343c99ab298f3d4. * change "ci" flag to "quiet" --------- Co-authored-by: Restyled.io --- .github/workflows/tests.yaml | 160 +++++++++++++++---------------- scripts/tests/run_python_test.py | 41 +++++--- 2 files changed, 106 insertions(+), 95 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 78c6d7347725ef..dccd846affddc1 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -477,89 +477,89 @@ jobs: - name: Run Tests run: | mkdir -p out/trace_data - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_AccessChecker.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_7.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DGGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceBasicComposition.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceConformance.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --tests test_TC_IDM_10_2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_ICDManagementCluster.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_11.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_13.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_7.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_8.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_9.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_TestEventTrigger.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestBatchInvoke.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script-args "--log-level INFO -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ACE_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_AccessChecker.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DA_1_7.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DGGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DRLK_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceBasicComposition.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_DeviceConformance.py" --script-args "--storage-path admin_storage.json --manual-code 10054912339 --bool-arg ignore_in_progress:True allow_provisional:True --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --tests test_TC_IDM_10_2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEM_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EEVSE_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_EPM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_FAN_3_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_ICDM_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-lit-icd-ipv6only-no-ble-no-wifi-tsan-clang-test/lit-icd-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_ICDManagementCluster.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --hex-arg enableKey:000102030405060708090a0b0c0d0e0f --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_IDM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_IDM_1_4.py" --script-args "--hex-arg PIXIT.DGGEN.TEST_EVENT_TRIGGER_KEY:000102030405060708090a0b0c0d0e0f --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_PWRTL_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RR_1_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_SC_3_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_10.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_11.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_12.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_13.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_5.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_6.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_7.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_8.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_2_9.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_TIMESYNC_3_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json --enable-key 000102030405060708090a0b0c0d0e0f" --script "src/python_testing/TC_TestEventTrigger.py" --script-args "--storage-path admin_storage.json --bool-arg allow_sdk_dac:true --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestBatchInvoke.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestConformanceSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestGroupTableReports.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TestGroupTableReports.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --script "src/python_testing/TestSpecParsingSupport.py" --script-args "--trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './scripts/tests/TestTimeSyncTrustedTimeSourceRunner.py' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPCREDS_3_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_1.py" --script-args "--endpoint 1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_2.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_3.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.COUNTDOWN:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_4.py" --script-args "--endpoint 1 --int-arg PIXIT.OVENOPSTATE.ErrorEventGen:1 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace-to json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_OVENOPSTATE_2_5.py" --script-args "--endpoint 1 --int-arg PIXIT.WAITTIME.REBOOT:5 --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS src/app/tests/suites/certification/ci-pics-values --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOCTRL_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-microwave-oven-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-microwave-oven-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_MWOM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_CHANGE_OK:0 PIXIT.RVCRUNM.MODE_CHANGE_FAIL:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCRUNM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_1_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto --int-arg PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCCLEANM_2_2.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_1.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/linux-x64-rvc-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-rvc-app --factoryreset --quiet --app-args "--discriminator 1234 --KVS kvs1 --trace_file json:out/trace_data/app-{SCRIPT_BASE_NAME}.json" --script "src/python_testing/TC_RVCOPSTATE_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:out/trace_data/test-{SCRIPT_BASE_NAME}.json --trace-to perfetto:out/trace_data/test-{SCRIPT_BASE_NAME}.perfetto"' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_DA_1_2.py' scripts/run_in_python_env.sh out/venv './src/python_testing/test_testing/test_TC_ICDM_2_1.py' scripts/run_in_python_env.sh out/venv 'python3 ./src/python_testing/TestIdChecks.py' @@ -624,7 +624,7 @@ jobs: " - name: Run Tests run: | - scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' + scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --quiet --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v4 if: ${{ failure() && !env.ACT }} diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 1a9b54a3ad6736..5d2afc31ae21b7 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -15,6 +15,7 @@ # limitations under the License. import datetime +import io import logging import os import os.path @@ -38,7 +39,7 @@ MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -def EnqueueLogOutput(fp, tag, q): +def EnqueueLogOutput(fp, tag, output_stream, q): for line in iter(fp.readline, b''): timestamp = time.time() if len(line) > len('[1646290606.901990]') and line[0:1] == b'[': @@ -47,24 +48,24 @@ def EnqueueLogOutput(fp, tag, q): line = line[19:] except Exception: pass - sys.stdout.buffer.write( + output_stream.write( (f"[{datetime.datetime.fromtimestamp(timestamp).isoformat(sep=' ')}]").encode() + tag + line) sys.stdout.flush() fp.close() -def RedirectQueueThread(fp, tag, queue) -> threading.Thread: +def RedirectQueueThread(fp, tag, stream_output, queue) -> threading.Thread: log_queue_thread = threading.Thread(target=EnqueueLogOutput, args=( - fp, tag, queue)) + fp, tag, stream_output, queue)) log_queue_thread.start() return log_queue_thread -def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, queue: queue.Queue): +def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, stream_output, queue: queue.Queue): thread_list.append(RedirectQueueThread(process.stdout, - (f"[{tag}][{Fore.YELLOW}STDOUT{Style.RESET_ALL}]").encode(), queue)) + (f"[{tag}][{Fore.YELLOW}STDOUT{Style.RESET_ALL}]").encode(), stream_output, queue)) thread_list.append(RedirectQueueThread(process.stderr, - (f"[{tag}][{Fore.RED}STDERR{Style.RESET_ALL}]").encode(), queue)) + (f"[{tag}][{Fore.RED}STDERR{Style.RESET_ALL}]").encode(), stream_output, queue)) @click.command() @@ -87,7 +88,8 @@ def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: st help='Script arguments, can use placeholders like {SCRIPT_BASE_NAME}.') @click.option("--script-gdb", is_flag=True, help='Run script through gdb') -def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: str, script: str, script_args: str, script_gdb: bool): +@click.option("--quiet", is_flag=True, help="Do not print output from passing tests. Use this flag in CI to keep github log sizes manageable.") +def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: str, script: str, script_args: str, script_gdb: bool, quiet: bool): app_args = app_args.replace('{SCRIPT_BASE_NAME}', os.path.splitext(os.path.basename(script))[0]) script_args = script_args.replace('{SCRIPT_BASE_NAME}', os.path.splitext(os.path.basename(script))[0]) @@ -127,6 +129,10 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st app_process = None app_pid = 0 + stream_output = sys.stdout.buffer + if quiet: + stream_output = io.BytesIO() + if app: if not os.path.exists(app): if app is None: @@ -137,7 +143,7 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) app_pid = app_process.pid DumpProgramOutputToQueue( - log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, log_queue) + log_cooking_threads, Fore.GREEN + "APP " + Style.RESET_ALL, app_process, stream_output, log_queue) script_command = [script, "--paa-trust-store-path", os.path.join(DEFAULT_CHIP_ROOT, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), '--log-format', '%(message)s', "--app-pid", str(app_pid)] + shlex.split(script_args) @@ -159,7 +165,7 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st test_script_process = subprocess.Popen( final_script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) DumpProgramOutputToQueue(log_cooking_threads, Fore.GREEN + "TEST" + Style.RESET_ALL, - test_script_process, log_queue) + test_script_process, stream_output, log_queue) test_script_exit_code = test_script_process.wait() @@ -177,11 +183,16 @@ def main(app: str, factoryreset: bool, factoryreset_app_only: bool, app_args: st for thread in log_cooking_threads: thread.join() - if test_script_exit_code != 0: - sys.exit(test_script_exit_code) - else: - # We expect both app and test script should exit with 0 - sys.exit(test_app_exit_code) + # We expect both app and test script should exit with 0 + exit_code = test_script_exit_code if test_script_exit_code != 0 else test_app_exit_code + + if quiet: + if exit_code: + sys.stdout.write(stream_output.getvalue().decode('utf-8')) + else: + logging.info("Test completed successfully") + + sys.exit(exit_code) if __name__ == '__main__': From 9b7e30059efa24e7f0bef86f29ea266b5122f03c Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 7 Jun 2024 14:59:40 -0400 Subject: [PATCH 44/78] Python testing: move PICS functions (#33759) * Python testing: move PICS functions We're going to need these for some new tooling, so moving them into their own file to avoid needing to pull in the entirety of matter_testing_support Only changes are moves and function renames. test: TC_pics_checker.py * Restyled by autopep8 * Restyled by isort * fix imports * Hey, I wrote a unit test Didn't update it though because I forgot it existed. Thanks, CI. It passes now. * Restyled by isort --------- Co-authored-by: Restyled.io --- src/python_testing/TC_pics_checker.py | 25 ++---- .../TestMatterTestingSupport.py | 4 +- src/python_testing/matter_testing_support.py | 47 +--------- src/python_testing/pics_support.py | 89 +++++++++++++++++++ 4 files changed, 97 insertions(+), 68 deletions(-) create mode 100644 src/python_testing/pics_support.py diff --git a/src/python_testing/TC_pics_checker.py b/src/python_testing/TC_pics_checker.py index 87107196916cd3..4e503edd101a01 100644 --- a/src/python_testing/TC_pics_checker.py +++ b/src/python_testing/TC_pics_checker.py @@ -22,25 +22,10 @@ from matter_testing_support import (AttributePathLocation, ClusterPathLocation, CommandPathLocation, FeaturePathLocation, MatterBaseTest, TestStep, async_test_body, default_matter_test_main) from mobly import asserts +from pics_support import accepted_cmd_pics_str, attribute_pics_str, feature_pics_str, generated_cmd_pics_str from spec_parsing_support import build_xml_clusters -def attribute_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.A{id:04x}' - - -def accepted_cmd_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.C{id:02x}.Rsp' - - -def generated_cmd_pics(pics_base: str, id: int) -> str: - return f'{pics_base}.S.C{id:02x}.Tx' - - -def feature_pics(pics_base: str, bit: int) -> str: - return f'{pics_base}.S.F{bit:02x}' - - class TC_PICS_Checker(MatterBaseTest, BasicCompositionTests): @async_test_body async def setup_class(self): @@ -64,14 +49,14 @@ def _add_pics_for_lists(self, cluster_id: int, attribute_id_of_element_list: Glo try: if attribute_id_of_element_list == GlobalAttributeIds.ATTRIBUTE_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_ATTRIBUTES[cluster_id] - pics_mapper = attribute_pics + pics_mapper = attribute_pics_str elif attribute_id_of_element_list == GlobalAttributeIds.ACCEPTED_COMMAND_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_ACCEPTED_COMMANDS[cluster_id] - pics_mapper = accepted_cmd_pics + pics_mapper = accepted_cmd_pics_str elif attribute_id_of_element_list == GlobalAttributeIds.GENERATED_COMMAND_LIST_ID: all_spec_elements_to_check = Clusters.ClusterObjects.ALL_GENERATED_COMMANDS[cluster_id] - pics_mapper = generated_cmd_pics + pics_mapper = generated_cmd_pics_str else: asserts.fail("add_pics_for_list function called for non-list attribute") except KeyError: @@ -177,7 +162,7 @@ def test_TC_IDM_10_4(self): self.record_warning("PICS check", location=location, problem=f"Unable to parse feature mask {feature_mask} from cluster {cluster}") continue - pics = feature_pics(pics_base, feature_bit) + pics = feature_pics_str(pics_base, feature_bit) if feature_mask & feature_map: required = True else: diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py index 56f105b8b904c0..eba9dc458383e5 100644 --- a/src/python_testing/TestMatterTestingSupport.py +++ b/src/python_testing/TestMatterTestingSupport.py @@ -24,9 +24,9 @@ from chip.clusters.Types import Nullable, NullValue from chip.tlv import uint from matter_testing_support import (MatterBaseTest, async_test_body, compare_time, default_matter_test_main, - get_wait_seconds_from_set_time, parse_pics, parse_pics_xml, type_matches, - utc_time_in_matter_epoch) + get_wait_seconds_from_set_time, type_matches, utc_time_in_matter_epoch) from mobly import asserts, signals +from pics_support import parse_pics, parse_pics_xml from taglist_and_topology_test_support import (TagProblem, create_device_type_list_for_root, create_device_type_lists, find_tag_list_problems, find_tree_roots, flat_list_ok, get_all_children, get_direct_children_of_root, parts_list_cycles, separate_endpoint_types) diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 4861cae7ea8c61..c342d87ef2cf46 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -18,7 +18,6 @@ import argparse import asyncio import builtins -import glob import inspect import json import logging @@ -30,7 +29,6 @@ import sys import typing import uuid -import xml.etree.ElementTree as ET from binascii import hexlify, unhexlify from dataclasses import asdict as dataclass_asdict from dataclasses import dataclass, field @@ -64,6 +62,7 @@ from mobly import asserts, base_test, signals, utils from mobly.config_parser import ENV_MOBLY_LOGPATH, TestRunConfig from mobly.test_runner import TestRunner +from pics_support import read_pics_from_file try: from matter_yamltests.hooks import TestRunnerHooks @@ -142,50 +141,6 @@ def get_default_paa_trust_store(root_path: pathlib.Path) -> pathlib.Path: return pathlib.Path.cwd() -def parse_pics(lines: typing.List[str]) -> dict[str, bool]: - pics = {} - for raw in lines: - line, _, _ = raw.partition("#") - line = line.strip() - - if not line: - continue - - key, _, val = line.partition("=") - val = val.strip() - if val not in ["1", "0"]: - raise ValueError('PICS {} must have a value of 0 or 1'.format(key)) - - pics[key.strip()] = (val == "1") - return pics - - -def parse_pics_xml(contents: str) -> dict[str, bool]: - pics = {} - mytree = ET.fromstring(contents) - for pi in mytree.iter('picsItem'): - name = pi.find('itemNumber').text - support = pi.find('support').text - pics[name] = int(json.loads(support.lower())) == 1 - return pics - - -def read_pics_from_file(path: str) -> dict[str, bool]: - """ Reads a dictionary of PICS from a file (ci format) or directory (xml format). """ - if os.path.isdir(os.path.abspath(path)): - pics_dict = {} - for filename in glob.glob(f'{path}/*.xml'): - with open(filename, 'r') as f: - contents = f.read() - pics_dict.update(parse_pics_xml(contents)) - return pics_dict - - else: - with open(path, 'r') as f: - lines = f.readlines() - return parse_pics(lines) - - def type_matches(received_value, desired_type): """ Checks if the value received matches the expected type. diff --git a/src/python_testing/pics_support.py b/src/python_testing/pics_support.py new file mode 100644 index 00000000000000..62e04f7dfa1cdb --- /dev/null +++ b/src/python_testing/pics_support.py @@ -0,0 +1,89 @@ +# +# Copyright (c) 2024 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 glob +import json +import os +import typing +import xml.etree.ElementTree as ET + + +def attribute_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.A{id:04x}' + + +def accepted_cmd_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.C{id:02x}.Rsp' + + +def generated_cmd_pics_str(pics_base: str, id: int) -> str: + return f'{pics_base}.S.C{id:02x}.Tx' + + +def feature_pics_str(pics_base: str, bit: int) -> str: + return f'{pics_base}.S.F{bit:02x}' + + +def server_pics_str(pics_base: str) -> str: + return f'{pics_base}.S' + + +def client_pics_str(pics_base: str) -> str: + return f'{pics_base}.C' + + +def parse_pics(lines: typing.List[str]) -> dict[str, bool]: + pics = {} + for raw in lines: + line, _, _ = raw.partition("#") + line = line.strip() + + if not line: + continue + + key, _, val = line.partition("=") + val = val.strip() + if val not in ["1", "0"]: + raise ValueError('PICS {} must have a value of 0 or 1'.format(key)) + + pics[key.strip()] = (val == "1") + return pics + + +def parse_pics_xml(contents: str) -> dict[str, bool]: + pics = {} + mytree = ET.fromstring(contents) + for pi in mytree.iter('picsItem'): + name = pi.find('itemNumber').text + support = pi.find('support').text + pics[name] = int(json.loads(support.lower())) == 1 + return pics + + +def read_pics_from_file(path: str) -> dict[str, bool]: + """ Reads a dictionary of PICS from a file (ci format) or directory (xml format). """ + if os.path.isdir(os.path.abspath(path)): + pics_dict = {} + for filename in glob.glob(f'{path}/*.xml'): + with open(filename, 'r') as f: + contents = f.read() + pics_dict.update(parse_pics_xml(contents)) + return pics_dict + + else: + with open(path, 'r') as f: + lines = f.readlines() + return parse_pics(lines) From c9bcd2245447c072d8b682d2e4c2167912a3f367 Mon Sep 17 00:00:00 2001 From: Philip Gregor <147669098+pgregorr-amazon@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:02:05 -0700 Subject: [PATCH 45/78] Linux tv-casting-app enable AccountLogin cluster (#33766) --- ...ationBasicReadVendorIDExampleFragment.java | 6 +++++ ...ntentLauncherLaunchURLExampleFragment.java | 6 +++++ ...ubscribeToCurrentStateExampleFragment.java | 5 +++++ .../tv-casting-common/clusters/Clusters.h | 22 +++++++++++++++++++ 4 files changed, 39 insertions(+) diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java index b64d10ce811332..e0a188455877c3 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ApplicationBasicReadVendorIDExampleFragment.java @@ -77,6 +77,12 @@ public View onCreateView( v -> { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo + // interactions with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this + // flow, we commissioned with the Target Content Application with Vendor ID 1111. Since + // this target content application does not report its Endpoint's Vendor IDs, we find + // the desired endpoint based on the Endpoint ID. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java index e1cfc4a456112b..9d31619fe1fc86 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/ContentLauncherLaunchURLExampleFragment.java @@ -77,6 +77,12 @@ public View onCreateView( v -> { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo + // interactions with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this + // flow, we commissioned with the Target Content Application with Vendor ID 1111. Since + // this target content application does not report its Endpoint's Vendor IDs, we find + // the desired endpoint based on the Endpoint ID. See + // connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java index cd5bbba14af2ed..882fc261f67e45 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/matter/casting/MediaPlaybackSubscribeToCurrentStateExampleFragment.java @@ -79,6 +79,11 @@ public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Endpoint endpoint; if (useCommissionerGeneratedPasscode) { + // For the example Commissioner-Generated passcode commissioning flow, run demo interactions + // with the Endpoint with ID DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW = 1. For this flow, we + // commissioned with the Target Content Application with Vendor ID 1111. Since this target + // content application does not report its Endpoint's Vendor IDs, we find the desired endpoint + // based on the Endpoint ID. See connectedhomeip/examples/tv-app/tv-common/include/AppTv.h. endpoint = EndpointSelectorExample.selectEndpointById( selectedCastingPlayer, DEFAULT_ENDPOINT_ID_FOR_CGP_FLOW); diff --git a/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h b/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h index 2da2f61e4825aa..acaa9d768e3246 100644 --- a/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h +++ b/examples/tv-casting-app/tv-casting-common/clusters/Clusters.h @@ -67,6 +67,28 @@ class ApplicationBasicCluster : public core::BaseCluster }; }; // namespace application_basic +namespace account_login { +class AccountLoginCluster : public core::BaseCluster +{ +public: + AccountLoginCluster(memory::Weak endpoint) : core::BaseCluster(endpoint) {} + + void SetUp() + { + ChipLogProgress(AppServer, "Setting up AccountLoginCluster on EndpointId: %d", GetEndpoint().lock()->GetId()); + + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::Login::Id, + new core::Command(GetEndpoint())); + RegisterCommand(chip::app::Clusters::AccountLogin::Commands::Logout::Id, + new core::Command(GetEndpoint())); + } +}; +}; // namespace account_login + namespace application_launcher { class ApplicationLauncherCluster : public core::BaseCluster { From c1a63916d8e2f634c172fc283f6ed475d1ce63d3 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 7 Jun 2024 16:57:13 -0400 Subject: [PATCH 46/78] Update more Darwin availability annotations. (#33810) --- src/darwin/Framework/CHIP/MTRDevice.h | 2 +- src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h | 2 +- .../Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index d9555a9633dc9d..08aae192468337 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -107,7 +107,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * * nil if no such estimate is available. Otherwise, the NSNumber stores an NSTimeInterval. */ -@property (nonatomic, readonly, nullable, copy) NSNumber * estimatedSubscriptionLatency MTR_NEWLY_AVAILABLE; +@property (nonatomic, readonly, nullable, copy) NSNumber * estimatedSubscriptionLatency MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * Set the delegate to receive asynchronous callbacks about the device. diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h index 548f1c64714f80..ffccc18b0398a4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h @@ -84,7 +84,7 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) * * If this value is 0, the maximum subscription establishments allowed at a time will be set to 1. */ -@property (nonatomic, assign) NSUInteger concurrentSubscriptionEstablishmentsAllowedOnThread MTR_NEWLY_AVAILABLE; +@property (nonatomic, assign) NSUInteger concurrentSubscriptionEstablishmentsAllowedOnThread MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * Sets the storage behavior configuration - see MTRDeviceStorageBehaviorConfiguration.h for details diff --git a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h index 30ea957cd3987d..fb835c1cc44ae0 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h +++ b/src/darwin/Framework/CHIP/MTRDeviceStorageBehaviorConfiguration.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN * Class that configures how MTRDevice objects persist its attributes to storage, so as to not * overwhelm the underlying storage system. */ -MTR_NEWLY_AVAILABLE +MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @interface MTRDeviceStorageBehaviorConfiguration : NSObject /** From 31d10bca62f8114cb98a7d0d387dc5936f65099c Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:28:26 +0800 Subject: [PATCH 47/78] Added endpoint id for Thread network commissioning instance (#33685) --- src/platform/BUILD.gn | 8 ++++++++ .../GenericThreadStackManagerImpl_OpenThread.hpp | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 97365a2ee72e0f..474e3c17ce284b 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -85,6 +85,9 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { # devices with multiple radios that have different sleep behavior for # different radios. chip_device_config_enable_dynamic_mrp_config = false + + # Define the default endpoint id for the generic Thread network commissioning instance + chip_device_config_thread_network_endpoint_id = 0 } if (chip_stack_lock_tracking == "auto") { @@ -389,6 +392,11 @@ if (chip_device_platform != "none" && chip_device_platform != "external") { defines += [ "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}" ] + if (chip_enable_openthread && chip_device_platform != "linux" && + chip_device_platform != "tizen" && chip_device_platform != "webos") { + defines += [ "CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID=${chip_device_config_thread_network_endpoint_id}" ] + } + visibility = [ ":platform_config_header", "${chip_root}/src/ble:ble_config_header", diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index cf1894cf93fc74..2056699d77c8c0 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -76,7 +76,8 @@ static_assert(OPENTHREAD_API_VERSION >= 219, "OpenThread version too old"); namespace { #ifndef _NO_NETWORK_COMMISSIONING_DRIVER_ NetworkCommissioning::GenericThreadDriver sGenericThreadDriver; -app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(0 /* Endpoint Id */, &sGenericThreadDriver); +app::Clusters::NetworkCommissioning::Instance + sThreadNetworkCommissioningInstance(CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID /* Endpoint Id */, &sGenericThreadDriver); #endif void initNetworkCommissioningThreadDriver(void) From 13b502dad6f44f282387b6467db4db4ab5604817 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Sat, 8 Jun 2024 01:31:40 -0400 Subject: [PATCH 48/78] Post-merge updates for IM/DM separation (#33730) * Some cleanup logic for event generation - naming and return values as eventid is not the same as event number * Comment fix * More naming updates * Several comment updates and renamed RequestContext to ActionContext * Restyle * Rename to InteractionModelContext * one more rename * Fix typo * Fix tests to compile * More renames of actions to context * One more comment added * Restyle * make clang-tidy happy * Operator== exists on optional ... make use of that directly * Update src/app/interaction-model/Events.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/IterationTypes.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/Paths.h Co-authored-by: Boris Zbarsky * Comment update --------- Co-authored-by: Andrei Litvin Co-authored-by: Boris Zbarsky --- .../{RequestContext.h => ActionContext.h} | 8 ++-- src/app/interaction-model/BUILD.gn | 4 +- .../{Actions.h => Context.h} | 10 ++-- src/app/interaction-model/Events.h | 46 +++++++++++-------- src/app/interaction-model/InvokeResponder.h | 2 +- src/app/interaction-model/IterationTypes.h | 9 +++- src/app/interaction-model/Model.h | 20 ++++---- src/app/interaction-model/OperationTypes.h | 6 +-- src/app/interaction-model/Paths.h | 16 +++---- .../tests/TestEventEmitting.cpp | 11 ++--- 10 files changed, 72 insertions(+), 60 deletions(-) rename src/app/interaction-model/{RequestContext.h => ActionContext.h} (87%) rename src/app/interaction-model/{Actions.h => Context.h} (74%) diff --git a/src/app/interaction-model/RequestContext.h b/src/app/interaction-model/ActionContext.h similarity index 87% rename from src/app/interaction-model/RequestContext.h rename to src/app/interaction-model/ActionContext.h index 74fa9af9da0fc8..bfc2555870c780 100644 --- a/src/app/interaction-model/RequestContext.h +++ b/src/app/interaction-model/ActionContext.h @@ -22,13 +22,13 @@ namespace chip { namespace app { namespace InteractionModel { -// Context for a currently executing request -class RequestContext +// Context for a currently executing action +class ActionContext { public: - virtual ~RequestContext() = default; + virtual ~ActionContext() = default; - /// Valid ONLY during synchronous handling of a Read/Write/Invoke + /// Valid ONLY during synchronous handling of an action. /// /// Used sparingly, however some operations will require these. An example /// usage is "Operational Credentials aborting communications on removed fabrics" diff --git a/src/app/interaction-model/BUILD.gn b/src/app/interaction-model/BUILD.gn index c91c2aedac633e..a0967289c6c65c 100644 --- a/src/app/interaction-model/BUILD.gn +++ b/src/app/interaction-model/BUILD.gn @@ -15,14 +15,14 @@ import("//build_overrides/chip.gni") source_set("interaction-model") { sources = [ - "Actions.h", + "ActionContext.h", + "Context.h", "Events.h", "InvokeResponder.h", "IterationTypes.h", "Model.h", "OperationTypes.h", "Paths.h", - "RequestContext.h", ] public_deps = [ diff --git a/src/app/interaction-model/Actions.h b/src/app/interaction-model/Context.h similarity index 74% rename from src/app/interaction-model/Actions.h rename to src/app/interaction-model/Context.h index 62021fbf7ccd32..5f7f442664ff20 100644 --- a/src/app/interaction-model/Actions.h +++ b/src/app/interaction-model/Context.h @@ -16,20 +16,24 @@ */ #pragma once +#include #include #include -#include namespace chip { namespace app { namespace InteractionModel { /// Data provided to data models in order to interface with the interaction model environment. -struct InteractionModelActions +/// +/// Provides callback-style functionality to notify the interaction model of changes +/// (e.g. using paths to notify of attribute data changes or events to generate events) +/// as well as fetching current state (via actionContext) +struct InteractionModelContext { Events * events; Paths * paths; - RequestContext * requestContext; + ActionContext * actionContext; }; } // namespace InteractionModel diff --git a/src/app/interaction-model/Events.h b/src/app/interaction-model/Events.h index 255a55e97ee465..0fc3fc56b974bd 100644 --- a/src/app/interaction-model/Events.h +++ b/src/app/interaction-model/Events.h @@ -24,6 +24,7 @@ #include #include +#include #include namespace chip { @@ -32,10 +33,10 @@ namespace InteractionModel { namespace internal { template -class SimpleEventLoggingDelegate : public EventLoggingDelegate +class SimpleEventPayloadWriter : public EventLoggingDelegate { public: - SimpleEventLoggingDelegate(const T & aEventData) : mEventData(aEventData){}; + SimpleEventPayloadWriter(const T & aEventData) : mEventData(aEventData){}; CHIP_ERROR WriteEvent(chip::TLV::TLVWriter & aWriter) final override { return DataModel::Encode(aWriter, TLV::ContextTag(EventDataIB::Tag::kData), mEventData); @@ -45,22 +46,22 @@ class SimpleEventLoggingDelegate : public EventLoggingDelegate const T & mEventData; }; -template ::value, bool> = true> -EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId aEndpoint) +template ::value, bool> = true> +std::optional GenerateEvent(G & generator, const T & aEventData, EndpointId aEndpoint) { - internal::SimpleEventLoggingDelegate eventData(aEventData); + internal::SimpleEventPayloadWriter eventPayloadWriter(aEventData); ConcreteEventPath path(aEndpoint, aEventData.GetClusterId(), aEventData.GetEventId()); EventOptions eventOptions; eventOptions.mPath = path; eventOptions.mPriority = aEventData.GetPriorityLevel(); eventOptions.mFabricIndex = aEventData.GetFabricIndex(); - // this skips logging the event if it's fabric-scoped but no fabric association exists yet. - + // this skips generating the event if it is fabric-scoped but the provided event data is not + // associated with any fabric. if (eventOptions.mFabricIndex == kUndefinedFabricIndex) { ChipLogError(EventLogging, "Event encode failure: no fabric index for fabric scoped event"); - return kInvalidEventId; + return std::nullopt; } // @@ -72,30 +73,30 @@ EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId aEndpoin // and used to match against the accessing fabric. // EventNumber eventNumber; - CHIP_ERROR err = emittor.GenerateEvent(&eventData, eventOptions, eventNumber); + CHIP_ERROR err = generator.GenerateEvent(&eventPayloadWriter, eventOptions, eventNumber); if (err != CHIP_NO_ERROR) { - ChipLogError(EventLogging, "Failed to log event: %" CHIP_ERROR_FORMAT, err.Format()); - return kInvalidEventId; + ChipLogError(EventLogging, "Failed to generate event: %" CHIP_ERROR_FORMAT, err.Format()); + return std::nullopt; } return eventNumber; } -template ::value, bool> = true> -EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId endpointId) +template ::value, bool> = true> +std::optional GenerateEvent(G & generator, const T & aEventData, EndpointId endpointId) { - internal::SimpleEventLoggingDelegate eventData(aEventData); + internal::SimpleEventPayloadWriter eventPayloadWriter(aEventData); ConcreteEventPath path(endpointId, aEventData.GetClusterId(), aEventData.GetEventId()); EventOptions eventOptions; eventOptions.mPath = path; eventOptions.mPriority = aEventData.GetPriorityLevel(); EventNumber eventNumber; - CHIP_ERROR err = emittor.GenerateEvent(&eventData, eventOptions, eventNumber); + CHIP_ERROR err = generator.GenerateEvent(&eventPayloadWriter, eventOptions, eventNumber); if (err != CHIP_NO_ERROR) { - ChipLogError(EventLogging, "Failed to log event: %" CHIP_ERROR_FORMAT, err.Format()); - return kInvalidEventId; + ChipLogError(EventLogging, "Failed to generate event: %" CHIP_ERROR_FORMAT, err.Format()); + return std::nullopt; } return eventNumber; @@ -103,6 +104,10 @@ EventNumber GenerateEvent(E & emittor, const T & aEventData, EndpointId endpoint } // namespace internal +/// Exposes event access capabilities. +/// +/// Allows callers to "generate events" which effectively notifies of an event having +/// ocurred. class Events { public: @@ -113,13 +118,14 @@ class Events /// Events are generally expected to be sent to subscribed clients and also /// be available for read later until they get overwritten by new events /// that are being generated. - virtual CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventContentWriter, const EventOptions & options, + virtual CHIP_ERROR GenerateEvent(EventLoggingDelegate * eventPayloadWriter, const EventOptions & options, EventNumber & generatedEventNumber) = 0; // Convenience methods for event logging using cluster-object structures - // On error, these log and return kInvalidEventId + // + // On error, these log and return nullopt. template - EventNumber GenerateEvent(const T & eventData, EndpointId endpointId) + std::optional GenerateEvent(const T & eventData, EndpointId endpointId) { return internal::GenerateEvent(*this, eventData, endpointId); } diff --git a/src/app/interaction-model/InvokeResponder.h b/src/app/interaction-model/InvokeResponder.h index 0a399b24564e96..54ae9ba0f51a08 100644 --- a/src/app/interaction-model/InvokeResponder.h +++ b/src/app/interaction-model/InvokeResponder.h @@ -26,7 +26,7 @@ namespace InteractionModel { /// Handles encoding of an invoke response for a specific invoke request. /// -/// This class handles a single response (i.e. a CommandDataIB within the +/// This class handles a single request (i.e. a CommandDataIB within the /// matter protocol) and is responsible for constructing its corresponding /// response (i.e. a InvokeResponseIB within the matter protocol) /// diff --git a/src/app/interaction-model/IterationTypes.h b/src/app/interaction-model/IterationTypes.h index 32ad8bc42b73be..441dd3acb7b81f 100644 --- a/src/app/interaction-model/IterationTypes.h +++ b/src/app/interaction-model/IterationTypes.h @@ -70,8 +70,13 @@ struct AttributeEntry /// Iteration rules: /// - kInvalidEndpointId will be returned when iteration ends (or generally kInvalid* for paths) /// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) -/// - Iteration order is NOT guaranteed, however uniqueness and completeness is (must iterate -/// over all possible distinct values as long as no internal structural changes occur) +/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: +/// - when iterating over an endpoint, ALL clusters of that endpoint will be iterated first, before +/// switching the endpoint (order of clusters themselves not guaranteed) +/// - when iterating over a cluster, ALL attributes of that cluster will be iterated first, before +/// switching to a new cluster +/// - uniqueness and completeness (iterate over all possible distinct values as long as no +/// internal structural changes occur) class AttributeTreeIterator { public: diff --git a/src/app/interaction-model/Model.h b/src/app/interaction-model/Model.h index b3a127c074aaa1..151065f4c540d2 100644 --- a/src/app/interaction-model/Model.h +++ b/src/app/interaction-model/Model.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -43,17 +43,17 @@ class Model : public AttributeTreeIterator public: virtual ~Model() = default; - // `actions` pointers will be guaranteed valid until Shutdown is called() - virtual CHIP_ERROR Startup(InteractionModelActions actions) + // `context` pointers will be guaranteed valid until Shutdown is called() + virtual CHIP_ERROR Startup(InteractionModelContext context) { - mActions = actions; + mContext = context; return CHIP_NO_ERROR; } virtual CHIP_ERROR Shutdown() = 0; // During the transition phase, we expect a large subset of code to require access to // event emitting, path marking and other operations - virtual InteractionModelActions CurrentActions() { return mActions; } + virtual InteractionModelContext CurrentContext() const { return mContext; } /// List reading has specific handling logic: /// `state` contains in/out data about the current list reading. MUST start with kInvalidListIndex on first call @@ -94,14 +94,14 @@ class Model : public AttributeTreeIterator /// - `NeedsTimedInteraction` for writes that are not timed however are required to be so virtual CHIP_ERROR WriteAttribute(const WriteAttributeRequest & request, AttributeValueDecoder & decoder) = 0; - /// `responder` is used to send back the reply. + /// `reply` is used to send back the reply. /// - calling Reply() or ReplyAsync() will let the application control the reply /// - returning a CHIP_NO_ERROR without reply/reply_async implies a Status::Success reply without data - /// - returning a CHIP_*_ERROR implies an error reply (error and data are mutually exclusive) + /// - returning a value other than CHIP_NO_ERROR implies an error reply (error and data are mutually exclusive) /// /// See InvokeReply/AutoCompleteInvokeResponder for details on how to send back replies and expected - /// error handling. If you require knowledge if a response was successfully sent, use the underlying - /// `reply` object instead of returning an error codes from Invoke. + /// error handling. If you need to know weather a response was successfully sent, use the underlying + /// `reply` object instead of returning an error code from Invoke. /// /// Return codes /// CHIP_IM_GLOBAL_STATUS(code): @@ -115,7 +115,7 @@ class Model : public AttributeTreeIterator virtual CHIP_ERROR Invoke(const InvokeRequest & request, chip::TLV::TLVReader & input_arguments, InvokeReply & reply) = 0; private: - InteractionModelActions mActions = { nullptr }; + InteractionModelContext mContext = { nullptr }; }; } // namespace InteractionModel diff --git a/src/app/interaction-model/OperationTypes.h b/src/app/interaction-model/OperationTypes.h index 115dc11a1ff3bc..57499a8dbafb49 100644 --- a/src/app/interaction-model/OperationTypes.h +++ b/src/app/interaction-model/OperationTypes.h @@ -66,8 +66,8 @@ struct ReadState enum class WriteFlags : uint32_t { - kTimed = 0x0001, // Received as a 2nd command after a timed invoke - kListBegin = 0x0002, // This is the FIRST list data element in a series of data + kTimed = 0x0001, // Write is a timed write (i.e. a Timed Request Action preceeded it) + kListBegin = 0x0002, // This is the FIRST list of data elements kListEnd = 0x0004, // This is the LAST list element to write }; @@ -79,7 +79,7 @@ struct WriteAttributeRequest : OperationRequest enum class InvokeFlags : uint32_t { - kTimed = 0x0001, // Received as a 2nd command after a timed invoke + kTimed = 0x0001, // Command received as part of a timed invoke interaction. }; struct InvokeRequest : OperationRequest diff --git a/src/app/interaction-model/Paths.h b/src/app/interaction-model/Paths.h index 2bf9f0c4158011..9241222a990cb5 100644 --- a/src/app/interaction-model/Paths.h +++ b/src/app/interaction-model/Paths.h @@ -22,23 +22,21 @@ namespace chip { namespace app { namespace InteractionModel { -/// Handles path attributes for interaction models. +/// Notification listener for attribute changes. /// -/// It allows a user of the class to mark specific paths -/// as having changed. The intended use is for some listener to -/// perform operations as a result of something having changed, -/// usually by forwarding updates (e.g. in case of subscriptions -/// that cover that path). +/// Used to notify that a specific attribute path (or several attributes +/// via wildcards) have changed their underlying content. /// -/// Methods on this class MUCH be called from within the matter +/// Methods on this class MUST be called from within the matter /// main loop as they will likely trigger interaction model -/// internal updates and subscription event updates. +/// internal updates and subscription data reporting. class Paths { public: virtual ~Paths() = 0; - /// Mark some specific attributes dirty. + /// Mark all attributes matching the given path (which may be a wildcard) dirty. + /// /// Wildcards are supported. virtual void MarkDirty(const AttributePathParams & path) = 0; }; diff --git a/src/app/interaction-model/tests/TestEventEmitting.cpp b/src/app/interaction-model/tests/TestEventEmitting.cpp index cb49dc25caa068..3196636f621653 100644 --- a/src/app/interaction-model/tests/TestEventEmitting.cpp +++ b/src/app/interaction-model/tests/TestEventEmitting.cpp @@ -100,7 +100,8 @@ TEST(TestInteractionModelEventEmitting, TestBasicType) StartUpEventType event{ kFakeSoftwareVersion }; - EventNumber n1 = events->GenerateEvent(event, 0 /* EndpointId */); + std::optional n1 = events->GenerateEvent(event, 0 /* EndpointId */); + ASSERT_EQ(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(0 /* endpointId */, StartUpEventType::GetClusterId(), StartUpEventType::GetEventId())); @@ -115,9 +116,8 @@ TEST(TestInteractionModelEventEmitting, TestBasicType) ASSERT_EQ(err, CHIP_NO_ERROR); ASSERT_EQ(decoded_event.softwareVersion, kFakeSoftwareVersion); - EventNumber n2 = events->GenerateEvent(event, /* endpointId = */ 1); + std::optional n2 = events->GenerateEvent(event, /* endpointId = */ 1); ASSERT_EQ(n2, logOnlyEvents.CurrentEventNumber()); - ASSERT_NE(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(1 /* endpointId */, StartUpEventType::GetClusterId(), StartUpEventType::GetEventId())); @@ -137,14 +137,13 @@ TEST(TestInteractionModelEventEmitting, TestFabricScoped) event.adminNodeID = chip::app::DataModel::MakeNullable(kTestNodeId); event.adminPasscodeID = chip::app::DataModel::MakeNullable(kTestPasscode); - EventNumber n1 = events->GenerateEvent(event, 0 /* EndpointId */); + std::optional n1 = events->GenerateEvent(event, 0 /* EndpointId */); // encoding without a fabric ID MUST fail for fabric events - ASSERT_EQ(n1, kInvalidEventId); + ASSERT_FALSE(n1.has_value()); event.fabricIndex = kTestFabricIndex; n1 = events->GenerateEvent(event, /* endpointId = */ 0); - ASSERT_NE(n1, kInvalidEventId); ASSERT_EQ(n1, logOnlyEvents.CurrentEventNumber()); ASSERT_EQ(logOnlyEvents.LastOptions().mPath, ConcreteEventPath(0 /* endpointId */, AccessControlEntryChangedType::GetClusterId(), From 5ee4ef6ffd33e4184b08177e1a82de4ba5381501 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Sat, 8 Jun 2024 04:56:47 -0700 Subject: [PATCH 49/78] [Darwin] MTRDevice subscription pool test timeout should be increased (#33812) --- src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 7b821d8648d949..8b7f50dedb828b 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -35,7 +35,7 @@ static const uint16_t kTimeoutInSeconds = 3; static NSString * kOnboardingPayload = @"MT:-24J0AFN00KA0648G00"; static const uint16_t kTestVendorId = 0xFFF1u; -static const uint16_t kSubscriptionPoolBaseTimeoutInSeconds = 10; +static const uint16_t kSubscriptionPoolBaseTimeoutInSeconds = 30; @interface MTRPerControllerStorageTestsControllerDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; From c15826050e744034ec9c90cf810fb2b34bb46c54 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Sun, 9 Jun 2024 21:22:05 -0700 Subject: [PATCH 50/78] [Fabric-Bridge] Don't track device changes for synced devices (#33769) * Don't track device change status for synced devices * Address review comments --- examples/fabric-bridge-app/linux/Device.cpp | 31 +++++-------------- .../fabric-bridge-app/linux/DeviceManager.cpp | 7 ++++- .../fabric-bridge-app/linux/include/Device.h | 20 +++--------- .../linux/include/DeviceManager.h | 19 +++++++++++- examples/fabric-bridge-app/linux/main.cpp | 8 ++--- 5 files changed, 41 insertions(+), 44 deletions(-) diff --git a/examples/fabric-bridge-app/linux/Device.cpp b/examples/fabric-bridge-app/linux/Device.cpp index 4cf72a281113b6..215db48f683ef5 100644 --- a/examples/fabric-bridge-app/linux/Device.cpp +++ b/examples/fabric-bridge-app/linux/Device.cpp @@ -25,10 +25,9 @@ using namespace chip::app::Clusters::Actions; -Device::Device(const char * szDeviceName, std::string szLocation) +Device::Device(chip::NodeId nodeId, const char * name) { - chip::Platform::CopyString(mName, szDeviceName); - mLocation = szLocation; + chip::Platform::CopyString(mName, name); mReachable = false; mEndpointId = 0; } @@ -38,13 +37,11 @@ bool Device::IsReachable() return mReachable; } -void Device::SetReachable(bool aReachable) +void Device::SetReachable(bool reachable) { - bool changed = (mReachable != aReachable); + mReachable = reachable; - mReachable = aReachable; - - if (aReachable) + if (reachable) { ChipLogProgress(NotSpecified, "Device[%s]: ONLINE", mName); } @@ -52,23 +49,11 @@ void Device::SetReachable(bool aReachable) { ChipLogProgress(NotSpecified, "Device[%s]: OFFLINE", mName); } - - if (changed) - { - HandleDeviceChange(this, kChanged_Reachable); - } } -void Device::SetName(const char * szName) +void Device::SetName(const char * name) { - bool changed = (strncmp(mName, szName, sizeof(mName)) != 0); + ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, name); - ChipLogProgress(NotSpecified, "Device[%s]: New Name=\"%s\"", mName, szName); - - chip::Platform::CopyString(mName, szName); - - if (changed) - { - HandleDeviceChange(this, kChanged_Name); - } + chip::Platform::CopyString(mName, name); } diff --git a/examples/fabric-bridge-app/linux/DeviceManager.cpp b/examples/fabric-bridge-app/linux/DeviceManager.cpp index a5ffe68445949b..3b158b876bf033 100644 --- a/examples/fabric-bridge-app/linux/DeviceManager.cpp +++ b/examples/fabric-bridge-app/linux/DeviceManager.cpp @@ -44,10 +44,15 @@ using namespace chip::DeviceLayer; using namespace chip::app::Clusters; namespace { + constexpr uint8_t kMaxRetries = 10; + } // namespace -DeviceManager::DeviceManager() +// Define the static member +DeviceManager DeviceManager::sInstance; + +void DeviceManager::Init() { memset(mDevices, 0, sizeof(mDevices)); mFirstDynamicEndpointId = static_cast( diff --git a/examples/fabric-bridge-app/linux/include/Device.h b/examples/fabric-bridge-app/linux/include/Device.h index ee7a917d8c4bb3..64940f33c23190 100644 --- a/examples/fabric-bridge-app/linux/include/Device.h +++ b/examples/fabric-bridge-app/linux/include/Device.h @@ -32,21 +32,13 @@ class Device public: static const int kDeviceNameSize = 32; - enum Changed_t - { - kChanged_Reachable = 1u << 0, - kChanged_Location = 1u << 1, - kChanged_Name = 1u << 2, - kChanged_Last = kChanged_Name, - } Changed; - - Device(const char * szDeviceName, std::string szLocation); + Device(chip::NodeId nodeId, const char * name); virtual ~Device() {} bool IsReachable(); - void SetReachable(bool aReachable); - void SetName(const char * szDeviceName); - void SetLocation(std::string szLocation); + void SetReachable(bool reachable); + void SetName(const char * name); + void SetLocation(std::string location) { mLocation = location; }; inline void SetEndpointId(chip::EndpointId id) { mEndpointId = id; }; inline chip::EndpointId GetEndpointId() { return mEndpointId; }; inline void SetParentEndpointId(chip::EndpointId id) { mParentEndpointId = id; }; @@ -56,13 +48,11 @@ class Device inline std::string GetZone() { return mZone; }; inline void SetZone(std::string zone) { mZone = zone; }; -private: - virtual void HandleDeviceChange(Device * device, Device::Changed_t changeMask) = 0; - protected: bool mReachable; char mName[kDeviceNameSize]; std::string mLocation; + chip::NodeId mNodeId; chip::EndpointId mEndpointId; chip::EndpointId mParentEndpointId; std::string mZone; diff --git a/examples/fabric-bridge-app/linux/include/DeviceManager.h b/examples/fabric-bridge-app/linux/include/DeviceManager.h index 8e87c9059bcb78..2667fc071d4ca8 100644 --- a/examples/fabric-bridge-app/linux/include/DeviceManager.h +++ b/examples/fabric-bridge-app/linux/include/DeviceManager.h @@ -25,7 +25,9 @@ class DeviceManager { public: - DeviceManager(); + DeviceManager() = default; + + void Init(); /** * @brief Adds a device to a dynamic endpoint. @@ -62,7 +64,22 @@ class DeviceManager Device * GetDevice(uint16_t index) const; private: + friend DeviceManager & DeviceMgr(); + + static DeviceManager sInstance; + chip::EndpointId mCurrentEndpointId; chip::EndpointId mFirstDynamicEndpointId; Device * mDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT + 1]; }; + +/** + * Returns the public interface of the DeviceManager singleton object. + * + * Applications should use this to access features of the DeviceManager + * object. + */ +inline DeviceManager & DeviceMgr() +{ + return DeviceManager::sInstance; +} diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 47670561430c90..3ad6a5a1b20fe1 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -97,8 +97,6 @@ void AttemptRpcClientConnect(System::Layer * systemLayer, void * appState) } #endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE -DeviceManager gDeviceManager; - } // namespace void ApplicationInit() @@ -111,6 +109,8 @@ void ApplicationInit() // Start a thread for bridge polling std::thread pollingThread(BridgePollingThread); pollingThread.detach(); + + DeviceMgr().Init(); } void ApplicationShutdown() {} @@ -135,7 +135,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(Endpoin uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); AttributeId attributeId = attributeMetadata->attributeId; - Device * dev = gDeviceManager.GetDevice(endpointIndex); + Device * dev = DeviceMgr().GetDevice(endpointIndex); if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id) { using namespace app::Clusters::BridgedDeviceBasicInformation::Attributes; @@ -179,7 +179,7 @@ Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback(Endpoi uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure; - Device * dev = gDeviceManager.GetDevice(endpointIndex); + Device * dev = DeviceMgr().GetDevice(endpointIndex); if (dev != nullptr && dev->IsReachable()) { ChipLogProgress(NotSpecified, "emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d", endpoint, clusterId); From 1f4ff38d42b8b5342f22e97d19c139268d3b9346 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 07:37:21 -0400 Subject: [PATCH 51/78] Log errors if AdvertiseOperational fails (#33773) * Log errors if AdvertiseOperational fails * Update log text --- examples/platform/linux/CommissionerMain.cpp | 2 +- .../operational-credentials-server.cpp | 6 +++++- src/app/server/CommissioningWindowManager.cpp | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/examples/platform/linux/CommissionerMain.cpp b/examples/platform/linux/CommissionerMain.cpp index 3ffac89a6e08e9..e8da5d70b25e8a 100644 --- a/examples/platform/linux/CommissionerMain.cpp +++ b/examples/platform/linux/CommissionerMain.cpp @@ -216,7 +216,7 @@ CHIP_ERROR InitCommissioner(uint16_t commissionerPort, uint16_t udcListenPort, F gCommissionerDiscoveryController.SetCommissionerCallback(&gCommissionerCallback); // advertise operational since we are an admin - app::DnssdServer::Instance().AdvertiseOperational(); + ReturnLogErrorOnFailure(app::DnssdServer::Instance().AdvertiseOperational()); ChipLogProgress(Support, "InitCommissioner nodeId=0x" ChipLogFormatX64 " fabric.fabricId=0x" ChipLogFormatX64 " fabricIndex=0x%x", diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 12fe1c43de0baf..366694a8c504d3 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -703,7 +703,11 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co needRevert = false; // We might have a new operational identity, so we should start advertising it right away. - app::DnssdServer::Instance().AdvertiseOperational(); + err = app::DnssdServer::Instance().AdvertiseOperational(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format()); + } // Notify the attributes containing fabric metadata can be read with new data MatterReportingAttributeChangeCallback(commandPath.mEndpointId, OperationalCredentials::Id, diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index f11261ad9c444d..229fd67c5bb24b 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -84,8 +84,15 @@ void CommissioningWindowManager::OnPlatformEvent(const DeviceLayer::ChipDeviceEv } else if (event->Type == DeviceLayer::DeviceEventType::kOperationalNetworkEnabled) { - app::DnssdServer::Instance().AdvertiseOperational(); - ChipLogProgress(AppServer, "Operational advertising enabled"); + CHIP_ERROR err = app::DnssdServer::Instance().AdvertiseOperational(); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "Operational advertising failed: %" CHIP_ERROR_FORMAT, err.Format()); + } + else + { + ChipLogProgress(AppServer, "Operational advertising enabled"); + } } #if CONFIG_NETWORK_LAYER_BLE else if (event->Type == DeviceLayer::DeviceEventType::kCloseAllBleConnections) From 853a3866d7ef40cb62fba36e8c54014f126c6e18 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Mon, 10 Jun 2024 13:41:36 +0200 Subject: [PATCH 52/78] pigweed unit_test migration: App 3rd batch (#33757) * pigweed unit_test migration: App 3rd batch * Integrating Comments * moving buffer in TestDataModelSerialization to Teardown --- src/app/tests/BUILD.gn | 36 +- src/app/tests/TestAttributePathParams.cpp | 156 ++ .../tests/TestBasicCommandPathRegistry.cpp | 58 +- src/app/tests/TestClusterInfo.cpp | 255 --- src/app/tests/TestCommandPathParams.cpp | 50 +- src/app/tests/TestConcreteAttributePath.cpp | 111 +- src/app/tests/TestDataModelSerialization.cpp | 613 +++---- .../tests/TestDefaultOTARequestorStorage.cpp | 133 +- src/app/tests/TestEventPathParams.cpp | 115 +- src/app/tests/TestExtensionFieldSets.cpp | 281 ++- src/app/tests/TestSceneTable.cpp | 1584 ++++++++--------- 11 files changed, 1478 insertions(+), 1914 deletions(-) create mode 100644 src/app/tests/TestAttributePathParams.cpp delete mode 100644 src/app/tests/TestClusterInfo.cpp diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index e8413b92026d9a..41f083e1735924 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -143,11 +143,18 @@ chip_test_suite("tests") { test_sources = [ "TestAttributeAccessInterfaceCache.cpp", "TestAttributePathExpandIterator.cpp", + "TestAttributePathParams.cpp", "TestAttributePersistenceProvider.cpp", "TestAttributeValueDecoder.cpp", "TestAttributeValueEncoder.cpp", + "TestBasicCommandPathRegistry.cpp", "TestBindingTable.cpp", "TestBuilderParser.cpp", + "TestCommandPathParams.cpp", + "TestConcreteAttributePath.cpp", + "TestDataModelSerialization.cpp", + "TestDefaultOTARequestorStorage.cpp", + "TestEventPathParams.cpp", "TestMessageDef.cpp", "TestNullable.cpp", "TestNumericAttributeTraits.cpp", @@ -193,6 +200,17 @@ chip_test_suite("tests") { "${chip_root}/src/lib/support:test_utils", "${chip_root}/src/lib/support:testing", ] + + if (chip_device_platform != "android") { + test_sources += [ + "TestExtensionFieldSets.cpp", + "TestSceneTable.cpp", + ] + public_deps += [ + ":power-cluster-test-srcs", + ":scenes-table-test-srcs", + ] + } } chip_test_suite_using_nltest("tests_nltest") { @@ -201,16 +219,9 @@ chip_test_suite_using_nltest("tests_nltest") { test_sources = [ "TestAclAttribute.cpp", "TestAclEvent.cpp", - "TestBasicCommandPathRegistry.cpp", - "TestClusterInfo.cpp", "TestCommandInteraction.cpp", - "TestCommandPathParams.cpp", - "TestConcreteAttributePath.cpp", - "TestDataModelSerialization.cpp", - "TestDefaultOTARequestorStorage.cpp", "TestEventLoggingNoUTCTime.cpp", "TestEventOverflow.cpp", - "TestEventPathParams.cpp", "TestFabricScopedEventLogging.cpp", "TestInteractionModelEngine.cpp", "TestReadInteraction.cpp", @@ -258,17 +269,6 @@ chip_test_suite_using_nltest("tests_nltest") { "${nlunit_test_root}:nlunit-test", ] - if (chip_device_platform != "android") { - test_sources += [ - "TestExtensionFieldSets.cpp", - "TestSceneTable.cpp", - ] - public_deps += [ - ":power-cluster-test-srcs", - ":scenes-table-test-srcs", - ] - } - if (chip_config_network_layer_ble && (chip_device_platform == "linux" || chip_device_platform == "darwin")) { test_sources += [ "TestCommissionManager.cpp" ] diff --git a/src/app/tests/TestAttributePathParams.cpp b/src/app/tests/TestAttributePathParams.cpp new file mode 100644 index 00000000000000..19745e20f027a0 --- /dev/null +++ b/src/app/tests/TestAttributePathParams.cpp @@ -0,0 +1,156 @@ +/* + * + * Copyright (c) 2021 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. + */ + +#include +#include + +#include +#include + +namespace chip { +namespace app { +namespace TestPath { + +TEST(TestAttributePathParams, TestAttributePathIntersect) +{ + EndpointId endpointIdArray[2] = { 1, kInvalidEndpointId }; + ClusterId clusterIdArray[2] = { 2, kInvalidClusterId }; + AttributeId attributeIdArray[2] = { 3, kInvalidAttributeId }; + + for (auto endpointId1 : endpointIdArray) + { + for (auto clusterId1 : clusterIdArray) + { + for (auto attributeId1 : attributeIdArray) + { + for (auto endpointId2 : endpointIdArray) + { + for (auto clusterId2 : clusterIdArray) + { + for (auto attributeId2 : attributeIdArray) + { + AttributePathParams path1; + path1.mEndpointId = endpointId1; + path1.mClusterId = clusterId1; + path1.mAttributeId = attributeId1; + AttributePathParams path2; + path2.mEndpointId = endpointId2; + path2.mClusterId = clusterId2; + path2.mAttributeId = attributeId2; + EXPECT_TRUE(path1.Intersects(path2)); + } + } + } + } + } + } + + { + AttributePathParams path1; + path1.mEndpointId = 1; + AttributePathParams path2; + path2.mEndpointId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } + + { + AttributePathParams path1; + path1.mClusterId = 1; + AttributePathParams path2; + path2.mClusterId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } + + { + AttributePathParams path1; + path1.mAttributeId = 1; + AttributePathParams path2; + path2.mAttributeId = 2; + EXPECT_FALSE(path1.Intersects(path2)); + } +} + +TEST(TestAttributePathParams, TestAttributePathIncludedSameFieldId) +{ + AttributePathParams path1; + AttributePathParams path2; + AttributePathParams path3; + path1.mAttributeId = 1; + path2.mAttributeId = 1; + path3.mAttributeId = 1; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + path2.mListIndex = 1; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + path1.mListIndex = 0; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path3)); + path3.mListIndex = 0; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path3)); + path3.mListIndex = 1; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path3)); +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentFieldId) +{ + { + AttributePathParams path1; + AttributePathParams path2; + path1.mAttributeId = 1; + path2.mAttributeId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + path2.mAttributeId = 2; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + EXPECT_TRUE(path1.IsAttributePathSupersetOf(path2)); + } + { + AttributePathParams path1; + AttributePathParams path2; + + path1.mAttributeId = 1; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); + } +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentEndpointId) +{ + AttributePathParams path1; + AttributePathParams path2; + path1.mEndpointId = 1; + path2.mEndpointId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); +} + +TEST(TestAttributePathParams, TestAttributePathIncludedDifferentClusterId) +{ + AttributePathParams path1; + AttributePathParams path2; + path1.mClusterId = 1; + path2.mClusterId = 2; + EXPECT_FALSE(path1.IsAttributePathSupersetOf(path2)); +} + +} // namespace TestPath +} // namespace app +} // namespace chip diff --git a/src/app/tests/TestBasicCommandPathRegistry.cpp b/src/app/tests/TestBasicCommandPathRegistry.cpp index 28d7621ccbe7d1..cc003cfc1581c3 100644 --- a/src/app/tests/TestBasicCommandPathRegistry.cpp +++ b/src/app/tests/TestBasicCommandPathRegistry.cpp @@ -17,9 +17,9 @@ */ #include -#include -#include +#include +#include namespace chip { namespace app { @@ -30,7 +30,7 @@ size_t constexpr kQuickTestSize = 10; } // namespace -void TestAddingSameConcretePath(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingSameConcretePath) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -47,11 +47,11 @@ void TestAddingSameConcretePath(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_DUPLICATE_KEY_ID); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == 1); + EXPECT_EQ(err, CHIP_ERROR_DUPLICATE_KEY_ID); + EXPECT_EQ(basicCommandPathRegistry.Count(), 1u); } -void TestAddingSameCommandRef(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingSameCommandRef) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -69,32 +69,30 @@ void TestAddingSameCommandRef(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_DUPLICATE_KEY_ID); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == 1); + EXPECT_EQ(err, CHIP_ERROR_DUPLICATE_KEY_ID); + EXPECT_EQ(basicCommandPathRegistry.Count(), 1u); } -void TestAddingMaxNumberOfEntries(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingMaxNumberOfEntries) { - CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; std::optional commandRef; uint16_t commandRefAndEndpointValue = 0; size_t idx = 0; - for (idx = 0; idx < kQuickTestSize && err == CHIP_NO_ERROR; idx++) + for (idx = 0; idx < kQuickTestSize; idx++) { ConcreteCommandPath concretePath(commandRefAndEndpointValue, 0, 0); commandRef.emplace(commandRefAndEndpointValue); commandRefAndEndpointValue++; - err = basicCommandPathRegistry.Add(concretePath, commandRef); + ASSERT_EQ(basicCommandPathRegistry.Add(concretePath, commandRef), CHIP_NO_ERROR); } - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == kQuickTestSize); + EXPECT_EQ(basicCommandPathRegistry.Count(), kQuickTestSize); } -void TestAddingTooManyEntries(nlTestSuite * apSuite, void * apContext) +TEST(TestBasicCommandPathRegistry, TestAddingTooManyEntries) { CHIP_ERROR err = CHIP_NO_ERROR; BasicCommandPathRegistry basicCommandPathRegistry; @@ -112,36 +110,10 @@ void TestAddingTooManyEntries(nlTestSuite * apSuite, void * apContext) err = basicCommandPathRegistry.Add(concretePath, commandRef); } - NL_TEST_ASSERT(apSuite, err == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(apSuite, basicCommandPathRegistry.Count() == kQuickTestSize); + EXPECT_EQ(err, CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(basicCommandPathRegistry.Count(), kQuickTestSize); } } // namespace TestBasicCommandPathRegistry } // namespace app } // namespace chip - -namespace { -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestAddingSameConcretePath", chip::app::TestBasicCommandPathRegistry::TestAddingSameConcretePath), - NL_TEST_DEF("TestAddingSameCommandRef", chip::app::TestBasicCommandPathRegistry::TestAddingSameCommandRef), - NL_TEST_DEF("TestAddingMaxNumberOfEntries", chip::app::TestBasicCommandPathRegistry::TestAddingMaxNumberOfEntries), - NL_TEST_DEF("TestAddingTooManyEntries", chip::app::TestBasicCommandPathRegistry::TestAddingTooManyEntries), - - NL_TEST_SENTINEL() -}; -// clang-format on - -} // namespace - -int TestBasicCommandPathRegistry() -{ - nlTestSuite theSuite = { "CommandPathRegistry", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBasicCommandPathRegistry) diff --git a/src/app/tests/TestClusterInfo.cpp b/src/app/tests/TestClusterInfo.cpp deleted file mode 100644 index bfbefc7af693e8..00000000000000 --- a/src/app/tests/TestClusterInfo.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * - * Copyright (c) 2021 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. - */ - -/** - * @file - * This file implements unit tests for CommandPathParams - * - */ - -#include -#include -#include -#include -#include -#include - -using namespace chip::Test; - -namespace chip { -namespace app { -namespace TestPath { -void TestAttributePathIntersect(nlTestSuite * apSuite, void * apContext) -{ - EndpointId endpointIdArray[2] = { 1, kInvalidEndpointId }; - ClusterId clusterIdArray[2] = { 2, kInvalidClusterId }; - AttributeId attributeIdArray[2] = { 3, kInvalidAttributeId }; - - for (auto endpointId1 : endpointIdArray) - { - for (auto clusterId1 : clusterIdArray) - { - for (auto attributeId1 : attributeIdArray) - { - for (auto endpointId2 : endpointIdArray) - { - for (auto clusterId2 : clusterIdArray) - { - for (auto attributeId2 : attributeIdArray) - { - AttributePathParams path1; - path1.mEndpointId = endpointId1; - path1.mClusterId = clusterId1; - path1.mAttributeId = attributeId1; - AttributePathParams path2; - path2.mEndpointId = endpointId2; - path2.mClusterId = clusterId2; - path2.mAttributeId = attributeId2; - NL_TEST_ASSERT(apSuite, path1.Intersects(path2)); - } - } - } - } - } - } - - { - AttributePathParams path1; - path1.mEndpointId = 1; - AttributePathParams path2; - path2.mEndpointId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } - - { - AttributePathParams path1; - path1.mClusterId = 1; - AttributePathParams path2; - path2.mClusterId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } - - { - AttributePathParams path1; - path1.mAttributeId = 1; - AttributePathParams path2; - path2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, !path1.Intersects(path2)); - } -} - -void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - AttributePathParams clusterInfo3; - clusterInfo1.mAttributeId = 1; - clusterInfo2.mAttributeId = 1; - clusterInfo3.mAttributeId = 1; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - clusterInfo2.mListIndex = 1; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - clusterInfo1.mListIndex = 0; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); - clusterInfo3.mListIndex = 0; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); - clusterInfo3.mListIndex = 1; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo3)); -} - -void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apContext) -{ - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mAttributeId = 1; - clusterInfo2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo2.mAttributeId = 2; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } - { - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - - clusterInfo1.mAttributeId = 1; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); - } -} - -void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mEndpointId = 1; - clusterInfo2.mEndpointId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); -} - -void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * apContext) -{ - AttributePathParams clusterInfo1; - AttributePathParams clusterInfo2; - clusterInfo1.mClusterId = 1; - clusterInfo2.mClusterId = 2; - NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); -} - -/* -{kInvalidEndpointId, kInvalidClusterId, kInvalidEventId}, -{kInvalidEndpointId, MockClusterId(1), kInvalidEventId}, -{kInvalidEndpointId, MockClusterId(1), MockEventId(1)}, -{kMockEndpoint1, kInvalidClusterId, kInvalidEventId}, -{kMockEndpoint1, MockClusterId(1), kInvalidEventId}, -{kMockEndpoint1, MockClusterId(1), MockEventId(1)}, -*/ -chip::app::EventPathParams validEventpaths[6]; -void InitEventPaths() -{ - validEventpaths[1].mClusterId = MockClusterId(1); - validEventpaths[2].mClusterId = MockClusterId(1); - validEventpaths[2].mEventId = MockEventId(1); - validEventpaths[3].mEndpointId = kMockEndpoint1; - validEventpaths[4].mEndpointId = kMockEndpoint1; - validEventpaths[4].mClusterId = MockClusterId(1); - validEventpaths[5].mEndpointId = kMockEndpoint1; - validEventpaths[5].mClusterId = MockClusterId(1); - validEventpaths[5].mEventId = MockEventId(1); -} - -void TestEventPathSameEventId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(1)); - for (auto & path : validEventpaths) - { - NL_TEST_ASSERT(apSuite, path.IsValidEventPath()); - NL_TEST_ASSERT(apSuite, path.IsEventPathSupersetOf(testPath)); - } -} - -void TestEventPathDifferentEventId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(2)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -void TestEventPathDifferentClusterId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(2), MockEventId(1)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -void TestEventPathDifferentEndpointId(nlTestSuite * apSuite, void * apContext) -{ - ConcreteEventPath testPath(kMockEndpoint2, MockClusterId(1), MockEventId(1)); - NL_TEST_ASSERT(apSuite, validEventpaths[0].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[1].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, validEventpaths[2].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[3].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[4].IsEventPathSupersetOf(testPath)); - NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); -} - -} // namespace TestPath -} // namespace app -} // namespace chip - -namespace { -const nlTest sTests[] = { - NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestPath::TestAttributePathIncludedSameFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestPath::TestAttributePathIncludedDifferentFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", chip::app::TestPath::TestAttributePathIncludedDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", chip::app::TestPath::TestAttributePathIncludedDifferentClusterId), - NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestPath::TestEventPathSameEventId), - NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestPath::TestEventPathDifferentEventId), - NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestPath::TestEventPathDifferentClusterId), - NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestPath::TestEventPathDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIntersect", chip::app::TestPath::TestAttributePathIntersect), - NL_TEST_SENTINEL() -}; -} - -int TestPath() -{ - nlTestSuite theSuite = { "TestPath", &sTests[0], nullptr, nullptr }; - chip::app::TestPath::InitEventPaths(); - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestPath) diff --git a/src/app/tests/TestCommandPathParams.cpp b/src/app/tests/TestCommandPathParams.cpp index 62b0b295b5b362..83a34cbc922537 100644 --- a/src/app/tests/TestCommandPathParams.cpp +++ b/src/app/tests/TestCommandPathParams.cpp @@ -23,74 +23,54 @@ */ #include -#include -#include + +#include +#include namespace chip { namespace app { namespace TestCommandPathParams { -void TestSamePath(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestSamePath) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_TRUE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentEndpointId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentEndpointId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(6, 2, 3, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentGroupId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentGroupId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kGroupIdValid); CommandPathParams commandPathParams2(1, 6, 3, 4, CommandPathFlags::kGroupIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentClusterId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentClusterId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 6, 4, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentCommandId(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentCommandId) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 6, CommandPathFlags::kEndpointIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } -void TestDifferentPathFlag(nlTestSuite * apSuite, void * apContext) +TEST(TestCommandPathParams, TestDifferentPathFlag) { CommandPathParams commandPathParams1(1, 2, 3, 4, CommandPathFlags::kEndpointIdValid); CommandPathParams commandPathParams2(1, 2, 3, 4, CommandPathFlags::kGroupIdValid); - NL_TEST_ASSERT(apSuite, !commandPathParams1.IsSamePath(commandPathParams2)); + EXPECT_FALSE(commandPathParams1.IsSamePath(commandPathParams2)); } } // namespace TestCommandPathParams } // namespace app } // namespace chip - -namespace { -const nlTest sTests[] = { NL_TEST_DEF("TestSamePath", chip::app::TestCommandPathParams::TestSamePath), - NL_TEST_DEF("TestDifferentEndpointId", chip::app::TestCommandPathParams::TestDifferentEndpointId), - NL_TEST_DEF("TestDifferentGroupId", chip::app::TestCommandPathParams::TestDifferentGroupId), - NL_TEST_DEF("TestDifferentClusterId", chip::app::TestCommandPathParams::TestDifferentClusterId), - NL_TEST_DEF("TestDifferentCommandId", chip::app::TestCommandPathParams::TestDifferentCommandId), - NL_TEST_DEF("TestDifferentPathFlag", chip::app::TestCommandPathParams::TestDifferentPathFlag), - NL_TEST_SENTINEL() }; -} - -int TestCommandPathParams() -{ - nlTestSuite theSuite = { "CommandPathParams", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestCommandPathParams) diff --git a/src/app/tests/TestConcreteAttributePath.cpp b/src/app/tests/TestConcreteAttributePath.cpp index a598c2f23c121f..d9f50ab799f487 100644 --- a/src/app/tests/TestConcreteAttributePath.cpp +++ b/src/app/tests/TestConcreteAttributePath.cpp @@ -17,36 +17,37 @@ */ #include -#include -#include + +#include +#include using namespace chip; using namespace chip::app; namespace { -void TestConcreteAttributePathEqualityDefaultConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathEqualityDefaultConstructor) { ConcreteAttributePath path_one; ConcreteAttributePath path_two; - NL_TEST_ASSERT(aSuite, path_one == path_two); + EXPECT_EQ(path_one, path_two); } -void TestConcreteAttributePathEquality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathEquality) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); - NL_TEST_ASSERT(aSuite, path_one == path_two); + EXPECT_EQ(path_one, path_two); } -void TestConcreteAttributePathInequalityDifferentAttributeId(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteAttributePathInequalityDifferentAttributeId) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, path_one != path_two); + EXPECT_NE(path_one, path_two); } -void TestConcreteDataAttributePathMatchesConcreteAttributePathEquality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathMatchesConcreteAttributePathEquality) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath data_path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); @@ -56,138 +57,96 @@ void TestConcreteDataAttributePathMatchesConcreteAttributePathEquality(nlTestSui /*aListOp=*/ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5U); - NL_TEST_ASSERT(aSuite, data_path.MatchesConcreteAttributePath(path)); - NL_TEST_ASSERT(aSuite, data_path_with_version.MatchesConcreteAttributePath(path)); - NL_TEST_ASSERT(aSuite, data_path_with_list.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path_with_version.MatchesConcreteAttributePath(path)); + EXPECT_TRUE(data_path_with_list.MatchesConcreteAttributePath(path)); } -void TestConcreteDataAttributePathMatchesConcreteAttributePathInequality(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathMatchesConcreteAttributePathInequality) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath data_path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, !data_path.MatchesConcreteAttributePath(path)); + EXPECT_FALSE(data_path.MatchesConcreteAttributePath(path)); } -void TestConcreteDataAttributePathEqualityDefaultConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityDefaultConstructor) { ConcreteDataAttributePath one; ConcreteDataAttributePath two; - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor) { ConcreteAttributePath path(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath one(path); ConcreteDataAttributePath two(path); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId(nlTestSuite * aSuite, - void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId) { ConcreteAttributePath path_one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteAttributePath path_two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); ConcreteDataAttributePath one(path_one); ConcreteDataAttributePath two(path_two); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId(nlTestSuite * aSuite, - void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/4); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityDataVersionConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityDataVersionConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(4U)); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, /*aDataVersion=*/MakeOptional(5U)); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathEqualityListConstructor(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathEqualityListConstructor) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); - NL_TEST_ASSERT(aSuite, one == two); + EXPECT_EQ(one, two); } -void TestConcreteDataAttributePathInequalityListConstructorDifferentListOp(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityListConstructorDifferentListOp) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceItem, /*aListIndex=*/5); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -void TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex(nlTestSuite * aSuite, void * aContext) +TEST(TestConcreteAttributePath, TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex) { ConcreteDataAttributePath one(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/5); ConcreteDataAttributePath two(/*aEndpointId=*/1, /*aClusterId=*/2, /*aAttributeId=*/3, ConcreteDataAttributePath::ListOperation::ReplaceAll, /*aListIndex=*/6); - NL_TEST_ASSERT(aSuite, one != two); + EXPECT_NE(one, two); } -const nlTest sTests[] = { - NL_TEST_DEF("TestConcreteAttributePathEqualityDefaultConstructor", TestConcreteAttributePathEqualityDefaultConstructor), - NL_TEST_DEF("TestConcreteAttributePathEquality", TestConcreteAttributePathEquality), - NL_TEST_DEF("TestConcreteAttributePathInequalityDifferentAttributeId", TestConcreteAttributePathInequalityDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathMatchesConcreteAttributePathEquality", - TestConcreteDataAttributePathMatchesConcreteAttributePathEquality), - NL_TEST_DEF("TestConcreteDataAttributePathMatchesConcreteAttributePathInequality", - TestConcreteDataAttributePathMatchesConcreteAttributePathInequality), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityDefaultConstructor", TestConcreteDataAttributePathEqualityDefaultConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor", - TestConcreteDataAttributePathEqualityConcreteAttributePathConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId", - TestConcreteDataAttributePathInequalityConcreteAttributePathConstructorDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor", - TestConcreteDataAttributePathEqualityConcreteAttributePathArgsConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId", - TestConcreteDataAttributePathInequalityConcreteAttributePathArgsConstructorDifferentAttributeId), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityDataVersionConstructor", - TestConcreteDataAttributePathEqualityDataVersionConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion", - TestConcreteDataAttributePathInequalityDataVersionConstructorDifferentDataVersion), - NL_TEST_DEF("TestConcreteDataAttributePathEqualityListConstructor", TestConcreteDataAttributePathEqualityListConstructor), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityListConstructorDifferentListOp", - TestConcreteDataAttributePathInequalityListConstructorDifferentListOp), - NL_TEST_DEF("TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex", - TestConcreteDataAttributePathInequalityListConstructorDifferentListIndex), - NL_TEST_SENTINEL() -}; - } // anonymous namespace - -int TestConcreteAttributePath() -{ - nlTestSuite theSuite = { "ConcreteAttributePath", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestConcreteAttributePath) diff --git a/src/app/tests/TestDataModelSerialization.cpp b/src/app/tests/TestDataModelSerialization.cpp index cdfa6560d70150..4c4a54e2e5ab74 100644 --- a/src/app/tests/TestDataModelSerialization.cpp +++ b/src/app/tests/TestDataModelSerialization.cpp @@ -16,57 +16,37 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for CHIP Interaction Model Command Interaction - * - */ - #include #include #include #include #include -#include -#include #include #include +#include +#include + namespace { using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; -class TestDataModelSerialization +class TestDataModelSerialization : public ::testing::Test { public: - static void TestDataModelSerialization_EncAndDecSimpleStruct(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecNestedStruct(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecNestedStructList(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecDecodableNestedStructList(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList(nlTestSuite * apSuite, void * apContext); - - static void TestDataModelSerialization_OptionalFields(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_ExtraField(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_InvalidSimpleFieldTypes(nlTestSuite * apSuite, void * apContext); - static void TestDataModelSerialization_InvalidListType(nlTestSuite * apSuite, void * apContext); - - static void NullablesOptionalsStruct(nlTestSuite * apSuite, void * apContext); - static void NullablesOptionalsCommand(nlTestSuite * apSuite, void * apContext); + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } + void TearDown() override { System::PacketBufferHandle buf = mStore.Release(); } - void Shutdown(); - -protected: // Helper functions template - static void NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext, bool encodeNulls, bool encodeValues); + void NullablesOptionalsEncodeDecodeCheck(bool encodeNulls, bool encodeValues); template - static void NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext); + void NullablesOptionalsEncodeDecodeCheck(); -private: void SetupBuf(); void DumpBuf(); void SetupReader(); @@ -74,13 +54,10 @@ class TestDataModelSerialization System::TLVPacketBufferBackingStore mStore; TLV::TLVWriter mWriter; TLV::TLVReader mReader; - nlTestSuite * mpSuite; }; using namespace TLV; -TestDataModelSerialization gTestDataModelSerialization; - void TestDataModelSerialization::SetupBuf() { System::PacketBufferHandle buf; @@ -92,11 +69,6 @@ void TestDataModelSerialization::SetupBuf() mReader.Init(mStore); } -void TestDataModelSerialization::Shutdown() -{ - System::PacketBufferHandle buf = mStore.Release(); -} - void TestDataModelSerialization::DumpBuf() { TLV::TLVReader reader; @@ -112,12 +84,9 @@ void TestDataModelSerialization::DumpBuf() void TestDataModelSerialization::SetupReader() { - CHIP_ERROR err; mReader.Init(mStore); - err = mReader.Next(); - - NL_TEST_ASSERT(mpSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mReader.Next(), CHIP_NO_ERROR); } template @@ -161,13 +130,9 @@ bool StringMatches(Span str1, const char * str2) return (strncmp(str1.data(), str2, str1.size()) == 0); } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecSimpleStruct) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -186,13 +151,11 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc t.f.Set(Clusters::UnitTesting::SimpleBitmap::kValueC); - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -201,35 +164,31 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc { Clusters::UnitTesting::Structs::SimpleStruct::Type t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); - NL_TEST_ASSERT(apSuite, t.f.HasOnly(Clusters::UnitTesting::SimpleBitmap::kValueC)); + EXPECT_TRUE(StringMatches(t.e, "chip")); + EXPECT_TRUE(t.f.HasOnly(Clusters::UnitTesting::SimpleBitmap::kValueC)); } } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecSimpleStructNegativeEnum) + { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -248,13 +207,11 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc t.f.Set(Clusters::UnitTesting::SimpleBitmap::kValueC); - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -263,21 +220,17 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruc { Clusters::UnitTesting::Structs::SimpleStruct::Type t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, to_underlying(t.c) == 4); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); + EXPECT_EQ(to_underlying(t.c), 4); } } -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecNestedStruct) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -296,13 +249,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruc t.c.e = Span{ strbuf, strlen(strbuf) }; - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + DumpBuf(); } // @@ -311,36 +261,30 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruc { Clusters::UnitTesting::Structs::NestedStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c.a == 11); - NL_TEST_ASSERT(apSuite, t.c.b == true); - NL_TEST_ASSERT(apSuite, t.c.c == Clusters::UnitTesting::SimpleEnum::kValueB); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c.a, 11); + EXPECT_TRUE(t.c.b); + EXPECT_EQ(t.c.c, Clusters::UnitTesting::SimpleEnum::kValueB); - NL_TEST_ASSERT(apSuite, t.c.d.size() == 4); + EXPECT_EQ(t.c.d.size(), 4u); for (uint32_t i = 0; i < t.c.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.c.d.data()[i] == i); + EXPECT_EQ(t.c.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.c.e, "chip")); + EXPECT_TRUE(StringMatches(t.c.e, "chip")); } } - -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNestedStructList(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecDecodableNestedStructList) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -381,13 +325,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe t.c.e = Span{ strbuf, strlen(strbuf) }; t.d = structList; - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + DumpBuf(); } // @@ -397,18 +338,17 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe Clusters::UnitTesting::Structs::NestedStructList::DecodableType t; int i; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c.a == 11); - NL_TEST_ASSERT(apSuite, t.c.b == true); - NL_TEST_ASSERT(apSuite, t.c.c == Clusters::UnitTesting::SimpleEnum::kValueB); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c.a, 11); + EXPECT_TRUE(t.c.b); + EXPECT_EQ(t.c.c, Clusters::UnitTesting::SimpleEnum::kValueB); - NL_TEST_ASSERT(apSuite, StringMatches(t.c.e, "chip")); + EXPECT_TRUE(StringMatches(t.c.e, "chip")); { i = 0; @@ -416,13 +356,13 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item.a == static_cast(i)); - NL_TEST_ASSERT(apSuite, item.b == true); + EXPECT_EQ(item.a, static_cast(i)); + EXPECT_TRUE(item.b); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -431,12 +371,12 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item == static_cast(i + 10000)); + EXPECT_EQ(item, static_cast(i + 10000)); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -450,15 +390,15 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe unsigned int j = 0; for (; j < item.size(); j++) { - NL_TEST_ASSERT(apSuite, item.data()[j] == j); + EXPECT_EQ(item.data()[j], j); } - NL_TEST_ASSERT(apSuite, j == 4); + EXPECT_EQ(j, 4u); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } { @@ -468,24 +408,19 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNe while (iter.Next()) { auto & item = iter.GetValue(); - NL_TEST_ASSERT(apSuite, item == i); + EXPECT_EQ(item, i); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4); } } } - -void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList(nlTestSuite * apSuite, - void * apContext) +TEST_F(TestDataModelSerialization, EncAndDecDecodableDoubleNestedStructList) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -510,13 +445,10 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo item.d = structList; } - err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), t), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -525,10 +457,9 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo { Clusters::UnitTesting::Structs::DoubleNestedStructList::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); uint8_t i = 0; @@ -543,26 +474,23 @@ void TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDo { auto & nestedItem = nestedIter.GetValue(); - NL_TEST_ASSERT(apSuite, nestedItem.a == (static_cast(35) + j)); + EXPECT_EQ(nestedItem.a, (static_cast(35) + j)); j++; } - NL_TEST_ASSERT(apSuite, j == 4); + EXPECT_EQ(j, 4u); i++; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, i == 4); + EXPECT_EQ(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_EQ(i, 4u); } } -void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, OptionalFields) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -581,18 +509,18 @@ void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTes // Encode every field manually except a. { - err = EncodeStruct(_this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -601,38 +529,33 @@ void TestDataModelSerialization::TestDataModelSerialization_OptionalFields(nlTes { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); // Set the value of a to a specific value, and ensure it is not over-written after decode. t.a = 150; - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); // Ensure that the decoder did not over-write the value set in the generated object - NL_TEST_ASSERT(apSuite, t.a == 150); + EXPECT_EQ(t.a, 150); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); + EXPECT_TRUE(StringMatches(t.e, "chip")); } } -void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, ExtraField) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -651,22 +574,21 @@ void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSui // Encode every field + an extra field. { - err = EncodeStruct( - _this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e), - MakeTagValuePair(TLV::ContextTag(to_underlying(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE) + 1), - t.a)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(EncodeStruct( + mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e), + MakeTagValuePair( + TLV::ContextTag(to_underlying(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE) + 1), t.a)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -675,35 +597,29 @@ void TestDataModelSerialization::TestDataModelSerialization_ExtraField(nlTestSui { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); // Ensure successful decode despite the extra field. - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, t.a == 20); - NL_TEST_ASSERT(apSuite, t.b == true); - NL_TEST_ASSERT(apSuite, t.c == Clusters::UnitTesting::SimpleEnum::kValueA); + EXPECT_EQ(t.a, 20); + EXPECT_TRUE(t.b); + EXPECT_EQ(t.c, Clusters::UnitTesting::SimpleEnum::kValueA); - NL_TEST_ASSERT(apSuite, t.d.size() == 4); + EXPECT_EQ(t.d.size(), 4u); for (uint32_t i = 0; i < t.d.size(); i++) { - NL_TEST_ASSERT(apSuite, t.d.data()[i] == i); + EXPECT_EQ(t.d.data()[i], i); } - NL_TEST_ASSERT(apSuite, StringMatches(t.e, "chip")); + EXPECT_TRUE(StringMatches(t.e, "chip")); } } -void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTypes(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, InvalidSimpleFieldTypes) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); - + SetupBuf(); // // Case #1: Swap out field a (an integer) with a boolean. // @@ -725,37 +641,32 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy // Encode every field manually except a. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.d), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); + DumpBuf(); } - // // Decode // { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err != CHIP_NO_ERROR); + EXPECT_NE(DataModel::Decode(mReader, t), CHIP_NO_ERROR); } } - _this->SetupBuf(); - + SetupBuf(); // // Case #2: Swap out an octet string with a UTF-8 string. // @@ -777,20 +688,19 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy // Encode every field manually except a. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kA), t.a), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kB), t.b), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kC), t.c), MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kD), t.e), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::SimpleStruct::Fields::kE), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); - _this->DumpBuf(); + DumpBuf(); } // @@ -799,21 +709,16 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTy { Clusters::UnitTesting::Structs::SimpleStruct::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err != CHIP_NO_ERROR); + EXPECT_NE(DataModel::Decode(mReader, t), CHIP_NO_ERROR); } } } -void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, InvalidListType) { - CHIP_ERROR err; - auto * _this = static_cast(apContext); - - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); // // Encode @@ -826,16 +731,14 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe // Encode a list of integers for field d instead of a list of structs. { - err = - EncodeStruct(_this->mWriter, TLV::AnonymousTag(), - MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::NestedStructList::Fields::kD), t.e)); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ( + EncodeStruct(mWriter, TLV::AnonymousTag(), + MakeTagValuePair(TLV::ContextTag(Clusters::UnitTesting::Structs::NestedStructList::Fields::kD), t.e)), + CHIP_NO_ERROR); } - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - - _this->DumpBuf(); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); + DumpBuf(); } // @@ -844,10 +747,9 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe { Clusters::UnitTesting::Structs::NestedStructList::DecodableType t; - _this->SetupReader(); + SetupReader(); - err = DataModel::Decode(_this->mReader, t); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, t), CHIP_NO_ERROR); auto iter = t.d.begin(); bool hadItems = false; @@ -857,8 +759,8 @@ void TestDataModelSerialization::TestDataModelSerialization_InvalidListType(nlTe hadItems = true; } - NL_TEST_ASSERT(apSuite, iter.GetStatus() != CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, !hadItems); + EXPECT_NE(iter.GetStatus(), CHIP_NO_ERROR); + EXPECT_FALSE(hadItems); } } @@ -905,13 +807,10 @@ bool ListsEqual(const DataModel::DecodableList & list1, const DataModel::List } // anonymous namespace template -void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext, bool encodeNulls, - bool encodeValues) +void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(bool encodeNulls, bool encodeValues) { - auto * _this = static_cast(apContext); - _this->mpSuite = apSuite; - _this->SetupBuf(); + SetupBuf(); static const char structStr[] = "something"; const uint8_t structBytes[] = { 1, 8, 17 }; @@ -974,161 +873,117 @@ void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite encodable.nullableList.SetNull(); } - CHIP_ERROR err = DataModel::Encode(_this->mWriter, TLV::AnonymousTag(), encodable); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - err = _this->mWriter.Finalize(); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Encode(mWriter, TLV::AnonymousTag(), encodable), CHIP_NO_ERROR); + EXPECT_EQ(mWriter.Finalize(), CHIP_NO_ERROR); } // Decode { - _this->SetupReader(); + SetupReader(); Decodable decodable; - CHIP_ERROR err = DataModel::Decode(_this->mReader, decodable); - NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(DataModel::Decode(mReader, decodable), CHIP_NO_ERROR); if (encodeNulls) { - NL_TEST_ASSERT(apSuite, decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.Value().IsNull()); - - NL_TEST_ASSERT(apSuite, decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.Value().IsNull()); + EXPECT_TRUE(decodable.nullableInt.IsNull()); + EXPECT_FALSE(decodable.optionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalInt.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableString.IsNull()); + EXPECT_FALSE(decodable.optionalString.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalString.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalString.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableStruct.IsNull()); + EXPECT_FALSE(decodable.optionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalStruct.Value().IsNull()); + + EXPECT_TRUE(decodable.nullableList.IsNull()); + EXPECT_FALSE(decodable.optionalList.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalList.HasValue()); + EXPECT_TRUE(decodable.nullableOptionalList.Value().IsNull()); } else if (encodeValues) { static const char str[] = "abc"; CharSpan strSpan = CharSpan::fromCharString(str); - NL_TEST_ASSERT(apSuite, !decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableInt.Value() == 5); - NL_TEST_ASSERT(apSuite, decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.optionalInt.Value() == 6); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalInt.Value().IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalInt.Value().Value() == 7); - - NL_TEST_ASSERT(apSuite, !decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableString.Value().data_equal(strSpan)); - NL_TEST_ASSERT(apSuite, decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.optionalString.Value().data_equal(strSpan)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalString.Value().IsNull()); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalString.Value().Value().data_equal(strSpan)); - - NL_TEST_ASSERT(apSuite, !decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.nullableStruct.Value(), myStruct)); - NL_TEST_ASSERT(apSuite, decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.optionalStruct.Value(), myStruct)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalStruct.Value().IsNull()); - NL_TEST_ASSERT(apSuite, SimpleStructsEqual(decodable.nullableOptionalStruct.Value().Value(), myStruct)); - - NL_TEST_ASSERT(apSuite, !decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.nullableList.Value(), enumList)); - NL_TEST_ASSERT(apSuite, decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.optionalList.Value(), enumList)); - NL_TEST_ASSERT(apSuite, decodable.nullableOptionalList.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalList.Value().IsNull()); - NL_TEST_ASSERT(apSuite, ListsEqual(decodable.nullableOptionalList.Value().Value(), enumList)); + EXPECT_FALSE(decodable.nullableInt.IsNull()); + EXPECT_EQ(decodable.nullableInt.Value(), 5); + EXPECT_TRUE(decodable.optionalInt.HasValue()); + EXPECT_EQ(decodable.optionalInt.Value(), 6); + EXPECT_TRUE(decodable.nullableOptionalInt.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalInt.Value().IsNull()); + EXPECT_EQ(decodable.nullableOptionalInt.Value().Value(), 7); + + EXPECT_FALSE(decodable.nullableString.IsNull()); + EXPECT_TRUE(decodable.nullableString.Value().data_equal(strSpan)); + EXPECT_TRUE(decodable.optionalString.HasValue()); + EXPECT_TRUE(decodable.optionalString.Value().data_equal(strSpan)); + EXPECT_TRUE(decodable.nullableOptionalString.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalString.Value().IsNull()); + EXPECT_TRUE(decodable.nullableOptionalString.Value().Value().data_equal(strSpan)); + + EXPECT_FALSE(decodable.nullableStruct.IsNull()); + EXPECT_TRUE(SimpleStructsEqual(decodable.nullableStruct.Value(), myStruct)); + EXPECT_TRUE(decodable.optionalStruct.HasValue()); + EXPECT_TRUE(SimpleStructsEqual(decodable.optionalStruct.Value(), myStruct)); + EXPECT_TRUE(decodable.nullableOptionalStruct.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalStruct.Value().IsNull()); + EXPECT_TRUE(SimpleStructsEqual(decodable.nullableOptionalStruct.Value().Value(), myStruct)); + + EXPECT_FALSE(decodable.nullableList.IsNull()); + EXPECT_TRUE(ListsEqual(decodable.nullableList.Value(), enumList)); + EXPECT_TRUE(decodable.optionalList.HasValue()); + EXPECT_TRUE(ListsEqual(decodable.optionalList.Value(), enumList)); + EXPECT_TRUE(decodable.nullableOptionalList.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalList.Value().IsNull()); + EXPECT_TRUE(ListsEqual(decodable.nullableOptionalList.Value().Value(), enumList)); } else { - NL_TEST_ASSERT(apSuite, decodable.nullableInt.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalInt.HasValue()); + EXPECT_TRUE(decodable.nullableInt.IsNull()); + EXPECT_FALSE(decodable.optionalInt.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalInt.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableString.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalString.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalString.HasValue()); + EXPECT_TRUE(decodable.nullableString.IsNull()); + EXPECT_FALSE(decodable.optionalString.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalString.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableStruct.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalStruct.HasValue()); + EXPECT_TRUE(decodable.nullableStruct.IsNull()); + EXPECT_FALSE(decodable.optionalStruct.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalStruct.HasValue()); - NL_TEST_ASSERT(apSuite, decodable.nullableList.IsNull()); - NL_TEST_ASSERT(apSuite, !decodable.optionalList.HasValue()); - NL_TEST_ASSERT(apSuite, !decodable.nullableOptionalList.HasValue()); + EXPECT_TRUE(decodable.nullableList.IsNull()); + EXPECT_FALSE(decodable.optionalList.HasValue()); + EXPECT_FALSE(decodable.nullableOptionalList.HasValue()); } } } template -void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck(nlTestSuite * apSuite, void * apContext) +void TestDataModelSerialization::NullablesOptionalsEncodeDecodeCheck() { - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, false, false); - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, true, false); - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext, false, true); + NullablesOptionalsEncodeDecodeCheck(false, false); + NullablesOptionalsEncodeDecodeCheck(true, false); + NullablesOptionalsEncodeDecodeCheck(false, true); } -void TestDataModelSerialization::NullablesOptionalsStruct(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, NullablesOptionalsStruct) { using EncType = Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::Type; using DecType = Clusters::UnitTesting::Structs::NullablesAndOptionalsStruct::DecodableType; - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext); + NullablesOptionalsEncodeDecodeCheck(); } -void TestDataModelSerialization::NullablesOptionalsCommand(nlTestSuite * apSuite, void * apContext) +TEST_F(TestDataModelSerialization, NullablesOptionalsCommand) { using EncType = Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Type; using DecType = Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::DecodableType; - NullablesOptionalsEncodeDecodeCheck(apSuite, apContext); -} - -int Initialize(void * apSuite) -{ - VerifyOrReturnError(chip::Platform::MemoryInit() == CHIP_NO_ERROR, FAILURE); - return SUCCESS; -} - -int Finalize(void * aContext) -{ - gTestDataModelSerialization.Shutdown(); - chip::Platform::MemoryShutdown(); - return SUCCESS; + NullablesOptionalsEncodeDecodeCheck(); } } // namespace - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestDataModelSerialization_EncAndDecSimple", TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStruct), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum", TestDataModelSerialization::TestDataModelSerialization_EncAndDecSimpleStructNegativeEnum), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecNestedStruct", TestDataModelSerialization::TestDataModelSerialization_EncAndDecNestedStruct), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecDecodableNestedStructList", TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableNestedStructList), - NL_TEST_DEF("TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList", TestDataModelSerialization::TestDataModelSerialization_EncAndDecDecodableDoubleNestedStructList), - NL_TEST_DEF("TestDataModelSerialization_OptionalFields", TestDataModelSerialization::TestDataModelSerialization_OptionalFields), - NL_TEST_DEF("TestDataModelSerialization_ExtraField", TestDataModelSerialization::TestDataModelSerialization_ExtraField), - NL_TEST_DEF("TestDataModelSerialization_InvalidSimpleFieldTypes", TestDataModelSerialization::TestDataModelSerialization_InvalidSimpleFieldTypes), - NL_TEST_DEF("TestDataModelSerialization_InvalidListType", TestDataModelSerialization::TestDataModelSerialization_InvalidListType), - NL_TEST_DEF("TestDataModelSerialization_NullablesOptionalsStruct", TestDataModelSerialization::NullablesOptionalsStruct), - NL_TEST_DEF("TestDataModelSerialization_NullablesOptionalsCommand", TestDataModelSerialization::NullablesOptionalsCommand), - NL_TEST_SENTINEL() -}; -// clang-format on - -nlTestSuite theSuite = { "TestDataModelSerialization", &sTests[0], Initialize, Finalize }; - -int DataModelSerializationTest() -{ - nlTestRunner(&theSuite, &gTestDataModelSerialization); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(DataModelSerializationTest) diff --git a/src/app/tests/TestDefaultOTARequestorStorage.cpp b/src/app/tests/TestDefaultOTARequestorStorage.cpp index 1b4e9b0a3bc5ed..53ee108e73f8b6 100644 --- a/src/app/tests/TestDefaultOTARequestorStorage.cpp +++ b/src/app/tests/TestDefaultOTARequestorStorage.cpp @@ -19,16 +19,16 @@ #include #include #include -#include -#include +#include +#include using namespace chip; using namespace chip::DeviceLayer; namespace { -void TestDefaultProviders(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestDefaultProviders) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -43,49 +43,49 @@ void TestDefaultProviders(nlTestSuite * inSuite, void * inContext) }; ProviderLocationList providers = {}; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(1), NodeId(0x11111111), EndpointId(1)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(2), NodeId(0x22222222), EndpointId(2)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == providers.Add(makeProvider(FabricIndex(3), NodeId(0x33333333), EndpointId(3)))); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreDefaultProviders(providers)); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(1), NodeId(0x11111111), EndpointId(1)))); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(2), NodeId(0x22222222), EndpointId(2)))); + EXPECT_EQ(CHIP_NO_ERROR, providers.Add(makeProvider(FabricIndex(3), NodeId(0x33333333), EndpointId(3)))); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreDefaultProviders(providers)); providers = {}; - NL_TEST_ASSERT(inSuite, !providers.Begin().Next()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadDefaultProviders(providers)); + EXPECT_FALSE(providers.Begin().Next()); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadDefaultProviders(providers)); auto provider = providers.Begin(); bool hasNext; - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 1); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x11111111); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 1); + EXPECT_EQ(provider.GetValue().fabricIndex, 1); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x11111111u); + EXPECT_EQ(provider.GetValue().endpoint, 1); } - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 2); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x22222222); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 2); + EXPECT_EQ(provider.GetValue().fabricIndex, 2); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x22222222u); + EXPECT_EQ(provider.GetValue().endpoint, 2); } - NL_TEST_ASSERT(inSuite, hasNext = provider.Next()); + EXPECT_TRUE(hasNext = provider.Next()); if (hasNext) { - NL_TEST_ASSERT(inSuite, provider.GetValue().fabricIndex == 3); - NL_TEST_ASSERT(inSuite, provider.GetValue().providerNodeID == 0x33333333); - NL_TEST_ASSERT(inSuite, provider.GetValue().endpoint == 3); + EXPECT_EQ(provider.GetValue().fabricIndex, 3); + EXPECT_EQ(provider.GetValue().providerNodeID, 0x33333333u); + EXPECT_EQ(provider.GetValue().endpoint, 3); } - NL_TEST_ASSERT(inSuite, !provider.Next()); + EXPECT_FALSE(provider.Next()); } -void TestDefaultProvidersEmpty(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestDefaultProvidersEmpty) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -93,11 +93,11 @@ void TestDefaultProvidersEmpty(nlTestSuite * inSuite, void * inContext) ProviderLocationList providers = {}; - NL_TEST_ASSERT(inSuite, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND == otaStorage.LoadDefaultProviders(providers)); - NL_TEST_ASSERT(inSuite, !providers.Begin().Next()); + EXPECT_EQ(CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND, otaStorage.LoadDefaultProviders(providers)); + EXPECT_FALSE(providers.Begin().Next()); } -void TestCurrentProviderLocation(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestCurrentProviderLocation) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -108,19 +108,19 @@ void TestCurrentProviderLocation(nlTestSuite * inSuite, void * inContext) provider.providerNodeID = 0x12344321; provider.endpoint = 10; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreCurrentProviderLocation(provider)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreCurrentProviderLocation(provider)); provider = {}; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadCurrentProviderLocation(provider)); - NL_TEST_ASSERT(inSuite, provider.fabricIndex == 1); - NL_TEST_ASSERT(inSuite, provider.providerNodeID == 0x12344321); - NL_TEST_ASSERT(inSuite, provider.endpoint == 10); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearCurrentProviderLocation()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadCurrentProviderLocation(provider)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadCurrentProviderLocation(provider)); + EXPECT_EQ(provider.fabricIndex, 1); + EXPECT_EQ(provider.providerNodeID, 0x12344321u); + EXPECT_EQ(provider.endpoint, 10); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearCurrentProviderLocation()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadCurrentProviderLocation(provider)); } -void TestUpdateToken(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestUpdateToken) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -133,21 +133,21 @@ void TestUpdateToken(nlTestSuite * inSuite, void * inContext) for (uint8_t i = 0; i < updateTokenLength; ++i) updateTokenBuffer[i] = i; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreUpdateToken(updateToken)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreUpdateToken(updateToken)); uint8_t readBuffer[updateTokenLength + 10]; MutableByteSpan readUpdateToken(readBuffer); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadUpdateToken(readUpdateToken)); - NL_TEST_ASSERT(inSuite, readUpdateToken.size() == updateTokenLength); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadUpdateToken(readUpdateToken)); + EXPECT_EQ(readUpdateToken.size(), updateTokenLength); for (uint8_t i = 0; i < updateTokenLength; ++i) - NL_TEST_ASSERT(inSuite, readBuffer[i] == i); + EXPECT_EQ(readBuffer[i], i); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearUpdateToken()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadUpdateToken(readUpdateToken)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearUpdateToken()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadUpdateToken(readUpdateToken)); } -void TestCurrentUpdateState(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestCurrentUpdateState) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -155,17 +155,17 @@ void TestCurrentUpdateState(nlTestSuite * inSuite, void * inContext) OTARequestorStorage::OTAUpdateStateEnum updateState = OTARequestorStorage::OTAUpdateStateEnum::kApplying; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreCurrentUpdateState(updateState)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreCurrentUpdateState(updateState)); updateState = OTARequestorStorage::OTAUpdateStateEnum::kUnknown; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadCurrentUpdateState(updateState)); - NL_TEST_ASSERT(inSuite, updateState == OTARequestorStorage::OTAUpdateStateEnum::kApplying); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearCurrentUpdateState()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadCurrentUpdateState(updateState)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadCurrentUpdateState(updateState)); + EXPECT_EQ(updateState, OTARequestorStorage::OTAUpdateStateEnum::kApplying); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearCurrentUpdateState()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadCurrentUpdateState(updateState)); } -void TestTargetVersion(nlTestSuite * inSuite, void * inContext) +TEST(TestDefaultOTARequestorStorage, TestTargetVersion) { TestPersistentStorageDelegate persistentStorage; DefaultOTARequestorStorage otaStorage; @@ -173,43 +173,14 @@ void TestTargetVersion(nlTestSuite * inSuite, void * inContext) uint32_t targetVersion = 2; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreTargetVersion(targetVersion)); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.StoreTargetVersion(targetVersion)); targetVersion = 0; - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadTargetVersion(targetVersion)); - NL_TEST_ASSERT(inSuite, targetVersion == 2); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearTargetVersion()); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadTargetVersion(targetVersion)); -} - -const nlTest sTests[] = { NL_TEST_DEF("Test default providers", TestDefaultProviders), - NL_TEST_DEF("Test default providers (empty list)", TestDefaultProvidersEmpty), - NL_TEST_DEF("Test current provider location", TestCurrentProviderLocation), - NL_TEST_DEF("Test update token", TestUpdateToken), - NL_TEST_DEF("Test current update state", TestCurrentUpdateState), - NL_TEST_DEF("Test target version", TestTargetVersion), - NL_TEST_SENTINEL() }; - -int TestSetup(void * inContext) -{ - return SUCCESS; -} - -int TestTearDown(void * inContext) -{ - return SUCCESS; + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.LoadTargetVersion(targetVersion)); + EXPECT_EQ(targetVersion, 2u); + EXPECT_EQ(CHIP_NO_ERROR, otaStorage.ClearTargetVersion()); + EXPECT_NE(CHIP_NO_ERROR, otaStorage.LoadTargetVersion(targetVersion)); } } // namespace - -int TestDefaultOTARequestorStorage() -{ - nlTestSuite theSuite = { "OTA Storage tests", &sTests[0], TestSetup, TestTearDown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestDefaultOTARequestorStorage) diff --git a/src/app/tests/TestEventPathParams.cpp b/src/app/tests/TestEventPathParams.cpp index da0b3315290815..a962a6b7e43d75 100644 --- a/src/app/tests/TestEventPathParams.cpp +++ b/src/app/tests/TestEventPathParams.cpp @@ -16,65 +16,120 @@ * limitations under the License. */ -/** - * @file - * This file implements unit tests for EventPathParams - * - */ - #include -#include -#include +#include +#include +#include + +using namespace chip::Test; namespace chip { namespace app { namespace TestEventPathParams { -void TestSamePath(nlTestSuite * apSuite, void * apContext) + +class TestEventPathParams : public ::testing::Test +{ +public: + static void SetUpTestSuite() { InitEventPaths(); } + + static void InitEventPaths(); + + static chip::app::EventPathParams validEventpaths[6]; +}; + +chip::app::EventPathParams TestEventPathParams::validEventpaths[6]; + +TEST_F(TestEventPathParams, SamePath) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 3, 4); - NL_TEST_ASSERT(apSuite, eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_TRUE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentEndpointId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentEndpointId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(6, 3, 4); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentClusterId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentClusterId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 6, 4); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -void TestDifferentEventId(nlTestSuite * apSuite, void * apContext) +TEST_F(TestEventPathParams, DifferentEventId) { EventPathParams eventPathParams1(2, 3, 4); EventPathParams eventPathParams2(2, 3, 6); - NL_TEST_ASSERT(apSuite, !eventPathParams1.IsSamePath(eventPathParams2)); + EXPECT_FALSE(eventPathParams1.IsSamePath(eventPathParams2)); } -} // namespace TestEventPathParams -} // namespace app -} // namespace chip -namespace { -const nlTest sTests[] = { NL_TEST_DEF("TestSamePath", chip::app::TestEventPathParams::TestSamePath), - NL_TEST_DEF("TestDifferentEndpointId", chip::app::TestEventPathParams::TestDifferentEndpointId), - NL_TEST_DEF("TestDifferentClusterId", chip::app::TestEventPathParams::TestDifferentClusterId), - NL_TEST_DEF("TestDifferentEventId", chip::app::TestEventPathParams::TestDifferentEventId), - NL_TEST_SENTINEL() }; +/* after Init, validEventpaths array will have the following values: +{kInvalidEndpointId, kInvalidClusterId, kInvalidEventId}, +{kInvalidEndpointId, MockClusterId(1), kInvalidEventId}, +{kInvalidEndpointId, MockClusterId(1), MockEventId(1)}, +{kMockEndpoint1, kInvalidClusterId, kInvalidEventId}, +{kMockEndpoint1, MockClusterId(1), kInvalidEventId}, +{kMockEndpoint1, MockClusterId(1), MockEventId(1)}, +*/ +void TestEventPathParams::InitEventPaths() +{ + validEventpaths[1].mClusterId = MockClusterId(1); + validEventpaths[2].mClusterId = MockClusterId(1); + validEventpaths[2].mEventId = MockEventId(1); + validEventpaths[3].mEndpointId = kMockEndpoint1; + validEventpaths[4].mEndpointId = kMockEndpoint1; + validEventpaths[4].mClusterId = MockClusterId(1); + validEventpaths[5].mEndpointId = kMockEndpoint1; + validEventpaths[5].mClusterId = MockClusterId(1); + validEventpaths[5].mEventId = MockEventId(1); } -int TestEventPathParams() +TEST_F(TestEventPathParams, ConcreteEventPathSameEventId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(1)); + for (auto & path : validEventpaths) + { + EXPECT_TRUE(path.IsValidEventPath()); + EXPECT_TRUE(path.IsEventPathSupersetOf(testPath)); + } +} +TEST_F(TestEventPathParams, ConcreteEventPathDifferentEndpointId) { - nlTestSuite theSuite = { "EventPathParams", &sTests[0], nullptr, nullptr }; + ConcreteEventPath testPath(kMockEndpoint2, MockClusterId(1), MockEventId(1)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); +} - nlTestRunner(&theSuite, nullptr); +TEST_F(TestEventPathParams, ConcreteEventPathDifferentClusterId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(2), MockEventId(1)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); +} - return (nlTestRunnerStats(&theSuite)); +TEST_F(TestEventPathParams, ConcreteEventPathDifferentEventId) +{ + ConcreteEventPath testPath(kMockEndpoint1, MockClusterId(1), MockEventId(2)); + EXPECT_TRUE(validEventpaths[0].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[1].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[2].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[3].IsEventPathSupersetOf(testPath)); + EXPECT_TRUE(validEventpaths[4].IsEventPathSupersetOf(testPath)); + EXPECT_FALSE(validEventpaths[5].IsEventPathSupersetOf(testPath)); } -CHIP_REGISTER_TEST_SUITE(TestEventPathParams) +} // namespace TestEventPathParams +} // namespace app +} // namespace chip diff --git a/src/app/tests/TestExtensionFieldSets.cpp b/src/app/tests/TestExtensionFieldSets.cpp index 2c7fb4e37a2929..66b4e9e72ad891 100644 --- a/src/app/tests/TestExtensionFieldSets.cpp +++ b/src/app/tests/TestExtensionFieldSets.cpp @@ -19,8 +19,9 @@ #include #include #include -#include -#include + +#include +#include using namespace chip; @@ -53,7 +54,14 @@ static const scenes::ExtensionFieldSet EFS3(kColorControlClusterId, colorControl static scenes::ExtensionFieldSetsImpl sEFSets; -void TestInsertExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +class TestExtensionFieldSets : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestExtensionFieldSets, TestInsertExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSetsImpl testEFS1; @@ -68,118 +76,118 @@ void TestInsertExtensionFieldSet(nlTestSuite * aSuite, void * aContext) memset(double_size_buffer, static_cast(1), sizeof(double_size_buffer)); - NL_TEST_ASSERT(aSuite, true == EFS->IsEmpty()); + EXPECT_TRUE(EFS->IsEmpty()); // Test creators of single ExtensionFieldSet - NL_TEST_ASSERT(aSuite, EFS1.mID == kOnOffClusterId); - NL_TEST_ASSERT(aSuite, EFS1.mUsedBytes == kOnOffSize); - NL_TEST_ASSERT(aSuite, !memcmp(onOffBuffer, EFS1.mBytesBuffer, EFS1.mUsedBytes)); + EXPECT_EQ(EFS1.mID, kOnOffClusterId); + EXPECT_EQ(EFS1.mUsedBytes, kOnOffSize); + EXPECT_EQ(memcmp(onOffBuffer, EFS1.mBytesBuffer, EFS1.mUsedBytes), 0); - NL_TEST_ASSERT(aSuite, EFS2.mID == kLevelControlClusterId); - NL_TEST_ASSERT(aSuite, EFS2.mUsedBytes == kLevelControlSize); - NL_TEST_ASSERT(aSuite, !memcmp(levelControlBuffer, EFS2.mBytesBuffer, EFS2.mUsedBytes)); + EXPECT_EQ(EFS2.mID, kLevelControlClusterId); + EXPECT_EQ(EFS2.mUsedBytes, kLevelControlSize); + EXPECT_EQ(memcmp(levelControlBuffer, EFS2.mBytesBuffer, EFS2.mUsedBytes), 0); - NL_TEST_ASSERT(aSuite, EFS3.mID == kColorControlClusterId); - NL_TEST_ASSERT(aSuite, EFS3.mUsedBytes == kColorControlSize); - NL_TEST_ASSERT(aSuite, !memcmp(colorControlBuffer, EFS3.mBytesBuffer, EFS3.mUsedBytes)); + EXPECT_EQ(EFS3.mID, kColorControlClusterId); + EXPECT_EQ(EFS3.mUsedBytes, kColorControlSize); + EXPECT_EQ(memcmp(colorControlBuffer, EFS3.mBytesBuffer, EFS3.mUsedBytes), 0); // operator tests single EFS tempEFS = EFS1; - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(tempEFS, EFS1); tempEFS = EFS2; - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); + EXPECT_EQ(tempEFS, EFS2); tempEFS = EFS3; - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(tempEFS, EFS3); // Test clear EFS tempEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempEFS.IsEmpty()); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kInvalidClusterId); - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer))); + EXPECT_TRUE(tempEFS.IsEmpty()); + EXPECT_EQ(tempEFS.mID, kInvalidClusterId); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer)), 0); // Test creation of EFS from Array and ByteSpan that are to big tempEFS = scenes::ExtensionFieldSet(kOnOffClusterId, double_size_buffer, sizeof(double_size_buffer)); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kOnOffClusterId); + EXPECT_EQ(tempEFS.mID, kOnOffClusterId); // Confirm EFS empty - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer))); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer)), 0); tempEFS = scenes::ExtensionFieldSet(kLevelControlClusterId, bufferSpan); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kLevelControlClusterId); + EXPECT_EQ(tempEFS.mID, kLevelControlClusterId); // Confirm EFS empty - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == 0); - NL_TEST_ASSERT(aSuite, !memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer))); + EXPECT_EQ(tempEFS.mUsedBytes, 0); + EXPECT_EQ(memcmp(empty_buffer, tempEFS.mBytesBuffer, sizeof(empty_buffer)), 0); // Test creation of EFS from truncating an Array tempEFS = scenes::ExtensionFieldSet(kColorControlClusterId, double_size_buffer, sizeof(tempEFS.mBytesBuffer)); - NL_TEST_ASSERT(aSuite, tempEFS.mID == kColorControlClusterId); + EXPECT_EQ(tempEFS.mID, kColorControlClusterId); // Confirm EFS was written - NL_TEST_ASSERT(aSuite, tempEFS.mUsedBytes == static_cast(sizeof(tempEFS.mBytesBuffer))); - NL_TEST_ASSERT(aSuite, !memcmp(double_size_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer))); + EXPECT_EQ(tempEFS.mUsedBytes, static_cast(sizeof(tempEFS.mBytesBuffer))); + EXPECT_EQ(memcmp(double_size_buffer, tempEFS.mBytesBuffer, sizeof(tempEFS.mBytesBuffer)), 0); tempEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempEFS.IsEmpty()); + EXPECT_TRUE(tempEFS.IsEmpty()); // Test insertion of uninitialized EFS - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_ARGUMENT == EFS->InsertFieldSet(tempEFS)); - NL_TEST_ASSERT(aSuite, 0 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_ERROR_INVALID_ARGUMENT, EFS->InsertFieldSet(tempEFS)); + EXPECT_EQ(0, EFS->GetFieldSetCount()); // Test insertion of empty EFS tempEFS.mID = kOnOffClusterId; - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_ARGUMENT == EFS->InsertFieldSet(tempEFS)); - NL_TEST_ASSERT(aSuite, 0 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_ERROR_INVALID_ARGUMENT, EFS->InsertFieldSet(tempEFS)); + EXPECT_EQ(0, EFS->GetFieldSetCount()); // test operators on multiple EFS struct - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS1.InsertFieldSet(EFS3)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS1)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS2)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS1.InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS2.InsertFieldSet(EFS3)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS2.InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS3.InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testEFS3.InsertFieldSet(EFS2)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS3.InsertFieldSet(EFS1)); + EXPECT_EQ(CHIP_NO_ERROR, testEFS3.InsertFieldSet(EFS2)); tempTestEFS = testEFS1; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS1); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS2)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS3)); + EXPECT_EQ(tempTestEFS, testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS2); + EXPECT_FALSE(tempTestEFS == testEFS3); tempTestEFS = testEFS2; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS2); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS1)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS3)); + EXPECT_EQ(tempTestEFS, testEFS2); + EXPECT_FALSE(tempTestEFS == testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS3); tempTestEFS = testEFS3; - NL_TEST_ASSERT(aSuite, tempTestEFS == testEFS3); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS1)); - NL_TEST_ASSERT(aSuite, !(tempTestEFS == testEFS2)); + EXPECT_EQ(tempTestEFS, testEFS3); + EXPECT_FALSE(tempTestEFS == testEFS1); + EXPECT_FALSE(tempTestEFS == testEFS2); // test clear multipler efs struct tempTestEFS.Clear(); - NL_TEST_ASSERT(aSuite, tempTestEFS.IsEmpty()); - NL_TEST_ASSERT(aSuite, 0 == tempTestEFS.GetFieldSetCount()); + EXPECT_TRUE(tempTestEFS.IsEmpty()); + EXPECT_EQ(0, tempTestEFS.GetFieldSetCount()); // Test insert - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, 1 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS1)); + EXPECT_EQ(1, EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS2)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS2)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Test get - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); } -void TestSerializeDerializeExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +TEST_F(TestExtensionFieldSets, TestSerializeDerializeExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSetsImpl testSceneEFS; @@ -203,148 +211,105 @@ void TestSerializeDerializeExtensionFieldSet(nlTestSuite * aSuite, void * aConte // Individual Field Sets serialize / deserialize writer.Init(EFS1Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS1.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS1.Serialize(writer)); EFS1_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS1_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS1_serialized_length, scenes::kMaxFieldBytesPerCluster); writer.Init(EFS2Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS2.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS2.Serialize(writer)); EFS2_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS2_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS2_serialized_length, scenes::kMaxFieldBytesPerCluster); writer.Init(EFS3Buffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS3.Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS3.Serialize(writer)); EFS3_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, EFS3_serialized_length <= scenes::kMaxFieldBytesPerCluster); + EXPECT_LE(EFS3_serialized_length, scenes::kMaxFieldBytesPerCluster); reader.Init(EFS1Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS1 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS1, tempEFS); reader.Init(EFS2Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS2 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS2, tempEFS); reader.Init(EFS3Buffer); reader.Next(TLV::AnonymousTag()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == tempEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, EFS3 == tempEFS); + EXPECT_EQ(CHIP_NO_ERROR, tempEFS.Deserialize(reader)); + EXPECT_EQ(EFS3, tempEFS); // All ExtensionFieldSets serialize / deserialize writer.Init(sceneEFSBuffer); writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->Serialize(writer)); + EXPECT_EQ(CHIP_NO_ERROR, EFS->Serialize(writer)); writer.EndContainer(outer); sceneEFS_serialized_length = writer.GetLengthWritten(); - NL_TEST_ASSERT(aSuite, sceneEFS_serialized_length <= kPersistentSceneBufferMax); + EXPECT_LE(sceneEFS_serialized_length, kPersistentSceneBufferMax); reader.Init(sceneEFSBuffer); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.EnterContainer(outerRead)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == testSceneEFS.Deserialize(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, reader.EnterContainer(outerRead)); + EXPECT_EQ(CHIP_NO_ERROR, testSceneEFS.Deserialize(reader)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.ExitContainer(outerRead)); - NL_TEST_ASSERT(aSuite, *EFS == testSceneEFS); + EXPECT_EQ(CHIP_NO_ERROR, reader.ExitContainer(outerRead)); + EXPECT_EQ(*EFS, testSceneEFS); } -void TestRemoveExtensionFieldSet(nlTestSuite * aSuite, void * aContext) +TEST_F(TestExtensionFieldSets, TestRemoveExtensionFieldSet) { scenes::ExtensionFieldSetsImpl * EFS = &sEFSets; scenes::ExtensionFieldSet tempEFS; // Order in EFS at this point: [EFS1, EFS2, EFS3] // Removal at beginning - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(0)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS1)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(0)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS1)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS1); // Order in EFS at this point: [EFS2, EFS3, EFS1] // Removal at middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(1)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(1)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); // Order in EFS at this point: [EFS2, EFS1, EFS3] // Removal at end - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->RemoveFieldAtPosition(2)); - NL_TEST_ASSERT(aSuite, 2 == EFS->GetFieldSetCount()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->InsertFieldSet(EFS3)); - NL_TEST_ASSERT(aSuite, 3 == EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->RemoveFieldAtPosition(2)); + EXPECT_EQ(2, EFS->GetFieldSetCount()); + EXPECT_EQ(CHIP_NO_ERROR, EFS->InsertFieldSet(EFS3)); + EXPECT_EQ(3, EFS->GetFieldSetCount()); // Verify order - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 0)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 1)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == EFS->GetFieldSetAtPosition(tempEFS, 2)); - NL_TEST_ASSERT(aSuite, tempEFS == EFS3); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 0)); + EXPECT_EQ(tempEFS, EFS2); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 1)); + EXPECT_EQ(tempEFS, EFS1); + EXPECT_EQ(CHIP_NO_ERROR, EFS->GetFieldSetAtPosition(tempEFS, 2)); + EXPECT_EQ(tempEFS, EFS3); // Emptying the table EFS->Clear(); - NL_TEST_ASSERT(aSuite, true == EFS->IsEmpty()); + EXPECT_TRUE(EFS->IsEmpty()); } } // namespace TestEFS -/** - * Tear down the test suite. - */ -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - - return SUCCESS; -} - -namespace { -/** - * Setup the test suite. - */ -int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - - return SUCCESS; -} -} // namespace - -int TestExtensionFieldSets() -{ - static nlTest sTests[] = { NL_TEST_DEF("TestInsertExtensionFieldSet", TestEFS::TestInsertExtensionFieldSet), - NL_TEST_DEF("TestSerializeDerializeExtensionFieldSet", - TestEFS::TestSerializeDerializeExtensionFieldSet), - NL_TEST_DEF("TestRemoveExtensionFieldSet", TestEFS::TestRemoveExtensionFieldSet), - - NL_TEST_SENTINEL() }; - - nlTestSuite theSuite = { - "SceneTable", - &sTests[0], - TestSetup, - TestTeardown, - }; - - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestExtensionFieldSets) diff --git a/src/app/tests/TestSceneTable.cpp b/src/app/tests/TestSceneTable.cpp index 1ce2583c28ab27..1563c286ac3e16 100644 --- a/src/app/tests/TestSceneTable.cpp +++ b/src/app/tests/TestSceneTable.cpp @@ -22,9 +22,9 @@ #include #include #include -#include -#include +#include +#include using namespace chip; using SceneTable = scenes::SceneTable; @@ -425,10 +425,42 @@ class TestSceneTableImpl : public SceneTableImpl uint8_t GetClusterCountFromEndpoint() override { return 3; } }; -// Storage -static chip::TestPersistentStorageDelegate testStorage; -// Scene -static TestSceneHandler sHandler; +// Test Fixture Class +class TestSceneTable : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + mpTestStorage = new chip::TestPersistentStorageDelegate; + mpSceneHandler = new TestSceneHandler; + + ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); + + // Initialize Scene Table + SceneTable * sceneTable = scenes::GetSceneTableImpl(); + ASSERT_NE(sceneTable, nullptr); + ASSERT_EQ(sceneTable->Init(mpTestStorage), CHIP_NO_ERROR); + } + + static void TearDownTestSuite() + { + // Terminate Scene Table + SceneTable * sceneTable = scenes::GetSceneTableImpl(); + ASSERT_NE(sceneTable, nullptr); + sceneTable->Finish(); + delete mpTestStorage; + delete mpSceneHandler; + chip::Platform::MemoryShutdown(); + } + + // Storage + static chip::TestPersistentStorageDelegate * mpTestStorage; + // Scene + static TestSceneHandler * mpSceneHandler; +}; + +chip::TestPersistentStorageDelegate * TestSceneTable::mpTestStorage = nullptr; +TestSceneHandler * TestSceneTable::mpSceneHandler = nullptr; void ResetSceneTable(SceneTable * sceneTable) { @@ -437,11 +469,10 @@ void ResetSceneTable(SceneTable * sceneTable) sceneTable->RemoveFabric(kFabric3); } -void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestHandlerRegistration) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); TestSceneHandler tmpHandler[scenes::kMaxClustersPerScene]; for (uint8_t i = 0; i < scenes::kMaxClustersPerScene; i++) @@ -453,7 +484,7 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) sceneTable->UnregisterAllHandlers(); // Verify the handler num has been updated properly - NL_TEST_ASSERT(aSuite, sceneTable->HandlerListEmpty()); + EXPECT_TRUE(sceneTable->HandlerListEmpty()); for (uint8_t i = 0; i < scenes::kMaxClustersPerScene; i++) { @@ -462,40 +493,38 @@ void TestHandlerRegistration(nlTestSuite * aSuite, void * aContext) // Hanlder order in table : [H0, H1, H2] - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Removal at beginning sceneTable->UnregisterHandler(&tmpHandler[0]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Re-insert sceneTable->RegisterHandler(&tmpHandler[0]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Hanlder order in table : [H0, H1, H2] // Removal at the middle sceneTable->UnregisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Re-insert sceneTable->RegisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Hanlder order in table : [H1, H0, H2] // Removal at the end sceneTable->UnregisterHandler(&tmpHandler[2]); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Emptying Handler array sceneTable->UnregisterAllHandlers(); // Verify the handler num has been updated properly - NL_TEST_ASSERT(aSuite, sceneTable->HandlerListEmpty()); + EXPECT_TRUE(sceneTable->HandlerListEmpty()); } -void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestHandlerFunctions) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - + ASSERT_NE(nullptr, sceneTable); app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type extensionFieldSetOut; app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::DecodableType extensionFieldSetIn; @@ -548,99 +577,91 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) // Serialize Extension Field sets as if they were recovered from memory writer.Init(OO_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), OOextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), OOextensionFieldSet.attributeValueList)); OO_buffer_serialized_length = writer.GetLengthWritten(); writer.Init(LC_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), LCextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), LCextensionFieldSet.attributeValueList)); LC_buffer_serialized_length = writer.GetLengthWritten(); writer.Init(CC_buffer); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), CCextensionFieldSet.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), CCextensionFieldSet.attributeValueList)); CC_buffer_serialized_length = writer.GetLengthWritten(); // Test Registering SceneHandler - sceneTable->RegisterHandler(&sHandler); - NL_TEST_ASSERT(aSuite, !sceneTable->HandlerListEmpty()); + sceneTable->RegisterHandler(mpSceneHandler); + EXPECT_FALSE(sceneTable->HandlerListEmpty()); // Setup the On Off Extension field set in the expected state from a command reader.Init(OO_list); extensionFieldSetIn.clusterID = kOnOffClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(OO_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(OO_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Setup the Level Control Extension field set in the expected state from a command reader.Init(LC_list); extensionFieldSetIn.clusterID = kLevelControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(LC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(LC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Setup the Color control Extension field set in the expected state from a command reader.Init(CC_list); extensionFieldSetIn.clusterID = kColorControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldSetIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldSetIn.attributeValueList.Decode(reader)); - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, extensionFieldSetIn.clusterID)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldSetIn, buff_span)); // Verify the handler extracted buffer matches the initial field sets - NL_TEST_ASSERT(aSuite, 0 == memcmp(CC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(0, memcmp(CC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); buff_span = MutableByteSpan(buffer); // Verify Deserializing is properly filling out output extension field set for on off - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kOnOffClusterId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kOnOffClusterId, OO_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kOnOffClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kOnOffClusterId, OO_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for on off previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(OO_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(OO_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // Verify Deserializing is properly filling out output extension field set for level control - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kLevelControlClusterId)); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kLevelControlClusterId, LC_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kLevelControlClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kLevelControlClusterId, LC_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for level control previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(LC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(LC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // Verify Deserializing is properly filling out output extension field set for color control - NL_TEST_ASSERT(aSuite, sHandler.SupportsCluster(kTestEndpoint1, kColorControlClusterId)); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == sHandler.Deserialize(kTestEndpoint1, kColorControlClusterId, CC_list, extensionFieldSetOut)); + EXPECT_TRUE(mpSceneHandler->SupportsCluster(kTestEndpoint1, kColorControlClusterId)); + EXPECT_EQ(CHIP_NO_ERROR, mpSceneHandler->Deserialize(kTestEndpoint1, kColorControlClusterId, CC_list, extensionFieldSetOut)); // Verify Encoding the Extension field set returns the same data as the one serialized for color control previously writer.Init(buff_span); - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); - NL_TEST_ASSERT(aSuite, 0 == memcmp(CC_list.data(), buff_span.data(), buff_span.size())); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldSetOut.attributeValueList)); + EXPECT_EQ(0, memcmp(CC_list.data(), buff_span.data(), buff_span.size())); memset(buffer, 0, buff_span.size()); // To test failure on serialize and deserialize when too many pairs are in the field sets @@ -663,52 +684,46 @@ void TestHandlerFunctions(nlTestSuite * aSuite, void * aContext) // Serialize Extension Field sets as if they were recovered from memory writer.Init(failBuffer); - NL_TEST_ASSERT( - aSuite, CHIP_NO_ERROR == app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldFailTestOut.attributeValueList)); + EXPECT_EQ(CHIP_NO_ERROR, app::DataModel::Encode(writer, TLV::AnonymousTag(), extensionFieldFailTestOut.attributeValueList)); // Setup the On Off Extension field set in the expected state from a command reader.Init(fail_list); extensionFieldFailTestIn.clusterID = kColorControlClusterId; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == reader.Next()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == extensionFieldFailTestIn.attributeValueList.Decode(reader)); + EXPECT_EQ(CHIP_NO_ERROR, reader.Next()); + EXPECT_EQ(CHIP_NO_ERROR, extensionFieldFailTestIn.attributeValueList.Decode(reader)); // Verify failure on both serialize and deserialize - NL_TEST_ASSERT(aSuite, - CHIP_ERROR_BUFFER_TOO_SMALL == sHandler.SerializeAdd(kTestEndpoint1, extensionFieldFailTestIn, buff_span)); - NL_TEST_ASSERT(aSuite, - CHIP_ERROR_BUFFER_TOO_SMALL == - sHandler.Deserialize(kTestEndpoint1, kColorControlClusterId, fail_list, extensionFieldFailTestOut)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, mpSceneHandler->SerializeAdd(kTestEndpoint1, extensionFieldFailTestIn, buff_span)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, + mpSceneHandler->Deserialize(kTestEndpoint1, kColorControlClusterId, fail_list, extensionFieldFailTestOut)); memset(failBuffer, 0, fail_list.size()); memset(buffer, 0, buff_span.size()); }; -void TestHandlerHelpers(nlTestSuite * aSuite, void * aContext) {} - -void TestStoreScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestStoreScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneId sceneList[defaultTestFabricCapacity]; // Reset test ResetSceneTable(sceneTable); // Populate scene1's EFS (Endpoint1) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene1)); // Populate scene2's EFS (Endpoint1) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene2)); // Populate scene3's EFS (Endpoint2) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene3)); // Populate scene4's EFS (Endpoint2) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene4)); // Populate scene8's EFS (Endpoint3) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneSaveEFS(scene8)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneSaveEFS(scene8)); SceneTableEntry scene; Span sceneListSpan = Span(sceneList); @@ -716,272 +731,266 @@ void TestStoreScenes(nlTestSuite * aSuite, void * aContext) Span smallListSpan = Span(sceneList, 1); // Test Get All scenes in Group in empty scene table - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); - NL_TEST_ASSERT(aSuite, 0 == emptyListSpan.size()); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(0u, emptyListSpan.size()); // Set test - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); // Test single scene in table with 0 size span - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); - NL_TEST_ASSERT(aSuite, 1 == smallListSpan.size()); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); + EXPECT_EQ(1u, smallListSpan.size()); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Too many scenes for 1 fabric - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric1, scene9)); // Not Found - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); // Get test - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SceneApplyEFS(scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SceneApplyEFS(scene)); // Test error when list too small in a full table // Test failure for 3 spaces in 4 scenes list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, smallListSpan)); // Test failure for no space in a 4 scenes list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, emptyListSpan)); // Test failure for no space in a 1 scene list - NL_TEST_ASSERT(aSuite, CHIP_ERROR_BUFFER_TOO_SMALL == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, emptyListSpan)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, smallListSpan)); - NL_TEST_ASSERT(aSuite, 1 == smallListSpan.size()); + EXPECT_EQ(CHIP_ERROR_BUFFER_TOO_SMALL, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, emptyListSpan)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, smallListSpan)); + EXPECT_EQ(1u, smallListSpan.size()); // Test successfully getting Ids from various groups - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 4 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene1 == sceneList[0]); - NL_TEST_ASSERT(aSuite, kScene2 == sceneList[1]); - NL_TEST_ASSERT(aSuite, kScene3 == sceneList[2]); - NL_TEST_ASSERT(aSuite, kScene4 == sceneList[3]); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup2, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 2 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene5 == sceneList[0]); - NL_TEST_ASSERT(aSuite, kScene6 == sceneList[1]); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, sceneListSpan)); - NL_TEST_ASSERT(aSuite, 1 == sceneListSpan.size()); - NL_TEST_ASSERT(aSuite, kScene7 == sceneList[0]); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup1, sceneListSpan)); + EXPECT_EQ(4u, sceneListSpan.size()); + EXPECT_EQ(kScene1, sceneList[0]); + EXPECT_EQ(kScene2, sceneList[1]); + EXPECT_EQ(kScene3, sceneList[2]); + EXPECT_EQ(kScene4, sceneList[3]); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup2, sceneListSpan)); + EXPECT_EQ(2u, sceneListSpan.size()); + EXPECT_EQ(kScene5, sceneList[0]); + EXPECT_EQ(kScene6, sceneList[1]); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetAllSceneIdsInGroup(kFabric1, kGroup3, sceneListSpan)); + EXPECT_EQ(1u, sceneListSpan.size()); + EXPECT_EQ(kScene7, sceneList[0]); uint8_t sceneCount = 0; sceneTable->GetEndpointSceneCount(sceneCount); sceneTable->GetFabricSceneCount(kFabric1, sceneCount); } -void TestOverwriteScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestOverwriteScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); uint8_t sceneCount = 0; sceneTable->GetEndpointSceneCount(sceneCount); sceneTable->GetFabricSceneCount(kFabric1, sceneCount); SceneTableEntry scene; // Overwriting the first entry - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene10)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene10)); // Overwriting in the middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene11)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene11)); // Overwriting the last entry - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene12)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene12)); // Scene 10 has the same sceneId as scene 1, Get->sceneId1 should thus return scene 10, etc. - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene10); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene11); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene11); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene12); } -void TestIterateScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestIterateScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneTableEntry scene; auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator != nullptr); + ASSERT_NE(iterator, nullptr); if (iterator) { - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene11); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); - - NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); + EXPECT_EQ(iterator->Count(), 7u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene3); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene11); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene12); + + EXPECT_FALSE(iterator->Next(scene)); iterator->Release(); } } -void TestRemoveScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestRemoveScenes) { SceneTableImpl * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); SceneTableEntry scene; // Removing non-existing entry should not return errors - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); // Remove middle - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene5.mStorageId)); auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(iterator->Count(), 6u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); iterator->Release(); // Add scene in middle, a spot should have been freed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene9)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); - NL_TEST_ASSERT(aSuite, scene == scene9); + EXPECT_EQ(iterator->Count(), 7u); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId9, scene)); + EXPECT_EQ(scene, scene9); iterator->Release(); // Remove the recently added scene 9 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene9.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene10); + EXPECT_EQ(iterator->Count(), 6u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene10); iterator->Release(); // Remove first - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, 0)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, 0)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 5); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); + EXPECT_EQ(iterator->Count(), 5u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); iterator->Release(); // Remove Next - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 4); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(iterator->Count(), 4u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene2); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 3); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(iterator->Count(), 3u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene4); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); + EXPECT_EQ(iterator->Count(), 2u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene6.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 1); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene12); + EXPECT_EQ(iterator->Count(), 1u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene12); iterator->Release(); // Remove last - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, scene7.mStorageId)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); - NL_TEST_ASSERT(aSuite, iterator->Next(scene) == false); + EXPECT_EQ(iterator->Count(), 0u); + EXPECT_FALSE(iterator->Next(scene)); iterator->Release(); // Remove at empty position, shouldn't trigger error - NL_TEST_ASSERT(aSuite, - CHIP_NO_ERROR == - sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, defaultTestFabricCapacity - 1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntryAtPosition(kTestEndpoint1, kFabric1, defaultTestFabricCapacity - 1)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); // Test Remove all scenes in Group - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 6); + EXPECT_EQ(iterator->Count(), 6u); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup1)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 2); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, iterator->Next(scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); + EXPECT_EQ(iterator->Count(), 2u); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene5); + EXPECT_TRUE(iterator->Next(scene)); + EXPECT_EQ(scene, scene6); iterator->Release(); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->DeleteAllScenesInGroup(kFabric1, kGroup2)); iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, iterator->Count() == 0); + EXPECT_EQ(iterator->Count(), 0u); iterator->Release(); } -void TestFabricScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestFabricScenes) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -990,234 +999,233 @@ void TestFabricScenes(nlTestSuite * aSuite, void * aContext) uint8_t fabric_capacity = 0; // Verify capacities are at max - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Fabric 1 inserts - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_count = 0; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(defaultTestFabricCapacity, scene_count); // Fabric 2 inserts - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, (defaultTestFabricCapacity - 4) == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 11 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ((defaultTestFabricCapacity - 4), fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(11, scene_count); // Fabric 3 inserts, should only be 4 spaces left at this point since 12 got taken - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize - 11 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric3, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, defaultTestTableSize == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestTableSize - 11, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric3, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(defaultTestTableSize, scene_count); // Checks capacity is now 0 accross all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // To many scenes accross fabrics (Max scenes accross fabrics == 16) - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric3, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NO_MEMORY == sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric3, scene6)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, sceneTable->SetSceneTableEntry(kFabric2, scene5)); // Verifying all inserted scenes are accessible - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric1)); // Verify Fabric 1 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 9 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(9, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); // Verify Fabric 2 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 4 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(4, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(scene, scene4); // Verify capacity updated for all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 4, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 5, fabric_capacity); // Verify we can now write more scenes in scene fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, scene == scene6); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, scene == scene7); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 7 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(scene, scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(scene, scene6); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(scene, scene7); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(7, scene_count); // Verify capacity updated properly - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 5 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(4, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 5, fabric_capacity); // Verify Fabric 3 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric2)); // Verify Fabric 2 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Verify Fabric 3 still there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 5 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, scene == scene2); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, scene == scene3); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, scene == scene4); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, scene == scene5); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(5, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(scene, scene2); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(scene, scene3); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(scene, scene4); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(scene, scene5); // Remove Fabric 3 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveFabric(kFabric3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveFabric(kFabric3)); // Verify Fabric 3 removed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric3, sceneId5, scene)); // Confirm all counts are at 0 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric1, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric2, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetFabricSceneCount(kFabric3, scene_count)); - NL_TEST_ASSERT(aSuite, 0 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric1, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric2, scene_count)); + EXPECT_EQ(0, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetFabricSceneCount(kFabric3, scene_count)); + EXPECT_EQ(0, scene_count); // Verify capacity updated for all fabrics - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric3, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); } -void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestEndpointScenes) { // Get Count for Endpoint 1 SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -1228,401 +1236,360 @@ void TestEndpointScenes(nlTestSuite * aSuite, void * aContext) // Get Count for Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Get Count for Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Get Count for Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Test Scenes insertion not accessible accross all endpoints sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 2 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(2, endpoint_scene_count); uint8_t fabric_capacity = 0; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); // Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Check if scene present in Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Check if scene present in Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); // Check if scene present in Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); // Test removal on different endpoints do not affect each endpoints // Insertion on Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Removal on Endpoint1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); // Scene present on Endpoint2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // Removal on Endpoint 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric1, sceneId1)); // Removal on Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveSceneTableEntry(kFabric2, sceneId1)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveSceneTableEntry(kFabric2, sceneId1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Test the fabric capacity accross endpoint // Fill fabric 1 endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Fill fabric 2 endpoint 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Endpoints 2 and 3 should be unaffected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Verify filling Fabric on endpoint 2 does not affect on endpoint 3 despite Max per fabric being reached by adding Endpoint1 // and Endpoint2 // Fill fabric 1 endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Fill fabric 2 endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); // scene count to Endpoint // Endpoint 3 still unafected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Fill fabric 1 endpoint 3 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); // Test removal of Endpoint clears scene on all fabrics for that endpoint sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->RemoveEndpoint()); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->RemoveEndpoint()); // Check Fabric1 on Endpoint 2 - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Check Fabric 1 and 2 on Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); - - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric2, sceneId7, scene)); // Check Fabric 1 on Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); // Test removal of fabric clears scene fabric on all endpoints sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); sceneTable->RemoveFabric(kFabric1); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId2, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId3, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId4, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId5, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId6, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId7, scene)); sceneTable->RemoveFabric(kFabric2); // Validate endpoints are empty sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(endpoint_scene_count)); - NL_TEST_ASSERT(aSuite, 0 == endpoint_scene_count); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(endpoint_scene_count)); + EXPECT_EQ(0, endpoint_scene_count); // Validate Fabric capacities at maximum accross all endpoints // Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Endpoint 2 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Endpoint 3 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint3, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); // Test of Get with changes to Endpoint capacity // Endpoint 1 sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize - 2); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 1, fabric_capacity); // Test Endpoint 2's capacity remains unaffected sceneTable = scenes::GetSceneTableImpl(kTestEndpoint2, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == fabric_capacity); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity, fabric_capacity); + ASSERT_NE(nullptr, sceneTable); // Test Insertion then change of capacity sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 4 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 4, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 2); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 6 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(defaultTestFabricCapacity - 6, fabric_capacity); sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 4); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Test making the endpoint scene table smaller than the actual number of scenes on it sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestFabricCapacity - 5); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + ASSERT_NE(nullptr, sceneTable); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); } -void TestOTAChanges(nlTestSuite * aSuite, void * aContext) +TEST_F(TestSceneTable, TestOTAChanges) { SceneTable * sceneTable = scenes::GetSceneTableImpl(kTestEndpoint1, defaultTestTableSize); - NL_TEST_ASSERT(aSuite, nullptr != sceneTable); - VerifyOrReturn(nullptr != sceneTable); + ASSERT_NE(nullptr, sceneTable); // Reset test ResetSceneTable(sceneTable); @@ -1633,88 +1600,85 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) // Fill scene table // Fill fabric 1 to capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric1, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric1, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_table_fabric1_capacity = fabric_capacity; auto * iterator = sceneTable->IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity, iterator->Count()); iterator->Release(); // Fill fabric 2 to capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene1)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene2)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene3)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene4)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene5)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene6)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->SetSceneTableEntry(kFabric2, scene7)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene1)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene2)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene3)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene4)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene5)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene6)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->SetSceneTableEntry(kFabric2, scene7)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); uint8_t scene_table_fabric2_capacity = fabric_capacity; iterator = sceneTable->IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity, iterator->Count()); iterator->Release(); // SceneTable should be full at this point uint8_t scene_count; - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetEndpointSceneCount(scene_count)); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, fabricsFullCount == scene_count); + EXPECT_EQ(fabricsFullCount, scene_count); // Create a scene table with a greater capacity than the original one (Max allowed capacity from gen_config.h) TestSceneTableImpl ExpandedSceneTable(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.Init(&testStorage)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.Init(mpTestStorage)); ExpandedSceneTable.SetEndpoint(kTestEndpoint1); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric2_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(scene_table_fabric2_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); // We should be able to insert 4 scenes into fabric 2 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene9)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene13)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene14)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene15)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene13)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene14)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric2, scene15)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Fabric 1's capacity should have remain unchanged - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, - scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(scene_table_fabric1_capacity + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), fabric_capacity); // Global count should have increased by (scenes::kMaxScenesPerFarbic - defaultTestFabricCapacity) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity) == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(fabricsFullCount + (scenes::kMaxScenesPerFabric - defaultTestFabricCapacity), scene_count); // Same test for 4 insertion in fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene13)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene14)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene15)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene9)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene13)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene14)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.SetSceneTableEntry(kFabric1, scene15)); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Global count should be at defaultTestTableSize + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ExpandedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, fabricsFullCount + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize) == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ExpandedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(fabricsFullCount + (scenes::kMaxScenesPerEndpoint - defaultTestTableSize), scene_count); // Test failure to init a SceneTable with sizes above the defined max scenes per fabric or globaly TestSceneTableImpl SceneTableTooManyPerFabric(scenes::kMaxScenesPerFabric + 1, scenes::kMaxScenesPerEndpoint); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_INTEGER_VALUE == SceneTableTooManyPerFabric.Init(&testStorage)); + EXPECT_EQ(CHIP_ERROR_INVALID_INTEGER_VALUE, SceneTableTooManyPerFabric.Init(mpTestStorage)); SceneTableTooManyPerFabric.Finish(); TestSceneTableImpl SceneTableTooManyGlobal(scenes::kMaxScenesPerFabric, scenes::kMaxScenesPerEndpoint + 1); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_INVALID_INTEGER_VALUE == SceneTableTooManyGlobal.Init(&testStorage)); + EXPECT_EQ(CHIP_ERROR_INVALID_INTEGER_VALUE, SceneTableTooManyGlobal.Init(mpTestStorage)); SceneTableTooManyGlobal.Finish(); // Create a new table with a lower limit of scenes per fabric @@ -1722,148 +1686,90 @@ void TestOTAChanges(nlTestSuite * aSuite, void * aContext) uint8_t newTableSize = defaultTestTableSize - 2; uint8_t capacityDifference = static_cast(scenes::kMaxScenesPerFabric - newCapacity); TestSceneTableImpl ReducedSceneTable(newCapacity, newTableSize); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.Init(&testStorage)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.Init(mpTestStorage)); ReducedSceneTable.SetEndpoint(kTestEndpoint1); // Global count should not have been modified - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 == scene_count); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(scenes::kMaxScenesPerEndpoint - 2, scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Load a scene from fabric 1, this should adjust fabric 1 scene count in flash - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric1, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetSceneTableEntry(kFabric1, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // The number count of scenes in Fabric 1 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, newCapacity == iterator->Count()); + EXPECT_EQ(newCapacity, iterator->Count()); iterator->Release(); // Capacity should still be 0 in fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); // Global count should have been reduced by the difference between the max fabric capacity of a fabric and the // new fabric capacity since we haven't loaded from fabric 2 yet - NL_TEST_ASSERT(aSuite, scenes::kMaxScenesPerEndpoint - 2 - capacityDifference == scene_count); + EXPECT_EQ(scenes::kMaxScenesPerEndpoint - 2 - capacityDifference, scene_count); // Remove a Scene from the Fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene1.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, static_cast(newCapacity - 1) == iterator->Count()); + EXPECT_EQ(static_cast(newCapacity - 1), iterator->Count()); iterator->Release(); // Check fabric still doesn't have capacity because fabric 2 still have a higher number of scene than allowed - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); // Remove another scene from fabric 1 - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene2.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene3.mStorageId)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.RemoveSceneTableEntry(kFabric1, scene4.mStorageId)); // Check count updated for fabric iterator = ReducedSceneTable.IterateSceneEntries(kFabric1); - NL_TEST_ASSERT(aSuite, 2 == iterator->Count()); + EXPECT_EQ(2u, iterator->Count()); iterator->Release(); // Confirm global count has been updated - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); - NL_TEST_ASSERT(aSuite, 13 == scene_count); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(13, scene_count); // Confirm we now have capacity in fabric one - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(1, fabric_capacity); // Load a scene from fabric 2, this should adjust fabric 2 scene count in flash - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetSceneTableEntry(kFabric2, sceneId1, scene)); - NL_TEST_ASSERT(aSuite, scene == scene1); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetSceneTableEntry(kFabric2, sceneId1, scene)); + EXPECT_EQ(scene, scene1); // The number count of scenes in Fabric 2 should have been adjusted here iterator = ReducedSceneTable.IterateSceneEntries(kFabric2); - NL_TEST_ASSERT(aSuite, defaultTestFabricCapacity - 1 == iterator->Count()); + EXPECT_EQ(defaultTestFabricCapacity - 1u, iterator->Count()); iterator->Release(); // Global count should also have been adjusted - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetEndpointSceneCount(scene_count)); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetEndpointSceneCount(scene_count)); // had 22 scenes, truncated 5 from both (10) and deleted 4 from fabric 1: 8 scenes left - NL_TEST_ASSERT(aSuite, 8 == scene_count); + EXPECT_EQ(8, scene_count); // Confirm we now have capacity of 6 in the first fabric since we previously removed 6 scenes form there - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 4 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(4, fabric_capacity); // Fabric 2 should still be at capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 0 == fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, ReducedSceneTable.GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(0, fabric_capacity); ReducedSceneTable.Finish(); // The Scene 8 should now have been truncated from the memory and thus not be accessible from both fabrics in the // original scene table - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); - NL_TEST_ASSERT(aSuite, CHIP_ERROR_NOT_FOUND == sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric1, sceneId8, scene)); + EXPECT_EQ(CHIP_ERROR_NOT_FOUND, sceneTable->GetSceneTableEntry(kFabric2, sceneId8, scene)); // The Remaining capacity in the original scene table therefore have been modified as well // Fabric 2 should still be almost at capacity - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 5 == fabric_capacity); - NL_TEST_ASSERT(aSuite, CHIP_NO_ERROR == sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric1, fabric_capacity)); + EXPECT_EQ(5, fabric_capacity); + EXPECT_EQ(CHIP_NO_ERROR, sceneTable->GetRemainingCapacity(kFabric2, fabric_capacity)); - NL_TEST_ASSERT(aSuite, 1 == fabric_capacity); + EXPECT_EQ(1, fabric_capacity); } } // namespace TestScenes - -namespace { -/** - * Setup the test suite. - */ -int TestSetup(void * inContext) -{ - VerifyOrReturnError(CHIP_NO_ERROR == chip::Platform::MemoryInit(), FAILURE); - - // Initialize Scene Table - SceneTable * sceneTable = scenes::GetSceneTableImpl(); - VerifyOrReturnError(nullptr != sceneTable, FAILURE); - VerifyOrReturnError(CHIP_NO_ERROR == sceneTable->Init(&TestScenes::testStorage), FAILURE); - - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestTeardown(void * inContext) -{ - // Terminate Scene Table - SceneTable * sceneTable = scenes::GetSceneTableImpl(); - VerifyOrReturnError(nullptr != sceneTable, FAILURE); - sceneTable->Finish(); - chip::Platform::MemoryShutdown(); - - return SUCCESS; -} -} // namespace - -int TestSceneTable() -{ - static nlTest sTests[] = { NL_TEST_DEF("TestHandlerRegistration", TestScenes::TestHandlerRegistration), - NL_TEST_DEF("TestHandlerFunctions", TestScenes::TestHandlerFunctions), - NL_TEST_DEF("TestStoreScenes", TestScenes::TestStoreScenes), - NL_TEST_DEF("TestOverwriteScenes", TestScenes::TestOverwriteScenes), - NL_TEST_DEF("TestIterateScenes", TestScenes::TestIterateScenes), - NL_TEST_DEF("TestRemoveScenes", TestScenes::TestRemoveScenes), - NL_TEST_DEF("TestFabricScenes", TestScenes::TestFabricScenes), - NL_TEST_DEF("TestEndpointScenes", TestScenes::TestEndpointScenes), - NL_TEST_DEF("TestOTAChanges", TestScenes::TestOTAChanges), - - NL_TEST_SENTINEL() }; - - nlTestSuite theSuite = { - "SceneTable", - &sTests[0], - TestSetup, - TestTeardown, - }; - - nlTestRunner(&theSuite, nullptr); - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSceneTable) From 0ea32d36f27723c7b86a0762f1e21b78190fc2e6 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 08:55:25 -0400 Subject: [PATCH 53/78] [MinMdns] do no stop a `browse` operation after the first result (#33808) * Do not stop minmdns browse after the first result found * Complete browsing for testing active resolve attempts * Fix test to be clearer - remove unused data --- src/lib/dnssd/ActiveResolveAttempts.cpp | 24 ------------------- src/lib/dnssd/ActiveResolveAttempts.h | 2 -- src/lib/dnssd/Resolver_ImplMinimalMdns.cpp | 2 -- .../dnssd/tests/TestActiveResolveAttempts.cpp | 10 ++------ 4 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/lib/dnssd/ActiveResolveAttempts.cpp b/src/lib/dnssd/ActiveResolveAttempts.cpp index f8f351d85cf05e..0b5072bc05e5e2 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.cpp +++ b/src/lib/dnssd/ActiveResolveAttempts.cpp @@ -53,30 +53,6 @@ void ActiveResolveAttempts::Complete(const PeerId & peerId) #endif } -void ActiveResolveAttempts::CompleteCommissioner(const chip::Dnssd::DiscoveredNodeData & data) -{ - for (auto & item : mRetryQueue) - { - if (item.attempt.Matches(data, chip::Dnssd::DiscoveryType::kCommissionerNode)) - { - item.attempt.Clear(); - return; - } - } -} - -void ActiveResolveAttempts::CompleteCommissionable(const chip::Dnssd::DiscoveredNodeData & data) -{ - for (auto & item : mRetryQueue) - { - if (item.attempt.Matches(data, chip::Dnssd::DiscoveryType::kCommissionableNode)) - { - item.attempt.Clear(); - return; - } - } -} - bool ActiveResolveAttempts::HasBrowseFor(chip::Dnssd::DiscoveryType type) const { for (auto & item : mRetryQueue) diff --git a/src/lib/dnssd/ActiveResolveAttempts.h b/src/lib/dnssd/ActiveResolveAttempts.h index 157790b531c3e7..a64a3444474c7e 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.h +++ b/src/lib/dnssd/ActiveResolveAttempts.h @@ -250,8 +250,6 @@ class ActiveResolveAttempts /// Mark a resolution as a success, removing it from the internal list void Complete(const chip::PeerId & peerId); - void CompleteCommissioner(const chip::Dnssd::DiscoveredNodeData & data); - void CompleteCommissionable(const chip::Dnssd::DiscoveredNodeData & data); void CompleteIpResolution(SerializedQNameIterator targetHostName); /// Mark all browse-type scheduled attemptes as a success, removing them diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 5d67c1de892a20..8b2b30e3184291 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -424,11 +424,9 @@ void MinMdnsResolver::AdvancePendingResolverStates() { case IncrementalResolver::ServiceNameType::kCommissioner: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionerNode); - mActiveResolves.CompleteCommissioner(nodeData); break; case IncrementalResolver::ServiceNameType::kCommissionable: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionableNode); - mActiveResolves.CompleteCommissionable(nodeData); break; default: ChipLogError(Discovery, "Unexpected type for browse data parsing"); diff --git a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp index 0648c9880c597b..6d778808f3e669 100644 --- a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp +++ b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp @@ -126,10 +126,7 @@ TEST(TestActiveResolveAttempts, TestSingleBrowseAddRemove) EXPECT_EQ(attempts.GetTimeUntilNextExpectedResponse(), std::make_optional(1900_ms32)); // once complete, nothing to schedule - Dnssd::DiscoveredNodeData data; - data.Set(); - data.Get().longDiscriminator = 1234; - attempts.CompleteCommissionable(data); + attempts.CompleteAllBrowses(); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().has_value()); EXPECT_FALSE(attempts.NextScheduled().has_value()); } @@ -377,10 +374,7 @@ TEST(TestActiveResolveAttempts, TestCombination) // Complete all, we should see no more scheduled. attempts.Complete(MakePeerId(2)); attempts.Complete(MakePeerId(1)); - Dnssd::DiscoveredNodeData data; - data.Set(); - data.Get().longDiscriminator = 1234; - attempts.CompleteCommissionable(data); + attempts.CompleteAllBrowses(); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().has_value()); EXPECT_FALSE(attempts.NextScheduled().has_value()); From d4d9a999a729d2e9bec39b4b42a513fb5fc889c0 Mon Sep 17 00:00:00 2001 From: Sting Chang <33673360+stingchang@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:14:25 +0800 Subject: [PATCH 54/78] add noip back to fix cloud build (#33820) --- integrations/cloudbuild/chef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 95cba5a3730e38..2795c6b5095cd5 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -29,7 +29,7 @@ steps: args: - >- perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && - ./examples/chef/chef.py --build_all + ./examples/chef/chef.py --build_all --build_exclude noip id: CompileAll waitFor: - Bootstrap From 17cda5a1a1817ffabd052cd9b51838efdeefe7eb Mon Sep 17 00:00:00 2001 From: C Freeman Date: Mon, 10 Jun 2024 11:37:28 -0400 Subject: [PATCH 55/78] TC-DA-1.2: Fix for numberic PIDs with fallback (#33621) * TC-DA-1.2: Fix for numberic PIDs will fallback Apparently isupper is false if there are no letters at all. Adds a fix for TC-DA-1.2 and test vector that exposes this condition. Also adds the pid as a variable to the test vectors. * Fix test to use pid from json * Restyled by clang-format * Change to regular expression - added a new test vector with the non-numeric PID - confirmed in the log that the test failure now happens on line 81 rather than line 90. This is a manual only verification, I am not adjusting the test-test to expect this, any failure is equally valid as far as the test-test is concerned. - remaning tests are still correct per test_TC_DA_1_2.py --------- Co-authored-by: Restyled.io --- .../invalid_paa/test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../struct_cd_cms_v2/test_case_vector.json | 1 + .../struct_cd_cms_v3/test_case_vector.json | 1 + .../test_case_vector.json | 3 +- .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 3 +- .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 472 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 472 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../test_case_vector.json | 1 + .../cd.der | Bin 0 -> 235 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 463 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../cd.der | Bin 0 -> 236 bytes .../dac-Cert.der | Bin 0 -> 479 bytes .../dac-Cert.pem | 12 +++++ .../dac-Key.der | Bin 0 -> 121 bytes .../dac-Key.pem | 5 ++ .../pai-Cert.der | Bin 0 -> 463 bytes .../pai-Cert.pem | 12 +++++ .../pai-Key.der | Bin 0 -> 121 bytes .../pai-Key.pem | 5 ++ .../test_case_vector.json | 10 ++++ .../credentials/TestHarnessDACProvider.cpp | 13 ++++++ .../credentials/TestHarnessDACProvider.h | 3 ++ .../tests/TestCommissionerDUTVectors.cpp | 2 +- src/python_testing/TC_DA_1_2.py | 3 +- .../test_testing/test_TC_DA_1_2.py | 7 +-- .../chip-cert/gen_com_dut_test_vectors.py | 44 ++++++++++++------ 195 files changed, 380 insertions(+), 21 deletions(-) create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem create mode 100644 credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json diff --git a/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json b/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json index 8b504a8a1b8997..b592004400ddf8 100644 --- a/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json +++ b/credentials/development/commissioner_dut/invalid_paa/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAA Test Vector: Use Invalid PAA (Not Registered in the DCL).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820172a0030201020208567d67fad563292c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3231303632383134323334335a170d3232303632383134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043e84ccfb667a1d562229015913124f85e7c62d6f1393a21327fb3e4dc4d6e7a425b00dc77250800c07a90311bdf4f70dd85a70ec7689a45a9f063c1bd03508c7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cd5158817cba8798bf2d4c3823403a78b26a6e2c301f0603551d2304183016801460299f6439897e6f486e5f7237cd98a297ad48e1300a06082a8648ce3d040302034900304602210088a0246e9fa3314477108d6ca54be5f085d49280dc443fe36d7142b35fa7661f022100deb66d515b10a85e3da566fcdacfd6809df9969281dc6c18aa3aa397d10596fe", "pai_cert": "308201c53082016ba00302010202087a29a4e6ad8c2979300a06082a8648ce3d04030230393137303506035504030c2e496e76616c696420284e6f74205265676973746572656420696e207468652044434c29204d617474657220504141301e170d3231303632383134323334335a170d3232303632383134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000447262db2383a51c1064c0f19ff281526a8a2d31186f26e4e99435d00ed2d839184dbfa933bb69f5d2efec15558d35306d9245e926f59a69fe3018bb7ca63928fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041460299f6439897e6f486e5f7237cd98a297ad48e1301f0603551d23041830168014135ad5c6f7b95c524f346cbf2e9c124d9fbd4e2d300a06082a8648ce3d0403020348003045022100f9a560954e98b0b3ff621166727664d689a41d3b4cd107c3e87a9145b3384a8a0220586b4ad7f4c2c7c333e9cdfe3d37065d238cb7498e7629e20964e501f4a7beea", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202f6fdf1d3e5587c6e6f4d6f2015b1a2b69a22768efe10bfbbdcc7f7c53e81db202206f4bcc3fead88b2aebb9a1ece815b5f20fee350d96127e77150d9a7b024d073f", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json index df138046c675f3..14056dd7e27db5 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains one valid PAA which is authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa003020102020866dfbc08976c91be300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000418f3f19bd1c766d85fc6f3f86773b1b3a245c4928fb24b3430294c7d3f43c26866b5aeeac77dbc8ac007195ac0ffa67412e63574a370ec024abeca5f30aa49faa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c154ccb722ff1bc9ed9f91aa597eb1e97039eb1c301f0603551d230418301680140c0527c403c6de10a5fde5c521bbbed4f0f88732300a06082a8648ce3d0403020349003046022100a5598c46a8b9991d5c488030eb6d8e6bbc6959774bac0838064d287cc1cbe485022100bbc7ba9ef547985f4956f8a65bacba7e6ebd6317ead65ef59784894e44d809c0", "pai_cert": "308201d53082017aa00302010202085cbff391288347ef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b360814283520ecb9fb9c405780a2930bc7b833ae4106ab1259fc6d177c54edf5d4725c30e400f542ca865f7f2d74b315e0ff7b438040f75fe1128142c6bc3daa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140c0527c403c6de10a5fde5c521bbbed4f0f88732301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100aba3cf5b385fa705ff1e2b49a067d6140c591797fadfd8815e52918a77b09c430221009434b1902c4306c1300224152cf04f56d353bc6d7953005a5edf9afef94164f7", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304806092a864886f70d010701a03b0439152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b1818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203e95e0d9d4324d9fdbb38d6880285888828427759c03b8763bda4e43953fd290022100e030484f70e8f937175c28d1ce575bd612251a4b1d83a0365a2374c613933487", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json index f88b7b80090cb7..422334bdca5ded 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains ten PAAs none of which is a valid PAA authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208619d97b52a9bd8b5300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000444ee63eae77e514b74f16a0ffc056f5cc7e15b50be36fa820f53c8f9db55f3abf63a2d9e801294ba8856aa3b8a890331068c7e91290069951fc8b7878f689acfa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041483d1ac698457e8200c643f7dac654164e6b0c676301f0603551d230418301680144a5d2c6304ac0c2e83759550647d8d2f45cb2b14300a06082a8648ce3d040302034800304502202484b475e7db3bc35b156fb4d4987fca8522f4ae2ac4029ba2a07441d9e22073022100b68d656f8b07db08086f29d1a26a53b3446767f797bb8b1abef5ef18842ee907", "pai_cert": "308201d43082017aa0030201020208079e93d07530dbf4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a70f9af70bb9bf2b302ecbd0ef86193ebfed1136bb62a9b115792a2b7f9ab0a920ffa8e7ff5f88a4dfbf211c5a0cf08d7265bc3513aabdf22420cdf4918f05ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144a5d2c6304ac0c2e83759550647d8d2f45cb2b14301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100acfd6e9ab1c356e6539f5208e6146627be56f80ced4fb39217e28fb7c23d0f5c0220214b75d6180d62c8d4afd7d32be976b20fcc40c1b362976b5ba65db13a1d9623", "certification_declaration": "308201d006092a864886f70d010702a08201c1308201bd020103310d300b06096086480165030402013082012806092a864886f70d010701a082011904820115152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10140b44cabbc5016577aa8b44ffb90fcca140fe662010140bbbcabbc5016577aa8b44ffb90fcca140fe662010140bbb35bbc5016577aa8b44ffb90fcca140fe662010140bbb3544c5016577aa8b44ffb90fcca140fe662010140bbb35443a016577aa8b44ffb90fcca140fe662010140bbb35443afe6577aa8b44ffb90fcca140fe662010140bbb35443afe9a77aa8b44ffb90fcca140fe662010140bbb35443afe9a88aa8b44ffb90fcca140fe662010140bbb35443afe9a88558b44ffb90fcca140fe662010140bbb35443afe9a88557444ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203d4581e769a71482498f4fe9df315e486ed838951af4aad8fa94dd8ef5bf3c63022100f24ac406238eb617e7a9c18b16938bfd4540a7aa106486d37468fc3b411855e3", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json index 679398c44cbc1e..62e64dec078a64 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count10_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains ten PAAs one of which is valid PAA authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208164c0e740ca45824300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000463aff759bddaee30f45b5b4a486d4f9fb32de4c698720054d3e95333a6d71dfb19e40a04f5c5eb4a535090e102df06e2ae8e02066bc086829f289cc9f3b7915aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414569bc3bd997dc682c1c714157c139710a38776ea301f0603551d2304183016801407a710a0ff13d00df63a9e5c8325174c5f08c8d0300a06082a8648ce3d040302034800304502203a3e6465f2cb66b3a61e2b4a44cf4a4084f4abc76a97471e3ffb444ccf1f3246022100f1e5cb7f071aa52231a4bdaee309ea3372b98875910ea14aedf76ad3f6721bc9", "pai_cert": "308201d33082017aa00302010202084feaec9a37c9398e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004142c31ebc29a3d6bb04a18ef2cc6e7648634fdbf9d3bb2c91a53799b9f458456db64372997fe1727ee95e95a2382c0b4066e2df9dbef78829d2b5b6d8e7a2a16a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041407a710a0ff13d00df63a9e5c8325174c5f08c8d0301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207e75cabe27de00bb184983ca5443416e7976c1de5f8b8a82df70444373d42cb5022077a43af72e320fc74dc1d76a859d10c700b2ffe5a49ec2d23753f27bd7f19b34", "certification_declaration": "308201d006092a864886f70d010702a08201c1308201bd020103310d300b06096086480165030402013082012806092a864886f70d010701a082011904820115152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1014f4bbcabbc5016577aa8b44ffb90fcca140fe66201014f4bb35bbc5016577aa8b44ffb90fcca140fe66201014f4bb3544c5016577aa8b44ffb90fcca140fe66201014f4bb35443a016577aa8b44ffb90fcca140fe66201014f4bb35443afe6577aa8b44ffb90fcca140fe66201014f4bb35443afe9a77aa8b44ffb90fcca140fe66201014f4bb35443afe9a88aa8b44ffb90fcca140fe66201014f4bb35443afe9a88558b44ffb90fcca140fe66201014f4bb35443afe9a88557444ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201b10656798c6360de20e30e2ebd93fa776f78eb347bc178b92064470080cd972022100e6c798a2c4dd0486b927c99d40c9a01994fd8f5000037c26e5f2bf5f3492192e", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json index 87dca92b8aaf4f..ad6fa8d2751c68 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count1_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains one valid PAA which is authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202080e5146c5fe47ba0a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004447eff6c579f3ebb8014886ecd2031ed2b22476986c35d5db3f1516f8335aa785e9e5d5b8b1ba5f0aee3cf3dcd9f84f5431f6bae2a15a207b4a81fb0540a50d0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c54475ec42f837b7b11d186236c6329607c5c23f301f0603551d230418301680140a620b8d9e1b8da6cb6f22b275a464e4b41938b1300a06082a8648ce3d0403020349003046022100dec569252bcde62ff937f3eb5c312c437cc1cad7736b145cc5c55f7e4beb2c0e022100d79dba6ed3b1c3956f6f759f20f1472415d095bef53ab65cba0b3c743d1709a1", "pai_cert": "308201d53082017aa00302010202082a474a51bba41ea1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000420fd963ee5c8a978c5b8f2bde7262279bf5517234f93e6dded3c23baf4e53cfb886ad83a82a0791bad434d0d72563815bab9a0a48fbf15489770ce77adabba31a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140a620b8d9e1b8da6cb6f22b275a464e4b41938b1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a859075ac87461eeaade52383d8d404f7f2ed41d0bf3535f22a670c7bf393b73022100e8be368b400f6ac406e03c3a85f93139e06532b23e8547b67ae35099ef40fb48", "certification_declaration": "3082010306092a864886f70d010702a081f53081f2020103310d300b0609608648016503040201305e06092a864886f70d010701a051044f152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1818317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100bac36c9f830bcbd49e07dd670d042df0eaa4ae1cf5308d39434fb0e7851402e902210087e279dc232a5eb68c74f19aec946ad988edfc35ac4a420cce36a1ec49c76d50", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json index 6572e21fc6a121..8d87d9342222e9 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count2_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains two PAAs one of which is valid PAA authorized to sign the PAI.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202082f03484bec0943da300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042c87804f5ccad479b3aa938377a54abdf689c73095f838cbf43da9dea9222e9dbcc335ad71c5175661c21604ab987c5903a5dbd8b0c4ca25104e5976d36c93a2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b5a9d50d21f956fe36544446e157e356263a3d80301f0603551d230418301680145bec2478a2da401835a0815cb4656ac4b92b0ae7300a06082a8648ce3d040302034700304402201734e114e6f6ae2c7c90b3ac5f74fb297a364fd871bf1ff4d3e78088a779c4f102204999daf1f02a331355a05bb4d79a6292726b90fa448ede1b0d052ca3e0af1dce", "pai_cert": "308201d43082017aa00302010202084663472106a76044300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b86e0da6af949217ff8df3257336ea0621ca53cc52e44a227041e32dd57a13b9ee68f33e30c13186d1232f0f44f0b004b6fd2d953165e843608a5c5750f2dee3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145bec2478a2da401835a0815cb4656ac4b92b0ae7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502201c3245a0ea743d922bbd3fb0496a4a1876941fbbddbed0d3f1a0b610655a9b3c0221008641b5be85663739e8356fafcc2057475c27cec37426e2e70417f69ffe673b74", "certification_declaration": "3082011b06092a864886f70d010702a082010c30820108020103310d300b0609608648016503040201307406092a864886f70d010701a0670465152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10146afd22771f511fecbf1641976710dcdc31a1717e1014f4bbcabbc5016577aa8b44ffb90fcca140fe66201818317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b47d3b1973b72fd8be80ded8c656a3adbb98928c0d4d8f9a0bcd864a68a49d66022100de3806359f877fb51ab36e3620f873bfa07da372bc71c9d1f1407a84da6996d2", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json index 633ca150855dec..3a5a370d22c2ed 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_count3_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The authorized_paa_list contains three PAAs none of which is a valid PAA authorized to sign the PAI.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202085dcb3bdbfd318499300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fa5e5d04fdf0bd8426495e3be7da6c9a83b9508a71f414fd41451bdcdde86930a85f64edd0a4ec66ecd9ea50bb2e1f5acd9f03b1b8f2c42e710886b38f432d18a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e378ed232ba0dca7ce541f8491bf217ca1d6742d301f0603551d23041830168014057dc0978692d229cb6ce732dbf8356ffcfd3efe300a06082a8648ce3d0403020349003046022100ffd65e1b7c352ad3b5db13770c5529b8b7a6693642801f07b92b49d95700ac76022100c21bf59617b444315dfbd34b35bb8eb6cfbcbb7de268210d4bf69c156097c108", "pai_cert": "308201d43082017aa003020102020812ede62cc86d392c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004161820bdda95f711e0fedd3a8d060f273c36f9a03ff7b105ff96fa7e7df0b2f951f8022f869570fce219c8f3e466881bad898b6265a8f8a2c6c5bff306761b71a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414057dc0978692d229cb6ce732dbf8356ffcfd3efe301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100acb6985b132d11929f78b38868be8b7b90ac73fd27b651930686b442d4c91a6a02201cc4b54f753703bcfe36eb4f298cb188b4a8814b44fa872d0584ccfb4649b389", "certification_declaration": "3082013106092a864886f70d010702a08201223082011e020103310d300b060960864801650304020130818a06092a864886f70d010701a07d047b152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800360b10140b44cabbc5016577aa8b44ffb90fcca140fe662010140bbbcabbc5016577aa8b44ffb90fcca140fe662010140bbb35bbc5016577aa8b44ffb90fcca140fe66201818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221009358856426dce2550347c9c5f52c0c028193de36adeaa73afc14708e01805be302206c29d9e9926df3f0dca2e794d6a1fc5de880e94626b7be1edfcae8996af22479", diff --git a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json index 1ac95989ce5e59..ea30a8c98546ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_authorized_paa_list_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The optional authorized_paa_list field is not present.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202086b9269307ec22f16300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004624dc0f62274149af021e4ad07a45635aeed76ff456d837473151de65ed2178962968f8e944a496f86b3300064ae32d4083a5fc8d32536fe83639b3c884aeebaa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141b3044abe088ea3aa56db5b2d66c5a057e8fb522301f0603551d23041830168014f0ed3106a93b842028dab233a73b796931529304300a06082a8648ce3d0403020349003046022100b4856c9f0ecde3572e807a7ffca098cfd21e808939e43880d7a7f3eda28987d9022100d865e23b12e835b38619e2fcab91edc46f5d6ff7b8a7cff98fae4ccf066a9cee", "pai_cert": "308201d43082017aa0030201020208473df880371ed255300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047c8294caa384716c2235fa8e6203aee8267cd97ab723234a66dddcef9adcfef9a341b00fb921f866c912381c2a19fe241d6f065e3bf3a5ad0ae179d106017d85a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f0ed3106a93b842028dab233a73b796931529304301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100a0e8962a88901e2aac1ba5bb04d87a9947ea7683ec3339e39469f88ba1c835f702201c929aee77e48c5ace4a7610bf526532f8eab67ad1927d19e96ae7ea0e3e0541", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220763d8156ca34e8b88c06570e73192f4a424eb7db57cddae2fcc88b3921b57364022100ceb7da4b891c5044ac391fa251f093a6488164ffa745397005ba36a935121457", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json index a9942fc7b01fc6..294e14f61dbda6 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_len_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field has wrong length.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083619fcce7a54254f300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004a48090410a0ee48ac198ceede10cd2c2e2c0ee0ab2bbad2810830ed9671dac611b0827af584a3474eba8b01f9b70dd3ba6ebd46f6c579a27b0c2b098f847232ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ca2506782dded38684c13090e61b932da62255cd301f0603551d230418301680141d45428a2e2c60ebae19604f9be6cc9154a30460300a06082a8648ce3d0403020349003046022100a0bfeb462544dc65359cc1c774004ab7057566e73738eba9ac1b858292560cc3022100b77bf8015dcafe539df52072037cd121e3bd51d368c246e552a34b232146cf3f", "pai_cert": "308201d33082017aa0030201020208495a434bcef0386e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000481628862f3c9e7492c3b6c805f02f1f0dfd0097c794ace554dd195003dbee1a47e5e3f1ab560dfe9cb5e5323c84d73e275e329b36cc3944aabc354e77afcfea2a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141d45428a2e2c60ebae19604f9be6cc9154a30460301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022073278ff5a49cb8ade2d11b810666f15a61f3eda4670463a932284fe07f18bccb0220241cfbd676c9dc57521e5c6736c195e73ecea61adac39ac5f6cbaba4bc947483", "certification_declaration": "3081ed06092a864886f70d010702a081df3081dc020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04175a494732303134315a423333303030312d3234313233342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ea14f344941e870353931995ed58dc2d168033d62ad0959373e2da6df7b3101d0220040391e1aa30f7212ddffc046faa4bdccfa7eb85de1d9bb497946ace6f68ea6d", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json index bd6dad51a51a48..9a931d0a211b48 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field doesn't contain a globally unique serial number allocated by the CSA for this CD.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202082ae17382e13a7119300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000464f5306b94ffdf12d7a7637a227130e34e17e60b956e728a28e65540b40e3cda41cc1105a1ef31fd102a3b5ba92446f79667cb65b72749bed53f9642d22a72b4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bb0ad484b4ab92e415e93d8d09e74105d45bbcf9301f0603551d230418301680149ec378a76a02aee9e859d43c3faa9af0cbf39f0c300a06082a8648ce3d04030203480030450220412ad16a485425c8868f4c19653c9306edfe2c039bc76f2144ae3ac97229c7ad022100bfcee30b78cd7ac4feb628f99bcb3c52bdd16035b34bd42dbd904e5e1ccf0b81", "pai_cert": "308201d33082017aa003020102020874ff7f5a21618e7f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f1cd573340d3df3967e4dd1c378c64b2cf0b8537deb67049b0b94a8b1d30f84e701b3dad5d9184e2e86904976bcbeda94996ac34e7b24051f41bba397ba75f0aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149ec378a76a02aee9e859d43c3faa9af0cbf39f0c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022041d3f40b2c1e22f41bfd5d6e6d3261eac42a6072baaf6618310ec33b105b759602206c45a3b31692243fdc1b6ad11bfac7834cc388535af914fa27c0341494cd7f2b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c0413494e5632303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203e409fc0be4e30cbe2c02a022519e2ee602a986df2f35c03e0b1ef0e076b3f62022069f6216057ae3319b80c4d56f5b6bd550f3506ac1252fbac7554542ecb1a2fd6", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json index cd13f02d943510..d745da16632fb9 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_id_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certificate_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202087ea6b3e63ae97177300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042972e5bef8a607c74269b7588bf898eedde3bccdc3992691a70e44a6269dcaaac04a52e82b81266c84738358942186b42e234848150fac84e8eeab3cf818163da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142853b2227f79ab542a266240daf3fda19d893371301f0603551d23041830168014ab730a7e9b73e7e65abf187b6e429d8a086946f1300a06082a8648ce3d0403020347003044022076978c4d1ae2636b8d936162adad9a596f00be855506afac5564abc0363aa1e102206ac28f4964c168d50010a926cea6a200afe03940a7d98e1a70c6c55c1fb8c0d4", "pai_cert": "308201d43082017aa003020102020862de19dd9e730905300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c5db54bb35840be7935426f46facbfb7472be15c30f1a2be6c9c31b51f8f815354b94a356a99e8e256e21db622365086b345804ae91e34b5c0cd97f0f1c9938ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ab730a7e9b73e7e65abf187b6e429d8a086946f1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ab728f28fee7b972fb9b0a5101c8fb2b41e2efab825f91df548a0b891785f40d022039427ccee45e76b7ac2dfc35f7e1ba042605095586947aa10fd2316667290389", "certification_declaration": "3081d206092a864886f70d010702a081c43081c1020103310d300b0609608648016503040201302f06092a864886f70d010701a0220420152400012501f1ff360205008018250334122405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022056ff620b0fd9551f2f66c49370768b42a4784cb291b95a7890e8ff8f8633977202200ebe80082d30d6e1e9c83b7e370a0f1f8fe5974d26e3cf9aa392e96b139973aa", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json index 4f2a4fb4e91575..7a0ca0c3dfd3ad 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_type_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certification_type field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080834f51f89b212c6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041ea075a3f408cc172ba4aa7c4d1ea97aa3edc5835c90a8c5375d0f0f449587a9bf21bd56f563260cb5549d546a2b0c394f650f8730b7f3ae69cd0877ad235dcea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414798660df8cec17e8ae767e680d831533c8081eb6301f0603551d230418301680146cde5ddb9319d4e60c20e8d2c66f1a0f62e1d014300a06082a8648ce3d040302034800304502200be4a2179b5ee5d1977a20cf1cb354df2045675b768032ff7a3e4ee0679d3664022100f654bb5dba82f43b27d791fc1ef228e1fec0b82c352f8321f01135e5435ce958", "pai_cert": "308201d43082017aa003020102020840f0908c93495565300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048c5edea82008e14fd7d8d9af5cec08d653d990120b3814fb836fe3db262fd1b5daea3a273a799b7dca990ca9e35383a751405221b0d7a5e62954881262577c52a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146cde5ddb9319d4e60c20e8d2c66f1a0f62e1d014301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220324de9de382052b2aa2aae5e96b32ac90c01022fe642b3fa17be32efe44d15fd0221009e41b8ba2dc2471012c804b63acc80718c77afdcd2a0b70d5830564eb66e739d", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769818317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022036136361524f160beacdd64b6eee06d1032448bd1ee371bf65afd46bc3ab1d3c022100d22617af7d9eff14c59a416577e1418e6f3ece0260207af0fe9e1c853ab82576", diff --git a/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json index 3d26c2b7eabeaa..fc9af3524486b3 100644 --- a/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cert_type_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The certification_type field is set to invalid value.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080949f08e6e414d05300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000403d434b1f209dae90b4326eea4bf966e6d07fb13550292852f79850ea904ad86d29f9700529e380320f398de5b49defd888b1c1afb431ce98dc843ac115fbcc0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414edf7a1d367a5ce829e4868adece1260ef0244d9c301f0603551d230418301680140697d80ad514db1aa6f39ed4656411ec857d7d8d300a06082a8648ce3d0403020348003045022100bca4338871ede720a51769ab758cece080330d88597907a2a020647f776f6912022016a5c97d4941ccfda32abfa2a055f658f42a644952b123d450568ff6b9d08da6", "pai_cert": "308201d33082017aa00302010202084347b700bedeec12300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ef003fb502869af99800bb86f629446c2135c576b0b479a7f0e7370ebde491faef37eb6a3dc96f772add28df97e6b9042a331b223f8ec30d53e270eb9846a48fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140697d80ad514db1aa6f39ed4656411ec857d7d8d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402200d3d073dd237778549c97f6fac3d459c52ed829d9f1fa53fe8dc4d5b3c09459f02207354b134ea4f5bd58b9610213eaee0f0120178eb19f4a203812b74c8b3176d65", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408ff18317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008a550a3a379571c8f81f5b17e786e4bfdfbcba3c7075e01b5dd25c7b644422000220551e26c99143a3850628d4f1206bb5895d9b82b25330bb84cdcd6197e5cc9be4", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json index 74100bfacfc7ed..dee527ed1287da 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS digest algorithm SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020818d5679a80c485be300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043f504a85258308105d789fad8b9686b3c1f8e94c253109625bb1de84587de360dd12ab2fa97c913db03e8f37197e8ce2395f3e9b030ad8ab1ddee1a4d6287142a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a5f57dea9d8dce16995a071a98485ce8cd5a29a3301f0603551d2304183016801486797969584455dd4955e8de31dd2e3bf0b8786d300a06082a8648ce3d0403020347003044022057787dc1a1ae060af9e2db9b4472c9e3a80b3fc659a18175d8aa4aafd4bf25c10220045ec44d104531961904bcccf2967b437708fbd8f66c1b1579a18d25e9785b4d", "pai_cert": "308201d33082017aa003020102020828b15ead56d26dcd300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042ebac935e9ea61e7f83e2a89d55aed38e57afbe5b6448d1cb4144c9cc5e65b10f55f6d2b981ebe9fe7e89445faec11f4994398edd61c30e8fff659ab1a556ba9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041486797969584455dd4955e8de31dd2e3bf0b8786d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203ae85c041ce766ce393d942d1cce8c4127cec8e61ee0742747b07a4ecbe7163e02206e2b81a014e84d818db39ff79e8701f7b1fce24b6158c20df9e5dd97b912920a", "certification_declaration": "3081e606092a864886f70d010702a081d83081d50201033109300706052b0e03021a304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ca28ee68583948a3197e804cdd8db6cde1298938b157af05d52436ca87e8f1bd022100c3a8e7b678ab18cba8d0d861ec9900b09d881f306b379f4acf76ef5b47555d74", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json index 2ff179954db243..4a96187d322c1d 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_digest_algo_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS digest algorithm SHA256.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020823dd9a7ed09f8bca300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040a520fd80573f5a8e69d46b5a8cc5874e10e157483c5fd4cca2a12f257423f38e4feadff92a346b8bd0354efe37b06013824349157102a8de8f4d22f07cf3544a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414250fe8cf813e21ea28829809fd34e001c392f1f2301f0603551d230418301680147ed74a75dbf1b443c03c9043a2723cb8ad8b7b32300a06082a8648ce3d0403020347003044022043c151192dba83944e615b22848091bd9ca4bc92988512d2609998fe0d7d33e502204e853e7bc3780e452db55974d49798f4cb8639913c6562c973abf3c03f73f873", "pai_cert": "308201d43082017aa003020102020806e8d71f2f54cee2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040396591399bd5e0a035caca49b67c4c41516cf6b16128710bdb199f5aafb73d1c47b3baeb8171e2eafb2bc7386428f850ad8f86852b6d5b93a78494f47100f5ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147ed74a75dbf1b443c03c9043a2723cb8ad8b7b32301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100f581bf20a9a51e35d66612740b6a92ce8e47ed1a30a0053b3616048a2550f237022051bb511dd78fe973513c42210611e9d98168a65b2067b0d58333c4c54df42ae8", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008433a32e83d025d8463a54b34e6d99f96bc2bfda0c8c2c24d8b2d6f365995d5f0220116b9124447deefee2e09457b871be791e2bbbd1eb5f7abf75916e379bf71418", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json index 4c0dc45cf7f2e6..99fbbe1d1aafa5 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_msac/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS eContentType is set to Microsoft Authenticode [MSAC] OID = { 1.3.6.1.4.1.311.2.1.4 }.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa0030201020208488516846e71dd57300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004aa2757988c72225ef0fc4b6f8ebb93a10efc1a9ab5b846f0f1e39a7fff0b4b09e4789ffd42713faf5d33c26bb785118b470573969681b5dc24bdc325318ca23ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148f363885e2769db706eb333283e16bf32a7e0f25301f0603551d2304183016801473f3119b54e7a2aacf469813b2a5c9308ceb5213300a06082a8648ce3d0403020349003046022100de1bbb4ceec70e791c2576c6690814e3523cf8656a140ff8a0843b2546fadc95022100819e50615e8e5b086794b4b5f879a55056e14fd25361c38c2dbf8e7b945707bc", "pai_cert": "308201d43082017aa00302010202087a315f5afa0c9264300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004334df1df5da93e2d7550d456c380e51457d28705dd1a07b67ddae3e8d9ffe2ab334ab4bf25f93422f3a61fe588fd6e285886224b06d6600230724de11e5c36f0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041473f3119b54e7a2aacf469813b2a5c9308ceb5213301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210090e20b2458c96f3a75b43382f516b23dcd51c865a48d2722a27c9c4ee5f6197b0220439546386978c1586351f18f114924d74b000258b40470f96d4ac199d65abc05", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b06096086480165030402013048060c060a2b060104018237020104a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022024af5a9a1b5a67ad88ca2f457651c20a77d610d246727b14fb120e81ec044fc3022100867566c3b058593b135a2cb076c28bbf59bfe711caa2c38462abf0ebf1091d0a", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json index 2980c02f17585e..13f64bec93a4b0 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_econtent_type_pkcs7_data/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS eContentType pkcs7-data.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202083e4c735a19aee98d300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041490bef16049b1efc6a4fcc93497a0954c4e5adc291678919ab22848052462e2f1d811dfb90b9cd2b6eb2069a2b0af801678f14ea001accac3832823273ed422a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f337a308dbd8bc2eaedadac926102341e8e45414301f0603551d230418301680148aa728da3e1784ab9c2f9222f12ff9d290391e9c300a06082a8648ce3d040302034700304402201f166f6c46ec16173b8fd9e55150c8447dee1f263b4de947f5576a5597444f6b02202eeae9d033308b9a289d4d256ea260a2fed5b169beafd18e68e2d59f3702726b", "pai_cert": "308201d53082017aa00302010202083b1196f67de3cab3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042a8975640240b47be77d90d681b5b99287d8501698628ba0d0947f0b646105ee89b0420ee73db8cbdb112cfc7ef2d79b66b7e691997c6bf7328c2b9c6b8110daa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148aa728da3e1784ab9c2f9222f12ff9d290391e9c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100bed6ee124a57397d0367af396f5433cef76191a6b8cfbc0e62687bb8f5a4a5ed022100e8140314b376852700b05eae972f376a7d38cbbe5cebc23b337c2d204bc5730c", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100adf29a65c3a84a1a19e2968b997ca529fe579de5c8250a2bbd091c201dad44c80220797e85e16cb511d67a52b185a742257f9a81e7fde48fe6555adc85a2d467d649", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json index a137093200a2d1..e46975d8039d2a 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS signature algorithm ECDSA_WITH_SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202086e0e9efbf1d9619b300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ec8c006c94cc032fc31de7ec8a7f0dd369175eb498cb1431745fc735ec3400912e0007512f73c0a72702b6373306e5c77dbb51b0fba27cb6e64f4d1c63ff53cfa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e455aca399560ce0fe06340a873a8ddfeaa58293301f0603551d230418301680145fb6d29163ae281d11fc7d89d8aff9da82da0e3a300a06082a8648ce3d0403020349003046022100e55f49bcbeb91907fdb1fce4192609bb42ad53ca4ac2df72ca550b7a380175b90221009461916880110ebdcc76722c978e5cc6f5ffa0b323a64e92d77d6b24e1c0848d", "pai_cert": "308201d33082017aa00302010202082970bad74acfd368300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ce94c57d7d3497df1be2950842552cc9dddf988a32a9b5310c1e10ad3e366d29ec904f5a9511024ad9e3e539421ce9220017998a7d43d0c06738e6459be57edda366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145fb6d29163ae281d11fc7d89d8aff9da82da0e3a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022075023bb0ea584b1a3429e3e15d00ca893c8767a06d4c76711f49a3ab1826d5860220769ffe8ab8bc468f1922423ae8a8280cf2d9d8cfaa8258db7ee69adaa33a1439", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300906072a8648ce3d04010447304502204cc9271c804ece5ea89f06e0c63843c795506a4c3a1d28f4a46d47c29c7db63b022100f461d4e5f10fea7f3f1ec0e74914c652a84cca9405391f77df497cb872bda61e", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json index 4a998f32779145..97c5400d0ad111 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS signature algorithm ECDSA_WITH_SHA256.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020832f4324184fe4e26300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040b3f9dbd1212fac0046edae04939d851270e165277fd8cb122b337399f661992fc0ee93b530af6f83f1ed6257316f867ef78691d14b2ae5aec98551ae7586a05a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041406eefce739159031955de59c8885f5ab8a17ba10301f0603551d230418301680145d4290b1c895bdb7706aeb0d1391d2115c5c6a21300a06082a8648ce3d0403020348003045022100ac3bb9c66d2ebd94b7afb9d1fc249c6371f4d8e22bb03636ff69acad5cb03d8d02205ce991efe36844eac83e9205ca1edd35ceaf4342b0547f96bd1863be3f692600", "pai_cert": "308201d33082017aa00302010202081aa79db7a1e4ed1d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004690252fd790882bd9ceb5c85ab843ac5c5b431600f6eda945b42d84d5d1f364e35ef60479a1a6d8244abd0bdc5448ef55cb591c1028e276ac7f045b178bea061a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145d4290b1c895bdb7706aeb0d1391d2115c5c6a21301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022022745fb78130a7923813eb860c7192770d82edc1c2cfe5317c2afe314176358a02200582f0d8c79c986ec179ec71269ac7e72fe100fc5b26c939b05abb19e13c994d", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220706cf8d088172ff3b477993f8e8c52a1ca8e55f9dc23d3945d8e1e8a4175d90002206f000bd775a4f8018cf0ed95eb2602f962c98d033addf86e84f350abcdf58e36", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json index b34880a9f677d5..51d064472a34c8 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_signature/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS Signature.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080d61e11583ee4e71300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d05f76a3b237cc3738ae7f7a03c3d93fac6dd5077c1ee18e124ce4d622914c5858b3ec97d1cce1ab1207b87fa81470f9ea2e709f66f42069dc4f483403716a20a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ad24fabacde3200591249cc2202f301418f5f4ff301f0603551d230418301680143185d867b334051a85f7b446aea68468c9678bc1300a06082a8648ce3d0403020348003045022100e79aa67f04087d96780f68ecd48745ed742b57b6cc58989988a3b18860c74eb702200d7a265d71ea0f79ecdb906678789742fa1bf9d6d3d99e8d53b62bf8d9f7b349", "pai_cert": "308201d53082017aa00302010202085df1c32d21c0d0e2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040cc77a443329420741dc26ee955a8361dfd2174a7e81e7ed376ff3c9489110fd8f8ab84cbbdc21ef34b067370ac94dadf01cd286dabb6681ea9602bdc54d53f6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143185d867b334051a85f7b446aea68468c9678bc1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100f05b93f95b181aca7d3cd55a73f5f4a561fe52f408c501df842eb9a6089ccb22022100bb8ea5464394284303d74415dac45fd4e81471d25635ad3d4e0a9dfda7ff2545", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100bb2e93d0f26c24ace0c0cef10a0d81c0d84dcaa07d64589d62fb23147c24027a0220485ee2ba0a3e49fd2050e5d70c522e3dcb6484e03ca0439c2038d0d5d8f409a1", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json index 61d4d5141df782..1de6a7c7644b49 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid CMS version set to v2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083adc3cb144189aa8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e9e999a358e56209c22b38c510fb3fef64a497eae473143c566946169ca031a5e3be48abc8abd09845a39336d98ab2ca14ef2bf74bad0acd37cac490deb2624da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a5888b8340c1f7b7caeb8aa42f99b71606240dc7301f0603551d2304183016801449c9631211c3f8f30ca4b484bec2ab1114b619cd300a06082a8648ce3d0403020349003046022100b2bd8a12820bfaf7f9b6b57bf5b2725184ac2dc177ac6d716b608cf20f4c47b3022100b1315fa56a6929aa4126ebdad80658dd59c12474e3051a5ad18ee895dea79f79", "pai_cert": "308201d33082017aa00302010202084d61098263fd16fa300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048db02838ff21f937c1917a3e4b18be675cbdbb64a694a729893b8f74552888e8dfe48e0dc6c401e684cb8a39e648ff275d628c9dfe4ea64aabbb1ad648b14b7ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041449c9631211c3f8f30ca4b484bec2ab1114b619cd301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022047681ee29a1b27fa850c12f913ca606b4646770a2704385ab4fd79972cef306902203ced713480174eb0b870f388b980c6488cbcec993ba15dfc1ac1d47345b4c60d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020102310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100eba961f6ebc6b94ff21c5b0e7b3c38c43e0b962bc2254478e707d5a19fee41d5022100b5891ea566ec4ff322c88ae42901537cbebd68cf8b9684d3be01dfc714f12aa6", diff --git a/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json index 42a211632e8c8e..a4cc0fbbf587a4 100644 --- a/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_cms_v3/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid CMS version set to v3.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa0030201020208609bf5957fed7d54300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004789dc05f84a38964024d1ede7a496f3233c7da6ad99b89626ca2d110678a6fc6759b0a9aa9ce4ce2963ae4541245d627c21e89b85445b9b736fafe558e234138a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ee4fb899cf58fcd00af70a5c894a3558c8913cba301f0603551d2304183016801481d80ecba12618d14bb27b6e1191068e1e9e165d300a06082a8648ce3d040302034700304402203d63196c07f428a2b86256eb778e22f750d86b5e66b672773484d49b703b4f1402206a47c70f1baeffe75d0f95ca3351bd34eca500b1013624bb322ec3c0224f41d3", "pai_cert": "308201d43082017aa00302010202083cf1c49eee2daf5c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b1c5febdd9c1f5a8909501bef8824948eede5c80704ee9c6846d367f506a8032f1c72f2ed2fe061c4065d8e2aeae44e4107d8544a8146d160ba3cbec636dd013a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041481d80ecba12618d14bb27b6e1191068e1e9e165d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022007e894383dad716eddec9da562610557178a288d2fb29155fec6543e3c0ad259022100d67324e8b92055dd07fb993f0029501a4e91eb35d5ba197aedaa297c114af358", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210099df8a735ec4a09649c1221afe848abf3880d6ee5f398d9fd9f6f59da1250d2c022100b229ca249649a3faa81a1cd7b011e80437a65abf34e2c314820df31245bbe437", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json index 7ffc0e7136ace1..1340e0acc11120 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_missing_pid_present/test_case_vector.json @@ -1,6 +1,7 @@ { - "description": "CD Test Vector: The dac_origin_vendor_id fild is not present and dac_origin_product_id is present.", + "description": "CD Test Vector: The dac_origin_vendor_id field is not present and dac_origin_product_id is present.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086fca8305379a51c8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048f9e81c533da04fa65f648b68a51e30e79cd25213fe0e12408de2c16143a9963b185be23b14984eaa85071801fc7f4c73d79c7c5764c6466d54bedf0d839c2b5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604149a9da1de5035530cf84ae9828cce06883dd4c8c6301f0603551d2304183016801461cd58c802384c8d2b02da483df4bfdcbd7251fe300a06082a8648ce3d0403020348003045022100bd1cbf19f6c4f8755e6b4a35e589605f703cc33a620a68d4eab6803c6d46ac4c02207211efe3355790fadf84523ad67425364fb9a3fe4b9d8ca01682398e761ee006", "pai_cert": "308201d33082017aa00302010202080f9cc819a7183e74300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046c49c8545aff616e73361aaafd3ec06e34bae81ab13dc0b74431a1bda4621f4dd9a5d4f67b4fac5b5463e9f026f4172bf2385719dd002e547bd2f1f834a8ba4ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041461cd58c802384c8d2b02da483df4bfdcbd7251fe301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207fc77f59a6ca922c02b3231158cec6d44b26444116646bfbc075d09db010f7440220435f925a125174f1d8fb58c3f44186246722796356eff2afbe362b65f49801c3", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060025077698240800250a008018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402200d624e7be3c6724f1d4daa489b95110f06c9444f562a8d9798bed064ff562eca022052f07ef535ab980a5def109859c48f82b8a7390d0841d3bce756e57d2b664900", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json index 00671b42ba8781..80e1a41779744f 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields are not present.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202084d50d23a1fbf1a0e300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fad5843ac6a0e6ce7595253614ca0ccfa754bff4709edf68ff81d0f3dae0d8574acafd70e41868b758ee7d00c410c4bf956ba58cbe832be98f936b1d9c2fa8e8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148fabb63e5851a5f212ce5acaed8c448e554d1481301f0603551d2304183016801473649040c70af4afbbb1bbded28377bb14a26167300a06082a8648ce3d04030203480030450221008533a38b2a3817d9511a3f9253e9f22a05d686e84a01d89fef2d4c315e2117d602207ff7732db1dc82541234789e7a82f68317440f13b9ef4510a48381fbe0c7eb00", "pai_cert": "308201d43082017aa003020102020826616921371e9c9d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000492e9e5797a852148103f60da01fdd12ab63602c297e8fe566356d7d89e573f76216ceafe379a5d6b3ea168d0ebf23537272e1a58d19021c216dd13dcbc285e6ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041473649040c70af4afbbb1bbded28377bb14a26167301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220326b9d41deff0d269e5ed4de61e7b19f4d24f7f68321415198d83164bcd20277022100e1b6ced478e5bc348d9dc2b721fa1be022e5658fff03361585ac30a471e4b913", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502203917850d875473d4ceea249b1a69f3298db296c912b193dca184a9e98f111e4e022100bca116dedfcc576533d1a2912ecd005bc6fd3fecfdd850c5db2da30100ab4ea2", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json index 5fe58f4d0cbfbc..f7b468832ccc10 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_match/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and contain the VID and PID values that match the VID and PID found in the DAC Subject DN.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202082c5f9571dca5b861300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043cd9d908a0fdeb76fa40708621cb62c4ca32be47cf69c225071ee52cc900b0f611643cee47e2bdadddd145f25ba6b12054131e568f58f9a35ffa65963a0f60f3a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a716fae6c3d9eaa950017ba8e996f9a006a126dc301f0603551d23041830168014a03ac8b3ca288b09538ec1bf8cc443eec8684937300a06082a8648ce3d0403020348003045022100befbece9c30d03aa53793e5187b92f641133459865d514d818a2e1423b52e16b022013406c2d6a15e2c8cddf188a80e37fd3d1c579a86dfa35787d07bf715f87ab30", "pai_cert": "308201d53082017aa00302010202083f02d99518e372cc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c04710951478627c5bb6e0466a81c38b8bd10a9c334ff10a3edd3717a30e792cf53478a1bc59fa53d6a539b2a0a6022ad65383d1adee308ad7c65aff94685f03a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a03ac8b3ca288b09538ec1bf8cc443eec8684937301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100edb92d9d41881a990deae2955d4a79d03dccbcbf607a0c87d07b52e0317e88c0022100fb70713bd140997b86983c51753c93c4fc09cef415003d7cab3710058c8eed00", "certification_declaration": "3081f106092a864886f70d010702a081e33081e0020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f1ff250a008018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cd9628a064b0421c0f2fb5ea4ddc4fadba37c70fc3fac7ba885121cb45f49384022069a14a56376e8155610eef914234a07952dc3b1287ce46926fd9b14c045ed04a", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json index 2705fffe53e80b..b8d8d49b342d90 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_pid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and the PID value doesn't match the PID found in the DAC Subject DN.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020801a8ef779583419a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046ba79cc6a857e4563aae3290494cd869248b5b551d7ec78e206d79d9239ef3b948a69968e1dca0962647f16de78f9b1d4414d73a724b9eb3bcbbaca6dfb3c7bba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ed5fce750f4fbaae8779ded9990bd77ed74f5deb301f0603551d230418301680140e5e0154fa83852ea9bd7d513678ce621b12db17300a06082a8648ce3d040302034700304402206f6f02d977fb7d0b5782914a76471f6f28b6bace6ba220f6bd2911b88e65ac7802204fe9c5893a713bfc65079e17f182949b1e7f30c1300e21a384ce0684a6bf37a4", "pai_cert": "308201d33082017aa003020102020807b9477dc7c08cbc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004db3961e906481011abb53af45fd9b92318c8d7081a9cf66ac9f48eb94c2582df0bf30ce9eae7839c64a7779b596096fbae6f3c107d807257fd819b19adc69aa9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140e5e0154fa83852ea9bd7d513678ce621b12db17301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220238af97ac2ac11c3a7576e0402ecc25ac7ae6b405e6f92735123c7c8e58f76da02204e07a2ed178a80f90255231be0de620c90ce653987ad61f53baff055292144df", "certification_declaration": "3081f206092a864886f70d010702a081e43081e1020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080025090880250a00ff18317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d08faa14c78d204d7b3f191b7b18c667eb53a4ea7b8fb2891a297c07b223c176022100842d2b037776544c70bd1206615f715fc7a2e6692189e4acb4d99807bbd05057", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json index 6419866698444d..955a1fed7c61fb 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_pid_present_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The dac_origin_vendor_id and dac_origin_product_id fields present and the VID value doesn't match the VID found in the DAC Subject DN.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020879ca6b466a955428300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c6139148e607ce3ef190bbdb39778ac0ea10c9aca71e6c4d0a2ab4480d2c022a4bc7fe5ccfc3a307da1ee904cd6dd4bed9f9efc9accff221bd96dadb5cb3862ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144cf71355a2d6e55bfe85a2b5df3bae595c8983ac301f0603551d23041830168014dc22d4c0ba96bcec9e73febcc6a5c6a95cccd530300a06082a8648ce3d04030203480030450221008f5df6c8e03cd974f77e82af82bf236a8fe85fef1db273545342c27f36776718022049cfc7dde9ca713da03676c38e4d7be7133410404308aa065741416664617230", "pai_cert": "308201d43082017aa00302010202080a3e877acc9fc778300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000492e0c2e66114caeeea5a9071f4405edea66c2bfb28e4ee09c467ed85a4ce85e5f1f19758511daeb57875c73e76bf8c3420a245882acd4cf7f2fa65b470609cd4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414dc22d4c0ba96bcec9e73febcc6a5c6a95cccd530301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207dfa2378ccef2df8b4b46e07e480825b9f4cab1b5e951ec38b37f8f89866bb39022100e94ded063f5ad6fac41871b361b233fb440f25e800d26342d16be62443acc5d3", "certification_declaration": "3081f106092a864886f70d010702a081e33081e0020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080025090880250a00ff18317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220141fd1d963a4d35addceeb2588808663bf9e48869cdd7638fcd17ca7744db671022100e247d9707c2e73a241a3ecc681e98f431e926dba315a8c7af014eaed8005cb68", diff --git a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json index 60d9465c59d190..3832d7379dcccf 100644 --- a/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_dac_origin_vid_present_pid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { - "description": "CD Test Vector: The dac_origin_vendor_id fild is present and dac_origin_product_id fields is not present.", + "description": "CD Test Vector: The dac_origin_vendor_id field is present and dac_origin_product_id fields is not present.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202084e03eb8442bd3357300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000432775051a1188d457be69d283d2d472fcf99fd91d0ce245ef4fb4d75726f71b3775c035f5671dacba351328d95553f1d052c6681b81bb81fd670da1662fa8b27a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604147409b1265bed56a570b09b12afd16cdeaa1d2516301f0603551d2304183016801415ca129c1fab4beef249c78b622dc725fdb04179300a06082a8648ce3d0403020348003045022100b263f48fd96ced033c137b21170f43bd02918dc15b73fea67ee2ae61640a7175022076a6ac30fa7996c45d8968c74891f9b8f7aa6b4e4fd1c2225f245b3c894deb6b", "pai_cert": "308201d43082017aa003020102020859c220c6e66614fb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d85129281a55c97cc9b9d6d7af6febf8fe95a6d3b78c71ed71f0f8444812b31686581e5f4010f68d9ce4f9182f7e7104d221da12184bad1a7124bcdf4ae131e0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041415ca129c1fab4beef249c78b622dc725fdb04179301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207d9edf0f1c24a33e6d7db0a4235fce3252939ec6fc5a6b8da5241fa8d03fd21f022100ab7447a8d5eca096615f777af4f9aa43af9e4af1ba37f9c71f401a86ec31d28c", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304906092a864886f70d010701a03c043a152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f1ff18317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203b39f5769ff990ea93efe930bf51b535b46bf27eb512b31b64d5c1ce0b14a4290220258dc57e0c162d8999cb540a663ead0f7b8afe43a81be777df57ebb94b1d0ee0", diff --git a/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json index 13849c2d91c371..d5f339f58549b8 100644 --- a/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_device_type_id_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The device_type_id field doesn't match the device_type_id value in the DCL entries associated with the VID and PID.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202085f01bc509b190dd9300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000487aecdce5fe02c34285d6ce225221bc3f7fc6fc9daf31e8f8a858e561af69322cea40af5841954c497a6e22144704dfc010b6712bdd863849c28f85f352985c5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fd34dded7d13efc8e32240d29591f4cb66073449301f0603551d230418301680140fd6fd9e6f14f152de21f74cb71e3fe6712dd69c300a06082a8648ce3d040302034800304502207b1d0291f7b87e43a891cee458f72c3756e34f8b7e7002c81bcca930c943bdb6022100c7ce22c0f6540b829d2412af63a7619d499c80906bfcbe35a6035ece6044c6c1", "pai_cert": "308201d53082017aa0030201020208096930bcd7b1301b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a1f689ca5b0139009ecd54f9f35c27eb5b98ee3c3798ecf673db03e0fa09bdbf2cbfc63ad218b6637d932f6dab737f028965982e2acccb3404b2812091ac45ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604140fd6fd9e6f14f152de21f74cb71e3fe6712dd69c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009e98128a4fee36e3c5e62706329c8436e899c40a7b795b02213e642153771fc10221008a2c4cdc5fca7bbe0ef90546fa20f7f3766cc19015580338aead5a6122e34d4b", "certification_declaration": "3081ec06092a864886f70d010702a081de3081db020103310d300b0609608648016503040201304706092a864886f70d010701a03a0438152400012501f1ff3602050080182603cbedffff2c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cf9ef2cd6f3d1dab544baa9b5aaea70b6566749d061ebf2fffb966f3934c94820221008de090bf9e9e4e5c52de503176ca4b8f9190eb46785676de92e709f32c4ea9dd", diff --git a/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json index b408b8ae58d446..b1fdef9f0dba28 100644 --- a/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_device_type_id_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The device_type_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020810b3b42fa205f9c0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b9d8b57fb9fc15c992cfc22c529a0aa19b88dddc0a9b46b4aa13797093575e65085ba15d026d19182038db35e7609b85a6ec70f984572f5164da1dbf9200dec1a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141cde48d9ac01f2598a5fb2217df5ff58c93f2189301f0603551d23041830168014c6103d3cae2c92dc0379e8cce69bbcbfc1b4aa3c300a06082a8648ce3d040302034800304502210080574615e0e9fd4d670355ace058849224103f84b5e7b56d01c04d7f4b5378e802207011fef698625b88b6f7f79132f53bdee556e9a0fa1c2ca05e99f03b6419b569", "pai_cert": "308201d43082017aa003020102020872436953e3407211300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043d8e78d7f321594504bbab7556fde17cdc4484aefb7efefd8bb0474d00193b85f3043dfd935c2ab6cb51e476e6b39b4edc081441b8f6b191af072d920ede0901a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c6103d3cae2c92dc0379e8cce69bbcbfc1b4aa3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c1135a1718bcc4ea707a92ccd9d5b2b6e7c45684d243fdae3fa75e02c75a18bc02207e0589ac4549b06d8fa45d728cc66fd2bcfd7d425164f33316efe8d8c2084536", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304106092a864886f70d010701a0340432152400012501f1ff3602050080182c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cff9aa11d224cad4658821f4de919097e83ad2f926563aee18de157e576facd60220295d0cd70509b00efeeec306bb609bef718d576b98906ff6645e3bb66ac3153e", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json index e7c33e2f0f5893..083817981e4e17 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Valid format_version field set to 1.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208035ec7a3a65b409a300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047186577af5c7e6dfdb08e9415c474a65f829b3572907edc2d790505e5887bc5ba2a873fcc9dcd675b87e96fcc8cf4b99cfcee7b6b3015e672230d12478f784daa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e456ebaf42c6ef15493dfc82ee9546172c80c7f3301f0603551d23041830168014c3a89febdb9d1aed09ed0ec7ced1f50c4322d95f300a06082a8648ce3d0403020348003045022100e01b2e2769d3e18ab2aa5901a93a9be4e12f084a678400f66ffe898e48a6394f022008c2f5f179c18c2231618d1528f8b28964d20455934a1a3a28d62e30cec1dfd6", "pai_cert": "308201d43082017aa003020102020848f107f0c566b40e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000474683a577879172160569252832accd2f50733b4cae596c13af815c0020d8fc4bdf20a6978f5181169a705d799a167d075eaacca19d54b5a650fd4de0f23ca16a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c3a89febdb9d1aed09ed0ec7ced1f50c4322d95f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100aad83a91f94b4ad0b0ab01a609fe0bf618f92891393536f63cbcb00b6d2560ab0220255c68bc1ee929d029c835cddd728856ebf09c00f03dc363d39097b790b0a2b5", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210091f543aa73f3665262f783002d126e06ae641d7e96d33dea516b088b44000421022100cd6e9a27613886e9c03831ad4bb4d101fabab954f7daa9e505b31081818890a3", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json index 4c9f1508fe2160..55e5384881cb75 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid format_version field set to 2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208546d6d522eac4ba8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200046fe3d432d949cca06e7d4571d31ace8d3e947e87623484f96594a9d8daaf1dbb4a0d64a61849818f39993cc58934778e96b6e010b6b38a798454c80f004f0d56a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f3952c383741bc8c56a4d8e65631e2427efe67b3301f0603551d230418301680145c138e7e257715f85f7fcf15de659ba17ca193de300a06082a8648ce3d04030203480030450220233534ecba0b8e4fa7f5cd4b969b93882d27b12a68dfcacb226db65ea5444065022100bc9eeb65560dfd3bb529b479ea0d1e35499b1844bbcdc4fc0a6b33a68fea573a", "pai_cert": "308201d43082017aa00302010202080ca9cc09727c82f9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000463e2721794f3e9f1d7a05127587e2f22d1ae41e1d12eeef1615d4bb624da430e5394d4c7561e0b01618cad4220f92c3a7adb3f995a68b8f0f669129116a13205a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145c138e7e257715f85f7fcf15de659ba17ca193de301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022041a7e9092f98355d832eb9161ebacb51f8e20bf016e12fff32b44dfcfc459f5c022100a7d64cda6f2fcf7e421330b6720fdf1675111cbab79a0c28e9baf55f71f92ed2", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400022501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221009ad37ffe2daa88ce82ba2af513e07a97be2b1f26bdd5b9101afe70151d56d7f1022040dee6e3b812d9f51436960334409a98ad84caa4e4a2a99bc1bdf7ee6f536305", diff --git a/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json index e087c92ff94c03..d15bfce64f71ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_format_version_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The format_version field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081d0d93366a36e62c300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c2b8426d06970ff9f15fbc35ec948089718f3e4b8976ce5766a6892c7f783e4fe43bb535c239c5e2a468480288feb2bb6b0972a1ba2bae03019063ef9d0f110ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414faf55002b31f6820668e0948b002334327119f98301f0603551d2304183016801455334811118b29e0cba9a03c77084e59ba0e90eb300a06082a8648ce3d040302034800304502206ea57ae13900ec1ff6ad9a9ff401b753247a74e19565422bfa9792dd455960c2022100a5e970b31f5d28dad1b08bbb523422271b74682a69068fb03f85295260503cd3", "pai_cert": "308201d53082017aa003020102020809329adc63f55298300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fe271aa0ba3d243895c9600f3fa555e62869a6ccd2e67edd7da82300bfc3bc40bc5fc8a8d1bed78479d600f4c3db52b50b6e878bf20d966d0ddf112c24fd5af1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041455334811118b29e0cba9a03c77084e59ba0e90eb301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b1f90ccef9c465b994748d7e480a87c50c20597cb1de338e835a295590e877a1022100a2d5570aee8609362bb3ce70188feb8daabd4432a5feb52f41ae65e8416d2c1e", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e1ab367555c9ed7816e5a307123278385ca877f2a0bdc4c9bd0e5083d279b184022031770d30da5910be7821c0f0e56265ecce55f40a19937d8f94af6461a137ea0a", diff --git a/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json index cba8781bcd3450..f8954776dc4a84 100644 --- a/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Origin VID/PID different than VID/PID (correct use of origin)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020842746453dda3a0f5300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313020170d3233303730343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d030107034200048b4e27fd46d015bc8eba0c1825b3dc47110f46f59024fc298c7be623726a62ca3d212cb3fcb49727740d22f977b7d020b6c5f0d7b6cc1f507acece9d1d7d3009a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145533733f2b3bb53210597a98f50af48124001fb2301f0603551d2304183016801424391a2ca5a801e0d174a4fecf2ae5256223a087300a06082a8648ce3d0403020348003045022047e6417ee7561058828789b02f1bd44c84b49d165a10d9bdf28373dc10693537022100e85ecb093c7aa6cbdbf9a2a5f48f219c0f7cffef3c8ef4e66f8e2fe1e7bd1c9a", "pai_cert": "308201bf30820164a00302010202085705dbb9324090c1300a06082a8648ce3d040302301a3118301606035504030c0f4d61747465722054657374205041413020170d3233303730343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d03010703420004381efd94c1d4049bcd45b803682945d13465c354964094697025920906a5d69f23cde03af2e159c662b00e3442ca69243f4e7963f47885bcfba71d8b5dc4db0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041424391a2ca5a801e0d174a4fecf2ae5256223a087301f0603551d23041830168014785ce705b86b8f4e6fc793aa60cb43ea696882d5300a06082a8648ce3d0403020349003046022100bb12c3850de8c26559f20a2931a3067a47287f28dc8afe25b80c930397c947b5022100f67c7bfbeb08fe615480d96442539819bcd71836d1fc0d4bef9d213c171c26b7", "certification_declaration": "3081f006092a864886f70d010702a081e23081df020103310d300b0609608648016503040201304d06092a864886f70d010701a040043e152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408002509f2ff250a018018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220494f87a430b234de3eaeb2dd756d49f5a952f99611b5e9049d864499670cad1c0220492f157848ef15bb597fb46ab387f639107bb53fc6d0dbe11b3fefc8e3baea8d", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json index 13655cc7ac64e9..aca02f4a5f9312 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field is empty TLV array.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202080dc031b7abf3d930300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a99914b40a3d8dead6bd352f34b5e42fb5e21decc630aa4b113b84200641e44b247365a738994b4be8f090a1369addb4bc341a54e5473be3748f7e58c3af77ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604146834c01c4b79aac7d003b0ba6b9ab1a400560dbc301f0603551d23041830168014eb370b914c6bcfd7979fd3f45e2fddaab5ee8d26300a06082a8648ce3d0403020349003046022100ad008178698f20bcdc0ea8626c06c07a6dcac84b0a8e0acf2262680abcf0e9ce0221008c7982c11ae70833488189b9ae6cd14bdcadc44e657d0c405e54c0e403b29ccc", "pai_cert": "308201d53082017aa00302010202085a36afe25e5dd180300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044412245c517c9a683b52cc94d75558ffc279b107281df2b0c42c07db0f9be2f8873542e666a1b992a2d250036499248debbae90ea8071408683b73c6af30336aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414eb370b914c6bcfd7979fd3f45e2fddaab5ee8d26301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100900c528c98b9fda57d0ef7910f5d6ef8b0e414224b770d766ca4b17d1a940c2c022100be3d396e3c63d2b7789574888711ca611e62b81a04bc74c4da616704a4233efa", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360218250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022037d322978286a3de31d08ee96bd942aa72da18fbe26b063b914934e5fd4e087402205601ec5cd295d33050ec64b6f3fb23bfec1ed436c02c5cc8f71639a49b5d9bfd", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json index d1a6420a9965bf..1b551c84fe2c1c 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has one PID value that doesn't match the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020816c768ae269faa24300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e617c522bc35989fccbaf3c1b4d1615d987c6308d9f882744ce9669a2742094a2bd1fc62abfc2807864d27ac6c2b1b8e34ad5eb614b38177bed577f235123376a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145e76235826c77cb8b422a34be5c7318799713da5301f0603551d230418301680145a91bc3c2d772cabc0febfd2e60b3f6ae7fcb7b6300a06082a8648ce3d0403020347003044022077e9c39d62d34ef5800435bbc2b4efc21bf857f1fc444c1293ea6de2effb583c0220425447084c7aa6802866797e9e80c2777e85539ab8f54ac356353721a09955b9", "pai_cert": "308201d53082017aa003020102020859befb179d081387300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004079e47bcab04f0b58e456e0b7cd5e4aa6f8e8bf3213722a94376a147e01b7369fbbc8fdbeb920294ac6db2edfd8b62594478fb56df46fb1a61154be2fc21cd8da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145a91bc3c2d772cabc0febfd2e60b3f6ae7fcb7b6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034900304602210098543371eb74e4060e9e6f0488d52f852b509d1aa35fadd8f5bcd65f4e093206022100873d70328f544762f25cd7180905c50fa8b6ab19e04dfc45446283fb1afd38e2", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205018018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c65b5b0f2133979bc4ddd7531bf401008178223bd19852a331431016cbeca0b202207cb7cc48ab35550809da5990fca76833177cc309b9d79f3420f498c127670883", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json index 59879f18149afd..481de31ca7560a 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count01_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has one PID value which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa003020102020846e7bb711b1a8f59300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004557802fa2919608b988d8e1d2014f8591d999f432c28007a8a3ad9709e9419cb67af46d0ac93db07e98c01a75883fbf4981f6017432bfc28faccaa1070d42707a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bc9f74adf13cd1c78c72957f12fdf3f8a5fe2a04301f0603551d2304183016801403dd353822461c72c01f85a7983678b0658de787300a06082a8648ce3d040302034700304402206195ed4f23756d16128ece0bdcabcf9262c1af6344a09061c07b6168acd0a75f02207ea18f2a8bf3bf7b99dc6b5e5acb344f6db92289a06e90fa51c7a817370377f0", "pai_cert": "308201d53082017aa00302010202087fb1e1f18805406f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000426e8e3bb5c21d9ed7741869e5ed5c5934d2d377be3282bd861c2e0a4d34e354bee793735503bd6efe3d6a8572ad0353693a7c50168dc0148a5ff3e796418cb3ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041403dd353822461c72c01f85a7983678b0658de787301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b56f9572ba07f32a20aac9990ecccba7a6552602d2cd4b61bc514f832f958519022100ed7caa6a6bbcef7836132472f62cb0f130b1ff28b6e48cefdc73302edcd19617", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201fd94ea4e095f4415928cd615ccfbdb4de8fd7f91452d19babae66d7e60c8568022100af9aff7d2a08426a1d2c232eccce49fdb61ac4e78c79edb3bd6fe6472a451e31", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json index 7514b727c2dbba..c3fdf882b7abb3 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 100 PID values none of which matches the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020813c9fe0d153b9626300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000495a09e0311075be696398378e4ecca35e1b934305e3728dcb10e9c5570490bb67e348ea57e97f4e672fa6175961f9e36ab87b4cf0defa3d36cc673975772738fa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144679a512bc53543f5927544dff9389c1eefa38b5301f0603551d23041830168014f8ee1c6b27d43c7bd4dcbc64a4dc088076e2c0ba300a06082a8648ce3d04030203480030450221008a43da983e7c9b4f2f472e426cda0cf83a4262bb20f86857ccf1913d019584770220294c04a18f1cf019781d7519f39ca519e80a72ac962d56659ffb02fac6e2ded5", "pai_cert": "308201d33082017aa003020102020806d9a6b9cd17946b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e2d2d49d1f0dab8764c82f3cc0741c2eb06e9d179748e740aac361e25a4c2c8933191489ec3c3c09d525b87f8a19f9c65d6358b7310fefaeb412696842ee3444a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f8ee1c6b27d43c7bd4dcbc64a4dc088076e2c0ba301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022020a4ab2de432a23674b86c3e256c5698e6befc62c7792fa8db9da8e1757abe3502204211a398c2f98a112bcba7327bbb3142019221b459c8400e54568d44b057753f", "certification_declaration": "3082021a06092a864886f70d010702a082020b30820207020103310d300b06096086480165030402013082017206092a864886f70d010701a08201630482015f152400012501f1ff3602050180050280050380050480050580050680050780050880050980050a80050b80050c80050d80050e80050f80051080051180051280051380051480051580051680051780051880051980051a80051b80051c80051d80051e80051f80052080052180052280052380052480052580052680052780052880052980052a80052b80052c80052d80052e80052f80053080053180053280053380053480053580053680053780053880053980053a80053b80053c80053d80053e80053f80054080054180054280054380054480054580054680054780054880054980054a80054b80054c80054d80054e80054f80055080055180055280055380055480055580055680055780055880055980055a80055b80055c80055d80055e80055f8005608005618005628005638005648018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502207edcef8e1549aa5924f99ebc30b0b117b0ea950e580f024d1d34e27fd6a78cf2022100e4bf6442c088ebe23afe5d4f245cf73ff433fc855d637c35739ad9fa339bd868", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json index 9c7038ab9d6569..4216d3c390f9e6 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count100_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 100 PID values one of which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202083d9a50313f7e6432300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000462849005c7c5d1e478e9f7646a07194a02195c27a6744fa4ab126bde19aa996ffb1edd37166784837d00a57c49b5365e7bac81a6d58a2c4207e32da2706125eca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140f3cf8c88db35522fee3cf07d76ed6f7a74218dd301f0603551d230418301680147c7ec3a697f1d1d23c3abf16eaa8543b41db0176300a06082a8648ce3d04030203470030440220521f5c8038043a4f525ab3a962a689a984919c213c6094e2a671fd87f306a12d022067027cfeff6a89e515807b34138e1b8ab30196aa29f9374ca9ca58608e9691c9", "pai_cert": "308201d43082017aa003020102020868922259f0f88d0f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ac190feb222ae94abf5e6f4bea6c78e3a8238d56a39ccdd3da557a0923623e8e463fb12d954cc311f85b40be0b81e6ca04bb2dae2417276cbda05bf443a898d6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147c7ec3a697f1d1d23c3abf16eaa8543b41db0176301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c9b17660bda201b3a1c620870cbd79dcfc6c5a9c26e956ca14a8ccd40de43a08022004ad90365b23ac6eb84a9e50f9c25f23e01c4fcbcc4526186c7af215e2b49c33", "certification_declaration": "3082021b06092a864886f70d010702a082020c30820208020103310d300b06096086480165030402013082017206092a864886f70d010701a08201630482015f152400012501f1ff3602050080050180050280050380050480050580050680050780050880050980050a80050b80050c80050d80050e80050f80051080051180051280051380051480051580051680051780051880051980051a80051b80051c80051d80051e80051f80052080052180052280052380052480052580052680052780052880052980052a80052b80052c80052d80052e80052f80053080053180053280053380053480053580053680053780053880053980053a80053b80053c80053d80053e80053f80054080054180054280054380054480054580054680054780054880054980054a80054b80054c80054d80054e80054f80055080055180055280055380055480055580055680055780055880055980055a80055b80055c80055d80055e80055f8005608005618005628005638018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d1ea878a4afdc2fa9421b821a0aa13c91adb7073a7aa522a37427e3deedddb0f022100fb4bd91f26623af67968c235f769685dbd216676a3a5e8be68a22882e8bb5426", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json index 560412e4a8d322..02b77d7b71d511 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 10 PID values none of which matches the PID value in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086c50b4cec0f6ee67300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041bd6caac43916f3205141a69f6f23701bf475ee1afdd2050e2e4e2d8061f92c0dc2289bf5b6f81bee05ad5f0844d2f346cf457064bd2a4115f5ac4bc13296660a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144f0ccaaedf52bea1d44f2044d9512515206ece41301f0603551d230418301680141de7c0e2d372e7e9786407337e2865d41c988d09300a06082a8648ce3d040302034800304502200172eb172b66f6f52e9f859f488f3efe1fa56ce2ec26bedcd431849d7a0cca63022100f6bc3169ce75c7aafa1aa97b008cf1e0152dcedbfb951eb3d388a2674a726af3", "pai_cert": "308201d43082017aa00302010202082857dd601ea8b4da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000436904f5521859435ce88e12ca860d4db2a9226ba508c0078ad8df155e2304b6a82a1fcb0ee824bb6ee9bbefdf533a6da58e7bbeda8a401fccec570613f9b31c8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141de7c0e2d372e7e9786407337e2865d41c988d09301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210094280a7789b65d3ea3285645e92ef7b4bd6d41e479fa4299a03f1a0c8bdf29e202204621f7a2a509a6806fa4c607b3e0d037fa7d4114f42aebd51a4f45e31f466254", "certification_declaration": "3082010406092a864886f70d010702a081f63081f3020103310d300b0609608648016503040201306006092a864886f70d010701a0530451152400012501f1ff3602050180050280050380050480050580050680050780050880050980050a8018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022003ee4d0af4f660acb22916e20add28c200535ff6119c9b6f265ad91f306e0c1f022100a93bb5f92bedba63c2d0ca7109e61191dbad4ddae05e05c43e153c162dbd6e17", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json index 61a9e7c0acf6e2..c6a6ccb9324511 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_count10_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field has 10 PID values one of which matches the PID value in DAC.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020813c727933283774e300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044d30a0a2913d3e430a5290f6f7b7c10f091367cf3c35cacd4918ebeba70e16500f8a8f7205750cfb7ed7c8239302903a30f616b2c9b64570aebc8c5710af03c0a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041407c291d0533f40e07526020c813e667658ea4314301f0603551d23041830168014751351fbfa9f9a5ecc254cca72530027e084aab3300a06082a8648ce3d0403020348003045022100eb85f860a40dca1ecd37fc5edd320ed9e4eb63475a819bec600a7a877456d84c022014da291fd311a09d622269da16456efba5138a2a5242ce50230725ddaad694f5", "pai_cert": "308201d33082017aa003020102020812d4b50d55511fef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044ff414682c6efa040a931d69d47375531d73385dcccbcd5573973efa2399c0319fa3d42d2789c00abffbd9636856130bdaece1e735b25a7947596e8cf9871c3da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414751351fbfa9f9a5ecc254cca72530027e084aab3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402204f5189cbd11c19c3dc0cbbb172cc500f17379dc64d6569fa77a9c02c3508d3330220511cbb9543a21f4020c302ff30c4fa78a4a3a971b57445c2c585bd56a05d9ed5", "certification_declaration": "3082010406092a864886f70d010702a081f63081f3020103310d300b0609608648016503040201306006092a864886f70d010701a0530451152400012501f1ff360205008005018005028005038005048005058005068005078005088005098018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220302965578573f3811244946361f79ce605b02863de179d8ac6a36efb8b78a67e0221009f15b1f4c93acfae9d9c4302c18f6ead7a2a3f3beeb37575085dd1f157db42aa", diff --git a/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json index 7fabff203d094e..1ada3777846d1e 100644 --- a/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_pid_array_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The product_id_array field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202081fdaa42991ccbf5c300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200044febdf8a83168d7a7c7be2fc6d42da9f778362105e0a5cc2709f712aed71b1893bbec09fb1e501b75b4df6e99d73a2cdacb0de68dddb01bef0aef2d466b9e1dda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414136fde481954f10977aab54c0e4ab7220f690741301f0603551d230418301680149fcf9ea3beed65ae0e5edca69600f4a20fa10597300a06082a8648ce3d040302034700304402206324cabab17126abcb90925d0501cc172f07d7eb8ab43390f0da92b1b18f2a2602205921cf9056d51ada910adc6a377c645369700d31a8a218eaac99d30b605e7f59", "pai_cert": "308201d43082017aa0030201020208724dda0890c6a378300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041cf4b099d094496b6fa3f4dd72f52a0a0742bb67582e20d24ef4d1cf8e6f4d8870684cc49ae09e5adecb024393fd67203246e21d06351c324622665cc2b724d4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149fcf9ea3beed65ae0e5edca69600f4a20fa10597301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221008f91a73b5646800340e04e1f7478771086430561ef1ed02ed19d95c29ccc06aa02204e019062c79e9715b254204091dbb38da2b67624deb13629b30b933008db02db", "certification_declaration": "3081e406092a864886f70d010702a081d63081d3020103310d300b0609608648016503040201303f06092a864886f70d010701a0320430152400012501f1ff250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210090cc80d5df9abd077d88a1419ab98362e7dca75c63d792f55587bf60aac3a6be022100814b62096f52d8c92e724c411e9d566c37b243f1ad75685a7c25a182acb59786", diff --git a/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json index c26acd865bf73a..53ff3961ecafc2 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_info_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_information field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081f9839b2310bf858300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004162f2d706590ca77c9e1de0a183d11ca1dc998d6d31bc5e0f2ccb9ba652bcbab07c71366c1359f56872a6bc715f72fe9f1f4a8ffcb3cd487c91eded0cb842000a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041462c90493c8edbab9e28c3ed0898190b43a937432301f0603551d230418301680147f9df096b23be219ff644d75ac3ec084eadd2b15300a06082a8648ce3d0403020348003045022055a69069836e345832d570b1e8294388acb62e04b007f5fd524cbd955711ef43022100b99c4a9a55412bc33ede6f3f7aaed189bc1b3a06a3acc2fa1314710e7d9b42d5", "pai_cert": "308201d53082017aa00302010202082dbfc301ef98a555300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dea4531769105d7a18cfc800847149e0675797adfe557502ba78a2f0340a5aad74d0d91377743ca89d51258e4d2a31b98b27db29c8631c226cf8dd8b92d9b4b3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147f9df096b23be219ff644d75ac3ec084eadd2b15301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034900304602210082c316171a4f9d96a11a3038735d8f7876a2ce670d2d43055888903bac5223e90221009e2bed4651004bf7b1b71d4f88b0034dd07d0ea7677a5133dd3b265be0cf7516", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100cf1310f8316f1d1d5b2ee2aee1e0169195ce52fc98f18b5c81327ae66b40ec6f02202ee3d05d763838996818ed91d77c5ee2813c056f4b4c8029c771dd2573c6a4d8", diff --git a/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json index 5c14ce4b86606a..7f0ee787bf20c1 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_info_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_information field is set to invalid value (different from 0).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202081f9e401f772b4b2f300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004989423f9e0db0bb3f22cd8c6869e192c4d09782c723ba25fb2e3fc623fa40932bcf22aa721679df6fa800808ae58da2399c254ba0ba2436812b3f96b94c6db54a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a38f1563a5e2ae848a8e681258f5a25000cd48fc301f0603551d230418301680146367ba130fd87aa3c438cfdcf41b241cf8321269300a06082a8648ce3d0403020348003045022100e7f32d095ae49428636c66f58509c9ff3db8ba9820266d0dec22ad3b96f881fa02200b78756b2cf84e15e368d199fdc17083f9319f4d50e5d7a2c21c0179d87091b9", "pai_cert": "308201d43082017aa003020102020828c893a7a03b5015300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049c433bab616a79c7b9b65caf2d497527ff899a5a429b2cfd875802adab808ffa038a2c6d63b11d207f9a8ac2cd7b23d4a77406718f33d22819b9c7199242fcf9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146367ba130fd87aa3c438cfdcf41b241cf8321269301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202b2408789db2e47d5c0a04878f542f5a985c63c28765c33bdbe55761ff2b81e8022100a6258588e1d045f14de82f943bcf3ad01b1a14aec661413f38c4f83f1af04419", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304606092a864886f70d010701a0390437152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002506ffff2507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220087385c9846e5d1ec7608356d9ae0597608686a47218820410ef4b2e0fa59945022100d1a0ede842c249956c5238a6a4084ac43a1920fbbe740f95f019abd41c98ce17", diff --git a/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json index 1482d88cc91df4..46ffb2f91b22a8 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_level_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_level field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020848ebeaa6effaa8c6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b1ccb8b35d098507cb83f5275c02fa24b036596eb3be4d3f74c5ef15bbde05cfbcfddf3fd7799d0f1125aa4214cbac75aa16fc95380b9c0c930440559c639ccca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041416784a005e7a505f13d9086dcf6fab07bddf129d301f0603551d230418301680141b15686cf8e9a85132a6aca592145435ffcb42b5300a06082a8648ce3d0403020348003045022017a3caf6b18960695b2fdc5097a851886a8ae9d54410e1b589e51ea950b07487022100bb271f958f2bc17c654559bc2fe5bc516585dc68840a93a328c18065c6611ead", "pai_cert": "308201d43082017aa00302010202085e6d13de4408d344300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000402d85361c4d4c7a9192e820d7864f3b98fada105aeda108f7cabcd33dc0cd6222c5f1dd6fda7666af4062e97ef7ab78aa2c618ca1ffc3bf1960b083fe27d4968a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141b15686cf8e9a85132a6aca592145435ffcb42b5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220425d3621f8a037ff10abcab5c55ee41f08af5633b6154c6a66f8c745bb1da844022100ab1c118fbcb73681a0492fe7479651c17c4c7c5ae529559d01b210fd6832c48f", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304206092a864886f70d010701a0350433152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100a072d7b4e71515e0828a0a0eec39f90a008d0ce906c147bed9c672ed985847cc022100e12aacef50a0e61f482c73293ea2f9098240a1a3daae2db574c657399dfece40", diff --git a/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json index 460cf3ee650282..dde5ccf5f492ff 100644 --- a/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_security_level_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The security_level field is set to invalid value (different from 0).", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202080da10cfa103085bf300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042acb38b065a4b6e841ed078be69c436333eb4f3fcd3fba131c58fc550a3bbf2b26af1a4b075c465ecd8bcc3ebfe746ea77cff82c27f4eeb180239cb66857b054a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e76139ac056d314ff584a7087c19465c1614e5d7301f0603551d230418301680143698b9c4bfc47425bea49e984414c1048c4eef64300a06082a8648ce3d04030203480030450220532d60d475d105724d6a47be4643f0aa458f6d6785ee04f2c0529b72e6195088022100c0806be0fe17f1a0258b6ca20bc16ddd0b819bedb423617f748051007ab6592d", "pai_cert": "308201d53082017aa003020102020847139e5a7216dc3c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ab5566db90184e7fc7022d3edf7e1a2be3b1ebb766d7c155eac812eb9de16bb0ac8402f8a37fd821eb2175d3d8688f50d5b9cd0a2a1327ce7b30929302bdc311a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143698b9c4bfc47425bea49e984414c1048c4eef64301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b130f4fc0fdf7e6131082a17b697a5c34b26c7889216b94ea7daff49c7e486740221009059d04e3b9d5d9fed2f9306920838c74b0d5128fe428a9f3a92b979ea5802d3", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405ff2406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100f2429a0c926703d64c4cba672c919e9200603b3745211444dd84b21bebaa575c0221009c0d6e198957dbfdb88f2ffaec61496061071a9fabd2b8ac0246215fa1e805f6", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json index b59c8a9840aede..949a53ac942c75 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_digest_algo_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid Signer Info digest algorithm SHA1.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202083fd918dfc8b2ab58300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b6387fd34152c23e5441d49ca6908963dcf491c9f52189ddcf989fa7812b91601f3f594a058c10f370df4c083d90d4550eae838af2edc6ae0badf9f97aac4ac8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e1b81c9f7fcb6b11a16b3d06e2f17436f7ad344b301f0603551d23041830168014bfd5be8cf033ac82dedd9e3eb53982ee1bb1e014300a06082a8648ce3d0403020349003046022100a529d4b2b1134beccf3e85e8919ae0d710d22a05c4052120e7c9a30477406ab7022100b964a21ae055b24328fd7c20c70d0d19e5fd38a835de187b293c6636748e555c", "pai_cert": "308201d53082017aa00302010202083630ed293ceef824300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049f78c2ab73260fe70af9b13456b5eb28a94fa62cefa0d67cd95ae4b9286e42c3d6eacf970911b8fb0152b9bb610e8a82367381c19d0e0fe609a24f023c78f57ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bfd5be8cf033ac82dedd9e3eb53982ee1bb1e014301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009223d81d992907e9f7e6edfdd1903a36ce177b0f4175ed7e64e053ce6a36db50022100c6d630576e94cbb8495dc78601277ad8b1988869a43d279cbcde0220a9ff98d9", "certification_declaration": "3081e506092a864886f70d010702a081d73081d4020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d3234240500240600250776982408001831793077020103801462fa823359acfaa9963e1cfa140addf504f37160300706052b0e03021a300a06082a8648ce3d0403020447304502202c35d141be0c27a9bd5a5c69faa663b3f310d87e10899407061cebfd62cd360a022100f99c7b60e2b8d226129b4e87e0b38626fa6ef230539fb00b02d7a4d7123302b1", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json index 791268974dd2a6..ac131dd75ea70d 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_invalid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The subjectKeyIdentifier contains invalid SKID of a certificate unknown by Zigbee Alliance.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa00302010202080449b1ba0ca6610b300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004476192ba7879dad903fde4281882fd9c31a932923794eec239011efac81c8f43fd679eb193215a01caafbde6a4e2416113554f898ce20d599efd2aae0d939f78a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a8cf7fca675bcb56264159cba7de9e50976f1e36301f0603551d23041830168014257bc2516e2e8f4a49eba7fcdcfad18132d89d42300a06082a8648ce3d040302034700304402202378a409779deef171791b30b8b8554a6ad795447ef68dfacd6ab2455ed3ce8d02206348fbcecea4c3867a597b0866b8327c3485b55e1078cf5a52ae53f5c9b52d4b", "pai_cert": "308201d33082017aa00302010202086b9fd2adb9fa9bb7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c56c72fa79ada0f211f0c1f80976ecc4cd20ce6eb107ad09454b35684c8e2e05c30f6ef41a5bd6382d1d8587c5d3dc4047a20e6b9e9b0e50c40821726c24005ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414257bc2516e2e8f4a49eba7fcdcfad18132d89d42301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402207bd148bc1deb4c4d2a57be1555e7151acd39ee254f49ad43b5fab8cfd4166a1802205db03aef7fe68dc04a68b84a4d4459b66b87c0b812e9e1e1d89cabdb7231d2ba", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfa56963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100843a5ae80128a72747c4813a2bd3e2d05399efe724c7e9fd96796be90481bdd702204a53adf892aae04987d392968f4e19f1d6b410f2980da7fba91ea64e1be54dcb", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json index 18a7ae0cf3a447..6fb7844e370e40 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_skid_valid/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The subjectKeyIdentifier contains SKID of a well-known Zigbee Alliance certificate.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa003020102020879d85bc8631fa644300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004cc3e63d50a1b6e95642df72a96d92017b528b34df8d6953c9b98482c7194017cb8eb7d87bbb326a37b4cac070dbacfdfbb1e64b0f0c0438b68bd70cb61431671a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414149a29058d0f857530f54686f995de0749434cb4301f0603551d23041830168014e42531c02856a9106eeee19ee9dfb3b360670708300a06082a8648ce3d04030203490030460221008a83809ac121294c36fbee051047e6e8580bc2d98bf29cf30a6c3028e7a41e08022100934913fb9f4265c5542461169de56e9b96c7c83be0d0059cd1cd5abf4f4e3035", "pai_cert": "308201d43082017aa0030201020208728baea41135814d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000423d95d94a1c9e4c4736795f260c37ebc8b7c8c6f3dbe5b1f9cae382fc778eadb3f3b25ec5505eaebff847e5820e4f6d8f471fc456bdbeefbde75f7f3325eb3bfa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e42531c02856a9106eeee19ee9dfb3b360670708301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100965f9a824426d8e2c4f223180b1f1622ae5fd96f9989ebc019942bd13a2bd2bb02202a3a72e40c36687602f4d73a979851b6e51ffd96f39febe42d2e1ffcbb0b16be", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022034b2293a7b5613f4cbc8a2f26b7da0ba28bc0915bb0142263d292d71789c271c022100d9039bb5de1d9d7250fe93562fd2adc897b9664bebbfbeb05cbfce5a3ddf3684", diff --git a/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json index 5755956e594ceb..75fae25b38822c 100644 --- a/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_signer_info_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: Invalid Signer Info version set to v2.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa0030201020208117917a583cbd6b0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d939262dd82a30a9840f0fb114b097edb80808b7bc34ed999d048cfc64c54eabfa3e0c2b2cea96275392e7b69f6bc55a9d9e9d38052997ce47f331565a2bfc29a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145a29f560c9204c6e4f3decb4de05f0793d6bfd01301f0603551d230418301680149491d720f4889bfa448ab4986b445df01cb52df4300a06082a8648ce3d0403020348003045022100e9f0d2836cad376ee9152ca51f4f42ddc0846b151c47fda4f65be7704436918e022058bdd4dd12658d9fd6a356d063098d47085a06d209ab0c31f4fe7fbd575eb76e", "pai_cert": "308201d43082017aa0030201020208656b64005678b171300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e35323689b50ae5067c80a1a01f8c2788905617a4b763ebb266601fc5d96268e3e728e1761e06348e8985bb3c3e0090c62da47d4aa3e991ff54a760c33e5aa7ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149491d720f4889bfa448ab4986b445df01cb52df4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022066273021cb039d8d3b44958addd88b95ef5487b63f6c2584b635b88c34ea9d84022100aac3275db29e500f9e1bed9dcbfc8382765837c6d9961a1c71f97c6f619db585", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020102801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ee6175515701e2506a15163c7427596f5cc04af9ed42c0f2e30838d5231c95bb022100a2a6286141b7980fbe899f6b671617d3dc69289e86b6a5214c1c9f6bd78f3ac4", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json index 40c37bac4d6f63..e8b42883266175 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_match/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field matches the VID and PID used in a DeviceSoftwareVersionModel entry in the DCL matching the certification record associated with the product presenting this CD.", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e53082018aa00302010202081622551da2d4d778300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048a940dc6c40efed5115ab4c5ecac5a07430cd076a0d147492923a1b33575c0808c32727eecc8c566a3a36fd36530d66d5282d95e1d2ce203f5074a376dbeb9d6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414316e558aed0f53a0cc88b5cad2459dcfe9b9ca28301f0603551d23041830168014518e46252f80867fc0469500b4dad94252a2b67e300a06082a8648ce3d04030203490030460221008fbb74877a92d7e721fa401452883242dab41cd361cf02d409da9c929f4718f5022100df09d5daea186377e943fe3b9369704287a6a4f3c79f7ab8f693de3d1dac9d26", "pai_cert": "308201d43082017aa0030201020208748e9a8416b212e2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004cb76fdac5fa085929c1ba9a9102d88e83582a8595a0db63a95329a693fe65a9b5a8eb9d19b515fb2e86eeb5adc8ef3be5789c232753f3f186a0fa9d77b3b9cb4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414518e46252f80867fc0469500b4dad94252a2b67e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022028ec372f5c36f2283ea0a41a15b2ec345f6ef701811859954bb9b6376b3df167022100e54a2b587e8616a4150cfeaefaf6b351b37e67264b6cd46f41f9b4c916c85bc7", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022012283adfefbe5c4a23cc33c6ec70201b26fe420a2b3da2f1ac147b70174decea02207dcfc97d3c49892086c6b719d70f82da7fff2220279524cf8c29add1c08f1330", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json index 09ac52a80ae23f..904287ed7fd886 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202086a7765b081a40335300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047e38ed35bc996dbef312cdf85e2eadd11c4b6c3843125082721d2590a5e5e8897d95b1120120dca618c683d7dade04623cb1a4258ccd47a05429c228b48d87a8a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414dab3eb82c3de0abef0ec250be90e26e673526228301f0603551d230418301680143274e481933e00139cd4e50e7f42cd52a403d821300a06082a8648ce3d0403020348003045022100cd7a6d0635e941363bb2424df39c1be8fbef4e8f4f7ba04ddd0fbb4a0008efd902207448d9b041a803f6b9d07788aaaf23e16ab15a44e7db9e573e5a926721dba8eb", "pai_cert": "308201d43082017aa00302010202081e737e8e518372b2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042b03124639fa4d89fca2aa66d5f671220772d1ca7605d17e24ac4d7e7b47bd8bd182a85fa16f466d7f635f46499abdea211eaec7146208cef25c90d3c62d14cfa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143274e481933e00139cd4e50e7f42cd52a403d821301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202802b12408cba31c5e097ef8ca46481d6c5ed22e8766d4c049a9d5131e81601802210085a2eb460b96399dff7b464e543c70d0a1d543c5af125c24a6a4f00642fb153b", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304106092a864886f70d010701a0340432152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d323424050024060024080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e2135149a92dbe0ca02398b9dea402d46cc2149e20298050ccbbc102d6a2abdf022100b977c0aad94469db8fbe2305814997e3584494768d3baea235eccbc8ef6b820d", diff --git a/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json index db9807522e592b..5e5771102c0348 100644 --- a/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_version_number_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The version_number field doesn't match the VID and PID used in a DeviceSoftwareVersionModel entry in the DCL matching the certification record associated with the product presenting this CD.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa00302010202087833051dc59f62dd300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e828793a41eda8d9efdde853b217c5a17c0e16e2ce144120c4780cdc257004e8bf76f32cbd5a76294111afdd23cf8073592c77ad8414c460c6826f3b5a9f48a7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145cd566edb8f6893abd4d1c04e74611931941d49c301f0603551d230418301680148e7778040228fc629f85dcc3fa1dfe10a5c2c49d300a06082a8648ce3d0403020348003045022100fd05569524e9054428e54c012fa6a7d6699af9ae7ca4af0423d055349c4c09c5022032c3b9ca820c120dc96bfa5c0c54d3916fdd2bdb357a18f0a7054c93e5a17f50", "pai_cert": "308201d53082017aa00302010202082b66d1b34a08c30d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d96ad82ce1bb46c468b84e98001a8704ff11a1e071f32bc8ea936226dfb9fee1e489675f5f4978a90331a22f59d994d3c5e37373122a27c06702e5f16a3e1620a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148e7778040228fc629f85dcc3fa1dfe10a5c2c49d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b92fd57713007c3d2774ab4717dfbe896f94e937e0039586c470839c16ed1dd3022100eb0521d25d3f3f285771c336258a8e988124be5419e03d6058c753185c1476ee", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507896724080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022020c748c4293aa2b81659b0a91d38d1e35bc3eb41ce36221fdc2fb58dd33a26de02210087aeae2865e0cc513c9911a69a82d6f2c796ed2abfd0c3a2779e79d76447fdab", diff --git a/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json index 8b6321d787ad43..e1827ceb6a6d6c 100644 --- a/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The vendor_id field doesn't match the VID in DAC.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e43082018aa003020102020832adb0737dd0acd7300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000415f2697e787d00181354f898f65f7e018ced4c15c86164a69bcf75d20837376e524b991641ac066a2b20144c8de1b00bca902057523a7301b32d8ac4c450da69a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148f156be29da80c8230b174e8e83ec9927a25760d301f0603551d23041830168014d48b2c316539e3d42ad29a9b3b90775eb7a30e1f300a06082a8648ce3d0403020348003045022007b798ce60c8c0fe98c0444875e968fc2a1c402839989789863857851ea3d1c1022100f473c74cc7841444319f2d6f29570266451f7369f7418f42f92a5459cd971141", "pai_cert": "308201d53082017aa0030201020208157f8d400118dd85300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200041532284406a7912580aeda7612483096a3dc644ff2882dcf6e87501790d2d256ab2beae2abc8d07b56394b0e14d4c6632493374dcfb67ccfb81e3c89fcc6b2a4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d48b2c316539e3d42ad29a9b3b90775eb7a30e1f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008c868b4f621fb63184c12022a43051bf73bbe981bcedf78c44b4dc7864323398022100cde48ee54a93c0c2373f2a5de308fbc247691ce91d8a2576d04f0850373ef451", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a03704351524000124010e360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c9b82be3af53917e8aff31d191207bedf84b37b38db9c9438c2b0834c4a98f36022022a5fa1ee66e3c620a879b8b64165238c72c136c0358187d3b4727454c105fef", diff --git a/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json index d9c704ea4a9a42..40f67b397d6c91 100644 --- a/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_cd_vid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "CD Test Vector: The vendor_id field is missing.", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201e33082018aa0030201020208736178e6191897a8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048e3fe403838d9946a4f77157594ee7c28600f37487809f8303dbd565a85db0fe550956e121d4f9ccc113b82a4827857721b43274a8f7612ad486d036ea87b157a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041443a32ab12530dff0130d4851778e88eeb80a7ae5301f0603551d23041830168014b2350028b1fc772516e26f04be22f6c963a2a232300a06082a8648ce3d040302034700304402206ec4f784b52e2fb9a3733a3b074c45db84c3faa573bb2aef9e59647dd698716b02205767c6d2baf4567bbd412319020eb25304903af3b5b9a0874e303144c79693bc", "pai_cert": "308201d53082017aa00302010202084efd06d050ba2959300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040534d2d6c918c3a96e63f57be94ceb6d97bce8abe2e2d2c7d30ad9d12fec61a2fed0eff139332a152e40ef22720b3d5dc07ce1de84894c5842f4011c2e6e79f3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b2350028b1fc772516e26f04be22f6c963a2a232301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b7229c9b630cec2c53a1c2098417a8418f4c48579336f6e0c6108dd8b384f388022100adb8085f4714917274c93fb919789528ba6d35ede12e47b3d4eb8d6b5c5f5c2a", "certification_declaration": "3081e606092a864886f70d010702a081d83081d5020103310d300b0609608648016503040201304106092a864886f70d010701a034043215240001360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210099fe1cb4ec023c66da5664313a73149bf5d8c3d4aea85bcb77adce5955b40bbc022100e4861d428bd36d52967a1054c950195e6b9f94baa87b2e3ecf875a74397b429f", diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json index 68a341172fa433..e86d10b0af2fec 100644 --- a/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate version field set to v2(1)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010102083ba3eb7cb6fb2a51300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f5885a28e31cbc62c567542c3c1c8a3b54df9451afca02cf270f4b683f232e7087476332722d4981e3e9b7e3a26fb561ca1def1f2ad1aa4bfc3f335fa1cda037a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cefc2960347781458d49ae9f10ddcb124d8bfd13301f0603551d230418301680144f50dd7c6c853aca876237d9888b1d1ec3e60b9f300a06082a8648ce3d0403020348003045022100d063ad4c4b3b41eacdedefff0a76132c22f974b2d39188863c5b3913360ada3102201858dd9a65dd131e628d3d2c88bf9e772d2b9e068400893ffd0b136e661c3f33", "pai_cert": "308201be30820164a003020102020837029f464ffc10c2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004a8217a150f37a40310cf8429eadf6c8134c0f1f89366c6d2f74557990f056f62aa4318759930ffada0738864d913d239b6bb1e228a675ecdb59e3f8fc6dd14cca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144f50dd7c6c853aca876237d9888b1d1ec3e60b9f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210085998213b7727fb36e500a25af052e72dcce6b620ee45e5bf5c95b268abe5e17022015a7daedcd6489195dfe558da40cb3b1682eb8883e328d8bf4d89f84965afc01", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502204d3fb38c767492bbdd3811dc1f7457c065a4b670404656ae69f9151c5a03fec002210082239902f8046dee65d2b3354de83f292d4083c6f9dbc8a7487426762ee9c516", diff --git a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json index 5986030ae10785..b2b2643463ba27 100644 --- a/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_cert_version_v3/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate version field set to v3(2)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202081908efc4bf218221300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000476dec962e5904000cd9f27bf234beb45f4c4a78c53937fb8e47389a4f68c2954dca78f0165f190015c9b0e4fc45855f3ffd1d34e37efcdb535c96edb8306381ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f1be91588378dcd745b2988757ce15d0ad9471b6301f0603551d23041830168014e31628f499bf0098610ad2b5f7a3e9de13d2efa6300a06082a8648ce3d04030203480030450221008603cd3f9dcc7778233d641b3182dd661d799179a0fc955525960bd0d4d898dc0220498a12f7160b037eaad711d4168e0d60962435d3cfab5dbd0cb7bc9210206f19", "pai_cert": "308201be30820164a0030201020208098e968682049bf2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042b2285059c4149c0e35089f640d60e7e6fc65dd82469bc1a9b931b507c0ed9a03c74f2f62854a7798d8934f0ccda282cbba0596b0668add094e722350c902e0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e31628f499bf0098610ad2b5f7a3e9de13d2efa6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b51e0affd4462d7af4985e27ccf20a15baa4b8b8b3d2dff7a8794419797d77c02210086cb585c5af3c09370f408360b3f6d13f6d09021ae58bc3ab55af035e5785f9b", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502202ef313c5feb221f1eddd34a97ea43444f9a86f97909e45dd05ec421e7fc3e965022100fdc7b7f459c983863a90cf590db765da9db6f9c83310536770fd3e12b14b78cc", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json index 58210e49605c04..fcf062fa0e8df3 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_akid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Authority Key ID (AKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ae30820153a00302010202084b6cacca28f2d38f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200040d678eabcb6d2ecaffd48577ec7d6ce32cee7fbb83fd88a0261db48a311ca4444220d4065d9a637b680146b51b58aaeb951391e62d4b6d9e6b1652418daef3bba33f303d300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414edf6f700acee89c30181b52cdc7ce035886c58fc300a06082a8648ce3d0403020349003046022100e39de7644bc6c7df2bee6ea677be430ec551eb6be466fc32a83273b5de82beaa0221009890aff16d4ba21f1e48286be90b70e37a31f5e6b96da253c762fe11e6c7e60f", "pai_cert": "308201bd30820164a0030201020208422ac4704756678a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043d63829b651906834d8803cca3f7275a19b0107588ecd02efd15a90eac94bcb56ddc7ca53f90bd6c637a02b081fa26ef14b16308703ffe22120ed8d38b155ebca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141cb346961663080a366c07e5da9326ecb5d8393c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022054816ff16b3a3c6a8fbfb68c7121ed504f0d8c9820e32e5d0a01ad9b01d5236b0220748491a820cc39be4dda5d7773309b4f3759552a5da358ebe3684e986320fac1", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d94c50f3261628f77100cea34594e5b67acbefaa7e3ada07a5f74079bfd19203022100d96e258ae4ccc2bcc8bcf51537756e4e36046339f01e149bbe873129ea7af420", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json index 3438843c7872dd..b1157d6c97bbcf 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_authority_info_access_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Authority Information Access extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "30820206308201aca00302010202080f0adb750d58d690300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047cd0bc7ae419622908143e7dd44e58210f60f40f90153b8501440d9ef1c0998c042c06ec2d315ffbff161bf369f1e2798a41c3274eb024f927bec6019e115bdda38197308194300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cb73817e8b5134890901f64afb9947eec041bab8301f0603551d23041830168014443baf79ed2ce8ac121be322c591696d7c488ccc303406082b0601050507010104283026302406082b060105050730018618687474703a2f2f6f6373702e6578616d706c652e636f6d2f300a06082a8648ce3d040302034800304502202e1065617620a4cd52fe6a95bee5e7e93b731f75c5c60e2f6c495533e34a93e402210090fce33ff921169b5e90f81516f10583f7db861082651ecac035ba78f9aaa4a9", "pai_cert": "308201bd30820164a00302010202082ab9c139e3697f81300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004383bbdd5efbf439184db94779bc8872e613029ee241c9da12870a286c1a229ae40056338c75de07d538973692fa513c7fde5c2d35c72614411563b0a82eb4074a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414443baf79ed2ce8ac121be322c591696d7c488ccc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402202e9cb6821140ff4352795ef52e3b95c97ea8360a8405855bc7439fb00eb22c5002205dbf0d04f9d74118467e6542d59e19432e824bd1a9bfb3d8825fad9188a32a62", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100a4978fe543e824a18c9a3c3f54ebd419893b4e4a22abdabcdc3fd6dce32869e3022100e22b532c829406ce468c0206c1b995a30801cb8a52b70b9278055c6f868e6930", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json index 3b4c95122e1235..ee875e2cd0489b 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension CA field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202082a89723f6d68826a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004a8593b0eb959925294b794904335fb2e1890577033aeeae23d196118582c2e6b1ce7165135bb92f4416e6781eb1169459fa4fd4b36521ef8d4a8f6b9ca2b8e41a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e041604148b27a5fdd6d22159190befc07fac12de1c331a24301f0603551d2304183016801404647c4ceab82731e63d5a7222da36ad6c284ec8300a06082a8648ce3d0403020348003045022063baf9dc5b7fb720fc4e49ae80e662ce64834979453dda41965c3b3960b11c0d022100aa6d3c931a7d5b1da41e5716127ceb762ca4c1757f726b7d382f5d05602669c5", "pai_cert": "308201be30820164a003020102020815dc92eb5f39a695300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000419ed4905a90cd1eab92b974feeccda816e3c3556f467b1fd76515a88bad173900b85ea027cbe755b6f5d58cc415b7fbfb19db86bdeb0abc5fbd2a2c8783a999ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041404647c4ceab82731e63d5a7222da36ad6c284ec8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207859f542713c2a0e756983b4a86086450456d48d389d1ff31d0aed8befa230c7022100afa3084ff5dd21ff3cb14ef9ca57aefa182cd95fa73d41f3c5b9aadb6a8be2e6", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502207582b5c46b19b264491a5bf4ea91dcba332fd38777c09255c71b16261127f96d02210080f3dab3e24ebb6e37586c3213e3d8227d7b72895188addc678548e09ff055de", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json index c7911dec9b82f6..039f4955b706a3 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_ca_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension CA field is wrong (TRUE for DAC and FALSE for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202083b56a43ddd336667300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000445b4b2be47ed9b260dcb3e7083b62d826a65d798f5173daae437d43a44ebc471cdfa6f77259262643041936522f0ec35c84a3eb9589ed95279eba9afa8d81bbda3633061300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020780301d0603551d0e04160414da0e770aa51514be235842ba34494867f0a87d35301f0603551d230418301680145d227b7af2389dfcf038be059d03a8845fa5958e300a06082a8648ce3d0403020348003045022100f4d16c045c3b94aa44b4515ffe0db0af003a2edf98742c161401bb1223a6aee7022023a97ffc1d72704122ec036e9404b79a363d25bd9dd75e1420bcab33e724c4d7", "pai_cert": "308201be30820164a0030201020208399cc990009060a3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000436323ffb940179b7795f28f7b0777d5e92c8ab8fc258e2fab5efd7dc095402111c4d9ab60a9b3bcd761ff0c97ea88c39491a7e110efb2167407a0c1d95eaf95da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145d227b7af2389dfcf038be059d03a8845fa5958e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220038b785c2d8a1e213660b860d781b49794399a852bb303f5bbb34c5e6b247cc6022100e63ba37ecb72f10f8cb01075923a3f006808ff84cf8b8c997da657d7e1a6e3f0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022028cc0043c6f627c9aaef3441800fa99746c1a5728157df2aeb4946fc6c071ffe022100b03185ac043cbb929dcdb20274350c5290128b214027235e4b5480d3ee559e8c", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json index 18ddcb21e3562e..d642aaf2c9f2d0 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202083c39dee6ad443f78300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045d61999120ad734bc24c8c3e9a90a84cb6b51af16e0d37de263cafaf28d1d909b798576d25aa24d5626bec1c5d0b4c2657e0db398c94d0ba54ffe6b9734249cfa35d305b30090603551d1304023000300e0603551d0f0101ff040403020780301d0603551d0e04160414747770ef34ad307ca070906631fcb25fc2240e6a301f0603551d23041830168014de80b24cc570d05bcb56b30c3ca94610971aa597300a06082a8648ce3d0403020348003045022100e7a1b28d1e029ab2b4bcfb0f1b21288bc37bb25c54234af9f5cb2a2ba13174fb02206da535b89c9501e7a99a7dabf02981b61fe81841fcda04fd8f8a67421cc5b7b1", "pai_cert": "308201be30820164a0030201020208756697d1ce94f554300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043400358a3bdf6236c43f4d2a315049b439c9129c9cd00af4f52b00b32812c267fbc117caf5683b68eb252b01430c9896bc49b1581546d9aaff4666c349cc985fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414de80b24cc570d05bcb56b30c3ca94610971aa597301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ec865d2661a6b69a44ef4cd7ad7cf7fdafa6d82130e67da379fea4d477d40c08022058eb4a2ebfb940b71f0afa95f7619a911e7e051ab44b5de694a180a158c7b115", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502202490a27b9cb1b226d0b0995ccbcb6512a24d34dc49892d7bd9c8394776061e2b022100de5cc2332376522eb1dfee5e6fc9cd5933e5b9770b2ea597289a211f4b66fd21", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json index d350034e1f0bb5..0e8df7e0c0eda9 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a003020102020851d4a5d08cb1f84d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049aa9753a30ff3c64fd1ad087dab0d17adece618301e4169dc53aedb03c6dbeaa82b36bb45a33bb0c2b2ea04011595d8d9a61fe431aed07d7ca0f69b16a7190d6a35d305b30090603551d1304023000300e0603551d0f0101ff040403020780301d0603551d0e041604141893e06a3689a6ae4c7b9e3e8369b8c94ef457a4301f0603551d2304183016801494a409152a5af16b2e00d13c56af80a20322fa8f300a06082a8648ce3d0403020348003045022100f6acbc9b4df278a5bebd570e261bfa456a01eed1eca49a0c0e9a0d603978d5bf022007b769e544a8e3cf468428120f803e0d4b4182a67a03294ab4fabcd335d76eef", "pai_cert": "308201bf30820164a00302010202084ab968740d296814300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042fa2bb9feec3a00343693dd8d6ad018f81017e7824daf37ba64bcdaf6c5675ff10d7fbcddadacf4e4430e098da8c84c75a9c9af41270bc941299e7db04642ecea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041494a409152a5af16b2e00d13c56af80a20322fa8f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ba40d3c8d1ddc146437b0ace816e269beb3240ff76f851944df16934282d6b40022100ffee871ee17f746f8dfacddecf30aa1a86eeed8a7ac31a467a373eea19999c5a", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402207a3b2f30fdcc229d11dce2e6ed02f9517603b40df5ed43453e4cb8c66ba8a87602202cd7245305a1091e35fe40d5e65214a6be88045f9ac85647579f45262606e85e", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json index 03aa9b93626d01..fa0a068e4d41dd 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Basic Constraint extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201bf30820166a0030201020208542ccbf9dad43cba300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000431e1d0a4f3806cf848bc6786abddf0414368c9e8e52bf92c8b29727f51ed12966d5a62dc7f1cb593a3cad939aa7a97c59cc0933363e964031b9197271065e3cba3523050300e0603551d0f0101ff040403020780301d0603551d0e04160414436b63c18e30d814b871bb3474a5873a4412c44c301f0603551d230418301680145f287b658fd9a7591673d80cd11f50018bb9035f300a06082a8648ce3d0403020347003044022026814c1a9939549333821c691205961ffb72853c1721cc30b2e4500b1d8cca0502200b4c23eb42ad94bea9e35afc44d0d084a894dcfd53435ecadd9b7540c2dce082", "pai_cert": "308201bf30820164a00302010202086f9fd8a98ab9867b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f0fafdf21f5a7910fc1e8cead30ffe2361d0ccde01a59b43642e9f9a1d2e2dfad47c076f3742672b26821b5021cef6b2aecf80194cb7c1ba6b11a9a846f85ee3a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145f287b658fd9a7591673d80cd11f50018bb9035f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ba450ce2dbc3863c543405cbb765b8dad28e1729521c503587d3b9068c06419502210080550950f0572aa0767805737b0f7dfd93ea11a30818eef071e39543de59e25e", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022049da2eccffd79253257db90af188605d300f91ffee448766e7268e17f8ba9308022100f29e915e4a179959d7f0192d2459a8e7b534f0abe60219de6a8ad7c9200abd37", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json index 289f278da85469..fbadc9c9091149 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 0", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a003020102020871174449215ddf62300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000429b58a07cf52b3f6efbb339c63b7b946c827125f99a1236a4c19f57faaefaeec9748cc3d18a2c9416fe0ee234c9d65e7653c5a20a68c1de45e48f3a2aac346b5a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e041604146ef90b0c8e122dc424ef5ddc9c36f922cd621640301f0603551d23041830168014ea2b3f73c70d1e91485a2a4c2eccc4ef88f0cc95300a06082a8648ce3d0403020348003045022025390c50ce52fcf58251cebd6c21a35faa2f760e56ba9fa553bfdb0fd0d4e29d0221009f30d5b20ac08f8543ebb4dd6a71c1889c15eb8029daa33b2b7d81075d41749f", "pai_cert": "308201be30820164a00302010202084678cbbf38e656de300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042c914c52129b7f1f4b582205926773676e0bc10f57f896889e460360d730734523d7fb614da73383459c1b2c00d1f5d2164145f2127d23e4148bbe142211fda7a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ea2b3f73c70d1e91485a2a4c2eccc4ef88f0cc95301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100bdb293acc0bb3a1aa5cd4d3b4c9fc59239b8684932932365bb42040571ae5f98022036e9bc2296d6e41e8bbb8c4e7960f8d91196644e4afcf53fb8ebf868d54a1711", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502200cbe95b5a51390421af00f726fb09796e4afc87cc64e6aa234cefdda1ff1b404022100d303c3cf20f95ddbade9090b6bb8862bad9068b721165a370d15a1f93db4ebd5", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json index b707f4cdf72563..fe4bba9ba9cbda 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d030820177a00302010202086fc58fce497f4fc1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043085781ed7aba5f074985a252618703bc6a590a0123257091b132b30ea41f6f6cff67245c9284201a5dc93f9e790e40617c2b1201f8c90dbb6aac2b6450c7033a3633061300f0603551d130101ff04053003020101300e0603551d0f0101ff040403020780301d0603551d0e04160414f10202fd24f013a98856b2f6b8e0737050a84ff7301f0603551d23041830168014cbcaab55db4778ce253aa016c4db01a67b1d83d4300a06082a8648ce3d0403020347003044022077f76c063eb3d61e1682d83571b15cc1af35b28281d13cfc54adefa3beca1bfc0220166661e380c214fed2198d656a7828a9525e5e5efa2153af9da3c4706c722628", "pai_cert": "308201be30820164a0030201020208279ddc8990db76e0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ea7f9047324cf0d380efda4b84487f9f25319436878beeaad973c6378ffe068fe7a439c6896e84f96e911309e331793fcccc54909399238136e8b6e3d0fa684ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414cbcaab55db4778ce253aa016c4db01a67b1d83d4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210090b5d666fd5fc9572fb629a44c1602e45c512cd79d6fdd07fd00137f0a4bc75e02207d9e29fe8dbf530ff79950f5bf63be84e349e32b29692fa94ca86c4d6d2d5910", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a1c34943dfe859c5f0a5359796dc6a10c04d39c7ef5098ae80faac357ffecd1b02203fe70b403dfb6f3437101f389dcb56bdc09add14897c222b6bf28cbbc4577d29", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json index c21db084383862..74998c6f87289e 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field set to 2", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a0030201020208749b848de9fc6fc8300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200049ffc39348e12c9a3cb9e4473baa867b0ea17a30121570dba19b764c96cde81de2d0a1483bbee43f1a611f8c3bab803b020f919f135cd052106d8ee4457dba018a3633061300f0603551d130101ff04053003020102300e0603551d0f0101ff040403020780301d0603551d0e0416041478a5e892cb6ec13e24751c611d75680c1d889b3d301f0603551d230418301680146cba764869bca2a7708c602b810b5a7fb7cfdd8a300a06082a8648ce3d040302034800304502210095d47efc8e5c1cb9fc87466deff1777b369fdb5e1bbb46986794b76546d4482d02207470ddab67618b1c684fd1b62a52b748704ba370bfc58bbe11c21fe600ccad10", "pai_cert": "308201be30820164a0030201020208360f4343b7b7f7d0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ab1f3b6308a2565fa2ee43880a9242c0261f90a06ec9a57f11a9b32c228512d4886f5a2fede0e401fdbe9ffb22260f39e613bcee26504b4322386245d6268363a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146cba764869bca2a7708c602b810b5a7fb7cfdd8a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205b0843cdf3e909f9991ce8fb54d94a1ca1bfce42d3d044c00358cac93c1277e5022100c880ae96eab90cd3fa54939e97631a2e51086571dbf566219b7fa9d06dd01e2a", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502206f199c1ec502d8f15804f9ab1ea5fbb9a0f5cd6461d84cddb0f825702a6dc60f022100d57a257aaa10244c511b870fd9f803123e0df10b24e4edf669656ed1a0bdb9ed", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json index d253e27cbc5c7d..4e591fb59c1ef0 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_basic_pathlen_presence_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201d130820177a00302010202087d22548c9509fd23300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047a5f946faf1cac4d26d442e01acec757bb23033ed21f1aa9d66380a0570596ab983321a6622c41878e5a5e3d7274e6cce519e0673aa974450ba26165549f62bda3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020780301d0603551d0e04160414be9782bcc685ffa4348f4d548f9e2952bc3cce2e301f0603551d23041830168014aa8c521a1f45b4c5a352baf9b967c9a2189ebbe7300a06082a8648ce3d0403020348003045022100972e50f245c051eafb3f37b951a86d21413ab5a2d2f05940c5d164f878ff2aa8022009648b741f1e672a28df8c2f76a31d99396637b5553848aab541350c059c4f1c", "pai_cert": "308201bf30820164a00302010202084599ae62becfd7a2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041ecb6f06cc52b8a26f9b9b4ecf3fb0d321d12bd1957cb03e466b7f0cd2a8fba696bc5210b30acbf2c483d7d4204382abf4d66f81303c96818fe485cb9b13a32da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414aa8c521a1f45b4c5a352baf9b967c9a2189ebbe7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b1d26f42e3e4f049c9e5d6c3522e818982b04e59cb0a7a31b18c85bf11eafd93022100e36d9bee94de52af9d301a5c6c3313f48e29c43466fa8d211751d0e6d3abdd26", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022019367fc550de0d8f86325e9b3a1fe8a062894e97ad0088159c25421640d68631022100e78d14dfb028254f05a496eb027541ff71c13428f1bc6e2e56a4677852845eac", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json index d50e7b59d3422f..36ec4fe1562d0e 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_extended_key_usage_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Extended Key Usage extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201f330820198a003020102020826c07e13fdadaf74300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c1af73f31aadf87241edcf509a2e804781c4543f899e798eb511750c3cb4dc845ef9dc8b37142ac86f5805603840700b03883796097e4c5c45ed080e9bc3bad0a38183308180300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c66199baa73c7d6f96cf12ce7b65cf602504e64e301f0603551d23041830168014e83beedeb8b896935f5181271297c76edda5d0c230200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d0403020349003046022100f5fbd1b41261451a44b0236b769d9f973e8083761bd56d246fdc2e25d6d1ed71022100e4cdc36166ba78593bb907b2065267838a595ae47edd80427e8b034201f8c8e2", "pai_cert": "308201be30820164a00302010202080676e3d48faf5485300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200046fa6974e916a3136a2fbb352686387bbfa03ced00f4fef8fe03bc52ef9850564b089bc48535e9177453c80fb6d5d1cb62924a52d87ffc93bce7a3841a83b4931a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e83beedeb8b896935f5181271297c76edda5d0c2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502201f32b837f5fa576b91caa6bef6ae2500de51b0b9113474f36e4dde8bcfb93694022100d005466eca37d941a6329b8f790497fa14f4876e66e805aa7f5e9148950c1d0d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c3dceb4a5486a898f6620304bd70b3030ea9b419455aca2f5a67ca9e192b5ba3022100b7adae5df4362351230f9579dbee9af8946fce3b64b5bf9d596c838e3ffe57bb", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json index 0617f430376521..d8a8adb132de72 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202085348b71d57879b61300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000404d635d5be07c4308366156e2209a5fdbf94cc18f11e3c724d9693d8f1e3baa12568282f42bbb55eede338c52dd45c112ad80741b68656a7058088e4138defbea35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e04160414cc5ea58fc66136108949afafd04ae350ee917300301f0603551d230418301680143cc58ec619899ee81c163ae8bde46544cfe0338e300a06082a8648ce3d04030203480030450220376e6a1f774cbbc0146cfdb0385c639f237a9a9256c9f091e640006fa3074808022100db7d5a67914cc8a987a5bce3f0e85cb73d9f44502e5b1842d579398ecc6f3361", "pai_cert": "308201be30820164a00302010202083d6fb5d8a98c2fe2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200040dd923d0de469285babbc47b2f3dc862f78918a6bee3279379b45b139dfc4aa6c1f296de9cb4995fc537dfee841a4a9f99fedce203f57943612f0d0f1946bc9fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143cc58ec619899ee81c163ae8bde46544cfe0338e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022045fd0514bced09f3e770cdf71e565523dd7c198bdc1a6c87d1d060abe2387c7402210089c258654f1a89f8feeb0f0ee42fbd9c0cd3eeb9878524a6e64ac6767b4e058b", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022074621792528816a56829309de1dccf9d15d6346f2023f1a664a16b647fe97a43022100eb2eb9a4b1f738d462c578c18737bb30d321a2a89ca2d496f9dd4b5cbfc9fb28", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json index ca136fa6d03771..03acab338c5fc5 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a0030201020208099959334677fd34300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e9ccf6f8c208c955ce3e26924932ff176f3d79253e01335decd3eb05005e070552c9ae9c3a9b5a2c40b3da83bbd78fa51db04579f99d3a8e1e809cb44151db95a35d305b300c0603551d130101ff04023000300b0603551d0f040403020780301d0603551d0e0416041427e590aefc5446e019594cd218a24dd9527bd647301f0603551d23041830168014f5f420cf4f8968961caadd6d812281da1e447450300a06082a8648ce3d04030203480030450220463641e9ce1c371bd5827ad9d2c05dfacb21d4906b23093a2d06b1adf7e1ee76022100aa975a1db7a90c7b17cc8202917ae23bff5f6180f2bf513ff8313037bcd341af", "pai_cert": "308201be30820164a00302010202087647db73d75e27f8300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000435d4c111ed8b651ae24d39a66d7534c1ce8255f9f14e8ad060dcbc96969a0f7f49a4dd827ec6fcc925ba9ac55ffb7a3a001d7bafb03a3418c1982099b5fccd1ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f5f420cf4f8968961caadd6d812281da1e447450301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b3241d06d443f88962b9268ab8fc2e7456c038a591a29f2ef54ffbbe9f9ab25022100ce3da7a5235435b687fa17ae02dc878e756070c3808c0a356b32f912eb1ecf5c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220298b626198b5038bb9a7f79ba3ccc271208db7c3df475f3697807ee601e273390220121e915fecc02bf1715a32ed36bf696c62bbf89cba7747d9be787a7dba7cb353", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json index 4066f7d309dddb..49fcb1702240c4 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_crl_sign_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020868e0dac009f4c70b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000455e3fd5482e746ba7fdd5a28e01e58f02c5841681b5c94134e0d3386e4845b59765f065d451e01ba089b7a6d5d4aa71e8284b0c9cf5612582828297c45d75ef1a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020182301d0603551d0e041604143f7aaa92d6b76dc33647f689c1c5b38dcf1c1559301f0603551d230418301680145b740c56ac25d90bbccc73f87b63cd511a57cd95300a06082a8648ce3d0403020348003045022046122080b94fc7767fcb43b7d2b77e66a918fc0f8d792ab411912652c838259c022100a9eab5046dbcaef8d2a9193186a86fcbed42b651c6c74f6da6e524349bbc29dd", "pai_cert": "308201be30820164a0030201020208157c8cfe500deb91300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042dcf3568044c9481cd2c6b0ad4b6740500629a1318c8b73a741f17ae639fb5f59f16c715cdb27e995d39dce78bb805ed5099d68113116b41f9a78a2eb4c6d4a4a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145b740c56ac25d90bbccc73f87b63cd511a57cd95301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502203b233512afda913788e740ce27fc06eddda62e06349acb066b90a9f11a3904430221008fa819829062bfd84d8e82732e891dcf3e7c6475fe5d8341e0eb9185224c9827", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022038de2b21625bd80e63b2789ca3165c934ed6880ca7785570e9eac250042639e3022100f97714fa8caa770eb151ee032ddcf91e7e12cafaa89a2930f260e631b9d98419", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json index 9fe2a05cdd2a71..95ffd720f33281 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_dig_sig_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension digitalSignature field is wrong (not present for DAC and present for PAI, which is OK as optional)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208611516cb5e8ce57b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000445b50fdfe1cc48523ea80ea86773611d507fd6d7df96b97a00e65118e908b2e8de80de34522efa043671c42648b8d1ad5d4d497f2b68bb275a7d5ef5cc977439a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020520301d0603551d0e04160414f3bc17e68fbb09ff2a77f7f06499b32b91d74d01301f0603551d23041830168014a66e9305a0a0bdfe507e29ae9e2e0fa9ed61c920300a06082a8648ce3d040302034700304402205352aed11ca8a49ab9fd1221cde5ef90a993f78af55480afce070ee92888069802202e40e6757b97f9a55aa6a7b2048b20a3537a27876b111e0eb2b321724d92ecfc", "pai_cert": "308201bd30820164a00302010202085ced6956be8aa63b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004cf18213b48c9bf7301785414ccde69bd6ac7212ccae0f41fd4d67b3b658d36f60a60978ab7522b3899c815fe374795e7a994d6d11ebfc2403210599fb778e97da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a66e9305a0a0bdfe507e29ae9e2e0fa9ed61c920301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205ce2d4931c0f16df3ee2d7b7c0566e103aff4d5a975c139ca926a781da50a3f002205e56862b0376d06f4379519b19e3731f21aa287292816baffe1570031aa50656", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a561ca1272a12d7e6edd2b0cac5767b57e4c24c08ab9089b5494feea9090b6d902201c80bc16baca9f9f0c82f8fa96e3243e87506ac1061a0e3c4bf7ed99ab7bc43a", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json index bb3c12e010b7c2..5a2802ff55c83f 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_key_cert_sign_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202084ceca31fe8cc1d0d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dc2019cdc198486fb105aa585ae2b7afe9fde3cd954ce68b7ebdaebd18bcaade8763af72673ce4b207b7740d8308d7087b68638fea8926496635d9c584adc7bda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020284301d0603551d0e04160414ad528529598849df671c22eb8526c9e0fd99ca33301f0603551d230418301680144adf4539d1902c0b9291fdcd1f5029bf352dd179300a06082a8648ce3d040302034700304402200f1948065b198f04554dd393b7d778b3f2fbe04a0ad677ad2e9991da822917a002202dc4540e2bb6393b768830547553cf5abd65cd4766b034a33f2b98e20a9e042f", "pai_cert": "308201bf30820164a0030201020208693f674e6ceb37a2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042edec26ffcb4a4ee30202a348962d50206a340a0a6719301300f9a7ef0b919b89c97139d705e52ff0b9795bbf785ef22fb7fb2e3270c553aeee331eff7006fcaa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144adf4539d1902c0b9291fdcd1f5029bf352dd179301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c9a5d2168863c80821ae8fdad1240ae832b5dc88d9548c62285b2c841b35e8c4022100f6e5972f2b1a33279fb7d41d47f23591977f358c409ef0bdf7012f8e8a3417cd", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e0c8bcd6f8b5eb6d16250a0687afcfcc61015d83b1ec39eb5bdcc189d0e5048b022100c6a3c7a04eb90cdf844ab205d61f86377829f3051f41509c505e94077ff39f0c", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json index 014486db725b2a..d009ce9d3c46c1 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_key_usage_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Key Usage extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201bd30820164a0030201020208215044dce27eb102300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004612aac6db63e5765671fe50f881fc9e90a38ac1fbf4949076ce258c390e57e21ade916828afb2884bf8895a621272fb400d689163db116acdb5da464ff0460aca350304e300c0603551d130101ff04023000301d0603551d0e0416041489b91701325ce525f7c1fc5cccefecf6218b71f0301f0603551d230418301680147328ddbeece00ae84eff0cf947bcb0a858bfd0dc300a06082a8648ce3d040302034700304402205103c4420c96c641f974db5fedb3f2c12c2da211d4f20ba2d2cb55183b2dece8022001995dab82273f252b6e9e13cdde4c52afca7fe6d3d46d32dfe68bc6d2029c19", "pai_cert": "308201be30820164a003020102020810041d2abde2b12e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000458be50cabeb209738307adc953e1d7d9841b603c817d14128770eb320afa980490b749c2cd9d173c7fa70cf55dc523aa76c171a10df395b62e47a867d56e26dca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147328ddbeece00ae84eff0cf947bcb0a858bfd0dc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100e596e48cd423eb9540f861336d7e7a1e05245a50101b9d904380ea8664629e6c02207dfdbc97e12b83e9a1fce02e532b08ca6e2abfbea8b323da35ad9b4ed7b90a2a", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008045ad78fe8fad5793f806a2b9f0a09cb1dfe5d56bf8634d5d8b7fa78783c9d402207463239b653f440d424d9ae9a3806918c6c9257e7ec0ed8f2813762c2487c45d", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json index e5ae862e44b3d2..882bd28f3312d1 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_skid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201af30820155a00302010202081624edc6605cecfc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f1d31a47a1cd755e27dee511a2fc6d9d7b737242f42ff0ae0e30bbbdac292b5c0575ec2ea357b55f23e79f49b8a00dd6be753413b0354d60d7e64ace2869e4f1a341303f300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301f0603551d230418301680144baea6b29882dc8d950b25655b5125fa337dd193300a06082a8648ce3d040302034800304502203a1e77e24d4aaa8235f90fb986d8dd465023e1cfd8adc6f24453777b0a345fd1022100cf6999b65788156f482dcbb1894e9746ba8784f34919ad775d33510727680211", "pai_cert": "308201bd30820164a003020102020875e948035f22b7c0300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200042c4ff7bc3c1ea2ee45973921b1f5007ca11d4374065cbed6331a06774670a11a9fdf949b87c39b28441fd7297e5cb8bb776ad16c354c109d83d4f6580f530c8ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144baea6b29882dc8d950b25655b5125fa337dd193301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402206311a445fcbc207559893b6725803f100c40952ef548aca996a2aa1812c908e702205f7824d931e848b08870b7a13fd3dcd31288f9bb7736c570e27419a932e6a4ad", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220556a3bd62b64c80275221b1ed77ee92886edf238ccfc5c0aa45eaf2bb9d2a2d5022100bd8481340dc5e0d2d6c73fa131e32eed0d15e305abd5127e53e2a4e0164c2a6e", diff --git a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json index 23db7bbf3ed594..e0f737e0511b69 100644 --- a/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_ext_subject_alt_name_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate includes optional Subject Alternative Name extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201e230820189a003020102020863fd2c36c3425772300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004277673d904f61fdb8937ff76ce0f4526ca57519cbadc2a2b9575220b5b96eadf4753025b28f2873878a7dd24a2799a7ceae717e7bdc95dfaaee2413a63af7347a3753073300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a8172a9c541cc215c46c39a00245808a36d892a1301f0603551d230418301680149c0190bf16a2c24db91025bc806e7e86694c261430130603551d11040c300a8208746573742e636f6d300a06082a8648ce3d040302034700304402203850a8248d4fa35f358a5870e1528434a27c7daab752d0688b5710982b6a8c240220403309ed122ddf0a6a23335b65439a55e399a051b30cfae046401c9aefdf7a00", "pai_cert": "308201bd30820164a00302010202081d89c8f23d658174300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004306c393635a68d0f557dac73f1d4d17da33f80cc1b8f056a8f6513d28b44a59996087ac57f002628c3464475856555b175b055a76a3f79ff6ac306b0fcc90de0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149c0190bf16a2c24db91025bc806e7e86694c2614301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205a23780da0942070d5353875fae9df3241648ea458f30d3bf2e6edc796e97400022002170e33f252681cef2cd7d249771d6f390ecdc6d766b0792d071afd7e513528", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044830460221009942c494728d2f6703ad6df3c14d35d9df4e60d40fe62af4c74bf4e0c31924b4022100d3cf9ef9427fe415f121638660a5b22b1a314f4e485be6b6469fbcaafa1a73f9", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json index 13a95b6b4eaf7c..b9d0199ac277ad 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate signature algorithm ECDSA_WITH_SHA1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820173a003020102020864fb8736e4754686300906072a8648ce3d040130303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047420dc78fdb8cae68663f3a6d8516853d1b86026752e00ca1a8f283011c6dc143c38a91ae52c40588ea823f1ee82520656f0509d71405645f9df04d4e5646e19a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140f44403635d6eafd79b22ff6c901bb052c3bbb2b301f0603551d23041830168014b4edcb1351cd27facb24982c663cc803266760b8300906072a8648ce3d04010348003045022053fee0973bb4d8778f08fb8f00996ab6b109b9994e52f382eca00d8eca1f944f0221009b0c99672f16ea3947277f2bbef916267562dc990e824d1fa391685d1571c4ce", "pai_cert": "308201bd30820164a003020102020868cea4056d3de1da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041e4940f0f728561c933a879238c3c14a7b9268bc8bafe67eb4bd33a8eb84fa5d129535e8996e3447a35c32e7d808776c9c45c9c5cae4f6dc2c8faba1d4aa4d53a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b4edcb1351cd27facb24982c663cc803266760b8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220689929a3c2e2da24d1ccee4764da7c2523aaaaca9f2835217108daf9a624d22d022062347d9d9c64259f4e354705e41dd92380fa6c33b683deba2430b020d934eef2", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100954bd416e8fc9d9e3732717e14248df49200cfb0264f9efbd2ef7e7dd5031013022100d9fcdeb6dc660c2fb9dc93518b3326e127a8ee52a56c7cfb3b1b108d5453af6c", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json index 591298dea07bb4..eb5e3033a0de18 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate signature algorithm ECDSA_WITH_SHA256", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020824f194f28e119296300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045d288fc7196587d1aac5a77526009c0b8ea2adbaae92586a5849587314e0f7f6c648d6d5e367f62df669b3b3caa8becaddc0c9449efee47e5dd260af2cb10afca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ee2830029214d5da28183c52a557554cbfc2b943301f0603551d23041830168014f155cf235ed49b00fa8190434153698a284a8651300a06082a8648ce3d040302034700304402200c3ace47a075c421ea59fe213a239550d9ead779008d7bbf80614a540d32ab60022001055efd005ceb0d444a6688e27d6cea2f6647646710913a833d3129a5d33a6c", "pai_cert": "308201bd30820164a00302010202084f3894c89b211080300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004088513eede3ab06f4d9abe3a25923ae513f6777e35ba254b34613651376ccf78e6eeda590685ffe90b5e9189e45b7f5dafe0baa337cf18fa6a5dee42260bbbf2a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f155cf235ed49b00fa8190434153698a284a8651301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203470030440220052019ac1f580c3115008252de19ab594f200964d252c6d440c9d7f861d5911302203a54ae629a0a181d39ad3e9f43151ef8f240507db6d042bc89eab8341ec1dacc", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203599859820fc64f9229084378c292e1c5dea3cf6fd765d4ecb48cf70c2a2f9b702202825485a2177c59251ff7f3e4bc3a447c2eacfff5d29281d104193f634e00700", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json index d31111b3a49436..941e3271ae7eea 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_prime256v1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Valid certificate public key curve prime256v1", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202084fa605523a924039300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fb73081dcfa2edb8388ec783661740abd2774a4ef2faabc869d7ec3f805f8558bead9c2d13eb104ee8098941ee9eddc84bae682433c37e5fc95fa68535b120a5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fc8bbcfdb58cfd7cbd6473c19a827814a157d87c301f0603551d2304183016801446595df0f1411c1644e21fcaee47d4c02f248428300a06082a8648ce3d04030203480030450221008a1ee737ace2fd03cf6cf7b422436ea3c1a702530617f2ab0f22918579cd6e5d02201d57b49f7b1d564bd7b29a2c73c16fa412e698950baf2bec1e9c02bdfec3c7f3", "pai_cert": "308201bf30820164a00302010202084f92417a050994e5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000434e3ca01932672dbcbb2de13833866d814680b68c2e11d8632fcce66726753fe931badc727868a1ce79a205db626945163a9e231a2cfc552f7acb0559bf33d8aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041446595df0f1411c1644e21fcaee47d4c02f248428301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008163aaede9e613c8f90c4dfe2f51be67294448fc0011e5ca8a2244a0c8b10d3e0221009d7014afbaae2b19905b6215276653802eb2fb1cc1188ac563937195fc79089d", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ee94924e33c79dc11d0abc6ac93ca3a759d45524acc643f896056a8e32fd58cf022100e63935de6e1211a8cffc4877b6627478958fad5eca2fcf50f310d44c4f75d916", diff --git a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json index 2e6ed327486af3..3e17f75cde7958 100644 --- a/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_sig_curve_secp256k1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Invalid certificate public key curve secp256k1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820171a00302010202081866a3a6b7953852300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303056301006072a8648ce3d020106052b8104000a03420004f088ff60e922b7a96c21551efc6f1160fa48867b2e94950061c89ff7609670a96f1e08b9a85e39c04ae9aea903dcf23ae970386f21223ca4193011dd639c126ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604149c8f72681f6ab4fcb1cb4a7cbbad8da23dbd50fd301f0603551d230418301680145853934314b362f5fa3516761838ebd60d68a0f1300a06082a8648ce3d04030203480030450220521d46359aec4710281048ca439e1416b8883224fa7f3ce76716a4d74eb255d50221008d714bd9347f081239f4c26b38e9c066bdee431bfe28f3c1eb062b3957fb769d", "pai_cert": "308201bf30820164a00302010202083072d109efc5d603300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200043eaacbcb56242620d0f15864fb9e97622bfe1375591ceb294a283ddacc5ae841c5e8ca5dcb908f22fddb57094885ed3688edd5559aa9fae96afd0cb44d5434a9a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145853934314b362f5fa3516761838ebd60d68a0f1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c4021880a744b21079ecf98533a63d674755650dc0c35cb849d8bde14895baf5022100e45cd3046e540c195ebce04b4080afc6074f826590909c5707ad174e73fd256f", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202c7ea0026fee921c2266373c2134e14e7aaff35e4550b217db1f74ef160f7e2202207ba6bd9a23218fabe3ce14c34ef8a186aca257a34dc8e66ba10741c586a6c45b", diff --git a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json index 71e64580e6428e..de9dff5afb3641 100644 --- a/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_subject_pid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: PID in Subject field doesn't match PID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a0030201020208551e399f250c0835300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d0301070342000420fd52098a02c099a0b86a0f916d91e695ac582b378306417e531f2408f19a8b82844fd0a6c03a8fa661fd0b97f55d02a9ce9f27829a7bb66420359ac93ebe9da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041441c0285c10a3cc4e512bf66221faee35616b41ec301f0603551d230418301680144df465e80dad07c9ebb774f907cf6a43cb623f90300a06082a8648ce3d0403020349003046022100f076fc3bfe9ec463f57718d0a80e5cc88c7ae965e98e4235e17d811ecbe9633c022100b98dabdc08cb3ce17eb8cf2b3b78cb36340b09113b4ce6e34853488fce7c006b", "pai_cert": "308201be30820164a00302010202087c7b761799be9ebc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e1044ce2148836899fa9ecb81478b0205816b5e5775eed2ddcab9d58c3e971db3e508786ac31047f5c854e98a3b9151959e76f304d118d2696bd68cfa75e5b30a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144df465e80dad07c9ebb774f907cf6a43cb623f90301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200b6df23fb68eb1714ef2190b8b9195702c2623c21c6f81b3d991e171d7e650de022100a5bc3cc9cb5138ba0127e84dd7b5c5b42aa5f33757d6f231a9fb7f6534deab44", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100d34a8ab1574e04baa20fc24877b4db32bcd0c6012369737f0408091bbf17c46a0221009c8609a1ab18c44c85ad54527adb49d94289ad0219717f931247877be416e755", diff --git a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json index 54654882246a19..7842af988a7b5a 100644 --- a/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_subject_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: VID in Subject field doesn't match VID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020878b6ab2d77f820c1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000498d621a99b15a5f6df769e6c0f17041fad89164fa035e0d3f21e338cc257332186265663200b697997716dd8ed374e93714bcffe680b7174ac06061698f6cb92a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414f54c3bee10d991c2f415b2851befbeee27c92609301f0603551d23041830168014aab0257418f9f8f9ae317f0de08edda1de9b3270300a06082a8648ce3d0403020347003044022030046109abb1dffa97c7bff48e46abbea1741aa0db7e041d4a08528a85c7754402205b12ba25c7b5e49b77e9fd1a4ef92bde48dda1db8776e50dbfdd2772b64f043c", "pai_cert": "308201bf30820164a00302010202087268af4a142801ea300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044b4c6e509f3fd142ce7f91e2d82f2a0765e9a99ef150106f36bb680e6a9790fa6858a8a0ad2039265a240989b97d8278c5e9dfbda3e28f628734f8df1b6dbc1aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414aab0257418f9f8f9ae317f0de08edda1de9b3270301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100dbbc0a6300d09c989a48c2e640f6e7f759b4a0d716f719f03d77d84db0c249b3022100b60b0b242a0e4dba2903419e6eb145e5f7ef9bf2783bf1bab93492ff9d5e2c8a", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100eb10f6b73cfba8500f6cf106e36e7b11b5b8672872ef39f9fdd4f67701119916022100e0025a63abe9c70577dd58caa15fb18abdcdaf357e1ad663a28626984299c6c8", diff --git a/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json index b3623c513884be..29af9fff6ddcb1 100644 --- a/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_valid_in_future/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate validity period starts in the future", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a003020102020847f5c234304b0eea300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3331303632383134323334335a170d3333303632373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004dffc8b46b0b48fff1cae51e2c6ecd0665f753872f4c449087eabf6f7ffa71236e61befe5ab5a8e999205f304cd2190370c3e796cb9dfa3c092f2a86c2609bba2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d2a45a15861772b85dd6c6424aa6e2bb2699e3bc301f0603551d230418301680143d564896f8107ddf5806a812ac6db916614ef69f300a06082a8648ce3d04030203480030450221009f09b8a2514bf896fc23c3887ef12d5d15e86bf8fb634b0041ef40a4f06690b102204e4ef9bc2c238c9df62ffb8846833f70501c9329538c4524f3e23095bd951651", "pai_cert": "308201bc30820162a00302010202087eee6a44e8b53a7f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200041d4eb35cd8828c1887806db9c283ec3c8eeeaaa7dc48e16f4c3f14af005e15a7a0add8a736a9bfa9fcfe3dca02a3093d679ecd3354d5081e2c839376e09d30a8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143d564896f8107ddf5806a812ac6db916614ef69f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100cfe62184f758b1472e7cb1d4aba2c8bfd97a84d5ac4c31f61d6959fb65501f0702202cdc7eccca24b4df5f1d0325a20c2d42106b46c6f9236ecfbab634843ed32104", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100dba9d6d965f78bb8abad896e8adcfc6d282a4cecb5d8d6ce0a8a066839f29bf9022100e230a8ef5cf5bc455de07a1402fa9c8b83319dde36af7e88456a5c0ccc4865a4", diff --git a/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json index d48e04537ffa3f..092d6988c5b91c 100644 --- a/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_valid_in_past/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Certificate validity period starts in the past", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cb30820172a00302010202087998c2933542a7fb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3230303632383134323334335a170d3232303632383134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004209d671b451f4b2578d2f933241b9d1935044757af06cb76e677fa37c16227726dca7384e34b0cb85ca51afd268a878e55963b65beddc5f40d2ccb2ac739ae1ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ffd806e2e6a889ac55f204ea0a8bb3f0c3d01f92301f0603551d230418301680149079fe1583f7b6ea355da01a02ddb614f11ba531300a06082a8648ce3d040302034700304402203a2ce7d7fc8436e212d6b0587a762f0b085b7eb607bdd8bdcbd4c86ae9b17715022030edf4169b2c96899849a42255c9bc7aaf8e04465eeb81a453aec3374f8620b6", "pai_cert": "308201bc30820162a003020102020816f012fe28135023300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004eebfd588e5d8957dfd59433e7cf86edc419fcb657424015bbd1fb4567775391e02644a382ace6c9000ea79c45e58d0f8a52b4e7918f29b946db412169a52840ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149079fe1583f7b6ea355da01a02ddb614f11ba531301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022077691f6f34428bde66acf50b95aa31be46274f4264dc77a3a52b2f7ce3f041bc0221008662090c1105194d42d5192c88877dcc1b4df0ab0e620869c89e806b131760b2", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402202b43d330506c1dee3c9c1b2d40a91600567630ee881814994d8993fbae8a6ab002206f91e1a6a1a6b75f830f72cfd5fde5490567783c936b51f67595c7a5df1f2c5c", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json index f503b4acf3d6dd..c8d3948ece98e4 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_01/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a0030201020208218c28889f5dcf84300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d0301070342000454255cc112ec505476e1b979a7935fa85f7126c4567c261be5d282fc26f6c85113db4043172eb3c7cd8135b907bc28e740839ba0215862210728524efbcd8e6ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041467885bc65c513e9f715aba9bf2a09930e244c1b3301f0603551d230418301680144710b9dc061857dfb72666f42648b9108b3ee007300a06082a8648ce3d040302034800304502200ffa0ca4b1fee309d87542e3b00ce520cdbd6b96d587ac8f947dde61f29e0d11022100a9b28c7e6d379582b6d97ca05a0f4a51b4fb1895a8233b4dd56cf2908107cd24", "pai_cert": "308201d53082017aa00302010202080dc4ea29d33c798d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000499fa98d8811876dd5f5208194d13ff917ef4aa0f33a604a27e38ea218507dfaf07db0bcc8ee09be80fb668e0896f6cb9679bb4e278ff54ed190a1e359d6be1e1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144710b9dc061857dfb72666f42648b9108b3ee007301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c8acebfbe735bb9a69af26f77472af404a2cc1ec6dbc5094c62fd1a42e8679e302210094df643736bea83e987a029b82c819a2b40c9d1253e0c38115174c9778fd2be4", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502210080094e7ed4e6513c65aafc6ed4a62c5ac44b191c0101b3678a3914be841913c702200642b29f67f492a898ede088c207a448d108cdc4ae992016d1e0dec1c599e750", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json index 8f7047b8b3c101..ee4df7f78ec28a 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_02/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201dc30820181a00302010202082bd17a8aec741a87300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7069643a30304231204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000462ee4e03f4e5e0f9e995e5bdc8b8ac822e637a5d4da1b8f0ab84414741d109b1cbf2e5c08210c445888afa14d5813744a0c32ed1ae74098e66d778b8e92199b6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e68b0e84e1452483fb9ff6414e045201d6754546301f0603551d2304183016801495e3dc38383b32b155de4430f1549acaea15ede9300a06082a8648ce3d0403020349003046022100eae3d005a98989ee75b09667c159b9a2c4b8ea506e5cae15018de3a39b3edd8d022100e002e74dbd037c90b77997112856b3b9012ae8f8f1106c79dee376dffe2e2171", "pai_cert": "308201d53082017aa0030201020208118f5672c3cd3bb7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000446e6ca5c4e0591b98886ee982274b1fae00b0635fba2a418a9d87c7f88b88735e0e87c012676fbb6c3aead87181f237a3eccd95c545786191a57da1061902609a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041495e3dc38383b32b155de4430f1549acaea15ede9301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a97b870a7b44e36d6b760fd854454f879c496da6d358b1a5d16450b15ff5d999022100cfd5091a46a0b9ad7793ff783258652c04c0d1b7869e33647223f6b2c47167c1", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c345f58fbdd7ed83339dffada42578b622301fc930ea5b93d166b075174179de022100a83e0a21d78bddf8f4c67eafa98da04fe212fe10345168a44f94c564d53d1269", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json index 63c39b604b1c54..451663474dfd6d 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_03/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid example showing that order or separators are not considered at all for the overall validity of the embedded fields", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a00302010202083756dd5e5948e624300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c204441432035434441393839392c4d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004b60c4242a83072da725974f05e9c378e8c5e9199a0075c27d5fbb3c3516be1b19dd359330396c7d7289e0f62257b29aff2af10925b651421a849853fdc00cf8aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ac88377781ab961af7a0a3f3d460a95ffc6b213a301f0603551d23041830168014f93941ac2d56ffba3a7eb9c6cc48c236d6739485300a06082a8648ce3d0403020348003045022100d9970cca51d4f368cbe877af4445f8338b00c5db600be3c5dc1128e3072e6dde02203818d384eb817c30f12f531556f2ef0dd3dde8b674915c84586ee11b817208f2", "pai_cert": "308201d43082017aa00302010202084d2be5dedf5d3af1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004013ba7ac6a3b1f23d62b0b55822d903be033f001807ed79f0bacdea514c4dbbeb649004fe13276dad1bf3141973c2badc705da8995f9f4b4c610e146c8c95affa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f93941ac2d56ffba3a7eb9c6cc48c236d6739485301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022054a160e148f4b1aa3027e69abc31d67b45613466f10933c5696960f10aa2d5e5022100bd34c3285635c0b84c86582b3d0716d8c84d620099ee008e6f27ef0ba69f2750", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c652b84aba698335386111a799fb3443520ce1b2814daeebf86abd85f9730e48022100e47e0a508493fb4c1cbaf88b52bf71d958799452b7739540925987c44a71fed4", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json index 2ecc078555da1f..2d2a34eb8469ae 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_04/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid, but less readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820180a00302010202086e7bbaad3ebfa8d8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20444143203543444139383939204d7669643a464646314d7069643a303042313059301306072a8648ce3d020106082a8648ce3d030107034200044f0de20910c7136428ce428a85c0f7339ac0ecc6c25075f86b2bbd3a3e45768987834215d62ae2d17a253f3d0c7e7c3706f91f3e69a4f71c5cb2e58fd1dcc416a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cd814efbaa0fea8be236fd6d7e235b541193e16c301f0603551d23041830168014bd410eaf521aaa4e90382e6d464ffae404dcc07b300a06082a8648ce3d040302034800304502205e5e78c65005711d60068a717c114e9540eb5fc89a082bd347230fdd18e28d65022100c48a04a1d307d15fb9b62965ac66051915af50c87ecae4e43a28f74b4ab909d5", "pai_cert": "308201d53082017aa003020102020827c6ddb3cfcf32f1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004405df1a48a5a2f58245848934fec18b7cd66ca2730c2bbd53111ff24b4b9b4bac51f458bf2c6bd344fb6504aedf8f456f77c6407e156154317f53500b356c62fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bd410eaf521aaa4e90382e6d464ffae404dcc07b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221009fd6463bf0201e3287a713f925d668b6c54f075b554782256c4534784cdfb5ef02210090820447701b0cc663af7fff6f15590e7a443e4d6788d9078c92ed766315b877", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220100e16ff557c192bf3ed3d07598599ed5cbf264ad6f60bb5b033fa35a2eee1cb022100d51aef4415d156224a22c8ad01c9910fcfa094b18e5ca17188e07a7cd0016bd8", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json index 0ae04af0363c25..7bc4d1ea2e0881 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_05/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid, but highly discouraged, since embedding of substrings within other substrings may be confusing to human readers", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da3082017fa00302010202084488071c48c43872300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2044414320354344414d7069643a30304231393839393059301306072a8648ce3d020106082a8648ce3d03010703420004ee4c5bad28b2f0523c0fcbf5560fabc01d08c73efd1f6804de97408bcee7c583814e2cb8e249f0377b30fdf149f37374d584fec389f1ae381efa8a29f658167ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414854d2bb3666656944d04a0a6ff6feb43966a2cf5301f0603551d23041830168014cf50a43f2fde415036c0d339a83279503e1520d2300a06082a8648ce3d0403020349003046022100f069e4ff73b8b15435c163da275ee51cd04bd65ea4f31cd2d6adee9158ff5c230221009b8c6bb3d694bf68a705835f30f10bce400b728812bbe69a68489264fb165bb7", "pai_cert": "308201d53082017aa0030201020208055f644d34af6fe2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000401e61a17689fa5f057c474f0dd495d938365081687b8325dd37feb99072bfc7def72b04bb890deea110bdfbb44516d6eac0f6e68a285f057a830d30f179f5a59a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414cf50a43f2fde415036c0d339a83279503e1520d2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100f0e2ec517536a6e74fd8b543229dd6b0397e259063405b32d4002df3a2e26c38022100e593dcd186470449fe26264cada693ab361c5789887dd2553049767597f9a7a5", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502205e1ea3ed215af5407a4d0b15f57b9456a7338a0ca60451a35d75adcf6ee5ca7a022100e7f6a4d997457a40d1cc798d00b3166e0a35e4b362f098dc5f6a952ebf044aee", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json index d8bf73a4323047..7c8a06915131e0 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_06/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d930820180a00302010202081e8fb8b53313faa0300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20444143203543444139383939204d7669643a464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d79211241a9aed2da74e1ab50f93c7379f1b93151c9c887144b8dd12bb285faaa2e83dd2ebbc856e135fc5c17b09c57a60a60ac9700b13d8110e4c5e9a66acdaa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414508e71f1ea785992e921ab1449a43ad58aa4f3af301f0603551d230418301680145cdf2fabbf52c17fa5e7b2c9974e1ebb19c71b1b300a06082a8648ce3d040302034700304402202686df38f7a27c889481fcd722cfcd36c62eb5c5887c8614bed3ef2f7eddb40e022026f8c3c00e971320590fbbf7c7b84526b43deaa02a66364b68f9b01383346a02", "pai_cert": "308201d33082017aa003020102020829ff9cd0d4fa3679300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004a052c3ba7ffcf738e3b9dfbbfd809aee3b7694b3eba78d6da2d7ca31339d2e5e6ff33b22719c26cfaa5da93297cc77e1506a9b333548cdfd82081a16e9b7406aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145cdf2fabbf52c17fa5e7b2c9974e1ebb19c71b1b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022033828a26306e2f18315e270cb26cdc6ee42be922ee69a5aed49a0cf8fb53ca9002201ebe4167282c703ad9b5f05ff7774ef819cc07050288f930cc7e98b625788b79", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e1a9240f055e6c87e0a4f870d24664cc6a1bca1b32041e41ee5423a835ea6452022100a2449e952ac701724ea2f44c6650d4e0281887e3f3506a1d6163723749ad7b91", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json index 0da0d32f3e62de..116c5079385001 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_07/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da30820181a003020102020808cb431057aecabe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a66666631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bf1ba2406b80a7c0c9d2253aae44fce12c4c4b67655a6482af03d8427aa7f053dd5fdbbfd12d5021128e612bd450ac5bd0b287b4d6bdc5295b5b77cea8312b61a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414566544693fc947f0744779ff1612d27191d4173e301f0603551d2304183016801465c4094c43bf88b432b816f7d25d27a229a2f313300a06082a8648ce3d0403020347003044022064693383f20445ae19986ffa44cd335c19180e75795f2710abbc44603d64c54e022054fec013f7943cd789948495376771e70383bfc1037d2c85b1f06c1046175106", "pai_cert": "308201d33082017aa00302010202081d3d8dc0c2c28f5a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200042f0038158c9fa863429af0b9ece6452b47ff594f0fa4d934020f0c3dded9d345d8312b91e170907f70772d9a2eb382b045042983376b9407886ccc2db62d0297a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041465c4094c43bf88b432b816f7d25d27a229a2f313301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044021f2fec41df9db50622935573910be33482bdef484329824fe63e1af37282efdd02210084b3e0dcb437299232e83c919d65527a608154e1f40a8c4f8af72828e1c316ba", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100d8b1c71d5289d9b26d25d64c2c1e33b5d9da868cedf796924f3d2ecce3c480a602203d452031217f0759733d9fef6b5dd4946fc6c1bbec8800cc84927b4f54a7da71", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json index 15b13083dab8ca..07641d5a15fb30 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_08/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da3082017fa003020102020815118084cc202563300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c3041434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a42313059301306072a8648ce3d020106082a8648ce3d030107034200049a4ba942340178f5572b97094d7013eddcaf575ead694b179f6ec4c9d400310c1ef0aa8c35d416d4c623436b4b04dcb95bf19f3cf8fbd30254563ce38c9a3599a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414680fc332a9f467a85f67acb3cb11cc74f0e66209301f0603551d230418301680142bb7cbab0af209ab02a54bd74c9f2355e1bbe51f300a06082a8648ce3d0403020349003046022100a4fe134d392b7514d910d10328ad58d8f1514cdc1734e2c70463b40c2e1fa0970221008a97360f3a3dd383785f699cd0f9899a8d3cdc8a1aa39a6e79b6992bbfd76d20", "pai_cert": "308201d43082017aa003020102020842b162c932382dac300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bdb42970bf96e40e6683146fd55ea5f44615c7dbd065264820573804a97cfdc886183e300a546a040b0f79a4ef35a420d67be4a09eddc94be52269aa512567c6a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604142bb7cbab0af209ab02a54bd74c9f2355e1bbe51f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502204ca398a053c3cc55eee29bb386cd493c4a411be38f8907e21433f0e0159d91aa022100aecd14c9953b544fd4d8ede7885be59611385a18bfb104e5426228bb801b5319", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220580f20832badfc322185a629da2b41a0341aa12dd72f592852722191efee5162022029c288ce573eec499ca06e84aafecdb538cb2da979021437c6788a0bc1156cd2", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json index 485d082b3da7dc..1c75f3253d66b6 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_09/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d63082017da00302010202086ffa2e5eeb61d406300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30393137303506035504030c2e41434d45204d617474657220446576656c20444143203543444139383939204d7069643a204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ce4d70843a23252eba74614a37f5a5309b4e13be66a8b5db3baf44bf80d59a4e838deb550e9fd4481d9f54d214ef5ed9af822307440272fee7e166d863eac66ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414de00d539bd03626849da26b45fdacf7884ffcc8d301f0603551d23041830168014dfa8b46a49b566b099e2bcd09bd449a0d5f52e49300a06082a8648ce3d040302034700304402207fb82f1ebe6ab11a1e5133feef13c6d6d63c6dad64133dab8d81910c99e6ee9502203fa0c22ee58177489661cd2a4d0f034b0c358732de7bdc14cce5ef4ab2c95f3d", "pai_cert": "308201d43082017aa0030201020208054a79fab29370b3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200042416a7d58bbbb41bc77fc9b3c793a8c7d2a2f7f85815754c4545361d918062d82bedc5e987d47a48e72a576841646d1269a783884075f23e0a6ca442da8b2129a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414dfa8b46a49b566b099e2bcd09bd449a0d5f52e49301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502204c3f22a3d37c42f228eb9441815bb05951ada27977e428e814e3122c44f7891c022100fb8c458dbb450d16ab904cd8a43bf0bb0f330185d68f3e00a40ed394d05776f6", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201dde96d7c08e23175c5052dfaa521bb8a063f84c5899a52436b5d032aab93aea022029a551c50d0d52133c388cb23d3adc1389149ea22449fc42390241bd67f3b2f1", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json index 22e6fb2f2de4b7..2d018aa2b25a1b 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_10/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid VID encoding", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201bd30820163a003020102020830a812bc7c5c45fe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783059301306072a8648ce3d020106082a8648ce3d030107034200048065be52b8f4ab2caf3013d05346c16689ecd45d5cd779f323d62f61d864866ccb2703987409dc8d5b99b16bb7c24b11b35bb134f9df21425ba39da0172540a3a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148ca0167efc3c765c91adf0e6cef7d662e1eb1538301f0603551d23041830168014e60a5e4b9217965291327e05b6eabcfd80326640300a06082a8648ce3d0403020348003045022100d17449f3cf83a85d16e7c4343bc10e264bdc92875a8051ab7f3f2eea6481b45102201ebd3950c7be50ff6222dfec1590e7b201d9aab8bbf7f18a0f9ae23f0014009f", "pai_cert": "308201d33082017aa003020102020832ba94c42f74da1e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004688ee8607b720b9997ae51bd6db5b4467dea88794583b43f8ee79e19b9f4120e31235ae9749127e780591131090d2114721d14f0883f5008a7cccaad4e6156eca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e60a5e4b9217965291327e05b6eabcfd80326640301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022014c85a0afc1bb6f24d8b9eff1fba7ef049330e7cd49c973be00a0e6f59e99737022004ff84dfb14274ce375126e609e679d34c6f5e86d1b6671b5f25f22ddafc5711", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220664fde5adea91e45342122a9d1d6df5cb634b50956bad69157b91aa8ccba0084022100ba2c1fb85725104068eaead244ba215aed326a21433d1e712771b9a8f3bc4de3", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json index 461b111e9870a0..2599481a26b64b 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_11/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: valid, but less human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201cc30820173a00302010202082b65e3dc5275db3d300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004ba680af819b925bcdedc9bf8adb080cd4bcfc7b287236a499e0c1fe6bb33c30c18c95455aa07a98ffc65945a22d6e3e725b43bb070fd02f47d50e6859f02acfda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141bd5a542acdd410c440c1224b492951f594ae3a9301f0603551d230418301680141c7b7b8c9b9444086455ca4ce3b6563d2db6fc5f300a06082a8648ce3d04030203470030440220506754efadb8356f065731f8ebcf22fd7d577978c9dc854b38e9fff872dcb401022017ebcb6fe47212cd883dd9e639283c69e819e248086bd5951591e2a0e93cbcc3", "pai_cert": "308201d33082017aa003020102020818b1e076dc0aaedf300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004383f11ca89935c512504a4c39539b9aab4e11f292d89ef271bab8051d0b51572824b41a3e2c8e8ee55338d143e9930b47b47aae438c9b4da95aadd06cc7d63ffa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141c7b7b8c9b9444086455ca4ce3b6563d2db6fc5f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020347003044022058540296ee569d219b66e12ea142dda6101d65be04485ca5feb514fc8e8ff6680220194efcf508d4adfa3e1e68203603e280e3dfd99c1f057a7faa358564571a5e44", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220427a3a99df86e798d5b7a2a840b0b260058873852a384eb67d8604eb3b78c500022100f59b32440d29408adcbcb3b608b1ce68382f6981e230fb5e7d637da4dbf878d1", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json index c947eb0d00da7b..895ec2b48fc7bb 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_12/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid, PID not present and VID not upper case", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea00302010202087c8421ecfe7949ba300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3128302606035504030c1f4d617474657220446576656c20444143204d7069643a4d7669643a466666313059301306072a8648ce3d020106082a8648ce3d03010703420004bd4ba68cb580e099310b890f1ab893dabe7dfdcd7969e64e307a3565b85ff613ec36b355229cec16ede8b797d86bfc34e1c48c5a79c4662b784d920810fb0115a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142ec709463ab3334a1fd77c81ed982dffa1d14f22301f0603551d23041830168014ddf00375d43c65047c1f08f5810164623a6fa713300a06082a8648ce3d04030203480030450221008d9cfc8c4e869cad6336f68266260da78872bad3696fc17b16993b8a2f4e545f0220423cd64e619af9bcbf5faacd44a3ae6cf5fe8d0e5bb5e0bbb465361238dce282", "pai_cert": "308201d43082017aa00302010202084ae2fd4c611e745b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200041e0609f32b8e09d499769c750ca07a13a1776e88d3c5c0b70942d2478865c6a8208d9f32ed3a5d6e8febc29a0bea7c8ec42bc958ce4bcd057a02e37d68abceaba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ddf00375d43c65047c1f08f5810164623a6fa713301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c1550f3aa8778dfc255032f2fa2321df90a45dae082949c2118b3cd49a2c4ce702202430ebf9bdab7a68da642d631f3e5b6a41e94ab46a14d4ae558375dbb11ad9d7", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201af8cbecbb93be21db9bfe79c87ec7a1ded945770b575ca07d0d3cbacced41620220794cc4afd4f78c505d6dce4f370d62d3baf077f19da4cf9880da21eed8190fa5", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json index ac2017d012a1a7..eec0ed8f0ef5f2 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_13/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid VID prefix", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201cc30820173a00302010202083f8263fb83bfe6ae300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20444143204d7069643a30304231204d5649443a464646313059301306072a8648ce3d020106082a8648ce3d030107034200049c0038fd271daee28494a945f6470e84c40e0882edb6244dd2df37cbb0da0b5a62e8f4a527d92c37ffd721dacec95676ac477e1ca9be4e348fd0bd75982984d5a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414df04f63745fcdf01b3670c6c24bd3595192aa4cc301f0603551d2304183016801420e0fd720609784388c6eff1f54c904157c70c44300a06082a8648ce3d04030203470030440220497a5592ca7b49b2ceba425167f00051c04d683c9ac4a1966ecf26a526bfd7c502204ac15272ee4224d300d8640493622fd120f72522d57d9a2f33c9bb9b6e51e460", "pai_cert": "308201d43082017aa003020102020821861c678a0297c4300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004eabc8faa45012e9e2a153ca7244da524cfa1686555490d0da5981076b19c5667e17b5444f95c7ef8c89ca322687d0930828558b2ffc7b9e54161ec5bf34c9a5ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041420e0fd720609784388c6eff1f54c904157c70c44301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202819789de8214bc07d64951f2ebc74a59ec20f59c915599e5e40b15f7ddd9b18022100e7ded830e374dec8f0d8b65c2e42fc5d30005a7c0df5f4ef6734069093c51166", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022012193cc131c18e54fc39553eafd3819ca98e40bdc6972de116322888006a0552022100ed76446da827bfc346940b396e7a2ff41d451733972bb707762b6bea864b30c7", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json index 2d05374bcdf6c2..990d26d0c60de3 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_14/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Fallback VID and PID encoding example: invalid PID and VID prefixes", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201cd30820173a00302010202083450a052182d2cd6300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20444143204d7069645f30304231204d7669645f464646313059301306072a8648ce3d020106082a8648ce3d03010703420004d4ca44d3452d78c8272daae93b6f9ce5885146e82a8f8415612388fe3ef94580b4fed9093f1008639017801e0125cf3792ba473b37d305576e984ca8bdd72ffea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140223a890046a4bb69b719552fd74bc8af09682c2301f0603551d23041830168014521d2fc8ae62dfb20fd7f5ddbe3a798380e31a89300a06082a8648ce3d0403020348003045022100cb49911425ce8e585513bf06ee68dc9fa39d6ad9e1492082d42ddbc49b9d6e3302202fe59c8e895e86095c7f47858725445a1b5d17a8d9848a0ea60ba14162968cab", "pai_cert": "308201d43082017aa0030201020208165f8b7932120930300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004078a4476badb7b22fb9713707d9f9a4c3ba556bc937fc346a7e4083abbdee63b12402c347502ede77f88962109a7a7e573e3bc2f96970d7980a2797ac6384c34a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414521d2fc8ae62dfb20fd7f5ddbe3a798380e31a89301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210091ac483821f0810c318bccf17763aa2001fb7a0b81b9f9b5ac6848ae5eb4ef940220737e0e7af6d1f4686dfc919e4f2c635a31cf4f7516ed33738657611de7909f4c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f1da2112b47840cd3598b14f5e9a305724b89041869b6c8f3a248d48669b99fc02207203ef330fed84804ea37cb901fa0e516ed0ddbb78db798e3298410880428e80", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json index b0299181dcf5f6..69186cb3ce2cef 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_15/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: valid, Matter OIDs are used and wrong values in the common-name are ignored", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "30820206308201ada00302010202087f2f44adebfd0fbe300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004482e4f2df94a413a6bf7598f8a5a8a0add1dd4e4ae32ffcc0c449a07c334fd5ca78d07296dbfc42ce8b106861328fa721d1203750ec1bf1fbef8ba3aa41d4168a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c39a416240515bddb8e098f4362665f4b7d6d0da301f0603551d230418301680147bcf35dfe7adb6c6ba01440ae2cd783a07c0ebf5300a06082a8648ce3d04030203470030440220487add268c7496438e82c4b1894f418ca748336175ef0fcc7db325b4fdae245702201786614af15ed5f62f92681115495f453898cb1290f7e22651954a64a172c37f", "pai_cert": "308201d43082017aa0030201020208771738ec2233c74a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043667dbd8353646f14f82c21a3f204e44829ef4111d5a9b619af9eaeef18cf4329ff92cffd26a6e3c38df91ac9342eea582c814e6ee20c3559bf72ffb3cd8257fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147bcf35dfe7adb6c6ba01440ae2cd783a07c0ebf5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205ed27aaa89a3167abc38c0417dbe86c55489abea5d54449d11199dab8a4711fe022100debedfe7e6026dd26d2ebdacec63a252e86c8670f465ab89d11792c1de5ce4da", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201219fcff318b3195d01aa3c4b240849bb3b3234ab2fb974b71ad11bb70ef728d022050dcba92eb4886ab90488dfde585184e19033b9e38fe1819826edc8619a58d1d", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json index 733a9965c7d559..c587e55f509a03 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_16/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: wrong, Correct values encoded in the common-name are ignored", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "30820208308201ada00302010202080a03470de9c83043300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323059301306072a8648ce3d020106082a8648ce3d03010703420004e7840a07aa0063e0c297520bfeb2ef0f01dabfb0d422183a29389a208569d7a589d42cc91311e6c2784efe9c6014bb0ef4da910daeabe72c81fbe64f79532a13a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041459e179e39d784efbcc8ab5724c8f0b192b1677cb301f0603551d2304183016801441cf771c87daef27d962d08e1a5d01a96ffa6bfa300a06082a8648ce3d0403020349003046022100db985b1699bd68cbbe8d4766af64570278401d069e4ce301e0744d7801ff0e11022100ca900b1dedd5732201d189de06a1324ecf7329ad293d72ab431b0eb4c72f6492", "pai_cert": "308201d53082017aa00302010202082961eae45ffb0ece300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d50a4fd8812153d6abb41aa6f2efc40ca72c0d6eac26efffb137a762ee15fc7d0cec02b27591e7b67ed8412f14bb2e9cbf999d6927733164f914351eece7f469a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041441cf771c87daef27d962d08e1a5d01a96ffa6bfa301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100ce95bbb8317d27966a9e7cdaad4a48159bb58692076b19312dcd467e7ecb9c150221009e9638acb3cc4de3170e975cecf855495a4a10ec3325934a997ec8570c038f53", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ec1c30f9f1faf9d449e3dcb911079759f5218b2c046cf4439357a4c97555309702207629f39b6819882403f061008ba6b5839a0bb42b62211ee70a382e168199fa94", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json index dd60dd1a87ed20..feef4ef79c4f9d 100644 --- a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_17/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "DAC Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: invalid, PID is using Matter OID then VID must also use Matter OID", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea00302010202081ba0df19c6aa35e2300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043070b6bea8a294089468f19f351f6bcd16fb16237ad1039d5ca72e35ec63ca32fd1420ea34058b3671d66ac7d8fa6370628b625711c20646dd29262a8a110305a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fdfe4dae471eb7cba37742b3c97ef7c6ed36c5e8301f0603551d230418301680143b6885a0010569ceb25af20b26968ef1386a882b300a06082a8648ce3d0403020348003045022025e3cdf47e060f9099fc5eb11d1268a370ae7014c93336e925ef2690f52db010022100985ba7e0d07335f8d952f528f22a721397003613dbdc364bd084619e301e3b76", "pai_cert": "308201d43082017aa00302010202082b94a3b21c530ab1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000497f9659ae16a8244bd4698f822174443bf4655a415275f477661d59c3954a2a1b20ed40ae2ca7e512253ad03691ba0b5cdbd6dd00792b31a5ecc7c853c93f86ba366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604143b6885a0010569ceb25af20b26968ef1386a882b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200bca5acf0b4a0530dea70af719217122de931c44cb1a87be0c8af33c04ec97b0022100d0eb16b1fdeac91dcec53fce2decd4ac019d09d1becb722452808d63588e1293", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220307a9a66f9aca664b34c8a14eaa71358395e7961599c88aef48b5c1af143bc4a02204895f6bf1127b829d31f7dd4c4bfd6b838802c5f6de4641beb93626557ad1b4e", diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..24e6e9dec05f5ce33a3f2da9f8c8feb82512566d GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LLEz}IS*f_M>JkHs&Ff$pr8A=$4u`!3TF!S*H zCYF?>7Ab_J7MCalIC>h27znX(X|pl1Fg7i!VPfQAadUGsL=$D=VKFc;Ff>pQ=QT1h zFf}p<@_-;pg5MGd42_I|$kfu*GRnZ#(AvNfVv~`hv#+ZH)H;{cveX;}7e{9WQ)d@P zOAAX&1>dsF6f2Nr3cdwE7SKFHgGd8mHg>SHnHZt&XJ%w)c4A4sm7=1_M_nMTYlp zQi~g(%6ZAMSly}m_EPC-jr!V-l}#PzCcbyC^oZWfq+tFkErjQ~sKtw=yVv>4Ca5f5 Uzk@%!Q+W5u`R942IDgg#0Ql*V(*OVf literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem new file mode 100644 index 00000000000000..09da4ecbded64b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB2zCCAYGgAwIBAgIIB5qc0XSVOCYwCgYIKoZIzj0EAwIwRjEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQB +gqJ8AgIMBDAwMDEwIBcNMjQwNTI3MDAwMDAwWhgPOTk5OTEyMzEyMzU5NTlaMD0x +OzA5BgNVBAMMMkFDTUUgTWF0dGVyIERldmVsIERBQyA1Q0RBOTg5OSBNdmlkOkZG +RjEgTXBpZDowMDAxMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfy5IIaX59HfG +8Xj+x06J6KWHOU/v6d0veBAjPiy9jGh4yyTDRIflyGmPrlucapOBNnu3nyJmFPX7 +b8/ymkIUiKNgMF4wDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0O +BBYEFBx5LoDsZ6pOW3IrrHwGQelecC8jMB8GA1UdIwQYMBaAFHiaFhohzYS8cSno +S4eCUb8nU0e+MAoGCCqGSM49BAMCA0gAMEUCIQDv7GVzgeUeSh0EOtx69uki5Xwn +rYipgojOke9HeUhbswIgN+pmVAzXFTjopbuuTx1gJKevuA9riRO7yZ/PDJRD8ys= +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/dac-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..466b687ad2ae85ae28234eb14f607a39a09bd933 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1RzA2NxkM|2?LvQuNdy@!Js{}{bXc6MfQ<_xp~fdgJGZw1_&yK zNX|V20SBQ(13~}j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$AjZ6$ojm!2g%#7^JP7EyU>U|r6 zLxTGzsjr*3Td;BQlx=1@-<7)5efh>s6$0Eie zQZY+RO7U#Vom7|7%nWV zLk?tdLPO~Q;Nd2;Lm9oy(MdI(a@S5;n*uejFcdqqjCPjw+sghUc iKk2Ia?X=|0srTFW1}df3E?QSV>qqO94`(E-)&l?yMvfQ& literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem new file mode 100644 index 00000000000000..d4e9ac3c453fb4 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIIRYduW1O7kEIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA1Mjcw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDAwMDEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQHJ46wU1RTjpInrpG7EYGjlLY2LPci +iiYfV9X7YpWI86cGUKXNOfluiQqcyLx+SE5m2BNh+Cpq6sfdH8/VTrd1o2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUeJoW +GiHNhLxxKehLh4JRvydTR74wHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGh +cX4wCgYIKoZIzj0EAwIDSAAwRQIgDTuPeVvtQpuTwGX0saojLLWiF+60DTQP0LAP +9bttO7MCIQCPlRnVn+SKevtCpOzK77e9USJnfaKuf5r4hZTwzBg6rw== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..2a611532b61a2f76c76a8b828ffe23e8fa74b86d GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R#Uhl~8cYbs2(sYy0?JG!KPZ*Wd!%enR3|yu4s-2Q{Dy1_&yK zNX|V20SBQ(13~}<2PclOQ&dxqk|(Z_yAgq-l(sf3_acfWA6M1;VwH&Vrv^}^%{lpQ bi3*&^ynaYdX4n&9_$q4Z$K4;#)lRo{go8Am literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem new file mode 100644 index 00000000000000..5db35921210b97 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIIPYlVBwy3UZgnpr+/hdNA+FWtfgAtt+QuJZvLxgbQc1oAoGCCqGSM49 +AwEHoUQDQgAEByeOsFNUU46SJ66RuxGBo5S2Niz3IoomH1fV+2KViPOnBlClzTn5 +bokKnMi8fkhOZtgTYfgqaurH3R/P1U63dQ== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json new file mode 100644 index 00000000000000..28129abe2b152a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_18/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: valid and PID numeric only", + "is_success_case": "true", + "basic_info_pid": 1, + "dac_cert": "308201db30820181a0030201020208079a9cd174953826300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313020170d3234303532373030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a303030313059301306072a8648ce3d020106082a8648ce3d030107034200047f2e4821a5f9f477c6f178fec74e89e8a587394fefe9dd2f7810233e2cbd8c6878cb24c34487e5c8698fae5b9c6a9381367bb79f226614f5fb6fcff29a421488a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c792e80ec67aa4e5b722bac7c0641e95e702f23301f0603551d23041830168014789a161a21cd84bc7129e84b878251bf275347be300a06082a8648ce3d0403020348003045022100efec657381e51e4a1d043adc7af6e922e57c27ad88a98288ce91ef4779485bb3022037ea66540cd71538e8a5bbae4f1d6024a7afb80f6b8913bbc99fcf0c9443f32b", + "pai_cert": "308201d43082017aa003020102020845876e5b53bb9042300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303532373030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313059301306072a8648ce3d020106082a8648ce3d0301070342000407278eb05354538e9227ae91bb1181a394b6362cf7228a261f57d5fb629588f3a70650a5cd39f96e890a9cc8bc7e484e66d81361f82a6aeac7dd1fcfd54eb775a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414789a161a21cd84bc7129e84b878251bf275347be301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502200d3b8f795bed429b93c065f4b1aa232cb5a217eeb40d340fd0b00ff5bb6d3bb30221008f9519d59fe48a7afb42a4eccaefb7bd5122677da2ae7f9af88594f0cc183aaf", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff3602040118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100dcf5d10789c25461065bb909766a014f49ebad35bf60afc890bd438bfc583f23022044caee28fa5e735e18171e692aa02d4652615ed78ef10417ae0741147da8128f", + "dac_private_key": "449949bde66409039b72af18eeebc1a03db3fd64643f45f69181b979ce7a8361", + "dac_public_key": "047f2e4821a5f9f477c6f178fec74e89e8a587394fefe9dd2f7810233e2cbd8c6878cb24c34487e5c8698fae5b9c6a9381367bb79f226614f5fb6fcff29a421488" +} diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..844539ca54439224cb80108abf033edaaafcb5b3 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL273TXkr-UWNd6;U|^_gWTL{#pu)zW%3d}@g@ZxD zu+E?cXm*20(yu1t$Th!KPP3EwCBk+0E6eA?1XTOD*f@ZWI%mtm%*5hh;KroL@G)k| zFF&c=Rf_-1@)oU9OMbU??I-VJA_?lR&pqb+GL09gO1V!py_( zn^;nkTBHz?T3n(K;OJ>6Vj#rErOn33!q~K^hKZ4f#m&vl5KWYchsD6a$x79;9CG>MMOp!8blfhv$2Dn&BO?GKQkjcvl9c$;>qd8pMJ-CZb|E2 z!zIylR*+pKY<}>(9Pa9sA7^fpeHLTpm%tHsfSvjM_i5sheoZmIR6hq4Y*`}EW#+tO zioMF>1cNvO9-zx)g&7(DvoIMj81R93{2(4MjMy6tWI=pB7BLnPo*TP=Hmwhp+Ed1K zU>9$c#kYnYJC~TsBT%2wuPk b1Ml~i7g2&RP;j)Q5Q;WKq?A7-M-njn literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem new file mode 100644 index 00000000000000..3942f4ac05a9a0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/dac-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIEPyI5pBVq3w4VbCah6rOhQFZeGZySF1dnG54DfgJZ50oAoGCCqGSM49 +AwEHoUQDQgAEo5NnM/L7X0m0ZousChiCzREHJFafU55sC3up8Zm2HeZcNk5gCF7A +BwPv95YXWU6CXPol81BwtKQQijZDpJQ/JA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..6c46c5c002b8ed776b3f419d80ce21605e5a2b5e GIT binary patch literal 472 zcmXqLV!UF|#8|a}nTe5!iG%AEYfaU*bQS|HHV&;ek8`#x%uEIbh7ty1Y|No7%sl+Q zi6teeMG7IQ#U%;>j*f;R210CH+H8z0j7^Jbm>79j+}zv@4HU$AjZ6&83``8bAWDMY z5(o^9jDg71($q4_zzwIFp4iPq6J_FIF)(m4G>9}1W@87tl!+1QWM)QoW+w)g?H+c9 zstps{eRoVYZ`&w6Y|!YzDF*J|Bx1 zi-?M!g7BC2kKEUs|DCmNO6Zg{4E$pt50X}90R~}%NY-Daa``~{H~YmLr>6_txnsDn zunsw>nLQW`T$vOZHW?N=N@{seo5sDKDbVhnT}0iN6DGnR_Sgr0n3d4>`!AD%>;I~U i+}AX|FuWF?nd!f0k)PlK#rv;&9CJRG&vz=jq67fRQj0+V literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem new file mode 100644 index 00000000000000..006a62ab9411b0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIB1DCCAXqgAwIBAgIICuoFfHq2ZwQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA2MDQw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowRjEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFJMRQwEgYKKwYBBAGConwCAQwERkZGMTEUMBIGCisGAQQBgqJ8AgIMBDAwQjEw +WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS3SD4xJYCRh024kzeGsRuY5ao/R0D3 +zOl2fQ8EyNdsUvOZnsmYcnTc0FDIFTjXJ6QTMu+u1bZIKzyS3smA50oOo2YwZDAS +BgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUJE4g +E/SH8QvWQ/7NO4JgiRkxUfwwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGh +cX4wCgYIKoZIzj0EAwIDSAAwRQIhALIxcUEZKkuWlguvAlE+7j5YfvTINBPwvD9R +8Jpghvv9AiBF/3rhC9Yo9ADrE5lpT7yiThGgId/rjEFs83efQnbUIg== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..866ce56865af7f4895e256f83693d4cbfde38608 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R$=a{TdRTR$oBen}xgtzWPG+cW|(T8k`Ev{7!=KtzMuC1_&yK zNX|V20SBQ(13~}7$k%LA^O>H>m~wR7 b&``(~IM*kn6Eg3v)wW10Jd)nYfagjMBn~!g literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem new file mode 100644 index 00000000000000..7d356675ce086b --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIK6m/RoSnVZfQNybhbwEvvpC9HdwsIQanArN/E6C8K1eoAoGCCqGSM49 +AwEHoUQDQgAEt0g+MSWAkYdNuJM3hrEbmOWqP0dA98zpdn0PBMjXbFLzmZ7JmHJ0 +3NBQyBU41yekEzLvrtW2SCs8kt7JgOdKDg== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json new file mode 100644 index 00000000000000..3e261feec13384 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_dac_vidpid_fallback_encoding_19/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "DAC Test Vector: Fallback VID and PID encoding example from spec: PID is not a number", + "is_success_case": "false", + "basic_info_pid": 177, + "dac_cert": "308201db30820181a003020102020825d8cacaf219fed8300a06082a8648ce3d04030230463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3234303630343030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20444143203543444139383939204d7669643a46464631204d7069643a58595a313059301306072a8648ce3d020106082a8648ce3d03010703420004a3936733f2fb5f49b4668bac0a1882cd110724569f539e6c0b7ba9f199b61de65c364e60085ec00703eff79617594e825cfa25f35070b4a4108a3643a4943f24a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140cd8bbf982af551abc7602c0ba0d5a38eecb54da301f0603551d23041830168014244e2013f487f10bd643fecd3b826089193151fc300a06082a8648ce3d040302034800304502203bd871c41b8008eece6158ad4eab328e262825449443ba9f6869353b28fe22ca022100c7816cb1bf50252b8e69db7f0123afdafa31b3567aa681c775f81a16fe981d28", + "pai_cert": "308201d43082017aa00302010202080aea057c7ab66704300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303630343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004b7483e31258091874db8933786b11b98e5aa3f4740f7cce9767d0f04c8d76c52f3999ec9987274dcd050c81538d727a41332efaed5b6482b3c92dec980e74a0ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414244e2013f487f10bd643fecd3b826089193151fc301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100b2317141192a4b96960baf02513eee3e587ef4c83413f0bc3f51f09a6086fbfd022045ff7ae10bd628f400eb1399694fbca24e11a021dfeb8c416cf3779f4276d422", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100f15ca4fa4e1a6daa21ff766ea2aa2663eeb5adf24bc6146027ebcee309f4960d022100eb1e0bc129f4952eac5fcaf4cf7160a13aac1edf8208bb928de1a31e6052f5bc", + "dac_private_key": "43f2239a4156adf0e156c26a1eab3a140565e199c921757671b9e037e0259e74", + "dac_public_key": "04a3936733f2fb5f49b4668bac0a1882cd110724569f539e6c0b7ba9f199b61de65c364e60085ec00703eff79617594e825cfa25f35070b4a4108a3643a4943f24" +} diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json index 9e5e28fe05f7a1..8609753221ba61 100644 --- a/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate version field set to v2(1)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a003020102020853499e9c955b61fc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f0a8942174fe219a54b7f6ad3c949301515de6de4194408f8116a475d7ea0b29f00feead0795e9a1e80e48d6a78949e8301aedb87652ff2671f8ad61d846ac87a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041414a140f46a5e334e943da00d8d5e66aad6850c13301f0603551d230418301680147023997434718457c8db8642eb761d711e33a348300a06082a8648ce3d040302034700304402207759805c4a05e63de5010259f857516182da37de51bebf1540bd0cd13520b64502203e90821c21ea3b6e047098630d1e79593398732ffc02bf156f957ca0e81f5ecd", "pai_cert": "308201bd30820163a00302010102071e1322349cf11c300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000477285c42d8d1e7349a28c95f58b9e08d75adb20c5b44c2652996c8efcb313ae1f44e5ecad0d536373a9128bf1dc6d30958abd81155410132a122dfe89dae1e7ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604147023997434718457c8db8642eb761d711e33a348301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022056248c4803fd254d197f55b901f0a3f33f9073068a1b9e750635d288f97ced8a0221008a0e687bfc73ece00b7795c86bceed053636a339c9c0cbf111ad25c82a02cf13", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100d59084416599184bb5169ee6a392ce3488eb86bd06e317752e1563a72add18e70220146e03a36e55eed8f4467b2426f853b91a157746618fca05662de230fcecd2d5", diff --git a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json index 6fcc37d0d05f16..e7918feccd423f 100644 --- a/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_cert_version_v3/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate version field set to v3(2)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202082cc0bb7d7ebfada7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004e8ca85d13d91dc036fa21a0c9335bd80e7f8fb76e2dd5d388435351c3cf74350002ceac9023918702083aae14eef77db21e7a737538d0df1edcc75ec1d6f8d0ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d296cd819f482c86d9c1f8305a524b0daf473884301f0603551d23041830168014d1769a48f728c7f09b6f91ef9d80c7522a04a141300a06082a8648ce3d0403020348003045022100a8fc296d51d3f2cbfcdd846503021df9d7f8788467686558379f020ccc94d63e022011fcea517f1781205652d11ce7ac6fb0cb070f36be88b2b83b2f4a70d5181980", "pai_cert": "308201be30820164a003020102020861117a7f475c53eb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200045bef0c28d8dac3cb09e207947322e762c791864ba321754c8fc5749abae091393c7bbc24b4bbd2ffebc918eddb81172b56917b62702e95c88571c03bd1ddb478a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d1769a48f728c7f09b6f91ef9d80c7522a04a141301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207f3799f2c535ad1d97268a0c90542c4792113eeed924d89cba7274a7825b3733022100a7856cc5665b8fab0e4447f4dae3a04c1a5fba459c0fb3d1faf77a3c8a41bbee", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100acded09e95dcbd884b869f5ed6cdaf524a1467fd1eee5bdb28b5958278175389022100f9d0e11ce33df0c97e9412d78828aa0ed1ac14b6324987a103274036c49c7393", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json index fa54b4abe77c5a..b49eaf20ce6ac9 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_akid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Authority Key ID (AKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202081b93836c5ddad56a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047840aed224047eff722068ae926aa3f9ff4dc1aa8b95f2cf63c39fd6999ba35073d96cf78dbf2d3a6058556d75e175916d15b8563df6f1c99e768f89c8396aa2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041472cd0b27ad47feb17aecaf0c6ff71a6628a115b6301f0603551d23041830168014f4bd62526842e86245a82d6a42900ad4e3386072300a06082a8648ce3d0403020349003046022100ca8d2134e7130334f9ceaecdc076bc7cce40198e23a3ef1c7be9d28643b40b0e022100e36aa2a1705fc4081459b6b53f3d218c77538d2da69c0ee2095aa4eefce810b9", "pai_cert": "3082019c30820143a00302010202084f12cae8e5e05ad5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004b2645a171296a7f51ab03f068547ac5ec69660c59ecb2ca1adcef1ca7e80bf241ffcf177049da9e4b4889f605415703cb77f128291a8426fb4d4ea6efdc8b481a345304330120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414f4bd62526842e86245a82d6a42900ad4e3386072300a06082a8648ce3d0403020347003044022077c30a76932fe2b935732bbe9c68974b32d064f6c9f1e9c6920aeb09f23befdb022042a84cba15ec67ad535552b2c9ed29d7314c7391c45838d0aa4e55e31689054d", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e0cb8b443946cd3594a80e9c18b3df41a16491fbeeee8892b895c6cd052e49ef022067594e7c83d152d1d91a955f9eae9e12de19919baa9000eaa92d52f754ab507e", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json index 38545eddb78cea..5c2d048b6706fb 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_authority_info_access_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Authority Information Access extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208045f8fc2bf378703300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000448c64ef84c0632a6608d3cb364bf69a0079d29ab901d7ff3b4b597c436638ef428a2be74f4bf8fc3773e6cdfbbb176ddbf8c502f298fbddff84f97269a29e1cca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ea686fb79495b0ef9c6b6b561561964f5eac812c301f0603551d230418301680145a9fa55f2b054f3dd076b1ebeb2deaf5c18330d2300a06082a8648ce3d0403020347003044022022d7c1e9ac63169a27cdfe7bdff0f25fb78e5c3444ad92ec3d3890e2726a7bca022032f20a3181309bc75615d49c0cd6fd2b0c27ebbaee7181b8b36e38899e63db23", "pai_cert": "308201f63082019ca0030201020208592e0f65157b6c51300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004fd659aa96867d771e47a195f2ee510fa5594e8318cb48a65285d8e5b58a59007a0a56c72819501008b38bd785d7c67e4bcd03ecfcf8603dde9762fc4124f94a5a3819d30819a30120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145a9fa55f2b054f3dd076b1ebeb2deaf5c18330d2301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e303406082b0601050507010104283026302406082b060105050730018618687474703a2f2f6f6373702e6578616d706c652e636f6d2f300a06082a8648ce3d040302034800304502207350999eeaa0384f01e503791dc977a0489da4a3dab2730779a3dc3307cc759c022100b0bbbf0980cb7a37af2bd28f682030098f2503db43d7362da1e4ca951bd846f3", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f36cb0e6769c61700f27a50387d2ce379705a0f223e52d5d8b6260cfdf28445a02204eb0bfd34be8d16a9b87cce43a6516fdd6655e52c4b5a6cde13ad407c42f2c98", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json index 1c59b0639725f7..ca32b6b69efb58 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension CA field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202083da5054519e6ce3d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004064e5abc04fcb2b47d268d13fd4ff72f8ce55f1c3c293e1241d0a14a38d11a221fbb0dd9f6711d14c37e079ee7dde2467a28ab857a5a387a23125f0a36d82f35a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c67e05126f57c04e0abb6efdb4c9a011d25c32a2301f0603551d230418301680147f77d01bdf45599ccb76e0d373f179772c84f08c300a06082a8648ce3d0403020348003045022100d49fe259ba477edbde3f30c41f83d28db133885312a2d3cf10d0870fceb71432022020920412c466836d80c9fb1de72b25039893c07ada387854fec4500dbda2a98c", "pai_cert": "308201bb30820161a00302010202084ec927cae6554828300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f34ae625b3fe0fbee4f596128d61f9deda5381c9831e50fe4e6bde25c85f8426bac7661d5bb6e43180bc4b1e1a91fa970b81e7d3b75c60d8e8ce534193ff1794a3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020106301d0603551d0e041604147f77d01bdf45599ccb76e0d373f179772c84f08c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207fb09866b5f6ce0d99aec5df54ac94c0e0fbb896023a15e027b553718033add3022100ffa43e9c1d02c52035e29391aa3a3748acd0ba1b9a70d796932cd6f3d911f0cc", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220538824384db76fd9c646a69a8f9db13e607e38b793bb7be892cf20c0ba1d3fd40220577258b59a9aa3071799525ff00596c24263cee0c4ce8c81a8bea92872c665c7", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json index 873c265f87537c..bbfcc82288e877 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_ca_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension CA field is wrong (TRUE for DAC and FALSE for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202085f5697509d14da42300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004b8a6c2a9787c84464beb4f7494d7b81aa010eb58fbe88487f3124d7971b09c37c7c82f8a6ae63365726364445ec8a0c2508530e3c9442d99b6e18fd649eaa1fda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414fcaf5898e4a3480ba3738c6b284f2185fd019a31301f0603551d230418301680143c576f9ada6b95c32c6a2f74450696f648afc7a5300a06082a8648ce3d04030203480030450221009fbbc2cfeb46c6c6a7d039ef1a059c0b02609aa0b323a666558e4a2fff1a12a102207d4135e4a55324231816e79fa9a0e51a8961e0232de7381fe0337412bed035f8", "pai_cert": "308201bb30820161a003020102020871d0ac32c5c88c11300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200040fe489d1fde9f4baff3c98a9f7c1ac148730ed42dacfcec0f60fabf3c235d280831eebc7a4b931489f1d289da0142c52a0024021b6e732e6eebb48f41fae317ba3633061300f0603551d130101ff04053003020100300e0603551d0f0101ff040403020106301d0603551d0e041604143c576f9ada6b95c32c6a2f74450696f648afc7a5301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207b57f3414541b34a8e90c35aa6aa0ab0c395afb7fc8cd5859e1a1af9091bd21d022100e6aea34126b617195fbc453e42638789e513d0c6569c67a64e60a0122da0642c", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ae657400ce20681866c99961b4ba2d88cdf61d3f7c618d9dce44545b89f1839702201ee4c334498527feafe8e987d83b46c72351ee4ccfcbbcd316be89f9ee5f4867", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json index dc74be67a4eb5e..ba6c1583a4f58d 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202085735aa4df0fb78da300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000487c885471fe9ae6bb7f38408132097df241bf77ea4e7e334c52bdf46e2c55cbbb412bbf4081f21a24ecbcfbbef77713c5fe2cf96e60b80a8ef4eecb1de3ccb7ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041422adaedd3b8cb9ad9fb376582c9f2a433443d576301f0603551d23041830168014a1db0e2e2e7e02c0e672e1203884584afebd97f7300a06082a8648ce3d040302034700304402205680339414256c009b11e30554d45acdb04713189fa26754ac47e763a1ca1f910220705677cdbe689bbc07af8023915b8c90654a1d52b3e9304409ff737079b6ba3c", "pai_cert": "308201ba30820161a00302010202083dea43b1b8847394300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000410b0a48be19c83105351114cdf2dfe7d99352a504afa63506e0ea066d2fea9aea850b8cbbd42218b95b61617f3fcb27e3e911cfa8e8bdec7c7810fd3270413c2a3633061300f0603551d13040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414a1db0e2e2e7e02c0e672e1203884584afebd97f7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402204706506e13bc371d04b9eee18ca902eb16f6e257556d5ed66d37d9c14b222d060220755831501c025255f5b69adc8aab0cd4d67a69c327dcab7e642f905d938601d0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ee77d7928d173e1fc11ab55622df33f35bde695a80eac6320f029e9e9536c8d002204748360facc01b838b708fffb3e928c20a27f6526926baa3d32325abee5fd852", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json index 2856d5a09fc731..bc3ff1b91d07e9 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020868428acfa7e73993300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042c7ed8ee0883e6c64e767e8b2d662a0df7e809bfd6df3ab5536261da71f333a76f852a78fe6e1705213c3de201fe90d62aaef5c2260f2330447c2dca16a0555da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b047ec75da0f7c894a6e911ce2fa4131c60ab8e5301f0603551d230418301680146e1c39b859b602e989412560645508a8ca28332a300a06082a8648ce3d0403020348003045022100a9907d40197990c189fa7b83a14db2e731fc0620483cddf8e7025bfb5e8649ff02202b6c48f282f032877e8fa58369657188118f1d81eae51e529f80764ada2a4d37", "pai_cert": "308201bb30820161a0030201020208439d87350c23c9ff300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000476a3d16e576b83313570ed8e8d398856c5988d3085c61b8bb0c0953683574f4e37e251fae65d8038e951852ac3f1f01212ca83d377aa9e63578b94b7612c1f72a3633061300f0603551d13040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604146e1c39b859b602e989412560645508a8ca28332a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502206b0130bb0da4edff11454b97ea3073fc61d8c0207e10c836d1992ed5143eed66022100834f343586a204c6bc31b47fb09ee7b85b22ca9ade0e3f6e122fc7c985acab05", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100ad10134969b09e9b74a0489d9621b79638fb9bf224d84be4ebe5eaf882593b1602200bd739740d0ff82387853b60beebd147eaac9274861d64a9044a79d25fb0deda", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json index e88f53c63ae608..344f4e244bb002 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Basic Constraint extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202087ad62b72306c96b9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004c7a3741f0af023a3eb364552cc16b3633f2b27f8ddd224aad9e8b9308f4216fc90f7d0ec0af850db936c19e363d033c5ade87c6d8c5d9fc5983d86f01c9ffe67a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414693f0a13b54495a8a2f668fa2775e6ee2f53266a301f0603551d230418301680147b0a00c60189441264e94b9a473049301200ea98300a06082a8648ce3d04030203480030450220422b0b365f5f893727a3ed71b2085299406444f35246a696cedc37678a0c22bd022100a0b67b0670aae4a08385268a743a73941403b88b7c99970b20bd41519c583b66", "pai_cert": "308201aa30820150a00302010202082d41c9cdfc7382ee300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200046e2940dca41b8edcf359ba47a5dd28cc0125f6831c09c2cbc6f49c90dc3404a01a7ed0cbc60340532d022970c13d42244ea172e35dd88ccb0e7cbaa237cd8e54a3523050300e0603551d0f0101ff040403020106301d0603551d0e041604147b0a00c60189441264e94b9a473049301200ea98301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502207c5eb799ab5ffd32af857674b0db22b55096f813ec9b2b3e7ff6b9bd31fa8ce4022100b7df7ab6907bcffeddc683f48183ef08287a1ae5b6bc6f53e63dbec2634d4293", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044830460221009da0f7f0329a4287636107a5eeafa3d92ec28176079b24c2a79e53c299a26776022100e1569a19519b6fb1f885236524cfa1fa18cfbd427f64d5c33af00c0b39badba7", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json index 626f1fb215c45f..c8913003e0ee1b 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen0/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 0", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202081b0efb24062d0358300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200045f21d1a84085998650bd4bc6ce58c27d8d155269cde2d1dfc5c2a1a7448d506e857e38d7add3df5e5afbb13de23ecc86c56d64ca5f62345436cda6c61db9ce81a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041490d6e1ad41c80b124667b968ce654303a7636f57301f0603551d2304183016801410cde8ee32b2d118f49d7c67ab308e51fc0583f4300a06082a8648ce3d0403020348003045022100a1ec287ac9eaea60c849a54770104b4657b304c258189a6f634dc8bf1d4b52fb02200e6d3f2fbcc7f904cabb83ef5605d0e42c5e1a3d15fed462e89d219d3cbfd2b1", "pai_cert": "308201be30820164a003020102020852c9c7028e5bc313300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e27260551a621b14c87cd1d0bed9b67a7928f0f3cf4e40114034e22743240baa309addb8d3928e3603cfc5cf6a4d55a10d3bd85d5a11297689979ab27171426fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041410cde8ee32b2d118f49d7c67ab308e51fc0583f4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009c7fc7d6ce8700f80009ec49af5265e6659559f9bb9c2e31765edccde3738fc4022028ae84c2c73480f65538ebdfbe0ec68bcac4605fa33f7c4890e2c022ae8a7160", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220515f2129149d39d763f4741aac9cfd8d63f2854794e04d9910accc1a26905125022100affd2a0d45a97fda7507e93c3c0a61530e34ae2b58aa74393d79983025b3a5dd", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json index 73b9d0f4485043..12c3553fce523b 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020845ddc355eb44cb0b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000497a72a93460efc389bd2dcd98d417b51684b300e6a2557732350b7536442ae84acd361ef369eb1a3c13632cb9cbf2e05042b1906b076eb34cb7ec700ccc50fc2a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414746bb4f5d6507f725492773f087ec9a129cbaf6e301f0603551d230418301680143592c45097add67f130549956a328d45ec65d7b3300a06082a8648ce3d0403020348003045022100c32916e1ba8794a674f851ef69790973a2461cb8b8436b9f5971b39f404e5ea80220428f059eee31dc407a2dca16a34e1512430c144fe2de0febd34afef36e101d84", "pai_cert": "308201bf30820164a00302010202081c6855b8c003bc1f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004c6e5d766d0276558b06b6719073942d2c4f82bb4bd68b3a2ad769610e66bc6710b982fff125c87d2304d3f22db8764bfc7e4538dd8cc4caa68ca833d6906c0b2a366306430120603551d130101ff040830060101ff020101300e0603551d0f0101ff040403020106301d0603551d0e041604143592c45097add67f130549956a328d45ec65d7b3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a0d8148f6b64ce392594d0b0740e411121b20ab2b32171b37a887d4b58c733960221009dfeb55fd3ed97e09b9388833e92d7628adcda2f980466cebc21f14ef61d4947", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100dbe77876c0798d5b2dd778fb2836f60c02e433d8dac1e268c910a8b312eb7d9002203d73c8347b3afdf61324fec7d3757401086950c5b3e202c2893339708fb02f13", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json index 2dc89941584741..50e4305252e1ff 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen2/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field set to 2", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208536312714af9628d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000428a2ab42bb49a7d6c8f9bc12a39bb65395d8f7542b1fc120805e29fc95eec92a320f8395a8b00353d2e68a85bc34fa6ec52439ac79c237ee70e537d966eb0f52a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414193d5e2b787e4546689f37b760b034c05a182a14301f0603551d2304183016801465300898455f00e39a1cdf41722c1e4faa351480300a06082a8648ce3d0403020347003044022066b1464aa4287113e4d09ba0f5091d1fea5b1bf7d78cc406c7034a16f5ed0d6e022036cbcea757db79eeb18f58118c614a8293e2bc39113bba3b16fec623f47a9308", "pai_cert": "308201bf30820164a003020102020808fede6e9cfde69f300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044d5be8e5adeb82a780fe4843f61656bd66f8797e4d1d29b9ae3b5d85a3fd763a750677435e0b7c7d1bc31de5348724b777d11a50641aa7e939da89723a58a7d7a366306430120603551d130101ff040830060101ff020102300e0603551d0f0101ff040403020106301d0603551d0e0416041465300898455f00e39a1cdf41722c1e4faa351480301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a98155f54f94c12642f3cc2943def076896c59c56a6ef05b2b0baaac8bad5255022100d22675e47c094c20728707f336308e0506840d82efadefc2659fa50df0e14c3b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022043857ce28dc06fc4f47dec75539d0fb06db7a83b004c33fa15aaec319c893770022045919bcf544eb9f9f2fabdb2d531086ff8d5267b1f2973178285bfdd3a0a8ff3", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json index c8299dddcc0703..6e8bcd13901af9 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_basic_pathlen_presence_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Basic Constraint extension PathLen field presence is wrong (present for DAC not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a0030201020208053c754c98e06d70300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004f5db47972a50f94333082f22deb5441d9d3b689a27ed37f991613a4e4975584a2e63a6ee0abcea1be4167581a32557044cdd78e95530c3b91ad8f6249dd10489a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b4c1a2cea21341f6d5e37bbd18eccc2c51ce7793301f0603551d23041830168014933cfeb600529db3dab05fdbd807e47508955f3c300a06082a8648ce3d040302034700304402206d13aa5ee281423d98a602cb198953c85a49ea4af689ae21f0a46501757fec48022055f9dea608e26eeac0c72e535685a2d137f86b652cfb722edb534a292fd9912a", "pai_cert": "308201bb30820161a0030201020208745bea427d2ec5b7300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ca752ea764c0a75c56d3035523ce48bee4d81f8d47782b3924130fb88f4c6f32b540d186f8f9b479bc803a75959f728386797f745d25c1cafb67c4fa0e058600a3633061300f0603551d130101ff040530030101ff300e0603551d0f0101ff040403020106301d0603551d0e04160414933cfeb600529db3dab05fdbd807e47508955f3c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022036474ef7f9807381c98d2a504cf8d1f3557a6a2c6e175e48d2e551bc0814b908022100ad3c08555de905e94dafcd89d36b6b4f0a897512edbdbd4d3a1cff69a241a0b0", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022070452625af7b0288d6316771c93405847db0b1d5baeaeb3fba505c55cd0e5c44022100ec154c7011209cad3e0b2a3f3286bb0c748bb2393612248d01a09c6943e2f932", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json index be1806379c5af9..22ff0ccd71d8a5 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_extended_key_usage_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Extended Key Usage extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202083c523c0b57effdb3300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004055f2f885618861199a5db69764c7811cbfd035dbe1cc696e014bec17414e918203e0765ed0d293a4fb1fde2ff9c59e32d81e51f4a9cc67ec9413044e2f837a4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141edff8148dbcaf2cc25ba42fc3c3cb0e3fbf6125301f0603551d23041830168014014bc0cdc665fb2486c66af5be4728cf6c900a61300a06082a8648ce3d040302034700304402203012eece615e9f9daf5d5e7f45a4c017c2d446dedbe0fdad70b1bbc07efb025202201bfc2b2dbc8c5443703dad78f7062f6ca7a40fac5210b2497210222ddf74a994", "pai_cert": "308201e130820188a003020102020862271f0ab28f7f07300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004bd2223da4d3069b6488c7cd6ee59e06af0fba4edd56b7d181ff3c833121b30d48d0f32db9259b98037b3526c7684cafd513a146a29d4d7baadc5782fb47dc785a3818930818630120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414014bc0cdc665fb2486c66af5be4728cf6c900a61301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e30200603551d250101ff0416301406082b0601050507030206082b06010505070301300a06082a8648ce3d0403020347003044022004636ce4b632b98b3431e57715979eaffcb138cb3abac44fd2cbec0f30c64fe902207386f51775528275449f09b4259e8296dd828497b8f59e7201ced3214ee12427", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c38a7f5dac777dfb5e8d557eb460d15ea2b681c1d167ae9ab96651e42f42f79f0220279eb7ba6f3dc379f37ac4b2f07cdfacf004c503a8a2c5d109f1cd239648ece4", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json index 26119dc176171a..41fdc55e63a3e4 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension critical field is missing", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202082ff7dd31d12569f5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000405a5323abcd8edb41ac5a69fc6bacabb83dc0f75c5b43b745d53c7bbfabe839e019d3bc9be44d5360291cd8e826ce9626003c333fcfc99ce5b9d49dab87fb78da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c99fd290b5709778a16cc3a68352b1edc4f8644301f0603551d23041830168014e4e747a7d0fe5105831ed079e820595673461bd4300a06082a8648ce3d040302034700304402203e1d07f6c2019695c6e1eb4e38654560ad30f82c38f4c8f231c95bd69553fcd5022058abaa2e7a82322b5d81f16786cc9237b3d10bdd5d621a5b2ce7ef5fef2c12ac", "pai_cert": "308201ba30820161a00302010202081bfdafa03b0d8201300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004645e57c86ecd4345faf4548c6192a42ed184fbdd59ff3700a1dd1dd97109a2fe2388065fcaa3278fd91cf16951c45b26d166a6b377b56e09b5d6ff2bad421c6da363306130120603551d130101ff040830060101ff020100300b0603551d0f040403020106301d0603551d0e04160414e4e747a7d0fe5105831ed079e820595673461bd4301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402201f1ca77038af496dedb9dbfca24b54809db0fcb8fe1841f8b900a36e625d22e20220577e6f488214267a3d3bdb8b3f76d693a0e1110aa95ebb4cad704728aadb022f", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c18d4416e5ce172103bd33a4282438c8fdcd40e965ee4c2d0602249c18f72f4a022100c705a866c0bfb10fe9cf89e0846b752f4b8447a110186ec311538258cb1d36b2", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json index 89ae327284be82..403a7bc9757ae3 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_critical_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension critical field is set as 'non-critical'", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208390f18304e91f339300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000456a4433af46b51d3a9109e6b5a1c59bdd13e19b5a3d31047b25eb3bf5d96392152ada13f3000719771b7ef9affd85c265c7d901c10aac888af727bc24125754ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604147a6079d172001dbeccdb1c920af00acd76c2d71e301f0603551d23041830168014003b6b25e8cb0898ff00caef87a5a6f0fcc6ee0e300a06082a8648ce3d0403020348003045022029742df6bd63c94f3bf49b9eb907d36634b798eab6da0545c99b7ae06dc803900221008fd2e4925ade569b594365cef9717d00b7fc8dbef32f091500299a80edc21f4a", "pai_cert": "308201bc30820161a00302010202087910e2400eab872b300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000417ce00698978d36f38cd9e3596c7640b18aa1fd4c6e8069865a584e8f1da13e7c5047c831ffc517d417a8cf8c8087a827891e9e9680659ac56a854ee300f8427a363306130120603551d130101ff040830060101ff020100300b0603551d0f040403020106301d0603551d0e04160414003b6b25e8cb0898ff00caef87a5a6f0fcc6ee0e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203490030460221008954e8a1d5ca5688bf724babdc15a6c9ac9c570c53c1a1ebfe8a983d8b2b2ae2022100ff7822f92b3a143f08c2f27912a849fcd387854f5891ae5a953046e7ac5bdeba", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008470dea64aae7eee67a213db62e7eab7a53af1fe0b1f8aa7ac137f102487cd0d02203e24b8cfd5abeacb19055071e01fc28b9de43567bcb300b070dc562ba0e77cd5", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json index b54cfde97e335a..00663111609102 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_crl_sign_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension cRLSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208021f05d9209b5eed300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d54d447e8096edc631867938576b4cde7ced88a3a201a7b5645b706fe1427071be4f8a2bfe3e53e2ae25b7540d08d491b05e0c53ecef7313fd32782882b7d21ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041499d27e55b5cc920feaa2062fbc5b045acfe87e32301f0603551d23041830168014de884c14c6f2bfb8911120f195130d1181f4df6b300a06082a8648ce3d0403020348003045022100c9a86509c9430ec42e9a4783451184f283c485d7ebaf0829865f473ca5deb99502207cde5f2591b80f0ad0b27d2f1bcb0e27b1b4e55a9d5034ff60a2b891e2b80ba2", "pai_cert": "308201be30820164a003020102020857c3959e77c71e37300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004c7b0a2a21b5cb8a8b04c7f074e44ab0d183b50623bcc4a7d58c7d9c30a4e6bdd4b7e03e4f6b8dd664c991894c6f805d7cb621e6a49d0c1a459550cc530fc1a48a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020204301d0603551d0e04160414de884c14c6f2bfb8911120f195130d1181f4df6b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009d9e282f05420d5c4eb9bd17d53e1dffbc485e621df668b96f9ea5736921ba0f02203d68a141312687eff02b58fed54caf96e6117481744fd4a7254fa7acbd0f66c2", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203a79f41c3abfc33d4a7341fd9613a1485015b659ebbb75dfc6ee9faafa8b3eb7022066cd96103af8fe1e9fb14471997ecef5aabae69e44eb0714a0417b29d7198e10", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json index d24649ef06d780..0a5e5fed786a81 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_dig_sig_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension digitalSignature field is wrong (not present for DAC and present for PAI, which is OK as optional)", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208568288cb4b319ee2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000491d6c7888cf88fe930493409a59e9bffcb7da6dfe8a24fef4366368171c407d4ab2cadc2a4d3aedf78f86034b510644795e8d60503f3393024102ef1bb3445d6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ce4916a3fb7cca300ed9b27bcfa6c52b32ace0ee301f0603551d230418301680146501d5f9b760746c421ffa03f40ee1233d87bad3300a06082a8648ce3d04030203480030450220273649bfb1b74c74a583f18b43dc0e998c8187b0862d4d8b7ecd4a38d76db1a90221009f8f26312ef21f1525ab3b1872c2601acb73543b97aba395111c4604b388d1a4", "pai_cert": "308201bf30820164a00302010202085067032f9c6011dc300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000407e035085865ff28c03934454eaa22dc1c4f36c0844f1d7c7ffaaeacfba0e777efa63547f59a4384448841476d9955f943372f43aa7d498c128dac0b3ac5b362a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020186301d0603551d0e041604146501d5f9b760746c421ffa03f40ee1233d87bad3301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c4cc07bb7c45d705406ff6d3b7ee858cec34822d97ded78593387bd708a0f219022100b5a010d2b5695dcee2ce4f4f3fe7fb0765671b4c29a556fc773575002c5c4235", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402203b8a87ccaf348a4a13a6ce23504c741ec4a8a56c63c5c02601e7aff8b7adc86602201f3848c9ee0a4141091184dd7bbe75fd44264447d7d75c69bc80432850778dc1", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json index 84edfb431b15cf..d33d85d9eb4e10 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_key_cert_sign_wrong/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate Key Usage extension keyCertSign field is wrong (present for DAC and not present for PAI)", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202087924884a38f4a5f9300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200043ff5af3215758482cd3e77eec68c76311493aa69bc9135dffb142ca7f4fe943f5a5498ce135c7ff260af9bef4e95a83fc20b7276c9033999f3aa2cf744ffc794a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604145d2e60837f18264fb553e58c21328969723c56f6301f0603551d2304183016801434a3a3a12ce0eaaaca884a4e022b4adc5147510c300a06082a8648ce3d0403020348003045022020ddefb0c44583276a368c74d61b2061f6c05efbb96e83700c15e03afe3662fd022100efd96ab7972c087230bb2b6ebf9da69e2abe69bd6ddaf68b4a9d64de847163ee", "pai_cert": "308201bd30820164a003020102020845bb60ecbb58ff00300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004a93151daa785620f6b04045438900303a6987e6c2a67cc1216fc37dd84c62b9c6e429084d6c5f24478b917813cbd92087c3210ceb16fd1fc1ab88cf03b2a0bcda366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020102301d0603551d0e0416041434a3a3a12ce0eaaaca884a4e022b4adc5147510c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203d2d0a078afcdb2cf493d9e788b0d5eec81867f7278b4f6f4a667a4ac3155a5c0220452e9d85ea0e6be15989662ab7dd00cc49e8c7250648fb74b4c841f3fdef52cb", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cf4f0659d5ce494fc94022fae7a010790cc4967f81385d05f3eaf1d73f9576bd022100d7d876e9b7f58cdc63413b5d8c9882f837baec2e0766d6c6359ddc5c582c823f", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json index 07192fd11176ab..bfb135ef06cf1f 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_key_usage_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Key Usage extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cd30820174a00302010202087d057f834fe94eba300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004ab4ce79364db7231c37b47fcc8f74842557750575ad601d9f0ec133f5822f0be460589c0bad5ff8a64632bf2f1cec2fb7ff8ff7c540abf412af029ab50144869a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141706f69bef3e85e7f2c404db903b3b15937a3e9c301f0603551d230418301680149ac3631ee8a6ea4db6d66f6ef8b48653415deda6300a06082a8648ce3d0403020347003044022061249ef479d1dae146c9fad56a596edb487f7f907f52c83831707b02cdfea23502205819279fe8bc41bb95eb2784f1e31b3261a7d54306772094de97b7a84225c786", "pai_cert": "308201ae30820154a003020102020839ded80c128124e1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000464e59ce6959d0a7ef1369052d40f3a7a1ff39896b6f2b93c41f7e09f8207af46af12e996c460d8c6e310825684d5d925169df233508cd511d989bfa54f3889a8a356305430120603551d130101ff040830060101ff020100301d0603551d0e041604149ac3631ee8a6ea4db6d66f6ef8b48653415deda6301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022043d0153166f4b8c4bad6bfea956f5beef2fe96febb2684ec92a2c99828b7a402022100e37b10e382e43ac44d759121d3faf7882598e46b3337ef5fdcd3edee383bf24d", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502201648c9173efde4f9d472307d760fba1dc8450db3b519a47b6e087d27eb5c5b07022100acf41d1e385382b6cbce70dbcef4735bbae8c57e8f69115d41fba11a807cb0ba", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json index 42d8d45bfe2692..f248eb94d4b644 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_skid_missing/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate doesn't include Subject Key ID (SKID) extension", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ad30820153a00302010202086e2ed492bc70d71d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042072871fa6fc54a1885c486f01f8f98412aaf0c51b9565da9bb531227f0d0e2b3ae2ddac35c8f95e1b40b9e49c3af84fe9fec864a2a17cff7df6299349e2a491a33f303d300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cb6d33825513ad3ca95e666e46b402246ffd1b81300a06082a8648ce3d040302034800304502206a006730723f9b2935daa5e73a217b49de60195b01f9242d53d31ed901a59671022100a2720f5c12c542e1e559bfc38499449720baa863ce704233fd21142bfae0faa2", "pai_cert": "3082019f30820145a00302010202082d4efa1768bd9df6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004e8c32f125ab85828abd0168b08e2e17637ee1a90bddc2a6621b45a161435711caf3cdfdfd7e5c994b6e2a033daaee3c82da0a38e9c9858ed7426a7b0bcb39094a347304530120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009b5e5d069368ab4c684368da10b1dacdd4861a0c4421d03dc47b8ce749969b840220656909b3a25b4d39965078f453022ec2c0192c3e62f344227144b08b970c4640", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220577d16c1b4e48f5d8aa4a2f89ab44684ea2b8c23eaf76ed4d62e0e4924c7df070220711ea523f0311b2aba70568b0e0dd3023b10a5887ee487f1a4db479d8f1ea7a8", diff --git a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json index 9b3805eb26e501..d7dcdfbf34c0a6 100644 --- a/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_ext_subject_alt_name_present/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate includes optional Subject Alternative Name extension", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020876cd3daa9f77b736300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000480bb57fb5c29071c16c72dd9ca923f0a308395d1598589de90a67ad67efa0bbce89b9f24ca57112be21bd0782b3520c53289a3a55528134b3a3da80a5923459da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604142b39990c7d963956b520dbd4762edbdc9d2210bd301f0603551d23041830168014741a7b63672a6a1b52850d2c5fc610fe1b70bc37300a06082a8648ce3d040302034800304502210085d0d397c932ae4c614cb4a25038494333dea82c216227d9dbca696af684ea0502206f9d844bf37f4484798d089fa4fd442c9d74d3af1bae246dc89d64d6a0e58347", "pai_cert": "308201d330820179a003020102020847e8708a15a23c84300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004ac0fe95dacbbdef66a9bf7d65fa16f396965708558f962ad654410b30c435837542e94c7c6bfac2ba5a5f5e86380a7a9084b5ce14fac6eafcf83ca3eae90494ea37b307930120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414741a7b63672a6a1b52850d2c5fc610fe1b70bc37301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e30130603551d11040c300a8208746573742e636f6d300a06082a8648ce3d04030203480030450220760375098e7b13fb67cd344eacdad6dcc82bafd169e2d1ac310c6bf2d8752205022100f4be9ef00b70882019241b2a6b76354313711962def73c3d16cb64b2ad8212a9", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502210090124c1624a6ec5f6ed299ba83ad2d2d640fa92290982a15f6e33fb3b06676dd022051ebaeaaea7e24f58c96540fc075dcdc0bc437c439c547b5d878e271157e9f6f", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json index 4d0b865bcf34c6..880c2c100c0d8f 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate signature algorithm ECDSA_WITH_SHA1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202084c92c16ce75c48bb300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004bd174e9109a8e7cda6c486ea56e2f0b194f874a14a29bd2ba63f9a94e8eef8ef733b212fe230725ee424792ab41fd5a3ebc5326e41d0a9846b65e97a5a8b049ea360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b1a07af3016f22fc71a32df1ef88841c6922ada6301f0603551d23041830168014ffb717ceb81d8d127e9cbc8588a2eaabe60419d9300a06082a8648ce3d0403020349003046022100b55b9ccc5734554e8bd0e3902424ca55837002ec307de04151c5bd72f0972ba70221009e5e620993c7a60341a796f21f0b3aea1e843ba8c0d4c97041b9782cada89cf4", "pai_cert": "308201bc30820163a0030201020208394bd8ef7c25fa52300906072a8648ce3d040130303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200049614adbdb52ebb9cd39657f43310decb7be7723cb52df8660ea86d49a294bea2ebd92c0188a72c2281c523d6b082f575fcf1a936c0040841467a14d7a31b23fea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ffb717ceb81d8d127e9cbc8588a2eaabe60419d9301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300906072a8648ce3d04010348003045022050539e0f36bce10825ebf4876f54d04e7de6f7aa40ff6232a444bfc345352255022100d2e05048e249ab2ba422d0e09a233aef5ba4719a6f7cb4f83e9b43ca8134dbea", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022062ace16c24819f25cef24ef481df62fbcb8ff6ab86f3225421adeddebcfecfd502210085cfd967564cd84698de4f4b1ff1a8032363d1b4f3a5ae4e463c75e0d4e2fb57", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json index ae15b5319c4c8d..a4292047f4275b 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_algo_ecdsa_with_sha256/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate signature algorithm ECDSA_WITH_SHA256", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201cf30820174a00302010202080a6d20ec541a9788300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004fef168ed076810e44c4d93f6e9b7dd63562f488dd8a562fdc14b4150d701d5fa864bb0b03f3e681c75aa3b92a47db445888b16c363e1e931903d8a6f5c994c8da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414684fafbfe3001b075b41233abfb8c2e9fa27e280301f0603551d23041830168014967d9859b09201222a48f2d3a06df7fbd0c0d605300a06082a8648ce3d040302034900304602210091b44bfd54e94510b67c9b325a1f00d9cb467bd5c12d336961acc5a3a37324d9022100e51014934fd403c7ab9f4f408b291098e744861fed66bb3e0c5754e7140a019d", "pai_cert": "308201bf30820164a00302010202087c76d8c6b0513e6a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200044a0345ebc50a500be2db044330f80bb7e64fdda251ee5323d5b96c56ae3d18f25fdf78f1bfdc8d4ab137aa0fc98fbaeb4d7aae565ce269fe01bbf40f2d3df168a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414967d9859b09201222a48f2d3a06df7fbd0c0d605301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100b4a69ed8ae34b9e69ba5945154d66b59ae79c7685d644b31dad5061875d1ce86022100ae682994a517a96a454178a78d9e2e7f7e7f0036d518852485d7283b3fb372d5", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100ac0b49310f9c603472ef27b77b7adacb934bd62c225474f70d39eea62cd53a5a02210099a89f2297dd55e8f98992c3928c3d834b1ab27b287116f1a94eeabe4d68331e", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json index 64a3e70734ecf2..fed4e721296cd3 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_prime256v1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Valid certificate public key curve prime256v1", "is_success_case": "true", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208034c3cf7ef307f83300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d0301070342000498f6b8f8c098d01a3c93bd4cf213af4758f48978a18172fe0e5b2bb0bf3fa0af666bb945e45ab4e2a5826d2ea4ae7cd1ec384d9d97022b3febab74557288208ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b350bdf1aad4fb3d74eaa03c2abdb2764d6cd535301f0603551d23041830168014da7a67a5f221866661471e808a6523dd55856834300a06082a8648ce3d0403020348003045022100d692846be1b39c154cd0f5ef0536c7fcc0e21c5cb24ef1d7794e12209f184fe102201731bebf38c51acd3913b7612c92f69f5a3d8c42fa5a921c0e62865dc06a709d", "pai_cert": "308201be30820164a0030201020208065cc0521db0ce10300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d03010703420004f0d91b8f91e6722112f2f88021ff3e04731d6af15edc4ed0368c7e9d4098b442d437b7ef758ce7feca8eb100c81916c26ce49b8b0d3ae1d6c4b8d96dd7823b6aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414da7a67a5f221866661471e808a6523dd55856834301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221008a904657f43c8c7e43f002a812639a391870bfa51b482481ff4c50e8fcb88e2b022047ef3730d97d29198cf0c55e84b778d267a16ef17a10de9c6b9379b37c3a7d20", "certification_declaration": "3081ea06092a864886f70d010702a081dc3081d9020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020448304602210083107ee77d879acd4fc612dbb4d96f4ad5d40ccd7350b509f88f432f626f8ec7022100bfa421c220aa548d2fe939e4bdb4adb4e90194c89d9d93b79aa7c257de9bc8c0", diff --git a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json index 3bb8980e1f7c19..1d4bfd8c37458b 100644 --- a/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_sig_curve_secp256k1/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Invalid certificate public key curve secp256k1", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a0030201020208159f2db80c8688b6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d03010703420004d68bf47e479b220605e3a4a31ab9618609951cbc5a394a7d5ce7d8fa6c977f3dac3e32135f863af41133d42589e67246f9447508ef19ac8c21ee459c389cc350a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d2ccafbcc0e990f3a7f49d5f57ad736ba401b483301f0603551d230418301680148532c4fafa4e2f896107e5e9b1540e20859792d8300a06082a8648ce3d040302034800304502206300b25907bd1fe1e2a88b9b8574686815a49314db8d151f9edf0bbf342e3b25022100c993b4c6ec106ff87fc748fa976994200b06b1d176e44d658ab45b3152f7cee7", "pai_cert": "308201ba30820160a00302010202076da356b4a721b6300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313056301006072a8648ce3d020106052b8104000a0342000453769340c2226a57d673e9f998a3f903fa017e9bce91f49a3bf5f064d9464c7a7a961864a4932c5bdcf9fbe19ea4da25fefca60bbc58b4c4dc93bba82adc3713a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148532c4fafa4e2f896107e5e9b1540e20859792d8301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450220228543574dbd43da23f084df886c61619a876749e2a66226ab67c5d541565ccc022100976a69d6d0785de76d9852c172c32bbadbfb259a314ef134b07fc9ebc880e9d8", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044630440220420e4db19950c3e205c427e9678bb78f701a93c2caaaf5bf54f2a3506e0a6a0302201493ac9216695935d70aad5b06e835efa1b49da6b7de9ed83224fa1c707170b7", diff --git a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json index d96f25dde02781..bac15b7737d55f 100644 --- a/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_subject_pid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: PID in Subject field doesn't match PID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a00302010202083c116225d1c63705300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030313059301306072a8648ce3d020106082a8648ce3d030107034200040e6d3bb1f6f06ce5db1b6aeb24587339fbaad8fb40b613754119e2d8c7b654801cd1ecc07c349ee88b9a53487cc201f9347f3e0564be7f60a4d6ea61ce17ea3aa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414df0ef175cececc49f84e2b5583b9eadf3497a93f301f0603551d23041830168014ab768451266a206497d304c55a9baddfb8afd934300a06082a8648ce3d04030203480030450221008924ea4a9581fd864cd9767f5a30c95b526e808fedeeb81fee60e6c9e3dde903022006f8c637cee3b4caf34207b9fcc8c87816460740fd73358051614c3c43d576f0", "pai_cert": "308201be30820164a00302010202086c4e02d4f7ee51ac300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000424f8a26698f7c85a69359fbb724a05485b7caf964796aaa4f02513e790a289f32d5add93e78fdc2820a855c024079c3d75bfc242b279a1332ec516f3097fcc74a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ab768451266a206497d304c55a9baddfb8afd934301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100c31c78e5ea4a825efcbfcc758b9dbe9401eb33475ffc02e8e9c01bdefa228e4b02205c076387c2d796e3509e0a6a9ae4993ee56c3d00b2f058cebff7b68b6c5b0977", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205018018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c843fccfdd89f6d5cc457f1f58f5184c975b19fd1178312328563a606fb93f8702206ed82aa8d3824d3ea9434813a49ad731702ed69650cf9be09151272294945a96", diff --git a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json index c274c22d7538c9..4196d49a74bb5e 100644 --- a/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_subject_vid_mismatch/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: VID in Subject field doesn't match VID in Issuer field", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201ce30820174a003020102020867c142f97f529383300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646323020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200047e8d29adbd27901afd2ba88ee8127ab4890abb5883a28069a09b3af53b307dd1e0f530ba36a0a164fcc3eac230326629a59eb330b6bd1d8cf34f92a54e187e6ca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414d5a162c530ee09695c6751392113e4f5c859a98a301f0603551d2304183016801441b45b408991886acac75afeb780845c93ceea0f300a06082a8648ce3d04030203480030450221008ce4aedcbdb09488f98205bbd013f986f023d402fffce2e079505b25a144227d02201de53d35dcfefaf0863e2187e90a84b176cf3f5f1e4d915c70edc345ae0821b8", "pai_cert": "308201be30820164a0030201020208178ee14bbc76933e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646323059301306072a8648ce3d020106082a8648ce3d0301070342000477731ebe24d0f7889902843c7b37c3aa05f65f3c527d3cebee0838a9edda8ec4db1ecae4ad671b8acdf115654d032975a85782600b937896a9d69de1a50f5c0ca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041441b45b408991886acac75afeb780845c93ceea0f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100fd6966017df84701e73c105c862fbde730e02101f86c4a3f4ded69a33ae225f102201cde0e4dafb66f426d4a5ef56fe2176f8852b51f89eedd6b51656043bf40048d", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f2ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204463044022016558fc85fa9ddc2b6a8fd315465288e10df64a4fa5c7df97a4d4ad5d718624b0220369af39142dd44abc12fc1b9f9acd8896bede8f4325ba5aad422133adaea0be5", diff --git a/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json index 36ad3a635b65e1..11d762523e0540 100644 --- a/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_valid_in_future/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate validity period starts in the future", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a0030201020208454a6dc9e9a2974a300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200042de758a70ead588db0aa679e72178fe3291b5e6a850f7994bc9c4a7af6fcffd2ff114461b29b86ef6bfc01208b83740dbcf11fdea4d1a196f98896bb428bd83ba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c83ec91c2a4a2b72f023cba57ab8aebd1450d2ab301f0603551d230418301680141b52835b0aea1b0ca641e2ac307a42359efc373f300a06082a8648ce3d0403020348003045022100ab803db22f397fd7203cd196e47a71be404719a582429be2338fc4314bb4171702204c847835c3eef57f8dcb6e2dd361df8b5764d7d682a0a393d056834f0c6fb6ee", "pai_cert": "308201bc30820162a00302010202086f23132964c502fa300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3331303632383134323334335a170d3333303632373134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d0301070342000478e5567aa7cfa53759aa645e288e8ab50cc355723e98a6b9189fefaed87048917c294b106ec478a0f264afc05a5d7f1efb57d63ebc3abeecc0b48454a5c5d380a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604141b52835b0aea1b0ca641e2ac307a42359efc373f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d04030203480030450221009cad628b2b80361fab025d2607ca9b44262ede96ed26eced42d3ba5b8276b4fa0220229cb4fa39f9e39e74623ce86612a30555b9f0a6ecfe2ef85b75fe97be148ddb", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220119f54818c1ab5e24f23be069a8e552a96aa2627bb5b431ec3769216822c96e7022100a8bfc1afcc6e3dcbd93faf9c93ac93e690fbe2558fdf22716a0c0933e03a1687", diff --git a/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json index 0f1e2e64544159..9f64d438cb41a1 100644 --- a/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_valid_in_past/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Certificate validity period starts in the past", "is_success_case": "false", + "basic_info_pid": 32768, "dac_cert": "308201cc30820172a003020102020804a1377d00a6d962300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c0446464631301e170d3232303932383134323334335a170d3234303932373134323334325a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04383030303059301306072a8648ce3d020106082a8648ce3d030107034200048b8fab592168f44e47b6e5db325b98f7be98893588bae4a37d0e14c6c4c36b28f903de55eb8b20738cf941cdc5d1cb664798916c2c1272ad90240b5041c5e842a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414a08873bc22f7d3b12c0413b1fc4bc907a09605f1301f0603551d23041830168014ceafb2800c542e5c7a25c1927f67fcc9e24dc317300a06082a8648ce3d040302034800304502205b59ef30fb501126afd11fb309822c45a03287fec0c709ed32bbb977f47bf0d9022100c98647b5e33a6a91e4cadafb66fb4974a6d4ddb2a044f8eece655852e58e28e3", "pai_cert": "308201bc30820162a0030201020208498271f690d142d1300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c0446464631301e170d3230303632383134323334335a170d3232303632383134323334325a30303118301606035504030c0f4d617474657220546573742050414931143012060a2b0601040182a27c02010c04464646313059301306072a8648ce3d020106082a8648ce3d030107034200045f65df3af4144e4d2a8dff68620011a5a24f00081464281522a47823b84bc38e647d0ebf20d172fa6a6c0f810bfaf02ad6046e71b1f9bfb70f382fba4694b9b0a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414ceafb2800c542e5c7a25c1927f67fcc9e24dc317301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100dd489d437280309b39dbb01a76c3be6e18c55c76913df455db9fd4b993e70237022002e0c2d331fb7abe0684ef467159bede7a57fa6a3212f86d925c90be1d33fdec", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304506092a864886f70d010701a0380436152400012501f1ff360205008018250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402205dc619e5096ea45ea834b77bd680e9d766ea79bf537f77def6048eeead88696802202f6ed57530098471cb085fd2d10e32088abf227e066178fda7dc78a77ca0f244", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json index 18b22bc258ddfc..beb43d8051fcaf 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_01/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820181a0030201020208075b92e4e6b84e82300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c17fc6509ae5a59424f3c708c0608fb7a6c0315e11d4b2225d1bdafa9086c3a14408da49d9c20b67eff3d682f3d04c970b6c4f635a20d41783481bf2ff49ee01a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414bba10e4b38e2c0e246051e84715e5baf6a13fd60301f0603551d230418301680148dfb62ca6a6bc48ac92ec1ac6a2371fe4fe3267e300a06082a8648ce3d0403020347003044022057b0b3d07ca9dff103f666d325028046200168451b599f091a8fcae50430ee74022057557b6bea2d6a8945a783b15b4b95697d815bb1f4fc99f2174ce62307ecd692", "pai_cert": "308201cc30820171a00302010202081798022b33fbf3d5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004bc34fa7fc9ea49b2731e65c1d78e13be11af24e7631cd36292ba3a7d6bdb56934717611170b9c989f64d5b7557081fb3a6504b3a443772528cfc5d0bf2699d92a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148dfb62ca6a6bc48ac92ec1ac6a2371fe4fe3267e301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a0090fdd7dbdc51282166ccb310ea9fac1e099235bdd60d454366e889d287b170221008d86d2cf63e6e351a0185c5357186fd86e078895810e3a8a0e1af1c1cc8be0aa", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b621544bb08ad4d9f4726bda7ee7d4401d8b371dbf55ecf23c5f77f9cfc99dec022100e3b4ea7d887641f74f88d53baab86c22b156c49a6f5d26c39133361100c52eef", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json index c45442381c8753..732d70cb510e00 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_02/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and recommended since easily human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820181a003020102020827b0ccb4f6500d10300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7069643a30304231204d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043f9fd0355ae1d7e07718cdd18ef833424630cdfc170bc1bcc75fea873bb74fbcdb66ef0a146488433252c69a41e01c233d3aa055710308a1385c9fa80c5a945da360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414264be0d1bace3eca7b1a402b913e33af96cbe7d0301f0603551d23041830168014d68f452a3f23173b4f09351fb28b94500a5cd815300a06082a8648ce3d040302034700304402207ee9bf16ab2d8ecf7f1dae17e13a276ada3823dada77d9c248ffd31490ce37ab02205e6c75a73c03a736b3d107b3f6b61eb5829ad7a41718e1c4c3aa954ea08c3627", "pai_cert": "308201cb30820171a00302010202083c82008c7ca9964e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7069643a30304231204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d03010703420004515a9008f7a5bea6990873b1f97b413c701af0c92f345faff86688e1b5b918dda5792fa097d12196e94fdf06430b58e685505456126936fa896280eaf012ed23a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414d68f452a3f23173b4f09351fb28b94500a5cd815301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502205e6088ae22c474f3a74c9ccffadd5af64f2b454ce2f8be307231038721d088fe022100ba91ba65bc7ae67077e4cd359d8e8c62731976f7afe100bb1626e951fc0864c8", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100c4d3874a8c4d4f346fde865cc123e2fabcdd12e5836ed35006673599df20d144022100e137b6a190860571970460a6926d8867d7bbed46c8ceaa0b9166ed85654c920b", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json index ae8d9f2dc9953e..796c4f0a8d491c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_03/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid example showing that order or separators are not considered at all for the overall validity of the embedded fields", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201db30820181a00302010202086be6588a0c214e50300a06082a8648ce3d040302303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c205041492035434441393839392c4d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040fe5f58712656d94acf12ca89e42de64bd93905c95f0c21b1450dbdbc5bd9b2c5f6dfbdd3379952a61b6dbb45db303423770ade5adf037c90fcfa5f089b00490a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414acc5e72ec60a3ac2916034340054df20d90ea6f7301f0603551d23041830168014fb76451848399889897ef5c1cf23e443c147c3bb300a06082a8648ce3d040302034800304502205c9a54117930e18b7ee39e5d694d1fc2c2841ff161a59fb52b575ebca9b19cbc0221009f1a4ed576680ea6c409deedc44d91f4fcb16224b49b84dbebd78aeaccad01db", "pai_cert": "308201cc30820171a0030201020208702ce8a9372b6270300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c324d7069643a303042312c41434d45204d617474657220446576656c205041492035434441393839392c4d7669643a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000488a08cabc9aba0b4dcd4afe8b0d5af7947b14a282a5b68dde65fe243d556360ea9cc5f39c01915168b83aefebf88358ab8d1f1e1746a6865ab91439e5bb4adcca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414fb76451848399889897ef5c1cf23e443c147c3bb301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100913e3da905a8b6526eeb1a00060367688f7616512150c0a5aa902fdd60a58a30022100d5af59745c178cad737b59b81c3a5be5bb97c59fb1cc71d096f0a1b61f2cc91c", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100a446bdfd25f2f265c8e5af02a04e66b97cde7c110093ae69e1b30037936f060d022047ee346e38e0329c6376fd2412f946874aea76b4f8bc31380d71528020e02152", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json index c0fd626b74fff3..a42eaccb1defb1 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_04/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid, but less readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201da30820180a0030201020208341c84535eef2a8c300a06082a8648ce3d040302303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464646314d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200043759eca89e16c6ea71d19373251b626735c40e4cc7676ee27d2d8b1a0b3adfebd30a1bb4c9debfb2bf38d884017f559b4ab643e3c1bccda8f95d2f190fa9cdcca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414b10e44888842fb2a4baeee56310b35e27c922432301f0603551d230418301680145cde37f2a41f16a31733ce16d13a77ebf05c48df300a06082a8648ce3d0403020348003045022100c676782b8f33aa2c7bb4e91e07d078c3ef02bb985fbad909262768868d1f3f3902204fe363f95746e4f4473011cff3790b0b27d946a23fb307ab287e99845863d612", "pai_cert": "308201cb30820170a0030201020208607acf46f1d3e5ce300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464646314d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004141fe85b64ccfaf4cf08decd5e527efedb6ffbd894a57f4841bcc6786c404757f596f438dc32ce9203284ffc13fb4361d8a621e70ac1c7ea0c229a90286bf7faa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604145cde37f2a41f16a31733ce16d13a77ebf05c48df301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a607e0db00ebf2410df9fc436d812c630e352d98f5353f0cc57d5bcc2c2707b5022100d3db92986d7187ff45f487b3033cab026645c64603461f95f48a57102351bb84", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450220718da3c75864aaafae04ae718df356f20cdb4688a3b6934d37bff390e3111d170221008d6449aec65b2c295effd4f8136fc8fcd014bb7bf43e741947e56d744dbb05c1", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json index 1749235ae42c2a..589ff774d27cdd 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_05/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid, but highly discouraged, since embedding of substrings within other substrings may be confusing to human readers", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201d93082017fa0030201020208788c1dba87df1eca300a06082a8648ce3d040302303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2050414920354344414d7069643a30304231393839393020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200047dcffdc020b98cf45243ff00b6e6ecb9b2104716acf58caada56594e15d9765c3ab3d5ef5915710be74b2a98e8c556cd7501cf54d11f381fda345e3ebbf891afa360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414aa332dd474f438cfefda10c9de746d47a26c2aef301f0603551d23041830168014eb78ed1e616d294a4ba80c7143272368e8a15f73300a06082a8648ce3d040302034800304502210082eceb5aa56a1b4c55176520c8d36b059ce56c0523a902312d4d821fa750b71302207c24a9d3904db54a967c50e39cfdd88bd2600d5fdfbbb5b04305cc6b8d3b013e", "pai_cert": "308201ca3082016fa003020102020876d8e013abbff228300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c304d7669643a4646463141434d45204d617474657220446576656c2050414920354344414d7069643a30304231393839393059301306072a8648ce3d020106082a8648ce3d030107034200044529d3117c1620b85bedba1625d0532dcf27aacabf727de5fd87718fa831c2219d7e290e5569a98383aeddd6535c1ce7f7132074b051cbc44941cd4b9f88c8a5a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414eb78ed1e616d294a4ba80c7143272368e8a15f73301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100d857ca39185d655e765ed86a8e0267c804ef370831abd643b49cc915d2367234022100cb42abba9290c7e98b541e44e1dea0836acf28efca6444339401769f9ee01e72", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d040302044730450221008c5e26f9803a761df58dad43a982b9d847c3c5314e3f96f2ded64e141506dae402205fd7b4753013d99a84a7ffbedf849f637c2460aabe0aff798766cf9b4cc973b2", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json index fbb97c09628413..1ca355f8b9214b 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_06/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201da30820180a00302010202082cc0ab89c5737671300a06082a8648ce3d040302303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000474c36871149a64e878220a79752c019edb7193c2144a4a6e882efb594a96ec9f7ca0953fa4238b9a49fe94d60c28c7df0ba1e0852c60fb1b82a9c4c6ab6b05eca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414ba73a4cbefd9468fbdd7ea29bfab5069aacbcf54301f0603551d230418301680144039994c01e076690db8bde12379548d58249492300a06082a8648ce3d040302034800304502202a717bdb5ec4317bdc38eba5107f62a33fe8776638ef4e434a63a0493dab935c022100c73160c265f43bab397d8023bc50854de3cbc8f61e9458deb80233aa54b659a4", "pai_cert": "308201ca30820170a00302010202081c51c96c3a6e7917300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303c313a303806035504030c3141434d45204d617474657220446576656c20504149203543444139383939204d7669643a464631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d030107034200046d8237afd1aaa978d61d7bb45be106dc29c6513061b63cdc7af3004d7e88ea14da1855741e805f54dd8292676871d3464c25234c2dd54a567ccb84566ecd1dbca366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604144039994c01e076690db8bde12379548d58249492301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022027de262c9345cea9a8f45597d6aef12ef7dce0c3ccd1d12305146c5c940355be022100ea342226806500b0bf0ca69ec2f233afb6c440e0197cfa3ddfad47dbf3888a62", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022076a4dd713a309fecfa71e707b71519a76d545c4d9a5195a0d58a4c9c49464bcc022100d562b3b2ef277df2cf64873d9e308ab622b81abe89aaa9114bbae1ad3efa9c4d", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json index ff957566887a19..92c74a639578b0 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_07/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mvid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201db30820181a0030201020208459e7c161800bb79300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a66666631204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040d64bbd9912a0905f5e7a199dd2c0ca9dc9c9186f9a6401e74367f08eac15a6de1b2b11e67a45c8b01f3f017748f756900f15aa61397dd342e2e8e5b5860a5d7a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414c61c03351d3689580e3d30793a0e98941308df93301f0603551d23041830168014b65bea13eda87ae7349b417429fcdc21b5e0c6ac300a06082a8648ce3d040302034800304502200631989f1bce923a41d708ae157f72d9a9b0dfa1cd6d85b013b46ef36e4fcc28022100963813cc6f68d125d4108a4e9dc30a4e7de9d1157e1b29732631b4682597172d", "pai_cert": "308201cb30820171a003020102020836de254c09e2c5b5300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a66666631204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c305250f66442203f5d0a1d4a69b15e2a04d3234da18db17144171b1fc6e711399e532ed4e1cf2e7ea25f6939330b4200c2aa9957955f1a877673bdecff80ef1a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b65bea13eda87ae7349b417429fcdc21b5e0c6ac301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100ae883e1c02bf892d9735e997ea1e4e3fb457604d922156d69db0d56a2de6f77c022020c2548237913179861a2b7cffa998a490cfd8a7ad06dc5970f27f403429f036", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022078c7912cf529c6667355bdcc47943465c0e0938a39097b729944b8eca11b2c33022100cb500ec6b4291d8a1ec7fa4190e295ef1581af65fc79236dd728f36adc29a6ec", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json index 41d5d3d94211cb..2b19a74f79aa8c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_08/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d93082017fa003020102020846cb41af3a7fc9c3300a06082a8648ce3d040302303b3139303706035504030c3041434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a42313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004d3e1c5422ab213f118f959a33d2204342cf598dffcf5cec0474a1bba6e4c1a7263a59c605cf892038a704fd266149b5c89fe35e17e8dda279bb03cb1c7bf8ca6a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041430616dcabe874ac65e3dce88de7c5cc5defd86f9301f0603551d230418301680148fa036268e8eedbc73e12a0eeadcb2fbec8faaac300a06082a8648ce3d040302034800304502204ef134d60bb150def30f7c2df8f88c46755e36f48a12831aaedf17c4944cd70d022100f61555085107e4e783a5ad6abc64e1ee1f0d719b7d83a5f8bace41949f85c284", "pai_cert": "308201c93082016fa003020102020821b17d362fe9afae300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a303b3139303706035504030c3041434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a42313059301306072a8648ce3d020106082a8648ce3d03010703420004e72dbe2a0f600358978022ea70fb7ef3ef14de92a0dfb9cfb83b542fbccb7b8a7b13d3f37a26dfd2400224ae4ab82e1c13ca57a45e4ee54e862a192a6d4f1f3aa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604148fa036268e8eedbc73e12a0eeadcb2fbec8faaac301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502210093a63c6f397d39dfa5b60c06c2839448ab5db0bf0728c7449c66bdc55e3ff6c302207b0c997ff95f1795b86828d1137b34f3f2aef1ffb2183a6e4c02836c1c735171", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100e1d4967878513c474101db44c68061689be47443e21f6675c34b872edc5a319c022100a963e07bcd8e4abeb8b4fcb19f6a59c92f1a3bad4d7153f333684f93a836e3f9", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json index 210bc861b49deb..04737915883859 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_09/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: invalid, since substring following Mpid: is not exactly 4 uppercase hexadecimal digits", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201d83082017da0030201020208697ea481e17f0f9c300a06082a8648ce3d04030230393137303506035504030c2e41434d45204d617474657220446576656c20504149203543444139383939204d7069643a204d7669643a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200046eb8078776faf91061011baca81d4577b5b6b64e6f3009ddbc05aea20eaa044dbde2f70716de1d0ea2221a57ba5ca2ab23995fff18e63c6c675e403f7bf7ed53a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141c1bdaa7b3c18076e81187da63295ee068a7fe29301f0603551d23041830168014bd781517ec524b8b752e7e529063de96d6c2deb1300a06082a8648ce3d0403020349003046022100ca59fb5cc9fd777641ba761c9fbf16dc24f044fcfca5dead17ed7cae02a3f64d022100bb501e52bef2e0ff3d9b6c9bc8dac1c6adf94a19d66f38cf840b89e0bbd7dc12", "pai_cert": "308201c63082016da00302010202082dbfc034ee2ebe32300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30393137303506035504030c2e41434d45204d617474657220446576656c20504149203543444139383939204d7069643a204d7669643a464646313059301306072a8648ce3d020106082a8648ce3d030107034200041a872e39c4f8337945c51b1a5dfa009e0f8402a59d996da057aa370acb18450bc3316babcf7c6eed0555300d7e9e4ac42c0e9556857835e8e8de2d91a1bbd27da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414bd781517ec524b8b752e7e529063de96d6c2deb1301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402205c38ff93c407961a98e61bc23ea65381a760f97ac0481ece8ee21bcd451b8c2002201d6c7ee510aec10ea02402f5f6d80bc74489fb8793d64a77e06b8fece69cd4b8", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402201f38b426df25ab4f552ded014845afb1a353e808e9250fc19dcfcab3d717679f0220575a610c996f0221628ff9a76123d3462922f91b6011ba727e6d42884ae88c08", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json index 3615a6d9a15024..d9feb73cd2286b 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_10/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid VID encoding", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201bd30820163a00302010202086e40d9d03d53e04c300a06082a8648ce3d040302301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000414db8ee1d3c8e43a400352c581370f73bd380ed7b21ba20797f528c29dc980ec596df6819b2b71eb278c528f2d40a25371dbc576fa79bc1f94f54f49a1c58f45a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414603a7f4c6ccf6008057b8ae8262261fd7bdaa558301f0603551d230418301680149470b6ee8199d7d22da4759bf40c6c86a2e62d5f300a06082a8648ce3d0403020348003045022028af44d175bb2617ec5e526c252e58c15c4130ce70954e06acad5661d25a8185022100a22fac60cb1b01cc6d891f9339177ec5ab9cfa877773b81b2db9b10dd1acdbc3", "pai_cert": "308201ae30820153a0030201020208139e9818eb206aa2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a301f311d301b06035504030c144d7669643a464646204d7069643a3030423130783059301306072a8648ce3d020106082a8648ce3d0301070342000441ce3856f31dcd073f9c3ea26df801f476761731f5c19b57ca9fbb99ea7289df4545287ed407505e1b4f9550410b6d3b4d3d4d73721286b4f0554613abf6567da366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149470b6ee8199d7d22da4759bf40c6c86a2e62d5f301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100a96cefd90329c9d9b3383e9d1afb43615851906d62fd46264201172fcb5e528d022100ee557e6c1fa5d5136c334561e3a24c083dec63adda0ed71f74a11dc1d4181829", "certification_declaration": "3081e706092a864886f70d010702a081d93081d6020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317c307a020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020446304402206cd818861259869d69ed0b9cc2b32e31daccf37f7151336fa0c4f165f505d03e022050ac584e1fcd7cb6caca10b21f5c54ac6450610af6d7f2bf8c49905ca2e887ae", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json index e9a09a8272b614..a4cd10cafacd46 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_11/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: valid, but less human-readable", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "308201cd30820173a00302010202084bdb341f5fc5937a300a06082a8648ce3d040302302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004e8254678b023c1734aea87337d4348a062e5766d98b185a7b411fd99e07058411fc83964936c48023ee62549792980e918da22631a8f4d26c570b417cec5a5eda360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604141443640055a45c380ea0a7588d0c146347e4c0aa301f0603551d23041830168014c50fde1ee7a77909db33145fbf848f088684cb32300a06082a8648ce3d0403020348003045022100c768aa66b6f1f4db7a3a7faa441066c51619ded33bf993bb926d4d1eb73fda78022010b7ada24220522a1a971952ab0c6d338533c84e2a755259ae6b2a23a95b8a3c", "pai_cert": "308201bc30820162a00302010202074750dd89bd3491300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d7069644d7669643a4646463130204d61747465722054657374204d7069643a303042313059301306072a8648ce3d020106082a8648ce3d03010703420004c391114e7fd627e3c152235bf1615eac8a879c7e9a51ba7c9e64595891bcac89b066416948376bb4f4f042d3f401918dff876013f99ec3d1f31bf78fcdda77baa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414c50fde1ee7a77909db33145fbf848f088684cb32301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100a8a04d5f669aa9b1f328dc875a4991631f425b930fc16728cd63c29f48dc465c02201e41ed42e59bb842749f457e062f73215cd60680fe478add46865bca36ab1dd0", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d0403020447304502200f2df28c96fdf4315f3aedc2047dc27b7e37b586a2748a6c06803be853289643022100d5f943449ab4e9e5424d425e3572569b784039e0f196fb12ebfae1ab7539fecf", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json index f6b538b9a7961a..60293876c966d4 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_12/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid, PID not present and VID not upper case", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c83082016ea003020102020822d3664b338a186d300a06082a8648ce3d040302302a3128302606035504030c1f4d617474657220446576656c20504149204d7069643a4d7669643a466666313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004e33d89b7d1a4123229b9040dddd131d1f233ac45b2b50773394b6d136fb78be57d6e0f0d89ff3065170d6e0b414fa8f8ec17ce2f56501ac3dbc649bde5ed3d68a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604146dbfd588aa275b31aaac6cf7275d4362c4829b45301f0603551d23041830168014e3da5c94dbdfacf38d137be8d4bf7a452af29af7300a06082a8648ce3d040302034800304502206932c2909878b6b14ad28da8805ec06e9f7976bb9174dc58b3793c99f6407816022100a2c6f4d90b4a70ff204e40ecc4340f3438f7baa1ae5a9fb854e4697ad4d232f1", "pai_cert": "308201b83082015ea00302010202082dbc38a238629a58300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3128302606035504030c1f4d617474657220446576656c20504149204d7069643a4d7669643a466666313059301306072a8648ce3d020106082a8648ce3d03010703420004e7c625c4c041fae1941c05256efb9b984c0730244d6d8f0da751e661b0799271e0d66b95ef9a14df8250e269929a2d8137996e2e95f852a001675b9bac436276a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e3da5c94dbdfacf38d137be8d4bf7a452af29af7301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022036e4641213b0979eac7fae35b2398250738c3506488b7e212ba39d3a60edf2680221009990708a87b42319c14b0be0003221ed0475a7f340206674490645a45634fdf4", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b4d83918fdaf27d2be610752b8eec9e6d171bdb9bf9adbc3bef6454ff9e70f80022100d92c92837d48c482883ee4b5dbfda63803f99eddc48b771c50b6594a857b55c0", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json index 9aafc1fe40ce3b..250adcd5de6fb1 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_13/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid VID prefix", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201ce30820173a0030201020208574a49bb6e801508300a06082a8648ce3d040302302f312d302b06035504030c244d617474657220446576656c20504149204d7069643a30304231204d5649443a464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004201bec5f397f2c81cde7e8982f4f8fae69ae2ace8bdd0bafce04d4dc56ffa1b2fa5eebdcb41afb93c8ca93fc414369e7fcf4645a1bbcb9a8ac4afb32b4610aeba360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414cdea6bc02803e30d56e95bfb5550742123869df0301f0603551d23041830168014b8aedf531ad42608d18dcd0e5d7bd1a28e897f7c300a06082a8648ce3d0403020349003046022100d3e60f58ac65a92c06ee6cd1b9fe05efaa407858b3fead97e5d93a69ed7b6c56022100891bc4ec5622f9079048d6a0de1395496ef027dd824b237e6bc40578bd0188bb", "pai_cert": "308201be30820163a003020102020869c1d77b203a0a2e300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20504149204d7069643a30304231204d5649443a464646313059301306072a8648ce3d020106082a8648ce3d0301070342000411c1801d3bdf4b502f672711747091621441c425f3f33171b86850a66c4140685ff7984331b4ee36aa1ba814313981feb0aad82ecaa912d4c0fc059a218a3d26a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b8aedf531ad42608d18dcd0e5d7bd1a28e897f7c301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100e2356b850362726d3df98f26f7488f0fc73e957669ee5c125dc0a7ce659819f402210084b5c669d8fa4fcd4fa314f6084bf051e8f3159dba00bfb75bc5972e08c6d26b", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100e436f76060ebcc3f73aa2ec87de249727b57125160fb154d8b8ed9b4ce9092d202206eed7e11edac26e3c348a41a298507501afba8ad6842d82cbb1fa38a15022daa", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json index bb4ec7ed45158c..50ee40c6adae25 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_14/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Fallback VID and PID encoding example: invalid PID and VID prefixes", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201ce30820173a00302010202086c9fdd8da9351b8d300a06082a8648ce3d040302302f312d302b06035504030c244d617474657220446576656c20504149204d7069645f30304231204d7669645f464646313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200040bd69bee62d407baa92d7b4c68dc403fc8b2fef5d9d180e9118debcca84ea66fff8a5a36dbde69f8d3d97f1cddf50c79633ba4292cc6f5bcdd412197fcfb1ecca360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604144ee61e7b13c450a62d630433a01bb40ec43dfb81301f0603551d2304183016801490743e23c01d37d935d6a526d94dbc415178ad6a300a06082a8648ce3d0403020349003046022100f6205f88dcc23ea2aca9952bd714eff2f71dcdfb3f34a20cb71c833f8d6743e6022100b99dfdb0ab3baffd03298e2f5e584d92cab4da7bcd615bbc11d430c0edf1cda3", "pai_cert": "308201bd30820163a00302010202081d70ffaeec319495300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302f312d302b06035504030c244d617474657220446576656c20504149204d7069645f30304231204d7669645f464646313059301306072a8648ce3d020106082a8648ce3d030107034200046f34d25034b716e7f95139f6975328763cb9f58bd6cdbcd2831f0d3caa664b3eafbba86ab9cc8dfaae719e279e63b209d4af23e025f0ba30853491940dbaedb7a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041490743e23c01d37d935d6a526d94dbc415178ad6a301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100fb4f85ded34dfddedf619a032d1f455b06561fcc4e6422578bd37222833602b1022008c2cf2199e6406abcde6e53c76fe9f221bd2cfbd89c613f77d3b903f0fadfe7", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022040f04031f06158305cb23570f815684eda648cd9c631adf3533e72315d11892f022100e64ab06c1da4d959126bf1c7b816dfa495dc57451df41597699419b114ee45e5", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json index ea6f3cf8d2ada6..8716676bf8923e 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_15/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: valid, Matter OIDs are used and wrong values in the common-name are ignored", "is_success_case": "true", + "basic_info_pid": 177, "dac_cert": "30820207308201ada003020102020829533b15b435e877300a06082a8648ce3d0403023069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200048afa3ede5112dec9f6798199c8ffa0d1f03a0f2e3fb46536b4dac7d4992938da3d7d939a86a590942b20f92d916406f31359d1a7266f510603e5e325bbcfae98a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041488064d10fd091fd07a227335aa25992a856263f9301f0603551d23041830168014b5c1398fa5d54d71868582d94afcc2d4e1aa1cec300a06082a8648ce3d0403020348003045022100cabe598239debfc7a34cc2785c5c42c4a8ea9b0219f7cf79b19ad03e54387314022052ddc7703d3b622aab04f5cf7b2576ccedc41d76a326111a78c48d57329b350b", "pai_cert": "308201f83082019da00302010202081c4df132887a800d300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464632204d7069643a3030423231143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d0301070342000466415c7ed0c8d2c281192083b84a304d1bce565fd9b7ef9ef37e05f747d9a064555cb6a1ad22fed19d279cfeedb45c904e2e0d2caabd412eced85ea784824cd8a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414b5c1398fa5d54d71868582d94afcc2d4e1aa1cec301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020349003046022100c32bb6595944549a5e4eb08b44ead56b5accd1d26dfc0ed757ceae44f19aab6802210080cebaf169e855c6299b6f2bb3804f05ccf7d8135b06bf6c645456c7306ce73e", "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100cefdbc32a0201dc87435343bb0e7da622955af7b2379f8222210dcf30a70d720022100968c705242ce3b863d173977abaebc43e9d1df8b5e7f7293cf9e389dd142bb38", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json index 41c2a7aebf0395..5726cbdc564037 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_16/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: wrong, Correct values encoded in the common-name are ignored", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "30820207308201ada003020102020875315e809fb604f4300a06082a8648ce3d0403023069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004ba2d344def6691a3f38ce971437c2841868d078d7d163629baddef4d3601eae9229fe3752a8d0a664271b3e49340c55dbc20b35b9db780910d91170a3551d561a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e04160414e68ac3723efd401494ce4b30d286d45479620516301f0603551d2304183016801456d6e273ea24e5dfeb570b1ff9f44f549b6d364b300a06082a8648ce3d040302034800304502206a255bb249a4dfeefd42ec6e04adff59338efb40299e323b72237af30db7afb3022100d60e8288883ec9e97116ffb571f2295bceafaf97ccd8318557b65eb15c8b0ac6", "pai_cert": "308201f73082019da0030201020208139609613795a5ef300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a3069313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a3030423131143012060a2b0601040182a27c02010c044646463231143012060a2b0601040182a27c02020c04303042323059301306072a8648ce3d020106082a8648ce3d030107034200041c7be69a1432aac427700729d16b4116bbe9269849ee7123d1e88ea2ed55da8ddea715fa754bf657ba4628972ab6de59efa5f40c085e35fe8a82a5f8aba51448a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e0416041456d6e273ea24e5dfeb570b1ff9f44f549b6d364b301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202e5a430a4e0e13ca4b8bac28f8f2a02e23779def59c93a7ed8b3419c92c4e38e0221008c3e9653298e9bdc23128aeab143e8e24d0b95700052617020d9342f8fb3e543", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100bf3f12a780ed57f091c7954f4ead03785b333ce9c1b50c4591cf98bb338add83022043898fe00565598e0e2308aa67d232179d7c5e84a76ad08a99f52365dbb33bca", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json index d77bc898dd40b4..edef7e2ac3490c 100644 --- a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_17/test_case_vector.json @@ -1,6 +1,7 @@ { "description": "PAI Test Vector: Mix of Fallback and Matter OID encoding for VID and PID: invalid, PID is using Matter OID then VID must also use Matter OID", "is_success_case": "false", + "basic_info_pid": 177, "dac_cert": "308201c73082016ea003020102020853a06a36c4eab9bf300a06082a8648ce3d040302302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313020170d3232303932333030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200047b52109ce0e498f87b5effb42e7d69f0950ab8f2b1a25039436bd4dcc249b1f9240f291c43b7880078c25bef91e0428c988ce91c710f10a6cb112d2ad2bceac4a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604140ef4cee4b1073d60c236291562705ac3884ee03f301f0603551d23041830168014e37d6ed3c0603d3bf0ca20dc925ba48c44c7482d300a06082a8648ce3d04030203470030440220132e0b4da310c490a3f2c4b05d6b042a80d286bd7e740cb5f375fb68f0d9f7020220661a046b87a32229d7d78bc70d307956304805bbe8e0522c011e4420ca71911e", "pai_cert": "308201b73082015ea0030201020208603cb8419e67f161300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3232303932333030303030305a180f39393939313233313233353935395a302a3112301006035504030c094d7669643a4646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d030107034200049c722b78bb7967f39787fb4c50e2b3b225240742917959eb8c5302b7df678e52eb3cd49597e7996f62a15cb94089b2ad848447971196b2a7c10e0956795d607ea366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414e37d6ed3c0603d3bf0ca20dc925ba48c44c7482d301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034700304402203e2304d6633f0c7d79399ecc40af655a0b7006a550849e15114f24bd837bf15f022032c314c6226b8a7dc91d102b5fa862b555da33884adf80491b4156bdce6bfd0a", "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100c3d32a2be9bf2fb5b82199dde590e1af5304c05739de1556fa089a3cab58938c02204915813b12f18101383d9be2157ca725645da86c011c29506f8ac6412cad4d77", diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..e1b469faa5e1fb2b9dcb2d6e2efb5a4fa6fd5d40 GIT binary patch literal 235 zcmXqLe8I-4)#lOmotKfFX+h&HgU0JjjLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL9y)`$r$= z$i%?Z$Q;N6f+z`oOCT^bG6o`3OH<1z12;nn12KpN{7|z)Qj1FzTpXPZMGS=4xU|_A zSs0rZ)i5#guz*ZQ6J_FI0UB&*5NROH#twEi6C>39%#7^JP7EyHU&q)j=2)I7oqFcI zO7ouyDwRJLyF^$dtkrAVzI#=LpkMk`iR?V7TFbIiQ*Q3Hc-|c-)))CEw`!dl!%OQ4 zaUF{j4B`xUfKHSZW@P-&!eqc;zz5>-gLuF&Vs9{z1@ZY<#8^anuUt!SH|myN{K%!h z^Wu>SPY%ACU?2~YR%QWuv_T|1XIHg$&NLO4v&n^-C#9zC*FKPe9OBF#36fqX?&I8)eMzB!m2rBzgFwL|8artuBVQyQ+8*PG{8^Yi=5S bId;mF*}XXDi%}MiS?q0kt|kEKJCI(8@JkHs&Ff$n#7)lt3u`!3TF!S*H zCYF?>7Ab_J7MCalI64}N7znX(X|pl1Fg7i!VPfQAadUGsG*A%dH8L?UH8M8}tyyvEQZU@r%<8Qh3xh_&{R(ATeN=FtQoQg7|zaVk{!zIlHR0bEc`VoJ}swJSjD8 zzxII)19_0NG7B)|8bq@GDwWFz%D>q!<~TiF;LaVxg@tvHO%*wN#_FoD&QM7JaG{c- literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem new file mode 100644 index 00000000000000..c31efc8b053f4a --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIIE2lYAsHi5rIwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA1Mjcw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowPTE7MDkGA1UEAwwyQUNNRSBNYXR0ZXIg +RGV2ZWwgUEFJIDVDREE5ODk5IE12aWQ6RkZGMSBNcGlkOjAwMDEwWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAATDxm43+EAMinF+njGtuBO7vjnCMvkh+ErO9vxmON+g +/y0D/0kbcKud7DGhj/jvDWTQ7jHpmOHgxtWEzBb7dTdfo2YwZDASBgNVHRMBAf8E +CDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUV2y6eytsliQEzWNx +ackalr8rwGgwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYIKoZI +zj0EAwIDSAAwRQIhANt6a6UBwW3gPjypFnSu7s0IGhMCFpGeBtKyeMtggIe9AiB9 +jOAQqo78kEf8Zf4C7VwKcChkg7TO/yr1mKt6VolVGQ== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..e2f6a204faea2ff4be31da8a50e20ef8787ff560 GIT binary patch literal 121 zcmV-<0EYiCcLD(c1R%$%NWaNHYQrZ={KrN;dyix7{ymfPVQu2TyEY_R!M&gg1_&yK zNX|V20SBQ(13~}@lH_`0ov5(C#tmnBm~Y)r8Cz`*k;8+SEGO literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem new file mode 100644 index 00000000000000..2ced90401e4572 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIMeqSL/JP2rDJ0r8x0Y9e49j7f49k/NhbeLAuzYkWsG9oAoGCCqGSM49 +AwEHoUQDQgAEw8ZuN/hADIpxfp4xrbgTu745wjL5IfhKzvb8ZjjfoP8tA/9JG3Cr +newxoY/47w1k0O4x6Zjh4MbVhMwW+3U3Xw== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json new file mode 100644 index 00000000000000..a935f55d85df7d --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_18/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: valid and PID numeric only", + "is_success_case": "true", + "basic_info_pid": 1, + "dac_cert": "308201db30820181a003020102020843650dd556554085300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303030313020170d3234303532373030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303030313059301306072a8648ce3d020106082a8648ce3d03010703420004f7eb5c3ea308a7691b65ccef2483fc902479f8a344583860ad2e86b7bbaa78114e67d5186b6e1a7d3976ca94d9bd38e78b51168e59ec6d7aae2600e93b905e88a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e041604148dd4d66787328b1ba3e2448f89d1c490e4c1ea90301f0603551d23041830168014576cba7b2b6c962404cd637169c91a96bf2bc068300a06082a8648ce3d0403020348003045022016b9473083a3c99f544e66d31556ba8cfd6d177142190dd5abd852b5cfd33d0a022100a10bd9bfe47cbc409c9f9322491ee65132c540c8bdedc26236bf47f64319a610", + "pai_cert": "308201cb30820171a003020102020813695802c1e2e6b2300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303532373030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a303030313059301306072a8648ce3d020106082a8648ce3d03010703420004c3c66e37f8400c8a717e9e31adb813bbbe39c232f921f84acef6fc6638dfa0ff2d03ff491b70ab9dec31a18ff8ef0d64d0ee31e998e1e0c6d584cc16fb75375fa366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e04160414576cba7b2b6c962404cd637169c91a96bf2bc068301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d0403020348003045022100db7a6ba501c16de03e3ca91674aeeecd081a130216919e06d2b278cb608087bd02207d8ce010aa8efc9047fc65fe02ed5c0a70286483b4ceff2af598ab7a56895519", + "certification_declaration": "3081e806092a864886f70d010702a081da3081d7020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff3602040118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317d307b020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204473045022100f3240528a1ce8a0154892dae718c47ba1d2db84a9f2e941bc0efffba46f7333402204ac1df237392e052e5d5ff5644852fad8949cd62721cae2e852c0a1c314cb0c2", + "dac_private_key": "ec810973fb09d207496509d81a14aff5da33278f12e35d085e1769565facc1b6", + "dac_public_key": "04f7eb5c3ea308a7691b65ccef2483fc902479f8a344583860ad2e86b7bbaa78114e67d5186b6e1a7d3976ca94d9bd38e78b51168e59ec6d7aae2600e93b905e88" +} diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/cd.der new file mode 100644 index 0000000000000000000000000000000000000000..7c52ac3e97aa07fd6fd84634284f81c61e3b4f03 GIT binary patch literal 236 zcmXqLe96YC)#lOmotKfFX+h&{gT@<7jLe3-2Hb3%32h#Xsmv@)j0P?UMT`r~SxiM$ z7#LL273TXkr-UWNd6;U|^_gWTL{#pu)zW%3d}@g@ZxD zu+E?cXm*20(yu1t$Th!KPP3EwCBk+0E6eA?1XTOD*f@ZWI%mtm%*5hh;KroLuyI?b zk+<)|NgWgBAGj@Yn$;;mcKxGn&EAbyXTRUO=1UY%$>ez=4F(pbadR|Z-}U$^^>b3N TgNnoN$`dbJZ*85lKxHEUVbx2? literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/dac-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..d72cdf58c690c627e5faa7ea2bb4acdf08aafb16 GIT binary patch literal 479 zcmXqLV!Un8#MroinTe5!i9_W7w+VHnKMf7I*f_M>JkHs&Ff$q08d@7zvN4CUF!LBW zI{UgR_$HQ=q!uZ-q?V=TCCM$lFOam z)gl|d>hbTDY+G~k74JItBT`(?Ed<4Oe7q)caD}y(b7cPNiOK@pGqjyITv%eTdV{cm z1$W2d1cNvO9-tFtg&7(DvoIMj81R93{2(4MjMy6tWI=pB7BLnPh1Um4Zk4Fn?Wt!` z@5$&f{n5G6!$2M+t;_=SXoJYCFP5GIZq#!TM zn~PnUk=uU!yT_-x*t2N&LyEEQv6Qe=3(`1aJVx!Lm;8Ql?A%KCQK Va3)*jQL||7ov|m3?L4 bJ4!=YZ>y0b5DS~{jYF%=H#av!0|jwjBNGEN0}}%_8?)s7sj{*_oXfSein6%*Ct?A`71LoELf9HTS*v(hWYb z&Pu+)d+!^cnZ+o`()_AI>pQQ~j-&Et*S|_ymhgOT%CcFD0_qGxtfeY47N;4c0R6-q zDl5#$_@9NtfDK47F)|qNfyDShV!$wAWHXQj@%dQ9SVU%hvGmmGyO;FsZL84EKdG9! zpASzokOxUCvj9V`K_u(1Qn`Gf{G0t^j?>cx?%Xk4SXhS~!pt5F2ChsBdef8&uAP|w z=w;qrx8E-=EDE@~F5tbhJ(KK*`%{umDkd{2GIWO6n7Eo;^Hn%#cA>{;&MxD7&CZPK PSGSw@PC4~-eZ^G(Bbkl> literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem new file mode 100644 index 00000000000000..9cf14e01b2a1b0 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIByzCCAXGgAwIBAgIIOWRFZRdrJTQwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yNDA2MDQw +MDAwMDBaGA85OTk5MTIzMTIzNTk1OVowPTE7MDkGA1UEAwwyQUNNRSBNYXR0ZXIg +RGV2ZWwgUEFJIDVDREE5ODk5IE12aWQ6RkZGMSBNcGlkOlhZWjEwWTATBgcqhkjO +PQIBBggqhkjOPQMBBwNCAASCVYw3FjswWXDnDM8U7Yqd7xelsExdQyJNU73fM8ya +AREEg+p4KvcNIrjFH82v6mKmYOedZKaaolB+MFQ7Gnhoo2YwZDASBgNVHRMBAf8E +CDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmvQ5SSyO3mL27YUS +ufxlKS3zw5EwHwYDVR0jBBgwFoAUav0idx9RH+y/FkGXZxDc3DGhcX4wCgYIKoZI +zj0EAwIDSAAwRQIgLpYicNbIn+Lpbt1G++jQolDVrlDvQz8CHfDflGLJIWMCIQCJ +VDw0RTTWTSDBNtCMMpy6M96DQwEn1bc3jZTK5a941Q== +-----END CERTIFICATE----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.der new file mode 100644 index 0000000000000000000000000000000000000000..91cd0c7c6196f02404dc7d2f75188b501dcfb82d GIT binary patch literal 121 zcmV-<0EYiCcLD(c1Rwy@Ai1_&yK zNX|V20SBQ(13~}n$+7CSImaOVuq6zz(g?-!-8OkG1FO;f$!Gt8O+5d?$kcq;b| bBDlpL&9CZWreNotWTu*;P<}8}I~sUs<$W;T literal 0 HcmV?d00001 diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem new file mode 100644 index 00000000000000..652b95059d958f --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/pai-Key.pem @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIAT0pLawB2gz1l/XLScbWT8+aPTnGbkQTGOyzoeGMuuVoAoGCCqGSM49 +AwEHoUQDQgAEglWMNxY7MFlw5wzPFO2Kne8XpbBMXUMiTVO93zPMmgERBIPqeCr3 +DSK4xR/Nr+pipmDnnWSmmqJQfjBUOxp4aA== +-----END EC PRIVATE KEY----- diff --git a/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json new file mode 100644 index 00000000000000..9dec5504865db1 --- /dev/null +++ b/credentials/development/commissioner_dut/struct_pai_vidpid_fallback_encoding_19/test_case_vector.json @@ -0,0 +1,10 @@ +{ + "description": "PAI Test Vector: Fallback VID and PID encoding example from spec: PID is not a number", + "is_success_case": "false", + "basic_info_pid": 177, + "dac_cert": "308201db30820181a003020102020814fff6907e75f931300a06082a8648ce3d040302303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a58595a313020170d3234303630343030303030305a180f39393939313233313233353935395a30463118301606035504030c0f4d617474657220546573742044414331143012060a2b0601040182a27c02010c044646463131143012060a2b0601040182a27c02020c04303042313059301306072a8648ce3d020106082a8648ce3d03010703420004a01980a18949212c6244dc8dab14b0f52e0fbd1986acc9ea0dae47c41a0ae7381116b8f1d618c1a83b4a43596fab9123100b982b43b0d0a430abb01330380b88a360305e300c0603551d130101ff04023000300e0603551d0f0101ff040403020780301d0603551d0e0416041420ebc074da74263ebc7f04278c688c35f889b148301f0603551d230418301680149af439492c8ede62f6ed8512b9fc65292df3c391300a06082a8648ce3d040302034800304502201f130d6914f3a61a5d171dedfa51e5a5f10f7da05a71e69edce0d0ec74a51604022100e7a3db95f56d6b9ea232dc17226af6dd31990679c5365b0bb95dc833de2373b4", + "pai_cert": "308201cb30820171a003020102020839644565176b2534300a06082a8648ce3d04030230303118301606035504030c0f4d617474657220546573742050414131143012060a2b0601040182a27c02010c04464646313020170d3234303630343030303030305a180f39393939313233313233353935395a303d313b303906035504030c3241434d45204d617474657220446576656c20504149203543444139383939204d7669643a46464631204d7069643a58595a313059301306072a8648ce3d020106082a8648ce3d0301070342000482558c37163b305970e70ccf14ed8a9def17a5b04c5d43224d53bddf33cc9a01110483ea782af70d22b8c51fcdafea62a660e79d64a69aa2507e30543b1a7868a366306430120603551d130101ff040830060101ff020100300e0603551d0f0101ff040403020106301d0603551d0e041604149af439492c8ede62f6ed8512b9fc65292df3c391301f0603551d230418301680146afd22771f511fecbf1641976710dcdc31a1717e300a06082a8648ce3d040302034800304502202e962270d6c89fe2e96edd46fbe8d0a250d5ae50ef433f021df0df9462c9216302210089543c344534d64d20c136d08c329cba33de83430127d5b7378d94cae5af78d5", + "certification_declaration": "3081e906092a864886f70d010702a081db3081d8020103310d300b0609608648016503040201304406092a864886f70d010701a0370435152400012501f1ff360204b118250334122c04135a494732303134315a423333303030312d32342405002406002507769824080018317e307c020103801462fa823359acfaa9963e1cfa140addf504f37160300b0609608648016503040201300a06082a8648ce3d04030204483046022100b1b689324b4de19288909fc0db14cb0542601dafe28b298db1d59befbdacf45a022100939e14803038355e9c29ebdd48f51af99253402440fb79c8e985dab592a024b1", + "dac_private_key": "6ccf019fff6efe049efb74f8c0cc2fa2c5d01e0ae28f3b4930fb245f88773a6f", + "dac_public_key": "04a01980a18949212c6244dc8dab14b0f52e0fbd1986acc9ea0dae47c41a0ae7381116b8f1d618c1a83b4a43596fab9123100b982b43b0d0a430abb01330380b88" +} diff --git a/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp b/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp index 366dd5752c2fb1..1eddfbb8282b92 100644 --- a/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp +++ b/src/app/tests/suites/credentials/TestHarnessDACProvider.cpp @@ -177,6 +177,11 @@ bool ReadValue(Json::Value jsonValue) return false; } +uint16_t ReadUint16(Json::Value jsonValue) +{ + return static_cast(jsonValue.asUInt()); +} + // TODO: This should be moved to a method of P256Keypair CHIP_ERROR LoadKeypairFromRaw(ByteSpan private_key, ByteSpan public_key, Crypto::P256Keypair & keypair) { @@ -205,6 +210,7 @@ void TestHarnessDACProvider::Init(const char * filepath) static constexpr char kFirmwareInfoKey[] = "firmware_information"; static constexpr char kIsSuccessKey[] = "is_success_case"; static constexpr char kDescription[] = "description"; + static constexpr char kPid[] = "basic_info_pid"; std::ifstream json(filepath, std::ifstream::binary); if (!json) @@ -272,6 +278,11 @@ void TestHarnessDACProvider::Init(const char * filepath) data.description.SetValue(ReadValue(root[kDescription], buf, sizeof(buf))); } + if (root.isMember(kPid)) + { + data.pid.SetValue(ReadUint16(root[kPid])); + } + Init(data); } @@ -288,6 +299,8 @@ void TestHarnessDACProvider::Init(const TestHarnessDACProviderData & data) // TODO: We need a real example FirmwareInformation to be populated. mFirmwareInformation = data.firmwareInformation.HasValue() ? data.firmwareInformation.Value() : ByteSpan(); + + mPid = data.pid.ValueOr(0x8000); } CHIP_ERROR TestHarnessDACProvider::GetDeviceAttestationCert(MutableByteSpan & out_dac_buffer) diff --git a/src/app/tests/suites/credentials/TestHarnessDACProvider.h b/src/app/tests/suites/credentials/TestHarnessDACProvider.h index 5904aa52e98cb0..91b848791f2fbe 100644 --- a/src/app/tests/suites/credentials/TestHarnessDACProvider.h +++ b/src/app/tests/suites/credentials/TestHarnessDACProvider.h @@ -33,6 +33,7 @@ struct TestHarnessDACProviderData chip::Optional firmwareInformation; chip::Optional description; chip::Optional isSuccessCase; + chip::Optional pid; }; class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider @@ -47,6 +48,7 @@ class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & message_to_sign, MutableByteSpan & out_signature_buffer) override; CharSpan GetDescription() { return mDescription; } bool IsSuccessCase() { return mIsSuccessCase; } + uint16_t GetPid() { return mPid; } void Init(const char * filepath); void Init(const TestHarnessDACProviderData & data); @@ -60,6 +62,7 @@ class TestHarnessDACProvider : public DeviceAttestationCredentialsProvider ByteSpan mFirmwareInformation; CharSpan mDescription; bool mIsSuccessCase; + uint16_t mPid; }; } // namespace Examples diff --git a/src/credentials/tests/TestCommissionerDUTVectors.cpp b/src/credentials/tests/TestCommissionerDUTVectors.cpp index 55beafdc044313..c512776cc89a69 100644 --- a/src/credentials/tests/TestCommissionerDUTVectors.cpp +++ b/src/credentials/tests/TestCommissionerDUTVectors.cpp @@ -108,7 +108,7 @@ TEST_F(TestCommissionerDUTVectors, TestCommissionerDUTVectors) Crypto::DRBG_get_bytes(attestationNonceBuf, sizeof(attestationNonceBuf)); VendorId vid = TestVendor1; - uint16_t pid = strstr(entry->d_name, "_vidpid_fallback_encoding_") ? 0x00B1 : 0x8000; + uint16_t pid = dacProvider.GetPid(); EXPECT_EQ(dacProvider.GetCertificationDeclaration(certDeclSpan), CHIP_NO_ERROR); EXPECT_EQ(dacProvider.GetDeviceAttestationCert(dacCertSpan), CHIP_NO_ERROR); diff --git a/src/python_testing/TC_DA_1_2.py b/src/python_testing/TC_DA_1_2.py index 100f5813778966..759fa3eae3e2a7 100644 --- a/src/python_testing/TC_DA_1_2.py +++ b/src/python_testing/TC_DA_1_2.py @@ -17,6 +17,7 @@ import os import random +import re import chip.clusters as Clusters from chip.interaction_model import InteractionModelError, Status @@ -56,7 +57,7 @@ def parse_single_vidpid_from_common_name(commonName: str, tag_str: str) -> str: return None s = sp[1][:4] - if not s.isupper() or len(s) != 4: + if re.match("[0-9A-F]{4}", s) is None: asserts.fail(f"Improperly encoded PID or VID when using fallback encoding {tag_str}:{s}") return None diff --git a/src/python_testing/test_testing/test_TC_DA_1_2.py b/src/python_testing/test_testing/test_TC_DA_1_2.py index 99acdea072694a..296508ba2fa287 100755 --- a/src/python_testing/test_testing/test_TC_DA_1_2.py +++ b/src/python_testing/test_testing/test_TC_DA_1_2.py @@ -71,7 +71,7 @@ def main(): cert_path, "struct_cd_authorized_paa_list_count1_valid/test_case_vector.json")) run_single_test(path, 32768, factory_reset=True) - test_cases = {'struct_cd': 32768, 'fallback_encoding': 177} + test_cases = ['struct_cd', 'fallback_encoding'] # struct_cd_version_number_wrong - excluded because this is a DCL test not covered by cert # struct_cd_cert_id_mismatch - excluded because this is a DCL test not covered by cert @@ -80,7 +80,7 @@ def main(): passes = [] for p in os.listdir(cert_path): - matches = list(filter(lambda t: t in str(p), test_cases.keys())) + matches = list(filter(lambda t: t in str(p), test_cases)) if len(matches) != 1: continue @@ -91,8 +91,9 @@ def main(): with open(path, 'r') as f: j = json.loads(f.read()) success_expected = j['is_success_case'].lower() == 'true' + pid = j['basic_info_pid'] - ret = run_single_test(path, test_cases[matches[0]]) + ret = run_single_test(path, pid) passes.append((str(p), ret, success_expected)) retval = 0 diff --git a/src/tools/chip-cert/gen_com_dut_test_vectors.py b/src/tools/chip-cert/gen_com_dut_test_vectors.py index 599021b4b5ae14..702868c691be02 100755 --- a/src/tools/chip-cert/gen_com_dut_test_vectors.py +++ b/src/tools/chip-cert/gen_com_dut_test_vectors.py @@ -336,6 +336,21 @@ class CertType(Enum): "test_folder": 'vidpid_fallback_encoding_17', "is_success_case": 'false', }, + # Numeric only + { + "description": 'Fallback VID and PID encoding example from spec: valid and PID numeric only', + "common_name": 'ACME Matter Devel DAC 5CDA9899 Mvid:FFF1 Mpid:0001', + "test_folder": 'vidpid_fallback_encoding_18', + "is_success_case": 'true', + "fallback_pid": 0x0001 + }, + # Not a number at all + { + "description": 'Fallback VID and PID encoding example from spec: PID is not a number', + "common_name": 'ACME Matter Devel DAC 5CDA9899 Mvid:FFF1 Mpid:XYZ1', + "test_folder": 'vidpid_fallback_encoding_19', + "is_success_case": 'false', + }, ] CD_STRUCT_TEST_CASES = [ @@ -770,7 +785,7 @@ def add_files_to_json_config(files_mapping: dict, json_dict: dict): json_dict[output_key_name] = hexlify(file_bytes).decode('utf-8') -def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_case): +def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_case, basic_info_pid: int): json_dict = {} files_in_path = glob.glob(os.path.join(test_case_out_dir, "*")) output_json_filename = test_case_out_dir + "/test_case_vector.json" @@ -788,14 +803,13 @@ def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_ if "is_success_case" in test_case: # These test cases are expected to fail when error injected in DAC but expected to pass when error injected in PAI if (test_cert == 'pai') and (test_case["test_folder"] in ['ext_basic_pathlen0', - 'vidpid_fallback_encoding_08', - 'vidpid_fallback_encoding_09', 'ext_key_usage_dig_sig_wrong' ]): json_dict["is_success_case"] = "true" else: json_dict["is_success_case"] = test_case["is_success_case"] + json_dict['basic_info_pid'] = basic_info_pid # Out of all files we could add, find the ones that were present in test case, and embed them in hex files_available = {os.path.basename(path) for path in files_in_path} files_to_add = {key: os.path.join(test_case_out_dir, filename) @@ -809,7 +823,8 @@ def generate_test_case_vector_json(test_case_out_dir: str, test_cert: str, test_ add_raw_ec_keypair_to_dict_from_der(der_key_filename, json_dict) with open(output_json_filename, "wt+") as outfile: - json.dump(json_dict, outfile, indent=2) + json.dump(json_dict, outfile, indent=4) + outfile.write('\n') def main(): @@ -900,11 +915,13 @@ def main(): subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, test_cert, test_case) + generate_test_case_vector_json(test_case_out_dir, test_cert, test_case, basic_info_pid=0x8000) for test_cert in ['dac', 'pai']: for test_case in VIDPID_FALLBACK_ENCODING_TEST_CASES: test_case_out_dir = args.outdir + '/struct_' + test_cert + '_' + test_case["test_folder"] + fallback_vid = test_case.get('fallback_vid', 0x0FFF1) + fallback_pid = test_case.get('fallback_pid', 0x00B1) if test_cert == 'dac': common_name_dac = test_case["common_name"] common_name_pai = '' @@ -916,14 +933,14 @@ def main(): pid_dac = test_case["pid"] else: pid_dac = PID_NOT_PRESENT - vid_pai = 0xFFF1 - pid_pai = 0x00B1 + vid_pai = fallback_vid + pid_pai = fallback_pid else: common_name_dac = '' common_name_pai = test_case["common_name"] common_name_pai = common_name_pai.replace('DAC', 'PAI') - vid_dac = 0xFFF1 - pid_dac = 0x00B1 + vid_dac = fallback_vid + pid_dac = fallback_pid if "vid" in test_case: vid_pai = test_case["vid"] else: @@ -944,12 +961,11 @@ def main(): builder.make_certs_and_keys() # Generate Certification Declaration (CD) - cmd = chipcert + ' gen-cd -K ' + cd_key + ' -C ' + cd_cert + ' -O ' + test_case_out_dir + '/cd.der' + \ - ' -f 1 -V 0xFFF1 -p 0x00B1 -d 0x1234 -c "ZIG20141ZB330001-24" -l 0 -i 0 -n 9876 -t 0' + cmd = f'{chipcert} gen-cd -K {cd_key} -C {cd_cert} -O {test_case_out_dir}/cd.der -f 1 -V 0x{fallback_vid:04X} -p 0x{fallback_pid:04X} -d 0x1234 -c "ZIG20141ZB330001-24" -l 0 -i 0 -n 9876 -t 0' subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, test_cert, test_case) + generate_test_case_vector_json(test_case_out_dir, test_cert, test_case, basic_info_pid=fallback_pid) for test_case in CD_STRUCT_TEST_CASES: test_case_out_dir = args.outdir + '/struct_cd_' + test_case["test_folder"] @@ -1008,7 +1024,7 @@ def main(): subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, 'cd', test_case) + generate_test_case_vector_json(test_case_out_dir, 'cd', test_case, basic_info_pid=0x8000) # Test case: Generate {DAC, PAI, PAA} chain with random (invalid) PAA test_case = { @@ -1049,7 +1065,7 @@ def main(): subprocess.run(cmd, shell=True) # Generate Test Case Data Container in JSON Format - generate_test_case_vector_json(test_case_out_dir, 'paa', test_case) + generate_test_case_vector_json(test_case_out_dir, 'paa', test_case, basic_info_pid=0x8000) if __name__ == '__main__': From e1b5fbe283ad3879033e3bb2067004b6dfd45845 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 10 Jun 2024 17:57:31 -0400 Subject: [PATCH 56/78] Update ZAP to fix codegen for nullable attributes. (#33834) Fixes https://github.com/project-chip/connectedhomeip/issues/33413 MIN_ZAP_VERSION is set differently from the tag being used, because the actual changeset tagged with that tag is from 2024-06-06, not 2024-06-10. --- scripts/setup/zap.json | 4 ++-- scripts/setup/zap.version | 2 +- scripts/tools/zap/zap_execution.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index 4e7da8f6d30a7c..c3e65c8bab9752 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2024.04.15-nightly.1"] + "tags": ["version:2@v2024.06.10-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2024.04.15-nightly.1"] + "tags": ["version:2@v2024.06.10-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index cdc8952361f654..8b3c20afc891f6 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2024.04.15-nightly +v2024.06.10-nightly diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index 3256ba069c2790..80def9602dce77 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2024.4.15' +MIN_ZAP_VERSION = '2024.6.6' class ZapTool: From 47097e023a960f2cf5cb2d4dc4f00a2a9c02727f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Mon, 10 Jun 2024 18:59:02 -0400 Subject: [PATCH 57/78] cluster model decoupling - declare the codegen (ember) version and implement iteration (#33345) * Initial copy with a clean history * make linter happy * Restyle * Fix typo * Add nolint: assert will return before we use the underlying value * 2 more fixes regarding unchecked access * Switch some asserts to expects, for better test logic * Model renames * Add renamed files * Add some attribute iteration hint * Make use of the attribute cache * Restyle * Add a cluster iteration hint * Add a few more hints. Ember code still contains loops though, so this may not be ideal still * Add some TODO items for using faster iterations for data. Ember index vs value duality still needs some work * Add a cluster type cache as well. This relies on ember being reasonably static * Add global attribute handling * Fix typing u16 vs unsigned * Fix auto-added include names * Remove back the initialization and make the comment more obvious * Update src/app/codegen-interaction-model/model.gni Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> * Code review feedback: added comments * Update src/app/codegen-interaction-model/CodegenDataModel.h Co-authored-by: Boris Zbarsky * Update src/app/codegen-interaction-model/CodegenDataModel.cpp Co-authored-by: Boris Zbarsky * Update src/app/codegen-interaction-model/BUILD.gn Co-authored-by: Tennessee Carmel-Veilleux * Some cleanup logic for event generation - naming and return values as eventid is not the same as event number * Comment fix * More naming updates * Several comment updates and renamed RequestContext to ActionContext * Restyle * Rename to InteractionModelContext * one more rename * Fix typo * Fix tests to compile * More renames of actions to context * One more comment added * Restyle * Address review comments * Restyle * make clang-tidy happy * Operator== exists on optional ... make use of that directly * Started renaming things * Use the right types in Model.h * Make things compile * Skip global attribute handling, add TODOs for reading extra bits from ember * Typo fix * Several flags and correct loading of privileges for attributes * Start implementing command iteration ... still feels awkward and caching will be a pain * We seem to also support fabric scoping detection * implementation is in theory done, need unit tests * Fix iterator name * Mock support for accepted/generated commands, start having unit tests * Better iteration tests on accepted commands * More unit tests and fix bugs * Restyle * More tests, one iteration bug fix * Slight update again * Aiming for more test coverage * More test coverage for edge cases in iteration * Fix code review comment * Restyle * Update src/app/interaction-model/Events.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/IterationTypes.h Co-authored-by: Boris Zbarsky * Update src/app/interaction-model/Paths.h Co-authored-by: Boris Zbarsky * Fix comment about validity * Some kListBegin/End comment updates * Drop kListBegin/End alltogether * Drop groupId * Comment update * Update for data version to be mandatory, add more error reporting and logging * Update to use kInvalid instead of Invalid method * Update flags.set * Use IsServerMask on clusterr class * Use a struct instead of a typedef * Fix compile without error logging * Restyle * Remove command quality that is not supported * Restyle * Rename IsServerMask to IsServer --------- Co-authored-by: Andrei Litvin Co-authored-by: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Co-authored-by: Boris Zbarsky Co-authored-by: Tennessee Carmel-Veilleux --- src/BUILD.gn | 1 + src/app/ConcreteClusterPath.h | 2 +- src/app/codegen-interaction-model/BUILD.gn | 27 + .../CodegenDataModel.cpp | 548 ++++++++++++++++++ .../CodegenDataModel.h | 132 +++++ src/app/codegen-interaction-model/model.gni | 35 ++ .../codegen-interaction-model/tests/BUILD.gn | 35 ++ .../tests/TestCodegenModelViaMocks.cpp | 488 ++++++++++++++++ src/app/interaction-model/BUILD.gn | 3 +- src/app/interaction-model/IterationTypes.h | 99 ---- src/app/interaction-model/MetadataTypes.cpp | 35 ++ src/app/interaction-model/MetadataTypes.h | 155 +++++ src/app/interaction-model/Model.h | 9 +- src/app/interaction-model/OperationTypes.h | 1 - src/app/interaction-model/tests/BUILD.gn | 2 + src/app/util/af-types.h | 7 +- src/app/util/mock/MockNodeConfig.cpp | 30 +- src/app/util/mock/MockNodeConfig.h | 5 +- 18 files changed, 1499 insertions(+), 115 deletions(-) create mode 100644 src/app/codegen-interaction-model/BUILD.gn create mode 100644 src/app/codegen-interaction-model/CodegenDataModel.cpp create mode 100644 src/app/codegen-interaction-model/CodegenDataModel.h create mode 100644 src/app/codegen-interaction-model/model.gni create mode 100644 src/app/codegen-interaction-model/tests/BUILD.gn create mode 100644 src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp delete mode 100644 src/app/interaction-model/IterationTypes.h create mode 100644 src/app/interaction-model/MetadataTypes.cpp create mode 100644 src/app/interaction-model/MetadataTypes.h diff --git a/src/BUILD.gn b/src/BUILD.gn index d455a596b4e346..0c7597b11d94db 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -55,6 +55,7 @@ if (chip_build_tests) { chip_test_group("tests") { deps = [] tests = [ + "${chip_root}/src/app/codegen-interaction-model/tests", "${chip_root}/src/app/interaction-model/tests", "${chip_root}/src/access/tests", "${chip_root}/src/crypto/tests", diff --git a/src/app/ConcreteClusterPath.h b/src/app/ConcreteClusterPath.h index 58b2f5b477f139..8b701efa83967b 100644 --- a/src/app/ConcreteClusterPath.h +++ b/src/app/ConcreteClusterPath.h @@ -52,7 +52,7 @@ struct ConcreteClusterPath // to alignment requirements it's "free" in the sense of not needing more // memory to put it here. But we don't initialize it, because that // increases codesize for the non-consumers. - bool mExpanded; // NOTE: in between larger members + bool mExpanded; // NOTE: in between larger members, NOT initialized (see above) ClusterId mClusterId = 0; }; diff --git a/src/app/codegen-interaction-model/BUILD.gn b/src/app/codegen-interaction-model/BUILD.gn new file mode 100644 index 00000000000000..418983a2fc8b8f --- /dev/null +++ b/src/app/codegen-interaction-model/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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("//build_overrides/chip.gni") +# This source set is TIGHLY coupled with code-generated data models +# as generally implemented by `src/app/util` +# +# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must +# be available at link time for this model to use +# +# Use `model.gni` to get access to: +# CodegenDataModel.cpp +# CodegenDataModel.h +# +# The above list of files exists to satisfy the "dependency linter" +# since those files should technically be "visible to gn" even though we +# are supposed to go through model.gni constants diff --git a/src/app/codegen-interaction-model/CodegenDataModel.cpp b/src/app/codegen-interaction-model/CodegenDataModel.cpp new file mode 100644 index 00000000000000..f917a8e9c9c4b0 --- /dev/null +++ b/src/app/codegen-interaction-model/CodegenDataModel.cpp @@ -0,0 +1,548 @@ +/* + * Copyright (c) 2024 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. + */ +#include + +#include +#include +#include +#include +#include + +#include +#include + +namespace chip { +namespace app { +namespace { + +/// Load the cluster information into the specified destination +std::variant LoadClusterInfo(const ConcreteClusterPath & path, + const EmberAfCluster & cluster) +{ + DataVersion * versionPtr = emberAfDataVersionStorage(path); + if (versionPtr == nullptr) + { + ChipLogError(AppServer, "Failed to get data version for %d/" ChipLogFormatMEI, static_cast(path.mEndpointId), + ChipLogValueMEI(cluster.clusterId)); + return CHIP_ERROR_NOT_FOUND; + } + + InteractionModel::ClusterInfo info(*versionPtr); + + // TODO: set entry flags: + // info->flags.Set(ClusterQualityFlags::kDiagnosticsData) + + return info; +} + +/// Converts a EmberAfCluster into a ClusterEntry +std::variant ClusterEntryFrom(EndpointId endpointId, const EmberAfCluster & cluster) +{ + ConcreteClusterPath clusterPath(endpointId, cluster.clusterId); + auto info = LoadClusterInfo(clusterPath, cluster); + + if (CHIP_ERROR * err = std::get_if(&info)) + { + return *err; + } + + if (InteractionModel::ClusterInfo * infoValue = std::get_if(&info)) + { + return InteractionModel::ClusterEntry{ + .path = clusterPath, + .info = *infoValue, + }; + } + return CHIP_ERROR_INCORRECT_STATE; +} + +/// Finds the first server cluster entry for the given endpoint data starting at [start_index] +/// +/// Returns an invalid entry if no more server clusters are found +InteractionModel::ClusterEntry FirstServerClusterEntry(EndpointId endpointId, const EmberAfEndpointType * endpoint, + unsigned start_index, unsigned & found_index) +{ + for (unsigned cluster_idx = start_index; cluster_idx < endpoint->clusterCount; cluster_idx++) + { + const EmberAfCluster & cluster = endpoint->cluster[cluster_idx]; + if (!cluster.IsServer()) + { + continue; + } + + found_index = cluster_idx; + auto entry = ClusterEntryFrom(endpointId, cluster); + + if (InteractionModel::ClusterEntry * entryValue = std::get_if(&entry)) + { + return *entryValue; + } + +#if CHIP_ERROR_LOGGING + if (CHIP_ERROR * errValue = std::get_if(&entry)) + { + ChipLogError(AppServer, "Failed to load cluster entry: %" CHIP_ERROR_FORMAT, errValue->Format()); + } + else + { + // Should NOT be possible: entryFrom has only 2 variants + ChipLogError(AppServer, "Failed to load cluster entry, UNKNOWN entry return type"); + } +#endif + } + + return InteractionModel::ClusterEntry::kInvalid; +} + +/// Load the attribute information into the specified destination +/// +/// `info` is assumed to be default-constructed/clear (i.e. this sets flags, but does not reset them). +void LoadAttributeInfo(const ConcreteAttributePath & path, const EmberAfAttributeMetadata & attribute, + InteractionModel::AttributeInfo * info) +{ + info->readPrivilege = RequiredPrivilege::ForReadAttribute(path); + if (attribute.IsReadOnly()) + { + info->writePrivilege = RequiredPrivilege::ForWriteAttribute(path); + } + + info->flags.Set(InteractionModel::AttributeQualityFlags::kListAttribute, (attribute.attributeType == ZCL_ARRAY_ATTRIBUTE_TYPE)); + info->flags.Set(InteractionModel::AttributeQualityFlags::kTimed, attribute.MustUseTimedWrite()); + + // NOTE: we do NOT provide additional info for: + // - IsExternal/IsSingleton/IsAutomaticallyPersisted is not used by IM handling + // - IsSingleton spec defines it for CLUSTERS where as we have it for ATTRIBUTES + // - Several specification flags are not available (reportable, quieter reporting, + // fixed, source attribution) + + // TODO: Set additional flags: + // info->flags.Set(InteractionModel::AttributeQualityFlags::kFabricScoped) + // info->flags.Set(InteractionModel::AttributeQualityFlags::kFabricSensitive) + // info->flags.Set(InteractionModel::AttributeQualityFlags::kChangesOmitted) +} + +InteractionModel::AttributeEntry AttributeEntryFrom(const ConcreteClusterPath & clusterPath, + const EmberAfAttributeMetadata & attribute) +{ + InteractionModel::AttributeEntry entry; + + entry.path = ConcreteAttributePath(clusterPath.mEndpointId, clusterPath.mClusterId, attribute.attributeId); + LoadAttributeInfo(entry.path, attribute, &entry.info); + + return entry; +} + +InteractionModel::CommandEntry CommandEntryFrom(const ConcreteClusterPath & clusterPath, CommandId clusterCommandId) +{ + InteractionModel::CommandEntry entry; + entry.path = ConcreteCommandPath(clusterPath.mEndpointId, clusterPath.mClusterId, clusterCommandId); + entry.info.invokePrivilege = RequiredPrivilege::ForInvokeCommand(entry.path); + + entry.info.flags.Set(InteractionModel::CommandQualityFlags::kTimed, + CommandNeedsTimedInvoke(clusterPath.mClusterId, clusterCommandId)); + + entry.info.flags.Set(InteractionModel::CommandQualityFlags::kFabricScoped, + CommandIsFabricScoped(clusterPath.mClusterId, clusterCommandId)); + + return entry; +} + +const ConcreteCommandPath kInvalidCommandPath(kInvalidEndpointId, kInvalidClusterId, kInvalidCommandId); + +} // namespace + +std::optional CodegenDataModel::EmberCommandListIterator::First(const CommandId * list) +{ + VerifyOrReturnValue(list != nullptr, std::nullopt); + mCurrentList = mCurrentHint = list; + + VerifyOrReturnValue(*mCurrentList != kInvalidCommandId, std::nullopt); + return *mCurrentList; +} + +std::optional CodegenDataModel::EmberCommandListIterator::Next(const CommandId * list, CommandId previousId) +{ + VerifyOrReturnValue(list != nullptr, std::nullopt); + VerifyOrReturnValue(previousId != kInvalidCommandId, std::nullopt); + + if (mCurrentList != list) + { + // invalidate the hint if switching lists... + mCurrentHint = nullptr; + mCurrentList = list; + } + + if ((mCurrentHint == nullptr) || (*mCurrentHint != previousId)) + { + // we did not find a usable hint. Search from the to set the hint + mCurrentHint = mCurrentList; + while ((*mCurrentHint != kInvalidCommandId) && (*mCurrentHint != previousId)) + { + mCurrentHint++; + } + } + + VerifyOrReturnValue(*mCurrentHint == previousId, std::nullopt); + + // hint is valid and can be used immediately + mCurrentHint++; // this is the next value + return (*mCurrentHint == kInvalidCommandId) ? std::nullopt : std::make_optional(*mCurrentHint); +} + +bool CodegenDataModel::EmberCommandListIterator::Exists(const CommandId * list, CommandId toCheck) +{ + VerifyOrReturnValue(list != nullptr, false); + VerifyOrReturnValue(toCheck != kInvalidCommandId, false); + + if (mCurrentList != list) + { + // invalidate the hint if switching lists... + mCurrentHint = nullptr; + mCurrentList = list; + } + + // maybe already positioned correctly + if ((mCurrentHint != nullptr) && (*mCurrentHint == toCheck)) + { + return true; + } + + // move and try to find it + mCurrentHint = mCurrentList; + while ((*mCurrentHint != kInvalidCommandId) && (*mCurrentHint != toCheck)) + { + mCurrentHint++; + } + + return (*mCurrentHint == toCheck); +} + +CHIP_ERROR CodegenDataModel::ReadAttribute(const InteractionModel::ReadAttributeRequest & request, + InteractionModel::ReadState & state, AttributeValueEncoder & encoder) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR CodegenDataModel::WriteAttribute(const InteractionModel::WriteAttributeRequest & request, + AttributeValueDecoder & decoder) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +CHIP_ERROR CodegenDataModel::Invoke(const InteractionModel::InvokeRequest & request, TLV::TLVReader & input_arguments, + InteractionModel::InvokeReply & reply) +{ + // TODO: this needs an implementation + return CHIP_ERROR_NOT_IMPLEMENTED; +} + +EndpointId CodegenDataModel::FirstEndpoint() +{ + // find the first enabled index + const uint16_t lastEndpointIndex = emberAfEndpointCount(); + for (uint16_t endpoint_idx = 0; endpoint_idx < lastEndpointIndex; endpoint_idx++) + { + if (emberAfEndpointIndexIsEnabled(endpoint_idx)) + { + mEndpointIterationHint = endpoint_idx; + return emberAfEndpointFromIndex(endpoint_idx); + } + } + + // No enabled endpoint found. Give up + return kInvalidEndpointId; +} + +std::optional CodegenDataModel::TryFindEndpointIndex(EndpointId id) const +{ + const uint16_t lastEndpointIndex = emberAfEndpointCount(); + + if ((mEndpointIterationHint < lastEndpointIndex) && emberAfEndpointIndexIsEnabled(mEndpointIterationHint) && + (id == emberAfEndpointFromIndex(mEndpointIterationHint))) + { + return std::make_optional(mEndpointIterationHint); + } + + // Linear search, this may be slow + uint16_t idx = emberAfIndexFromEndpoint(id); + if (idx == kEmberInvalidEndpointIndex) + { + return std::nullopt; + } + + return std::make_optional(idx); +} + +EndpointId CodegenDataModel::NextEndpoint(EndpointId before) +{ + const unsigned lastEndpointIndex = emberAfEndpointCount(); + + std::optional before_idx = TryFindEndpointIndex(before); + if (!before_idx.has_value()) + { + return kInvalidEndpointId; + } + + // find the first enabled index + for (uint16_t endpoint_idx = static_cast(*before_idx + 1); endpoint_idx < lastEndpointIndex; endpoint_idx++) + { + if (emberAfEndpointIndexIsEnabled(endpoint_idx)) + { + mEndpointIterationHint = endpoint_idx; + return emberAfEndpointFromIndex(endpoint_idx); + } + } + + // No enabled enpoint after "before" was found, give up + return kInvalidEndpointId; +} + +InteractionModel::ClusterEntry CodegenDataModel::FirstCluster(EndpointId endpointId) +{ + const EmberAfEndpointType * endpoint = emberAfFindEndpointType(endpointId); + VerifyOrReturnValue(endpoint != nullptr, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->clusterCount > 0, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->cluster != nullptr, InteractionModel::ClusterEntry::kInvalid); + + return FirstServerClusterEntry(endpointId, endpoint, 0, mClusterIterationHint); +} + +std::optional CodegenDataModel::TryFindServerClusterIndex(const EmberAfEndpointType * endpoint, ClusterId id) const +{ + const unsigned clusterCount = endpoint->clusterCount; + + if (mClusterIterationHint < clusterCount) + { + const EmberAfCluster & cluster = endpoint->cluster[mClusterIterationHint]; + if (cluster.IsServer() && (cluster.clusterId == id)) + { + return std::make_optional(mClusterIterationHint); + } + } + + // linear search, this may be slow + // does NOT use emberAfClusterIndex to not iterate over endpoints as we have + // already found the correct endpoint + for (unsigned cluster_idx = 0; cluster_idx < clusterCount; cluster_idx++) + { + const EmberAfCluster & cluster = endpoint->cluster[cluster_idx]; + if (cluster.IsServer() && (cluster.clusterId == id)) + { + return std::make_optional(cluster_idx); + } + } + + return std::nullopt; +} + +InteractionModel::ClusterEntry CodegenDataModel::NextCluster(const ConcreteClusterPath & before) +{ + // TODO: This search still seems slow (ember will loop). Should use index hints as long + // as ember API supports it + const EmberAfEndpointType * endpoint = emberAfFindEndpointType(before.mEndpointId); + + VerifyOrReturnValue(endpoint != nullptr, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->clusterCount > 0, InteractionModel::ClusterEntry::kInvalid); + VerifyOrReturnValue(endpoint->cluster != nullptr, InteractionModel::ClusterEntry::kInvalid); + + std::optional cluster_idx = TryFindServerClusterIndex(endpoint, before.mClusterId); + if (!cluster_idx.has_value()) + { + return InteractionModel::ClusterEntry::kInvalid; + } + + return FirstServerClusterEntry(before.mEndpointId, endpoint, *cluster_idx + 1, mClusterIterationHint); +} + +std::optional CodegenDataModel::GetClusterInfo(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + + auto info = LoadClusterInfo(path, *cluster); + + if (CHIP_ERROR * err = std::get_if(&info)) + { +#if CHIP_ERROR_LOGGING + ChipLogError(AppServer, "Failed to load cluster info: %" CHIP_ERROR_FORMAT, err->Format()); +#else + (void) err->Format(); +#endif + return std::nullopt; + } + + return std::make_optional(std::get(info)); +} + +InteractionModel::AttributeEntry CodegenDataModel::FirstAttribute(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributeCount > 0, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributes != nullptr, InteractionModel::AttributeEntry::kInvalid); + + mAttributeIterationHint = 0; + return AttributeEntryFrom(path, cluster->attributes[0]); +} + +std::optional CodegenDataModel::TryFindAttributeIndex(const EmberAfCluster * cluster, AttributeId id) const +{ + const unsigned attributeCount = cluster->attributeCount; + + // attempt to find this based on the embedded hint + if ((mAttributeIterationHint < attributeCount) && (cluster->attributes[mAttributeIterationHint].attributeId == id)) + { + return std::make_optional(mAttributeIterationHint); + } + + // linear search is required. This may be slow + for (unsigned attribute_idx = 0; attribute_idx < attributeCount; attribute_idx++) + { + + if (cluster->attributes[attribute_idx].attributeId == id) + { + return std::make_optional(attribute_idx); + } + } + + return std::nullopt; +} + +const EmberAfCluster * CodegenDataModel::FindServerCluster(const ConcreteClusterPath & path) +{ + // cache things + if (mPreviouslyFoundCluster.has_value() && (mPreviouslyFoundCluster->path == path)) + { + return mPreviouslyFoundCluster->cluster; + } + + const EmberAfCluster * cluster = emberAfFindServerCluster(path.mEndpointId, path.mClusterId); + if (cluster != nullptr) + { + mPreviouslyFoundCluster = std::make_optional(path, cluster); + } + return cluster; +} + +InteractionModel::AttributeEntry CodegenDataModel::NextAttribute(const ConcreteAttributePath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + VerifyOrReturnValue(cluster != nullptr, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributeCount > 0, InteractionModel::AttributeEntry::kInvalid); + VerifyOrReturnValue(cluster->attributes != nullptr, InteractionModel::AttributeEntry::kInvalid); + + // find the given attribute in the list and then return the next one + std::optional attribute_idx = TryFindAttributeIndex(cluster, before.mAttributeId); + if (!attribute_idx.has_value()) + { + return InteractionModel::AttributeEntry::kInvalid; + } + + unsigned next_idx = *attribute_idx + 1; + if (next_idx < cluster->attributeCount) + { + mAttributeIterationHint = next_idx; + return AttributeEntryFrom(before, cluster->attributes[next_idx]); + } + + // iteration complete + return InteractionModel::AttributeEntry::kInvalid; +} + +std::optional CodegenDataModel::GetAttributeInfo(const ConcreteAttributePath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + VerifyOrReturnValue(cluster->attributeCount > 0, std::nullopt); + VerifyOrReturnValue(cluster->attributes != nullptr, std::nullopt); + + std::optional attribute_idx = TryFindAttributeIndex(cluster, path.mAttributeId); + + if (!attribute_idx.has_value()) + { + return std::nullopt; + } + + InteractionModel::AttributeInfo info; + LoadAttributeInfo(path, cluster->attributes[*attribute_idx], &info); + return std::make_optional(info); +} + +InteractionModel::CommandEntry CodegenDataModel::FirstAcceptedCommand(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::CommandEntry::kInvalid); + + std::optional commandId = mAcceptedCommandsIterator.First(cluster->acceptedCommandList); + VerifyOrReturnValue(commandId.has_value(), InteractionModel::CommandEntry::kInvalid); + + return CommandEntryFrom(path, *commandId); +} + +InteractionModel::CommandEntry CodegenDataModel::NextAcceptedCommand(const ConcreteCommandPath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + + VerifyOrReturnValue(cluster != nullptr, InteractionModel::CommandEntry::kInvalid); + + std::optional commandId = mAcceptedCommandsIterator.Next(cluster->acceptedCommandList, before.mCommandId); + VerifyOrReturnValue(commandId.has_value(), InteractionModel::CommandEntry::kInvalid); + + return CommandEntryFrom(before, *commandId); +} + +std::optional CodegenDataModel::GetAcceptedCommandInfo(const ConcreteCommandPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, std::nullopt); + VerifyOrReturnValue(mAcceptedCommandsIterator.Exists(cluster->acceptedCommandList, path.mCommandId), std::nullopt); + + return CommandEntryFrom(path, path.mCommandId).info; +} + +ConcreteCommandPath CodegenDataModel::FirstGeneratedCommand(const ConcreteClusterPath & path) +{ + const EmberAfCluster * cluster = FindServerCluster(path); + + VerifyOrReturnValue(cluster != nullptr, kInvalidCommandPath); + + std::optional commandId = mGeneratedCommandsIterator.First(cluster->generatedCommandList); + VerifyOrReturnValue(commandId.has_value(), kInvalidCommandPath); + return ConcreteCommandPath(path.mEndpointId, path.mClusterId, *commandId); +} + +ConcreteCommandPath CodegenDataModel::NextGeneratedCommand(const ConcreteCommandPath & before) +{ + const EmberAfCluster * cluster = FindServerCluster(before); + + VerifyOrReturnValue(cluster != nullptr, kInvalidCommandPath); + + std::optional commandId = mGeneratedCommandsIterator.Next(cluster->generatedCommandList, before.mCommandId); + VerifyOrReturnValue(commandId.has_value(), kInvalidCommandPath); + + return ConcreteCommandPath(before.mEndpointId, before.mClusterId, *commandId); +} + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-interaction-model/CodegenDataModel.h b/src/app/codegen-interaction-model/CodegenDataModel.h new file mode 100644 index 00000000000000..43117fa48d2312 --- /dev/null +++ b/src/app/codegen-interaction-model/CodegenDataModel.h @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2024 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. + */ +#pragma once + +#include + +#include + +namespace chip { +namespace app { + +/// An implementation of `InteractionModel::Model` that relies on code-generation +/// via zap/ember. +/// +/// The Ember framework uses generated files (like endpoint-config.h and various +/// other generated metadata) to provide a cluster model. +/// +/// This class will use global functions generally residing in `app/util` +/// as well as application-specific overrides to provide data model functionality. +/// +/// Given that this relies on global data at link time, there generally can be +/// only one CodegenDataModel per application (you can create more instances, +/// however they would share the exact same underlying data and storage). +class CodegenDataModel : public chip::app::InteractionModel::Model +{ +private: + /// Ember commands are stored as a `CommandId *` pointer that is either null (i.e. no commands) + /// or is terminated with 0xFFFF_FFFF aka kInvalidCommandId + /// + /// Since iterator implementations in the data model use Next(before_path) calls, iterating + /// such lists from the beginning would be very inefficient as O(n^2). + /// + /// This class maintains a cached position inside such iteration, such that `Next` calls + /// can be faster. + class EmberCommandListIterator + { + private: + const CommandId * mCurrentList = nullptr; + const CommandId * mCurrentHint = nullptr; // Invariant: mCurrentHint is INSIDE mCurrentList + public: + EmberCommandListIterator() = default; + + /// Returns the first command in the given list (or nullopt if list is null or starts with 0xFFFFFFF) + std::optional First(const CommandId * list); + + /// Returns the command after `previousId` in the given list + std::optional Next(const CommandId * list, CommandId previousId); + + /// Checks if the given command id exists in the given list + bool Exists(const CommandId * list, CommandId toCheck); + }; + +public: + /// Generic model implementations + CHIP_ERROR Shutdown() override { return CHIP_NO_ERROR; } + + CHIP_ERROR ReadAttribute(const InteractionModel::ReadAttributeRequest & request, InteractionModel::ReadState & state, + AttributeValueEncoder & encoder) override; + CHIP_ERROR WriteAttribute(const InteractionModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; + CHIP_ERROR Invoke(const InteractionModel::InvokeRequest & request, chip::TLV::TLVReader & input_arguments, + InteractionModel::InvokeReply & reply) override; + + /// attribute tree iteration + EndpointId FirstEndpoint() override; + EndpointId NextEndpoint(EndpointId before) override; + + InteractionModel::ClusterEntry FirstCluster(EndpointId endpoint) override; + InteractionModel::ClusterEntry NextCluster(const ConcreteClusterPath & before) override; + std::optional GetClusterInfo(const ConcreteClusterPath & path) override; + + InteractionModel::AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) override; + InteractionModel::AttributeEntry NextAttribute(const ConcreteAttributePath & before) override; + std::optional GetAttributeInfo(const ConcreteAttributePath & path) override; + + InteractionModel::CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) override; + InteractionModel::CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) override; + std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) override; + + ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) override; + ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) override; + +private: + // Iteration is often done in a tight loop going through all values. + // To avoid N^2 iterations, cache a hint of where something is positioned + uint16_t mEndpointIterationHint = 0; + unsigned mClusterIterationHint = 0; + unsigned mAttributeIterationHint = 0; + EmberCommandListIterator mAcceptedCommandsIterator; + EmberCommandListIterator mGeneratedCommandsIterator; + + // represents a remembered cluster reference that has been found as + // looking for clusters is very common (for every attribute iteration) + struct ClusterReference + { + ConcreteClusterPath path; + const EmberAfCluster * cluster; + + ClusterReference(const ConcreteClusterPath p, const EmberAfCluster * c) : path(p), cluster(c) {} + }; + std::optional mPreviouslyFoundCluster; + + /// Finds the specified ember cluster + /// + /// Effectively the same as `emberAfFindServerCluster` except with some caching capabilities + const EmberAfCluster * FindServerCluster(const ConcreteClusterPath & path); + + /// Find the index of the given attribute id + std::optional TryFindAttributeIndex(const EmberAfCluster * cluster, chip::AttributeId id) const; + + /// Find the index of the given cluster id + std::optional TryFindServerClusterIndex(const EmberAfEndpointType * endpoint, chip::ClusterId id) const; + + /// Find the index of the given endpoint id + std::optional TryFindEndpointIndex(chip::EndpointId id) const; +}; + +} // namespace app +} // namespace chip diff --git a/src/app/codegen-interaction-model/model.gni b/src/app/codegen-interaction-model/model.gni new file mode 100644 index 00000000000000..d1c4e85b90b433 --- /dev/null +++ b/src/app/codegen-interaction-model/model.gni @@ -0,0 +1,35 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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("//build_overrides/chip.gni") + +# The sources in this directory are TIGHTLY coupled with code-generated data models +# as generally implemented by `src/app/util` +# +# Corresponding functions defined in attribute-storace.cpp/attribute-table.cpp must +# be available at link time for this model to use and constants heavily depend +# on `zap-generated/endpoint_config.h` (generally compile-time constants that +# are code generated) +# +# As a result, the files here are NOT a source_set or similar because they cannot +# be cleanly built as a stand-alone and instead have to be imported as part of +# a different data model or compilation unit. +codegen_interaction_model_SOURCES = [ + "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.h", + "${chip_root}/src/app/codegen-interaction-model/CodegenDataModel.cpp", +] + +codegen_interaction_model_PUBLIC_DEPS = [ + "${chip_root}/src/app/common:attribute-type", + "${chip_root}/src/app/interaction-model", +] diff --git a/src/app/codegen-interaction-model/tests/BUILD.gn b/src/app/codegen-interaction-model/tests/BUILD.gn new file mode 100644 index 00000000000000..f543bc8d0cc24b --- /dev/null +++ b/src/app/codegen-interaction-model/tests/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2024 Project CHIP Authors +# +# 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("//build_overrides/chip.gni") +import("${chip_root}/build/chip/chip_test_suite.gni") +import("${chip_root}/src/app/codegen-interaction-model/model.gni") + +source_set("mock_model") { + sources = codegen_interaction_model_SOURCES + + public_deps = codegen_interaction_model_PUBLIC_DEPS + + # this ties in the codegen model to an actual ember implementation + public_deps += [ "${chip_root}/src/app/util/mock:mock_ember" ] +} + +chip_test_suite("tests") { + output_name = "libCodegenInteractionModelTests" + + test_sources = [ "TestCodegenModelViaMocks.cpp" ] + + cflags = [ "-Wconversion" ] + + public_deps = [ ":mock_model" ] +} diff --git a/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp new file mode 100644 index 00000000000000..e8175bf8d3f340 --- /dev/null +++ b/src/app/codegen-interaction-model/tests/TestCodegenModelViaMocks.cpp @@ -0,0 +1,488 @@ +/* + * + * Copyright (c) 2024 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. + */ +#include + +#include +#include +#include +#include + +#include + +using namespace chip; +using namespace chip::Test; +using namespace chip::app; +using namespace chip::app::InteractionModel; +using namespace chip::app::Clusters::Globals::Attributes; + +namespace { + +constexpr EndpointId kEndpointIdThatIsMissing = kMockEndpointMin - 1; + +static_assert(kEndpointIdThatIsMissing != kInvalidEndpointId); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint1); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint2); +static_assert(kEndpointIdThatIsMissing != kMockEndpoint3); + +// clang-format off +const MockNodeConfig gTestNodeConfig({ + MockEndpointConfig(kMockEndpoint1, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, + }, { + MockEventId(1), MockEventId(2), + }), + MockClusterConfig(MockClusterId(2), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), + }), + }), + MockEndpointConfig(kMockEndpoint2, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, + }), + MockClusterConfig( + MockClusterId(2), + { + ClusterRevision::Id, + FeatureMap::Id, + MockAttributeId(1), + MockAttributeConfig(MockAttributeId(2), ZCL_ARRAY_ATTRIBUTE_TYPE), + }, /* attributes */ + {}, /* events */ + {1, 2, 23}, /* acceptedCommands */ + {2, 10} /* generatedCommands */ + ), + MockClusterConfig( + MockClusterId(3), + { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), MockAttributeId(2), MockAttributeId(3), + }, /* attributes */ + {}, /* events */ + {11}, /* acceptedCommands */ + {4, 6} /* generatedCommands */ + ), + }), + MockEndpointConfig(kMockEndpoint3, { + MockClusterConfig(MockClusterId(1), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), + }), + MockClusterConfig(MockClusterId(2), { + ClusterRevision::Id, FeatureMap::Id, MockAttributeId(1), MockAttributeId(2), MockAttributeId(3), MockAttributeId(4), + }), + MockClusterConfig(MockClusterId(3), { + ClusterRevision::Id, FeatureMap::Id, + }), + MockClusterConfig(MockClusterId(4), { + ClusterRevision::Id, FeatureMap::Id, + }), + }), +}); +// clang-format on + +struct UseMockNodeConfig +{ + UseMockNodeConfig(const MockNodeConfig & config) { SetMockNodeConfig(config); } + ~UseMockNodeConfig() { ResetMockNodeConfig(); } +}; + +} // namespace + +TEST(TestCodegenModelViaMocks, IterateOverEndpoints) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // This iteration relies on the hard-coding that occurs when mock_ember is used + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + + /// Some out of order requests should work as well + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint2), kMockEndpoint3); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint1), kMockEndpoint2); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + EXPECT_EQ(model.NextEndpoint(kMockEndpoint3), kInvalidEndpointId); + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + EXPECT_EQ(model.FirstEndpoint(), kMockEndpoint1); + + // invalid endpoiunts + EXPECT_EQ(model.NextEndpoint(kInvalidEndpointId), kInvalidEndpointId); + EXPECT_EQ(model.NextEndpoint(987u), kInvalidEndpointId); +} + +TEST(TestCodegenModelViaMocks, IterateOverClusters) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + chip::Test::ResetVersion(); + + EXPECT_FALSE(model.FirstCluster(kEndpointIdThatIsMissing).path.HasValidIds()); + EXPECT_FALSE(model.FirstCluster(kInvalidEndpointId).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kInvalidEndpointId, 123)).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + EXPECT_FALSE(model.NextCluster(ConcreteClusterPath(kMockEndpoint1, 981u)).path.HasValidIds()); + + // mock endpoint 1 has 2 mock clusters: 1 and 2 + ClusterEntry entry = model.FirstCluster(kMockEndpoint1); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(1)); + EXPECT_EQ(entry.info.dataVersion, 0u); + EXPECT_EQ(entry.info.flags.Raw(), 0u); + + chip::Test::BumpVersion(); + + entry = model.NextCluster(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.info.dataVersion, 1u); + EXPECT_EQ(entry.info.flags.Raw(), 0u); + + entry = model.NextCluster(entry.path); + EXPECT_FALSE(entry.path.HasValidIds()); + + // mock endpoint 3 has 4 mock clusters: 1 through 4 + entry = model.FirstCluster(kMockEndpoint3); + for (uint16_t clusterId = 1; clusterId <= 4; clusterId++) + { + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint3); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(clusterId)); + entry = model.NextCluster(entry.path); + } + EXPECT_FALSE(entry.path.HasValidIds()); + + // repeat calls should work + for (int i = 0; i < 10; i++) + { + entry = model.FirstCluster(kMockEndpoint1); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(1)); + } + + for (int i = 0; i < 10; i++) + { + ClusterEntry nextEntry = model.NextCluster(entry.path); + ASSERT_TRUE(nextEntry.path.HasValidIds()); + EXPECT_EQ(nextEntry.path.mEndpointId, kMockEndpoint1); + EXPECT_EQ(nextEntry.path.mClusterId, MockClusterId(2)); + } +} + +TEST(TestCodegenModelViaMocks, GetClusterInfo) +{ + + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + chip::Test::ResetVersion(); + + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId)).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).has_value()); + ASSERT_FALSE(model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).has_value()); + + // now get the value + std::optional info = model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(1))); + ASSERT_TRUE(info.has_value()); + EXPECT_EQ(info->dataVersion, 0u); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->flags.Raw(), 0u); // NOLINT(bugprone-unchecked-optional-access) + + chip::Test::BumpVersion(); + info = model.GetClusterInfo(ConcreteClusterPath(kMockEndpoint1, MockClusterId(1))); + ASSERT_TRUE(info.has_value()); + EXPECT_EQ(info->dataVersion, 1u); // NOLINT(bugprone-unchecked-optional-access) + EXPECT_EQ(info->flags.Raw(), 0u); // NOLINT(bugprone-unchecked-optional-access) +} + +TEST(TestCodegenModelViaMocks, IterateOverAttributes) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAttribute(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kEndpointIdThatIsMissing, MockClusterId(1), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kInvalidEndpointId, MockClusterId(1), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, kInvalidClusterId, 1u)).path.HasValidIds()); + ASSERT_FALSE(model.NextAttribute(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), 987u)).path.HasValidIds()); + + // should be able to iterate over valid paths + AttributeEntry entry = model.FirstAttribute(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, ClusterRevision::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, FeatureMap::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(1)); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(2)); + ASSERT_TRUE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + + entry = model.NextAttribute(entry.path); + ASSERT_FALSE(entry.path.HasValidIds()); + + // repeated calls should work + for (int i = 0; i < 10; i++) + { + entry = model.FirstAttribute(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, ClusterRevision::Id); + ASSERT_FALSE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAttribute(ConcreteAttributePath(kMockEndpoint2, MockClusterId(2), MockAttributeId(1))); + ASSERT_TRUE(entry.path.HasValidIds()); + ASSERT_EQ(entry.path.mEndpointId, kMockEndpoint2); + ASSERT_EQ(entry.path.mClusterId, MockClusterId(2)); + ASSERT_EQ(entry.path.mAttributeId, MockAttributeId(2)); + ASSERT_TRUE(entry.info.flags.Has(AttributeQualityFlags::kListAttribute)); + } +} + +TEST(TestCodegenModelViaMocks, GetAttributeInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // various non-existent or invalid paths should return no info data + ASSERT_FALSE( + model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, kInvalidAttributeId)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kInvalidEndpointId, MockClusterId(1), FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, kInvalidClusterId, FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), FeatureMap::Id)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(10), kInvalidAttributeId)).has_value()); + ASSERT_FALSE(model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), MockAttributeId(10))).has_value()); + + // valid info + std::optional info = + model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), FeatureMap::Id)); + ASSERT_TRUE(info.has_value()); + EXPECT_FALSE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) + + info = model.GetAttributeInfo(ConcreteAttributePath(kMockEndpoint2, MockClusterId(2), MockAttributeId(2))); + ASSERT_TRUE(info.has_value()); + EXPECT_TRUE(info->flags.Has(AttributeQualityFlags::kListAttribute)); // NOLINT(bugprone-unchecked-optional-access) +} + +// global attributes are EXPLICITLY not supported +TEST(TestCodegenModelViaMocks, GlobalAttributeInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + std::optional info = model.GetAttributeInfo( + ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), Clusters::Globals::Attributes::GeneratedCommandList::Id)); + + ASSERT_FALSE(info.has_value()); + + info = model.GetAttributeInfo( + ConcreteAttributePath(kMockEndpoint1, MockClusterId(1), Clusters::Globals::Attributes::AttributeList::Id)); + ASSERT_FALSE(info.has_value()); +} + +TEST(TestCodegenModelViaMocks, IterateOverAcceptedCommands) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).path.HasValidIds()); + ASSERT_FALSE(model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).path.HasValidIds()); + + // should be able to iterate over valid paths + CommandEntry entry = model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 1u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 2u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 23u); + + entry = model.NextAcceptedCommand(entry.path); + ASSERT_FALSE(entry.path.HasValidIds()); + + // attempt some out-of-order requests as well + entry = model.FirstAcceptedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(3))); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(3)); + EXPECT_EQ(entry.path.mCommandId, 11u); + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2)); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 23u); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1)); + ASSERT_TRUE(entry.path.HasValidIds()); + EXPECT_EQ(entry.path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(entry.path.mClusterId, MockClusterId(2)); + EXPECT_EQ(entry.path.mCommandId, 2u); + } + + for (int i = 0; i < 10; i++) + { + entry = model.NextAcceptedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 10)); + EXPECT_FALSE(entry.path.HasValidIds()); + } +} + +TEST(TestCodegenModelViaMocks, AcceptedCommandInfo) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kEndpointIdThatIsMissing, MockClusterId(1), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kInvalidEndpointId, MockClusterId(1), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, MockClusterId(10), 1)).has_value()); + ASSERT_FALSE(model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, kInvalidClusterId, 1)).has_value()); + ASSERT_FALSE( + model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint1, MockClusterId(1), kInvalidCommandId)).has_value()); + + std::optional info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 23u)); + ASSERT_TRUE(info.has_value()); + + info = model.GetAcceptedCommandInfo(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 1234u)); + ASSERT_FALSE(info.has_value()); +} + +TEST(TestCodegenModelViaMocks, IterateOverGeneratedCommands) +{ + UseMockNodeConfig config(gTestNodeConfig); + chip::app::CodegenDataModel model; + + // invalid paths should return in "no more data" + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kEndpointIdThatIsMissing, MockClusterId(1))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kInvalidEndpointId, MockClusterId(1))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint1, MockClusterId(10))).HasValidIds()); + ASSERT_FALSE(model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint1, kInvalidClusterId)).HasValidIds()); + + // should be able to iterate over valid paths + ConcreteCommandPath path = model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(2))); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 2u); + + path = model.NextGeneratedCommand(path); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 10u); + + path = model.NextGeneratedCommand(path); + ASSERT_FALSE(path.HasValidIds()); + + // attempt some out-of-order requests as well + path = model.FirstGeneratedCommand(ConcreteClusterPath(kMockEndpoint2, MockClusterId(3))); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(3)); + EXPECT_EQ(path.mCommandId, 4u); + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(2), 2)); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(2)); + EXPECT_EQ(path.mCommandId, 10u); + } + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 4)); + ASSERT_TRUE(path.HasValidIds()); + EXPECT_EQ(path.mEndpointId, kMockEndpoint2); + EXPECT_EQ(path.mClusterId, MockClusterId(3)); + EXPECT_EQ(path.mCommandId, 6u); + } + + for (int i = 0; i < 10; i++) + { + path = model.NextGeneratedCommand(ConcreteCommandPath(kMockEndpoint2, MockClusterId(3), 6)); + EXPECT_FALSE(path.HasValidIds()); + } +} diff --git a/src/app/interaction-model/BUILD.gn b/src/app/interaction-model/BUILD.gn index a0967289c6c65c..19dd3de6c26291 100644 --- a/src/app/interaction-model/BUILD.gn +++ b/src/app/interaction-model/BUILD.gn @@ -19,7 +19,8 @@ source_set("interaction-model") { "Context.h", "Events.h", "InvokeResponder.h", - "IterationTypes.h", + "MetadataTypes.cpp", + "MetadataTypes.h", "Model.h", "OperationTypes.h", "Paths.h", diff --git a/src/app/interaction-model/IterationTypes.h b/src/app/interaction-model/IterationTypes.h deleted file mode 100644 index 441dd3acb7b81f..00000000000000 --- a/src/app/interaction-model/IterationTypes.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2024 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. - */ -#pragma once - -#include -#include - -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace InteractionModel { - -enum class ClusterQualityFlags : uint32_t -{ - kDiagnosticsData = 0x0001, // `K` quality, may be filtered out in subscriptions -}; - -struct ClusterInfo -{ - DataVersion dataVersion; // current version of this cluster - BitFlags flags; -}; - -struct ClusterEntry -{ - ConcreteClusterPath path; - ClusterInfo info; -}; - -enum class AttributeQualityFlags : uint32_t -{ - kListAttribute = 0x0001, // This attribute is a list attribute - kChangesOmitted = 0x0002, // `C` quality on attributes -}; - -struct AttributeInfo -{ - BitFlags flags; -}; - -struct AttributeEntry -{ - ConcreteAttributePath path; - AttributeInfo info; -}; - -/// Provides metadata information for a data model -/// -/// The data model can be viewed as a tree of endpoint/cluster/attribute -/// where each element can be iterated through independently -/// -/// Iteration rules: -/// - kInvalidEndpointId will be returned when iteration ends (or generally kInvalid* for paths) -/// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) -/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: -/// - when iterating over an endpoint, ALL clusters of that endpoint will be iterated first, before -/// switching the endpoint (order of clusters themselves not guaranteed) -/// - when iterating over a cluster, ALL attributes of that cluster will be iterated first, before -/// switching to a new cluster -/// - uniqueness and completeness (iterate over all possible distinct values as long as no -/// internal structural changes occur) -class AttributeTreeIterator -{ -public: - virtual ~AttributeTreeIterator() = default; - - virtual EndpointId FirstEndpoint() = 0; - virtual EndpointId NextEndpoint(EndpointId before) = 0; - - virtual ClusterEntry FirstCluster(EndpointId endpoint) = 0; - virtual ClusterEntry NextCluster(const ConcreteClusterPath & before) = 0; - virtual std::optional GetClusterInfo(const ConcreteClusterPath & path) = 0; - - virtual AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) = 0; - virtual AttributeEntry NextAttribute(const ConcreteAttributePath & before) = 0; - virtual std::optional GetAttributeInfo(const ConcreteAttributePath & path) = 0; -}; - -} // namespace InteractionModel -} // namespace app -} // namespace chip diff --git a/src/app/interaction-model/MetadataTypes.cpp b/src/app/interaction-model/MetadataTypes.cpp new file mode 100644 index 00000000000000..48c2e3db733a52 --- /dev/null +++ b/src/app/interaction-model/MetadataTypes.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024 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. + */ +#include + +namespace chip { +namespace app { +namespace InteractionModel { + +const AttributeEntry AttributeEntry::kInvalid{ .path = ConcreteAttributePath(kInvalidEndpointId, kInvalidClusterId, + kInvalidAttributeId) }; + +const CommandEntry CommandEntry::kInvalid{ .path = ConcreteCommandPath(kInvalidEndpointId, kInvalidClusterId, kInvalidCommandId) }; + +const ClusterEntry ClusterEntry::kInvalid{ + .path = ConcreteClusterPath(kInvalidEndpointId, kInvalidClusterId), + .info = ClusterInfo(0 /* version */), // version of invalid cluster entry does not matter +}; + +} // namespace InteractionModel +} // namespace app +} // namespace chip diff --git a/src/app/interaction-model/MetadataTypes.h b/src/app/interaction-model/MetadataTypes.h new file mode 100644 index 00000000000000..5b3c62f0be2247 --- /dev/null +++ b/src/app/interaction-model/MetadataTypes.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2024 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. + */ +#pragma once + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace app { +namespace InteractionModel { + +enum class ClusterQualityFlags : uint32_t +{ + kDiagnosticsData = 0x0001, // `K` quality, may be filtered out in subscriptions +}; + +struct ClusterInfo +{ + DataVersion dataVersion; // current cluster data version, + BitFlags flags; + + /// Constructor that marks data version as mandatory + /// for this structure. + ClusterInfo(DataVersion version) : dataVersion(version) {} +}; + +struct ClusterEntry +{ + ConcreteClusterPath path; + ClusterInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const ClusterEntry kInvalid; +}; + +enum class AttributeQualityFlags : uint32_t +{ + kListAttribute = 0x0004, // This attribute is a list attribute + kFabricScoped = 0x0008, // 'F' quality on attributes + kFabricSensitive = 0x0010, // 'S' quality on attributes + kChangesOmitted = 0x0020, // `C` quality on attributes + kTimed = 0x0040, // `T` quality on attributes (writes require timed interactions) +}; + +struct AttributeInfo +{ + BitFlags flags; + + // read/write access will be missing if read/write is NOT allowed + std::optional readPrivilege; // generally defaults to View if readable + std::optional writePrivilege; // generally defaults to Operate if writable +}; + +struct AttributeEntry +{ + ConcreteAttributePath path; + AttributeInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const AttributeEntry kInvalid; +}; + +enum class CommandQualityFlags : uint32_t +{ + kFabricScoped = 0x0001, + kTimed = 0x0002, // `T` quality on commands +}; + +struct CommandInfo +{ + BitFlags flags; + Access::Privilege invokePrivilege = Access::Privilege::kOperate; +}; + +struct CommandEntry +{ + ConcreteCommandPath path; + CommandInfo info; + + bool IsValid() const { return path.HasValidIds(); } + + static const CommandEntry kInvalid; +}; + +/// Provides metadata information for a data model +/// +/// The data model can be viewed as a tree of endpoint/cluster/(attribute+commands+events) +/// where each element can be iterated through independently. +/// +/// Iteration rules: +/// - Invalid paths will be returned when iteration ends (IDs will be kInvalid* and in particular +/// mEndpointId will be kInvalidEndpointId). See `::kInvalid` constants for entries and +/// can use ::IsValid() to determine if the entry is valid or not. +/// - Global Attributes are NOT returned since they are implied +/// - Any internal iteration errors are just logged (callers do not handle iteration CHIP_ERROR) +/// - Iteration order is NOT guaranteed globally. Only the following is guaranteed: +/// - Complete tree iteration (e.g. when iterating an endpoint, ALL clusters of that endpoint +/// are returned, when iterating over a cluster, all attributes/commands are iterated over) +/// - uniqueness and completeness (iterate over all possible distinct values as long as no +/// internal structural changes occur) +class DataModelMetadataTree +{ +public: + virtual ~DataModelMetadataTree() = default; + + virtual EndpointId FirstEndpoint() = 0; + virtual EndpointId NextEndpoint(EndpointId before) = 0; + + virtual ClusterEntry FirstCluster(EndpointId endpoint) = 0; + virtual ClusterEntry NextCluster(const ConcreteClusterPath & before) = 0; + virtual std::optional GetClusterInfo(const ConcreteClusterPath & path) = 0; + + // Attribute iteration and accessors provide cluster-level access over + // attributes + virtual AttributeEntry FirstAttribute(const ConcreteClusterPath & cluster) = 0; + virtual AttributeEntry NextAttribute(const ConcreteAttributePath & before) = 0; + virtual std::optional GetAttributeInfo(const ConcreteAttributePath & path) = 0; + + // Command iteration and accessors provide cluster-level access over commands + virtual CommandEntry FirstAcceptedCommand(const ConcreteClusterPath & cluster) = 0; + virtual CommandEntry NextAcceptedCommand(const ConcreteCommandPath & before) = 0; + virtual std::optional GetAcceptedCommandInfo(const ConcreteCommandPath & path) = 0; + + // "generated" commands are purely for reporting what types of command ids can be + // returned as responses. + virtual ConcreteCommandPath FirstGeneratedCommand(const ConcreteClusterPath & cluster) = 0; + virtual ConcreteCommandPath NextGeneratedCommand(const ConcreteCommandPath & before) = 0; +}; + +} // namespace InteractionModel +} // namespace app +} // namespace chip diff --git a/src/app/interaction-model/Model.h b/src/app/interaction-model/Model.h index 151065f4c540d2..5ab973901a433b 100644 --- a/src/app/interaction-model/Model.h +++ b/src/app/interaction-model/Model.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include namespace chip { @@ -38,7 +38,7 @@ namespace InteractionModel { /// thread or equivalent /// - class is allowed to attempt to cache indexes/locations for faster /// lookups of things (e.g during iterations) -class Model : public AttributeTreeIterator +class Model : public DataModelMetadataTree { public: virtual ~Model() = default; @@ -77,11 +77,6 @@ class Model : public AttributeTreeIterator /// When this is invoked, caller is expected to have already done some validations: /// - cluster `data version` has been checked for the incoming request if applicable /// - /// List operation support: - /// - the first list write will have `request.writeFlags.Has(WriteFlags::kListBegin)` - /// - the last list write will have `request.writeFlags.Has(WriteFlags::kListEnd)` - /// - the last list write MAY have empty data (no list items) - /// /// When `request.writeFlags.Has(WriteFlags::kForceInternal)` the request is from an internal app update /// and SHOULD bypass some internal checks (like timed enforcement, potentially read-only restrictions) /// diff --git a/src/app/interaction-model/OperationTypes.h b/src/app/interaction-model/OperationTypes.h index 57499a8dbafb49..feb2e173d91600 100644 --- a/src/app/interaction-model/OperationTypes.h +++ b/src/app/interaction-model/OperationTypes.h @@ -85,7 +85,6 @@ enum class InvokeFlags : uint32_t struct InvokeRequest : OperationRequest { ConcreteCommandPath path; - std::optional groupRequestId; // set if and only if this was a group request BitFlags invokeFlags; }; diff --git a/src/app/interaction-model/tests/BUILD.gn b/src/app/interaction-model/tests/BUILD.gn index c7d36b4f1dcdca..4767d61dd12ed1 100644 --- a/src/app/interaction-model/tests/BUILD.gn +++ b/src/app/interaction-model/tests/BUILD.gn @@ -15,6 +15,8 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/chip_test_suite.gni") chip_test_suite("tests") { + output_name = "libIMInterfaceTests" + test_sources = [ "TestEventEmitting.cpp" ] cflags = [ "-Wconversion" ] diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index c608854c346fba..929ad055d0fc1e 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -23,6 +23,7 @@ * @{ */ +#include "att-storage.h" #include // For bool #include // For various uint*_t types @@ -63,7 +64,7 @@ typedef void (*EmberAfGenericClusterFunction)(void); /** * @brief Struct describing cluster */ -typedef struct +struct EmberAfCluster { /** * ID of cluster according to ZCL spec @@ -116,7 +117,9 @@ typedef struct * Total number of events supported by the cluster instance (in eventList array). */ uint16_t eventCount; -} EmberAfCluster; + + bool IsServer() const { return (mask & CLUSTER_MASK_SERVER) != 0; } +}; /** * @brief Struct that represents a logical device type consisting diff --git a/src/app/util/mock/MockNodeConfig.cpp b/src/app/util/mock/MockNodeConfig.cpp index 79c886f532a8a2..5670966e2ebb29 100644 --- a/src/app/util/mock/MockNodeConfig.cpp +++ b/src/app/util/mock/MockNodeConfig.cpp @@ -54,9 +54,12 @@ const T * findById(const std::vector & vector, decltype(std::declval().id) } // namespace MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list aAttributes, - std::initializer_list aEvents) : + std::initializer_list aEvents, + std::initializer_list aAcceptedCommands, + std::initializer_list aGeneratedCommands) : id(aId), - attributes(aAttributes), events(aEvents), mEmberCluster{} + attributes(aAttributes), events(aEvents), mEmberCluster{}, mAcceptedCommands(aAcceptedCommands), + mGeneratedCommands(aGeneratedCommands) { VerifyOrDie(aAttributes.size() < UINT16_MAX); @@ -71,6 +74,18 @@ MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list(mEmberEventList.size()); mEmberCluster.eventList = mEmberEventList.data(); + if (!mAcceptedCommands.empty()) + { + mAcceptedCommands.push_back(kInvalidCommandId); + mEmberCluster.acceptedCommandList = mAcceptedCommands.data(); + } + + if (!mGeneratedCommands.empty()) + { + mGeneratedCommands.push_back(kInvalidCommandId); + mEmberCluster.generatedCommandList = mGeneratedCommands.data(); + } + for (auto & attr : attributes) { mAttributeMetaData.push_back(attr.attributeMetaData); @@ -82,10 +97,19 @@ MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list aAttributes = {}, - std::initializer_list aEvents = {}); + std::initializer_list aEvents = {}, std::initializer_list aAcceptedCommands = {}, + std::initializer_list aGeneratedCommands = {}); // Cluster-config is self-referential: mEmberCluster.attributes references mAttributeMetaData.data() MockClusterConfig(const MockClusterConfig & other); @@ -86,6 +87,8 @@ struct MockClusterConfig EmberAfCluster mEmberCluster; std::vector mEmberEventList; std::vector mAttributeMetaData; + std::vector mAcceptedCommands; + std::vector mGeneratedCommands; }; struct MockEndpointConfig From 23e0f3b979d82337baf0333d6eec8026c6c7944c Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:57:32 +0800 Subject: [PATCH 58/78] Modified wifi network diagnostics cluster name, WiFi to Wi-Fi to match the SPEC (#33746) --- .../air-quality-sensor-common/air-quality-sensor-app.zap | 2 +- .../all-clusters-common/all-clusters-app.zap | 2 +- .../all-clusters-common/all-clusters-minimal-app.zap | 2 +- examples/bridge-app/bridge-common/bridge-app.zap | 2 +- .../devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap | 2 +- examples/chef/devices/rootnode_dishwasher_cc105034fe.zap | 2 +- .../chef/devices/rootnode_laundrywasher_fb10d238c8.zap | 2 +- ...ledcabinet_temperaturecontrolledcabinet_ffdb696680.zap | 2 +- .../chef/sample_app_util/test_files/sample_zap_file.zap | 2 +- .../contact-sensor-common/contact-sensor-app.zap | 2 +- .../dishwasher-app/dishwasher-common/dishwasher-app.zap | 2 +- .../fabric-bridge-common/fabric-bridge-app.zap | 2 +- .../laundry-washer-app/nxp/zap/laundry-washer-app.zap | 2 +- .../light-switch-common/light-switch-app.zap | 2 +- .../bouffalolab/data_model/lighting-app-wifi.zap | 2 +- examples/lighting-app/lighting-common/lighting-app.zap | 2 +- .../lighting-app/silabs/data_model/lighting-wifi-app.zap | 2 +- .../lit-icd-app/lit-icd-common/lit-icd-server-app.zap | 2 +- examples/lock-app/lock-common/lock-app.zap | 2 +- .../microwave-oven-common/microwave-oven-app.zap | 2 +- .../network-manager-common/network-manager-app.zap | 2 +- examples/placeholder/linux/apps/app1/config.zap | 2 +- examples/placeholder/linux/apps/app2/config.zap | 2 +- .../refrigerator-common/refrigerator-app.zap | 2 +- .../temperature-measurement.zap | 2 +- examples/thermostat/nxp/zap/thermostat_matter_wifi.zap | 2 +- examples/thermostat/thermostat-common/thermostat.zap | 2 +- examples/tv-app/tv-common/tv-app.zap | 2 +- .../tv-casting-app/tv-casting-common/tv-casting-app.zap | 2 +- .../virtual-device-common/virtual-device-app.zap | 2 +- examples/window-app/common/window-app.zap | 2 +- scripts/tools/zap/tests/inputs/all-clusters-app.zap | 2 +- scripts/tools/zap/tests/inputs/lighting-app.zap | 2 +- .../all-clusters-app/app-templates/endpoint_config.h | 8 ++++---- .../outputs/all-clusters-app/app-templates/gen_config.h | 2 +- .../outputs/lighting-app/app-templates/endpoint_config.h | 8 ++++---- .../tests/outputs/lighting-app/app-templates/gen_config.h | 2 +- .../wifi-network-diagnostics-server.cpp | 6 +++--- src/app/tests/suites/TestDescriptorCluster.yaml | 2 +- .../zap-templates/zcl/data-model/chip/matter-devices.xml | 4 ++-- .../data-model/chip/wifi-network-diagnostics-cluster.xml | 2 +- src/app/zap-templates/zcl/zcl-with-test-extensions.json | 2 +- src/app/zap-templates/zcl/zcl.json | 2 +- src/controller/data_model/controller-clusters.zap | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h | 2 +- src/darwin/Framework/CHIP/zap-generated/MTRClusters.h | 2 +- src/include/platform/DiagnosticDataProvider.h | 2 +- .../app-common/app-common/zap-generated/callback.h | 4 ++-- 48 files changed, 58 insertions(+), 58 deletions(-) diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap index 1ba46389e28a9e..a4d9ae077df2ee 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap @@ -2742,7 +2742,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 14c5f68d26e89c..8660f24af8b504 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -4340,7 +4340,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index a4d3b3858ef160..f6d3c8da0bf480 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -3002,7 +3002,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 555299e68cb5c0..ee172e2f021daf 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -3249,7 +3249,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index f335efdea007c7..84f87b51c18147 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -2714,7 +2714,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap index a7d96a16932d52..7b211cba5c115f 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap index 6b7f934335240c..6a142824041899 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap index d3395e323b9495..ca71e2306c494f 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap @@ -2094,7 +2094,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/chef/sample_app_util/test_files/sample_zap_file.zap b/examples/chef/sample_app_util/test_files/sample_zap_file.zap index d45fe300bf20b4..5dfd0fb28a9427 100644 --- a/examples/chef/sample_app_util/test_files/sample_zap_file.zap +++ b/examples/chef/sample_app_util/test_files/sample_zap_file.zap @@ -3024,7 +3024,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap index 87e55719e6a026..6e810d2e9641ed 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap @@ -3098,7 +3098,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap index 62667da2b3a2a0..e639aba9e7ccee 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap @@ -2234,7 +2234,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap index 76344153de457a..38bfd514882edd 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap +++ b/examples/fabric-bridge-app/fabric-bridge-common/fabric-bridge-app.zap @@ -2884,7 +2884,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap index d5c7ee215e1976..3a30427a3ee25d 100644 --- a/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap +++ b/examples/laundry-washer-app/nxp/zap/laundry-washer-app.zap @@ -2240,7 +2240,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index dcfa64d7c5e88f..3c55161e479404 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -3024,7 +3024,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap index 4986e87b004d02..11f0f8146c0faf 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap @@ -1903,7 +1903,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 0e706b8b162482..f4ca3d4705b405 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -2979,7 +2979,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index 4893d153e6b246..acd877496b7497 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -1877,7 +1877,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap index 6bbfc9050a8365..93d47fc3870900 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap @@ -2217,7 +2217,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 04689b5ca64a00..376e925d6545bb 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -3654,7 +3654,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap index 81d051d068a88f..a6f1ff62c1d03b 100644 --- a/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap +++ b/examples/microwave-oven-app/microwave-oven-common/microwave-oven-app.zap @@ -1790,7 +1790,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.zap b/examples/network-manager-app/network-manager-common/network-manager-app.zap index 46cb4b19598ca8..cb4e48c3c0480b 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.zap +++ b/examples/network-manager-app/network-manager-common/network-manager-app.zap @@ -2033,7 +2033,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 06ce98d5dac58d..8e493ace9674be 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -4056,7 +4056,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index d53fd356cce9ac..055309e6c07340 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -4072,7 +4072,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap index 7b28387152fa19..ebb8f70ea5aa9e 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap @@ -2002,7 +2002,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap index ff63220f006ce9..72a68b64e569f1 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap @@ -1962,7 +1962,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap index 9e18152bebf2bd..14c9dc4ecf3f75 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -2248,7 +2248,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 64c87bce7e15c6..3a39fb6b0e2909 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -3156,7 +3156,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 981d295d0afb02..3fce693642d18d 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -3174,7 +3174,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index 37b4953c1c72ce..526143427a3cb7 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -1745,7 +1745,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap index af20ff3733f846..4046660e64a9a1 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap @@ -2972,7 +2972,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap index fdfeb3db5eab93..5aaefb796e33ab 100644 --- a/examples/window-app/common/window-app.zap +++ b/examples/window-app/common/window-app.zap @@ -3782,7 +3782,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 784c8dfddb7664..26c2f9161e1b5a 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -4082,7 +4082,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/inputs/lighting-app.zap b/scripts/tools/zap/tests/inputs/lighting-app.zap index 5bbb7f86708ff7..6dcaaa4b3408d1 100644 --- a/scripts/tools/zap/tests/inputs/lighting-app.zap +++ b/scripts/tools/zap/tests/inputs/lighting-app.zap @@ -3087,7 +3087,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 55da8ec3f3f136..8542d7428860b3 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -637,7 +637,7 @@ { ZAP_SIMPLE_DEFAULT(0x000F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 7, ZAP_TYPE(OCTET_STRING), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* BSSID */ \ { ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(ENUM8), \ @@ -1502,7 +1502,7 @@ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ /* EventList (index=12) */ \ 0x00000000, /* SoftwareFault */ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ /* EventList (index=13) */ \ 0x00000000, /* Disconnection */ \ 0x00000001, /* AssociationFailure */ \ @@ -1662,7 +1662,7 @@ /* AcceptedCommandList (index=44) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */\ /* AcceptedCommandList (index=46) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ @@ -2197,7 +2197,7 @@ .eventCount = 0, \ },\ { \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ .attributes = ZAP_ATTRIBUTE_INDEX(173), \ .attributeCount = 15, \ diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h index e4347a93f273b1..f31bd86846fef7 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/gen_config.h @@ -205,7 +205,7 @@ #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS -// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included +// Use this macro to check if the server side of the Wi-Fi Network Diagnostics cluster is included #define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h index f04deadd1610b7..e4d7ea430d603d 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h @@ -336,7 +336,7 @@ { ZAP_SIMPLE_DEFAULT(0x000F), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \ { ZAP_SIMPLE_DEFAULT(2), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ { ZAP_EMPTY_DEFAULT(), 0x00000000, 7, ZAP_TYPE(OCTET_STRING), \ ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* BSSID */ \ { ZAP_EMPTY_DEFAULT(), 0x00000001, 1, ZAP_TYPE(ENUM8), \ @@ -545,7 +545,7 @@ 0x00000001, /* RadioFaultChange */ \ 0x00000002, /* NetworkFaultChange */ \ 0x00000003, /* BootReason */ \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ /* EventList (index=12) */ \ 0x00000000, /* Disconnection */ \ 0x00000001, /* AssociationFailure */ \ @@ -652,7 +652,7 @@ /* AcceptedCommandList (index=41) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */\ /* AcceptedCommandList (index=43) */ \ 0x00000000 /* ResetCounts */, \ chip::kInvalidCommandId /* end of list */, \ @@ -947,7 +947,7 @@ .eventCount = 0, \ },\ { \ - /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ + /* Endpoint: 0, Cluster: Wi-Fi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ .attributes = ZAP_ATTRIBUTE_INDEX(154), \ .attributeCount = 15, \ diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h index 7002f3ef3bd806..48b2305ba372b7 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/gen_config.h @@ -139,7 +139,7 @@ #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_THREAD_NETWORK_DIAGNOSTICS -// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included +// Use this macro to check if the server side of the Wi-Fi Network Diagnostics cluster is included #define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER #define MATTER_DM_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS diff --git a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp index d24bc02227b272..e119cfd7c2972f 100644 --- a/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp +++ b/src/app/clusters/wifi-network-diagnostics-server/wifi-network-diagnostics-server.cpp @@ -250,7 +250,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint Events::Disconnection::Type event{ reasonCode }; EventNumber eventNumber; @@ -271,7 +271,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint EventNumber eventNumber; if (CHIP_NO_ERROR != LogEvent(event, endpoint, eventNumber)) @@ -290,7 +290,7 @@ class WiFiDiagnosticsDelegate : public DeviceLayer::WiFiDiagnosticsDelegate Events::ConnectionStatus::Type event{ static_cast(connectionStatus) }; for (auto endpoint : EnabledEndpointsWithServerCluster(WiFiNetworkDiagnostics::Id)) { - // If WiFi Network Diagnostics cluster is implemented on this endpoint + // If Wi-Fi Network Diagnostics cluster is implemented on this endpoint EventNumber eventNumber; if (CHIP_NO_ERROR != LogEvent(event, endpoint, eventNumber)) diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index 332e72ede9b084..b6b2cbc73e9f42 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -58,7 +58,7 @@ tests: 0x0033, # General Diagnostics 0x0034, # Software Diagnostics 0x0035, # Thread Network Diagnostiscs - 0x0036, # WiFi Network Diagnostics + 0x0036, # Wi-Fi Network Diagnostics 0x0037, # Ethernet Network Diagnostics 0x0038, # Time Synchronization 0x003C, # Administrator Commissioning diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 2aad342ea71311..0016bb8ec27717 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -84,7 +84,7 @@ limitations under the License. - + @@ -2606,7 +2606,7 @@ limitations under the License. PARTS_LIST - + diff --git a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml index 33d3f661fd3834..7fb35aab255ed7 100644 --- a/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml @@ -50,7 +50,7 @@ limitations under the License. General - WiFi Network Diagnostics + Wi-Fi Network Diagnostics 0x0036 WIFI_NETWORK_DIAGNOSTICS_CLUSTER The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 30c14436667202..e0fcb32e0dc89e 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -353,7 +353,7 @@ "ChannelPage0Mask", "OperationalDatasetComponents" ], - "WiFi Network Diagnostics": [ + "Wi-Fi Network Diagnostics": [ "BSSID", "SecurityType", "WiFiVersion", diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 33955572d795ec..c95ce76c77c4b5 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -351,7 +351,7 @@ "ChannelPage0Mask", "OperationalDatasetComponents" ], - "WiFi Network Diagnostics": [ + "Wi-Fi Network Diagnostics": [ "BSSID", "SecurityType", "WiFiVersion", diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 66863228023a7b..475eaec9c76d7c 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -1233,7 +1233,7 @@ ] }, { - "name": "WiFi Network Diagnostics", + "name": "Wi-Fi Network Diagnostics", "code": 54, "mfgCode": null, "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index c5e73b22368081..db7cab28e7b4d2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -3218,7 +3218,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end /** - * Cluster WiFi Network Diagnostics + * Cluster Wi-Fi Network Diagnostics * * The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 29249e35e5a360..24759f5e2c461b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -1498,7 +1498,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end /** - * Cluster WiFi Network Diagnostics + * Cluster Wi-Fi Network Diagnostics * The Wi-Fi Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 2430673bc55724..4ea81bc7bcc6ac 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -234,7 +234,7 @@ class DiagnosticDataProvider virtual CHIP_ERROR ResetEthNetworkDiagnosticsCounts(); /** - * WiFi network diagnostics methods + * Wi-Fi network diagnostics methods */ /** diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index e260c824886cd6..73ae93e310a1a2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -1599,7 +1599,7 @@ chip::Protocols::InteractionModel::Status MatterThreadNetworkDiagnosticsClusterS void emberAfThreadNetworkDiagnosticsClusterServerTickCallback(chip::EndpointId endpoint); // -// WiFi Network Diagnostics Cluster +// Wi-Fi Network Diagnostics Cluster // /** @@ -5567,7 +5567,7 @@ bool emberAfThreadNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::DecodableType & commandData); /** - * @brief WiFi Network Diagnostics Cluster ResetCounts Command callback (from client) + * @brief Wi-Fi Network Diagnostics Cluster ResetCounts Command callback (from client) */ bool emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, From b29c1deb0e8e72be1f6d6d5988b21c8060dbfd91 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Tue, 11 Jun 2024 09:12:37 -0400 Subject: [PATCH 59/78] Allow CommandSender request to be built using DataModel::EncodableToTLV (#33782) Allow CommandSender request to be built using DataModel::EncodableToTLV --- src/app/CommandSender.cpp | 12 ++++++++++++ src/app/CommandSender.h | 40 +++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index af317f76003900..fe263eb8923cc7 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -537,6 +537,18 @@ CHIP_ERROR CommandSender::FinishCommand(FinishCommandParameters & aFinishCommand return FinishCommandInternal(aFinishCommandParams); } +CHIP_ERROR CommandSender::AddRequestData(const CommandPathParams & aCommandPath, const DataModel::EncodableToTLV & aEncodable, + AddRequestDataParameters & aAddRequestDataParams) +{ + PrepareCommandParameters prepareCommandParams(aAddRequestDataParams); + ReturnErrorOnFailure(PrepareCommand(aCommandPath, prepareCommandParams)); + TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); + VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(aEncodable.EncodeTo(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields))); + FinishCommandParameters finishCommandParams(aAddRequestDataParams); + return FinishCommand(finishCommandParams); +} + CHIP_ERROR CommandSender::FinishCommandInternal(FinishCommandParameters & aFinishCommandParams) { CHIP_ERROR err = CHIP_NO_ERROR; diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 25603b3a1f3787..5542d2469bb743 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -375,6 +376,22 @@ class CommandSender final : public Messaging::ExchangeDelegate TLV::TLVWriter * GetCommandDataIBTLVWriter(); + /** + * API for adding request data using DataModel::EncodableToTLV. + * + * @param [in] aCommandPath The path of the command being requested. + * @param [in] aEncodable The request data to encode into the + * `CommandFields` member of `CommandDataIB`. + * @param [in] aAddRequestDataParams parameters associated with building the + * InvokeRequestMessage that are associated with this request. + * + * This API will not fail if this is an untimed invoke but the command provided requires a timed + * invoke interaction. If the caller wants that to fail before sending the command, they should call + * the templated version of AddRequestData. + */ + CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const DataModel::EncodableToTLV & aEncodable, + AddRequestDataParameters & aAddRequestDataParams); + /** * API for adding a data request. The template parameter T is generally * expected to be a ClusterName::Commands::CommandName::Type struct, but any @@ -391,15 +408,18 @@ class CommandSender final : public Messaging::ExchangeDelegate return AddRequestData(aCommandPath, aData, addRequestDataParams); } - template + template , int> = 0> CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const CommandDataT & aData, AddRequestDataParameters & aAddRequestDataParams) { VerifyOrReturnError(!CommandDataT::MustUseTimedInvoke() || aAddRequestDataParams.timedInvokeTimeoutMs.HasValue(), CHIP_ERROR_INVALID_ARGUMENT); - return AddRequestDataInternal(aCommandPath, aData, aAddRequestDataParams); + DataModel::EncodableType encodable(aData); + return AddRequestData(aCommandPath, encodable, aAddRequestDataParams); } + template CHIP_ERROR AddRequestData(const CommandPathParams & aCommandPath, const CommandDataT & aData, const Optional & aTimedInvokeTimeoutMs) @@ -426,7 +446,8 @@ class CommandSender final : public Messaging::ExchangeDelegate CHIP_ERROR TestOnlyAddRequestDataNoTimedCheck(const CommandPathParams & aCommandPath, const CommandDataT & aData, AddRequestDataParameters & aAddRequestDataParams) { - return AddRequestDataInternal(aCommandPath, aData, aAddRequestDataParams); + DataModel::EncodableType encodable(aData); + return AddRequestData(aCommandPath, encodable, aAddRequestDataParams); } CHIP_ERROR TestOnlyFinishCommand(FinishCommandParameters & aFinishCommandParams) @@ -448,19 +469,6 @@ class CommandSender final : public Messaging::ExchangeDelegate #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST private: - template - CHIP_ERROR AddRequestDataInternal(const CommandPathParams & aCommandPath, const CommandDataT & aData, - AddRequestDataParameters & aAddRequestDataParams) - { - PrepareCommandParameters prepareCommandParams(aAddRequestDataParams); - ReturnErrorOnFailure(PrepareCommand(aCommandPath, prepareCommandParams)); - TLV::TLVWriter * writer = GetCommandDataIBTLVWriter(); - VerifyOrReturnError(writer != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnErrorOnFailure(DataModel::Encode(*writer, TLV::ContextTag(CommandDataIB::Tag::kFields), aData)); - FinishCommandParameters finishCommandParams(aAddRequestDataParams); - return FinishCommand(finishCommandParams); - } - CHIP_ERROR FinishCommandInternal(FinishCommandParameters & aFinishCommandParams); public: From bd0422b25ac329323b0ba93808fe7084ec8f2c0a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 11 Jun 2024 10:25:29 -0400 Subject: [PATCH 60/78] Clear Aliro credentials when ClearCredential for all credentials happens. (#33796) We were not clearing credentials of the Aliro types in this situation. --- .../door-lock-server/door-lock-server.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 742afee28480f3..b48327bc6c5ce0 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -3038,6 +3038,24 @@ Status DoorLockServer::clearCredentials(chip::EndpointId endpointId, chip::Fabri ChipLogProgress(Zcl, "[clearCredentials] All face credentials were cleared [endpointId=%d]", endpointId); } + if (SupportsAliroProvisioning(endpointId)) + { + for (auto & credentialType : + { CredentialTypeEnum::kAliroEvictableEndpointKey, CredentialTypeEnum::kAliroCredentialIssuerKey, + CredentialTypeEnum::kAliroNonEvictableEndpointKey }) + { + auto status = clearCredentials(endpointId, modifier, sourceNodeId, credentialType); + if (Status::Success != status) + { + ChipLogError(Zcl, + "[clearCredentials] Unable to clear all Aliro credentials [endpointId=%d,credentialType=%d,status=%d]", + endpointId, to_underlying(credentialType), to_underlying(status)); + return status; + } + } + ChipLogProgress(Zcl, "[clearCredentials] All Aliro credentials were cleared [endpointId=%d]", endpointId); + } + return Status::Success; } From 2ee90eba27676950fa2f4ef96597d9696f510d5d Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Wed, 12 Jun 2024 03:38:24 +0900 Subject: [PATCH 61/78] Implement Android ICD queue Btn (#33743) --- .../clusterclient/WildcardFragment.kt | 83 ++++++++++++------- .../src/main/res/layout/wildcard_fragment.xml | 47 +++++++---- .../app/src/main/res/values/strings.xml | 2 + 3 files changed, 87 insertions(+), 45 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index 4324ba535d886a..f27aede35d19e8 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -174,7 +174,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall setVisibilityEachView(radioBtnId) } - binding.sendBtn.setOnClickListener { showDialog() } + binding.sendBtn.setOnClickListener { showDialog(isICDQueueBtn = false) } binding.shutdownSubscriptionBtn.setOnClickListener { showShutdownSubscriptionDialog() } @@ -183,6 +183,16 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall binding.addListBtn.setOnClickListener { addRequest() } binding.resetBtn.setOnClickListener { resetPath() } binding.writeInvokeresetBtn.setOnClickListener { resetPath() } + binding.icdQueueBtn.setOnCheckedChangeListener { _, isChecked -> + if (isChecked) { + val isSetting = showDialog(isICDQueueBtn = true) + if (!isSetting) { + binding.icdQueueBtn.isChecked = false + } + } else { + resetICDConfig() + } + } addressUpdateFragment = childFragmentManager.findFragmentById(R.id.addressUpdateFragment) as AddressUpdateFragment @@ -202,11 +212,11 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall override fun notifyCheckInMessage() { Log.d(TAG, "notifyCheckInMessage") - if (attributePath.isNotEmpty() || eventPath.isNotEmpty()) { - if (binding.readRadioBtn.isChecked && readICDConfig != null) { - scope.launch { read(readICDConfig!!.isFabricFiltered, readICDConfig!!.eventMin) } - } else if (binding.subscribeRadioBtn.isChecked && subscribeICDConfig != null) { - scope.launch { + scope.launch { + if (attributePath.isNotEmpty() || eventPath.isNotEmpty()) { + if (binding.readRadioBtn.isChecked && readICDConfig != null) { + read(readICDConfig!!.isFabricFiltered, readICDConfig!!.eventMin) + } else if (binding.subscribeRadioBtn.isChecked && subscribeICDConfig != null) { subscribe( subscribeICDConfig!!.minInterval, subscribeICDConfig!!.maxInterval, @@ -215,20 +225,27 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall subscribeICDConfig!!.eventMin ) } - } - } else if ( - binding.writeRadioBtn.isChecked && writePath.isNotEmpty() && writeICDConfig != null - ) { - scope.launch { write(writeICDConfig!!.timedRequestTimeoutMs, writeICDConfig!!.imTimeoutMs) } - } else if ( - binding.invokeRadioBtn.isChecked && invokePath.isNotEmpty() && invokeICDConfig != null - ) { - scope.launch { + } else if ( + binding.writeRadioBtn.isChecked && writePath.isNotEmpty() && writeICDConfig != null + ) { + write(writeICDConfig!!.timedRequestTimeoutMs, writeICDConfig!!.imTimeoutMs) + } else if ( + binding.invokeRadioBtn.isChecked && invokePath.isNotEmpty() && invokeICDConfig != null + ) { invoke(invokeICDConfig!!.timedRequestTimeoutMs, invokeICDConfig!!.imTimeoutMs) } + requireActivity().runOnUiThread { binding.icdQueueBtn.isChecked = false } + resetICDConfig() } } + private fun resetICDConfig() { + readICDConfig = null + subscribeICDConfig = null + writeICDConfig = null + invokeICDConfig = null + } + private fun setVisibilityEachView(radioBtnId: Int) { val readBtnOn = (radioBtnId == R.id.readRadioBtn) val subscribeBtnOn = (radioBtnId == R.id.subscribeRadioBtn) @@ -261,16 +278,20 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall resetPath() } - private fun showDialog() { + private fun showDialog(isICDQueueBtn: Boolean): Boolean { + var ret = false if (binding.readRadioBtn.isChecked) { - showReadDialog() + ret = showReadDialog(isICDQueueBtn) } else if (binding.subscribeRadioBtn.isChecked) { - showSubscribeDialog() + ret = showSubscribeDialog(isICDQueueBtn) } else if (binding.writeRadioBtn.isChecked) { - showWriteDialog() + showWriteDialog(isICDQueueBtn) + ret = true } else if (binding.invokeRadioBtn.isChecked) { - showInvokeDialog() + showInvokeDialog(isICDQueueBtn) + ret = true } + return ret } private fun addRequest() { @@ -547,7 +568,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) } - private fun showReadDialog() { + private fun showReadDialog(isICDQueueBtn: Boolean): Boolean { if (attributePath.isEmpty() && eventPath.isEmpty()) { requireActivity().runOnUiThread { Toast.makeText( @@ -557,7 +578,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) .show() } - return + return false } val dialogView = requireActivity().layoutInflater.inflate(R.layout.read_dialog, null) val eventMinEd = dialogView.findViewById(R.id.eventMinEd) @@ -576,7 +597,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) { eventMin = eventMinEd.text.toString().toULong().toLong() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { readICDConfig = ReadICDConfig(isFabricFilteredEd.selectedItem.toString().toBoolean(), eventMin) } else { @@ -586,9 +607,10 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } } dialog.show() + return true } - private fun showWriteDialog() { + private fun showWriteDialog(isICDQueueBtn: Boolean) { binding.outputTv.text = "" val dialogView = requireActivity().layoutInflater.inflate(R.layout.write_dialog, null) val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() @@ -610,7 +632,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } else { imTimeout.toInt() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { writeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt) } else { write(timedRequestTimeoutInt, imTimeoutInt) @@ -621,7 +643,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall dialog.show() } - private fun showSubscribeDialog() { + private fun showSubscribeDialog(isICDQueueBtn: Boolean): Boolean { if (attributePath.isEmpty() && eventPath.isEmpty()) { requireActivity().runOnUiThread { Toast.makeText( @@ -631,7 +653,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall ) .show() } - return + return false } val dialogView = requireActivity().layoutInflater.inflate(R.layout.subscribe_dialog, null) val eventMinEd = dialogView.findViewById(R.id.eventMinEd) @@ -654,7 +676,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall if (eventPath.isNotEmpty() && eventMinEd.text.isNotBlank()) { eventMin = eventMinEd.text.toString().toULong().toLong() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { subscribeICDConfig = SubscribeICDConfig( minIntervalEd.text.toString().toInt(), @@ -679,9 +701,10 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } } dialog.show() + return true } - private fun showInvokeDialog() { + private fun showInvokeDialog(isICDQueueBtn: Boolean) { binding.outputTv.text = "" val dialogView = requireActivity().layoutInflater.inflate(R.layout.invoke_dialog, null) val dialog = AlertDialog.Builder(requireContext()).apply { setView(dialogView) }.create() @@ -703,7 +726,7 @@ class WildcardFragment : Fragment(), AddressUpdateFragment.ICDCheckInMessageCall } else { imTimeout.toInt() } - if (addressUpdateFragment.isICDDevice()) { + if (isICDQueueBtn) { invokeICDConfig = WriteInvokeICDConfig(timedRequestTimeoutInt, imTimeoutInt) } else { invoke(timedRequestTimeoutInt, imTimeoutInt) diff --git a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml index 4387724ef847ef..a4837875fcd7e5 100644 --- a/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml +++ b/examples/android/CHIPTool/app/src/main/res/layout/wildcard_fragment.xml @@ -299,9 +299,23 @@ android:textSize="16sp" android:visibility="gone" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/sendBtn" + app:layout_constraintEnd_toStartOf="@id/writeInvokeresetBtn" app:layout_constraintTop_toBottomOf="@id/addLayout"/> +