wiliot-certificate 1.5.2a1__py3-none-any.whl → 4.4.0a1__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.
Files changed (85) hide show
  1. brg_certificate/ag/energous_v0_defines.py +3 -3
  2. brg_certificate/ag/energous_v1_defines.py +3 -3
  3. brg_certificate/ag/energous_v2_defines.py +3 -3
  4. brg_certificate/ag/energous_v3_defines.py +3 -3
  5. brg_certificate/ag/energous_v4_defines.py +3 -3
  6. brg_certificate/ag/fanstel_lan_v0_defines.py +3 -3
  7. brg_certificate/ag/fanstel_lte_v0_defines.py +3 -3
  8. brg_certificate/ag/fanstel_wifi_v0_defines.py +3 -3
  9. brg_certificate/ag/minew_lte_v0_defines.py +3 -3
  10. brg_certificate/ag/wlt_types.html +3 -3
  11. brg_certificate/ag/wlt_types_ag.py +8 -8
  12. brg_certificate/cert_common.py +61 -11
  13. brg_certificate/cert_config.py +12 -7
  14. brg_certificate/cert_utils.py +3 -1
  15. brg_certificate/certificate_bcc_test_list.txt +2 -2
  16. brg_certificate/certificate_test_list.txt +4 -4
  17. brg_certificate/tests/calibration/interval_test/interval_test.py +7 -6
  18. brg_certificate/tests/calibration/output_power_test/output_power_test.py +7 -6
  19. brg_certificate/tests/calibration/pattern_test/pattern_test.py +20 -10
  20. brg_certificate/tests/datapath/aging_test/aging_test.py +11 -9
  21. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +11 -13
  22. brg_certificate/tests/datapath/output_power_test/output_power_test.py +7 -5
  23. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +13 -8
  24. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +11 -4
  25. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +12 -10
  26. brg_certificate/tests/datapath/pattern_test/pattern_test.py +7 -6
  27. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +12 -9
  28. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +13 -10
  29. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +13 -11
  30. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +13 -11
  31. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +7 -7
  32. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +34 -35
  33. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +41 -44
  34. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +1 -2
  35. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +7 -9
  36. brg_certificate/tests/datapath/stress_test/stress_test.json +1 -2
  37. brg_certificate/tests/datapath/stress_test/stress_test.py +8 -10
  38. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +1 -1
  39. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +14 -11
  40. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +15 -13
  41. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
  42. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +2 -2
  43. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +7 -5
  44. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +7 -5
  45. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +7 -5
  46. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +2 -2
  47. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +256 -278
  48. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +2 -2
  49. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +256 -278
  50. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +3 -3
  51. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +30 -91
  52. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +7 -6
  53. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +7 -5
  54. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +2 -2
  55. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +7 -6
  56. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +2 -2
  57. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +8 -7
  58. gw_certificate/api_if/gw_capabilities.py +37 -1
  59. gw_certificate/common/serialization_formatter.py +80 -0
  60. gw_certificate/common/wltPb_pb2.py +50 -38
  61. gw_certificate/common/wltPb_pb2.pyi +42 -35
  62. gw_certificate/gw_certificate.py +4 -2
  63. gw_certificate/gw_certificate_cli.py +5 -4
  64. gw_certificate/interface/4.4.88_app.zip +0 -0
  65. gw_certificate/interface/{4.4.52_sd_bl_app.zip → 4.4.88_sd_bl_app.zip} +0 -0
  66. gw_certificate/interface/ble_simulator.py +5 -3
  67. gw_certificate/interface/mqtt.py +39 -23
  68. gw_certificate/interface/pkt_generator.py +0 -44
  69. gw_certificate/interface/uart_if.py +25 -12
  70. gw_certificate/tests/actions.py +33 -5
  71. gw_certificate/tests/connection.py +3 -1
  72. gw_certificate/tests/generic.py +1 -1
  73. gw_certificate/tests/registration.py +4 -4
  74. gw_certificate/tests/static/generated_packet_table.py +47 -25
  75. gw_certificate/tests/static/packet_table.csv +10067 -10051
  76. gw_certificate/tests/static/uplink_defines.py +1 -0
  77. gw_certificate/tests/throughput.py +2 -1
  78. gw_certificate/tests/uplink.py +142 -22
  79. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/METADATA +1 -1
  80. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/RECORD +84 -83
  81. gw_certificate/interface/4.4.52_app.zip +0 -0
  82. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/WHEEL +0 -0
  83. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/entry_points.txt +0 -0
  84. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/licenses/LICENSE +0 -0
  85. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0a1.dist-info}/top_level.txt +0 -0
