wiliot-certificate 4.4.3__py3-none-any.whl → 4.5.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 (295) hide show
  1. {brg_certificate → certificate}/ag/wlt_cmd_if.html +10 -4
  2. {brg_certificate → certificate}/ag/wlt_types_ag.py +1878 -519
  3. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/brg2brg_ota.json +69 -0
  4. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/brg2gw_hb.json +109 -0
  5. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +45 -0
  6. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/calibration.json +96 -0
  7. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/custom.json +99 -0
  8. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/datapath.json +241 -13
  9. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/energy2400.json +120 -0
  10. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/energySub1g.json +96 -0
  11. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/externalSensor.json +135 -6
  12. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/interface.json +157 -0
  13. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/powerManagement.json +205 -0
  14. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json → certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +27 -11
  15. certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +175 -0
  16. certificate/ag/wlt_types_ag_jsons/unified_sensor_pkt.json +65 -0
  17. certificate/cert_common.py +1459 -0
  18. certificate/cert_config.py +455 -0
  19. {brg_certificate → certificate}/cert_data_sim.py +131 -46
  20. {brg_certificate → certificate}/cert_defines.py +120 -128
  21. {brg_certificate → certificate}/cert_gw_sim.py +151 -49
  22. {brg_certificate → certificate}/cert_mqtt.py +164 -59
  23. {brg_certificate → certificate}/cert_prints.py +34 -33
  24. {brg_certificate → certificate}/cert_protobuf.py +15 -6
  25. {brg_certificate → certificate}/cert_results.py +205 -48
  26. certificate/cert_utils.py +622 -0
  27. certificate/certificate.py +198 -0
  28. certificate/certificate_cli.py +79 -0
  29. certificate/certificate_eth_test_list.txt +74 -0
  30. certificate/certificate_sanity_test_list.txt +65 -0
  31. certificate/certificate_test_list.txt +75 -0
  32. {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.json +2 -2
  33. {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.py +7 -6
  34. certificate/tests/calibration/output_power_test/output_power_test.json +22 -0
  35. certificate/tests/calibration/output_power_test/output_power_test.py +39 -0
  36. {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.json +1 -1
  37. {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.py +20 -15
  38. certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.json +14 -0
  39. certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.py +140 -0
  40. certificate/tests/cloud_connectivity/acl_test/acl_test.json +14 -0
  41. certificate/tests/cloud_connectivity/acl_test/acl_test.py +98 -0
  42. certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.json +18 -0
  43. certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.py +39 -0
  44. certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.json +18 -0
  45. certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py +215 -0
  46. certificate/tests/cloud_connectivity/connection_test/connection_test.json +17 -0
  47. certificate/tests/cloud_connectivity/connection_test/connection_test.py +74 -0
  48. certificate/tests/cloud_connectivity/downlink_test/downlink_test.json +20 -0
  49. certificate/tests/cloud_connectivity/downlink_test/downlink_test.py +204 -0
  50. certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.json +16 -0
  51. certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.py +98 -0
  52. certificate/tests/cloud_connectivity/reboot_test/reboot_test.json +17 -0
  53. certificate/tests/cloud_connectivity/reboot_test/reboot_test.py +57 -0
  54. certificate/tests/cloud_connectivity/registration_test/registration_test.json +19 -0
  55. certificate/tests/cloud_connectivity/registration_test/registration_test.py +384 -0
  56. certificate/tests/cloud_connectivity/registration_test/registration_test_cli.py +90 -0
  57. certificate/tests/cloud_connectivity/stress_test/stress_test.json +16 -0
  58. certificate/tests/cloud_connectivity/stress_test/stress_test.py +97 -0
  59. certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.json +24 -0
  60. certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.py +93 -0
  61. certificate/tests/cloud_connectivity/uplink_test/uplink_test.json +19 -0
  62. certificate/tests/cloud_connectivity/uplink_test/uplink_test.py +161 -0
  63. {brg_certificate → certificate}/tests/datapath/aging_test/aging_test.json +1 -1
  64. certificate/tests/datapath/aging_test/aging_test.py +138 -0
  65. certificate/tests/datapath/event_ble5_test/event_ble5_test.json +16 -0
  66. certificate/tests/datapath/event_ble5_test/event_ble5_test.py +95 -0
  67. certificate/tests/datapath/event_test/event_test.json +16 -0
  68. certificate/tests/datapath/event_test/event_test.py +85 -0
  69. {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.json +1 -1
  70. {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.py +10 -8
  71. certificate/tests/datapath/output_power_test/output_power_test.json +22 -0
  72. {brg_certificate → certificate}/tests/datapath/output_power_test/output_power_test.py +17 -6
  73. {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +1 -1
  74. {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +10 -8
  75. {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.json +1 -1
  76. {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.py +9 -7
  77. {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.json +2 -2
  78. {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.py +18 -6
  79. certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.json +19 -0
  80. certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.py +61 -0
  81. {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +1 -1
  82. {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +11 -10
  83. certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.json +18 -0
  84. certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.py +83 -0
  85. {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +1 -1
  86. {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +10 -9
  87. {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.json +1 -1
  88. {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.py +10 -9
  89. {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +1 -1
  90. {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +9 -8
  91. brg_certificate/tests/datapath/output_power_test/output_power_test.json → certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.json +5 -4
  92. certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.py +77 -0
  93. {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.json +2 -2
  94. {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.py +7 -6
  95. {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +7 -7
  96. {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +112 -72
  97. {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +7 -7
  98. {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +112 -72
  99. {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.json +3 -3
  100. {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.py +12 -11
  101. {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.json +3 -3
  102. {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.py +12 -11
  103. {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.json +2 -1
  104. {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.py +14 -13
  105. certificate/tests/edge_mgmt/action_blink_test/action_blink_test.json +14 -0
  106. certificate/tests/edge_mgmt/action_blink_test/action_blink_test.py +24 -0
  107. certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.json +14 -0
  108. certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.py +43 -0
  109. certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.json +14 -0
  110. certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.py +42 -0
  111. certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.json +14 -0
  112. certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.py +44 -0
  113. certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.json +15 -0
  114. certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.py +42 -0
  115. certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.json +14 -0
  116. certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.py +49 -0
  117. certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.json +14 -0
  118. certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.py +102 -0
  119. certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.json +14 -0
  120. certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.py +41 -0
  121. {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.json +2 -2
  122. {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.py +22 -11
  123. {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.json +1 -1
  124. {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.py +7 -6
  125. certificate/tests/energy2400/output_power_test/output_power_test.json +22 -0
  126. {brg_certificate → certificate}/tests/energy2400/output_power_test/output_power_test.py +17 -6
  127. {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.json +1 -1
  128. {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.py +7 -6
  129. certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +25 -0
  130. certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +378 -0
  131. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json → certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.json +3 -3
  132. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py → certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.py +97 -87
  133. certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +23 -0
  134. certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +350 -0
  135. {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +1 -1
  136. {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +7 -6
  137. {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.json +1 -1
  138. {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.py +7 -6
  139. {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +1 -1
  140. {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +10 -10
  141. {brg_certificate → certificate}/tests/sensors/ext_sensor_test/ext_sensor_test.json +4 -4
  142. certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +455 -0
  143. certificate/wlt_types.py +122 -0
  144. {gw_certificate → common}/api_if/202/status.json +6 -0
  145. {gw_certificate → common}/api_if/203/status.json +6 -0
  146. {gw_certificate → common}/api_if/204/status.json +6 -0
  147. common/api_if/206/data.json +85 -0
  148. common/api_if/206/status.json +69 -0
  149. common/api_if/api_validation.py +85 -0
  150. common/web/templates/generator.html +148 -0
  151. common/web/templates/index.html +20 -0
  152. common/web/templates/menu.html +54 -0
  153. common/web/templates/parser.html +53 -0
  154. {brg_certificate/ag → common/web/templates}/wlt_types.html +1216 -191
  155. common/web/web_utils.py +377 -0
  156. {brg_certificate → common}/wltPb_pb2.py +14 -12
  157. {gw_certificate/common → common}/wltPb_pb2.pyi +16 -2
  158. gui_certificate/gui_certificate_cli.py +14 -0
  159. gui_certificate/server.py +1062 -0
  160. gui_certificate/templates/cert_run.html +1207 -0
  161. wiliot_certificate-4.5.0a1.dist-info/METADATA +110 -0
  162. wiliot_certificate-4.5.0a1.dist-info/RECORD +182 -0
  163. {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0a1.dist-info}/WHEEL +1 -1
  164. wiliot_certificate-4.5.0a1.dist-info/entry_points.txt +5 -0
  165. wiliot_certificate-4.5.0a1.dist-info/top_level.txt +3 -0
  166. brg_certificate/ag/energous_v0_defines.py +0 -925
  167. brg_certificate/ag/energous_v1_defines.py +0 -931
  168. brg_certificate/ag/energous_v2_defines.py +0 -925
  169. brg_certificate/ag/energous_v3_defines.py +0 -925
  170. brg_certificate/ag/energous_v4_defines.py +0 -925
  171. brg_certificate/ag/fanstel_lan_v0_defines.py +0 -925
  172. brg_certificate/ag/fanstel_lte_v0_defines.py +0 -925
  173. brg_certificate/ag/fanstel_wifi_v0_defines.py +0 -925
  174. brg_certificate/ag/minew_lte_v0_defines.py +0 -925
  175. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +0 -61
  176. brg_certificate/brg_certificate.py +0 -225
  177. brg_certificate/brg_certificate_cli.py +0 -63
  178. brg_certificate/cert_common.py +0 -923
  179. brg_certificate/cert_config.py +0 -402
  180. brg_certificate/cert_utils.py +0 -362
  181. brg_certificate/certificate_bcc_sanity_test_list.txt +0 -40
  182. brg_certificate/certificate_bcc_test_list.txt +0 -48
  183. brg_certificate/certificate_sanity_test_list.txt +0 -43
  184. brg_certificate/certificate_test_list.txt +0 -53
  185. brg_certificate/config/eclipse.json +0 -10
  186. brg_certificate/config/hivemq.json +0 -10
  187. brg_certificate/config/mosquitto.json +0 -10
  188. brg_certificate/config/mosquitto.md +0 -95
  189. brg_certificate/config/wiliot-dev.json +0 -10
  190. brg_certificate/restore_brg.py +0 -61
  191. brg_certificate/tests/calibration/output_power_test/output_power_test.json +0 -16
  192. brg_certificate/tests/calibration/output_power_test/output_power_test.py +0 -28
  193. brg_certificate/tests/datapath/aging_test/aging_test.py +0 -143
  194. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +0 -16
  195. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +0 -73
  196. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +0 -17
  197. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +0 -118
  198. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +0 -14
  199. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +0 -396
  200. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +0 -20
  201. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +0 -94
  202. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +0 -19
  203. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +0 -87
  204. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +0 -17
  205. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +0 -223
  206. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +0 -17
  207. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +0 -128
  208. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +0 -16
  209. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +0 -20
  210. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +0 -321
  211. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +0 -20
  212. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +0 -141
  213. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +0 -20
  214. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +0 -276
  215. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +0 -20
  216. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +0 -390
  217. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +0 -16
  218. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +0 -28
  219. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +0 -305
  220. brg_certificate/wltPb_pb2.pyi +0 -234
  221. brg_certificate/wlt_types.py +0 -113
  222. gw_certificate/ag/ut_defines.py +0 -364
  223. gw_certificate/ag/wlt_types.py +0 -85
  224. gw_certificate/ag/wlt_types_ag.py +0 -5310
  225. gw_certificate/ag/wlt_types_data.py +0 -64
  226. gw_certificate/api/extended_api.py +0 -23
  227. gw_certificate/api_if/200/data.json +0 -106
  228. gw_certificate/api_if/200/status.json +0 -47
  229. gw_certificate/api_if/201/data.json +0 -98
  230. gw_certificate/api_if/201/status.json +0 -53
  231. gw_certificate/api_if/205/logs.json +0 -12
  232. gw_certificate/api_if/api_validation.py +0 -38
  233. gw_certificate/api_if/gw_capabilities.py +0 -54
  234. gw_certificate/cert_results.py +0 -145
  235. gw_certificate/common/analysis_data_bricks.py +0 -60
  236. gw_certificate/common/debug.py +0 -42
  237. gw_certificate/common/serialization_formatter.py +0 -93
  238. gw_certificate/common/utils.py +0 -8
  239. gw_certificate/common/utils_defines.py +0 -15
  240. gw_certificate/common/wltPb_pb2.py +0 -84
  241. gw_certificate/gw_certificate.py +0 -154
  242. gw_certificate/gw_certificate_cli.py +0 -87
  243. gw_certificate/interface/4.4.93_app.zip +0 -0
  244. gw_certificate/interface/4.4.93_sd_bl_app.zip +0 -0
  245. gw_certificate/interface/ble_simulator.py +0 -61
  246. gw_certificate/interface/ble_sniffer.py +0 -189
  247. gw_certificate/interface/flash_fw.py +0 -90
  248. gw_certificate/interface/if_defines.py +0 -36
  249. gw_certificate/interface/mqtt.py +0 -563
  250. gw_certificate/interface/nrfutil-linux +0 -0
  251. gw_certificate/interface/nrfutil-mac +0 -0
  252. gw_certificate/interface/nrfutil.exe +0 -0
  253. gw_certificate/interface/pkt_generator.py +0 -594
  254. gw_certificate/interface/uart_if.py +0 -236
  255. gw_certificate/interface/uart_ports.py +0 -20
  256. gw_certificate/templates/results.html +0 -241
  257. gw_certificate/templates/stage.html +0 -22
  258. gw_certificate/templates/table.html +0 -6
  259. gw_certificate/templates/test.html +0 -38
  260. gw_certificate/tests/__init__.py +0 -10
  261. gw_certificate/tests/actions.py +0 -289
  262. gw_certificate/tests/bad_crc_to_PER_quantization.csv +0 -51
  263. gw_certificate/tests/connection.py +0 -188
  264. gw_certificate/tests/downlink.py +0 -172
  265. gw_certificate/tests/generic.py +0 -238
  266. gw_certificate/tests/registration.py +0 -340
  267. gw_certificate/tests/static/__init__.py +0 -0
  268. gw_certificate/tests/static/connection_defines.py +0 -9
  269. gw_certificate/tests/static/downlink_defines.py +0 -9
  270. gw_certificate/tests/static/generated_packet_table.py +0 -195
  271. gw_certificate/tests/static/packet_table.csv +0 -10067
  272. gw_certificate/tests/static/references.py +0 -5
  273. gw_certificate/tests/static/uplink_defines.py +0 -14
  274. gw_certificate/tests/throughput.py +0 -240
  275. gw_certificate/tests/uplink.py +0 -853
  276. wiliot_certificate-4.4.3.dist-info/METADATA +0 -211
  277. wiliot_certificate-4.4.3.dist-info/RECORD +0 -210
  278. wiliot_certificate-4.4.3.dist-info/entry_points.txt +0 -3
  279. wiliot_certificate-4.4.3.dist-info/top_level.txt +0 -3
  280. {brg_certificate → certificate}/__init__.py +0 -0
  281. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/side_info_sensor.json +0 -0
  282. {brg_certificate → certificate}/ag/wlt_types_ag_jsons/signal_indicator_data.json +0 -0
  283. {gw_certificate → common}/api_if/202/data.json +0 -0
  284. {gw_certificate/api_if/200 → common/api_if/202}/logs.json +0 -0
  285. {gw_certificate → common}/api_if/203/data.json +0 -0
  286. {gw_certificate/api_if/201 → common/api_if/203}/logs.json +0 -0
  287. {gw_certificate → common}/api_if/204/data.json +0 -0
  288. {gw_certificate/api_if/202 → common/api_if/204}/logs.json +0 -0
  289. {gw_certificate → common}/api_if/205/data.json +0 -0
  290. {gw_certificate/api_if/203 → common/api_if/205}/logs.json +0 -0
  291. {gw_certificate → common}/api_if/205/status.json +0 -0
  292. {gw_certificate/api_if/204 → common/api_if/206}/logs.json +0 -0
  293. {gw_certificate → common/api_if}/__init__.py +0 -0
  294. {gw_certificate/api_if → gui_certificate}/__init__.py +0 -0
  295. {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0a1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,622 @@
1
+
2
+ import os
3
+ import random
4
+ import tabulate
5
+ import importlib # needed for importing all of the tests
6
+ from requests import codes as r_codes
7
+
8
+ # Local imports
9
+ import certificate.cert_config as cert_config
10
+ import certificate.cert_common as cert_common
11
+ import certificate.cert_results as cert_results
12
+ from certificate.wlt_types import *
13
+ from certificate.cert_defines import *
14
+ from certificate.cert_prints import *
15
+
16
+ TESTER_FW_VERSIONS = ["4.6.26", "4.6.27"]
17
+ MULTI_BRG_STR = "multi_brg" # used for multi brg tests
18
+ GW_ONLY_STR = "gw_only" # used for gw only tests
19
+ INTERNAL_BRG_STR = "internal_brg"
20
+ ORIGINAL_AG_FILE = "wlt_types_ag.py"
21
+
22
+ ##################################
23
+ # Utils
24
+ ##################################
25
+
26
+ TEST_MODULES_MAP = {"calibration": ag.MODULE_CALIBRATION, "datapath": ag.MODULE_DATAPATH, "energy2400": ag.MODULE_ENERGY_2400, "energy_sub1g": ag.MODULE_ENERGY_SUB1G,
27
+ "pwr_mgmt": ag.MODULE_PWR_MGMT, "sensors": ag.MODULE_EXT_SENSORS, "custom": ag.MODULE_CUSTOM}
28
+
29
+ # Used when mac is not really important for the test (e.g: gw_sim) or to randomize pkt data
30
+ def get_random_hex_str(len=12):
31
+ return ''.join([random.choice('0123456789ABCDEF') for i in range(len)])
32
+
33
+ def module2name(module_id):
34
+ for k, v in TEST_MODULES_MAP.items():
35
+ if module_id == v:
36
+ return k
37
+ return ''
38
+
39
+ def load_module(module_name, module_path, rel_path="."):
40
+ spec = importlib.util.spec_from_file_location(module_name, os.path.join(BASE_DIR, rel_path, module_path))
41
+ module = importlib.util.module_from_spec(spec)
42
+ spec.loader.exec_module(module)
43
+ return module
44
+
45
+ def handle_error(error, start_time):
46
+ utPrint(error, "red")
47
+ cert_results.generate_results_files(html=True, pdf=False, start_time=start_time, error=error)
48
+ sys.exit(-1)
49
+
50
+ def overwrite_defines_file(file_name, brg_id, overwrite_defs):
51
+ overwritten = {key: False for key in overwrite_defs}
52
+ with open(os.path.join(BASE_DIR, "ag", file_name), "r") as f:
53
+ lines = f.readlines()
54
+ for i, line in enumerate(lines):
55
+ for key,val in overwrite_defs.items():
56
+ pattern = r"^(\s*" + re.escape(key) + r"\s*=\s*).*$" # match the key before the "=", capture it, then replace what's after
57
+ if re.match(pattern, line):
58
+ lines[i] = re.sub(pattern, rf"\g<1>{val}", line)
59
+ overwritten[key] = True
60
+ break
61
+ for key,flag in overwritten.items():
62
+ if not flag:
63
+ utPrint(f"Couldn't overwrite '{key}' as it was not found in {file_name}!", "WARNING")
64
+ with open(os.path.join(BASE_DIR, "ag", file_name.replace('.py', f'_overwritten_for_{brg_id}.py')), "w") as f:
65
+ f.writelines(lines)
66
+ return file_name.replace('.py', f'_overwritten_for_{brg_id}.py')
67
+
68
+ def parse_cfg_file(filepath):
69
+ config = {}
70
+ with open(filepath, 'r') as f:
71
+ for line in f:
72
+ line = line.strip()
73
+ if not line or line.startswith("#"):
74
+ continue # skip empty lines and comments
75
+ if "=" in line:
76
+ key, value = line.split("=", 1)
77
+ config[key.strip()] = value.strip()
78
+ return config
79
+
80
+ ##################################
81
+ # Test
82
+ ##################################
83
+
84
+ class WltTest:
85
+ """
86
+ Wiliot Test class representing a single test case.
87
+
88
+ This class encapsulates all information needed to run a certification test,
89
+ including gateway information, bridge information, test parameters, and test results.
90
+
91
+ Attributes:
92
+ name: Test name from test list
93
+ tester: Gateway object (or string ID for backward compatibility)
94
+ dut: Device under test object (or string ID for backward compatibility)
95
+ brg1: Secondary bridge object for multi-bridge tests (optional)
96
+ active_brg: Currently active bridge being tested
97
+ test_json: Test configuration from JSON file
98
+ phases: List of test phases
99
+ params: List of test parameters
100
+ rc: Test result code (TEST_PASSED, TEST_FAILED, TEST_SKIPPED, etc.)
101
+ reason: Reason for test result
102
+ start_time: Test start time
103
+ end_time: Test end time
104
+ duration: Test duration
105
+ exit_on_param_failure: Whether to exit on parameter failure
106
+ latest: Whether to use latest version
107
+ release_candidate: Whether to use release candidate version
108
+ sterile_run: Whether to run in sterile run mode
109
+ data: Test data
110
+ rand: Random number
111
+ """
112
+ def __init__(self, line, tester, dut, brg1=None, exit_on_param_failure=False,
113
+ latest=False, release_candidate=False, sterile_run=False, data=''):
114
+ if line:
115
+ test_list_line = line.strip().split()
116
+ self.name = test_list_line[0]
117
+ self.test_module = ag.MODULE_EMPTY # Default test module
118
+ # Determine test's module
119
+ for s in self.name.split('/'):
120
+ if s in TEST_MODULES_MAP:
121
+ self.test_module = TEST_MODULES_MAP[s]
122
+ break
123
+ line_params = test_list_line[1:]
124
+ self.dir = os.path.join("tests", self.name)
125
+ self.module_name = os.path.join(os.path.basename(self.name))
126
+ self.file = os.path.join(self.dir, os.path.basename(self.name)+".py")
127
+ # Load test json
128
+ test_json_file = open(os.path.join(BASE_DIR, self.dir, os.path.basename(self.name)+".json"))
129
+ self.test_json = json.load(test_json_file)
130
+ self.gw_only = self.test_json[GW_ONLY_TEST]
131
+ self.multi_brg = self.test_json[MULTI_BRG_TEST]
132
+ self.internal_brg = INTERNAL_BRG_STR in line_params
133
+ if INTERNAL_BRG_STR in line_params: line_params.remove(INTERNAL_BRG_STR)
134
+ self.create_test_phases_and_params(line_params)
135
+ else:
136
+ self.test_json = {}
137
+ self.internal_brg = False
138
+ self.multi_brg = False
139
+ self.phases = [Phase(PRE_CONFIG), Phase(TEST_BODY), Phase(RESTORE_CONFIG)]
140
+ self.params = []
141
+
142
+ self.tester = tester
143
+ self.dut = dut
144
+ # Actual brg to cfg - can be dut, its internal_brg or None
145
+ if isinstance(self.dut, Bridge):
146
+ self.active_brg = self.dut
147
+ elif isinstance(self.dut, Gateway) and self.dut.has_internal_brg():
148
+ self.active_brg = self.dut.internal_brg
149
+ else:
150
+ self.active_brg = None
151
+ self.brg1 = brg1 if brg1 else (self.tester.internal_brg if tester and tester.internal_brg else None)
152
+ self.rc = TEST_PASSED
153
+ self.reason = ""
154
+ self.start_time = None
155
+ self.end_time = None
156
+ self.duration = None
157
+ self.exit_on_param_failure = exit_on_param_failure
158
+ self.rand = random.randrange(255)
159
+ self.latest = latest
160
+ self.release_candidate = release_candidate
161
+ self.sterile_run = sterile_run
162
+ self.data = data
163
+
164
+ def create_test_phases_and_params(self, line_params):
165
+ self.params = []
166
+ if len(self.test_json[ALL_SUPPORTED_VALUES]) > 0:
167
+ self.phases = [Phase(PRE_CONFIG)] + [Phase(param) for param in self.test_json[ALL_SUPPORTED_VALUES]] + [Phase(RESTORE_CONFIG)]
168
+ for param_phase in self.phases:
169
+ param = Param(param_phase.name)
170
+ if (param.name in line_params or param.value in [eval_param(p) for p in line_params]):
171
+ self.params += [param]
172
+ else:
173
+ param_phase.tested = False
174
+ param_phase.rc = TEST_SKIPPED
175
+ if all([param_phase.rc == TEST_SKIPPED for param_phase in self.phases]):
176
+ error = f"ERROR: All params skipped for test {self.name}! Check test list file and update the supported values!\n{[f.__dict__ for f in self.phases]}"
177
+ handle_error(error, datetime.datetime.now())
178
+ else:
179
+ if line_params:
180
+ error = f"ERROR: For {self.name} params exist in test_list but not in test_json!\nline_params:{line_params}"
181
+ handle_error(error, datetime.datetime.now())
182
+ self.phases = [Phase(PRE_CONFIG), Phase(TEST_BODY), Phase(RESTORE_CONFIG)]
183
+
184
+
185
+ def get_mqttc_by_target(self, target=DUT):
186
+ if target == DUT:
187
+ return self.dut.mqttc if isinstance(self.dut, Gateway) else self.tester.mqttc
188
+ return self.tester.mqttc
189
+
190
+ # Flush all existing mqtt packets
191
+ def flush_all_mqtt_packets(self):
192
+ self.get_mqttc_by_target(TESTER).flush_pkts()
193
+ self.get_mqttc_by_target(DUT).flush_pkts()
194
+
195
+ # Phase rc
196
+ def set_phase_rc(self, phase_name, rc):
197
+ phase = self.get_phase_by_name(phase_name)
198
+ phase.rc = rc
199
+
200
+ def get_phase_rc(self, phase_name):
201
+ phase = self.get_phase_by_name(phase_name)
202
+ return phase.rc
203
+
204
+ # Phase reason
205
+ def add_phase_reason(self, phase_name, reason):
206
+ phase = self.get_phase_by_name(phase_name)
207
+ if phase.reason:
208
+ phase.reason += "\n"
209
+ if reason not in phase.reason:
210
+ phase.reason += reason
211
+
212
+ def get_phase_reason(self, phase_name):
213
+ phase = self.get_phase_by_name(phase_name)
214
+ return phase.reason
215
+
216
+ # Test funcs
217
+ def get_phase_by_name(self, phase_name):
218
+ for phase in self.phases:
219
+ if phase.name == phase_name:
220
+ return phase
221
+ return None
222
+
223
+ def update_overall_rc(self):
224
+ if any([phase.rc == TEST_FAILED for phase in self.phases]):
225
+ self.rc = TEST_FAILED
226
+
227
+ def reset_result(self):
228
+ self.rc = TEST_PASSED
229
+ self.reason = ""
230
+
231
+ def get_seq_id(self):
232
+ self.rand = (self.rand + 1) % 256
233
+ return self.rand
234
+
235
+ # TODO - remove when test reason is re-designed
236
+ def add_reason(self, reason):
237
+ if self.reason:
238
+ self.reason += "\n"
239
+ if reason not in self.reason:
240
+ self.reason += reason
241
+
242
+ def internal_id_alias(self):
243
+ return self.dut.internal_brg.id_alias if isinstance(self.dut, Gateway) and self.dut.has_internal_brg() else self.tester.internal_brg.id_alias
244
+
245
+ def dut_is_gateway(self):
246
+ return isinstance(self.dut, Gateway)
247
+
248
+ def dut_is_bridge(self):
249
+ return isinstance(self.dut, Bridge)
250
+
251
+ def dut_is_combo(self):
252
+ return hasattr(self.dut, 'internal_brg') and self.dut.has_internal_brg()
253
+
254
+ ##################################
255
+ # Phases
256
+ ##################################
257
+ class Phase:
258
+ def __init__(self, input=None, tested=True, rc=TEST_ABORTED, reason=""):
259
+ self.name = str(input)
260
+ self.tested = tested
261
+ self.rc = rc
262
+ self.reason = reason
263
+
264
+ def __repr__(self):
265
+ return self.name
266
+
267
+ ##################################
268
+ # Param
269
+ ##################################
270
+ class Param:
271
+ def __init__(self, input=None):
272
+ self.name = str(input)
273
+ self.value = eval_param(input)
274
+
275
+ def __repr__(self):
276
+ return self.name
277
+
278
+ ##################################
279
+ # Bridge
280
+ ##################################
281
+ brg_flag = lambda validation_schema: 'modules' in validation_schema
282
+
283
+ class Bridge:
284
+ def __init__(self, id_str="", board_type=0, cfg_hash=0, api_version=ag.API_VERSION_LATEST, interface_pkt=None, import_defs=True, overwrite_defs={}, rel_path=".", validation_schema=None):
285
+ """
286
+ Initialize a Bridge object.
287
+
288
+ Args:
289
+ id_str: Bridge ID string (hex format)
290
+ board_type: Board type identifier (default: 0)
291
+ cfg_hash: Configuration hash value (default: 0)
292
+ api_version: Bridge API version (default: ag.API_VERSION_LATEST)
293
+ interface_pkt: Interface packet containing bridge information (optional)
294
+ import_defs: Whether to import and overwrite defines (default: True)
295
+ overwrite_defs: Dictionary of defines to overwrite (default: {})
296
+ rel_path: Relative path for loading modules (default: ".")
297
+ validation_schema: Validation schema dictionary
298
+ """
299
+ self.id_str = id_str
300
+ self.id_int = hex_str2int(id_str)
301
+ self.id_alias = cert_common.hex2alias_id_get(id_str)
302
+ self.board_type = interface_pkt.board_type if interface_pkt else board_type
303
+ self.version = f"{interface_pkt.major_ver}.{interface_pkt.minor_ver}.{interface_pkt.patch_ver}" if interface_pkt else ""
304
+ self.bl_version = interface_pkt.bl_version if interface_pkt else ""
305
+ self.cfg_hash = interface_pkt.cfg_hash if interface_pkt else cfg_hash
306
+ self.api_version = interface_pkt.api_version if interface_pkt else api_version
307
+ if import_defs:
308
+ self.defines_file_name = f'{ag.BOARD_TYPES_LIST[self.board_type]}_defines.cfg'
309
+ overwrite_dict = {}
310
+ # Overwrite auto-generated defines for the specific bridge
311
+ if os.path.exists(os.path.join(BASE_DIR, "ag", self.defines_file_name)):
312
+ overwrite_dict.update(parse_cfg_file(os.path.join(BASE_DIR, "ag", self.defines_file_name)))
313
+ overwrite_dict.update(overwrite_defs) # Defines overwritten manually through cli
314
+ overwritten_defs_file = overwrite_defines_file(ORIGINAL_AG_FILE, self.id_str, overwrite_dict)
315
+ new_defines = load_module(overwritten_defs_file, f"./ag/{overwritten_defs_file}", rel_path)
316
+ ag.__dict__.update(new_defines.__dict__)
317
+ self.max_output_power_dbm = ag.BRG_DEFAULT_TX_POWER_MAX_2_4_DBM
318
+ self.validation_schema = validation_schema
319
+ self.sup_caps = []
320
+ self.modules = []
321
+ if interface_pkt:
322
+ for key, value in interface_pkt.__dict__.items():
323
+ if 'sup_cap_' in key and value:
324
+ module = key.replace('sup_cap_','')
325
+ if module in TEST_MODULES_MAP:
326
+ self.sup_caps += [TEST_MODULES_MAP[module]]
327
+ self.modules += [eval_pkt(ag.MODULES_DICT[TEST_MODULES_MAP[module]] + str(self.api_version))]
328
+ setattr(self, module, eval_pkt(ag.MODULES_DICT[TEST_MODULES_MAP[module]] + str(self.api_version)))
329
+
330
+ def update_modules(self):
331
+ self.modules = []
332
+ for sup_cap in self.sup_caps:
333
+ self.modules += [eval_pkt(ag.MODULES_DICT[sup_cap] + str(self.api_version))]
334
+
335
+ def is_sup_cap(self, test):
336
+ """Check if bridge supports the test module capability."""
337
+ return test.test_module in self.sup_caps if test.test_module and self.sup_caps else True
338
+
339
+ def __repr__(self):
340
+ version_str = f", version={self.version}" if self.version else ""
341
+ return f"Bridge(id={self.id_str}, board_type={self.board_type}{version_str})"
342
+
343
+ def cfg_brg_defaults_ret_after_fail(test):
344
+ utPrint(f"Configuring bridge {test.active_brg.id_str} to defaults", "BLUE")
345
+ modules = test.active_brg.modules
346
+ for module in modules:
347
+ utPrint(f"Configuring {module.__name__} to defaults", "BLUE")
348
+ cfg_pkt = cert_config.get_default_brg_pkt(test, module)
349
+ res = cert_config.brg_configure(test=test, cfg_pkt=cfg_pkt)[1]
350
+ if res == NO_RESPONSE:
351
+ utPrint(f"FAILURE: {module.__name__} configuration to defaults", "RED")
352
+ return NO_RESPONSE
353
+ else:
354
+ utPrint(f"SUCCESS: {module.__name__} configured to defaults", "GREEN")
355
+ return DONE
356
+
357
+ def handle_prep_brg_for_latest(test, interface, brg_id, start_time):
358
+ if test.rc == TEST_FAILED:
359
+ utPrint(f"No ModuleIf pkts found, try again", "BLUE")
360
+ test.rc = ""
361
+ test, interface = cert_common.get_module_if_pkt(test)
362
+ if test.rc == TEST_FAILED:
363
+ error = f"ERROR: No ModuleIf pkts found for 2 tries, couldn't perform OTA for bridge"
364
+ handle_error(error, start_time)
365
+ version = f"{interface.major_ver}.{interface.minor_ver}.{interface.patch_ver}"
366
+ board_type = interface.board_type
367
+ utPrint(f"BRG version [{version}], board type [{board_type}]", "BLUE")
368
+ utPrint(f"Skipping configurations for BRG {brg_id} to defaults because of latest/rc flag", "BLUE")
369
+ return Bridge(brg_id, interface_pkt=interface)
370
+
371
+ # Check BRGs are online and configure to defaults
372
+ def ut_prep_brg(args, start_time, tester, brg_id, tester_flag=False, validation_schema=None):
373
+ overwrite_defs = {} if (tester_flag or not args.overwrite_defaults) else args.overwrite_defaults
374
+ brg = Bridge(brg_id)
375
+ utPrint(SEP)
376
+ if not cert_common.is_cert_running:
377
+ versions_mgmt = load_module('versions_mgmt.py', f'{UTILS_BASE_REL_PATH}/versions_mgmt.py')
378
+ brg_owner = versions_mgmt.gw_brg_owner(env=AWS, server=PROD, brg=brg.id_str)
379
+ if brg_owner and not brg_owner in r_codes:
380
+ print_warn(f"{brg} owned by account {brg_owner}")
381
+ test = WltTest("", tester, dut=brg, exit_on_param_failure=args.exit_on_param_failure, data=args.data)
382
+ utPrint(f"Getting {brg} version and board type", "BLUE")
383
+ test, interface = cert_common.get_module_if_pkt(test)
384
+ # TODO - check validation against device response!
385
+ if args.latest or args.rc:
386
+ return handle_prep_brg_for_latest(test, interface, brg_id, start_time)
387
+ elif test.rc == TEST_FAILED:
388
+ error = f"ERROR: Didn't get ModuleIfV{test.active_brg.api_version} from BRG:{brg.id_str}!"
389
+ handle_error(error, start_time)
390
+ version = f"{interface.major_ver}.{interface.minor_ver}.{interface.patch_ver}"
391
+ board_type = interface.board_type
392
+ utPrint(f"BRG version [{version}], board type [{board_type}]", "BLUE")
393
+ test.active_brg = Bridge(brg.id_str, interface_pkt=interface, overwrite_defs=overwrite_defs, validation_schema=validation_schema)
394
+ test.dut = test.active_brg
395
+ modules_support = []
396
+ for module in TEST_MODULES_MAP:
397
+ modules_support.append([module, color("GREEN", "SUPPORTED") if TEST_MODULES_MAP[module] in test.active_brg.sup_caps else color("WARNING", "UNSUPPORTED")])
398
+ utPrint(f"BRG {brg.id_str} modules support coverage:", "BLUE")
399
+ print(tabulate.tabulate(modules_support, headers=['Module', 'Support'], tablefmt="fancy_grid"))
400
+ test.active_brg.board_type = board_type
401
+ cfg_output = cfg_brg_defaults_ret_after_fail(test=test)[1]
402
+ if cfg_output == NO_RESPONSE:
403
+ error = f"ERROR: Didn't get response from BRG:{brg.id_str}!"
404
+ handle_error(error, start_time)
405
+ test, interface = cert_common.get_module_if_pkt(test)
406
+ if test.rc == TEST_FAILED:
407
+ error = f"ERROR: Didn't get ModuleIfV{test.active_brg.api_version} from BRG:{brg.id_str}!"
408
+ handle_error(error, start_time)
409
+ utPrint(f"Received cfg hash {hex(interface.cfg_hash)}", "BLUE")
410
+ if not interface.cfg_hash or len(str(interface.cfg_hash)) < BRG_CFG_HAS_LEN:
411
+ error = f"ERROR: invalid cfg_hash for BRG:{brg.id_str}!"
412
+ handle_error(error, start_time)
413
+ utPrint(f"BRG {brg.id_str} cfg_hash_default={hex(interface.cfg_hash)}", "BLUE")
414
+ return Bridge(brg.id_str, interface_pkt=interface, overwrite_defs=overwrite_defs, validation_schema=validation_schema)
415
+
416
+ ##################################
417
+ # Gateway
418
+ ##################################
419
+ cloud_connectivity_flag = lambda validation_schema: 'properties' in validation_schema
420
+ class Gateway:
421
+ def __init__(self, id_str="", gw_version=None, gw_api_version=GW_API_VER_LATEST,
422
+ protobuf=False, mqttc=None, gw_sim=None, port='',
423
+ internal_brg=None, gw_orig_versions=None, validation_schema=None, upload_wait_time=0):
424
+ """
425
+ Initialize a Gateway object.
426
+
427
+ Args:
428
+ id_str: Gateway ID string
429
+ gw_version: Dictionary with BLE_VERSION and WIFI_VERSION keys
430
+ gw_api_version: Gateway API version
431
+ protobuf: Boolean indicating if gateway uses protobuf (default: False)
432
+ mqttc: MQTT client for the gateway
433
+ gw_sim: Gateway simulator thread (optional)
434
+ port: Port number (optional)
435
+ internal_brg: Internal Bridge object (optional)
436
+ gw_orig_versions: Original gateway versions dictionary (optional)
437
+ validation_schema: Validation schema dictionary
438
+ """
439
+ self.id_str = id_str
440
+ self.gw_version = gw_version or {}
441
+ self.gw_api_version = gw_api_version
442
+ self.mqttc = mqttc
443
+ self.gw_sim = gw_sim
444
+ self.port = port
445
+ self.internal_brg = internal_brg
446
+ self.gw_orig_versions = gw_orig_versions or gw_version or {}
447
+ self.protobuf = protobuf
448
+ self.validation_schema = validation_schema
449
+ self.upload_wait_time = upload_wait_time
450
+
451
+ def __repr__(self):
452
+ internal_brg_str = f", {self.internal_brg}" if self.internal_brg else ""
453
+ return f"Gateway(id={self.id_str}, api_version={self.gw_api_version}{internal_brg_str})"
454
+
455
+ def has_internal_brg(self):
456
+ """Check if gateway has an internal bridge."""
457
+ return self.internal_brg is not None
458
+
459
+ def is_simulated(self):
460
+ """Check if gateway is simulated."""
461
+ return self.gw_sim is not None
462
+
463
+ def get_tester_id(tester):
464
+ if not tester or tester == GW_SIM_PREFIX:
465
+ return f"GW_SIM_{get_random_hex_str()}"
466
+ else:
467
+ # Allow tester to be specified as tester_id:ble_addr
468
+ if ':' in tester:
469
+ tester, _ = tester.split(':')
470
+ return tester
471
+
472
+ def prep_dut(args, tester, validation_schema, mqttc, start_time, upload_wait_time):
473
+ """
474
+ Prepare device under test - returns Gateway() or Bridge() object.
475
+
476
+ Returns:
477
+ Gateway object if device is a gateway (with optional internal Bridge)
478
+ Bridge object if device is a standalone bridge
479
+ """
480
+ utPrint(SEP + f"Preparing DUT with ID {args.dut}" + SEP, "BLUE")
481
+ if cloud_connectivity_flag(validation_schema):
482
+ dut = Gateway(
483
+ id_str=args.dut,
484
+ gw_version=None,
485
+ gw_api_version=None,
486
+ protobuf=False,
487
+ mqttc=mqttc,
488
+ internal_brg=None,
489
+ gw_orig_versions=None,
490
+ validation_schema=validation_schema['properties'],
491
+ upload_wait_time=upload_wait_time
492
+ )
493
+ test = WltTest("", tester=None, dut=dut)
494
+ test, gw_info_ble_addr = prep_gw_info_action(test=test, start_time=start_time, brg_flag=brg_flag(validation_schema), target=DUT)
495
+ if brg_flag(validation_schema):
496
+ if not args.combo_ble_addr:
497
+ handle_error(f"ERROR: combo_ble_addr is missing! dut should be {args.dut}:<combo_ble_addr>", start_time)
498
+ elif gw_info_ble_addr and gw_info_ble_addr != args.combo_ble_addr:
499
+ handle_error(f"ERROR: DUT internal BRG ID from gw_info ({gw_info_ble_addr}) doesn't match the provided combo_ble_addr ({args.combo_ble_addr})!", start_time)
500
+
501
+ test.dut.gw_orig_versions = test.dut.gw_version.copy()
502
+ internal_brg_str = f":{args.combo_ble_addr}" if args.combo_ble_addr else ""
503
+ print(f"Starting certification for {test.dut}{internal_brg_str}")
504
+ # Configure GW to defaults
505
+ if not args.latest and not args.rc:
506
+ test, res = cert_config.config_gw_defaults(test, target=DUT)
507
+ if res == NO_RESPONSE:
508
+ handle_error("ERROR: Configuring gateway to defaults failed!", start_time)
509
+ # TODO - check validation against device response! (API_VALIDATION script from uplink_test)
510
+ else:
511
+ utPrint(f"Skipping configurations for gateway {test.dut.id_str} to defaults because of latest/rc flag", "BLUE")
512
+ # Prepare gateway's internal BRG
513
+ if brg_flag(validation_schema):
514
+ dut.internal_brg = ut_prep_brg(args, start_time, tester=test.dut, brg_id=args.combo_ble_addr, validation_schema=validation_schema['modules'])
515
+ if dut.internal_brg.api_version != ag.API_VERSION_LATEST:
516
+ handle_error(f"ERROR: Certificate FW api_version={dut.internal_brg.api_version} instead of api_version={ag.API_VERSION_LATEST}! Please upgrade the FW!", start_time)
517
+ # Return Gateway object
518
+ return dut
519
+
520
+ elif brg_flag(validation_schema):
521
+ # Prepare standalone bridge using prepared tester
522
+ brg = ut_prep_brg(args, start_time, tester=tester, brg_id=args.dut, validation_schema=validation_schema['modules'])
523
+ if brg.api_version != ag.API_VERSION_LATEST:
524
+ handle_error(f"ERROR: DUT FW api_version={brg.api_version} instead of api_version={ag.API_VERSION_LATEST}!", start_time)
525
+ return brg
526
+
527
+
528
+ def prep_tester(args, mqttc, start_time, gw_sim_thread=None):
529
+ """
530
+ Prepare tester gateway - returns Gateway() object (can also be a simulated GW).
531
+
532
+ Returns:
533
+ Gateway object with optional internal Bridge
534
+ """
535
+ utPrint(SEP + f"Preparing tester with ID {args.tester}" + SEP, "BLUE")
536
+ tester = Gateway(
537
+ id_str=args.tester,
538
+ gw_version=None,
539
+ gw_api_version=None,
540
+ protobuf=False,
541
+ mqttc=mqttc,
542
+ gw_sim=gw_sim_thread,
543
+ port=args.port,
544
+ internal_brg=None,
545
+ gw_orig_versions=None,
546
+ validation_schema=None
547
+ )
548
+ # Prepare a GW SIM tester
549
+ if gw_sim_thread:
550
+ # Check simulator is online and configure to defaults
551
+ utPrint("Checking UART response and configure internal brg to defaults", "BLUE")
552
+ internal_brg_mac_addr = os.getenv(GW_SIM_BLE_MAC_ADDRESS)
553
+ internal_brg_ble_ver = os.getenv(GW_APP_VERSION_HEADER)
554
+ if not internal_brg_mac_addr:
555
+ handle_error(f"ERROR: Didn't receive {GW_SIM_BLE_MAC_ADDRESS} response!", start_time)
556
+ tester.gw_version = {BLE_VERSION:internal_brg_ble_ver, WIFI_VERSION:"0.0.0"}
557
+ tester.gw_api_version = GW_API_VER_LATEST
558
+
559
+ # Prepare a GW tester
560
+ else:
561
+ test = WltTest("", tester=tester, dut=None)
562
+ test, internal_brg_mac_addr = prep_gw_info_action(test=test, start_time=start_time, brg_flag=True, target=TESTER)
563
+ # Tester is expected to have ble addr in gw info response
564
+ if internal_brg_mac_addr == "":
565
+ handle_error(f"ERROR: internal_brg_mac_addr in response is empty!", start_time)
566
+ test.tester.gw_orig_versions = test.tester.gw_version.copy()
567
+ print(f"Starting certification with tester ID {test.tester.id_str} and tester's internal BRG ID {internal_brg_mac_addr}")
568
+ # Configure GW to defaults
569
+ if not args.latest and not args.rc:
570
+ test, res = cert_config.config_gw_defaults(test, target=TESTER)
571
+ if res == NO_RESPONSE:
572
+ handle_error("ERROR: Config tester to defaults failed!", start_time)
573
+ else:
574
+ utPrint(f"Skipping configurations for tester {tester} to defaults because of latest/rc flag", "BLUE")
575
+ tester = test.tester
576
+
577
+ # Prepare tester's internal BRG
578
+ tester.internal_brg = ut_prep_brg(args, start_time, tester, internal_brg_mac_addr, tester_flag=True, validation_schema=None)
579
+ if gw_sim_thread and tester.internal_brg.version not in TESTER_FW_VERSIONS:
580
+ utPrint(f"ERROR: Certificate FW version={tester.internal_brg.version} instead of versions={TESTER_FW_VERSIONS}!\n"
581
+ f"Please run the command wlt-cert-tester-upgrade to upgrade the tester firmware!", "RED")
582
+ handle_error("ERROR: Tester FW version mismatch!", start_time)
583
+ # Return Gateway object
584
+ return tester
585
+
586
+ def prep_gw_info_action(test, start_time, brg_flag, target):
587
+ # TODO - make sure certification can run with new assumptions (results, bitbucket-pipelines, etc.)
588
+ gw = test.dut if target == DUT else test.tester
589
+ utPrint(f"Getting {gw} information", "BLUE")
590
+ response = cert_common.get_gw_info(test, target=target)
591
+ if response == NO_RESPONSE:
592
+ error = f"ERROR: Didn't get response from {gw} !"
593
+ handle_error(error, start_time)
594
+ internal_brg_mac_addr = ""
595
+ if ENTRIES in response[GW_INFO]:
596
+ # Protobuf
597
+ info = response[GW_INFO][ENTRIES]
598
+ gw.protobuf = True
599
+ if BLE_VERSION in info and WIFI_VERSION in info:
600
+ gw.gw_version = {BLE_VERSION : info[BLE_VERSION][STR_VAL], WIFI_VERSION : info[WIFI_VERSION][STR_VAL]}
601
+ if brg_flag and BLE_MAC_ADDR in info:
602
+ internal_brg_mac_addr = info[BLE_MAC_ADDR][STR_VAL]
603
+ if GW_API_VERSION in info:
604
+ gw.gw_api_version = info[GW_API_VERSION][STR_VAL]
605
+ else:
606
+ # JSON
607
+ info = response[GW_INFO]
608
+ gw.protobuf = False
609
+ if BLE_VERSION in info and WIFI_VERSION in info:
610
+ gw.gw_version = {BLE_VERSION : info[BLE_VERSION], WIFI_VERSION : info[WIFI_VERSION]}
611
+ if brg_flag and BLE_MAC_ADDR in info:
612
+ internal_brg_mac_addr = info[BLE_MAC_ADDR]
613
+ if GW_API_VERSION in info:
614
+ gw.gw_api_version = info[GW_API_VERSION]
615
+
616
+ if target == DUT:
617
+ test.dut = gw
618
+ else:
619
+ test.tester = gw
620
+
621
+ return test, internal_brg_mac_addr
622
+