wiliot-certificate 1.5.1a1__py3-none-any.whl → 1.5.3a1__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 (133) 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_cmd_if.html +3 -2
  11. brg_certificate/ag/wlt_types.html +3 -3
  12. brg_certificate/ag/wlt_types_ag.py +8 -8
  13. brg_certificate/brg_certificate_cli.py +18 -3
  14. brg_certificate/cert_common.py +134 -28
  15. brg_certificate/cert_config.py +12 -7
  16. brg_certificate/cert_data_sim.py +22 -4
  17. brg_certificate/cert_defines.py +10 -5
  18. brg_certificate/cert_gw_sim.py +4 -2
  19. brg_certificate/cert_mqtt.py +7 -6
  20. brg_certificate/cert_prints.py +14 -1
  21. brg_certificate/cert_protobuf.py +7 -7
  22. brg_certificate/cert_results.py +91 -64
  23. brg_certificate/cert_utils.py +12 -5
  24. brg_certificate/certificate_bcc_sanity_test_list.txt +10 -5
  25. brg_certificate/certificate_bcc_test_list.txt +16 -11
  26. brg_certificate/certificate_sanity_test_list.txt +10 -4
  27. brg_certificate/certificate_test_list.txt +14 -10
  28. brg_certificate/tests/calibration/interval_test/interval_test.json +2 -2
  29. brg_certificate/tests/calibration/interval_test/interval_test.py +1 -1
  30. brg_certificate/tests/calibration/output_power_test/output_power_test.json +3 -2
  31. brg_certificate/tests/calibration/output_power_test/output_power_test.py +1 -1
  32. brg_certificate/tests/calibration/pattern_test/pattern_test.json +2 -2
  33. brg_certificate/tests/calibration/pattern_test/pattern_test.py +27 -28
  34. brg_certificate/tests/datapath/aging_test/aging_test.json +4 -5
  35. brg_certificate/tests/datapath/aging_test/aging_test.py +40 -33
  36. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +2 -2
  37. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +13 -12
  38. brg_certificate/tests/datapath/output_power_test/output_power_test.json +2 -2
  39. brg_certificate/tests/datapath/output_power_test/output_power_test.py +3 -2
  40. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +3 -3
  41. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +7 -4
  42. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +2 -2
  43. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +7 -4
  44. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +2 -2
  45. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +5 -3
  46. brg_certificate/tests/datapath/pattern_test/pattern_test.json +2 -2
  47. brg_certificate/tests/datapath/pattern_test/pattern_test.py +3 -2
  48. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +3 -3
  49. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +12 -5
  50. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +2 -2
  51. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +12 -7
  52. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +2 -2
  53. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +12 -8
  54. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +3 -3
  55. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +8 -6
  56. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +2 -2
  57. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +7 -3
  58. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +3 -3
  59. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +108 -74
  60. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +3 -3
  61. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +129 -119
  62. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +8 -8
  63. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +103 -102
  64. brg_certificate/tests/datapath/stress_test/stress_test.json +14 -15
  65. brg_certificate/tests/datapath/stress_test/stress_test.py +103 -102
  66. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +2 -2
  67. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +8 -3
  68. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +2 -2
  69. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +9 -7
  70. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +2 -2
  71. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +11 -27
  72. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +14 -8
  73. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
  74. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +13 -8
  75. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +2 -2
  76. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +24 -11
  77. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +2 -2
  78. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +6 -5
  79. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.json → periodic_msgs_test/periodic_msgs_test.json} +3 -3
  80. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.py → periodic_msgs_test/periodic_msgs_test.py} +4 -4
  81. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +3 -3
  82. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +3 -2
  83. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +4 -3
  84. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +3 -2
  85. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +3 -3
  86. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +3 -2
  87. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +7 -7
  88. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +270 -295
  89. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +7 -7
  90. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +270 -295
  91. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +12 -6
  92. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +45 -57
  93. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +4 -4
  94. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +130 -207
  95. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +2 -2
  96. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +3 -2
  97. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +4 -3
  98. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +3 -2
  99. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +13 -7
  100. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +119 -126
  101. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +2 -2
  102. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +3 -2
  103. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +18 -0
  104. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +84 -0
  105. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +21 -0
  106. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +306 -0
  107. brg_certificate/wlt_types.py +2 -1
  108. gw_certificate/api_if/gw_capabilities.py +37 -1
  109. gw_certificate/common/serialization_formatter.py +80 -0
  110. gw_certificate/common/wltPb_pb2.py +50 -38
  111. gw_certificate/common/wltPb_pb2.pyi +40 -34
  112. gw_certificate/gw_certificate.py +4 -2
  113. gw_certificate/gw_certificate_cli.py +5 -4
  114. gw_certificate/interface/4.4.82_app.zip +0 -0
  115. gw_certificate/interface/{4.4.52_sd_bl_app.zip → 4.4.82_sd_bl_app.zip} +0 -0
  116. gw_certificate/interface/mqtt.py +39 -23
  117. gw_certificate/interface/pkt_generator.py +0 -44
  118. gw_certificate/interface/uart_if.py +20 -9
  119. gw_certificate/tests/actions.py +33 -5
  120. gw_certificate/tests/connection.py +3 -1
  121. gw_certificate/tests/generic.py +1 -1
  122. gw_certificate/tests/registration.py +4 -4
  123. gw_certificate/tests/static/generated_packet_table.py +47 -25
  124. gw_certificate/tests/static/packet_table.csv +10067 -10051
  125. gw_certificate/tests/static/uplink_defines.py +1 -0
  126. gw_certificate/tests/uplink.py +142 -22
  127. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/METADATA +40 -40
  128. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/RECORD +132 -127
  129. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/WHEEL +1 -1
  130. gw_certificate/interface/4.4.52_app.zip +0 -0
  131. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/entry_points.txt +0 -0
  132. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/licenses/LICENSE +0 -0
  133. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/top_level.txt +0 -0