@@ -29,66 +29,7 @@ DEFAULT_SCAN_TIME = 30
29
29
  SCAN_DELAY_TIME = 3
30
30
 
31
31
 
32
- # Test functions #
33
- def rssi_check(test, received_signal_ind_pkts):
34
- threshold_rssi = [0, 80]
35
- for p in received_signal_ind_pkts:
36
- if not threshold_rssi[0] < p[RSSI] < threshold_rssi[1]:
37
- test.rc = TEST_FAILED
38
- test.add_reason("rssi value is wrong, out of 0 to 80 ")
39
-
40
- return test
41
-
42
-
43
- def rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_):
44
-
45
- # Allow to miss 1 packet
46
- expected = range(int(NUM_OF_SCANNING_CYCLE * 0.5), NUM_OF_SCANNING_CYCLE + 1)
47
-
48
- received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=0))
49
- if received not in expected:
50
- test.rc = TEST_FAILED
51
- test.add_reason(f"rx_ant=0 tx_ant=0 expected={NUM_OF_SCANNING_CYCLE} received={received}")
52
-
53
- if tx_brg_.board_type in cert_common.dual_polarization_ant_boards_get():
54
- received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=1))
55
- if received not in expected:
56
- test.rc = TEST_FAILED
57
- test.add_reason(f"rx_ant=0 tx_ant=1 expected={NUM_OF_SCANNING_CYCLE} received={received}")
58
-
59
- if rx_brg_.board_type in cert_common.dual_polarization_ant_boards_get():
60
- received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=0))
61
- if received not in expected:
62
- test.rc = TEST_FAILED
63
- test.add_reason(f"rx_ant=1 tx_ant=0 expected={NUM_OF_SCANNING_CYCLE} received={received}")
64
-
65
- if (rx_brg_.board_type in cert_common.dual_polarization_ant_boards_get() and
66
- tx_brg_.board_type in cert_common.dual_polarization_ant_boards_get()):
67
- received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=1))
68
- if received not in expected:
69
- test.rc = TEST_FAILED
70
- test.add_reason(f"rx_ant=1 tx_ant=1 expected={NUM_OF_SCANNING_CYCLE} received={received}")
71
- return test
72
-
73
-
74
- def get_polar_signal_ind_pkt(pkts, rx_ant, tx_ant):
75
- return [p for p in pkts if p[SENSOR_PKT].pkt.rx_antenna == rx_ant and p[SENSOR_PKT].pkt.tx_antenna == tx_ant]
76
-
77
-
78
- def output_power_check(test, received_signal_ind_pkts, tx_brg_):
79
-
80
- datapath_module = cert_common.get_module_by_name(tx_brg_.modules, "Datapath")
81
- output_power_default = datapath_module().output_power
82
-
83
- for p in received_signal_ind_pkts:
84
- if p[SENSOR_PKT].pkt.output_power != output_power_default:
85
- test.rc = TEST_FAILED
86
- test.add_reason("output power of internal brg is incorrect!\n"
87
- f"got:{p[SENSOR_PKT].pkt.output_power}, expected: {output_power_default}\n")
88
- return test
89
-
90
-
91
- def test_rssi_threshold(test, energy2400_module, ext_sensors_module):
32
+ def test_rssi_threshold(test):
92
33
  cycle, rep = 5, 4
93
34
  tx_brg_ = test.brg0
94
35
  rx_brg_ = test.brg1
@@ -97,14 +38,14 @@ def test_rssi_threshold(test, energy2400_module, ext_sensors_module):
97
38
  utPrint(f"TX BRG with RX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
98
39
  # configuring receiver #
99
40
  utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
100
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD],
41
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD],
101
42
  values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR, rssi_threshold])[0]
