wiliot-certificate 1.5.0a1__py3-none-any.whl → 1.5.2a1__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 +17 -17
- brg_certificate/ag/energous_v1_defines.py +17 -17
- brg_certificate/ag/energous_v2_defines.py +17 -17
- brg_certificate/ag/energous_v3_defines.py +17 -17
- brg_certificate/ag/energous_v4_defines.py +17 -17
- brg_certificate/ag/fanstel_lan_v0_defines.py +17 -17
- brg_certificate/ag/fanstel_lte_v0_defines.py +17 -17
- brg_certificate/ag/fanstel_wifi_v0_defines.py +17 -17
- brg_certificate/ag/minew_lte_v0_defines.py +17 -17
- brg_certificate/ag/wlt_cmd_if.html +3 -2
- brg_certificate/ag/wlt_types.html +0 -1
- brg_certificate/ag/wlt_types_ag.py +151 -152
- brg_certificate/brg_certificate.py +38 -7
- brg_certificate/brg_certificate_cli.py +19 -3
- brg_certificate/cert_common.py +92 -55
- brg_certificate/cert_config.py +6 -4
- brg_certificate/cert_data_sim.py +47 -7
- brg_certificate/cert_defines.py +20 -6
- brg_certificate/cert_gw_sim.py +10 -6
- brg_certificate/cert_mqtt.py +9 -6
- brg_certificate/cert_prints.py +14 -1
- brg_certificate/cert_protobuf.py +7 -7
- brg_certificate/cert_results.py +131 -84
- brg_certificate/cert_utils.py +13 -7
- brg_certificate/certificate_bcc_sanity_test_list.txt +40 -0
- brg_certificate/certificate_bcc_test_list.txt +50 -0
- brg_certificate/certificate_sanity_test_list.txt +12 -5
- brg_certificate/certificate_test_list.txt +16 -6
- brg_certificate/tests/calibration/interval_test/interval_test.json +4 -3
- brg_certificate/tests/calibration/output_power_test/output_power_test.json +8 -5
- brg_certificate/tests/calibration/pattern_test/pattern_test.json +7 -4
- brg_certificate/tests/calibration/pattern_test/pattern_test.py +25 -26
- brg_certificate/tests/datapath/aging_test/aging_test.json +19 -0
- brg_certificate/tests/datapath/aging_test/aging_test.py +142 -0
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +10 -5
- brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +12 -11
- brg_certificate/tests/datapath/output_power_test/output_power_test.json +7 -4
- brg_certificate/tests/datapath/output_power_test/output_power_test.py +2 -1
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +8 -5
- brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +6 -3
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +7 -4
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +6 -3
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +7 -4
- brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +4 -2
- brg_certificate/tests/datapath/pattern_test/pattern_test.json +8 -5
- brg_certificate/tests/datapath/pattern_test/pattern_test.py +2 -1
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +11 -5
- brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +12 -5
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +10 -4
- brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +11 -6
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +10 -4
- brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +11 -7
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +8 -4
- brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +7 -5
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +7 -4
- brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +7 -3
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +4 -5
- brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +107 -73
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +4 -5
- brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +128 -118
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +15 -23
- brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +104 -103
- brg_certificate/tests/datapath/stress_test/stress_test.json +15 -23
- brg_certificate/tests/datapath/stress_test/stress_test.py +104 -110
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +8 -4
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +7 -2
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +8 -4
- brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +8 -6
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +4 -3
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +2 -38
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +15 -8
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +14 -8
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +11 -7
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +25 -12
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +11 -7
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +48 -3
- brg_certificate/tests/edge_mgmt/{stat_test/stat_test.json → periodic_msgs_test/periodic_msgs_test.json} +5 -4
- brg_certificate/tests/edge_mgmt/{stat_test/stat_test.py → periodic_msgs_test/periodic_msgs_test.py} +4 -4
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +8 -5
- brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +2 -1
- brg_certificate/tests/energy2400/output_power_test/output_power_test.json +9 -6
- brg_certificate/tests/energy2400/output_power_test/output_power_test.py +2 -1
- brg_certificate/tests/energy2400/pattern_test/pattern_test.json +8 -5
- brg_certificate/tests/energy2400/pattern_test/pattern_test.py +2 -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 +343 -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 +343 -0
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +14 -7
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +45 -57
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +14 -7
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +198 -125
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +7 -4
- brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +2 -1
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +13 -6
- brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +2 -1
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +14 -7
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +117 -124
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +7 -4
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +2 -1
- brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +18 -0
- brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +84 -0
- brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +21 -0
- brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +306 -0
- brg_certificate/wltPb_pb2.py +15 -15
- brg_certificate/wltPb_pb2.pyi +8 -2
- brg_certificate/wlt_types.py +2 -1
- gw_certificate/cert_results.py +11 -4
- gw_certificate/gw_certificate.py +0 -2
- gw_certificate/gw_certificate_cli.py +3 -3
- gw_certificate/interface/uart_if.py +1 -1
- gw_certificate/tests/actions.py +7 -1
- gw_certificate/tests/registration.py +2 -1
- gw_certificate/tests/uplink.py +26 -35
- {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/METADATA +46 -42
- {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/RECORD +120 -112
- {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/WHEEL +1 -1
- 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.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/entry_points.txt +0 -0
- {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info/licenses}/LICENSE +0 -0
- {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/top_level.txt +0 -0
|
@@ -38,6 +38,8 @@ def skip_test_check(test, args):
|
|
|
38
38
|
skip_string = ""
|
|
39
39
|
if test.multi_brg and not test.brg1:
|
|
40
40
|
skip_string = f"Skipped {test.module_name} multi brg test because brg1 wasn't given"
|
|
41
|
+
elif (args.brg_cloud_connectivity or test.internal_brg) and not test.test_json[INTERNAL_BRG]:
|
|
42
|
+
skip_string = f"Skipped {test.module_name} because test is unable to run on an internal brg"
|
|
41
43
|
elif args.skip_internal and test.internal_brg:
|
|
42
44
|
skip_string = f"Skipped {test.module_name} for internal brg because skip_internal flag is set"
|
|
43
45
|
elif test.active_brg and not test.active_brg.is_sup_cap(test):
|
|
@@ -86,7 +88,16 @@ def main(args):
|
|
|
86
88
|
sys.exit(0)
|
|
87
89
|
|
|
88
90
|
# Init mqtt client
|
|
89
|
-
|
|
91
|
+
if args.brg_cloud_connectivity:
|
|
92
|
+
# Mqtt client for tested device
|
|
93
|
+
mqttc = cert_mqtt.mqttc_init(args.brg_cloud_connectivity, data=args.data)
|
|
94
|
+
# Mqtt client for testing device
|
|
95
|
+
sim_mqttc = cert_mqtt.mqttc_init(args.gw, data=args.data)
|
|
96
|
+
else:
|
|
97
|
+
# Single mqtt client for a single device with cloud connectivity
|
|
98
|
+
mqttc = cert_mqtt.mqttc_init(args.gw, data=args.data)
|
|
99
|
+
sim_mqttc = mqttc
|
|
100
|
+
|
|
90
101
|
|
|
91
102
|
# Run Gateway Simulator in separated thread if exists
|
|
92
103
|
gw_sim_thread = None
|
|
@@ -105,12 +116,29 @@ def main(args):
|
|
|
105
116
|
|
|
106
117
|
# Prepare GW
|
|
107
118
|
if gw_sim_thread:
|
|
108
|
-
|
|
119
|
+
if args.brg_cloud_connectivity:
|
|
120
|
+
# Prepare tested device
|
|
121
|
+
gw, internal_brg, gw_server, gw_version, protobuf = ut_prep_gw(args, mqttc, start_time)
|
|
122
|
+
# Prepare testing device
|
|
123
|
+
_, internal_brg_sim, _, _, _ = cert_gw_sim.prep_gw(args, sim_mqttc, start_time)
|
|
124
|
+
else:
|
|
125
|
+
# Prepare single device with cloud connectivity
|
|
126
|
+
gw, internal_brg, gw_server, gw_version, protobuf = cert_gw_sim.prep_gw(args, mqttc, start_time)
|
|
109
127
|
else:
|
|
110
|
-
|
|
128
|
+
if args.brg_cloud_connectivity:
|
|
129
|
+
# Prepare tested device
|
|
130
|
+
gw, internal_brg, gw_server, gw_version, protobuf = ut_prep_gw(args, mqttc, start_time)
|
|
131
|
+
# Prepare testing device
|
|
132
|
+
_, internal_brg_sim, _, _, _ = ut_prep_gw(args, sim_mqttc, start_time, tester_gw=True)
|
|
133
|
+
else:
|
|
134
|
+
# Prepare single device with cloud connectivity
|
|
135
|
+
gw, internal_brg, gw_server, gw_version, protobuf = ut_prep_gw(args, mqttc, start_time)
|
|
111
136
|
|
|
112
137
|
brg0, brg1 = None, None
|
|
113
|
-
if args.
|
|
138
|
+
if args.brg_cloud_connectivity:
|
|
139
|
+
brg0 = internal_brg
|
|
140
|
+
internal_brg = internal_brg_sim
|
|
141
|
+
elif args.brg:
|
|
114
142
|
brg0 = ut_prep_brg(args, mqttc, start_time, gw, args.brg, gw_server, protobuf)
|
|
115
143
|
if args.brg1:
|
|
116
144
|
brg1 = ut_prep_brg(args, mqttc, start_time, gw, args.brg1, gw_server, protobuf)
|
|
@@ -119,7 +147,7 @@ def main(args):
|
|
|
119
147
|
tests = []
|
|
120
148
|
for l in open(os.path.join(BASE_DIR, test_list)).readlines():
|
|
121
149
|
if l.strip() and not l.strip().startswith("#"):
|
|
122
|
-
test = (WltTest(l.strip(), gw, mqttc, exit_on_param_failure=args.exit_on_param_failure, gw_lan=args.lan,
|
|
150
|
+
test = (WltTest(l.strip(), gw, mqttc, sim_mqttc=sim_mqttc, exit_on_param_failure=args.exit_on_param_failure, gw_lan=args.lan,
|
|
123
151
|
gw_orig_versions={BLE_VERSION:gw_version[BLE_VERSION], WIFI_VERSION:gw_version[WIFI_VERSION]},
|
|
124
152
|
server=gw_server, latest=args.latest, release_candidate=args.rc, private_setup=args.private_setup, internal_brg_obj=internal_brg,
|
|
125
153
|
gw_sim=gw_sim_thread, data=args.data, port=args.port, protobuf=protobuf))
|
|
@@ -150,6 +178,8 @@ def main(args):
|
|
|
150
178
|
test_module_name = load_module(f'{test.module_name}.py', f'{test.dir}/{test.module_name}.py')
|
|
151
179
|
test = skip_test_check(test, args)
|
|
152
180
|
if test.rc == TEST_SKIPPED:
|
|
181
|
+
for phase in test.phases:
|
|
182
|
+
phase.rc = TEST_SKIPPED
|
|
153
183
|
skipped += 1
|
|
154
184
|
else:
|
|
155
185
|
test = test_module_name.run(test)
|
|
@@ -182,8 +212,9 @@ def main(args):
|
|
|
182
212
|
print_pass_or_fail(not failures, f"Wiliot Certificate")
|
|
183
213
|
|
|
184
214
|
pipeline = cert_common.pipeline_running()
|
|
185
|
-
|
|
186
|
-
|
|
215
|
+
# brg = args.brg_cloud_connectivity if args.brg_cloud_connectivity else args.brg
|
|
216
|
+
cert_results.generate_results_files(html=True, pdf=True, failures=failures, skipped=skipped, start_time=start_time, duration=duration,
|
|
217
|
+
brg=test.active_brg, internal_brg=internal_brg, tests=tests, pipeline=pipeline)
|
|
187
218
|
if not pipeline:
|
|
188
219
|
webbrowser.open('file://' + os.path.realpath(os.path.join(BASE_DIR, UT_RESULT_FILE_PDF)))
|
|
189
220
|
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import os
|
|
3
3
|
sys.path.insert(0, os.path.abspath(".."))
|
|
4
|
-
from argparse import ArgumentParser
|
|
4
|
+
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|
5
5
|
from brg_certificate.cert_defines import DATA_REAL_TAGS, DATA_SIMULATION
|
|
6
6
|
import brg_certificate.brg_certificate as brg_certificate
|
|
7
|
-
TEST_LIST_DEFAULT_FILE = "
|
|
7
|
+
TEST_LIST_DEFAULT_FILE = "certificate_test_list.txt"
|
|
8
8
|
|
|
9
9
|
class BrgCertificateCLI:
|
|
10
10
|
"""Bridge Certificate CLI."""
|
|
11
11
|
def __init__(self):
|
|
12
12
|
self.parser = ArgumentParser(
|
|
13
13
|
description="Bridge Certificate CLI",
|
|
14
|
+
epilog=
|
|
15
|
+
"run examples:\n"
|
|
16
|
+
" Run command example with COM PORT connection:\n"
|
|
17
|
+
" wlt-cert-brg --gw SIM --brg <XXXXXXXXXXXX> --port <COM_PORT>\n"
|
|
18
|
+
" Run command example with remote GW connection:\n"
|
|
19
|
+
" wlt-cert-brg --gw <YYYYYYYYYYYY> --brg <XXXXXXXXXXXX>\n"
|
|
20
|
+
" Run command example for running datapath module tests only:\n"
|
|
21
|
+
" wlt-cert-brg --gw <YYYYYYYYYYYY> --brg <XXXXXXXXXXXX> --run datapath\n"
|
|
22
|
+
" Run command example with sanity test list:\n"
|
|
23
|
+
" wlt-cert-brg --gw <YYYYYYYYYYYY> --brg <XXXXXXXXXXXX> --tl certificate_sanity_test_list.txt\n"
|
|
24
|
+
" Run command example with COM PORT connection for bridge with cloud connectivity:\n"
|
|
25
|
+
" wlt-cert-brg --gw SIM --brg_cloud_connectivity <XXXXXXXXXXXX> --tl certificate_bcc_test_list.txt --port <COM_PORT>\n"
|
|
26
|
+
" Run command example with remote GW connection for bridge with cloud connectivity:\n"
|
|
27
|
+
" wlt-cert-brg --gw <YYYYYYYYYYYY> --brg_cloud_connectivity <XXXXXXXXXXXX> --tl certificate_bcc_test_list.txt\n",
|
|
28
|
+
formatter_class=RawDescriptionHelpFormatter
|
|
14
29
|
)
|
|
15
30
|
self.parser.add_argument('--brg', '-b', default="", help='Bridge id to run on the tests')
|
|
31
|
+
self.parser.add_argument('--brg_cloud_connectivity', '-bcc', default="", help='Bridge with cloud connectivity id to run on the tests')
|
|
16
32
|
self.parser.add_argument('--brg1', '-b1', default="", help='Second bridge id to run on tests two bridges needed')
|
|
17
33
|
self.parser.add_argument('--gw', '-g', type=str, required=True, help='GW id to run on the test, SIM prefix is used for Gateway simulation')
|
|
18
|
-
self.parser.add_argument('--data', '-d', choices=[DATA_REAL_TAGS, DATA_SIMULATION], default=
|
|
34
|
+
self.parser.add_argument('--data', '-d', choices=[DATA_REAL_TAGS, DATA_SIMULATION], default=DATA_SIMULATION, help='Choose if data generated from real tags or by simulation')
|
|
19
35
|
self.parser.add_argument('--port', '-p', default='', help='Enable UT using UART connection for Gateway Simulation or Data Simulation')
|
|
20
36
|
self.parser.add_argument('--clean', default=False, action='store_true', help='Clean all logs')
|
|
21
37
|
self.parser.add_argument('--tl', type=str, help='Test list file to use', default=TEST_LIST_DEFAULT_FILE)
|
brg_certificate/cert_common.py
CHANGED
|
@@ -15,9 +15,24 @@ DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
|
|
|
15
15
|
# Returns a 12 chars long hex string
|
|
16
16
|
int2mac_get = lambda int_val: f"{int_val:012X}"
|
|
17
17
|
|
|
18
|
+
# Returns True if running with bridge with cloud connectivity, else False
|
|
19
|
+
is_bcc_running = lambda test: not (test.sim_mqttc == test.mqttc)
|
|
20
|
+
|
|
21
|
+
# Returns True if running from PyPi package, else False
|
|
22
|
+
is_cert_running = lambda : not (CERT_VERSION == LOCAL_DEV)
|
|
23
|
+
|
|
18
24
|
def name_to_val(name):
|
|
19
25
|
return globals()[name]
|
|
20
26
|
|
|
27
|
+
|
|
28
|
+
def get_module_by_name(modules, name):
|
|
29
|
+
# Get module from active modules in device (loaded from board type ag defines)
|
|
30
|
+
for module in modules:
|
|
31
|
+
if name in module.__name__:
|
|
32
|
+
return module
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
21
36
|
def test_prolog(test):
|
|
22
37
|
"""
|
|
23
38
|
kicks off the test:
|
|
@@ -154,8 +169,12 @@ def get_gw_geolocation(test):
|
|
|
154
169
|
for p in test.mqttc._userdata[PKTS].status:
|
|
155
170
|
if GW_INFO in p.body:
|
|
156
171
|
print_pkt(p.body)
|
|
157
|
-
|
|
158
|
-
|
|
172
|
+
if test.protobuf:
|
|
173
|
+
gw_lat = p.body[GW_INFO][ENTRIES][GW_LATITUDE][NUM_VAL]
|
|
174
|
+
gw_lng = p.body[GW_INFO][ENTRIES][GW_LONGITUDE][NUM_VAL]
|
|
175
|
+
else:
|
|
176
|
+
gw_lat = p.body[GW_INFO][GW_LATITUDE]
|
|
177
|
+
gw_lng = p.body[GW_INFO][GW_LONGITUDE]
|
|
159
178
|
print(f"gw_lat:{gw_lat} \ngw_lng:{gw_lng}")
|
|
160
179
|
found = True
|
|
161
180
|
print_update_wait()
|
|
@@ -406,7 +425,7 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
|
|
|
406
425
|
if pkt_filter_cfg != ag.PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT:
|
|
407
426
|
for pkt_type in list(df[PACKET_TYPE].unique()):
|
|
408
427
|
if ((pkt_filter_cfg & (1 << pkt_type)) == 0
|
|
409
|
-
and not (is_ble5_test and test.internal_brg and pkt_type == ag.PKT_TYPE_BLE5_EXTENDED_TEMP_ADVANCED)):
|
|
428
|
+
and not (is_ble5_test and (test.internal_brg or is_bcc_running(test)) and pkt_type == ag.PKT_TYPE_BLE5_EXTENDED_TEMP_ADVANCED)):
|
|
410
429
|
test.rc = TEST_FAILED
|
|
411
430
|
test.add_reason(f"Tag is of packet type {pkt_type} which is turned off in packet_types_mask configuration!")
|
|
412
431
|
return test
|
|
@@ -414,7 +433,10 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
|
|
|
414
433
|
# Verify the tags count according to simulation data and pkt_filter_cfg
|
|
415
434
|
tags_count = len(list(df[TAG_ID].unique()))
|
|
416
435
|
if test.data == DATA_SIMULATION and num_of_pixels:
|
|
417
|
-
if
|
|
436
|
+
if is_ble5_test and is_bcc_running(test):
|
|
437
|
+
# In ble5 bcc packet type 2 extended uploaded as is without splitting to ble4 packets
|
|
438
|
+
expected_tags_count = num_of_pixels
|
|
439
|
+
elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_ADVANCED_PKTS or pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_DEBUG_PKTS:
|
|
418
440
|
expected_tags_count = num_of_pixels * 2
|
|
419
441
|
elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_ADVANCED_AND_DEBUG_PKTS:
|
|
420
442
|
expected_tags_count = num_of_pixels * 3
|
|
@@ -439,17 +461,10 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
|
|
|
439
461
|
if test.data == DATA_SIMULATION and (avg_pacer / pacer_interval) > PACER_INTERVAL_CEIL_THRESHOLD:
|
|
440
462
|
failed_tags += 1
|
|
441
463
|
print(f"Tag {tag} with diff_time {list(pkts.timestamp.diff().div(1000))}, avg_pacer={avg_pacer} exceeds {PACER_INTERVAL_CEIL_THRESHOLD} maximum threshold!")
|
|
442
|
-
if failed_tags >
|
|
464
|
+
if failed_tags/tags_count > 0.2: # Fail the test on ceil threshold only when more than 20 % tag failed
|
|
465
|
+
test.add_reason(f"{failed_tags}/{tags_count} tags with wrong time diff")
|
|
443
466
|
test.rc = TEST_FAILED
|
|
444
467
|
|
|
445
|
-
# PASS test if only 1 tag out of many failed - this could be an issue with the tag
|
|
446
|
-
if tags_count >= PACER_INTERVAL_MIN_TAGS_COUNT and failed_tags <= PACER_INTERVAL_MAX_FAILED_TAGS:
|
|
447
|
-
test.rc = TEST_PASSED
|
|
448
|
-
# Addition to understand how many tags failed in total
|
|
449
|
-
if test.rc == TEST_FAILED:
|
|
450
|
-
test.add_reason(f"{failed_tags}/{tags_count} tags with wrong time diff")
|
|
451
|
-
print(test.reason)
|
|
452
|
-
return test
|
|
453
468
|
return test
|
|
454
469
|
|
|
455
470
|
def reboot_config_analysis(test, expected_hash, timeout=ACTION_LONG_TIMEOUT, ble_version=None, bl_version=None):
|
|
@@ -527,12 +542,14 @@ def scan_for_mgmt_pkts(test, mgmt_type):
|
|
|
527
542
|
print_update_wait()
|
|
528
543
|
pkts_collected = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=mgmt_type)
|
|
529
544
|
if pkts_collected:
|
|
530
|
-
|
|
545
|
+
#TODO: logging print
|
|
546
|
+
# utPrint("Found brg2gw_mgmt_pkts:", "GREEN")
|
|
531
547
|
seq_ids = []
|
|
532
548
|
for p in pkts_collected:
|
|
533
549
|
if seq_ids == [] or p[SEQUENCE_ID] not in seq_ids:
|
|
534
550
|
seq_ids.append(p[SEQUENCE_ID])
|
|
535
|
-
print
|
|
551
|
+
#TODO: Logging print
|
|
552
|
+
# print(p[MGMT_PKT].pkt)
|
|
536
553
|
ret_pkts.append(p)
|
|
537
554
|
found = True
|
|
538
555
|
break
|
|
@@ -721,25 +738,6 @@ def get_cfg_hash(test):
|
|
|
721
738
|
else:
|
|
722
739
|
return test, module_if_pkt.cfg_hash
|
|
723
740
|
|
|
724
|
-
def module_ack_search(test, test_pkt, mgmt_type, wait=True):
|
|
725
|
-
"""
|
|
726
|
-
module ack search
|
|
727
|
-
wait=False is for pwr mgmt off - in order to send the "off" pkt repeatidly while searching for the ack
|
|
728
|
-
"""
|
|
729
|
-
if wait:
|
|
730
|
-
test, mgmt_pkts = scan_for_mgmt_pkts(test, [mgmt_type])
|
|
731
|
-
else:
|
|
732
|
-
mgmt_pkts = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=[mgmt_type])
|
|
733
|
-
if not test.rc:
|
|
734
|
-
for p in mgmt_pkts:
|
|
735
|
-
pkt = p[MGMT_PKT].pkt
|
|
736
|
-
if (pkt == test_pkt.pkt):
|
|
737
|
-
return test, True
|
|
738
|
-
if wait:
|
|
739
|
-
test.rc = TEST_FAILED
|
|
740
|
-
test.add_reason(f"{mgmt_type} module does not match pkt received")
|
|
741
|
-
print(test.reason)
|
|
742
|
-
return test, False
|
|
743
741
|
|
|
744
742
|
def brg_restore_defaults_check(test):
|
|
745
743
|
print("Starting Restore Defaults Check")
|
|
@@ -762,19 +760,6 @@ def brg_restore_defaults_check(test):
|
|
|
762
760
|
print_update_wait()
|
|
763
761
|
return test, revived, output
|
|
764
762
|
|
|
765
|
-
def erase_sensors(test):
|
|
766
|
-
module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
|
|
767
|
-
wltpkt = WltPkt(hdr=DEFAULT_HDR, pkt=eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')(brg_mac=test.active_brg.id_int, msg_type=ag.BRG_MGMT_MSG_TYPE_CFG_SET, seq_id=random.randrange(99),
|
|
768
|
-
sensor0=0, sensor1=0))
|
|
769
|
-
print("Erasing all sensors from BRG {}".format(test.active_brg.id_int))
|
|
770
|
-
test = cert_config.brg_configure(test=test, cfg_pkt=wltpkt)[0]
|
|
771
|
-
|
|
772
|
-
if test.rc == TEST_FAILED:
|
|
773
|
-
test.add_reason("Failed to erase sensors! Didn't receive module ext sensors pkt")
|
|
774
|
-
else:
|
|
775
|
-
utPrint("SUCCESS! Module ext_sensors returned to default!", "GREEN")
|
|
776
|
-
return test
|
|
777
|
-
|
|
778
763
|
# Pwr Mgmt
|
|
779
764
|
def brg_pwr_mgmt_turn_on(test):
|
|
780
765
|
utPrint("Sending pwr_mgmt static mode configuration - 30 seconds ON, 60 seconds SLEEP!", "BLUE")
|
|
@@ -785,8 +770,7 @@ def brg_pwr_mgmt_turn_on(test):
|
|
|
785
770
|
brg_mac=test.active_brg.id_int, static_on_duration=30, static_sleep_duration=60,
|
|
786
771
|
dynamic_leds_on=0,dynamic_keep_alive_period=0, dynamic_keep_alive_scan=0,
|
|
787
772
|
dynamic_on_duration=0,dynamic_sleep_duration=0))
|
|
788
|
-
cert_config.
|
|
789
|
-
test = module_ack_search(test, test_pkt=wltpkt, mgmt_type=module)[0]
|
|
773
|
+
test = cert_config.brg_configure(test=test, cfg_pkt=wltpkt, module=module)[0]
|
|
790
774
|
|
|
791
775
|
if test.rc == TEST_FAILED:
|
|
792
776
|
test.add_reason("Turning pwr mgmt ON failed, Didn't receive GW MEL pwr mgmt ON pkt")
|
|
@@ -805,16 +789,15 @@ def brg_pwr_mgmt_turn_off(test):
|
|
|
805
789
|
static_on_duration=0,static_sleep_duration=0,
|
|
806
790
|
dynamic_leds_on=0,dynamic_keep_alive_period=0,
|
|
807
791
|
dynamic_keep_alive_scan=0,dynamic_on_duration=0,dynamic_sleep_duration=0))
|
|
808
|
-
found =
|
|
809
|
-
while
|
|
810
|
-
cert_config.
|
|
811
|
-
test, found = module_ack_search(test, wltpkt, module, wait=False)
|
|
792
|
+
found = NOT_FOUND
|
|
793
|
+
while found != DONE:
|
|
794
|
+
test, found = cert_config.brg_configure(test=test, cfg_pkt=wltpkt, module=module, wait=False)
|
|
812
795
|
if ((datetime.datetime.now() - start_time).seconds > (ag.PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD + 1)):
|
|
813
796
|
test.add_reason(f"Didn't receive GW MEL pwr mgmt OFF ack after {ag.PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD + 1} seconds")
|
|
814
797
|
test.rc = TEST_FAILED
|
|
815
798
|
break
|
|
816
799
|
print_update_wait()
|
|
817
|
-
if found:
|
|
800
|
+
if found == DONE:
|
|
818
801
|
utPrint(f"FOUND off pkt after {(datetime.datetime.now() - start_time)} secs", "GREEN")
|
|
819
802
|
utPrint("SUCCESS! pwr mgmt static mode turned off!", "GREEN")
|
|
820
803
|
return test
|
|
@@ -833,4 +816,58 @@ def value_check_if_y(test, received_value, stage):
|
|
|
833
816
|
if 'y' != received_value.lower():
|
|
834
817
|
test.rc = TEST_FAILED
|
|
835
818
|
test.add_reason(f"{stage} failed")
|
|
836
|
-
return test
|
|
819
|
+
return test
|
|
820
|
+
|
|
821
|
+
# Signal Indicator functions
|
|
822
|
+
def dual_polarization_ant_boards_get():
|
|
823
|
+
return [ag.BOARD_TYPE_MINEW_SINGLE_BAND_V0, ag.BOARD_TYPE_MINEW_DUAL_BAND_V0,
|
|
824
|
+
ag.BOARD_TYPE_ENERGOUS_V2, ag.BOARD_TYPE_ERM_V0, ag.BOARD_TYPE_ERM_V1,
|
|
825
|
+
ag.BOARD_TYPE_MINEW_POE_V0]
|
|
826
|
+
|
|
827
|
+
def exp_sig_ind_pkts(tx_brg, rx_brg, cycles):
|
|
828
|
+
if tx_brg.board_type in dual_polarization_ant_boards_get():
|
|
829
|
+
tx_brg_ant_polarization_num = 2
|
|
830
|
+
else:
|
|
831
|
+
tx_brg_ant_polarization_num = 1
|
|
832
|
+
if rx_brg.board_type in dual_polarization_ant_boards_get():
|
|
833
|
+
rx_brg_ant_polarization_num = 2
|
|
834
|
+
else:
|
|
835
|
+
rx_brg_ant_polarization_num = 1
|
|
836
|
+
|
|
837
|
+
expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
|
|
838
|
+
# Allow missing 1 pkt
|
|
839
|
+
return [expected - 1, expected]
|
|
840
|
+
|
|
841
|
+
def exp_sig_ind_pkts2(tx_brg, rx_brg, cycles):
|
|
842
|
+
if tx_brg.board_type in dual_polarization_ant_boards_get():
|
|
843
|
+
tx_brg_ant_polarization_num = 2
|
|
844
|
+
else:
|
|
845
|
+
tx_brg_ant_polarization_num = 1
|
|
846
|
+
if rx_brg.board_type in dual_polarization_ant_boards_get():
|
|
847
|
+
rx_brg_ant_polarization_num = 2
|
|
848
|
+
else:
|
|
849
|
+
rx_brg_ant_polarization_num = 1
|
|
850
|
+
|
|
851
|
+
expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
|
|
852
|
+
return expected
|
|
853
|
+
|
|
854
|
+
def sig_ind_pkts_fail_analysis(tx_brg, rx_brg, cycles, received_pkts):
|
|
855
|
+
|
|
856
|
+
expected = exp_sig_ind_pkts2(tx_brg, rx_brg, cycles)
|
|
857
|
+
print(f"Expected pkts: {expected}, Received pkts: {len(received_pkts)}")
|
|
858
|
+
# Allow missing 25% max
|
|
859
|
+
if int(0.75 * expected) <= len(received_pkts) <= int(1.25 * expected):
|
|
860
|
+
return False
|
|
861
|
+
return True
|
|
862
|
+
|
|
863
|
+
def get_all_sig_ind_pkts(test=None, rx_brg=None, tx_brg=None):
|
|
864
|
+
if rx_brg == test.brg1:
|
|
865
|
+
all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(test=test)
|
|
866
|
+
elif rx_brg == test.brg0:
|
|
867
|
+
all_sensor_packets = cert_mqtt.get_all_sensor_pkts(test=test)
|
|
868
|
+
signal_ind_pkts = []
|
|
869
|
+
for p in all_sensor_packets:
|
|
870
|
+
if (p[SENSOR_UUID] == f"{ag.SENSOR_SERVICE_ID_SIGNAL_INDICATOR:06X}" and
|
|
871
|
+
p[BRIDGE_ID] == rx_brg.id_str and p[SENSOR_ID] == tx_brg.id_alias):
|
|
872
|
+
signal_ind_pkts.append(p)
|
|
873
|
+
return signal_ind_pkts
|
brg_certificate/cert_config.py
CHANGED
|
@@ -64,7 +64,8 @@ def create_gw_config(test, cfg, version=""):
|
|
|
64
64
|
|
|
65
65
|
def gw_downlink(test, raw_tx_data="", is_ota=False, version="", max_duration=100, max_retries=8):
|
|
66
66
|
pkt = create_gw_downlink_pkt(test, raw_tx_data, is_ota, version=version, max_duration=max_duration, max_retries=max_retries)
|
|
67
|
-
|
|
67
|
+
#TODO: logging print
|
|
68
|
+
# print("GW Downlink:", pkt)
|
|
68
69
|
payload = cert_protobuf.downlink_to_pb(pkt) if test.protobuf else json.dumps(pkt)
|
|
69
70
|
test.mqttc.publish(test.mqttc.update_topic, payload=payload, qos=1)
|
|
70
71
|
|
|
@@ -73,9 +74,9 @@ def create_gw_downlink_pkt(test, raw_tx_data="", is_ota=False, version="", max_d
|
|
|
73
74
|
TX_MAX_DURATION_MS: max_duration,
|
|
74
75
|
TX_MAX_RETRIES: max_retries})
|
|
75
76
|
if is_ota == False:
|
|
76
|
-
ret[ACTION] =
|
|
77
|
+
ret[ACTION] = ACTION_ADVERTISING
|
|
77
78
|
else:
|
|
78
|
-
ret[ACTION] =
|
|
79
|
+
ret[ACTION] = ACTION_BRG_OTA
|
|
79
80
|
ret[GW_ID] = str(test.gw)
|
|
80
81
|
ret[BRIDGE_ID] = test.active_brg.id_str
|
|
81
82
|
ret[IMG_DIR_URL] = f"https://api.us-east-2.prod.wiliot.cloud/v1/bridge/type/{test.active_brg.board_type}/version/{version}/binary/"
|
|
@@ -262,7 +263,8 @@ def internal_brg_configure(test, cfg_pkt=None, module=None, fields=None, values=
|
|
|
262
263
|
return test, res
|
|
263
264
|
|
|
264
265
|
def send_brg_action(test, action_id, **kwargs):
|
|
265
|
-
|
|
266
|
+
#TODO: logging print
|
|
267
|
+
# print(f"\nSending {ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version} with parameters={kwargs if kwargs else None}")
|
|
266
268
|
test.mqttc.flush_pkts()
|
|
267
269
|
action_pkt = get_default_brg_pkt(test, pkt_type=eval_pkt(f'{ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version}'), **kwargs)
|
|
268
270
|
gw_downlink(test, raw_tx_data=action_pkt.dump())
|
brg_certificate/cert_data_sim.py
CHANGED
|
@@ -126,13 +126,28 @@ class WiliotPixelGen3Extended:
|
|
|
126
126
|
adva-6 adi-2 hdr-7 nonce/pkt_id-4 uid-6 mic-6 payload0-8 payload1-8 """
|
|
127
127
|
return self.adva + self.adi + self.hdr.dump() + self.get_pkt_id() + self.uid + self.mic + self.payload0 + self.payload1
|
|
128
128
|
|
|
129
|
+
class RawData:
|
|
130
|
+
"""Represents Explicit Data. Can be sensors, tags or anything else"""
|
|
131
|
+
def __init__(self, raw):
|
|
132
|
+
self.raw = raw
|
|
133
|
+
|
|
134
|
+
def __repr__(self) -> str:
|
|
135
|
+
return f'RawPkt: {self.get_pkt()}'
|
|
136
|
+
|
|
137
|
+
def set_pkt_type(self, _):
|
|
138
|
+
pass
|
|
139
|
+
def get_pkt(self):
|
|
140
|
+
return self.raw
|
|
141
|
+
|
|
129
142
|
class DataSimThread(threading.Thread):
|
|
130
|
-
def __init__(self, test, num_of_pixels, duplicates, delay, pkt_types, pixels_type=GEN2):
|
|
143
|
+
def __init__(self, test, num_of_pixels, duplicates, delay, pkt_types, pixels_type=GEN2, pkts=[]):
|
|
131
144
|
super().__init__()
|
|
132
145
|
self.test = test
|
|
133
146
|
self.num_of_pixels = num_of_pixels
|
|
134
|
-
# Create
|
|
135
|
-
if pixels_type ==
|
|
147
|
+
# Create data list
|
|
148
|
+
if pixels_type == RAW_DATA:
|
|
149
|
+
self.pixels = [RawData(p) for p in pkts]
|
|
150
|
+
elif pixels_type == GEN2:
|
|
136
151
|
self.pixels = [WiliotPixelGen2() for _ in range(self.num_of_pixels)]
|
|
137
152
|
elif pixels_type == GEN3:
|
|
138
153
|
self.pixels = [WiliotPixelGen3() for _ in range(self.num_of_pixels)]
|
|
@@ -144,18 +159,30 @@ class DataSimThread(threading.Thread):
|
|
|
144
159
|
self.delay = delay
|
|
145
160
|
self.pkt_types = pkt_types
|
|
146
161
|
self._stop_event = threading.Event()
|
|
162
|
+
self._pause_event = threading.Event()
|
|
163
|
+
self._pause_event.set()
|
|
147
164
|
self.daemon = True
|
|
148
165
|
|
|
149
166
|
def run(self):
|
|
150
167
|
write_to_data_sim_log_file(f"num_of_pixels={self.num_of_pixels} duplicates={self.duplicates} delay={self.delay} pkt_types={self.pkt_types}\n")
|
|
151
168
|
# Run pixel_sim loop
|
|
152
169
|
while not self._stop_event.is_set():
|
|
170
|
+
self._pause_event.wait()
|
|
153
171
|
for i in range(self.num_of_pixels):
|
|
172
|
+
if self._stop_event.is_set():
|
|
173
|
+
return
|
|
174
|
+
if not self._pause_event.is_set():
|
|
175
|
+
break
|
|
154
176
|
for pkt_type in self.pkt_types:
|
|
177
|
+
if not self._pause_event.is_set():
|
|
178
|
+
break
|
|
155
179
|
pkt = self.pixels[i]
|
|
156
180
|
pkt.set_pkt_type(pkt_type)
|
|
181
|
+
|
|
157
182
|
# Set pkt_id, in Gen3 pkt_type_1 has pkt_id_0+1
|
|
158
|
-
if type(pkt) ==
|
|
183
|
+
if type(pkt) == RawData:
|
|
184
|
+
pass
|
|
185
|
+
elif type(pkt) == WiliotPixelGen3:
|
|
159
186
|
if pkt_type == 1:
|
|
160
187
|
if self.pkt_types == [0,1]:
|
|
161
188
|
pkt.pkt_id += 1
|
|
@@ -175,14 +202,27 @@ class DataSimThread(threading.Thread):
|
|
|
175
202
|
TX_MAX_RETRIES: self.duplicates,
|
|
176
203
|
TX_MAX_DURATION_MS: 100,
|
|
177
204
|
ACTION: 0}
|
|
178
|
-
|
|
205
|
+
# Use protobuf if protubuf flag is set to True AND data sim does not use a gw simulator board
|
|
206
|
+
if self.test.protobuf == True and not self.test.gw_sim:
|
|
179
207
|
payload = cert_protobuf.downlink_to_pb(msg)
|
|
180
208
|
else:
|
|
181
209
|
payload = json.dumps(msg)
|
|
182
|
-
self.test.
|
|
210
|
+
self.test.sim_mqttc.publish(self.test.sim_mqttc.update_topic, payload=payload)
|
|
183
211
|
write_to_data_sim_log_file(f"{pkt}" + " {}\n".format(datetime.datetime.now().strftime("%d/%m,%H:%M:%S.%f")[:-4]))
|
|
184
212
|
actual_delay = max(self.delay, self.duplicates*(PIXEL_SIM_MIN_CYCLE))
|
|
185
213
|
time.sleep(actual_delay/1000)
|
|
186
214
|
|
|
187
215
|
def stop(self):
|
|
188
|
-
|
|
216
|
+
"""Stops the thread completely"""
|
|
217
|
+
self._stop_event.set()
|
|
218
|
+
write_to_data_sim_log_file(f"DataSimThread stopped\n")
|
|
219
|
+
|
|
220
|
+
def pause(self):
|
|
221
|
+
"""Pauses the thread execution"""
|
|
222
|
+
self._pause_event.clear()
|
|
223
|
+
write_to_data_sim_log_file(f"DataSimThread paused\n")
|
|
224
|
+
|
|
225
|
+
def resume(self):
|
|
226
|
+
"""Resumes the thread execution"""
|
|
227
|
+
self._pause_event.set()
|
|
228
|
+
write_to_data_sim_log_file(f"DataSimThread resumed\n")
|
brg_certificate/cert_defines.py
CHANGED
|
@@ -4,16 +4,17 @@ import importlib.metadata
|
|
|
4
4
|
# BASE_DIR should be initiated in the same dir as brg_certificate.py
|
|
5
5
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
6
6
|
# CERT_VERSION handling - local/PyPi
|
|
7
|
-
|
|
7
|
+
LOCAL_DEV = "local-dev"
|
|
8
|
+
if hasattr(importlib.metadata,'packages_distributions') and "wiliot-certificate" in importlib.metadata.packages_distributions():
|
|
8
9
|
CERT_VERSION = importlib.metadata.version("wiliot-certificate")
|
|
9
10
|
else:
|
|
10
|
-
CERT_VERSION =
|
|
11
|
+
CERT_VERSION = LOCAL_DEV
|
|
11
12
|
CERT_MQTT_LOG_FILE = "cert_mqtt_log.json"
|
|
12
13
|
DATA_SIM_LOG_FILE = "data_sim_log.txt"
|
|
13
14
|
UT_RESULT_FILE_HTML = "results.html"
|
|
14
15
|
UT_RESULT_FILE_PDF = "results.pdf"
|
|
15
16
|
UT_RESULT_FILE = "results.html"
|
|
16
|
-
UTILS_BASE_REL_PATH =
|
|
17
|
+
UTILS_BASE_REL_PATH = "../../../utils"
|
|
17
18
|
|
|
18
19
|
# GW defines
|
|
19
20
|
GW_ID = "gatewayId"
|
|
@@ -56,6 +57,7 @@ WLT_SERVER = "wiliotServer"
|
|
|
56
57
|
PACER_INTERVAL = "pacerInterval"
|
|
57
58
|
OUTPUT_POWER_2_4 = "2.4GhzOutputPower"
|
|
58
59
|
USE_STAT_LOC = "useStaticLocation"
|
|
60
|
+
LOCATION = "location"
|
|
59
61
|
GW_ENERGY_PATTERN = "energizingPattern"
|
|
60
62
|
VERSION = "version"
|
|
61
63
|
WIFI_VERSION = "interfaceChipSwVersion"
|
|
@@ -93,6 +95,8 @@ TX_PKT = "txPacket"
|
|
|
93
95
|
TX_MAX_DURATION_MS = "txMaxDurationMs"
|
|
94
96
|
TX_MAX_RETRIES = "txMaxRetries"
|
|
95
97
|
TRANPARENT_PKT_LEN = 31 * 2
|
|
98
|
+
ACTION_ADVERTISING = 0
|
|
99
|
+
ACTION_BRG_OTA = 1
|
|
96
100
|
|
|
97
101
|
# Simulator defines
|
|
98
102
|
GW_SIM_BLE_MAC_ADDRESS = 'GW_SIM_BLE_MAC_ADDRESS'
|
|
@@ -103,6 +107,7 @@ DATA_REAL_TAGS = 'tags'
|
|
|
103
107
|
GEN2 = 2
|
|
104
108
|
GEN3 = 3
|
|
105
109
|
GEN3_EXTENDED = 4
|
|
110
|
+
RAW_DATA = 5
|
|
106
111
|
|
|
107
112
|
# Configurable brg fields' names by modules
|
|
108
113
|
# common #
|
|
@@ -178,6 +183,8 @@ STATUS_CODE = "status" # Protobuf
|
|
|
178
183
|
IMG_DIR_URL = "imageDirUrl"
|
|
179
184
|
UPGRADE_BLSD = "upgradeBlSd"
|
|
180
185
|
VER_UUID_STR = "versionUUID"
|
|
186
|
+
STEP = "step"
|
|
187
|
+
PROGRESS = "progress"
|
|
181
188
|
VER_MAX_LEN = 31
|
|
182
189
|
|
|
183
190
|
# Versions
|
|
@@ -226,7 +233,7 @@ ACTION_SHORT_TIMEOUT = 5
|
|
|
226
233
|
PACER_INTERVAL_MIN_TAGS_COUNT = 20
|
|
227
234
|
PACER_INTERVAL_MAX_FAILED_TAGS = 2
|
|
228
235
|
PACER_INTERVAL_THRESHOLD_HIGH = 0.90
|
|
229
|
-
PACER_INTERVAL_CEIL_THRESHOLD = 1.
|
|
236
|
+
PACER_INTERVAL_CEIL_THRESHOLD = 1.2
|
|
230
237
|
PACER_INTERVAL_THRESHOLD = 0.80
|
|
231
238
|
PACKETS_ECHO_OFF = 16
|
|
232
239
|
TEST_PASSED = 0
|
|
@@ -234,6 +241,7 @@ TEST_FAILED = -1
|
|
|
234
241
|
TEST_SKIPPED = 1
|
|
235
242
|
TEST_INIT = 2
|
|
236
243
|
NO_RESPONSE = "NO_RESPONSE"
|
|
244
|
+
NOT_FOUND = "NOT_FOUND"
|
|
237
245
|
DONE = "DONE"
|
|
238
246
|
MGMT_PKT = "mgmt_pkt"
|
|
239
247
|
UNIFIED_PKT = "unified_pkt"
|
|
@@ -257,10 +265,16 @@ AWS = "aws"
|
|
|
257
265
|
TEST = "test"
|
|
258
266
|
MULTI_BRG_TEST = "multiBridgeTest" # used for multi brg tests
|
|
259
267
|
GW_ONLY_TEST = "gwOnlyTest" # used for gw only tests
|
|
268
|
+
INTERNAL_BRG = "internalBridge"
|
|
269
|
+
PURPOSE = "purpose"
|
|
270
|
+
MANDATORY = "mandatory"
|
|
271
|
+
MODULE = "module"
|
|
272
|
+
NAME = "name"
|
|
273
|
+
DOCUMENTATION = "documentation"
|
|
260
274
|
ALL_SUPPORTED_VALUES = "allSupportedValues"
|
|
261
|
-
PRE_CONFIG = "Pre
|
|
275
|
+
PRE_CONFIG = "Pre Configuration"
|
|
262
276
|
TEST_BODY = "Test Body"
|
|
263
|
-
RESTORE_CONFIG = "Restore
|
|
277
|
+
RESTORE_CONFIG = "Restore Configuration"
|
|
264
278
|
|
|
265
279
|
# test reasons
|
|
266
280
|
NO_PARAMS_GIVEN = "No parameters given!"
|
brg_certificate/cert_gw_sim.py
CHANGED
|
@@ -93,8 +93,8 @@ def prep_gw(args, mqttc, start_time):
|
|
|
93
93
|
# UART FUNCTIONS
|
|
94
94
|
##############################################
|
|
95
95
|
def write_to_ble(ble_serial, txt, print_enable=True, sleep=0):
|
|
96
|
-
if print_enable:
|
|
97
|
-
|
|
96
|
+
# if print_enable:
|
|
97
|
+
# print('\n' + txt)
|
|
98
98
|
ble_serial.write(bytes(txt, encoding='utf-8') + b'\r\n')
|
|
99
99
|
if sleep:
|
|
100
100
|
cert_common.wait_time_n_print(sleep)
|
|
@@ -193,8 +193,10 @@ def on_unsubscribe(mqttc, userdata, mid):
|
|
|
193
193
|
def on_message(client, userdata, message):
|
|
194
194
|
data = json.loads(message.payload.decode("utf-8"))
|
|
195
195
|
print_enable = True if not PIXEL_SIM_INDICATOR in str(message.payload.decode("utf-8")) else False
|
|
196
|
-
if print_enable:
|
|
197
|
-
|
|
196
|
+
# if print_enable:
|
|
197
|
+
# print("##########\n// Message received at {}, topic={}:\n{}\n".format(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), message.topic, str(message.payload.decode("utf-8"))))
|
|
198
|
+
# #TODO: logging print
|
|
199
|
+
# # print("##########\n// Message received at {}, topic={}:\n{}\n".format(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), message.topic, str(message.payload.decode("utf-8"))))
|
|
198
200
|
# Send packet to UART
|
|
199
201
|
if TX_PKT in data:
|
|
200
202
|
# Downlink packet
|
|
@@ -213,12 +215,14 @@ def on_message(client, userdata, message):
|
|
|
213
215
|
# GW SIMULATOR
|
|
214
216
|
##############################################
|
|
215
217
|
def parse_uart_pkts(input, mqttc, custom_broker, gw_id, seq_id):
|
|
216
|
-
|
|
218
|
+
# 3 for p6, 12 for alias_brg_id, 62 for payload, 2 for rssi
|
|
219
|
+
if input.startswith("p6 ") and len(input) == (3 + 12 + 62 + 2):
|
|
217
220
|
# p6 1234567898761E16C6FC0000EE02093E3C71BF6DFA3C006648001CB8003A730160000E010031
|
|
218
221
|
pkt = UplinkPkt(gw_id, seq_id, input.split()[1])
|
|
219
222
|
mqttc.publish(custom_broker[CUSTOM_BROKER_DATA_TOPIC], payload=json.dumps(pkt.dump(), indent=4))
|
|
220
223
|
return True
|
|
221
|
-
|
|
224
|
+
# 3 for p7, 12 for alias_brg_id, 78 for payload, 6 for side info, 2 for rssi
|
|
225
|
+
elif input.startswith("p7 ") and len(input) == (3 + 12 + 78 + 6 + 2):
|
|
222
226
|
# p7 1234567898762616C6FC05000002093E3C71BF6DFA3C006648001CB8003A730160000E0100112233445566778831
|
|
223
227
|
pkt = UplinkExtendedPkt(gw_id, seq_id, input.split()[1])
|
|
224
228
|
mqttc.publish(custom_broker[CUSTOM_BROKER_DATA_TOPIC], payload=json.dumps(pkt.dump(), indent=4))
|