wiliot-certificate 1.4.0a2__py3-none-any.whl → 1.5.1a1__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.
- brg_certificate/ag/energous_v0_defines.py +28 -28
- brg_certificate/ag/energous_v1_defines.py +28 -28
- brg_certificate/ag/energous_v2_defines.py +28 -28
- brg_certificate/ag/energous_v3_defines.py +28 -28
- brg_certificate/ag/energous_v4_defines.py +28 -28
- brg_certificate/ag/fanstel_lan_v0_defines.py +28 -28
- brg_certificate/ag/fanstel_lte_v0_defines.py +28 -28
- brg_certificate/ag/fanstel_wifi_v0_defines.py +28 -28
- brg_certificate/ag/minew_lte_v0_defines.py +28 -28
- brg_certificate/ag/wlt_cmd_if.html +1 -1
- brg_certificate/ag/wlt_types.html +3 -4
- brg_certificate/ag/wlt_types_ag.py +162 -163
- brg_certificate/brg_certificate.py +46 -12
- brg_certificate/brg_certificate_cli.py +1 -0
- brg_certificate/cert_common.py +31 -42
- brg_certificate/cert_config.py +7 -5
- brg_certificate/cert_data_sim.py +26 -4
- brg_certificate/cert_defines.py +30 -3
- brg_certificate/cert_gw_sim.py +12 -8
- brg_certificate/cert_mqtt.py +10 -2
- brg_certificate/cert_prints.py +7 -5
- brg_certificate/cert_protobuf.py +5 -1
- brg_certificate/cert_results.py +134 -84
- brg_certificate/cert_utils.py +14 -17
- brg_certificate/certificate_bcc_sanity_test_list.txt +35 -0
- brg_certificate/certificate_bcc_test_list.txt +45 -0
- brg_certificate/certificate_sanity_test_list.txt +2 -1
- brg_certificate/certificate_test_list.txt +10 -4
- brg_certificate/restore_brg.py +2 -0
- brg_certificate/tests/calibration/interval_test/interval_test.json +2 -1
- brg_certificate/tests/calibration/interval_test/interval_test.py +1 -1
- brg_certificate/tests/calibration/output_power_test/output_power_test.json +5 -3
- brg_certificate/tests/calibration/output_power_test/output_power_test.py +1 -1
- brg_certificate/tests/calibration/pattern_test/pattern_test.json +5 -2
- brg_certificate/tests/calibration/pattern_test/pattern_test.py +1 -1
- brg_certificate/tests/datapath/aging_test/aging_test.json +20 -0
- brg_certificate/tests/datapath/aging_test/aging_test.py +135 -0
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +8 -3
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +2 -2
- brg_certificate/tests/datapath/output_power_test/output_power_test.json +5 -2
- brg_certificate/tests/datapath/output_power_test/output_power_test.py +1 -1
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +5 -2
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +1 -1
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +5 -2
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +2 -2
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +5 -2
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +1 -1
- brg_certificate/tests/datapath/pattern_test/pattern_test.json +6 -3
- brg_certificate/tests/datapath/pattern_test/pattern_test.py +1 -1
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +8 -2
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +1 -1
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +8 -2
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +1 -1
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +8 -2
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +1 -1
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +6 -2
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +1 -1
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +5 -2
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +1 -1
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +3 -4
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +1 -1
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +3 -4
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +1 -1
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +14 -22
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +24 -24
- brg_certificate/tests/datapath/stress_test/stress_test.json +11 -18
- brg_certificate/tests/datapath/stress_test/stress_test.py +20 -27
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +6 -2
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +1 -1
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +6 -2
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +1 -1
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +2 -1
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +4 -24
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +2 -1
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +2 -1
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +1 -1
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +9 -5
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +4 -4
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +9 -5
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +45 -1
- brg_certificate/tests/edge_mgmt/stat_test/stat_test.json +2 -1
- brg_certificate/tests/edge_mgmt/stat_test/stat_test.py +1 -1
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +5 -2
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +1 -1
- brg_certificate/tests/energy2400/output_power_test/output_power_test.json +5 -3
- brg_certificate/tests/energy2400/output_power_test/output_power_test.py +1 -1
- brg_certificate/tests/energy2400/pattern_test/pattern_test.json +5 -2
- brg_certificate/tests/energy2400/pattern_test/pattern_test.py +1 -1
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +20 -0
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +346 -0
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +20 -0
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +346 -0
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +2 -1
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +1 -1
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +12 -5
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +130 -43
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +5 -2
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +1 -1
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +9 -3
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +1 -1
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +2 -1
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +1 -1
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +5 -2
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +1 -1
- brg_certificate/wltPb_pb2.py +50 -38
- brg_certificate/wltPb_pb2.pyi +40 -34
- brg_certificate/wlt_types.py +4 -6
- common/wlt_logo.png +0 -0
- gw_certificate/ag/ut_defines.py +4 -1
- gw_certificate/cert_results.py +145 -0
- gw_certificate/gw_certificate.py +18 -6
- gw_certificate/gw_certificate_cli.py +3 -3
- gw_certificate/interface/mqtt.py +1 -0
- gw_certificate/interface/uart_if.py +1 -1
- gw_certificate/tests/actions.py +7 -2
- gw_certificate/tests/connection.py +1 -1
- gw_certificate/tests/generic.py +43 -17
- gw_certificate/tests/registration.py +2 -1
- gw_certificate/tests/uplink.py +26 -35
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info}/METADATA +16 -10
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info}/RECORD +126 -120
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info}/WHEEL +1 -1
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info}/top_level.txt +1 -0
- brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.json +0 -13
- brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +0 -76
- brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +0 -13
- brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +0 -398
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info}/entry_points.txt +0 -0
- {wiliot_certificate-1.4.0a2.dist-info → wiliot_certificate-1.5.1a1.dist-info/licenses}/LICENSE +0 -0
|
@@ -43,7 +43,7 @@ def compare_versions(gw_version, brg_version):
|
|
|
43
43
|
|
|
44
44
|
def run(test):
|
|
45
45
|
test = cert_common.test_prolog(test)
|
|
46
|
-
if test.rc == TEST_FAILED
|
|
46
|
+
if test.rc == TEST_FAILED:
|
|
47
47
|
return cert_common.test_epilog(test)
|
|
48
48
|
|
|
49
49
|
test.mqttc.flush_pkts()
|
|
@@ -102,7 +102,7 @@ def run(test):
|
|
|
102
102
|
cert_common.wait_time_n_print(BRG_REBOOT_TIME - (int(datetime.datetime.now().timestamp()) - reboot_start_ts))
|
|
103
103
|
utPrint("Advertisement LED check completed!\n", "GREEN")
|
|
104
104
|
|
|
105
|
-
# ------------------
|
|
105
|
+
# ------------------ Energizing LED check ------------------ #
|
|
106
106
|
# Energizing is ON (Non default for SUB1G, but for UT purposses we'll set it to ON)
|
|
107
107
|
utPrint("Energizing LED check!", "HEADER")
|
|
108
108
|
utPrint(f"Is the Energizing LED ({ENERGIZING_LED_COLOR}) on? (Y/N)", "BLUE")
|
|
@@ -114,7 +114,7 @@ def run(test):
|
|
|
114
114
|
# Energizing is OFF
|
|
115
115
|
# Default cfg for 2400 is 0 == no energizing so we only eliminating sub1g energizing
|
|
116
116
|
utPrint("Configuring the BRG to no energizing in sub1g", "WARNING")
|
|
117
|
-
sub1g_module =
|
|
117
|
+
sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
|
|
118
118
|
test = cert_config.brg_configure(test, fields=[BRG_PATTERN], values=[ag.SUB1G_ENERGY_PATTERN_NO_ENERGIZING], module=sub1g_module)[0]
|
|
119
119
|
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
120
120
|
return cert_common.test_epilog(test, revert_brgs=True, modules=[sub1g_module])
|
|
@@ -177,7 +177,7 @@ def run(test):
|
|
|
177
177
|
# ------------- Power management sleep & Keep Alive Mode ------------- #
|
|
178
178
|
utPrint("Power management Sleep state & Keep Alive Mode check!", "HEADER")
|
|
179
179
|
utPrint("Sending the BRG power management configuration in order to enter sleep state", "WARNING")
|
|
180
|
-
pwr_mgmt_module =
|
|
180
|
+
pwr_mgmt_module = eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}')
|
|
181
181
|
test, wltpkt = cert_common.brg_pwr_mgmt_turn_on(test)
|
|
182
182
|
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
183
183
|
# Preventing leaving brg in pwr mgmt, protection for on that worked yet no ack was received
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ota_test",
|
|
3
3
|
"module": "edge_mgmt",
|
|
4
|
-
"purpose": "
|
|
5
|
-
"
|
|
6
|
-
"initialCondition": "
|
|
7
|
-
"procedure": ["Test prolog",
|
|
8
|
-
|
|
4
|
+
"purpose": "Test Over-the-air (OTA) firmware update functionality",
|
|
5
|
+
"documentation": "<TEST_DOCUMENTATION_LINK>",
|
|
6
|
+
"initialCondition": "Bridge configured to defaults and connected to a GW",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"Extract latest firmware version",
|
|
9
|
+
"Perform BRG OTA firmware update",
|
|
10
|
+
"Test epilog"],
|
|
11
|
+
"expectedOutcome": "BRG OTA firmware update was successful - bridge is running the latest firmware version",
|
|
9
12
|
"mandatory": 0,
|
|
10
13
|
"multiBridgeTest": 0,
|
|
11
14
|
"gwOnlyTest": 0,
|
|
15
|
+
"internalBridge": 1,
|
|
12
16
|
"allSupportedValues": []
|
|
13
17
|
}
|
|
@@ -19,6 +19,49 @@ BRG_OTA_LOGS = {
|
|
|
19
19
|
"finish brg ota": "BRG OTA finished with status",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
RECIEVED_REPORTS_TIMEOUT = 60
|
|
23
|
+
|
|
24
|
+
EXPECTED_REPORTS = {
|
|
25
|
+
4: {0, 25, 50, 75, 100},
|
|
26
|
+
5: {0, 100},
|
|
27
|
+
6: {10, 20, 30, 40, 50, 60, 70, 80, 90, 100},
|
|
28
|
+
7: {100}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_report_status(test):
|
|
33
|
+
received = {step: set() for step in EXPECTED_REPORTS}
|
|
34
|
+
start_time = datetime.datetime.now()
|
|
35
|
+
|
|
36
|
+
while (datetime.datetime.now() - start_time).seconds < RECIEVED_REPORTS_TIMEOUT:
|
|
37
|
+
for p in test.mqttc._userdata["pkts"].status:
|
|
38
|
+
if ACTION_STATUS in p.body:
|
|
39
|
+
msg = p.body[ACTION_STATUS]
|
|
40
|
+
# Check that the packet contains the expected action, statusCode, and progress
|
|
41
|
+
if msg[ACTION] == ACTION_BRG_OTA: # OTA action
|
|
42
|
+
if STATUS_CODE_STR in msg and msg[STATUS_CODE_STR] != 0:
|
|
43
|
+
test.rc = TEST_FAILED
|
|
44
|
+
test.add_reason(f"Got the following error code during OTA : {p.body[STATUS_CODE_STR]}")
|
|
45
|
+
return test
|
|
46
|
+
else:
|
|
47
|
+
step = msg[STEP]
|
|
48
|
+
progress = msg[PROGRESS]
|
|
49
|
+
# Only record progress if it is one of the expected values for this step
|
|
50
|
+
if progress in EXPECTED_REPORTS[step]:
|
|
51
|
+
received[step].add(progress)
|
|
52
|
+
|
|
53
|
+
# Check if every step has received all its expected progress values
|
|
54
|
+
if all(received[step] == EXPECTED_REPORTS[step] for step in EXPECTED_REPORTS):
|
|
55
|
+
utPrint("SUCCESS: Got all the required reports on the OTA process!", "GREEN")
|
|
56
|
+
return test
|
|
57
|
+
|
|
58
|
+
print_update_wait()
|
|
59
|
+
|
|
60
|
+
test.rc = TEST_FAILED
|
|
61
|
+
print("Not all reports on OTA where received")
|
|
62
|
+
test.add_reason("Not all reports on OTA where received")
|
|
63
|
+
return test
|
|
64
|
+
|
|
22
65
|
|
|
23
66
|
def get_ts_from_log(log):
|
|
24
67
|
ts_end = log.find(']')
|
|
@@ -55,7 +98,7 @@ def breakdown_steps_timing(test, start_ts):
|
|
|
55
98
|
def run(test):
|
|
56
99
|
|
|
57
100
|
test = cert_common.test_prolog(test)
|
|
58
|
-
if test.rc == TEST_FAILED
|
|
101
|
+
if test.rc == TEST_FAILED:
|
|
59
102
|
return cert_common.test_epilog(test, revert_brgs=True)
|
|
60
103
|
|
|
61
104
|
versions_mgmt = cert_utils.load_module('versions_mgmt.py', f'{UTILS_BASE_REL_PATH}/versions_mgmt.py')
|
|
@@ -75,6 +118,7 @@ def run(test):
|
|
|
75
118
|
|
|
76
119
|
start_time = datetime.datetime.now()
|
|
77
120
|
test = cert_config.brg_ota(test, gw_ble_version=version)
|
|
121
|
+
test = get_report_status(test)
|
|
78
122
|
generate_log_file(test, f"brg_ota_{version}")
|
|
79
123
|
|
|
80
124
|
if test.rc == TEST_PASSED and WANTED_VER_SAME not in test.reason:
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
"name": "stat_test",
|
|
3
3
|
"module": "edge_mgmt",
|
|
4
4
|
"purpose": "Test static packets (heartbeat and interface) sent from the bridge",
|
|
5
|
-
"
|
|
5
|
+
"documentation": "<TEST_DOCUMENTATION_LINK>",
|
|
6
6
|
"initialCondition": "Bridge configured to defaults",
|
|
7
7
|
"procedure": ["Test prolog", "Scan for heartbeat and interface packets", "Test epilog"],
|
|
8
8
|
"expectedOutcome": "Both heartbeat and interface packets received from the bridge within 65 seconds",
|
|
9
9
|
"mandatory": 1,
|
|
10
10
|
"multiBridgeTest": 0,
|
|
11
11
|
"gwOnlyTest": 0,
|
|
12
|
+
"internalBridge": 1,
|
|
12
13
|
"allSupportedValues": []
|
|
13
14
|
}
|
|
@@ -39,7 +39,7 @@ def scan_for_brg_stat(test, timeout=BRG_STAT_SCAN_TIMEOUT, only_hb=False):
|
|
|
39
39
|
def run(test):
|
|
40
40
|
|
|
41
41
|
test = cert_common.test_prolog(test)
|
|
42
|
-
if test.rc == TEST_FAILED
|
|
42
|
+
if test.rc == TEST_FAILED:
|
|
43
43
|
return cert_common.test_epilog(test)
|
|
44
44
|
|
|
45
45
|
test = scan_for_brg_stat(test)
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
"name": "duty_cycle_test",
|
|
3
3
|
"module": "energy2400",
|
|
4
4
|
"purpose": "Test configuration for supported energy2400 duty cycle values",
|
|
5
|
-
"
|
|
5
|
+
"documentation": "https://community.wiliot.com/customers/s/article/Wiliot-Network-Energizing-2-4Ghz",
|
|
6
6
|
"initialCondition": "Bridge configured to defaults",
|
|
7
|
-
"procedure": ["Test prolog",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"For each supported value - configure the BRG and verify the value",
|
|
9
|
+
"Test epilog and revert to defaults"],
|
|
8
10
|
"expectedOutcome": "All values configured successfully",
|
|
9
11
|
"mandatory": 1,
|
|
10
12
|
"multiBridgeTest": 0,
|
|
11
13
|
"gwOnlyTest": 0,
|
|
14
|
+
"internalBridge": 1,
|
|
12
15
|
"allSupportedValues": [1, 25, 50, 75]
|
|
13
16
|
}
|
|
@@ -10,7 +10,7 @@ def run(test):
|
|
|
10
10
|
energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
|
|
11
11
|
|
|
12
12
|
test = cert_common.test_prolog(test)
|
|
13
|
-
if test.rc == TEST_FAILED
|
|
13
|
+
if test.rc == TEST_FAILED:
|
|
14
14
|
return cert_common.test_epilog(test)
|
|
15
15
|
for param in test.params:
|
|
16
16
|
test = cert_config.brg_configure(test, fields=fields, values=[param.value], module=energy2400_module)[0]
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
"name": "output_power_test",
|
|
3
3
|
"module": "energy2400",
|
|
4
4
|
"purpose": "Test configuration for all supported energy2400 output power values",
|
|
5
|
-
"
|
|
5
|
+
"documentation": "https://community.wiliot.com/customers/s/article/Wiliot-Network-Energizing-2-4Ghz",
|
|
6
6
|
"initialCondition": "Bridge configured to defaults",
|
|
7
|
-
"procedure": ["Test prolog",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"For each supported value - configure the BRG and verify the value",
|
|
9
|
+
"Test epilog and revert to defaults"],
|
|
8
10
|
"expectedOutcome": "All values configured successfully",
|
|
9
11
|
"mandatory": 1,
|
|
10
12
|
"multiBridgeTest": 0,
|
|
11
13
|
"gwOnlyTest": 0,
|
|
12
|
-
"allSupportedValues": [
|
|
14
|
+
"allSupportedValues": [-12, -8, -4, 0, 2, 3]
|
|
13
15
|
}
|
|
@@ -10,7 +10,7 @@ def run(test):
|
|
|
10
10
|
energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
|
|
11
11
|
|
|
12
12
|
test = cert_common.test_prolog(test)
|
|
13
|
-
if test.rc == TEST_FAILED
|
|
13
|
+
if test.rc == TEST_FAILED:
|
|
14
14
|
return cert_common.test_epilog(test)
|
|
15
15
|
|
|
16
16
|
for param in test.params:
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
"name": "pattern_test",
|
|
3
3
|
"module": "energy2400",
|
|
4
4
|
"purpose": "Test configuration for all supported Energy 2400MHz pattern values",
|
|
5
|
-
"
|
|
5
|
+
"documentation": "https://community.wiliot.com/customers/s/article/Wiliot-Network-Energizing-2-4Ghz",
|
|
6
6
|
"initialCondition": "Bridge configured to defaults",
|
|
7
|
-
"procedure": ["Test prolog",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"For each supported value - configure the BRG and verify the value",
|
|
9
|
+
"Test epilog and revert to defaults"],
|
|
8
10
|
"expectedOutcome": "All values configured successfully",
|
|
9
11
|
"mandatory": 1,
|
|
10
12
|
"multiBridgeTest": 0,
|
|
11
13
|
"gwOnlyTest": 0,
|
|
14
|
+
"internalBridge": 1,
|
|
12
15
|
"allSupportedValues": ["ENERGY_PATTERN_2_4_NO_ENERGIZING", "ENERGY_PATTERN_2_4_CHANNEL_37", "ENERGY_PATTERN_2_4_CHANNEL_38", "ENERGY_PATTERN_2_4_CHANNEL_39", "ENERGY_PATTERN_2_4_FREQ_2450", "ENERGY_PATTERN_2_4_FREQ_2454"]
|
|
13
16
|
}
|
|
@@ -10,7 +10,7 @@ def run(test):
|
|
|
10
10
|
energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
|
|
11
11
|
|
|
12
12
|
test = cert_common.test_prolog(test)
|
|
13
|
-
if test.rc == TEST_FAILED
|
|
13
|
+
if test.rc == TEST_FAILED:
|
|
14
14
|
return cert_common.test_epilog(test)
|
|
15
15
|
|
|
16
16
|
for param in test.params:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "signal_indicator_functionality_ble5_10_250k_test",
|
|
3
|
+
"module": "energy2400",
|
|
4
|
+
"purpose": "TODO",
|
|
5
|
+
"documentation": "https://community.wiliot.com/customers/s/article/Bridge-to-Bridge-Signal-Indicator",
|
|
6
|
+
"initialCondition": "",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"rssi_threshold - check the if rssi value is between 0 to -25.",
|
|
9
|
+
"brg0_rx_brg1_tx - one brg is transmitter and the second is receiver, we expect to get the same values from the receiver, according to the tx params",
|
|
10
|
+
"brg0_none_brg1_rx - One rx BRG without any tx BRG. We don't expect to see any signal indicator packets.",
|
|
11
|
+
"brg0_rxtx_brg1_rxtx - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect to see signal indicator packets from both BRG's, according to the tx params.",
|
|
12
|
+
"brg0_tx_brg1_none - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicator packets.",
|
|
13
|
+
"Test epilog"],
|
|
14
|
+
"expectedOutcome": "",
|
|
15
|
+
"mandatory": 0,
|
|
16
|
+
"multiBridgeTest": 1,
|
|
17
|
+
"gwOnlyTest": 0,
|
|
18
|
+
"internalBridge": 1,
|
|
19
|
+
"allSupportedValues": ["rssi_threshold", "brg0_rx_brg1_tx", "brg0_none_brg1_rx", "brg0_rxtx_brg1_rxtx", "brg0_tx_brg1_none"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
from brg_certificate.cert_prints import *
|
|
2
|
+
from brg_certificate.cert_defines import *
|
|
3
|
+
from brg_certificate.wlt_types import *
|
|
4
|
+
import brg_certificate.cert_common as cert_common
|
|
5
|
+
import brg_certificate.cert_config as cert_config
|
|
6
|
+
import random
|
|
7
|
+
|
|
8
|
+
# Test Description:
|
|
9
|
+
# This test is to verify the functionality of both signal indicator tx (tx_brg) and rx (rx_brg) at BRG level.
|
|
10
|
+
# rssi_threshold = phase 0 , check the if rssi value is between 0 to -25.
|
|
11
|
+
# brg0_rx_brg1_tx = phase 1+2
|
|
12
|
+
# phase 1 - One BRG will be configured as signal indicator tx, and the other as signal indicator rx, and we expect to see signal indicator packets only from the rx BRG according to the tx params (repetition and cycle params).
|
|
13
|
+
# phase 2 - Same as phase 1, but with different tx params configured.
|
|
14
|
+
# brg0_none_brg1_rx = phase 3 - One rx BRG without any tx BRG. We don't expect to see any signal indicator packets. This phase is to verify the brg module logic is working properly, and no tag packet is accidentally being treated as signal indicator packet.
|
|
15
|
+
# brg0_rxtx_brg1_rxtx = phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect
|
|
16
|
+
# to see signal indicator packets from both BRG's, according to the tx params.
|
|
17
|
+
# brg0_tx_brg1_none = phase 5 - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicatopr packets.
|
|
18
|
+
# that way we can assure the logic within the receiver is not confused by the signal indicator uuid as external sensor.
|
|
19
|
+
|
|
20
|
+
# Test MACROS #
|
|
21
|
+
DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
|
|
22
|
+
NUM_OF_SCANNING_tx_signal_ind_cycle = 2
|
|
23
|
+
DEFAULT_SCAN_TIME = 60
|
|
24
|
+
SCAN_DELAY_TIME = 5
|
|
25
|
+
BOARD_TYPES_2_POLARIZATION_ANT_LIST = [ag.BOARD_TYPE_MINEW_SINGLE_BAND_V0, ag.BOARD_TYPE_MINEW_DUAL_BAND_V0, ag.BOARD_TYPE_ENERGOUS_V2, ag.BOARD_TYPE_ERM_V0, ag.BOARD_TYPE_ERM_V1]
|
|
26
|
+
BLE4_LISTEN_PERIOD = 15
|
|
27
|
+
BLE4_BROADCAST_DURATION = BLE4_LISTEN_PERIOD + 1
|
|
28
|
+
|
|
29
|
+
# Test functions #
|
|
30
|
+
def mqtt_scan_n_create_log_file(test, duration, phase):
|
|
31
|
+
test.mqttc.flush_pkts()
|
|
32
|
+
mqtt_scan_wait(test, duration=duration)
|
|
33
|
+
generate_log_file(test, f"{phase}")
|
|
34
|
+
|
|
35
|
+
def get_all_signal_ind_pkt(test=None, rx_brg=None, tx_brg=None):
|
|
36
|
+
if rx_brg == test.brg1:
|
|
37
|
+
all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(mqttc=test.mqttc, test=test)
|
|
38
|
+
elif rx_brg == test.brg0:
|
|
39
|
+
all_sensor_packets = cert_mqtt.get_all_sensor_pkts(mqttc=test.mqttc, test=test)
|
|
40
|
+
signal_ind_pkts = []
|
|
41
|
+
for p in all_sensor_packets:
|
|
42
|
+
if p[SENSOR_UUID] == "{:06X}".format(ag.SENSOR_SERVICE_ID_SIGNAL_INDICATOR) and p[BRIDGE_ID] == rx_brg.id_str and (p[SENSOR_ID] == tx_brg.id_alias or hex_str2int(p[SENSOR_ID]) == tx_brg.id_str):
|
|
43
|
+
signal_ind_pkts.append(p)
|
|
44
|
+
return signal_ind_pkts
|
|
45
|
+
|
|
46
|
+
def expected_signal_ind_pkts_calc(tx_brg, rx_brg):
|
|
47
|
+
if (tx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
|
|
48
|
+
tx_brg_ant_polarization_num = 2
|
|
49
|
+
else:
|
|
50
|
+
tx_brg_ant_polarization_num = 1
|
|
51
|
+
if (rx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
|
|
52
|
+
rx_brg_ant_polarization_num = 2
|
|
53
|
+
result = [(NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num) - 1,
|
|
54
|
+
NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num]
|
|
55
|
+
else:
|
|
56
|
+
rx_brg_ant_polarization_num = 1
|
|
57
|
+
result = [NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num]
|
|
58
|
+
return result
|
|
59
|
+
|
|
60
|
+
def terminate_test(test, phase, revert_rx_brg=False, revert_tx_brg=False, modules=[]):
|
|
61
|
+
# Temp solution for internal_brg test because test_epilog doesn't support both internal brg and test.brgs
|
|
62
|
+
utPrint(f"Terminating test (phase={phase})!!!!!!!!\n", "BLUE")
|
|
63
|
+
if revert_rx_brg:
|
|
64
|
+
restore_modules = [modules[1]] if (test.internal_brg or phase != 4) else modules
|
|
65
|
+
restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
|
|
66
|
+
utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
|
|
67
|
+
test, response = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)
|
|
68
|
+
if response == NO_RESPONSE and test.exit_on_param_failure:
|
|
69
|
+
test.rc = TEST_FAILED
|
|
70
|
+
test.add_reason(f"BRG {test.brg1.id_str} didn't revert modules "
|
|
71
|
+
f"{restore_modules} to default configuration!")
|
|
72
|
+
|
|
73
|
+
if revert_tx_brg:
|
|
74
|
+
restore_modules = [modules[0]] if (test.internal_brg or phase != 4) else modules
|
|
75
|
+
restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
|
|
76
|
+
utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
|
|
77
|
+
test, response = cert_config.config_brg_defaults(test, modules=restore_modules, ble5=True)
|
|
78
|
+
if response == NO_RESPONSE and test.exit_on_param_failure:
|
|
79
|
+
test.rc = TEST_FAILED
|
|
80
|
+
test.add_reason(f"BRG {test.brg0.id_str} didn't revert modules"
|
|
81
|
+
f"{restore_modules} to default configuration!")
|
|
82
|
+
return cert_common.test_epilog(test)
|
|
83
|
+
|
|
84
|
+
def brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
|
|
85
|
+
datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
|
|
86
|
+
|
|
87
|
+
# Phase 5 - Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
|
|
88
|
+
# The receiver isn't receiving any signal indicator packets.
|
|
89
|
+
phase = "brg0_tx_brg1_none"
|
|
90
|
+
tx_signal_ind_cycle = 15
|
|
91
|
+
tx_signal_ind_rep = 1
|
|
92
|
+
utPrint(f"TX BRG without RX - cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
|
|
93
|
+
# restore default configuration for receiver #
|
|
94
|
+
utPrint(f"Configuring BRG {rx_brg_.id_str} to default", "BOLD")
|
|
95
|
+
restore_modules = [modules[1]] if (test.internal_brg) else modules
|
|
96
|
+
test = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)[0]
|
|
97
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
98
|
+
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
99
|
+
test.add_reason(f"BRG {rx_brg_.id_str}: didn't revert to default configuration!")
|
|
100
|
+
|
|
101
|
+
# configuring transmitter #
|
|
102
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
103
|
+
test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep], ble5=True)[0]
|
|
104
|
+
if test.rc == TEST_FAILED:
|
|
105
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
106
|
+
|
|
107
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
108
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
|
|
109
|
+
f"repetition = {tx_signal_ind_rep}", "BOLD")
|
|
110
|
+
|
|
111
|
+
# phase analysis #
|
|
112
|
+
mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle*tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
|
|
113
|
+
expected_signal_ind_pkts = [0]
|
|
114
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
|
|
115
|
+
if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
|
|
116
|
+
test.rc = TEST_FAILED
|
|
117
|
+
test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG {rx_brg_.id_str}")
|
|
118
|
+
|
|
119
|
+
# Revert bridges to BLE4 before next loop
|
|
120
|
+
utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
|
|
121
|
+
test, response = cert_config.config_brg1_defaults(test, modules=[datapath_module], ble5=True)
|
|
122
|
+
if response == NO_RESPONSE and test.exit_on_param_failure:
|
|
123
|
+
test.rc = TEST_FAILED
|
|
124
|
+
test.add_reason(f"BRG {test.brg1.id_str} didn't revert datapath_module to default configuration!")
|
|
125
|
+
|
|
126
|
+
utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
|
|
127
|
+
test, response = cert_config.config_brg_defaults(test, modules=[datapath_module], ble5=True)
|
|
128
|
+
if response == NO_RESPONSE and test.exit_on_param_failure:
|
|
129
|
+
test.rc = TEST_FAILED
|
|
130
|
+
test.add_reason(f"BRG {test.brg0.id_str} didn't revert datapath module to default configuration!")
|
|
131
|
+
|
|
132
|
+
# Test epilog
|
|
133
|
+
return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
|
|
134
|
+
|
|
135
|
+
def brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
|
|
136
|
+
phase = "brg0_rxtx_brg1_rxtx"
|
|
137
|
+
|
|
138
|
+
if not test.internal_brg:
|
|
139
|
+
# Phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one.
|
|
140
|
+
# expecting to see signal indicator packets from both BRG's, according to the tx params.
|
|
141
|
+
utPrint(f"Both BRG's are transmitter and receivers, with different values\n", "BLUE")
|
|
142
|
+
|
|
143
|
+
# configuring first BRG (tx_brg_) #
|
|
144
|
+
tx_brg_signal_indicator_cycle = 15
|
|
145
|
+
tx_brg_signal_indicator_rep = 3
|
|
146
|
+
# configuring first brg (tx_brg_) as receiver
|
|
147
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
|
|
148
|
+
cert_config.brg_configure_ble5(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], wait=False)
|
|
149
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
150
|
+
utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
|
|
151
|
+
|
|
152
|
+
# configuring transmitter #
|
|
153
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
154
|
+
test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_brg_signal_indicator_cycle, tx_brg_signal_indicator_rep])[0]
|
|
155
|
+
if test.rc == TEST_FAILED:
|
|
156
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
157
|
+
|
|
158
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
159
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_brg_signal_indicator_cycle},"
|
|
160
|
+
f"repetition = {tx_brg_signal_indicator_rep}", "BOLD")
|
|
161
|
+
|
|
162
|
+
# configuring second brg (rx_brg_) as receiver
|
|
163
|
+
utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
|
|
164
|
+
test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
|
|
165
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
166
|
+
utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
|
|
167
|
+
|
|
168
|
+
# configuring second brg (rx_brg_) as transmitter
|
|
169
|
+
utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
170
|
+
rx_brg_signal_indicator_cycle = 15
|
|
171
|
+
rx_brg_signal_indicator_rep = 4
|
|
172
|
+
test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[rx_brg_signal_indicator_cycle, rx_brg_signal_indicator_rep], ble5=True)[0]
|
|
173
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
174
|
+
if test.rc == TEST_FAILED:
|
|
175
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
176
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {rx_brg_signal_indicator_cycle},"
|
|
177
|
+
f"repetition = {rx_brg_signal_indicator_rep}")
|
|
178
|
+
|
|
179
|
+
# phase analysis #
|
|
180
|
+
mqtt_scan_n_create_log_file(test, NUM_OF_SCANNING_tx_signal_ind_cycle * max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) + SCAN_DELAY_TIME, phase)
|
|
181
|
+
|
|
182
|
+
# Analyzing tx_brg_ performance as receiver
|
|
183
|
+
utPrint(f"Analyzing tx_brg {tx_brg_.id_str} performance as a Receiver\n", "BOLD")
|
|
184
|
+
rx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / rx_brg_signal_indicator_cycle
|
|
185
|
+
expected_signal_ind_pkts = [int(x * rx_brg_tx_cycles) for x in expected_signal_ind_pkts_calc(rx_brg_, tx_brg_)]
|
|
186
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=tx_brg_, tx_brg=rx_brg_)
|
|
187
|
+
txt = f"""Phase {phase} - BRG {tx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
|
|
188
|
+
print(txt)
|
|
189
|
+
if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
|
|
190
|
+
test.rc = TEST_FAILED
|
|
191
|
+
test.add_reason(txt)
|
|
192
|
+
|
|
193
|
+
# Analyzing rx_brg_ performance as receiver
|
|
194
|
+
utPrint(f"Analyzing rx_brg {rx_brg_.id_str} performance as a Receiver\n", "BOLD")
|
|
195
|
+
tx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / tx_brg_signal_indicator_cycle
|
|
196
|
+
expected_signal_ind_pkts = [int(x * tx_brg_tx_cycles) for x in expected_signal_ind_pkts_calc(rx_brg_, tx_brg_)]
|
|
197
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
|
|
198
|
+
txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
|
|
199
|
+
print(txt)
|
|
200
|
+
if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
|
|
201
|
+
test.rc = TEST_FAILED
|
|
202
|
+
test.add_reason(txt)
|
|
203
|
+
else:
|
|
204
|
+
test.add_reason("skip for internal BRG")
|
|
205
|
+
return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
|
|
206
|
+
|
|
207
|
+
def brg0_none_brg1_rx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
|
|
208
|
+
phase = "brg0_none_brg1_rx"
|
|
209
|
+
# Phase 3 - Rx BRG without tx.Expecting no signal indicator packets to be received.
|
|
210
|
+
tx_signal_ind_cycle = ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE
|
|
211
|
+
tx_signal_ind_rep = ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP
|
|
212
|
+
utPrint(f"RX BRG without TX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
|
|
213
|
+
|
|
214
|
+
# configuring transmitter #
|
|
215
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
216
|
+
test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
|
|
217
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
218
|
+
if test.rc == TEST_FAILED:
|
|
219
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
220
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to default!!! cycle = {tx_signal_ind_cycle},"f"repetition = {tx_signal_ind_rep}", "BOLD")
|
|
221
|
+
|
|
222
|
+
# phase analysis #
|
|
223
|
+
mqtt_scan_n_create_log_file(test, DEFAULT_SCAN_TIME, phase)
|
|
224
|
+
expected_signal_ind_pkts = [0]
|
|
225
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
|
|
226
|
+
if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
|
|
227
|
+
test.rc = TEST_FAILED
|
|
228
|
+
test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG"
|
|
229
|
+
f"{rx_brg_.id_str}")
|
|
230
|
+
return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
|
|
231
|
+
|
|
232
|
+
def brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
|
|
233
|
+
phase = "brg0_rx_brg1_tx"
|
|
234
|
+
cycle_rep = [(30,3), (60,4)]
|
|
235
|
+
for tx_signal_ind_cycle, tx_signal_ind_rep in cycle_rep:
|
|
236
|
+
|
|
237
|
+
utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
|
|
238
|
+
# configuring receiver #
|
|
239
|
+
utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
|
|
240
|
+
test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep])[0]
|
|
241
|
+
if test.rc == TEST_FAILED:
|
|
242
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
243
|
+
|
|
244
|
+
# configuring transmitter #
|
|
245
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
246
|
+
test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
|
|
247
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
248
|
+
if test.rc == TEST_FAILED:
|
|
249
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
250
|
+
|
|
251
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"f"repetition = {tx_signal_ind_rep}", "BOLD")
|
|
252
|
+
|
|
253
|
+
# phase analysis
|
|
254
|
+
mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
|
|
255
|
+
expected_signal_ind_pkts = expected_signal_ind_pkts_calc(tx_brg_, rx_brg_)
|
|
256
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
|
|
257
|
+
txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
|
|
258
|
+
print(txt)
|
|
259
|
+
#TODO: change condition
|
|
260
|
+
if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
|
|
261
|
+
test.rc = TEST_FAILED
|
|
262
|
+
test.add_reason(txt)
|
|
263
|
+
return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
|
|
264
|
+
|
|
265
|
+
def rssi_threshold(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
|
|
266
|
+
phase = "rssi_threshold"
|
|
267
|
+
# RSSI Threshold
|
|
268
|
+
rssi_threshold = -25
|
|
269
|
+
tx_signal_ind_cycle = 15
|
|
270
|
+
tx_signal_ind_rep = 3
|
|
271
|
+
utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
|
|
272
|
+
|
|
273
|
+
# configuring receiver #
|
|
274
|
+
utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
|
|
275
|
+
test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR, rssi_threshold], ble5=True)[0]
|
|
276
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
277
|
+
|
|
278
|
+
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
279
|
+
test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
|
|
280
|
+
|
|
281
|
+
# configuring transmitter #
|
|
282
|
+
utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
|
|
283
|
+
test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
|
|
284
|
+
print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
|
|
285
|
+
if test.rc == TEST_FAILED:
|
|
286
|
+
test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
|
|
287
|
+
|
|
288
|
+
utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
|
|
289
|
+
f"repetition = {tx_signal_ind_rep}", "BOLD")
|
|
290
|
+
# phase analysis #
|
|
291
|
+
mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
|
|
292
|
+
received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
|
|
293
|
+
rssi_threshold_viloation_pkts = [p for p in received_signal_ind_pkts if p[RSSI] >= -1*rssi_threshold]
|
|
294
|
+
if rssi_threshold_viloation_pkts:
|
|
295
|
+
test.rc = TEST_FAILED
|
|
296
|
+
test.add_reason(f"rssi_threshold phase failed - BRG {rx_brg_.id_str} echoed" +
|
|
297
|
+
f" {len(rssi_threshold_viloation_pkts)} signal indicator packets\n with RSSI weaker than {rssi_threshold}")
|
|
298
|
+
field_functionality_pass_fail_print(test, 'phase', phase)
|
|
299
|
+
|
|
300
|
+
return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
SIGNAL_INDICATOR_TEST_MAP = {
|
|
304
|
+
"rssi_threshold" : rssi_threshold, # phase 0
|
|
305
|
+
"brg0_rx_brg1_tx": brg0_rx_brg1_tx, # phase 1 + 2
|
|
306
|
+
"brg0_none_brg1_rx": brg0_none_brg1_rx, # phase 3
|
|
307
|
+
"brg0_rxtx_brg1_rxtx": brg0_rxtx_brg1_rxtx, # phase 4, skip for internal brg
|
|
308
|
+
"brg0_tx_brg1_none": brg0_tx_brg1_none} # phase 5
|
|
309
|
+
|
|
310
|
+
def run(test):
|
|
311
|
+
|
|
312
|
+
# Test modules evaluation #
|
|
313
|
+
energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
|
|
314
|
+
ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
|
|
315
|
+
datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
|
|
316
|
+
|
|
317
|
+
# Transmitter related defines #
|
|
318
|
+
tx_brg_ = test.brg0
|
|
319
|
+
tx_module = energy2400_module
|
|
320
|
+
|
|
321
|
+
# Receiver related defines #
|
|
322
|
+
rx_brg_ = test.brg1
|
|
323
|
+
|
|
324
|
+
# Modules list #
|
|
325
|
+
modules = [tx_module, ext_sensors_module]
|
|
326
|
+
|
|
327
|
+
# Test prolog
|
|
328
|
+
test = cert_common.test_prolog(test)
|
|
329
|
+
test = cert_config.brg_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K], module=datapath_module)[0]
|
|
330
|
+
test = cert_config.brg1_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K], module=datapath_module)[0]
|
|
331
|
+
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
332
|
+
return terminate_test(test, phase=1, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
|
|
333
|
+
for param in test.params:
|
|
334
|
+
functionality_run_print(param.name)
|
|
335
|
+
test = SIGNAL_INDICATOR_TEST_MAP[param.value](test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules)
|
|
336
|
+
generate_log_file(test, param.name)
|
|
337
|
+
field_functionality_pass_fail_print(test, param.name)
|
|
338
|
+
test.set_phase_rc(param.name, test.rc)
|
|
339
|
+
test.add_phase_reason(param.name, test.reason)
|
|
340
|
+
if test.rc == TEST_FAILED and test.exit_on_param_failure:
|
|
341
|
+
break
|
|
342
|
+
else:
|
|
343
|
+
test.reset_result()
|
|
344
|
+
|
|
345
|
+
return cert_common.test_epilog(test, revert_brgs=True, modules=[energy2400_module, ext_sensors_module],
|
|
346
|
+
brg1_modules=[energy2400_module, ext_sensors_module])
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "signal_indicator_functionality_ble5_10_500k_test",
|
|
3
|
+
"module": "energy2400",
|
|
4
|
+
"purpose": "TODO",
|
|
5
|
+
"documentation": "https://community.wiliot.com/customers/s/article/Bridge-to-Bridge-Signal-Indicator",
|
|
6
|
+
"initialCondition": "",
|
|
7
|
+
"procedure": ["Test prolog",
|
|
8
|
+
"rssi_threshold - check the if rssi value is between 0 to -25.",
|
|
9
|
+
"brg0_rx_brg1_tx - one brg is transmitter and the second is receiver, we expect to get the same values from the receiver, according to the tx params",
|
|
10
|
+
"brg0_none_brg1_rx - One rx BRG without any tx BRG. We don't expect to see any signal indicator packets.",
|
|
11
|
+
"brg0_rxtx_brg1_rxtx - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect to see signal indicator packets from both BRG's, according to the tx params.",
|
|
12
|
+
"brg0_tx_brg1_none - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicator packets.",
|
|
13
|
+
"Test epilog"],
|
|
14
|
+
"expectedOutcome": "",
|
|
15
|
+
"mandatory": 0,
|
|
16
|
+
"multiBridgeTest": 1,
|
|
17
|
+
"gwOnlyTest": 0,
|
|
18
|
+
"internalBridge": 1,
|
|
19
|
+
"allSupportedValues": ["rssi_threshold", "brg0_rx_brg1_tx", "brg0_none_brg1_rx", "brg0_rxtx_brg1_rxtx", "brg0_tx_brg1_none"]
|
|
20
|
+
}
|