102
43
  if test.rc == TEST_FAILED:
103
44
  test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
104
45
  return test
105
46
  # configuring transmitter #
106
47
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
107
- test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
48
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
108
49
  values=[cycle, rep])[0]
109
50
  if test.rc == TEST_FAILED:
110
51
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
@@ -124,7 +65,7 @@ def test_rssi_threshold(test, energy2400_module, ext_sensors_module):
124
65
  return test
125
66
 
126
67
 
127
- def test_brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module):
68
+ def test_brg0_rx_brg1_tx(test):
128
69
 
129
70
  rx_brg_ = test.brg0
130
71
  tx_brg_ = test.brg1
@@ -133,14 +74,14 @@ def test_brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module):
133
74
  utPrint(f"TX BRG with RX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
134
75
  # configuring receiver #
135
76
  utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
136
- test = cert_config.brg_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0],
77
+ test = cert_config.brg_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
137
78
  values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR])[0]
138
79
  if test.rc == TEST_FAILED:
139
80
  test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
140
81
  return test
141
82
  # configuring transmitter #
142
83
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
143
- test = cert_config.brg1_configure(test=test, module=energy2400_module,
84
+ test = cert_config.brg1_configure(test=test, module=tx_brg_.energy2400,
144
85
  fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
145
86
  values=[cycle, rep])[0]
146
87
  if test.rc == TEST_FAILED:
@@ -161,21 +102,21 @@ def test_brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module):
161
102
  print(received_signal_ind_pkts) # TODO: logging print(debug)
162
103
  print([[p[TIMESTAMP], p[SENSOR_PKT].pkt.rx_antenna] for p in received_signal_ind_pkts])
163
104
 
164
- test = rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_)
165
- test = output_power_check(test, received_signal_ind_pkts, tx_brg_)
166
- test = rssi_check(test, received_signal_ind_pkts)
105
+ test = cert_common.rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE)
106
+ test = cert_common.output_power_check(test, received_signal_ind_pkts, tx_brg_)
107
+ test = cert_common.rssi_check(test, received_signal_ind_pkts)
167
108
 
168
109
  return test
169
110
 
170
111
 
171
- def test_brg0_none_brg1_rx(test, energy2400_module, ext_sensors_module):
112
+ def test_brg0_none_brg1_rx(test):
172
113
  cycle, rep = ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP
173
114
  tx_brg_ = test.brg1
174
115
  rx_brg_ = test.brg1
175
116
  utPrint(f"RX BRG without TX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
176
117
  # configuring receiver #
177
118
  utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
178
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0],
119
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
179
120
  values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR])[0]
180
121
  if test.rc == TEST_FAILED:
181
122
  test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
@@ -195,7 +136,7 @@ def test_brg0_none_brg1_rx(test, energy2400_module, ext_sensors_module):
195
136
  return test
196
137
 
197
138
 
198
- def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
139
+ def test_brg0_rxtx_brg1_rxtx(test):
199
140
  tx_cycle, tx_rep = 5, 4
200
141
  rx_cycle, rx_rep = 5, 4
201
142
  tx_brg_ = test.brg0
@@ -203,7 +144,7 @@ def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
203
144
  utPrint("Both BRG's are transmitter and receivers, with different values\n", "BLUE")
204
145
  # configuring first brg (tx_brg_) as receiver
205
146
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
206
- test = cert_config.brg_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0],
147
+ test = cert_config.brg_configure(test=test, module=tx_brg_.sensors, fields=[BRG_SENSOR0],
207
148
  values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR])[0]
208
149
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
209
150
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
@@ -211,7 +152,7 @@ def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
211
152
  utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
212
153
  # configuring first brg (tx_brg_) as transmitter
213
154
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
214
- test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
155
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
215
156
  values=[tx_cycle, tx_rep])[0]
216
157
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
217
158
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
@@ -220,7 +161,7 @@ def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
220
161
 
221
162
  # configuring second brg (rx_brg_) as receiver
222
163
  utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
223
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0],
164
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
224
165
  values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR])[0]
