Skip to content

Commit 61668a3

Browse files
authored
Merge branch 'master' into Update_Energy_Cluster_XML_For_1_4
2 parents 81f7009 + 8143615 commit 61668a3

File tree

29 files changed

+789
-210
lines changed

29 files changed

+789
-210
lines changed

.github/workflows/tests.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,16 @@ jobs:
476476
build \
477477
--copy-artifacts-to objdir-clone \
478478
"
479+
- name: Generate an argument environment file
480+
run: |
481+
echo -n "" >/tmp/test_env.yaml
482+
echo "ALL_CLUSTERS_APP: out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app" >> /tmp/test_env.yaml
483+
echo "CHIP_LOCK_APP: out/linux-x64-lock-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-lock-app" >> /tmp/test_env.yaml
484+
echo "ENERGY_MANAGEMENT_APP: out/linux-x64-energy-management-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-energy-management-app" >> /tmp/test_env.yaml
485+
echo "TRACE_APP: out/trace_data/app-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
486+
echo "TRACE_TEST_JSON: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
487+
echo "TRACE_TEST_PERFETTO: out/trace_data/test-{SCRIPT_BASE_NAME}" >> /tmp/test_env.yaml
488+
479489
- name: Run Tests
480490
run: |
481491
mkdir -p out/trace_data
@@ -517,7 +527,7 @@ jobs:
517527
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"'
518528
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"'
519529
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"'
520-
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"'
530+
scripts/run_in_python_env.sh out/venv './scripts/tests/run_python_test.py --load-from-env /tmp/test_env.yaml --script src/python_testing/TC_SC_3_6.py'
521531
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"'
522532
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"'
523533
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"'

.pullapprove.yml

+8
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ groups:
133133
teams: [reviewers-google]
134134
reviews:
135135
request: 10
136+
shared-reviewers-grundfos:
137+
type: optional
138+
conditions:
139+
- files.include('*')
140+
reviewers:
141+
teams: [reviewers-grundfos]
142+
reviews:
143+
request: 10
136144
shared-reviewers-irobot:
137145
type: optional
138146
conditions:

credentials/fetch-paa-certs-from-dcl.py credentials/fetch_paa_certs_from_dcl.py

+56-13
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
PRODUCTION_NODE_URL_REST = "https://on.dcl.csa-iot.org"
3838
TEST_NODE_URL_REST = "https://on.test-net.dcl.csa-iot.org"
3939

40+
MATTER_CERT_CA_SUBJECT = "MFIxDDAKBgNVBAoMA0NTQTEsMCoGA1UEAwwjTWF0dGVyIENlcnRpZmljYXRpb24gYW5kIFRlc3RpbmcgQ0ExFDASBgorBgEEAYKifAIBDARDNUEw"
41+
MATTER_CERT_CA_SUBJECT_KEY_ID = "97:E4:69:D0:C5:04:14:C2:6F:C7:01:F7:7E:94:77:39:09:8D:F6:A5"
42+
4043