@@ -15,9 +15,16 @@ 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
+
21
28
  def test_prolog(test):
22
29
  """
23
30
  kicks off the test:
@@ -154,8 +161,12 @@ def get_gw_geolocation(test):
154
161
  for p in test.mqttc._userdata[PKTS].status:
155
162
  if GW_INFO in p.body:
156
163
  print_pkt(p.body)
157
- gw_lat = p.body[GW_INFO][GW_LATITUDE]
158
- gw_lng = p.body[GW_INFO][GW_LONGITUDE]
164
+ if test.protobuf:
165
+ gw_lat = p.body[GW_INFO][ENTRIES][GW_LATITUDE][NUM_VAL]
166
+ gw_lng = p.body[GW_INFO][ENTRIES][GW_LONGITUDE][NUM_VAL]
167
+ else:
168
+ gw_lat = p.body[GW_INFO][GW_LATITUDE]
169
+ gw_lng = p.body[GW_INFO][GW_LONGITUDE]
159
170
  print(f"gw_lat:{gw_lat} \ngw_lng:{gw_lng}")
160
171
  found = True
161
172
  print_update_wait()
@@ -406,7 +417,7 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
406
417
  if pkt_filter_cfg != ag.PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT:
407
418
  for pkt_type in list(df[PACKET_TYPE].unique()):
408
419
  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)):
420
+ 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
421
  test.rc = TEST_FAILED
411
422
  test.add_reason(f"Tag is of packet type {pkt_type} which is turned off in packet_types_mask configuration!")
412
423
  return test
@@ -414,7 +425,10 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
414
425
  # Verify the tags count according to simulation data and pkt_filter_cfg
415
426
  tags_count = len(list(df[TAG_ID].unique()))
416
427
  if test.data == DATA_SIMULATION and num_of_pixels:
417
- if pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_ADVANCED_PKTS or pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_DEBUG_PKTS:
428
+ if is_ble5_test and is_bcc_running(test):
429
+ # In ble5 bcc packet type 2 extended uploaded as is without splitting to ble4 packets
430
+ expected_tags_count = num_of_pixels
431
+ elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_ADVANCED_PKTS or pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_DEBUG_PKTS:
418
432
  expected_tags_count = num_of_pixels * 2
419
433
  elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_ADVANCED_AND_DEBUG_PKTS:
420
434
  expected_tags_count = num_of_pixels * 3
@@ -440,16 +454,9 @@ def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDO
440
454
  failed_tags += 1
441
455
  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
456
  if failed_tags/tags_count > 0.2: # Fail the test on ceil threshold only when more than 20 % tag failed
457
+ test.add_reason(f"{failed_tags}/{tags_count} tags with wrong time diff")
443
458
  test.rc = TEST_FAILED
444
459
 
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
460
  return test
454
461
 
455
462
  def reboot_config_analysis(test, expected_hash, timeout=ACTION_LONG_TIMEOUT, ble_version=None, bl_version=None):
@@ -745,23 +752,10 @@ def brg_restore_defaults_check(test):
745
752
  print_update_wait()
746
753
  return test, revived, output
747
754
 
748
- def erase_sensors(test):
749
- module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
750
- 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),
751
- sensor0=0, sensor1=0))
752
- print("Erasing all sensors from BRG {}".format(test.active_brg.id_int))
753
- test = cert_config.brg_configure(test=test, cfg_pkt=wltpkt)[0]
754
-
755
- if test.rc == TEST_FAILED:
756
- test.add_reason("Failed to erase sensors! Didn't receive module ext sensors pkt")
757
- else:
758
- utPrint("SUCCESS! Module ext_sensors returned to default!", "GREEN")
759
- return test
760
-
761
755
  # Pwr Mgmt
762
756
  def brg_pwr_mgmt_turn_on(test):
763
757
  utPrint("Sending pwr_mgmt static mode configuration - 30 seconds ON, 60 seconds SLEEP!", "BLUE")
764
- module = eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}')
758
+ module = test.active_brg.pwr_mgmt
765
759
  # send pwr mgmt module packet
766
760
  wltpkt = WltPkt(hdr=DEFAULT_HDR, pkt=module(module_type=ag.MODULE_PWR_MGMT, msg_type=ag.BRG_MGMT_MSG_TYPE_CFG_SET,
767
761
  api_version=ag.API_VERSION_LATEST,seq_id=random.randrange(99),
@@ -778,7 +772,7 @@ def brg_pwr_mgmt_turn_on(test):
778
772
 
779
773
  def brg_pwr_mgmt_turn_off(test):
780
774
  utPrint("Turning pwr mgmt OFF - sending default configuration!", "BLUE")
781
- module = eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}')
775
+ module = test.active_brg.pwr_mgmt
782
776
  start_time = datetime.datetime.now()
783
777
  wltpkt = WltPkt(hdr=DEFAULT_HDR, pkt=module(module_type=ag.MODULE_PWR_MGMT, msg_type=ag.BRG_MGMT_MSG_TYPE_CFG_SET,
784
778
  api_version=ag.API_VERSION_LATEST,seq_id=random.randrange(99),
@@ -814,4 +808,116 @@ def value_check_if_y(test, received_value, stage):
814
808
  if 'y' != received_value.lower():
815
809
  test.rc = TEST_FAILED
816
810
  test.add_reason(f"{stage} failed")
817
- return test
811
+ return test
812
+
813
+
814
+ ##########################################
815
+ # Signal Indicator functions
816
+ ##########################################
817
+ def dual_polarization_ant_boards_get():
818
+ return [ag.BOARD_TYPE_MINEW_SINGLE_BAND_V0, ag.BOARD_TYPE_MINEW_DUAL_BAND_V0,
819
+ ag.BOARD_TYPE_ENERGOUS_V2, ag.BOARD_TYPE_ERM_V0, ag.BOARD_TYPE_ERM_V1,
820
+ ag.BOARD_TYPE_MINEW_POE_V0]
821
+
822
+ def exp_sig_ind_pkts(tx_brg, rx_brg, cycles):
823
+ if tx_brg.board_type in dual_polarization_ant_boards_get():
824
+ tx_brg_ant_polarization_num = 2
825
+ else:
826
+ tx_brg_ant_polarization_num = 1
827
+ if rx_brg.board_type in dual_polarization_ant_boards_get():
828
+ rx_brg_ant_polarization_num = 2
829
+ else:
830
+ rx_brg_ant_polarization_num = 1
831
+
832
+ expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
833
+ # Allow missing 1 pkt
834
+ return [expected - 1, expected]
835
+
836
+ def exp_sig_ind_pkts2(tx_brg, rx_brg, cycles):
837
+ if tx_brg.board_type in dual_polarization_ant_boards_get():
838
+ tx_brg_ant_polarization_num = 2
839
+ else:
840
+ tx_brg_ant_polarization_num = 1
841
+ if rx_brg.board_type in dual_polarization_ant_boards_get():
842
+ rx_brg_ant_polarization_num = 2
843
+ else:
844
+ rx_brg_ant_polarization_num = 1
845
+
846
+ expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
847
+ return expected
848
+
849
+ def sig_ind_pkts_fail_analysis(tx_brg, rx_brg, cycles, received_pkts):
850
+
851
+ expected = exp_sig_ind_pkts2(tx_brg, rx_brg, cycles)
852
+ print(f"Expected pkts: {expected}, Received pkts: {len(received_pkts)}")
853
+ # Allow missing 25% max
854
+ if int(0.75 * expected) <= len(received_pkts) <= int(1.25 * expected):
855
+ return False
856
+ return True
857
+
858
+ def get_all_sig_ind_pkts(test=None, rx_brg=None, tx_brg=None):
859
+ if rx_brg == test.brg1:
860
+ all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(test=test)
861
+ elif rx_brg == test.brg0:
862
+ all_sensor_packets = cert_mqtt.get_all_sensor_pkts(test=test)
863
+ signal_ind_pkts = []
864
+ for p in all_sensor_packets:
865
+ if (p[SENSOR_UUID] == f"{ag.SENSOR_SERVICE_ID_SIGNAL_INDICATOR:06X}" and
866
+ p[BRIDGE_ID] == rx_brg.id_str and p[SENSOR_ID] == tx_brg.id_alias):
867
+ signal_ind_pkts.append(p)
868
+ return signal_ind_pkts
869
+
870
+ def output_power_check(test, received_signal_ind_pkts, tx_brg_):
871
+
872
+ output_power_default = tx_brg_.datapath().output_power
873
+
874
+ for p in received_signal_ind_pkts:
875
+ if p[SENSOR_PKT].pkt.output_power != output_power_default:
876
+ test.rc = TEST_FAILED
877
+ test.add_reason("output power of internal brg is incorrect!\n"
878
+ f"got:{p[SENSOR_PKT].pkt.output_power}, expected: {output_power_default}\n")
879
+ return test
880
+
881
+ def rssi_check(test, received_signal_ind_pkts):
882
+ threshold_rssi = [0, 80]
883
+ for p in received_signal_ind_pkts:
884
+ if not threshold_rssi[0] < p[RSSI] < threshold_rssi[1]:
885
+ test.rc = TEST_FAILED
886
+ test.add_reason("rssi value is wrong, out of 0 to 80 ")
887
+
888
+ return test
889
+
890
+
891
+ def rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_, cycles):
892
+
893
+ # Allow to miss 1 packet or get 1 extra packet
894
+ expected = range(int(cycles * 0.5), cycles + 2)
895
+
896
+ received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=0))
897
+ if received not in expected:
898
+ test.rc = TEST_FAILED
899
+ test.add_reason(f"rx_ant=0 tx_ant=0 expected={cycles} received={received}")
900
+
901
+ if tx_brg_.board_type in dual_polarization_ant_boards_get():
902
+ received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=1))
903
+ if received not in expected:
904
+ test.rc = TEST_FAILED
905
+ test.add_reason(f"rx_ant=0 tx_ant=1 expected={cycles} received={received}")
906
+
907
+ if rx_brg_.board_type in dual_polarization_ant_boards_get():
908
+ received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=0))
909
+ if received not in expected:
910
+ test.rc = TEST_FAILED
911
+ test.add_reason(f"rx_ant=1 tx_ant=0 expected={cycles} received={received}")
912
+
913
+ if (rx_brg_.board_type in dual_polarization_ant_boards_get() and
914
+ tx_brg_.board_type in dual_polarization_ant_boards_get()):
915
+ received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=1))
916
+ if received not in expected:
917
+ test.rc = TEST_FAILED
918
+ test.add_reason(f"rx_ant=1 tx_ant=1 expected={cycles} received={received}")
919
+ return test
920
+
921
+
922
+ def get_polar_signal_ind_pkt(pkts, rx_ant, tx_ant):
923
+ return [p for p in pkts if p[SENSOR_PKT].pkt.rx_antenna == rx_ant and p[SENSOR_PKT].pkt.tx_antenna == tx_ant]
@@ -161,7 +161,10 @@ def fields_n_vals_dict_get(fields, values):
161
161
  functionality_run_print(print_string)
162
162
  return fields_and_values
163
163
 
164
- def brg_configure(test, cfg_pkt=None, module=None, fields=None, values=None, wait=True, ret_cfg_pkt=False):
164
+ def brg_configure(test, cfg_pkt=None, module=None, fields=None, values=None, wait=True, ret_cfg_pkt=False, ble5=False):
165
+ if ble5:
166
+ return brg_configure_ble5(test, cfg_pkt=cfg_pkt, module=module, fields=fields,
167
+ values=values, ret_cfg_pkt=ret_cfg_pkt, wait=wait)
165
168
  retries = 3
166
169
  if not cfg_pkt:
167
170
  fields_n_vals = fields_n_vals_dict_get(fields, values)
@@ -217,7 +220,9 @@ def brg_configure_ble5(test, cfg_pkt=None, module=None, fields=None, values=None
217
220
  wlt_pkt = WltPkt()
218
221
  start_time = datetime.datetime.now()
219
222
  gw_downlink(test=test, raw_tx_data=cfg_pkt.dump(), max_duration=BLE5_MAX_DURATION, max_retries=BLE5_MAX_RETRIES)
220
- while not pkts_found and wait:
223
+ if wait is False:
224
+ return test, DONE
225
+ while not pkts_found:
221
226
  if ((datetime.datetime.now() - start_time).seconds > ((ag.BLE5_PARAM_PRIMARY_CHANNEL_SCAN_CYCLE/1000)+1)):
222
227
  if num_of_tries < 3:
223
228
  num_of_tries += 1
@@ -279,16 +284,16 @@ def get_default_brg_pkt(test, pkt_type, group_id=ag.GROUP_ID_GW2BRG, seq_id=0, *
279
284
  brg_pkt = WltPkt(hdr=ag.Hdr(group_id=group_id), pkt=pkt_type(brg_mac=test.active_brg.id_int if test.active_brg else 0, seq_id=seq_id, **kwargs))
280
285
  return brg_pkt
281
286
 
282
- def config_brg_defaults(test, modules=[], ble5=False):
287
+ def config_brg_defaults(test, modules=[], ble5=False, wait=True):
283
288
  failed_cfg = False
284
289
  modules = test.active_brg.modules if not modules else modules
285
290
  for module in modules:
286
291
  utPrint(f"Configuring {module.__name__} to defaults. board type[{test.active_brg.board_type}] api version[{test.active_brg.api_version}]", "BLUE")
287
292
  cfg_pkt = get_default_brg_pkt(test, module)
288
293
  if ble5:
289
- test, res = brg_configure_ble5(test=test, cfg_pkt=cfg_pkt)
294
+ test, res = brg_configure_ble5(test=test, cfg_pkt=cfg_pkt, wait=wait)
290
295
  else:
291
- test, res = brg_configure(test=test, cfg_pkt=cfg_pkt)
296
+ test, res = brg_configure(test=test, cfg_pkt=cfg_pkt, wait=wait)
292
297
  if res == NO_RESPONSE:
293
298
  utPrint(f"FAILURE: {module.__name__} not configured to defaults", "RED")
294
299
  failed_cfg = True
@@ -296,9 +301,9 @@ def config_brg_defaults(test, modules=[], ble5=False):
296
301
  utPrint(f"SUCCESS: {module.__name__} configured to defaults", "GREEN")
297
302
  return (test, DONE) if not failed_cfg else (test, NO_RESPONSE)
298
303
 
299
- def config_brg1_defaults(test, modules=[], ble5=False):
304
+ def config_brg1_defaults(test, modules=[], ble5=False, wait=True):
300
305
  test.active_brg = test.brg1
301
- test, res = config_brg_defaults(test, modules, ble5)
306
+ test, res = config_brg_defaults(test, modules=modules, ble5=ble5, wait=wait)
302
307
  test.active_brg = test.brg0
303
308
  return test, res
304
309
 
@@ -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 pixels list
135
- if pixels_type == GEN2:
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)]
@@ -165,7 +180,9 @@ class DataSimThread(threading.Thread):
165
180
  pkt.set_pkt_type(pkt_type)
166
181
 
167
182
  # Set pkt_id, in Gen3 pkt_type_1 has pkt_id_0+1
168
- if type(pkt) == WiliotPixelGen3:
183
+ if type(pkt) == RawData:
184
+ pass
185
+ elif type(pkt) == WiliotPixelGen3:
169
186
  if pkt_type == 1:
170
187
  if self.pkt_types == [0,1]:
171
188
  pkt.pkt_id += 1
@@ -194,6 +211,7 @@ class DataSimThread(threading.Thread):
194
211
  write_to_data_sim_log_file(f"{pkt}" + " {}\n".format(datetime.datetime.now().strftime("%d/%m,%H:%M:%S.%f")[:-4]))
195
212
  actual_delay = max(self.delay, self.duplicates*(PIXEL_SIM_MIN_CYCLE))
196
213
  time.sleep(actual_delay/1000)
214
+
197
215
  def stop(self):
198
216
  """Stops the thread completely"""
199
217
  self._stop_event.set()
@@ -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
+ LOCAL_DEV = "local-dev"
7
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 = "local-dev"
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 = "../../../utils"
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"
@@ -105,6 +107,7 @@ DATA_REAL_TAGS = 'tags'
105
107
  GEN2 = 2
106
108
  GEN3 = 3
107
109
  GEN3_EXTENDED = 4
110
+ RAW_DATA = 5
108
111
 
109
112
  # Configurable brg fields' names by modules
110
113
  # common #
@@ -230,7 +233,7 @@ ACTION_SHORT_TIMEOUT = 5
230
233
  PACER_INTERVAL_MIN_TAGS_COUNT = 20
231
234
  PACER_INTERVAL_MAX_FAILED_TAGS = 2
232
235
  PACER_INTERVAL_THRESHOLD_HIGH = 0.90
233
- PACER_INTERVAL_CEIL_THRESHOLD = 1.1
236
+ PACER_INTERVAL_CEIL_THRESHOLD = 1.2
234
237
  PACER_INTERVAL_THRESHOLD = 0.80
235
238
  PACKETS_ECHO_OFF = 16
236
239
  TEST_PASSED = 0
@@ -265,11 +268,13 @@ GW_ONLY_TEST = "gwOnlyTest" # used for gw o
265
268
  INTERNAL_BRG = "internalBridge"
266
269
  PURPOSE = "purpose"
267
270
  MANDATORY = "mandatory"
271
+ MODULE = "module"
272
+ NAME = "name"
268
273
  DOCUMENTATION = "documentation"
269
274
  ALL_SUPPORTED_VALUES = "allSupportedValues"
270
- PRE_CONFIG = "Pre config"
275
+ PRE_CONFIG = "Pre Configuration"
271
276
  TEST_BODY = "Test Body"
272
- RESTORE_CONFIG = "Restore config"
277
+ RESTORE_CONFIG = "Restore Configuration"
273
278
 
274
279
  # test reasons
275
280
  NO_PARAMS_GIVEN = "No parameters given!"
@@ -215,12 +215,14 @@ def on_message(client, userdata, message):
215
215
  # GW SIMULATOR
216
216
  ##############################################
217
217
  def parse_uart_pkts(input, mqttc, custom_broker, gw_id, seq_id):
218
- if input.startswith("p6 "):
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):
219
220
  # p6 1234567898761E16C6FC0000EE02093E3C71BF6DFA3C006648001CB8003A730160000E010031
220
221
  pkt = UplinkPkt(gw_id, seq_id, input.split()[1])
221
222
  mqttc.publish(custom_broker[CUSTOM_BROKER_DATA_TOPIC], payload=json.dumps(pkt.dump(), indent=4))
222
223
  return True
223
- elif input.startswith("p7 "):
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):
224
226
  # p7 1234567898762616C6FC05000002093E3C71BF6DFA3C006648001CB8003A730160000E0100112233445566778831
225
227
  pkt = UplinkExtendedPkt(gw_id, seq_id, input.split()[1])
226
228
  mqttc.publish(custom_broker[CUSTOM_BROKER_DATA_TOPIC], payload=json.dumps(pkt.dump(), indent=4))
@@ -287,7 +287,7 @@ def get_undecrypted_data_pkts_count(mqttc):
287
287
  undecrypted += p.body_ex['undecrypted']
288
288
  return undecrypted
289
289
 
290
- def get_all_sensor_pkts(mqttc, test, is_embedded=False):
290
+ def get_all_sensor_pkts(test, is_embedded=False):
291
291
  all_sensor_pkts = couple_sensor_data_si_coupling(test)
292
292
  all_sensor_pkts = [p for p in all_sensor_pkts if test.active_brg.id_str == p[BRIDGE_ID] and (p[IS_EMBEDDED] == is_embedded)]
293
293
  return all_sensor_pkts
@@ -339,16 +339,17 @@ def count_pkt_id_duplications(test, all_sensor_data_pkts, all_sensor_side_info_p
339
339
  coupled_pkt[PKT_ID_CTR] = pkt_ids.count(_pkt_id)
340
340
  if coupled_pkt[PKT_ID_CTR] > SENSORS_DATA_SI_DUP:
341
341
  print(f"pkt_id {_pkt_id:08X}: {coupled_pkt[PKT_ID_CTR]} occurrences")
342
- test.reason = f'Warning: {coupled_pkt[PKT_ID_CTR]} sensor data and si with pkt id 0x{_pkt_id:08X}'
342
+ #TODO: logging print(debug)
343
+ # test.reason = f'Warning: {coupled_pkt[PKT_ID_CTR]} sensor data and si with pkt id 0x{_pkt_id:08X}'
343
344
 
344
- def get_all_brg1_ext_sensor_pkts(mqttc, test=None):
345
+ def get_all_brg1_ext_sensor_pkts(test=None):
345
346
  test.active_brg = test.brg1
346
- pkts = get_all_sensor_pkts(mqttc, test)
347
+ pkts = get_all_sensor_pkts(test)
347
348
  test.active_brg = test.brg0
348
349
  return pkts
349
350
 
350
- def get_all_custom_pkts(mqttc, test=None):
351
- return get_all_sensor_pkts(mqttc, test, is_embedded=True)
351
+ def get_all_custom_pkts(test=None):
352
+ return get_all_sensor_pkts(test, is_embedded=True)
352
353
 
353
354
  def get_all_mgmt_pkts(mqttc):
354
355
  all_data_pkts = get_all_data_pkts(mqttc)
@@ -22,6 +22,7 @@ color = lambda c, t : COLORS["BOLD"]+COLORS[c]+t+COLORS["ENDC"]
22
22
  pipeline_running = lambda : True if 'BITBUCKET_BUILD_NUMBER' in os.environ else False
23
23
  camelcase_to_title = lambda s: ' '.join(word.capitalize() for word in re.split('(?=[A-Z])', s))
24
24
  SEP = '\n' + '#'*100 + '\n'
25
+ SEP2 = '\n' + '#'*100 + '\n' + '#'*100 + '\n'
25
26
  WIL_CERT_TEXT = r'''
26
27
  __ _____ _ ___ ___ _____ ____ _____ ____ _____ ___ _____ ___ ____ _ _____ _____
27
28
  \ \ / /_ _| | |_ _/ _ \_ _| / ___| ____| _ \_ _|_ _| ___|_ _/ ___| / \|_ _| ____|
@@ -65,17 +66,23 @@ def mqtt_scan_wait(test, duration):
65
66
  i += 1
66
67
  print("\n")
67
68
 
69
+ def mqtt_scan_n_create_log_file(test, duration, phase):
70
+ test.mqttc.flush_pkts()
71
+ mqtt_scan_wait(test, duration=duration)
72
+ generate_log_file(test, phase)
73
+
68
74
  def print_update_wait(secs=1):
69
75
  sys.stdout.write(".")
70
76
  sys.stdout.flush()
71
77
  time.sleep(secs)
72
78
 
73
79
  def field_functionality_pass_fail_print(test, field, value=""):
74
- print_string = "{}={}".format(field, value)
80
+ print_string = f"{field}={value}"
75
81
  if value == "":
76
82
  print_string = str(field)
77
83
  if test.rc == TEST_FAILED:
78
84
  utPrint(print_string + " functionality failed!", "RED")
85
+ utPrint(test.reason, "RED")
79
86
  elif test.rc == TEST_SKIPPED:
80
87
  utPrint(print_string + " functionality skipped!", "WARNING")
81
88
  else:
@@ -127,6 +134,12 @@ def functionality_run_print(func):
127
134
  cert_mqtt.write_to_mqtt_log_file(txt)
128
135
  cert_data_sim.write_to_data_sim_log_file(txt)
129
136
 
137
+ def phase_run_print(func):
138
+ txt = f"{SEP2}==>> Phase {func}{SEP2}\n"
139
+ utPrint(txt, "CYAN")
140
+ cert_mqtt.write_to_mqtt_log_file(txt)
141
+ cert_data_sim.write_to_data_sim_log_file(txt)
142
+
130
143
 
131
144
  def generate_print_string(fields_and_values):
132
145
  list_to_print = []
@@ -36,19 +36,19 @@ def gw_cfg_pb(msg: dict):
36
36
  pb_msg.gatewayConfig.bleSwVersion = msg[BLE_VERSION]
37
37
 
38
38
  for key, val in msg[ADDITIONAL].items():
39
- # Skip GW_MODE since it doesn't exist today and harm the parsing in PB
40
- if GW_MODE == key:
39
+ # Skip GW_MODE since it doesn't exist today and harm the parsing in PB, and skip lat & lng to create duplicate values
40
+ if key == GW_MODE or key == LAT or key == LNG:
41
41
  continue
42
42
  pb_value = wpb.GatewayConfigValue()
43
- if isinstance(val, int):
43
+ if type(val) is int:
44
44
  pb_value.integerValue = val
45
- elif isinstance(val, float):
45
+ elif type(val) is float:
46
46
  pb_value.numberValue = val
47
- elif isinstance(val, str):
47
+ elif type(val) is str:
48
48
  pb_value.stringValue = val
49
- elif isinstance(val, bool):
49
+ elif type(val) is bool:
50
50
  pb_value.boolValue = val
51
- elif isinstance(val, dict) and key == ACL:
51
+ elif type(val) is dict and key == ACL:
52
52
  pb_value.aclValue.mode_allow = ACL_DENY_VALUE if msg[ADDITIONAL][ACL][ACL_MODE] == ACL_DENY else ACL_ALLOW_VALUE
53
53
  ids_bytes = [bytes.fromhex(id) for id in msg[ADDITIONAL][ACL][ACL_BRIDGE_IDS]]
54
54
  pb_value.aclValue.ids.extend(ids_bytes)