225
166
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
226
167
  test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
@@ -229,7 +170,7 @@ def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
229
170
 
230
171
  # configuring second brg (rx_brg_) as transmitter (already configured as rx)
231
172
  utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
232
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
173
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
233
174
  values=[rx_cycle, rx_rep])[0]
234
175
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
235
176
  test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
@@ -264,7 +205,7 @@ def test_brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module):
264
205
  return test
265
206
 
266
207
 
267
- def test_brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module):
208
+ def test_brg0_tx_brg1_none(test):
268
209
  # Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
269
210
  # The receiver isn't receiving any signal indicator packets.
270
211
  cycle, rep = 4, 3
@@ -273,7 +214,7 @@ def test_brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module):
273
214
  utPrint(f"TX BRG without RX - cycle = {cycle}, repetition = {rep}\n", "BLUE")
274
215
  # configuring transmitter #
275
216
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
276
- test = cert_config.brg_configure(test=test, module=energy2400_module,
217
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400,
277
218
  fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[cycle, rep])[0]
278
219
  if test.rc == TEST_FAILED:
279
220
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
@@ -287,7 +228,7 @@ def test_brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module):
287
228
  test.rc = TEST_FAILED
288
229
  test.add_reason(f"brg0_tx_brg1_none phase failed - received signal indicator packet from BRG"
289
230
  f"{rx_brg_.id_str}")
290
- test = output_power_check(test, received_signal_ind_pkts, tx_brg_)
231
+ test = cert_common.output_power_check(test, received_signal_ind_pkts, tx_brg_)
291
232
 
292
233
  return test
293
234
 
@@ -301,28 +242,26 @@ def run(test):
301
242
  # Test prolog
302
243
  test = cert_common.test_prolog(test)
303
244
 
304
- # Test modules evaluation #
305
- energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
306
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
307
-
308
245
  for param in test.params:
309
246
  phase_run_print(param.name)
310
- test = SIGNAL_INDICATOR_TEST_MAP[param.value](test, energy2400_module, ext_sensors_module)
247
+ test = SIGNAL_INDICATOR_TEST_MAP[param.value](test)
311
248
  generate_log_file(test, param.name)
312
249
  field_functionality_pass_fail_print(test, param.name)
313
250
  test.set_phase_rc(param.name, test.rc)
314
251
  test.add_phase_reason(param.name, test.reason)
315
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
316
- break
317
- else:
318
- test.reset_result()
252
+ if test.rc == TEST_FAILED:
253
+ if test.exit_on_param_failure:
254
+ break # break the whole for loop and keep the test as failed
255
+ else:
256
+ test.reset_result() # reset result and continue to next param
257
+ continue
319
258
 
320
259
  # Reset to defaults after every phase (don't fail the phase on that)
321
- test = cert_config.config_brg_defaults(test, modules=[energy2400_module, ext_sensors_module])[0]
260
+ test = cert_config.config_brg_defaults(test, modules=[test.brg0.energy2400, test.brg0.sensors])[0]
322
261
  if test.rc == TEST_FAILED:
323
262
  test.add_reason("Failed to restore brg0 to defaults")
324
263
  else:
325
- test = cert_config.config_brg1_defaults(test, modules=[energy2400_module, ext_sensors_module])[0]
264
+ test = cert_config.config_brg1_defaults(test, modules=[test.brg1.energy2400, test.brg1.sensors])[0]
326
265
  if test.rc == TEST_FAILED:
327
266
  test.add_reason("Failed to restore brg0 to defaults")
328
267
  if test.rc == TEST_FAILED:
@@ -333,5 +272,5 @@ def run(test):
333
272
  else:
334
273
  test.reset_result()
335
274
 
336
- return cert_common.test_epilog(test, revert_brgs=True, modules=[energy2400_module, ext_sensors_module],
337
- brg1_modules=[energy2400_module, ext_sensors_module])
275
+ return cert_common.test_epilog(test, revert_brgs=True, modules=[test.brg0.energy2400, test.brg0.sensors],
276
+ brg1_modules=[test.brg1.energy2400, test.brg1.sensors])
@@ -8,7 +8,7 @@ import brg_certificate.cert_config as cert_config
8
8
  def run(test):