4144
def parse_paa_root_certs(cmdpipe, paa_list):
4245
"""
@@ -73,13 +76,14 @@ def parse_paa_root_certs(cmdpipe, paa_list):
7376
else:
7477
if b': ' in line:
7578
key, value = line.split(b': ')
76-
result[key.strip(b' -').decode("utf-8")] = value.strip().decode("utf-8")
79+
result[key.strip(b' -').decode("utf-8")
80+
] = value.strip().decode("utf-8")
7781
parse_paa_root_certs.counter += 1
7882
if parse_paa_root_certs.counter % 2 == 0:
7983
paa_list.append(copy.deepcopy(result))
8084

8185

82-
def write_paa_root_cert(certificate, subject):
86+
def write_cert(certificate, subject):
8387
filename = 'dcld_mirror_' + \
8488
re.sub('[^a-zA-Z0-9_-]', '', re.sub('[=, ]', '_', subject))
8589
with open(filename + '.pem', 'w+') as outfile:
@@ -93,7 +97,8 @@ def write_paa_root_cert(certificate, subject):
9397
serialization.Encoding.DER)
9498
outfile.write(der_certificate)
9599
except (IOError, ValueError) as e:
96-
print(f"ERROR: Failed to convert {filename + '.pem'}: {str(e)}. Skipping...")
100+
print(
101+
f"ERROR: Failed to convert {filename + '.pem'}: {str(e)}. Skipping...")
97102

98103

99104
def parse_paa_root_cert_from_dcld(cmdpipe):
@@ -133,7 +138,38 @@ def use_dcld(dcld, production, cmdlist):
133138
@optgroup.option('--paa-trust-store-path', default='paa-root-certs', type=str, metavar='PATH', help="PAA trust store path (default: paa-root-certs)")
134139
def main(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_http, paa_trust_store_path):
135140
"""DCL PAA mirroring tools"""
141+
fetch_paa_certs(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_http, paa_trust_store_path)
142+
143+
144+
def get_cert_from_rest(rest_node_url, subject, subject_key_id):
145+
response = requests.get(
146+
f"{rest_node_url}/dcl/pki/certificates/{subject}/{subject_key_id}").json()["approvedCertificates"]["certs"][0]
147+
certificate = response["pemCert"].rstrip("\n")
148+
subject = response["subjectAsText"]
149+
return certificate, subject
150+
151+
152+
def fetch_cd_signing_certs(store_path):
153+
''' Only supports using main net http currently.'''
154+
rest_node_url = PRODUCTION_NODE_URL_REST
155+
os.makedirs(store_path, exist_ok=True)
156+
original_dir = os.getcwd()
157+
os.chdir(store_path)
136158

159+
cd_signer_ids = requests.get(
160+
f"{rest_node_url}/dcl/pki/child-certificates/{MATTER_CERT_CA_SUBJECT}/{MATTER_CERT_CA_SUBJECT_KEY_ID}").json()['childCertificates']['certIds']
161+
for signer in cd_signer_ids:
162+
subject = signer['subject']
163+
subject_key_id = signer['subjectKeyId']
164+
certificate, subject = get_cert_from_rest(rest_node_url, subject, subject_key_id)
165+
166+
print(f"Downloaded CD signing cert with subject: {subject}")
167+
write_cert(certificate, subject)
168+
169+
os.chdir(original_dir)
170+
171+
172+
def fetch_paa_certs(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_http, paa_trust_store_path):
137173
production = False
138174
dcld = use_test_net_dcld
139175

@@ -148,36 +184,43 @@ def main(use_main_net_dcld, use_test_net_dcld, use_main_net_http, use_test_net_h
148184
rest_node_url = PRODUCTION_NODE_URL_REST if production else TEST_NODE_URL_REST
149185

150186
os.makedirs(paa_trust_store_path, exist_ok=True)
187+
original_dir = os.getcwd()
151188
os.chdir(paa_trust_store_path)
152189

153190
if use_rest:
154-
paa_list = requests.get(f"{rest_node_url}/dcl/pki/root-certificates").json()["approvedRootCertificates"]["certs"]
191+
paa_list = requests.get(
192+
f"{rest_node_url}/dcl/pki/root-certificates").json()["approvedRootCertificates"]["certs"]
155193
else:
156194
cmdlist = ['query', 'pki', 'all-x509-root-certs']
157195

158-
cmdpipe = subprocess.Popen(use_dcld(dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
196+
cmdpipe = subprocess.Popen(use_dcld(
197+
dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
159198

160199
paa_list = []
161200
parse_paa_root_certs.counter = 0
162201
parse_paa_root_certs(cmdpipe, paa_list)
163202

164203
for paa in paa_list:
204+
if paa['subject'] == MATTER_CERT_CA_SUBJECT and paa['subjectKeyId'] == MATTER_CERT_CA_SUBJECT_KEY_ID:
205+
# Don't include the CD signing cert as a PAA root.
206+
continue
165207
if use_rest:
166-
response = requests.get(
167-
f"{rest_node_url}/dcl/pki/certificates/{paa['subject']}/{paa['subjectKeyId']}").json()["approvedCertificates"]["certs"][0]
168-
certificate = response["pemCert"]
169-
subject = response["subjectAsText"]
208+
certificate, subject = get_cert_from_rest(rest_node_url, paa['subject'], paa['subjectKeyId'])
170209
else:
171-
cmdlist = ['query', 'pki', 'x509-cert', '-u', paa['subject'], '-k', paa['subjectKeyId']]
210+
cmdlist = ['query', 'pki', 'x509-cert', '-u',
211+
paa['subject'], '-k', paa['subjectKeyId']]
172212

173-
cmdpipe = subprocess.Popen(use_dcld(dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
213+
cmdpipe = subprocess.Popen(use_dcld(
214+
dcld, production, cmdlist), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
174215

175216
(certificate, subject) = parse_paa_root_cert_from_dcld(cmdpipe)
176217

177218
certificate = certificate.rstrip('\n')
178219

179-
print(f"Downloaded certificate with subject: {subject}")
180-
write_paa_root_cert(certificate, subject)
220+
print(f"Downloaded PAA certificate with subject: {subject}")
221+
write_cert(certificate, subject)
222+
223+
os.chdir(original_dir)
181224

182225

183226
if __name__ == "__main__":

examples/bridge-app/linux/main.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ int AddDeviceEndpoint(Device * dev, EmberAfEndpointType * ep, const Span<const E
278278
}
279279
if (err != CHIP_ERROR_ENDPOINT_EXISTS)
280280
{
281+
gDevices[index] = nullptr;
281282
return -1;
282283
}
283284
// Handle wrap condition

examples/fabric-bridge-app/linux/DeviceManager.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ int DeviceManager::AddDeviceEndpoint(Device * dev, chip::EndpointId parentEndpoi
161161
}
162162
if (err != CHIP_ERROR_ENDPOINT_EXISTS)
163163
{
164+
mDevices[index] = nullptr;
164165
return -1; // Return error as endpoint addition failed due to an error other than endpoint already exists
165166
}
166167
// Increment the endpoint ID and handle wrap condition
@@ -171,6 +172,7 @@ int DeviceManager::AddDeviceEndpoint(Device * dev, chip::EndpointId parentEndpoi
171172
retryCount++;
172173
}
173174
ChipLogError(NotSpecified, "Failed to add dynamic endpoint after %d retries", kMaxRetries);
175+
mDevices[index] = nullptr;
174176
return -1; // Return error as all retries are exhausted
175177
}
176178
index++;

scripts/build_python.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export SYSTEM_VERSION_COMPAT=0
184184
# Make all possible human redable tracing available.
185185
tracing_options="matter_log_json_payload_hex=true matter_log_json_payload_decode_full=true matter_enable_tracing_support=true"
186186

187-
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble"
187+
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args="$tracing_options chip_detail_logging=$chip_detail_logging enable_pylib=$enable_pybindings enable_rtti=$enable_pybindings chip_project_config_include_dirs=[\"//config/python\"] $chip_mdns_arg $chip_case_retry_arg $pregen_dir_arg chip_config_network_layer_ble=$enable_ble chip_enable_ble=$enable_ble chip_crypto=\"boringssl\""
188188

189189
function ninja_target() {
190190
# Print the ninja target required to build a gn label.

0 commit comments

Comments
 (0)