wiliot-certificate 4.5.0a3__py3-none-any.whl → 4.5.0a4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- certificate/cert_common.py +33 -16
- certificate/cert_config.py +3 -3
- certificate/cert_data_sim.py +12 -9
- certificate/cert_defines.py +6 -0
- certificate/cert_gw_sim.py +3 -3
- certificate/cert_mqtt.py +5 -4
- certificate/cert_results.py +42 -32
- certificate/cert_utils.py +9 -10
- certificate/certificate.py +7 -5
- certificate/certificate_cli.py +9 -12
- certificate/tests/cloud_connectivity/acl_test/acl_test.py +13 -15
- certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.json +1 -1
- certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py +2 -2
- certificate/tests/cloud_connectivity/connection_test/connection_test.py +4 -13
- certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.py +1 -2
- certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.py +12 -6
- certificate/tests/cloud_connectivity/registration_test/registration_test_cli.py +1 -1
- certificate/tests/cloud_connectivity/stress_test/stress_test.py +12 -7
- certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.py +1 -2
- certificate/tests/cloud_connectivity/uplink_test/uplink_test.py +26 -20
- certificate/tests/datapath/event_ble5_test/event_ble5_test.json +1 -1
- certificate/tests/datapath/event_ble5_test/event_ble5_test.py +1 -9
- certificate/tests/datapath/event_test/event_test.json +1 -1
- certificate/tests/datapath/event_test/event_test.py +1 -7
- certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +1 -1
- certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +3 -1
- certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.py +2 -0
- certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +1 -1
- common/api_if/api_validation.py +6 -0
- gui_certificate/server.py +151 -58
- gui_certificate/templates/cert_run.html +86 -93
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/METADATA +3 -3
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/RECORD +37 -53
- certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +0 -211
- certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +0 -894
- certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +0 -184
- certificate/ag/wlt_types_ag_jsons/calibration.json +0 -490
- certificate/ag/wlt_types_ag_jsons/custom.json +0 -614
- certificate/ag/wlt_types_ag_jsons/datapath.json +0 -900
- certificate/ag/wlt_types_ag_jsons/energy2400.json +0 -670
- certificate/ag/wlt_types_ag_jsons/energySub1g.json +0 -691
- certificate/ag/wlt_types_ag_jsons/externalSensor.json +0 -727
- certificate/ag/wlt_types_ag_jsons/interface.json +0 -1095
- certificate/ag/wlt_types_ag_jsons/powerManagement.json +0 -1439
- certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +0 -105
- certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +0 -77
- certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +0 -126
- certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +0 -175
- certificate/ag/wlt_types_ag_jsons/unified_sensor_pkt.json +0 -65
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/WHEEL +0 -0
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/entry_points.txt +0 -0
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/licenses/LICENSE +0 -0
- {wiliot_certificate-4.5.0a3.dist-info → wiliot_certificate-4.5.0a4.dist-info}/top_level.txt +0 -0
certificate/cert_common.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
from certificate.cert_prints import *
|
|
2
2
|
from certificate.cert_defines import *
|
|
3
3
|
from certificate.wlt_types import *
|
|
4
|
-
from certificate.cert_utils import Phase
|
|
5
|
-
from certificate.cert_utils import *
|
|
6
4
|
import certificate.cert_utils as cert_utils
|
|
7
5
|
import certificate.cert_config as cert_config
|
|
8
6
|
import certificate.cert_mqtt as cert_mqtt
|
|
@@ -776,8 +774,7 @@ def scan_for_modules(test, modules=[]):
|
|
|
776
774
|
|
|
777
775
|
|
|
778
776
|
def search_action_ack(test, action_id, **kwargs):
|
|
779
|
-
test, mgmt_pkts =
|
|
780
|
-
mgmt_type=[eval_pkt(f'{ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version}')])
|
|
777
|
+
test, mgmt_pkts = scan_for_mgmt_pkts(test, mgmt_type=[eval_pkt(f'{ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version}')])
|
|
781
778
|
if test.rc == TEST_FAILED:
|
|
782
779
|
return test
|
|
783
780
|
print("\nReceived ACK pkts:")
|
|
@@ -1051,8 +1048,9 @@ def get_gw_type(mqttc):
|
|
|
1051
1048
|
|
|
1052
1049
|
def get_module_if_pkt(test):
|
|
1053
1050
|
cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, interface=1)
|
|
1054
|
-
|
|
1055
|
-
|
|
1051
|
+
mgmt_type = [m for m in ag.MODULES_LIST if "ModuleIf" in m.__name__]
|
|
1052
|
+
test, pkts = scan_for_mgmt_pkts(test, mgmt_type=mgmt_type)
|
|
1053
|
+
|
|
1056
1054
|
if test.rc == TEST_FAILED:
|
|
1057
1055
|
return test, NO_RESPONSE
|
|
1058
1056
|
else:
|
|
@@ -1273,10 +1271,28 @@ def output_power_supported(board_type, output_power):
|
|
|
1273
1271
|
else:
|
|
1274
1272
|
return output_power in ag.OUTPUT_POWER_2_4_SUPPORTED_VALUES
|
|
1275
1273
|
|
|
1274
|
+
|
|
1275
|
+
def validate_received_packets(pkts_array):
|
|
1276
|
+
for pkt in pkts_array:
|
|
1277
|
+
# Check all required fields are present
|
|
1278
|
+
if TIMESTAMP not in pkt:
|
|
1279
|
+
return False, "timestamp field is missing in some of the packets"
|
|
1280
|
+
if ALIAS_BRIDGE_ID not in pkt:
|
|
1281
|
+
return False, "alias_bridge_id field is missing in some of the packets"
|
|
1282
|
+
if PAYLOAD not in pkt:
|
|
1283
|
+
return False, "payload field is missing in some of the packets"
|
|
1284
|
+
if SEQUENCE_ID not in pkt:
|
|
1285
|
+
return False, "sequence_id field is missing in some of the packets"
|
|
1286
|
+
# Check that the payload length is either 62 or 74 hex characters (equevelnt to 31 or 37 bytes)
|
|
1287
|
+
if len(pkt[PAYLOAD]) != 62 and len(pkt[PAYLOAD]) !=74:
|
|
1288
|
+
return False, f"Payload length is invalid for packet {pkt[PAYLOAD]}"
|
|
1289
|
+
return True, ""
|
|
1290
|
+
|
|
1291
|
+
|
|
1276
1292
|
def wiliot_pkts_validation(test, all_messages_in_test, all_data_pkts):
|
|
1277
1293
|
PHASE_NAME = "Wiliot packets validation"
|
|
1278
1294
|
phase_run_print(PHASE_NAME)
|
|
1279
|
-
wiliot_pkts_validation_phase = Phase(PHASE_NAME, rc=TEST_PASSED)
|
|
1295
|
+
wiliot_pkts_validation_phase = cert_utils.Phase(PHASE_NAME, rc=TEST_PASSED)
|
|
1280
1296
|
|
|
1281
1297
|
if len(all_messages_in_test) == 0:
|
|
1282
1298
|
wiliot_pkts_validation_phase.rc = TEST_FAILED
|
|
@@ -1358,9 +1374,9 @@ def timestamps_validation(wiliot_pkts_validation_phase, all_messages_in_test, up
|
|
|
1358
1374
|
return wiliot_pkts_validation_phase
|
|
1359
1375
|
previous_ts = inner_pkt[TIMESTAMP]
|
|
1360
1376
|
else:
|
|
1361
|
-
if inner_pkt[TIMESTAMP]
|
|
1377
|
+
if inner_pkt[TIMESTAMP] <= previous_ts:
|
|
1362
1378
|
wiliot_pkts_validation_phase.rc = TEST_FAILED
|
|
1363
|
-
wiliot_pkts_validation_phase.reason = f'Timestamp is not incremental for inner packet {inner_pkt}'
|
|
1379
|
+
wiliot_pkts_validation_phase.reason = f'Timestamp is not incremental for inner packet {inner_pkt[PAYLOAD]}'
|
|
1364
1380
|
return wiliot_pkts_validation_phase
|
|
1365
1381
|
previous_ts = inner_pkt[TIMESTAMP]
|
|
1366
1382
|
return wiliot_pkts_validation_phase
|
|
@@ -1438,21 +1454,22 @@ def stress_analysis(test, pps, sent_pkts, received_pkts):
|
|
|
1438
1454
|
|
|
1439
1455
|
# PASS/FAIL logic
|
|
1440
1456
|
if percentage_received < 1: # If less than 1% of the packets were received, fail the test
|
|
1441
|
-
test.
|
|
1442
|
-
test.
|
|
1457
|
+
test.set_phase_rc(str(pps), TEST_FAILED)
|
|
1458
|
+
test.add_phase_reason(str(pps), "Insufficient amount of packets were scanned & uploaded by the gateway")
|
|
1443
1459
|
else:
|
|
1444
|
-
test.
|
|
1460
|
+
test.set_phase_rc(str(pps), TEST_PASSED)
|
|
1461
|
+
test.add_phase_reason(str(pps), f"received pps: {received_pps} ({percentage_received}% of packets)")
|
|
1445
1462
|
|
|
1446
1463
|
return test, received_pps
|
|
1447
1464
|
|
|
1448
1465
|
|
|
1449
1466
|
def generate_adv_payload(test_indicator, unique_pkt=False):
|
|
1450
1467
|
# Keep last 4 bytes as zeroes so for incrementing them in FW 'ble_sim'
|
|
1451
|
-
adva = hex2alias_id_get(
|
|
1452
|
-
unique_pkt_byte =
|
|
1468
|
+
adva = hex2alias_id_get(get_random_hex_str(12))
|
|
1469
|
+
unique_pkt_byte = get_random_hex_str(2) if unique_pkt == False else "00"
|
|
1453
1470
|
payload = (ag.Hdr(group_id=ag.GROUP_ID_UNIFIED_PKT_V2).dump() + test_indicator +
|
|
1454
|
-
|
|
1471
|
+
get_random_hex_str(32) + unique_pkt_byte + "00000000")
|
|
1455
1472
|
return adva + payload
|
|
1456
1473
|
|
|
1457
1474
|
def change_endianness(hex_str: str) -> str:
|
|
1458
|
-
return ''.join(f"{b:02X}" for b in bytes.fromhex(hex_str)[::-1])
|
|
1475
|
+
return ''.join(f"{b:02X}" for b in bytes.fromhex(hex_str)[::-1])
|
certificate/cert_config.py
CHANGED
|
@@ -41,6 +41,8 @@ def gw_configure(test, cfg={}, version="", extended_cfg={}, ret_pkt=False, wait=
|
|
|
41
41
|
for p in cert_mqtt.get_all_status_pkts(mqttc):
|
|
42
42
|
if GW_CONF in p or GW_STATUS in p:
|
|
43
43
|
test.gw_api_version = p[GW_CONF][GW_API_VERSION] if GW_CONF in p else p[GW_STATUS][GW_API_VERSION]
|
|
44
|
+
if target == DUT and is_gw(test.dut):
|
|
45
|
+
test.dut.gw_api_version = test.gw_api_version
|
|
44
46
|
print_pkt(p)
|
|
45
47
|
utPrint("SUCCESS: Found GW cfg", "GREEN")
|
|
46
48
|
wait_time_n_print(2)
|
|
@@ -351,9 +353,7 @@ def get_default_brg_pkt(test, pkt_type, group_id=ag.GROUP_ID_GW2BRG, seq_id=0, t
|
|
|
351
353
|
seq_id = test.get_seq_id() if seq_id == 0 else seq_id
|
|
352
354
|
# Bypass from default sub1g ep cfg of 0 (no energizing) ONLY if not using data simulation
|
|
353
355
|
if "ModuleEnergySub1G" in pkt_type.__name__ and BRG_PATTERN not in kwargs and test.data != DATA_SIMULATION:
|
|
354
|
-
|
|
355
|
-
brg_pattern = "sub1g_energy_" + BRG_PATTERN if brg.api_version < ag.API_VERSION_V12 else BRG_PATTERN
|
|
356
|
-
kwargs.update({brg_pattern: ag.SUB1G_ENERGY_PATTERN_ISRAEL})
|
|
356
|
+
kwargs.update({BRG_PATTERN: ag.SUB1G_ENERGY_PATTERN_ISRAEL})
|
|
357
357
|
brg_pkt = WltPkt(hdr=ag.Hdr(group_id=group_id), pkt=pkt_type(brg_mac=brg.id_int if brg else 0, seq_id=seq_id, **kwargs))
|
|
358
358
|
return brg_pkt
|
|
359
359
|
|
certificate/cert_data_sim.py
CHANGED
|
@@ -23,10 +23,10 @@ SECONDARY_CHANNEL_10 = 10
|
|
|
23
23
|
SECONDARY_CHANNEL_21 = 21
|
|
24
24
|
|
|
25
25
|
# Randomize pixel simulation indicator once per run (6 hex chars)
|
|
26
|
-
PIXEL_SIM_INDICATOR
|
|
26
|
+
PIXEL_SIM_INDICATOR = get_random_hex_str(6)
|
|
27
27
|
|
|
28
28
|
def init_adva(flow_version_major=0x4, flow_version_minor=0x34):
|
|
29
|
-
return "{0:02X}".format(flow_version_major) +
|
|
29
|
+
return "{0:02X}".format(flow_version_major) + get_random_hex_str(8) + "{0:02X}".format(flow_version_minor)
|
|
30
30
|
|
|
31
31
|
random_bytes = lambda n: int.from_bytes(os.urandom(n), "big")
|
|
32
32
|
|
|
@@ -41,15 +41,16 @@ def brg_pkt_gen(num_of_pkts_per_brg, num_of_brgs, brgs_list=[], pkt_type=PIXELS_
|
|
|
41
41
|
if brgs_list:
|
|
42
42
|
brg_mac = brgs_list[i]
|
|
43
43
|
else:
|
|
44
|
-
brg_mac = cert_common.hex2alias_id_get(
|
|
44
|
+
brg_mac = cert_common.hex2alias_id_get(get_random_hex_str(12))
|
|
45
45
|
bridge_ids.append(brg_mac)
|
|
46
46
|
adva = cert_common.change_endianness(brg_mac) # Change endianness to little endian
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
for j in range(num_of_pkts_per_brg):
|
|
49
|
-
serial_pkt_id = f"{i % 256:02X}{j % 256:02X}{idx:04X}"
|
|
50
|
-
|
|
49
|
+
serial_pkt_id = f"{i % 256:02X}{j % 256:02X}{idx:04X}" # 8 hex chars - 4 bytes
|
|
50
|
+
|
|
51
51
|
if pkt_type == PIXELS_PKT:
|
|
52
|
-
payload = ag.Hdr(group_id=ag.GROUP_ID_UNIFIED_PKT_V2).dump() +
|
|
52
|
+
payload = (ag.Hdr(group_id=ag.GROUP_ID_UNIFIED_PKT_V2).dump() +
|
|
53
|
+
indicator + brg_mac + get_random_hex_str(22) + serial_pkt_id)
|
|
53
54
|
|
|
54
55
|
if pkt_type == MGMT_PKT:
|
|
55
56
|
mgmt_pkt = eval_pkt(f'GenericV{ag.API_VERSION_LATEST}')
|
|
@@ -57,10 +58,12 @@ def brg_pkt_gen(num_of_pkts_per_brg, num_of_brgs, brgs_list=[], pkt_type=PIXELS_
|
|
|
57
58
|
payload = ag.Hdr(group_id=ag.GROUP_ID_BRG2GW).dump() + body.dump()[:-14] + indicator + serial_pkt_id
|
|
58
59
|
|
|
59
60
|
if pkt_type == SENSOR_PKT:
|
|
60
|
-
payload = ag.Hdr(uuid_msb=ag.HDR_DEFAULT_BRG_SENSOR_UUID_MSB, uuid_lsb=ag.HDR_DEFAULT_BRG_SENSOR_UUID_LSB).dump() +
|
|
61
|
+
payload = (ag.Hdr(uuid_msb=ag.HDR_DEFAULT_BRG_SENSOR_UUID_MSB, uuid_lsb=ag.HDR_DEFAULT_BRG_SENSOR_UUID_LSB).dump() +
|
|
62
|
+
indicator + brg_mac + get_random_hex_str(22) + serial_pkt_id)
|
|
61
63
|
|
|
62
64
|
if pkt_type == SIDE_INFO_SENSOR_PKT:
|
|
63
|
-
payload = ag.Hdr(group_id=ag.GROUP_ID_SIDE_INFO_SENSOR).dump() +
|
|
65
|
+
payload = (ag.Hdr(group_id=ag.GROUP_ID_SIDE_INFO_SENSOR).dump() +
|
|
66
|
+
indicator + brg_mac + get_random_hex_str(22) + serial_pkt_id)
|
|
64
67
|
|
|
65
68
|
idx += 1
|
|
66
69
|
pkts += [GenericPkt(adva=adva, payload=payload)]
|
certificate/cert_defines.py
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# Files
|
|
2
2
|
import os
|
|
3
|
+
import random
|
|
3
4
|
import datetime
|
|
4
5
|
import importlib.metadata
|
|
5
6
|
import certificate.ag.wlt_types_ag as ag
|
|
7
|
+
|
|
8
|
+
get_random_hex_str = lambda n: ''.join([random.choice('0123456789ABCDEF') for _ in range(n)])
|
|
9
|
+
|
|
6
10
|
# BASE_DIR should be initiated in the same dir as certificate.py
|
|
7
11
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
8
12
|
ARTIFACTS_DIR = os.path.join(os.getcwd(), f"cert_artifacts_{datetime.datetime.now().strftime("%d_%m_%Y__%H_%M_%S")}")
|
|
13
|
+
|
|
9
14
|
# CERT_VERSION handling - local/PyPi
|
|
10
15
|
LOCAL_DEV = "local-dev"
|
|
11
16
|
try:
|
|
@@ -278,6 +283,7 @@ GW_LONGITUDE_DEFAULT = -117.0839
|
|
|
278
283
|
GW_API_VER_DEFAULT = "201"
|
|
279
284
|
GW_API_VER_OLD = "200"
|
|
280
285
|
GW_API_VER_LATEST = "206"
|
|
286
|
+
API_OLDEST_SUPPORTED_VERSION = ag.API_VERSION_V12
|
|
281
287
|
BRG_CFG_HAS_LEN = 2
|
|
282
288
|
CLEAR_DATA_PATH_TIMEOUT = 10
|
|
283
289
|
ACTION_LONG_TIMEOUT = 120
|
certificate/cert_gw_sim.py
CHANGED
|
@@ -330,10 +330,10 @@ def handle_cmds(input, ble_serial):
|
|
|
330
330
|
GW_SIM_RESET_TS = datetime.datetime.now()
|
|
331
331
|
write_to_ble(ble_serial, RESET_GW, sleep=0)
|
|
332
332
|
if input.startswith(RX_NORDIC_RECOVER_NORESET):
|
|
333
|
-
utPrint(f"
|
|
333
|
+
utPrint(f"COM tester recovered", "CYAN")
|
|
334
334
|
write_to_ble(ble_serial, f"{CONNECTIVITY_STATUS} 1 1")
|
|
335
335
|
|
|
336
|
-
def gw_sim_run(port, gw_id, custom_broker,
|
|
336
|
+
def gw_sim_run(port, gw_id, custom_broker, disable_interference_analyzer=False):
|
|
337
337
|
|
|
338
338
|
# Init serial side
|
|
339
339
|
if not port:
|
|
@@ -378,7 +378,7 @@ def gw_sim_run(port, gw_id, custom_broker, analyze_interference=False):
|
|
|
378
378
|
write_to_ble(ble_serial, f"{CONNECTIVITY_STATUS} 1 1")
|
|
379
379
|
|
|
380
380
|
# Run interference analysis
|
|
381
|
-
if
|
|
381
|
+
if not disable_interference_analyzer:
|
|
382
382
|
print(color("BLUE", f"\nStarting interference analysis for channels {[ch[0] for ch in CHANNELS_TO_ANALYZE]}. This will take {30 * len(CHANNELS_TO_ANALYZE)} seconds (total)"))
|
|
383
383
|
interference_analysis(ble_serial)
|
|
384
384
|
|
certificate/cert_mqtt.py
CHANGED
|
@@ -198,7 +198,8 @@ def on_message_json(mqttc, userdata, message):
|
|
|
198
198
|
wlt_mqtt_pkts = userdata[PKTS]
|
|
199
199
|
data = json.loads(message.payload.decode("utf-8"))
|
|
200
200
|
wlt_mqtt_pkts.insert(WltMqttPkt(data, message.topic, userdata))
|
|
201
|
-
|
|
201
|
+
text = json.dumps(json.loads(message.payload.decode("utf-8")), indent=4)
|
|
202
|
+
write_to_mqtt_log_file("// JSON message received at {}, topic={}:\n{}\n".format(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), message.topic, text))
|
|
202
203
|
|
|
203
204
|
def on_message_protobuf(mqttc, userdata, message):
|
|
204
205
|
pb_msg = None
|
|
@@ -264,9 +265,9 @@ def load_custom_broker(broker_filepath, gw):
|
|
|
264
265
|
except FileNotFoundError:
|
|
265
266
|
raise FileNotFoundError(f"No such file: {broker_filepath}")
|
|
266
267
|
data = json.load(f)
|
|
267
|
-
data[CUSTOM_BROKER_UPDATE_TOPIC]
|
|
268
|
-
data[CUSTOM_BROKER_STATUS_TOPIC]
|
|
269
|
-
data[CUSTOM_BROKER_DATA_TOPIC]
|
|
268
|
+
data[CUSTOM_BROKER_UPDATE_TOPIC] = data[CUSTOM_BROKER_UPDATE_TOPIC].replace(f'<{GW_ID}>', gw)
|
|
269
|
+
data[CUSTOM_BROKER_STATUS_TOPIC] = data[CUSTOM_BROKER_STATUS_TOPIC].replace(f'<{GW_ID}>', gw)
|
|
270
|
+
data[CUSTOM_BROKER_DATA_TOPIC] = data[CUSTOM_BROKER_DATA_TOPIC].replace(f'<{GW_ID}>', gw)
|
|
270
271
|
return data
|
|
271
272
|
|
|
272
273
|
def mqttc_init(gw_id, custom_broker, data=DATA_REAL_TAGS):
|
certificate/cert_results.py
CHANGED
|
@@ -31,6 +31,7 @@ CERT_VER = "Certificate Version"
|
|
|
31
31
|
TESTING_DEVICE_INFO = "Testing Device Information"
|
|
32
32
|
TESTED_DEVICE_INFO = "Tested Device Information"
|
|
33
33
|
SIM = "Simulator"
|
|
34
|
+
GATEWAY = "Gateway"
|
|
34
35
|
BRG = "Bridge"
|
|
35
36
|
BLE_MAC_ADDRESS = "BLE MAC Address"
|
|
36
37
|
BOARD_TYPE = "Board Type"
|
|
@@ -113,32 +114,24 @@ def get_important_tests_info():
|
|
|
113
114
|
patterns = ["DISCONNECTED", "WLT_ERROR", "free heap size", "python_mqtt_disconnect"]
|
|
114
115
|
return "".join([l.strip(' "') for l in open(os.path.join(ARTIFACTS_DIR, CERT_MQTT_LOG_FILE)).readlines() if any([p in l for p in patterns])])
|
|
115
116
|
|
|
116
|
-
def generate_results_files(
|
|
117
|
+
def generate_results_files(html=True, pdf=True, failures=0, skipped=0, start_time=datetime.datetime.now(), tests=[], error=None, non_cert_run=False):
|
|
117
118
|
print(cert_prints.SEP)
|
|
118
119
|
duration = (datetime.datetime.now()-start_time)
|
|
119
120
|
print("Tests duration: {}".format(str(duration).split(".")[0]))
|
|
120
121
|
pipeline = cert_prints.pipeline_running()
|
|
121
|
-
|
|
122
|
-
if
|
|
123
|
-
|
|
124
|
-
if isinstance(brg, cert_utils.Bridge):
|
|
125
|
-
print("Bridge version: {}".format(brg.version))
|
|
122
|
+
test = tests[-1] if tests else None
|
|
123
|
+
if test and test.dut_is_bridge():
|
|
124
|
+
print("Bridge version: {}".format(test.dut.version))
|
|
126
125
|
if not error:
|
|
127
126
|
print(generate_tests_table(tests))
|
|
128
127
|
print(tabulate.tabulate([[len(tests), len(tests)-(failures+skipped), skipped, failures, len(tests)]],
|
|
129
128
|
headers=["FINISHED", "PASSED", "SKIPPED", "FAILED", "TOTAL"], tablefmt="pretty"))
|
|
130
129
|
print(cert_prints.WIL_CERT_TEXT)
|
|
131
130
|
cert_prints.print_warn(get_important_tests_info())
|
|
131
|
+
print(f"Run artifacts saved in \"{ARTIFACTS_DIR}\" directory")
|
|
132
132
|
run_type = headline_get(non_cert_run, "").strip()
|
|
133
133
|
cert_prints.print_pass_or_fail(not failures and not error, run_type)
|
|
134
134
|
|
|
135
|
-
# Get internal_brg from dut or tester
|
|
136
|
-
internal_brg = None
|
|
137
|
-
if dut and isinstance(dut, cert_utils.Gateway) and dut.has_internal_brg():
|
|
138
|
-
internal_brg = dut.internal_brg
|
|
139
|
-
elif tester:
|
|
140
|
-
internal_brg = tester.internal_brg
|
|
141
|
-
|
|
142
135
|
# Generate HTML file
|
|
143
136
|
if html:
|
|
144
137
|
file_path = os.path.join(ARTIFACTS_DIR, UT_RESULT_FILE_HTML)
|
|
@@ -160,8 +153,8 @@ def generate_results_files(dut=None, tester=None, html=True, pdf=True, failures=
|
|
|
160
153
|
f.write(update_status + "<br><br>")
|
|
161
154
|
f.write(error + "<br><br>")
|
|
162
155
|
f.write(f"{RUN_DUR}: {str(duration).split('.')[0]} <br><br>")
|
|
163
|
-
if
|
|
164
|
-
f.write(f"{BRG} {BLE_VER}: {
|
|
156
|
+
if test and test.dut_is_bridge():
|
|
157
|
+
f.write(f"{BRG} {BLE_VER}: {test.dut.version} <br><br>")
|
|
165
158
|
elif tests:
|
|
166
159
|
if not failures and ("successfully!" in update_status or "skipped!" in update_status or not pipeline):
|
|
167
160
|
headline = headline_get(non_cert_run, "Passed!")
|
|
@@ -176,12 +169,19 @@ def generate_results_files(dut=None, tester=None, html=True, pdf=True, failures=
|
|
|
176
169
|
f.write(f"{RUN_DATETIME}: {start_time.strftime('%d/%m/%Y, %H:%M:%S')} <br><br>")
|
|
177
170
|
f.write(f"{RUN_DUR}: {str(duration).split('.')[0]} <br><br>")
|
|
178
171
|
f.write(f"{CERT_VER}: {CERT_VERSION} <br><br>")
|
|
179
|
-
if
|
|
180
|
-
f.write(f"{
|
|
181
|
-
f.write(f"{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
172
|
+
if test and test.dut_is_gateway():
|
|
173
|
+
f.write(f"{GATEWAY} ID: {test.dut.id_str} <br><br>")
|
|
174
|
+
f.write(f"{GATEWAY} {SUP_API_VER}: {test.dut.gw_api_version} <br><br>")
|
|
175
|
+
if test.dut_is_combo():
|
|
176
|
+
f.write(f"{BRG} {BLE_MAC_ADDRESS}: {test.dut.internal_brg.id_str} <br><br>")
|
|
177
|
+
f.write(f"{BRG} {BLE_VER}: {test.dut.internal_brg.version} <br><br>")
|
|
178
|
+
if test.dut_is_bridge():
|
|
179
|
+
f.write(f"{BRG} {BLE_MAC_ADDRESS}: {test.dut.id_str} <br><br>")
|
|
180
|
+
f.write(f"{BRG} {BLE_VER}: {test.dut.version} <br><br>")
|
|
181
|
+
if test.tester:
|
|
182
|
+
f.write(f"{SIM} {BLE_MAC_ADDRESS}: {test.tester.internal_brg.id_str} <br><br>")
|
|
183
|
+
f.write(f"{SIM} {BLE_VER}: {test.tester.internal_brg.version} <br><br>")
|
|
184
|
+
|
|
185
185
|
f.write(tabulate.tabulate([[len(tests)-(failures+skipped), skipped, failures, len(tests)]], headers=["PASSED", "SKIPPED", "FAILED", "TOTAL"], tablefmt="html"))
|
|
186
186
|
f.write(generate_tests_table(tests, html=True))
|
|
187
187
|
f.write("<br><br>")
|
|
@@ -243,20 +243,26 @@ def generate_results_files(dut=None, tester=None, html=True, pdf=True, failures=
|
|
|
243
243
|
hdr_page.append(Paragraph(f"{RUN_DUR}: {str(duration).split('.')[0]}", bold_text_style))
|
|
244
244
|
hdr_page.append(Paragraph(f"{CERT_VER}: {CERT_VERSION}", bold_text_style))
|
|
245
245
|
hdr_page.append(Spacer(1, 10))
|
|
246
|
-
if
|
|
246
|
+
if test:
|
|
247
247
|
hdr_page.append(Paragraph(f"<u>{TESTED_DEVICE_INFO}:</u>", bold_text_style))
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
if test.dut_is_gateway():
|
|
249
|
+
hdr_page.append(Paragraph(f"{GATEWAY} ID: {test.dut.id_str}", bold_text_style))
|
|
250
|
+
hdr_page.append(Paragraph(f"{GATEWAY} {SUP_API_VER}: {test.dut.gw_api_version}", bold_text_style))
|
|
251
|
+
if test.dut_is_combo() or test.dut_is_bridge():
|
|
252
|
+
brg = test.dut.internal_brg if test.dut_is_combo() else test.dut
|
|
253
|
+
hdr_page.append(Paragraph(f"{BRG} {BLE_MAC_ADDRESS}: {brg.id_str}", bold_text_style))
|
|
250
254
|
hdr_page.append(Paragraph(f"{BRG} {BOARD_TYPE}: {ag.BOARD_TYPES_LIST[brg.board_type]}", bold_text_style))
|
|
251
255
|
hdr_page.append(Paragraph(f"{BRG} {BLE_VER}: {brg.version}", bold_text_style))
|
|
252
256
|
hdr_page.append(Paragraph(f"{BRG} {SUP_API_VER}: {brg.api_version}", bold_text_style))
|
|
257
|
+
hdr_page.append(Spacer(1, 10))
|
|
258
|
+
|
|
259
|
+
# In wlt-cert-reg there is no tester
|
|
260
|
+
if test.tester:
|
|
261
|
+
hdr_page.append(Paragraph(f"<u>{TESTING_DEVICE_INFO}:</u>", bold_text_style))
|
|
262
|
+
hdr_page.append(Paragraph(f"{SIM} {BLE_MAC_ADDRESS}: {test.tester.internal_brg.id_str}", bold_text_style))
|
|
263
|
+
hdr_page.append(Paragraph(f"{SIM} {BOARD_TYPE}: {ag.BOARD_TYPES_LIST[test.tester.internal_brg.board_type]}", bold_text_style))
|
|
264
|
+
hdr_page.append(Paragraph(f"{SIM} {BLE_VER}: {test.tester.internal_brg.version}", bold_text_style))
|
|
253
265
|
hdr_page.append(Spacer(1, 10))
|
|
254
|
-
if internal_brg:
|
|
255
|
-
hdr_page.append(Paragraph(f"<u>{TESTING_DEVICE_INFO}:</u>", bold_text_style))
|
|
256
|
-
hdr_page.append(Paragraph(f"{SIM} {BLE_MAC_ADDRESS}: {internal_brg.id_str}", bold_text_style))
|
|
257
|
-
hdr_page.append(Paragraph(f"{SIM} {BOARD_TYPE}: {ag.BOARD_TYPES_LIST[internal_brg.board_type]}", bold_text_style))
|
|
258
|
-
hdr_page.append(Paragraph(f"{SIM} {BLE_VER}: {internal_brg.version}", bold_text_style))
|
|
259
|
-
hdr_page.append(Paragraph(f"{SIM} {SUP_API_VER}: {internal_brg.api_version}", bold_text_style))
|
|
260
266
|
notes_file_path = os.path.join(ARTIFACTS_DIR, RESULT_NOTES_FILE)
|
|
261
267
|
if os.path.exists(notes_file_path):
|
|
262
268
|
hdr_page.append(Paragraph(f"<u>{ADD_INFO}:</u>", bold_text_style))
|
|
@@ -340,8 +346,12 @@ def generate_results_files(dut=None, tester=None, html=True, pdf=True, failures=
|
|
|
340
346
|
import io
|
|
341
347
|
from botocore.exceptions import ClientError
|
|
342
348
|
|
|
343
|
-
|
|
344
|
-
|
|
349
|
+
if test:
|
|
350
|
+
device_id = f"{test.dut.id_str}:{test.dut.internal_brg.id_str}" if test.dut_is_combo() else test.dut.id_str
|
|
351
|
+
version = test.dut.internal_brg.version if test.dut_is_combo() else test.dut.version
|
|
352
|
+
else:
|
|
353
|
+
device_id = "NO_ID"
|
|
354
|
+
version = "0.0.0"
|
|
345
355
|
json_data = {
|
|
346
356
|
"setup_name": os.environ['PIPELINE_NAME'],
|
|
347
357
|
"device_id": device_id,
|
certificate/cert_utils.py
CHANGED
|
@@ -26,10 +26,6 @@ ORIGINAL_AG_FILE = "wlt_types_ag.py"
|
|
|
26
26
|
TEST_MODULES_MAP = {"calibration": ag.MODULE_CALIBRATION, "datapath": ag.MODULE_DATAPATH, "energy2400": ag.MODULE_ENERGY_2400, "energy_sub1g": ag.MODULE_ENERGY_SUB1G,
|
|
27
27
|
"pwr_mgmt": ag.MODULE_PWR_MGMT, "sensors": ag.MODULE_EXT_SENSORS, "custom": ag.MODULE_CUSTOM}
|
|
28
28
|
|
|
29
|
-
# Used when mac is not really important for the test (e.g: gw_sim) or to randomize pkt data
|
|
30
|
-
def get_random_hex_str(len=12):
|
|
31
|
-
return ''.join([random.choice('0123456789ABCDEF') for i in range(len)])
|
|
32
|
-
|
|
33
29
|
def module2name(module_id):
|
|
34
30
|
for k, v in TEST_MODULES_MAP.items():
|
|
35
31
|
if module_id == v:
|
|
@@ -308,6 +304,8 @@ class Bridge:
|
|
|
308
304
|
self.cfg_hash = interface_pkt.cfg_hash if interface_pkt else cfg_hash
|
|
309
305
|
self.api_version = interface_pkt.api_version if interface_pkt else api_version
|
|
310
306
|
if import_defs:
|
|
307
|
+
if self.board_type >= len(ag.BOARD_TYPES_LIST):
|
|
308
|
+
handle_error(f"ERROR: Unknown board type {self.board_type} for bridge {self.id_str}!", datetime.datetime.now())
|
|
311
309
|
self.defines_file_name = f'{ag.BOARD_TYPES_LIST[self.board_type]}_defines.cfg'
|
|
312
310
|
overwrite_dict = {}
|
|
313
311
|
# Overwrite auto-generated defines for the specific bridge
|
|
@@ -388,7 +386,7 @@ def ut_prep_brg(args, start_time, tester, brg_id, tester_flag=False, validation_
|
|
|
388
386
|
if args.latest or args.rc:
|
|
389
387
|
return handle_prep_brg_for_latest(test, interface, brg_id, start_time)
|
|
390
388
|
elif test.rc == TEST_FAILED:
|
|
391
|
-
error = f"ERROR: Didn't get ModuleIfV{test.active_brg.api_version} from BRG:{brg.id_str}
|
|
389
|
+
error = f"ERROR: Didn't get ModuleIfV{test.active_brg.api_version} from BRG:{brg.id_str}!\n Check that the brg responded with the correct module"
|
|
392
390
|
handle_error(error, start_time)
|
|
393
391
|
version = f"{interface.major_ver}.{interface.minor_ver}.{interface.patch_ver}"
|
|
394
392
|
board_type = interface.board_type
|
|
@@ -465,7 +463,7 @@ class Gateway:
|
|
|
465
463
|
|
|
466
464
|
def get_tester_id(tester):
|
|
467
465
|
if not tester or tester == GW_SIM_PREFIX:
|
|
468
|
-
return f"GW_SIM_{get_random_hex_str()}"
|
|
466
|
+
return f"GW_SIM_{get_random_hex_str(12)}"
|
|
469
467
|
else:
|
|
470
468
|
# Allow tester to be specified as tester_id:ble_addr
|
|
471
469
|
if ':' in tester:
|
|
@@ -515,16 +513,16 @@ def prep_dut(args, tester, validation_schema, mqttc, start_time, upload_wait_tim
|
|
|
515
513
|
# Prepare gateway's internal BRG
|
|
516
514
|
if brg_flag(validation_schema):
|
|
517
515
|
dut.internal_brg = ut_prep_brg(args, start_time, tester=test.dut, brg_id=args.combo_ble_addr, validation_schema=validation_schema['modules'])
|
|
518
|
-
if dut.internal_brg.api_version
|
|
519
|
-
|
|
516
|
+
if dut.internal_brg.api_version < API_OLDEST_SUPPORTED_VERSION:
|
|
517
|
+
handle_error(f"ERROR: DUT internal brg FW api_version={dut.internal_brg.api_version} is lower then the oldest supported = {API_OLDEST_SUPPORTED_VERSION}! Please upgrade the internal brg FW!", start_time)
|
|
520
518
|
# Return Gateway object
|
|
521
519
|
return dut
|
|
522
520
|
|
|
523
521
|
elif brg_flag(validation_schema):
|
|
524
522
|
# Prepare standalone bridge using prepared tester
|
|
525
523
|
brg = ut_prep_brg(args, start_time, tester=tester, brg_id=args.dut, validation_schema=validation_schema['modules'])
|
|
526
|
-
if brg.api_version
|
|
527
|
-
handle_error(f"ERROR: DUT FW api_version={brg.api_version}
|
|
524
|
+
if brg.api_version < API_OLDEST_SUPPORTED_VERSION:
|
|
525
|
+
handle_error(f"ERROR: DUT brg FW api_version={brg.api_version} is lower then the oldest supported = {API_OLDEST_SUPPORTED_VERSION}! Please upgrade the brg FW!", start_time)
|
|
528
526
|
return brg
|
|
529
527
|
|
|
530
528
|
|
|
@@ -613,6 +611,7 @@ def prep_gw_info_action(test, start_time, brg_flag, target):
|
|
|
613
611
|
gw.gw_version = {BLE_VERSION : info[BLE_VERSION], WIFI_VERSION : info[WIFI_VERSION]}
|
|
614
612
|
if brg_flag and BLE_MAC_ADDR in info:
|
|
615
613
|
internal_brg_mac_addr = info[BLE_MAC_ADDR]
|
|
614
|
+
# For internal use only in versions update test
|
|
616
615
|
if GW_API_VERSION in info:
|
|
617
616
|
gw.gw_api_version = info[GW_API_VERSION]
|
|
618
617
|
|
certificate/certificate.py
CHANGED
|
@@ -101,11 +101,12 @@ def main(args):
|
|
|
101
101
|
|
|
102
102
|
utPrint(f"wiliot_certificate version: {CERT_VERSION}")
|
|
103
103
|
utPrint(str(args.__dict__))
|
|
104
|
-
os.makedirs(ARTIFACTS_DIR, exist_ok=True)
|
|
105
104
|
start_time = datetime.datetime.now()
|
|
106
105
|
|
|
107
106
|
# Clean
|
|
108
107
|
clean(args)
|
|
108
|
+
# Create artifacts dir
|
|
109
|
+
os.makedirs(ARTIFACTS_DIR, exist_ok=True)
|
|
109
110
|
|
|
110
111
|
# Filter tests
|
|
111
112
|
test_list = TEST_LIST_FW_UPDATE_FILE if args.latest or args.rc else args.tl
|
|
@@ -130,9 +131,9 @@ def main(args):
|
|
|
130
131
|
# Run Gateway Simulator in separate thread
|
|
131
132
|
gw_sim_thread = threading.Thread(target=cert_gw_sim.gw_sim_run, daemon=True, kwargs={'port':args.port, 'gw_id': args.tester,
|
|
132
133
|
'custom_broker':args.custom_broker,
|
|
133
|
-
'
|
|
134
|
+
'disable_interference_analyzer':args.disable_interference_analyzer})
|
|
134
135
|
gw_sim_thread.start()
|
|
135
|
-
sleep_time = (len(cert_gw_sim.CHANNELS_TO_ANALYZE) * 30) + 15 if args.
|
|
136
|
+
sleep_time = (len(cert_gw_sim.CHANNELS_TO_ANALYZE) * 30) + 15 if not args.disable_interference_analyzer else 10
|
|
136
137
|
time.sleep(sleep_time)
|
|
137
138
|
tester = cert_utils.prep_tester(args, tester_mqttc, start_time, gw_sim_thread)
|
|
138
139
|
|
|
@@ -182,12 +183,13 @@ def main(args):
|
|
|
182
183
|
print(f"Test Duration: {test.duration}")
|
|
183
184
|
print(tabulate.tabulate([[i+1, i+1-(failures+skipped), skipped, failures, len(tests)]],
|
|
184
185
|
headers=["FINISHED", "PASSED", "SKIPPED", "FAILED", "TOTAL"], tablefmt="pretty"))
|
|
185
|
-
|
|
186
|
+
if test.rc != TEST_SKIPPED:
|
|
187
|
+
wait_time_n_print(2)
|
|
186
188
|
if exit_on_test_failure and test.rc == TEST_FAILED:
|
|
187
189
|
break
|
|
188
190
|
|
|
189
191
|
# Print results
|
|
190
|
-
cert_results.generate_results_files(
|
|
192
|
+
cert_results.generate_results_files(html=True, pdf=True, failures=failures, skipped=skipped, start_time=start_time, tests=tests, non_cert_run=args.non_cert_run)
|
|
191
193
|
if not pipeline_running():
|
|
192
194
|
webbrowser.open('file://' + os.path.realpath(os.path.join(ARTIFACTS_DIR, UT_RESULT_FILE_PDF)))
|
|
193
195
|
|
certificate/certificate_cli.py
CHANGED
|
@@ -24,18 +24,16 @@ class CertificateCLI:
|
|
|
24
24
|
description='Certificate - CLI Tool to test Wiliot Devices',
|
|
25
25
|
epilog=
|
|
26
26
|
"run examples:\n"
|
|
27
|
-
" Run command example with COM PORT
|
|
28
|
-
" wlt-cert-cli --
|
|
29
|
-
" Run command example with remote GW
|
|
30
|
-
" wlt-cert-cli --
|
|
27
|
+
" Run command example with COM PORT tester:\n"
|
|
28
|
+
" wlt-cert-cli --tester SIM --dut <XXXXXXXXXXXX> --port <COM_PORT>\n"
|
|
29
|
+
" Run command example with remote GW tester:\n"
|
|
30
|
+
" wlt-cert-cli --tester <YYYYYYYYYYYY> --dut <XXXXXXXXXXXX>\n"
|
|
31
31
|
" Run command example for running datapath module tests only:\n"
|
|
32
|
-
" wlt-cert-cli --
|
|
32
|
+
" wlt-cert-cli --tester <YYYYYYYYYYYY> --dut <XXXXXXXXXXXX> --run datapath\n"
|
|
33
33
|
" Run command example with sanity test list:\n"
|
|
34
|
-
" wlt-cert-cli --
|
|
35
|
-
" Run command example with COM PORT
|
|
36
|
-
" wlt-cert-cli --
|
|
37
|
-
" Run command example with remote GW connection for bridge with cloud connectivity:\n"
|
|
38
|
-
" wlt-cert-cli --gw <YYYYYYYYYYYY> --brg_cloud_connectivity <XXXXXXXXXXXX> --tl certificate_bcc_test_list.txt\n",
|
|
34
|
+
" wlt-cert-cli --tester <YYYYYYYYYYYY> --dut <XXXXXXXXXXXX> --tl certificate_sanity_test_list.txt\n"
|
|
35
|
+
" Run command example with COM PORT tester for combo device:\n"
|
|
36
|
+
" wlt-cert-cli --tester SIM --dut <XXXXXXXXXXXX>:<YYYYYYYYYYYY> --port <COM_PORT>\n",
|
|
39
37
|
formatter_class=argparse.RawDescriptionHelpFormatter
|
|
40
38
|
)
|
|
41
39
|
self.parser.add_argument('--validation_schema', '-vs', required=True, help='Validation schema json file path to use for the run')
|
|
@@ -52,8 +50,7 @@ class CertificateCLI:
|
|
|
52
50
|
self.parser.add_argument('--exit_on_test_failure', default=False, action='store_true', help='Stop running the tests if a test failed ' + argparse.SUPPRESS)
|
|
53
51
|
self.parser.add_argument('--exit_on_param_failure', default=False, action='store_true', help='Sets exit_on_param_failure mode to true in order to prevent \
|
|
54
52
|
tests from continuing iteration over all possibilities in case of failure ' + argparse.SUPPRESS)
|
|
55
|
-
self.parser.add_argument('--
|
|
56
|
-
(relevant only for Gateway Simulator)')
|
|
53
|
+
self.parser.add_argument('--disable_interference_analyzer', '-dia', default=False, action='store_true', help='Disable interference analysis before tests')
|
|
57
54
|
self.parser.add_argument('--unsterile_run', '-ur', default=False, action='store_true',
|
|
58
55
|
help="Set unsterile run mode for the run if there are pixels or energizing devices nearby")
|
|
59
56
|
self.parser.add_argument("--overwrite_defaults", '-od', type=parse_dict_arg, help='Manually overwrite default defines for the bridge (key1=value1,key2=value2...)')
|
|
@@ -8,7 +8,7 @@ import certificate.cert_data_sim as cert_data_sim
|
|
|
8
8
|
from certificate.ag.wlt_types_ag import *
|
|
9
9
|
|
|
10
10
|
SCAN_TIMEOUT = 30
|
|
11
|
-
|
|
11
|
+
NUM_OF_BRGS = 4
|
|
12
12
|
# DEFINES
|
|
13
13
|
test_indicator = cert_data_sim.PIXEL_SIM_INDICATOR
|
|
14
14
|
|
|
@@ -20,11 +20,11 @@ def run(test):
|
|
|
20
20
|
return cert_common.test_epilog(test)
|
|
21
21
|
|
|
22
22
|
# Generate management and data packets
|
|
23
|
-
bridge_ids = []
|
|
24
|
-
pixels_pkts,
|
|
25
|
-
|
|
23
|
+
bridge_ids = [cert_common.hex2alias_id_get(get_random_hex_str(12)) for _ in range(NUM_OF_BRGS)]
|
|
24
|
+
pixels_pkts, _ = cert_data_sim.brg_pkt_gen(num_of_pkts_per_brg=20, num_of_brgs=NUM_OF_BRGS, brgs_list=bridge_ids,
|
|
25
|
+
pkt_type=PIXELS_PKT, indicator=test_indicator)
|
|
26
26
|
|
|
27
|
-
mgmt_pkts, _ = cert_data_sim.brg_pkt_gen(num_of_pkts_per_brg=10, num_of_brgs=
|
|
27
|
+
mgmt_pkts, _ = cert_data_sim.brg_pkt_gen(num_of_pkts_per_brg=10, num_of_brgs=NUM_OF_BRGS, brgs_list=bridge_ids,
|
|
28
28
|
pkt_type=MGMT_PKT, indicator=test_indicator)
|
|
29
29
|
# Use first 3 bridges for ACL, 4th bridge is not in ACL
|
|
30
30
|
acl_bridge_ids = bridge_ids[:3]
|
|
@@ -41,7 +41,7 @@ def run(test):
|
|
|
41
41
|
cfg = cert_config.get_default_gw_dict(test)
|
|
42
42
|
cfg[ACL][ACL_BRIDGE_IDS] = acl_bridge_ids
|
|
43
43
|
cfg[ACL][ACL_MODE] = param.value
|
|
44
|
-
test,
|
|
44
|
+
test, _ = cert_config.gw_configure(test, cfg=cfg, wait=True)
|
|
45
45
|
print_update_wait(1)
|
|
46
46
|
|
|
47
47
|
test.get_mqttc_by_target(DUT).flush_pkts()
|
|
@@ -51,8 +51,8 @@ def run(test):
|
|
|
51
51
|
# Analyze pass/fail
|
|
52
52
|
# Get all received packets with the test indicator and filter packets by bridge IDs in ACL list
|
|
53
53
|
received_pkts = cert_mqtt.get_unified_data_pkts(test, only_active_brg=False, indicator=test_indicator)
|
|
54
|
-
acl_bridge_pkts = [pkt for pkt in received_pkts if pkt[
|
|
55
|
-
non_acl_bridge_pkts = [pkt for pkt in received_pkts if
|
|
54
|
+
acl_bridge_pkts = [pkt for pkt in received_pkts if any([id in pkt[PAYLOAD] for id in acl_bridge_ids])]
|
|
55
|
+
non_acl_bridge_pkts = [pkt for pkt in received_pkts if non_acl_bridge_id in pkt[PAYLOAD]]
|
|
56
56
|
|
|
57
57
|
# In deny mode - we want to make sure bridges in ACL list are filtered
|
|
58
58
|
if param.value == ACL_DENY:
|
|
@@ -71,20 +71,18 @@ def run(test):
|
|
|
71
71
|
test.add_reason(f"Phase failed! Bridge {non_acl_bridge_id} was not on the allow list "
|
|
72
72
|
f"and {len(non_acl_bridge_pkts)} packets were found from it")
|
|
73
73
|
# Check that we received packets from all expected bridges
|
|
74
|
-
|
|
75
|
-
if
|
|
74
|
+
received_alias_bridge_ids = set([pkt[ALIAS_BRIDGE_ID] for pkt in acl_bridge_pkts])
|
|
75
|
+
if len(received_alias_bridge_ids) != len(acl_bridge_ids):
|
|
76
76
|
test.rc = TEST_FAILED
|
|
77
77
|
test.add_reason("Phase failed! Didn't receive packets from all bridges that were on the allow list")
|
|
78
78
|
|
|
79
79
|
# Check that management packets are received from all bridges (ACL doesn't filter mgmt packets)
|
|
80
80
|
all_mgmt_pkts = cert_mqtt.get_all_mgmt_pkts(test.get_mqttc_by_target(DUT), indicator=test_indicator)
|
|
81
|
-
|
|
81
|
+
mgmt_alias_bridge_ids = set([pkt[ALIAS_BRIDGE_ID] for pkt in all_mgmt_pkts])
|
|
82
82
|
|
|
83
|
-
if
|
|
83
|
+
if len(mgmt_alias_bridge_ids) != NUM_OF_BRGS:
|
|
84
84
|
test.rc = TEST_FAILED
|
|
85
|
-
|
|
86
|
-
test.add_reason(f"Phase failed! Expected management packets from all bridges, "
|
|
87
|
-
f"whether they are on the ACL or not, but missing from BRG {missing_bridges}")
|
|
85
|
+
test.add_reason("Phase failed! Didn't receive management packets from all bridges")
|
|
88
86
|
|
|
89
87
|
field_functionality_pass_fail_print(test, "ACL", value=param.value)
|
|
90
88
|
test.set_phase_rc(param.name, test.rc)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"Analyze if bridge was upgraded and action status message was uploaded",
|
|
10
10
|
"Test epilog"],
|
|
11
11
|
"expectedOutcome": "Tester brg advertises ModuleIF packet with the new version and DUT Gateway publish an actionStatus message indicating success and within timeout",
|
|
12
|
-
"mandatory":
|
|
12
|
+
"mandatory": 0,
|
|
13
13
|
"multiBridgeTest": 0,
|
|
14
14
|
"gwOnlyTest": 1,
|
|
15
15
|
"internalBridge": 1,
|
certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py
CHANGED
|
@@ -3,7 +3,6 @@ from certificate.cert_defines import *
|
|
|
3
3
|
from certificate.wlt_types import *
|
|
4
4
|
from certificate.ag.wlt_types_ag import OUTPUT_POWER_2_4_MAX
|
|
5
5
|
import certificate.cert_common as cert_common
|
|
6
|
-
import certificate.cert_utils as cert_utils
|
|
7
6
|
import certificate.cert_mqtt as cert_mqtt
|
|
8
7
|
import certificate.cert_config as cert_config
|
|
9
8
|
import certificate.cert_gw_sim as cert_gw_sim
|
|
@@ -18,7 +17,7 @@ from collections import defaultdict
|
|
|
18
17
|
# DEFINES
|
|
19
18
|
CHANNELS = [37, 38, 39] # channel to check in DUT
|
|
20
19
|
DEFAULT_WAIT_TIME = 5 # How much extra time to wait after the transmition is over
|
|
21
|
-
SCAN_TEST_INDICATOR =
|
|
20
|
+
SCAN_TEST_INDICATOR = get_random_hex_str(6) # Unique identifier for the pkt sent
|
|
22
21
|
ADV_DURATION = 20 # How long to transmit to the DUT
|
|
23
22
|
# cmd_ble_sm defines
|
|
24
23
|
BLE_SIM_RADIO_1MBPS = 1
|
|
@@ -84,6 +83,7 @@ def analyze_listening_timeline(test, all_pkts_received_from_tester, num_of_sent_
|
|
|
84
83
|
channel_cards = []
|
|
85
84
|
|
|
86
85
|
# Parse data into {ts, channel pairs} - X and Y axis
|
|
86
|
+
all_pkts_received_from_tester = sorted(all_pkts_received_from_tester, key=lambda pkt: float(pkt.get(TIMESTAMP)))
|
|
87
87
|
for idx, pkt in enumerate(all_pkts_received_from_tester):
|
|
88
88
|
payload = pkt.get(PAYLOAD)
|
|
89
89
|
channel = int(payload[-10:-8], 16)
|