9
9
 
10
10
  fields = [BRG_DUTY_CYCLE]
11
- sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
11
+ sub1g_module = test.active_brg.energy_sub1g
12
12
 
13
13
  test = cert_common.test_prolog(test)
14
14
  if test.rc == TEST_FAILED:
@@ -20,9 +20,10 @@ def run(test):
20
20
  field_functionality_pass_fail_print(test, fields, value=param_name)
21
21
  test.set_phase_rc(param.name, test.rc)
22
22
  test.add_phase_reason(param.name, test.reason)
23
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
24
- break
25
- else:
26
- test.reset_result()
27
-
23
+ if test.rc == TEST_FAILED:
24
+ if test.exit_on_param_failure:
25
+ break # break the whole for loop and keep the test as failed
26
+ else:
27
+ test.reset_result() # reset result and continue to next param
28
+ continue
28
29
  return cert_common.test_epilog(test, revert_brgs=True, modules=[sub1g_module])
@@ -8,7 +8,7 @@ import brg_certificate.cert_config as cert_config
8
8
  def run(test):
9
9
 
10
10
  fields = [BRG_PATTERN]
11
- sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
11
+ sub1g_module = test.active_brg.energy_sub1g
12
12
 
13
13
  test = cert_common.test_prolog(test)
14
14
  if test.rc == TEST_FAILED:
@@ -19,9 +19,11 @@ def run(test):
19
19
  field_functionality_pass_fail_print(test, fields, value=param.name)
20
20
  test.set_phase_rc(param.name, test.rc)
21
21
  test.add_phase_reason(param.name, test.reason)
22
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
23
- break
24
- else:
25
- test.reset_result()
22
+ if test.rc == TEST_FAILED:
23
+ if test.exit_on_param_failure:
24
+ break # break the whole for loop and keep the test as failed
25
+ else:
26
+ test.reset_result() # reset result and continue to next param
27
+ continue
26
28
 
27
29
  return cert_common.test_epilog(test, revert_brgs=True, modules=[sub1g_module])
