wiliot-certificate 4.4.3__py3-none-any.whl → 4.5.0__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 (297) 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. certificate/cert_common.py +1488 -0
  4. certificate/cert_config.py +480 -0
  5. {brg_certificate → certificate}/cert_data_sim.py +134 -46
  6. {brg_certificate → certificate}/cert_defines.py +129 -128
  7. {brg_certificate → certificate}/cert_gw_sim.py +183 -53
  8. {brg_certificate → certificate}/cert_mqtt.py +179 -64
  9. {brg_certificate → certificate}/cert_prints.py +35 -33
  10. {brg_certificate → certificate}/cert_protobuf.py +15 -6
  11. {brg_certificate → certificate}/cert_results.py +240 -64
  12. certificate/cert_utils.py +634 -0
  13. certificate/certificate.py +205 -0
  14. certificate/certificate_cli.py +76 -0
  15. certificate/certificate_eth_test_list.txt +76 -0
  16. certificate/certificate_sanity_test_list.txt +66 -0
  17. certificate/certificate_test_list.txt +76 -0
  18. {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.json +3 -2
  19. {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.py +7 -6
  20. certificate/tests/calibration/output_power_test/output_power_test.json +23 -0
  21. certificate/tests/calibration/output_power_test/output_power_test.py +39 -0
  22. {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.json +2 -1
  23. {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.py +20 -15
  24. certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.json +15 -0
  25. certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.py +140 -0
  26. certificate/tests/cloud_connectivity/acl_test/acl_test.json +15 -0
  27. certificate/tests/cloud_connectivity/acl_test/acl_test.py +96 -0
  28. certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.json +19 -0
  29. certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.py +41 -0
  30. certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.json +19 -0
  31. certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py +215 -0
  32. certificate/tests/cloud_connectivity/connection_test/connection_test.json +18 -0
  33. certificate/tests/cloud_connectivity/connection_test/connection_test.py +67 -0
  34. certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.json +15 -0
  35. certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.py +80 -0
  36. certificate/tests/cloud_connectivity/downlink_test/downlink_test.json +21 -0
  37. certificate/tests/cloud_connectivity/downlink_test/downlink_test.py +201 -0
  38. certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.json +17 -0
  39. certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.py +104 -0
  40. certificate/tests/cloud_connectivity/reboot_test/reboot_test.json +18 -0
  41. certificate/tests/cloud_connectivity/reboot_test/reboot_test.py +59 -0
  42. certificate/tests/cloud_connectivity/registration_test/registration_test.json +20 -0
  43. certificate/tests/cloud_connectivity/registration_test/registration_test.py +384 -0
  44. certificate/tests/cloud_connectivity/registration_test/registration_test_cli.py +90 -0
  45. certificate/tests/cloud_connectivity/stress_test/stress_test.json +17 -0
  46. certificate/tests/cloud_connectivity/stress_test/stress_test.py +101 -0
  47. certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.json +25 -0
  48. certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.py +92 -0
  49. certificate/tests/cloud_connectivity/uplink_test/uplink_test.json +20 -0
  50. certificate/tests/cloud_connectivity/uplink_test/uplink_test.py +169 -0
  51. {brg_certificate → certificate}/tests/datapath/aging_test/aging_test.json +2 -1
  52. certificate/tests/datapath/aging_test/aging_test.py +142 -0
  53. certificate/tests/datapath/event_ble5_test/event_ble5_test.json +17 -0
  54. certificate/tests/datapath/event_ble5_test/event_ble5_test.py +89 -0
  55. certificate/tests/datapath/event_test/event_test.json +17 -0
  56. certificate/tests/datapath/event_test/event_test.py +80 -0
  57. {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.json +4 -3
  58. {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.py +19 -13
  59. certificate/tests/datapath/output_power_test/output_power_test.json +23 -0
  60. {brg_certificate → certificate}/tests/datapath/output_power_test/output_power_test.py +17 -6
  61. {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +2 -1
  62. {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +13 -11
  63. {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.json +2 -1
  64. {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.py +9 -7
  65. {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.json +3 -2
  66. {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.py +18 -6
  67. certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.json +20 -0
  68. certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.py +61 -0
  69. {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +2 -1
  70. {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +15 -14
  71. certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.json +19 -0
  72. certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.py +85 -0
  73. {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +2 -1
  74. {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +10 -9
  75. {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.json +2 -1
  76. {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.py +10 -9
  77. {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +3 -2
  78. {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +9 -8
  79. brg_certificate/tests/datapath/output_power_test/output_power_test.json → certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.json +6 -4
  80. certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.py +77 -0
  81. {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.json +3 -2
  82. {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.py +7 -6
  83. {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +8 -7
  84. {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +113 -73
  85. {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +8 -7
  86. {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +112 -72
  87. {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.json +4 -3
  88. {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.py +15 -11
  89. {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.json +4 -3
  90. {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.py +15 -11
  91. {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.json +3 -1
  92. {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.py +14 -13
  93. certificate/tests/edge_mgmt/action_blink_test/action_blink_test.json +15 -0
  94. certificate/tests/edge_mgmt/action_blink_test/action_blink_test.py +24 -0
  95. certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.json +15 -0
  96. certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.py +43 -0
  97. certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.json +15 -0
  98. certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.py +42 -0
  99. certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.json +15 -0
  100. certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.py +44 -0
  101. certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.json +16 -0
  102. certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.py +42 -0
  103. certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.json +15 -0
  104. certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.py +49 -0
  105. certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.json +15 -0
  106. certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.py +102 -0
  107. certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.json +15 -0
  108. certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.py +45 -0
  109. {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.json +3 -2
  110. {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.py +22 -11
  111. {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.json +2 -1
  112. {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.py +7 -6
  113. certificate/tests/energy2400/output_power_test/output_power_test.json +23 -0
  114. {brg_certificate → certificate}/tests/energy2400/output_power_test/output_power_test.py +17 -6
  115. {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.json +2 -1
  116. {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.py +7 -6
  117. certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +26 -0
  118. certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +379 -0
  119. certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.json +20 -0
  120. certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.py +173 -0
  121. certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +24 -0
  122. certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +350 -0
  123. {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +2 -1
  124. {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +7 -6
  125. {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.json +2 -1
  126. {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.py +7 -6
  127. {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +2 -1
  128. {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +10 -10
  129. {brg_certificate → certificate}/tests/sensors/ext_sensor_test/ext_sensor_test.json +5 -4
  130. certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +450 -0
  131. certificate/wlt_types.py +122 -0
  132. {gw_certificate → common}/api_if/202/status.json +6 -0
  133. {gw_certificate → common}/api_if/203/status.json +6 -0
  134. {gw_certificate → common}/api_if/204/status.json +6 -0
  135. common/api_if/206/data.json +85 -0
  136. common/api_if/206/status.json +69 -0
  137. common/api_if/api_validation.py +91 -0
  138. common/web/templates/generator.html +210 -0
  139. common/web/templates/index.html +20 -0
  140. common/web/templates/menu.html +54 -0
  141. common/web/templates/parser.html +53 -0
  142. {brg_certificate/ag → common/web/templates}/wlt_types.html +1216 -191
  143. common/web/web_utils.py +399 -0
  144. {brg_certificate → common}/wltPb_pb2.py +14 -12
  145. {gw_certificate/common → common}/wltPb_pb2.pyi +16 -2
  146. gui_certificate/gui_certificate_cli.py +14 -0
  147. gui_certificate/server.py +1267 -0
  148. gui_certificate/templates/cert_run.html +1273 -0
  149. wiliot_certificate-4.5.0.dist-info/METADATA +99 -0
  150. wiliot_certificate-4.5.0.dist-info/RECORD +168 -0
  151. {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0.dist-info}/WHEEL +1 -1
  152. wiliot_certificate-4.5.0.dist-info/entry_points.txt +5 -0
  153. wiliot_certificate-4.5.0.dist-info/top_level.txt +3 -0
  154. brg_certificate/ag/energous_v0_defines.py +0 -925
  155. brg_certificate/ag/energous_v1_defines.py +0 -931
  156. brg_certificate/ag/energous_v2_defines.py +0 -925
  157. brg_certificate/ag/energous_v3_defines.py +0 -925
  158. brg_certificate/ag/energous_v4_defines.py +0 -925
  159. brg_certificate/ag/fanstel_lan_v0_defines.py +0 -925
  160. brg_certificate/ag/fanstel_lte_v0_defines.py +0 -925
  161. brg_certificate/ag/fanstel_wifi_v0_defines.py +0 -925
  162. brg_certificate/ag/minew_lte_v0_defines.py +0 -925
  163. brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +0 -142
  164. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +0 -785
  165. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +0 -139
  166. brg_certificate/ag/wlt_types_ag_jsons/calibration.json +0 -394
  167. brg_certificate/ag/wlt_types_ag_jsons/custom.json +0 -515
  168. brg_certificate/ag/wlt_types_ag_jsons/datapath.json +0 -672
  169. brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +0 -550
  170. brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +0 -595
  171. brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +0 -598
  172. brg_certificate/ag/wlt_types_ag_jsons/interface.json +0 -938
  173. brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +0 -1234
  174. brg_certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +0 -105
  175. brg_certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +0 -77
  176. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +0 -61
  177. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +0 -110
  178. brg_certificate/brg_certificate.py +0 -225
  179. brg_certificate/brg_certificate_cli.py +0 -63
  180. brg_certificate/cert_common.py +0 -923
  181. brg_certificate/cert_config.py +0 -402
  182. brg_certificate/cert_utils.py +0 -362
  183. brg_certificate/certificate_bcc_sanity_test_list.txt +0 -40
  184. brg_certificate/certificate_bcc_test_list.txt +0 -48
  185. brg_certificate/certificate_sanity_test_list.txt +0 -43
  186. brg_certificate/certificate_test_list.txt +0 -53
  187. brg_certificate/config/eclipse.json +0 -10
  188. brg_certificate/config/hivemq.json +0 -10
  189. brg_certificate/config/mosquitto.json +0 -10
  190. brg_certificate/config/mosquitto.md +0 -95
  191. brg_certificate/config/wiliot-dev.json +0 -10
  192. brg_certificate/restore_brg.py +0 -61
  193. brg_certificate/tests/calibration/output_power_test/output_power_test.json +0 -16
  194. brg_certificate/tests/calibration/output_power_test/output_power_test.py +0 -28
  195. brg_certificate/tests/datapath/aging_test/aging_test.py +0 -143
  196. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +0 -16
  197. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +0 -73
  198. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +0 -17
  199. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +0 -118
  200. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +0 -14
  201. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +0 -396
  202. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +0 -20
  203. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +0 -94
  204. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +0 -19
  205. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +0 -87
  206. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +0 -17
  207. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +0 -223
  208. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +0 -17
  209. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +0 -128
  210. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +0 -16
  211. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +0 -20
  212. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +0 -321
  213. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +0 -20
  214. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +0 -321
  215. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +0 -20
  216. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +0 -141
  217. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +0 -20
  218. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +0 -276
  219. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +0 -20
  220. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +0 -390
  221. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +0 -16
  222. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +0 -28
  223. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +0 -305
  224. brg_certificate/wltPb_pb2.pyi +0 -234
  225. brg_certificate/wlt_types.py +0 -113
  226. gw_certificate/ag/ut_defines.py +0 -364
  227. gw_certificate/ag/wlt_types.py +0 -85
  228. gw_certificate/ag/wlt_types_ag.py +0 -5310
  229. gw_certificate/ag/wlt_types_data.py +0 -64
  230. gw_certificate/api/extended_api.py +0 -23
  231. gw_certificate/api_if/200/data.json +0 -106
  232. gw_certificate/api_if/200/status.json +0 -47
  233. gw_certificate/api_if/201/data.json +0 -98
  234. gw_certificate/api_if/201/status.json +0 -53
  235. gw_certificate/api_if/205/logs.json +0 -12
  236. gw_certificate/api_if/api_validation.py +0 -38
  237. gw_certificate/api_if/gw_capabilities.py +0 -54
  238. gw_certificate/cert_results.py +0 -145
  239. gw_certificate/common/analysis_data_bricks.py +0 -60
  240. gw_certificate/common/debug.py +0 -42
  241. gw_certificate/common/serialization_formatter.py +0 -93
  242. gw_certificate/common/utils.py +0 -8
  243. gw_certificate/common/utils_defines.py +0 -15
  244. gw_certificate/common/wltPb_pb2.py +0 -84
  245. gw_certificate/gw_certificate.py +0 -154
  246. gw_certificate/gw_certificate_cli.py +0 -87
  247. gw_certificate/interface/4.4.93_app.zip +0 -0
  248. gw_certificate/interface/4.4.93_sd_bl_app.zip +0 -0
  249. gw_certificate/interface/ble_simulator.py +0 -61
  250. gw_certificate/interface/ble_sniffer.py +0 -189
  251. gw_certificate/interface/flash_fw.py +0 -90
  252. gw_certificate/interface/if_defines.py +0 -36
  253. gw_certificate/interface/mqtt.py +0 -563
  254. gw_certificate/interface/nrfutil-linux +0 -0
  255. gw_certificate/interface/nrfutil-mac +0 -0
  256. gw_certificate/interface/nrfutil.exe +0 -0
  257. gw_certificate/interface/pkt_generator.py +0 -594
  258. gw_certificate/interface/uart_if.py +0 -236
  259. gw_certificate/interface/uart_ports.py +0 -20
  260. gw_certificate/templates/results.html +0 -241
  261. gw_certificate/templates/stage.html +0 -22
  262. gw_certificate/templates/table.html +0 -6
  263. gw_certificate/templates/test.html +0 -38
  264. gw_certificate/tests/__init__.py +0 -10
  265. gw_certificate/tests/actions.py +0 -289
  266. gw_certificate/tests/bad_crc_to_PER_quantization.csv +0 -51
  267. gw_certificate/tests/connection.py +0 -188
  268. gw_certificate/tests/downlink.py +0 -172
  269. gw_certificate/tests/generic.py +0 -238
  270. gw_certificate/tests/registration.py +0 -340
  271. gw_certificate/tests/static/__init__.py +0 -0
  272. gw_certificate/tests/static/connection_defines.py +0 -9
  273. gw_certificate/tests/static/downlink_defines.py +0 -9
  274. gw_certificate/tests/static/generated_packet_table.py +0 -195
  275. gw_certificate/tests/static/packet_table.csv +0 -10067
  276. gw_certificate/tests/static/references.py +0 -5
  277. gw_certificate/tests/static/uplink_defines.py +0 -14
  278. gw_certificate/tests/throughput.py +0 -240
  279. gw_certificate/tests/uplink.py +0 -853
  280. wiliot_certificate-4.4.3.dist-info/METADATA +0 -211
  281. wiliot_certificate-4.4.3.dist-info/RECORD +0 -210
  282. wiliot_certificate-4.4.3.dist-info/entry_points.txt +0 -3
  283. wiliot_certificate-4.4.3.dist-info/top_level.txt +0 -3
  284. {brg_certificate → certificate}/__init__.py +0 -0
  285. {gw_certificate → common}/api_if/202/data.json +0 -0
  286. {gw_certificate/api_if/200 → common/api_if/202}/logs.json +0 -0
  287. {gw_certificate → common}/api_if/203/data.json +0 -0
  288. {gw_certificate/api_if/201 → common/api_if/203}/logs.json +0 -0
  289. {gw_certificate → common}/api_if/204/data.json +0 -0
  290. {gw_certificate/api_if/202 → common/api_if/204}/logs.json +0 -0
  291. {gw_certificate → common}/api_if/205/data.json +0 -0
  292. {gw_certificate/api_if/203 → common/api_if/205}/logs.json +0 -0
  293. {gw_certificate → common}/api_if/205/status.json +0 -0
  294. {gw_certificate/api_if/204 → common/api_if/206}/logs.json +0 -0
  295. {gw_certificate → common/api_if}/__init__.py +0 -0
  296. {gw_certificate/api_if → gui_certificate}/__init__.py +0 -0
  297. {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -8,28 +8,40 @@ import datetime
8
8
  import base64
9
9
  import copy
10
10
  import traceback
11
- import brg_certificate.wltPb_pb2 as wpb
11
+ import common.wltPb_pb2 as wpb
12
12
  from google.protobuf.message import DecodeError
13
13
  from google.protobuf.json_format import MessageToDict
14
14
 
15
15
  # Local imports
16
- from brg_certificate.wlt_types import *
17
- from brg_certificate.cert_data_sim import PIXEL_SIM_INDICATOR, TAG_ID_OFFSET
18
- from brg_certificate.cert_prints import *
19
- from brg_certificate.cert_defines import *
16
+ from certificate.wlt_types import *
17
+ from certificate.cert_data_sim import PIXEL_SIM_INDICATOR, TAG_ID_OFFSET
18
+ from certificate.cert_prints import *
19
+ from certificate.cert_defines import *
20
20
 
21
21
 
22
22
  SENSORS_DATA_SI_DUP = 6
23
-
23
+ # Custom MQTT brokers' configuration jsons' paths
24
+ EMQX = os.path.join(BASE_DIR, "config/emqx.json")
25
+ WILIOT_DEV = os.path.join(BASE_DIR, "config/wiliot-dev.json")
24
26
  class WltMqttPkt:
25
27
  def __init__(self, body, topic, userdata):
26
28
  self.body = body
27
29
  self.mqtt_topic = topic
28
- self.mqtt_timestamp = datetime.datetime.now()
30
+ self.mqtt_timestamp = int(time.time() * 1000)
29
31
  self.body_ex = {}
30
32
  if "data" in self.mqtt_topic:
31
33
  self.body_ex = copy.deepcopy(body)
32
34
  self.body_ex['undecrypted'] = 0
35
+
36
+ # Split aggregated packets into multiple packets
37
+ split_pkts = []
38
+ for pkt in self.body_ex[PACKETS]:
39
+ if len(pkt[PAYLOAD])/2 > (int(pkt[PAYLOAD][0:2], 16) + 1): # Aggregated packet since the length is larger than the header length
40
+ split_pkts += split_aggregated_pkt(pkt)
41
+ else: # Not an aggregated packet
42
+ split_pkts += [pkt]
43
+ self.body_ex[PACKETS] = split_pkts
44
+
33
45
  for pkt in self.body_ex[PACKETS]:
34
46
  # if packet is not a mgmt packet or a side info packet it is a data packet
35
47
  wlt_pkt = WltPkt(pkt[PAYLOAD])
@@ -45,7 +57,12 @@ class WltMqttPkt:
45
57
  elif wlt_pkt.hdr.group_id == ag.GROUP_ID_SIDE_INFO_SENSOR:
46
58
  pkt[SIDE_INFO_SENSOR_PKT] = copy.deepcopy(wlt_pkt)
47
59
  elif wlt_pkt.hdr.uuid_lsb == ag.HDR_DEFAULT_BRG_SENSOR_UUID_LSB and wlt_pkt.hdr.uuid_msb == ag.HDR_DEFAULT_BRG_SENSOR_UUID_MSB:
48
- pkt[SENSOR_PKT] = copy.deepcopy(wlt_pkt)
60
+ if isinstance(wlt_pkt.pkt, ag.UnifiedSensorPkt):
61
+ pkt[UNIFIED_SENSOR_PKT] = copy.deepcopy(wlt_pkt)
62
+ if (wlt_pkt.hdr.group_id == ag.GROUP_ID_SIGNAL_INDICATOR):
63
+ pkt[UNIFIED_SENSOR_PKT].pkt.signal_indicator_payload = ag.SignalIndicatorDataV1(pkt[PAYLOAD][8:62])
64
+ else:
65
+ pkt[SENSOR_PKT] = copy.deepcopy(wlt_pkt)
49
66
  pkt[DECODED_DATA] = {TAG_ID: None, PACKET_CNTR: None, PACKET_TYPE: None}
50
67
  else:
51
68
  if userdata["data"] != DATA_SIMULATION:
@@ -91,7 +108,7 @@ class WltMqttPkts:
91
108
  self.status = []
92
109
 
93
110
  def local_resolve(p):
94
- import brg_certificate.ut.ut_resolve as ut_resolve
111
+ import certificate.ut.ut_resolve as ut_resolve
95
112
  irresolvable_payloads = ["1E16C6FC0000EE", "1E16AFFD0000EC", "1E16C6FC0000EC"]
96
113
  try:
97
114
  if any(substring in p for substring in irresolvable_payloads):
@@ -115,6 +132,39 @@ def local_resolve(p):
115
132
  print(e)
116
133
  print(f"Failed in local_resolve with packet: {p}\n")
117
134
  return None
135
+
136
+ def split_aggregated_pkt(pkt):
137
+ hex_str = pkt[PAYLOAD]
138
+ idx = 0
139
+ fragments = []
140
+
141
+ # walk through the hex string
142
+ while idx < len(hex_str):
143
+ # parse length byte
144
+ length = int(hex_str[idx:idx+2], 16)
145
+ if length < ag.HDR_DEFAULT_PKT_SIZE:
146
+ # The sensor packet itself is built from small segments, the smallest payload is of size 31 bytes
147
+ length = ag.HDR_DEFAULT_PKT_SIZE
148
+ end = idx + 2 + length*2
149
+ if end > len(hex_str):
150
+ raise ValueError(
151
+ f"Packet at position {idx} says {length} bytes, "
152
+ f"but only {(len(hex_str)-idx-2)//2} are available. pkt : {pkt[PAYLOAD]}"
153
+ )
154
+ # slice out this packet (including the length byte itself)
155
+ fragment = hex_str[idx:end]
156
+
157
+ # build new packet dict
158
+ fragments.append({
159
+ PAYLOAD: fragment,
160
+ TIMESTAMP: pkt[TIMESTAMP],
161
+ SEQUENCE_ID: pkt[SEQUENCE_ID],
162
+ RSSI: pkt[RSSI],
163
+ ALIAS_BRIDGE_ID: pkt[ALIAS_BRIDGE_ID],
164
+ AGGREGATED_PAYLOAD: pkt[PAYLOAD]
165
+ })
166
+ idx = end
167
+ return fragments
118
168
 
119
169
  def is_json(msg):
120
170
  is_utf = True
@@ -148,7 +198,8 @@ def on_message_json(mqttc, userdata, message):
148
198
  wlt_mqtt_pkts = userdata[PKTS]
149
199
  data = json.loads(message.payload.decode("utf-8"))
150
200
  wlt_mqtt_pkts.insert(WltMqttPkt(data, message.topic, userdata))
151
- write_to_mqtt_log_file("// JSON message received at {}, topic={}:\n{}\n".format(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), message.topic, str(message.payload.decode("utf-8"))))
201
+ text = json.dumps(json.loads(message.payload.decode("utf-8")), indent=4)
202
+ write_to_mqtt_log_file("// JSON message received at {}, topic={}:\n{}\n".format(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"), message.topic, text))
152
203
 
153
204
  def on_message_protobuf(mqttc, userdata, message):
154
205
  pb_msg = None
@@ -165,19 +216,21 @@ def on_message_protobuf(mqttc, userdata, message):
165
216
  pb_msg.ParseFromString(message.payload)
166
217
  pb_decoded = True
167
218
  except DecodeError as e:
168
- print(f'ERROR: failed decoding {message.topic} message: \n{e}\n')
219
+ print(f'ERROR: failed decoding {message.topic} message: {e}\npayload: {message.payload}')
169
220
 
170
221
  if pb_decoded is True:
171
222
  pb_msg_dict = MessageToDict(pb_msg)
172
223
  # Align formats with JSON (bytes to hex strings)
173
224
  if 'status' in message.topic:
174
225
  if ACTION_STATUS in pb_msg_dict:
175
- pb_msg_dict[ACTION_STATUS][BRIDGE_ID] = base64.b64decode(pb_msg_dict[ACTION_STATUS][BRIDGE_ID]).hex().upper()
226
+ if BRIDGE_ID in pb_msg_dict[ACTION_STATUS].keys():
227
+ pb_msg_dict[ACTION_STATUS][BRIDGE_ID] = base64.b64decode(pb_msg_dict[ACTION_STATUS][BRIDGE_ID]).hex().upper()
176
228
  if GW_STATUS in pb_msg_dict and ACL_IDS in pb_msg_dict[GW_STATUS][CONFIG][ACL][ACL_VALUE]:
177
229
  ids_list = pb_msg_dict[GW_STATUS][CONFIG][ACL][ACL_VALUE][ACL_IDS]
178
230
  for idx, id in enumerate(ids_list):
179
231
  ids_list[idx] = base64.b64decode(id).hex().upper()
180
232
  if 'data' in message.topic and PACKETS in pb_msg_dict.keys():
233
+ pb_msg_dict[TIMESTAMP] = (int(pb_msg_dict[TIMESTAMP]))
181
234
  for idx, pkt in enumerate(pb_msg_dict[PACKETS]):
182
235
  pb_msg_dict[PACKETS][idx][PAYLOAD] = base64.b64decode(pkt[PAYLOAD]).hex().upper()
183
236
  pb_msg_dict[PACKETS][idx][TIMESTAMP] = int(pkt[TIMESTAMP])
@@ -196,37 +249,36 @@ def on_message_protobuf(mqttc, userdata, message):
196
249
  def pkts_to_log(pkts):
197
250
  text = ""
198
251
  for p in pkts:
199
- text += "// {} topic={}".format(p.mqtt_timestamp.strftime("%d/%m/%Y, %H:%M:%S"), p.mqtt_topic)
252
+ dt = datetime.datetime.fromtimestamp(p.mqtt_timestamp / 1000)
253
+ text += "// {} topic={}".format(dt.strftime("%d/%m/%Y, %H:%M:%S"), p.mqtt_topic)
200
254
  text += "\n"+json.dumps(p.body, indent=4)+"\n"
201
255
  return text
202
256
 
203
- def write_to_log_file(file_name, pkts):
204
- f = open(os.path.join(BASE_DIR, file_name), "w")
205
- f.write(pkts_to_log(pkts))
206
- f.close()
257
+ def write_pkts_to_log_file(file, pkts):
258
+ write_to_log_file(file, pkts_to_log(pkts), "w")
207
259
 
208
260
  def write_to_mqtt_log_file(txt):
209
- f = open(os.path.join(BASE_DIR, CERT_MQTT_LOG_FILE), "a")
210
- f.write(txt)
211
- f.close()
212
-
213
- def load_custom_broker(gw, rel_path="."):
214
- f = open(os.path.join(BASE_DIR, rel_path, "config", "eclipse.json"))
215
- # f = open(os.path.join(BASE_DIR, rel_path, "config", "hivemq.json"))
216
- # f = open(os.path.join(BASE_DIR, rel_path, "config", "mosquitto.json"))
217
- # f = open(os.path.join(BASE_DIR, rel_path, "config", "wiliot-dev.json"))
261
+ write_to_log_file(CERT_MQTT_LOG_FILE, txt, "a")
262
+
263
+ def load_custom_broker(broker_filepath, gw):
264
+ try:
265
+ f = open(str(broker_filepath).strip("'"))
266
+ except FileNotFoundError:
267
+ raise FileNotFoundError(f"No such file: {broker_filepath}")
218
268
  data = json.load(f)
219
- data[CUSTOM_BROKER_UPDATE_TOPIC] += gw
220
- data[CUSTOM_BROKER_STATUS_TOPIC] += gw
221
- data[CUSTOM_BROKER_DATA_TOPIC] += gw
269
+ data[CUSTOM_BROKER_UPDATE_TOPIC] = data[CUSTOM_BROKER_UPDATE_TOPIC].replace(f'<{GW_ID}>', gw)
270
+ data[CUSTOM_BROKER_STATUS_TOPIC] = data[CUSTOM_BROKER_STATUS_TOPIC].replace(f'<{GW_ID}>', gw)
271
+ data[CUSTOM_BROKER_DATA_TOPIC] = data[CUSTOM_BROKER_DATA_TOPIC].replace(f'<{GW_ID}>', gw)
222
272
  return data
223
273
 
224
- def mqttc_init(gw_id, userdata={PKTS: WltMqttPkts()}, rel_path=".", data=DATA_REAL_TAGS):
225
-
226
- custom_broker = load_custom_broker(gw=gw_id, rel_path=rel_path)
274
+ def mqttc_init(gw_id, custom_broker, data=DATA_REAL_TAGS):
275
+ # Ensure each MQTT client gets its own userdata for logging and getting pkts
276
+ userdata = {PKTS: WltMqttPkts()}
277
+ custom_broker = load_custom_broker(broker_filepath=custom_broker, gw=gw_id)
227
278
  client_id = '{}-republish'.format(gw_id)
228
279
  userdata["data"] = data
229
280
  mqttc = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, client_id, userdata=userdata)
281
+ print(f"Connecting to MQTT broker at {custom_broker[CUSTOM_BROKER_BROKER_URL]}:{custom_broker[CUSTOM_BROKER_PORT]} with client ID: {client_id}")
230
282
  mqttc.username_pw_set(custom_broker[CUSTOM_BROKER_USERNAME], custom_broker[CUSTOM_BROKER_PASSWORD])
231
283
  mqttc.on_message = on_message
232
284
  mqttc.on_connect = on_connect
@@ -240,10 +292,21 @@ def mqttc_init(gw_id, userdata={PKTS: WltMqttPkts()}, rel_path=".", data=DATA_RE
240
292
 
241
293
  mqttc.update_topic = custom_broker[CUSTOM_BROKER_UPDATE_TOPIC]
242
294
  mqttc.subscribe(mqttc.update_topic)
295
+ print(f"Subscribed to update topic: {mqttc.update_topic}")
243
296
  mqttc.data_topic = custom_broker[CUSTOM_BROKER_DATA_TOPIC]
244
297
  mqttc.subscribe(mqttc.data_topic)
298
+ print(f"Subscribed to data topic: {mqttc.data_topic}")
245
299
  mqttc.status_topic = custom_broker[CUSTOM_BROKER_STATUS_TOPIC]
246
300
  mqttc.subscribe(mqttc.status_topic)
301
+ print(f"Subscribed to status topic: {mqttc.status_topic}")
302
+
303
+ # v2 protobuf topics
304
+ mqttc.data_topic_pb = re.sub(r'^([^/]+)', r'\1-v2', custom_broker[CUSTOM_BROKER_DATA_TOPIC])
305
+ mqttc.subscribe(mqttc.data_topic_pb)
306
+ print(f"Subscribed to data topic: {mqttc.data_topic_pb}")
307
+ mqttc.status_topic_pb = re.sub(r'^([^/]+)', r'\1-v2', custom_broker[CUSTOM_BROKER_STATUS_TOPIC])
308
+ mqttc.subscribe(mqttc.status_topic_pb)
309
+ print(f"Subscribed to status topic: {mqttc.status_topic_pb}")
247
310
 
248
311
  mqttc.flush_pkts = mqttc._userdata[PKTS].flush
249
312
  mqttc.flush_data_pkts = mqttc._userdata[PKTS].flush_data
@@ -252,33 +315,65 @@ def mqttc_init(gw_id, userdata={PKTS: WltMqttPkts()}, rel_path=".", data=DATA_RE
252
315
 
253
316
  return mqttc
254
317
 
255
- def dump_pkts(test, log):
256
- write_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_all.json"), test.mqttc._userdata[PKTS].all)
257
- write_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_data.json"), test.mqttc._userdata[PKTS].data)
258
- write_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_status.json"), test.mqttc._userdata[PKTS].status)
259
- write_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_update.json"), test.mqttc._userdata[PKTS].update)
318
+ def dump_pkts(test, log, target=DUT):
319
+ mqttc = test.get_mqttc_by_target(target)
320
+ write_pkts_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_all.json"), mqttc._userdata[PKTS].all)
321
+ write_pkts_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_data.json"), mqttc._userdata[PKTS].data)
322
+ write_pkts_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_status.json"), mqttc._userdata[PKTS].status)
323
+ write_pkts_to_log_file(os.path.join(test.dir, MQTT_LOG_PRE_STR+log+"_update.json"), mqttc._userdata[PKTS].update)
324
+
325
+ def generate_log_file(test, val, target=DUT):
326
+ if type(val) == int or type(val) == str:
327
+ log_string = str(val)
328
+ else:
329
+ log_string = str(val[0])
330
+ for i in range(1,len(val)):
331
+ log_string += ","+ str(val[i])
332
+ if test.internal_brg:
333
+ log_string += "_internal_brg"
334
+ dump_pkts(test, log_string, target)
335
+
336
+ def mqtt_scan_n_create_log_file(test, duration, phase, target=DUT):
337
+ test.flush_all_mqtt_packets()
338
+ mqtt_scan_wait(test, duration=duration, target=target)
339
+ generate_log_file(test, phase, DUT)
340
+ generate_log_file(test, phase + "_tester", TESTER)
260
341
 
261
342
  # Get data/tags functions
262
- def get_all_data_pkts(mqttc):
343
+ def get_all_data_pkts(mqttc, indicator=None):
263
344
  data_pkts = []
345
+ gw_id = mqttc.update_topic.split("/")[-1]
264
346
  for p in mqttc._userdata[PKTS].data:
265
- gw_id = p.body_ex[GW_ID] if GW_ID in p.body_ex else ""
266
347
  if PACKETS in p.body_ex:
267
348
  for pkt in p.body_ex[PACKETS]:
349
+ if indicator and indicator not in pkt[PAYLOAD]: continue
268
350
  pkt[GW_ID] = gw_id
269
351
  data_pkts += [pkt]
270
352
  return data_pkts
271
353
 
272
- def get_all_sim_data_pkts(mqttc):
273
- data_pkts = []
354
+ def get_all_aggregated_data_pkts(mqttc, indicator =""):
355
+ aggregated_data_pkts = []
356
+ seen_aggregated_payloads = set()
357
+ gw_id = mqttc.update_topic.split("/")[-1]
274
358
  for p in mqttc._userdata[PKTS].data:
275
- gw_id = p.body_ex[GW_ID] if GW_ID in p.body_ex else ""
276
359
  if PACKETS in p.body_ex:
277
360
  for pkt in p.body_ex[PACKETS]:
278
- if PIXEL_SIM_INDICATOR in pkt[PAYLOAD]:
279
- pkt[GW_ID] = gw_id
280
- data_pkts += [pkt]
281
- return data_pkts
361
+ if indicator and indicator not in pkt[PAYLOAD]: continue
362
+ if AGGREGATED_PAYLOAD in pkt:
363
+ # Deduplicate based on AGGREGATED_PAYLOAD (since for each packet in the aggregated packet, we have another element with the same AGGREGATED_PAYLOAD)
364
+ aggregated_payload = pkt[AGGREGATED_PAYLOAD]
365
+ if aggregated_payload not in seen_aggregated_payloads:
366
+ seen_aggregated_payloads.add(aggregated_payload)
367
+ pkt[GW_ID] = gw_id
368
+ aggregated_data_pkts += [pkt]
369
+ return aggregated_data_pkts
370
+
371
+ def get_all_status_pkts(mqttc, status_type=None):
372
+ status_pkts = []
373
+ for p in mqttc._userdata[PKTS].status:
374
+ if status_type and status_type not in p.body: continue
375
+ status_pkts += [p.body]
376
+ return status_pkts
282
377
 
283
378
  def get_undecrypted_data_pkts_count(mqttc):
284
379
  undecrypted = 0
@@ -287,13 +382,30 @@ def get_undecrypted_data_pkts_count(mqttc):
287
382
  undecrypted += p.body_ex['undecrypted']
288
383
  return undecrypted
289
384
 
290
- def get_all_sensor_pkts(test, is_embedded=False):
291
- all_sensor_pkts = couple_sensor_data_si_coupling(test)
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)]
385
+ def get_embedded_sensor_pkts(sensor_pkts):
386
+ embedded_sensor_pkts = []
387
+ embedded_sensor_uuid_list = [ag.SENSOR_SERVICE_ID_BATTERY_SENSOR, ag.SENSOR_SERVICE_ID_LIS2DW12, ag.SENSOR_SERVICE_ID_POF_DATA]
388
+ for uuid in embedded_sensor_uuid_list:
389
+ for p in sensor_pkts:
390
+ _uuid = (f"{p[UNIFIED_SENSOR_PKT].pkt.sensor_ad_type:02X}"
391
+ f"{p[UNIFIED_SENSOR_PKT].pkt.sensor_uuid_msb:02X}"
392
+ f"{p[UNIFIED_SENSOR_PKT].pkt.sensor_uuid_lsb:02X}")
393
+ if UNIFIED_SENSOR_PKT in p and (f"{uuid:06X}" == f"{_uuid}"):
394
+ embedded_sensor_pkts += [p]
395
+ return embedded_sensor_pkts
396
+
397
+ def get_all_sensor_pkts(test, is_unified=False, remove_embedded=False, target=DUT):
398
+ all_pkts = get_all_data_pkts(test.get_mqttc_by_target(target))
399
+ all_unified_sensor_pkts = [p for p in all_pkts if UNIFIED_SENSOR_PKT in p and test.active_brg.id_alias == p[ALIAS_BRIDGE_ID]
400
+ and is_unified]
401
+ all_coupled_sensor_pkts = couple_sensor_data_si_coupling(test, all_pkts)
402
+ all_sensor_pkts = [p for p in all_coupled_sensor_pkts if test.active_brg.id_str == p[BRIDGE_ID]] + all_unified_sensor_pkts
403
+ if remove_embedded:
404
+ embedded_sensor_pkts = get_embedded_sensor_pkts(all_unified_sensor_pkts)
405
+ all_sensor_pkts = [p for p in all_sensor_pkts if p not in embedded_sensor_pkts]
293
406
  return all_sensor_pkts
294
407
 
295
- def couple_sensor_data_si_coupling(test):
296
- all_pkts = get_all_data_pkts(test.mqttc)
408
+ def couple_sensor_data_si_coupling(test, all_pkts):
297
409
  all_sensor_data_pkts = [p for p in all_pkts if SENSOR_PKT in p]
298
410
  all_sensor_side_info_pkts = [p for p in all_pkts if SIDE_INFO_SENSOR_PKT in p]
299
411
  # Couple data and side info
@@ -342,27 +454,29 @@ def count_pkt_id_duplications(test, all_sensor_data_pkts, all_sensor_side_info_p
342
454
  #TODO: logging print(debug)
343
455
  # test.reason = f'Warning: {coupled_pkt[PKT_ID_CTR]} sensor data and si with pkt id 0x{_pkt_id:08X}'
344
456
 
345
- def get_all_brg1_ext_sensor_pkts(test=None):
457
+ def get_all_brg1_ext_sensor_pkts(test=None, is_unified=False, target=DUT):
458
+ original_active_brg = test.active_brg
346
459
  test.active_brg = test.brg1
347
- pkts = get_all_sensor_pkts(test)
348
- test.active_brg = test.brg0
460
+ pkts = get_all_sensor_pkts(test, is_unified, target=target)
461
+ test.active_brg = original_active_brg
349
462
  return pkts
350
463
 
351
464
  def get_all_custom_pkts(test=None):
352
- return get_all_sensor_pkts(test, is_embedded=True)
465
+ return get_all_sensor_pkts(test, is_unified=True)
353
466
 
354
- def get_all_mgmt_pkts(mqttc):
355
- all_data_pkts = get_all_data_pkts(mqttc)
467
+ def get_all_mgmt_pkts(mqttc, indicator=""):
468
+ all_data_pkts = get_all_data_pkts(mqttc, indicator)
356
469
  return [p for p in all_data_pkts if MGMT_PKT in p]
357
470
 
358
- def get_brg2gw_mgmt_pkts(mqttc, test=None, mgmt_types=[]):
471
+ def get_brg2gw_mgmt_pkts(mqttc, brg, mgmt_types=[]):
359
472
  brg2gw_mgmt_pkts = [p for p in get_all_mgmt_pkts(mqttc) if ((p[MGMT_PKT].hdr.group_id == ag.GROUP_ID_BRG2GW) and
360
473
  (not mgmt_types or type(p[MGMT_PKT].pkt) in mgmt_types))]
361
- pkts = [p for p in brg2gw_mgmt_pkts if test.active_brg.id_str in p[PAYLOAD]]
474
+ pkts = [p for p in brg2gw_mgmt_pkts if brg.id_str in p[PAYLOAD]]
362
475
  return pkts
363
476
 
364
- def get_unified_data_pkts(test, only_active_brg=True):
365
- all_unified_pkts, pkts = [], get_all_sim_data_pkts(test.mqttc) if test.data == DATA_SIMULATION else get_all_data_pkts(test.mqttc)
477
+ def get_unified_data_pkts(test, only_active_brg=True, target=DUT, indicator=PIXEL_SIM_INDICATOR):
478
+ mqttc = test.get_mqttc_by_target(target)
479
+ all_unified_pkts, pkts = [], get_all_data_pkts(mqttc, indicator) if test.data == DATA_SIMULATION else get_all_data_pkts(mqttc)
366
480
  for p in pkts:
367
481
  if UNIFIED_PKT in p:
368
482
  all_unified_pkts += [p]
@@ -372,11 +486,12 @@ def get_unified_data_pkts(test, only_active_brg=True):
372
486
  print(f"\nCollected {len(pkts)} unified data pkts")
373
487
  return pkts
374
488
 
375
- def get_internal_brg_unified_data_pkts(test):
376
- all_unified_pkts, pkts = [], get_all_sim_data_pkts(test.mqttc) if test.data == DATA_SIMULATION else get_all_data_pkts(test.mqttc)
489
+ def get_internal_brg_unified_data_pkts(test, target=DUT):
490
+ mqttc = test.get_mqttc_by_target(target)
491
+ all_unified_pkts, pkts = [], get_all_data_pkts(mqttc, indicator=PIXEL_SIM_INDICATOR) if test.data == DATA_SIMULATION else get_all_data_pkts(mqttc)
377
492
  for p in pkts:
378
493
  if UNIFIED_PKT in p:
379
494
  all_unified_pkts += [p]
380
495
  pkts = [p for p in all_unified_pkts if p[ALIAS_BRIDGE_ID] == test.internal_id_alias()]
381
496
  print(f"\nCollected {len(pkts)} unified gw_tag_pkts")
382
- return pkts
497
+ return pkts
@@ -1,9 +1,7 @@
1
- from brg_certificate.cert_defines import *
1
+ from certificate.cert_defines import *
2
2
  import time, datetime
3
3
  import sys
4
4
  import json
5
- import brg_certificate.cert_mqtt as cert_mqtt
6
- import brg_certificate.cert_data_sim as cert_data_sim
7
5
  import os
8
6
  import re
9
7
 
@@ -20,6 +18,7 @@ COLORS = {
20
18
  }
21
19
  color = lambda c, t : COLORS["BOLD"]+COLORS[c]+t+COLORS["ENDC"]
22
20
  pipeline_running = lambda : True if 'BITBUCKET_BUILD_NUMBER' in os.environ else False
21
+ is_quiet_setup_running = lambda : True if 'CI_GW' in os.environ else False
23
22
  camelcase_to_title = lambda s: ' '.join(word.capitalize() for word in re.split('(?=[A-Z])', s))
24
23
  SEP = '\n' + '#'*100 + '\n'
25
24
  SEP2 = '\n' + '#'*100 + '\n' + '#'*100 + '\n'
@@ -33,7 +32,14 @@ WIL_CERT_TEXT = r'''
33
32
  '''
34
33
 
35
34
  hex_str2int = lambda s : int(s, 16)
36
- print_brg = lambda brg: brg.__dict__ if brg else None
35
+
36
+ def write_to_log_file(file, txt, mode):
37
+ file_path = os.path.join(ARTIFACTS_DIR, file)
38
+ if not os.path.exists(os.path.dirname(file_path)):
39
+ os.makedirs(os.path.dirname(file_path))
40
+ f = open(file_path, mode)
41
+ f.write(txt)
42
+ f.close()
37
43
 
38
44
  def print_pkt(p):
39
45
  print(datetime.datetime.now().strftime("%d/%m/%Y, %H:%M:%S"))
@@ -43,12 +49,16 @@ def print_warn(txt):
43
49
  if txt:
44
50
  utPrint(f"WARNING: {txt}","WARNING")
45
51
 
46
- def mqtt_scan_start(test, duration):
47
- utPrint("Scanning mqtt packets on {} for {} seconds...".format(test.gw, duration), "WARNING")
52
+ def mqtt_scan_start(test, duration, target=DUT):
53
+ gw = test.dut if target == DUT else test.tester
54
+ utPrint("Scanning mqtt packets on {} for {} seconds...".format(gw.id_str, duration), "WARNING")
48
55
  sys.stdout.flush()
49
56
 
50
- def mqtt_scan_wait(test, duration):
51
- utPrint("Scanning mqtt packets on {} for {} seconds...".format(test.gw, duration), "WARNING")
57
+
58
+ def mqtt_scan_wait(test, duration, target=DUT):
59
+ mqttc = test.get_mqttc_by_target(target)
60
+ gw = test.dut if target == DUT else test.tester
61
+ utPrint("Scanning mqtt packets on {} for {} seconds...".format(gw.id_str, duration), "WARNING")
52
62
  sys.stdout.flush()
53
63
  chars = ["|", "/", "-", "\\"]
54
64
  start_time = datetime.datetime.now()
@@ -60,22 +70,26 @@ def mqtt_scan_wait(test, duration):
60
70
  if pipeline_running():
61
71
  sys.stdout.write(".")
62
72
  else:
63
- sys.stdout.write("\r"+chars[i%4]*20+" "+str(cur_duration)+" "+chars[i%4]*20+" {} pkts captured".format(len(test.mqttc._userdata["pkts"].data)))
73
+ sys.stdout.write("\r"+chars[i%4]*20+" "+str(cur_duration)+" "+chars[i%4]*20+" {} pkts captured".format(len(mqttc._userdata[PKTS].data)))
64
74
  sys.stdout.flush()
65
75
  time.sleep(0.25)
66
76
  i += 1
67
77
  print("\n")
68
78
 
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
79
 
74
80
  def print_update_wait(secs=1):
75
81
  sys.stdout.write(".")
76
82
  sys.stdout.flush()
77
83
  time.sleep(secs)
78
84
 
85
+ def wait_time_n_print(secs, txt=""):
86
+ if txt:
87
+ utPrint(txt, "CYAN")
88
+ utPrint(f"Waiting for {secs} seconds", "CYAN")
89
+ while secs:
90
+ print_update_wait()
91
+ secs -= 1
92
+
79
93
  def field_functionality_pass_fail_print(test, field, value=""):
80
94
  print_string = f"{field}={value}"
81
95
  if value == "":
@@ -105,11 +119,11 @@ def test_run_print(test):
105
119
  test_json_print(test)
106
120
  utPrint("Test Configuration:", "HEADER")
107
121
  params = [{'name':p.name, 'value':p.value} for p in test.params]
108
- utPrint(f""" - internal_brg={test.internal_brg}\n - brg0={print_brg(test.brg0)}
109
- - brg1={print_brg(test.brg1)}\n - active_brg={print_brg(test.active_brg)}
122
+ utPrint(f""" - internal_brg={test.internal_brg}\n - tester={test.tester}
123
+ - dut={test.dut}\n - brg1={test.brg1}\n - active_brg={test.active_brg}
110
124
  - params={params}\n""")
111
- cert_mqtt.write_to_mqtt_log_file(log_txt)
112
- cert_data_sim.write_to_data_sim_log_file(log_txt)
125
+ write_to_log_file(DATA_SIM_LOG_FILE, log_txt, "a")
126
+ write_to_log_file(CERT_MQTT_LOG_FILE, log_txt, "a")
113
127
 
114
128
  def test_json_print(test):
115
129
  for key, value in test.test_json.items():
@@ -131,14 +145,14 @@ def test_epilog_print(test):
131
145
  def functionality_run_print(func):
132
146
  txt = "{0}==>> Running {1}\n".format(SEP, func)
133
147
  utPrint(txt, "CYAN")
134
- cert_mqtt.write_to_mqtt_log_file(txt)
135
- cert_data_sim.write_to_data_sim_log_file(txt)
148
+ write_to_log_file(DATA_SIM_LOG_FILE, txt, "a")
149
+ write_to_log_file(CERT_MQTT_LOG_FILE, txt, "a")
136
150
 
137
151
  def phase_run_print(func):
138
152
  txt = f"{SEP2}==>> Phase {func}{SEP2}\n"
139
153
  utPrint(txt, "CYAN")
140
- cert_mqtt.write_to_mqtt_log_file(txt)
141
- cert_data_sim.write_to_data_sim_log_file(txt)
154
+ write_to_log_file(DATA_SIM_LOG_FILE, txt, "a")
155
+ write_to_log_file(CERT_MQTT_LOG_FILE, txt, "a")
142
156
 
143
157
 
144
158
  def generate_print_string(fields_and_values):
@@ -147,18 +161,6 @@ def generate_print_string(fields_and_values):
147
161
  list_to_print.append(str(f) + "=" + str(fields_and_values[f]))
148
162
  return " & ".join(list_to_print)
149
163
 
150
- def generate_log_file(test, val):
151
- if type(val) == int or type(val) == str:
152
- log_string = str(val)
153
- else:
154
- log_string = str(val[0])
155
- for i in range(1,len(val)):
156
- log_string += ","+ str(val[i])
157
- if test.internal_brg:
158
- log_string += "_internal_brg"
159
-
160
- cert_mqtt.dump_pkts(test, log=log_string)
161
-
162
164
  ENERGY_GRAPH_HTML = """
163
165
  <h1 style="color:blue;text-align:center;">{}</h1>
164
166
  <div style="width:80%;margin:auto;"><canvas id="myChart"></canvas></div>
@@ -1,7 +1,7 @@
1
1
 
2
- from brg_certificate.cert_defines import *
2
+ from certificate.cert_defines import *
3
3
 
4
- import brg_certificate.wltPb_pb2 as wpb
4
+ import common.wltPb_pb2 as wpb
5
5
 
6
6
  def action_pb(msg: dict):
7
7
  pb_msg = wpb.DownlinkMessage()
@@ -15,6 +15,13 @@ def tx_pkt_pb(msg: dict):
15
15
  pb_msg.txPacket.maxRetries = int(msg[TX_MAX_RETRIES])
16
16
  return pb_msg.SerializeToString()
17
17
 
18
+ def gw_ota_pb(msg: dict):
19
+ pb_msg = wpb.DownlinkMessage()
20
+ pb_msg.gatewayUpgrade.imageDirUrl = msg[IMG_DIR_URL]
21
+ pb_msg.gatewayUpgrade.interfaceSwVersion = msg[WIFI_VERSION]
22
+ pb_msg.gatewayUpgrade.bleSwVersion = msg[BLE_VERSION]
23
+ return pb_msg.SerializeToString()
24
+
18
25
  def brg_ota_pb(msg: dict):
19
26
  pb_msg = wpb.DownlinkMessage()
20
27
  pb_msg.bridgeUpgrade.bridgeId = msg[BRIDGE_ID]
@@ -36,8 +43,8 @@ def gw_cfg_pb(msg: dict):
36
43
  pb_msg.gatewayConfig.bleSwVersion = msg[BLE_VERSION]
37
44
 
38
45
  for key, val in msg[ADDITIONAL].items():
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:
46
+ # Skip lat & lng to create duplicate values
47
+ if key == LAT or key == LNG:
41
48
  continue
42
49
  pb_value = wpb.GatewayConfigValue()
43
50
  if type(val) is int:
@@ -79,10 +86,12 @@ def custom_message_pb(msg: dict):
79
86
 
80
87
  def downlink_to_pb(msg: dict):
81
88
  if ACTION in msg.keys():
82
- if msg[ACTION] == 0:
89
+ if msg[ACTION] == ACTION_ADVERTISING:
83
90
  return tx_pkt_pb(msg)
84
- elif msg[ACTION] == 1:
91
+ elif msg[ACTION] == ACTION_BRG_OTA:
85
92
  return brg_ota_pb(msg)
93
+ elif msg[ACTION] == ACTION_GW_OTA:
94
+ return gw_ota_pb(msg)
86
95
  else:
87
96
  return action_pb(msg)
88
97
  elif GW_CONF in msg.keys():