@@ -76,8 +76,8 @@ def terminate_test(test, phase=0, revert_rx_brg=False, revert_tx_brg=False, modu
76
76
  def run(test):
77
77
 
78
78
  # Test modules evaluation #
79
- sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
80
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
79
+ sub1g_module = test.active_brg.energy_sub1g
80
+ ext_sensors_module = test.active_brg.sensors
81
81
 
82
82
  # Transmitter related defines #
83
83
  tx_brg_ = test.brg0
@@ -8,7 +8,7 @@ import brg_certificate.cert_config as cert_config
8
8
  def run(test):
9
9
 
10
10
  fields = [BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP]
11
- sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
11
+ sub1g_module = test.active_brg.energy_sub1g
12
12
 
13
13
  test = cert_common.test_prolog(test)
14
14
  if test.rc == TEST_FAILED:
@@ -20,9 +20,10 @@ def run(test):
20
20
  generate_log_file(test, param_name)
21
21
  test.set_phase_rc(param.name, test.rc)
22
22
  test.add_phase_reason(param.name, test.reason)
23
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
24
- break
25
- else:
26
- test.reset_result()
27
-
23
+ if test.rc == TEST_FAILED:
24
+ if test.exit_on_param_failure:
25
+ break # break the whole for loop and keep the test as failed
26
+ else:
27
+ test.reset_result() # reset result and continue to next param
28
+ continue
28
29
  return cert_common.test_epilog(test, revert_brgs=True, modules=[sub1g_module])
@@ -63,7 +63,7 @@ def run(test):
63
63
  # Need to turn off just in case the ON was successful but didn't receive the ack packet
64
64
  test = cert_common.brg_pwr_mgmt_turn_off(test)
65
65
  cert_mqtt.dump_pkts(test, log=test.module_name)
66
- return cert_common.test_epilog(test, revert_brgs=True, modules=[eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}')])
66
+ return cert_common.test_epilog(test, revert_brgs=True, modules=[test.active_brg.pwr_mgmt])
67
67
 
68
68
  # On duration starts
69
69
  utPrint(f"On duration started - Waiting for {int(wltpkt.pkt.static_on_duration)} seconds!", "WARNING")
@@ -81,4 +81,4 @@ def run(test):
81
81
  test = cert_common.brg_pwr_mgmt_turn_off(test)
82
82
 
83
83
  cert_mqtt.dump_pkts(test, log=test.module_name)
84
- return cert_common.test_epilog(test, revert_brgs=True, modules=[eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}')])
84
+ return cert_common.test_epilog(test, revert_brgs=True, modules=[test.active_brg.pwr_mgmt])
@@ -262,8 +262,8 @@ EXT_SENSOR_TEST_MAP = {"tag_data_only": test_tag_data_only,
262
262
 
263
263
 
264
264
  def run(test):
265
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
266
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
265
+ datapath_module = test.active_brg.datapath
266
+ ext_sensors_module = test.active_brg.sensors
267
267
  test = cert_common.test_prolog(test)
268
268
  # check for problems in prolog
269
269
  if test.rc == TEST_FAILED:
@@ -293,11 +293,12 @@ def run(test):
293
293
  field_functionality_pass_fail_print(test, param.name)
294
294
  test.set_phase_rc(param.name, test.rc)
295
295
  test.add_phase_reason(param.name, test.reason)
296
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
297
- field_functionality_pass_fail_print(test, 'phase', param.name)
298
- break
299
- else:
300
- test.reset_result()
296
+ if test.rc == TEST_FAILED:
297
+ if test.exit_on_param_failure:
298
+ break # break the whole for loop and keep the test as failed
299
+ else:
300
+ test.reset_result() # reset result and continue to next param
301
+ continue
301
302
 
302
303
  # Kill the ble simulator
303
304
  if test.data == DATA_SIMULATION:
@@ -1,6 +1,10 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Literal
3
3
 
4
+ from gw_certificate.common.debug import debug_print
5
+ from gw_certificate.interface.mqtt import Serialization
6
+ from gw_certificate.ag.ut_defines import GW_CONF, GW_API_VERSION
7
+
4
8
  @dataclass
5
9
  class GWCapabilities:
6
10
  tagMetadataCouplingSupported: bool = False
@@ -15,4 +19,36 @@ class GWCapabilities:
15
19
 
16
20
  def set_capability(self, capability, value:bool):
17
21
  assert capability in GWCapabilities.get_capabilities(), f'{capability} is not a valid capability'
18
- setattr(self, capability, value)
22
+ setattr(self, capability, value)
23
+
24
+ class ConfigurationData():
25
+ """
26
+ Hold variables which values must be shared between different tests.
27
+ """
28
+ def __init__(self):
29
+ self.status_msg = None
30
+ self.api_version = None
31
+
32
+ def status_msg_set(self, status_msg, ser: Serialization):
33
+ if not isinstance(status_msg, dict):
34
+ debug_print('Status message should be a dict!')
35
+ return
36
+
37
+ self.status_msg = status_msg
38
+ if ser == Serialization.PB:
39
+ self.api_version = status_msg.get(GW_API_VERSION)
40
+ else:
41
+ conf = status_msg.get(GW_CONF, {})
42
+ self.api_version = conf.get(GW_API_VERSION)
43
+ if isinstance(self.api_version, str):
44
+ self.api_version = int(self.api_version)
45
+
46
+ def status_msg_get(self):
47
+ return self.status_msg
48
+
49
+ def is_acl_supported(self):
50
+ API_VERSION_SUPPORT_ACL = 205
51
+
52
+ if self.api_version != None and self.api_version >= API_VERSION_SUPPORT_ACL:
53
+ return True
54
+ return False
@@ -0,0 +1,80 @@
1
+
2
+ from enum import Enum
3
+ from google.protobuf.json_format import MessageToDict, Parse, ParseError, ParseDict
4
+
5
+ from gw_certificate.interface.mqtt import Serialization
6
+ from gw_certificate.interface.if_defines import LOCATION
7
+ from gw_certificate.common import wltPb_pb2
8
+ from gw_certificate.ag.ut_defines import GW_CONF, ADDITIONAL, VERSION, BLE_VERSION, WIFI_VERSION, LAT, LNG
9
+ from gw_certificate.common.debug import debug_print
10
+
11
+ # helper defines
12
+ ACL_MODE = "mode"
13
+ ACL_BRIDGE_IDS = "bridgeIds"
14
+ ACL_DENY = "deny"
15
+ ACL_ALLOW = "allow"
16
+ ACL_DENY_VALUE = 0
17
+ ACL_ALLOW_VALUE = 1
18
+
19
+
20
+ class Configurable(Enum):
21
+ ACL = "accessControlList"
22
+
23
+ class SerializationFormatter():
24
+ def __init__(self, serialization:Serialization):
25
+ self.serialization = serialization
26
+
27
+ def cfg_param_set(self, received_status_msg: dict, param: Configurable, value):
28
+ '''
29
+ Since configuration paramters change between partners, we must use a received_status_msg to keep every parameter as is.
30
+ In the future we may use a validation schema file or default.
31
+ '''
32
+
33
+ def gatewaystatus_to_downlink(gw_status_dict: dict, param_to_set: Configurable, value_to_set) -> wltPb_pb2.DownlinkMessage:
34
+ gw_status = ParseDict(gw_status_dict, wltPb_pb2.GatewayStatus())
35
+ gw_cfg = wltPb_pb2.GatewayConfig()
36
+
37
+ if gw_status.HasField(VERSION):
38
+ gw_cfg.version = gw_status.version
39
+ if gw_status.HasField('bleSwVersion'):
40
+ gw_cfg.bleSwVersion = gw_status.bleSwVersion
41
+ if gw_status.HasField('interfaceSwVersion'):
42
+ gw_cfg.interfaceSwVersion = gw_status.interfaceSwVersion
43
+ if gw_status.HasField(LOCATION):
44
+ gw_cfg.location.lat = gw_status.location.lat
45
+ gw_cfg.location.lng = gw_status.location.lng
46
+
47
+ for key, val in gw_status.config.items():
48
+ if key != param_to_set:
49
+ gw_cfg.config[key].CopyFrom(val)
50
+ else:
51
+ pb_gcvalue = wltPb_pb2.GatewayConfigValue()
52
+ if isinstance(value_to_set, int):
53
+ pb_gcvalue.integerValue = value_to_set
54
+ elif isinstance(value_to_set, float):
55
+ pb_gcvalue.numberValue = value_to_set
56
+ elif isinstance(value_to_set, str):
57
+ pb_gcvalue.stringValue = value_to_set
58
+ elif isinstance(value_to_set, bool):
59
+ pb_gcvalue.boolValue = value_to_set
60
+ elif isinstance(value_to_set, dict) and key == Configurable.ACL.value:
61
+ pb_gcvalue.aclValue.mode_allow = ACL_ALLOW_VALUE if value_to_set.get(ACL_MODE) == ACL_ALLOW else ACL_DENY_VALUE
62
+ ids_bytes = [bytes.fromhex(id) for id in value_to_set.get(ACL_BRIDGE_IDS)]
63
+ pb_gcvalue.aclValue.ids.extend(ids_bytes)
64
+ else:
65
+ debug_print(f"Unsupported value type for key '{key}': {type(val)}, protobuf cfg may be invalid")
66
+
67
+ gw_cfg.config[key].CopyFrom(pb_gcvalue)
68
+
69
+ return wltPb_pb2.DownlinkMessage(gatewayConfig=gw_cfg)
70
+
71
+ cfg_msg = received_status_msg.copy()
72
+ if self.serialization == Serialization.PB:
73
+ # In protobuf, we must convert the GatewayStatus to a DownlinkMessage with oneof=GatewayConfig
74
+ cfg_msg = gatewaystatus_to_downlink(cfg_msg, param, value)
75
+ return cfg_msg
76
+ else:
77
+ # JSON
78
+ cfg_msg.setdefault(GW_CONF, {}).setdefault(ADDITIONAL, {})[param] = value
79
+ debug_print(cfg_msg)
80
+ return cfg_msg