wiliot-certificate 1.3.0a1__py3-none-any.whl → 1.4.0a2__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 (184) hide show
  1. brg_certificate/__init__.py +0 -0
  2. brg_certificate/ag/energous_v0_defines.py +925 -0
  3. brg_certificate/ag/energous_v1_defines.py +931 -0
  4. brg_certificate/ag/energous_v2_defines.py +925 -0
  5. brg_certificate/ag/energous_v3_defines.py +925 -0
  6. brg_certificate/ag/energous_v4_defines.py +925 -0
  7. brg_certificate/ag/fanstel_lan_v0_defines.py +925 -0
  8. brg_certificate/ag/fanstel_lte_v0_defines.py +925 -0
  9. brg_certificate/ag/fanstel_wifi_v0_defines.py +925 -0
  10. brg_certificate/ag/minew_lte_v0_defines.py +925 -0
  11. brg_certificate/ag/wlt_cmd_if.html +102 -0
  12. brg_certificate/ag/wlt_types.html +6114 -0
  13. brg_certificate/ag/wlt_types_ag.py +7840 -0
  14. brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +142 -0
  15. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +785 -0
  16. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +139 -0
  17. brg_certificate/ag/wlt_types_ag_jsons/calibration.json +394 -0
  18. brg_certificate/ag/wlt_types_ag_jsons/custom.json +515 -0
  19. brg_certificate/ag/wlt_types_ag_jsons/datapath.json +672 -0
  20. brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +550 -0
  21. brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +595 -0
  22. brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +598 -0
  23. brg_certificate/ag/wlt_types_ag_jsons/interface.json +938 -0
  24. brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +1234 -0
  25. brg_certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +105 -0
  26. brg_certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +77 -0
  27. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +61 -0
  28. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +110 -0
  29. brg_certificate/brg_certificate.py +191 -0
  30. brg_certificate/brg_certificate_cli.py +47 -0
  31. brg_certificate/cert_common.py +828 -0
  32. brg_certificate/cert_config.py +395 -0
  33. brg_certificate/cert_data_sim.py +188 -0
  34. brg_certificate/cert_defines.py +337 -0
  35. brg_certificate/cert_gw_sim.py +285 -0
  36. brg_certificate/cert_mqtt.py +373 -0
  37. brg_certificate/cert_prints.py +181 -0
  38. brg_certificate/cert_protobuf.py +88 -0
  39. brg_certificate/cert_results.py +300 -0
  40. brg_certificate/cert_utils.py +358 -0
  41. brg_certificate/certificate_sanity_test_list.txt +36 -0
  42. brg_certificate/certificate_test_list.txt +43 -0
  43. brg_certificate/config/eclipse.json +10 -0
  44. brg_certificate/config/hivemq.json +10 -0
  45. brg_certificate/config/mosquitto.json +10 -0
  46. brg_certificate/config/mosquitto.md +95 -0
  47. brg_certificate/config/wiliot-dev.json +10 -0
  48. brg_certificate/restore_brg.py +59 -0
  49. brg_certificate/tests/calibration/interval_test/interval_test.json +13 -0
  50. brg_certificate/tests/calibration/interval_test/interval_test.py +28 -0
  51. brg_certificate/tests/calibration/output_power_test/output_power_test.json +13 -0
  52. brg_certificate/tests/calibration/output_power_test/output_power_test.py +28 -0
  53. brg_certificate/tests/calibration/pattern_test/pattern_test.json +13 -0
  54. brg_certificate/tests/calibration/pattern_test/pattern_test.py +70 -0
  55. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.json +13 -0
  56. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +76 -0
  57. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +13 -0
  58. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +83 -0
  59. brg_certificate/tests/datapath/output_power_test/output_power_test.json +13 -0
  60. brg_certificate/tests/datapath/output_power_test/output_power_test.py +27 -0
  61. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +13 -0
  62. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +43 -0
  63. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +13 -0
  64. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +63 -0
  65. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +13 -0
  66. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +50 -0
  67. brg_certificate/tests/datapath/pattern_test/pattern_test.json +13 -0
  68. brg_certificate/tests/datapath/pattern_test/pattern_test.py +28 -0
  69. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +13 -0
  70. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +51 -0
  71. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +13 -0
  72. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +54 -0
  73. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +13 -0
  74. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +55 -0
  75. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +13 -0
  76. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +73 -0
  77. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +13 -0
  78. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +41 -0
  79. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +21 -0
  80. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +184 -0
  81. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +21 -0
  82. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +210 -0
  83. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +30 -0
  84. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +203 -0
  85. brg_certificate/tests/datapath/stress_test/stress_test.json +30 -0
  86. brg_certificate/tests/datapath/stress_test/stress_test.py +210 -0
  87. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +13 -0
  88. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +113 -0
  89. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +13 -0
  90. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +79 -0
  91. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +13 -0
  92. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +432 -0
  93. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +13 -0
  94. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +94 -0
  95. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +13 -0
  96. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +87 -0
  97. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +13 -0
  98. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +210 -0
  99. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +13 -0
  100. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +83 -0
  101. brg_certificate/tests/edge_mgmt/stat_test/stat_test.json +13 -0
  102. brg_certificate/tests/edge_mgmt/stat_test/stat_test.py +48 -0
  103. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +13 -0
  104. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +26 -0
  105. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +13 -0
  106. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +27 -0
  107. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +13 -0
  108. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +28 -0
  109. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +13 -0
  110. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +398 -0
  111. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +13 -0
  112. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +153 -0
  113. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +13 -0
  114. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +264 -0
  115. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +13 -0
  116. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +27 -0
  117. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +13 -0
  118. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +26 -0
  119. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +13 -0
  120. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +397 -0
  121. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +13 -0
  122. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +27 -0
  123. brg_certificate/wltPb_pb2.py +72 -0
  124. brg_certificate/wltPb_pb2.pyi +227 -0
  125. brg_certificate/wlt_types.py +114 -0
  126. gw_certificate/api/extended_api.py +7 -1531
  127. gw_certificate/api_if/200/data.json +106 -0
  128. gw_certificate/api_if/200/logs.json +12 -0
  129. gw_certificate/api_if/200/status.json +47 -0
  130. gw_certificate/api_if/201/data.json +98 -0
  131. gw_certificate/api_if/201/logs.json +12 -0
  132. gw_certificate/api_if/201/status.json +53 -0
  133. gw_certificate/api_if/202/data.json +83 -0
  134. gw_certificate/api_if/202/logs.json +12 -0
  135. gw_certificate/api_if/202/status.json +60 -0
  136. gw_certificate/api_if/203/data.json +85 -0
  137. gw_certificate/api_if/203/logs.json +12 -0
  138. gw_certificate/api_if/203/status.json +63 -0
  139. gw_certificate/api_if/204/data.json +85 -0
  140. gw_certificate/api_if/204/logs.json +12 -0
  141. gw_certificate/api_if/204/status.json +63 -0
  142. gw_certificate/api_if/205/data.json +85 -0
  143. gw_certificate/api_if/205/logs.json +12 -0
  144. gw_certificate/api_if/205/status.json +63 -0
  145. gw_certificate/api_if/api_validation.py +0 -2
  146. gw_certificate/common/analysis_data_bricks.py +18 -1413
  147. gw_certificate/common/debug.py +0 -21
  148. gw_certificate/common/utils.py +1 -212
  149. gw_certificate/common/utils_defines.py +0 -87
  150. gw_certificate/gw_certificate.py +9 -7
  151. gw_certificate/gw_certificate_cli.py +39 -23
  152. gw_certificate/interface/4.4.52_app.zip +0 -0
  153. gw_certificate/interface/4.4.52_sd_bl_app.zip +0 -0
  154. gw_certificate/interface/ble_simulator.py +0 -32
  155. gw_certificate/interface/if_defines.py +1 -0
  156. gw_certificate/interface/mqtt.py +96 -19
  157. gw_certificate/interface/nrfutil-linux +0 -0
  158. gw_certificate/interface/nrfutil-mac +0 -0
  159. gw_certificate/interface/nrfutil.exe +0 -0
  160. gw_certificate/interface/pkt_generator.py +0 -82
  161. gw_certificate/interface/uart_if.py +73 -43
  162. gw_certificate/templates/results.html +1 -1
  163. gw_certificate/tests/__init__.py +1 -2
  164. gw_certificate/tests/actions.py +134 -9
  165. gw_certificate/tests/connection.py +10 -5
  166. gw_certificate/tests/downlink.py +2 -4
  167. gw_certificate/tests/generic.py +62 -12
  168. gw_certificate/tests/registration.py +78 -27
  169. gw_certificate/tests/static/generated_packet_table.py +12 -48
  170. gw_certificate/tests/static/packet_table.csv +10048 -10048
  171. gw_certificate/tests/static/references.py +2 -1
  172. gw_certificate/tests/static/uplink_defines.py +0 -7
  173. gw_certificate/tests/throughput.py +7 -12
  174. gw_certificate/tests/uplink.py +83 -43
  175. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a2.dist-info}/METADATA +59 -8
  176. wiliot_certificate-1.4.0a2.dist-info/RECORD +198 -0
  177. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a2.dist-info}/WHEEL +1 -1
  178. wiliot_certificate-1.4.0a2.dist-info/entry_points.txt +3 -0
  179. wiliot_certificate-1.4.0a2.dist-info/top_level.txt +2 -0
  180. gw_certificate/interface/packet_error.py +0 -22
  181. wiliot_certificate-1.3.0a1.dist-info/RECORD +0 -51
  182. wiliot_certificate-1.3.0a1.dist-info/entry_points.txt +0 -2
  183. wiliot_certificate-1.3.0a1.dist-info/top_level.txt +0 -1
  184. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a2.dist-info}/LICENSE +0 -0
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "actions_test",
3
+ "module": "edge_mgmt",
4
+ "purpose": "Test bridge actions functionality",
5
+ "documentaion": "<TEST_DOCUMENTATION_LINK>",
6
+ "initialCondition": "Bridge configured to defaults",
7
+ "procedure": ["Test prolog", "Run all actions and test bridge's response accordingly", "Test epilog"],
8
+ "expectedOutcome": "Bridge responded as expected to all sent actions",
9
+ "mandatory": 1,
10
+ "multiBridgeTest": 0,
11
+ "gwOnlyTest": 0,
12
+ "allSupportedValues": ["ACTION_GW_HB", "ACTION_BLINK", "ACTION_SEND_HB", "ACTION_GET_BATTERY_SENSOR" , "ACTION_GET_POF_DATA", "ACTION_PL_STATUS", "ACTION_GET_MODULE", "ACTION_REBOOT", "ACTION_RESTORE_DEFAULTS"]
13
+ }
@@ -0,0 +1,432 @@
1
+ from brg_certificate.cert_prints import *
2
+ from brg_certificate.cert_defines import *
3
+ from brg_certificate.wlt_types import *
4
+ import brg_certificate.cert_common as cert_common
5
+ import brg_certificate.cert_config as cert_config
6
+ import random
7
+
8
+ WATERMARK = "watermark"
9
+ PACER_INC = "pacer_inc"
10
+ BATTERY_SENSOR_SUPPORTING_BOARD_TYPES = [ag.BOARD_TYPE_MINEW_DUAL_BAND_V0, ag.BOARD_TYPE_ERM_V0,
11
+ ag.BOARD_TYPE_ERM_V1, ag.BOARD_TYPE_KOAMTAC_V0]
12
+ POF_NOT_SUPPORTING_BOARD_TYPES = [ag.BOARD_TYPE_FANSTEL_WIFI_V0, ag.BOARD_TYPE_FANSTEL_LAN_V0]
13
+
14
+ # Non Default defines
15
+ BRG_NON_DEFAULT_DUTY_CYCLE = 15
16
+ BRG_NON_DEFAULT_OP_2_4 = 6
17
+ BRG_NON_DEFAULT_EP_2_4 = 1
18
+ BRG_NON_DEFAULT_SIGNAL_INDICATOR_CYCLE_2_4 = 100
19
+ BRG_NON_DEFAULT_SIGNAL_INDICATOR_REP_2_4 = 3
20
+ BRG_NON_DEFAULT_SIGNAL_INDICATOR_CYCLE_SUB1G = 100
21
+ BRG_NON_DEFAULT_SIGNAL_INDICATOR_REP_SUB1G = 3
22
+ BRG_NON_DEFAULT_OUTPUT_POWER_SUB1G = 26
23
+ BRG_NON_DEFAULT_PWR_MGMT_KEEP_ALIVE_SCAN = 0
24
+ BRG_NON_DEFAULT_TX_REPETITION = 2
25
+ BRG_NON_DEFAULT_PACER_INTERVAL = 20
26
+ BRG_NON_DEFAULT_RSSI_THRESHOLD = -80
27
+ BRG_NON_DEFAULT_CALIB_OUTPUT_POWER = 8
28
+ BRG_NON_DEFAULT_PKT_FILTER = 17
29
+ BRG_NON_DEFAULT_CALIB_PATTERN = 2
30
+ BRG_NON_DEFAULT_CALIB_INTERVAL = 15
31
+
32
+ LIS2DW12_NON_DEFAULT_STATE_THRESHOLD = 620
33
+ LIS2DW12_NON_DEFAULT_WAKE_UP_DURATION = 120
34
+ LIS2DW12_NON_DEFAULT_SLEEP_DURATION = 35
35
+
36
+
37
+ def get_brg_non_default_module_pkt(test, module):
38
+ if 'Energy2400' in module.__name__:
39
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}'),
40
+ duty_cycle=BRG_NON_DEFAULT_DUTY_CYCLE,
41
+ output_power=BRG_NON_DEFAULT_OP_2_4, pattern=BRG_NON_DEFAULT_EP_2_4,
42
+ signal_indicator_cycle=BRG_NON_DEFAULT_SIGNAL_INDICATOR_CYCLE_2_4,
43
+ signal_indicator_rep=BRG_NON_DEFAULT_SIGNAL_INDICATOR_REP_2_4)
44
+ elif 'EnergySub1G' in module.__name__:
45
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}'),
46
+ duty_cycle=BRG_NON_DEFAULT_DUTY_CYCLE,
47
+ signal_indicator_cycle=BRG_NON_DEFAULT_SIGNAL_INDICATOR_CYCLE_SUB1G,
48
+ signal_indicator_rep=BRG_NON_DEFAULT_SIGNAL_INDICATOR_REP_SUB1G)
49
+ elif 'PwrMgmt' in module.__name__:
50
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModulePwrMgmtV{test.active_brg.api_version}'),
51
+ dynamic_keep_alive_scan=BRG_NON_DEFAULT_PWR_MGMT_KEEP_ALIVE_SCAN)
52
+ elif 'Custom' in module.__name__:
53
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleCustomV{test.active_brg.api_version}'),
54
+ state_threshold=LIS2DW12_NON_DEFAULT_STATE_THRESHOLD,
55
+ wake_up_duration=LIS2DW12_NON_DEFAULT_WAKE_UP_DURATION,
56
+ sleep_duration=LIS2DW12_NON_DEFAULT_SLEEP_DURATION)
57
+ elif 'Datapath' in module.__name__:
58
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'),
59
+ tx_repetition=BRG_NON_DEFAULT_TX_REPETITION,
60
+ pkt_filter=BRG_NON_DEFAULT_PKT_FILTER,
61
+ output_power=BRG_NON_DEFAULT_OP_2_4,
62
+ pattern=ag.DATAPATH_PATTERN_EU_PATTERN,
63
+ pacer_interval=BRG_NON_DEFAULT_PACER_INTERVAL,
64
+ rssi_threshold=BRG_NON_DEFAULT_RSSI_THRESHOLD)
65
+ elif 'Calibration' in module.__name__:
66
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleCalibrationV{test.active_brg.api_version}'),
67
+ output_power=BRG_NON_DEFAULT_CALIB_OUTPUT_POWER,
68
+ interval=BRG_NON_DEFAULT_CALIB_INTERVAL,
69
+ pattern=BRG_NON_DEFAULT_CALIB_PATTERN)
70
+ elif 'ExtSensors' in module.__name__:
71
+ return cert_config.get_default_brg_pkt(test, pkt_type=eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}'),
72
+ sensor0=ag.EXTERNAL_SENSORS_MINEWS1,
73
+ sensor1=ag.EXTERNAL_SENSORS_VOLTAIC_BATT_LEVEL_DONGLE,
74
+ rssi_threshold=BRG_NON_DEFAULT_RSSI_THRESHOLD,
75
+ sub1g_rssi_threshold=BRG_NON_DEFAULT_RSSI_THRESHOLD)
76
+ return None
77
+
78
+
79
+ def brg_non_default_modules_cfg(test):
80
+ for module in test.active_brg.modules:
81
+ cfg_pkt = get_brg_non_default_module_pkt(test, module)
82
+ if cfg_pkt:
83
+ utPrint(f"Configuring {module.__name__} non-default cfg", "BLUE")
84
+ test = cert_config.brg_configure(test=test, cfg_pkt=cfg_pkt)[0]
85
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
86
+ test.add_reason(f"{module.__name__} non-default cfg pkt was not found after {DEFAULT_BRG_FIELD_UPDATE_TIMEOUT} sec!")
87
+ return test
88
+ return test
89
+
90
+
91
+ def search_action_ack(test, action_id, **kwargs):
92
+ test, mgmt_pkts = cert_common.scan_for_mgmt_pkts(test,
93
+ mgmt_type=[eval_pkt(f'{ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version}')])
94
+ if test.rc == TEST_FAILED:
95
+ return test
96
+ print("\nReceived ACK pkts:")
97
+ for p in mgmt_pkts:
98
+ print(p[MGMT_PKT].pkt)
99
+ pkt = cert_config.get_default_brg_pkt(test,
100
+ pkt_type=eval_pkt(f'{ag.ACTIONS_DICT[action_id]}{test.active_brg.api_version}'),
101
+ **kwargs).pkt
102
+ if p[MGMT_PKT].pkt == pkt:
103
+ utPrint("Received ACK for action", "GREEN")
104
+ return test
105
+ test.rc = TEST_FAILED
106
+ test.add_reason(f"Didn't find action ACK for action id {action_id} {ag.ACTIONS_DICT[action_id]}")
107
+ return test
108
+
109
+
110
+ # modules should receive a list of module names to look for - identical to their actual classes' names!
111
+ def scan_for_modules(test, modules=[]):
112
+ modules = test.active_brg.modules if not modules else modules
113
+ found = {module.__name__: False for module in modules}
114
+ start_time = datetime.datetime.now()
115
+
116
+ # Search for packets
117
+ while not all(found.values()):
118
+ for module in found:
119
+ pkts = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=[eval_pkt(module)])
120
+ if pkts and not found[module]:
121
+ found[module] = True
122
+ print("\nGot {} packet after {} sec!".format(module, (datetime.datetime.now() - start_time).seconds))
123
+ print(pkts[-1][MGMT_PKT].pkt)
124
+ print_update_wait()
125
+ if (datetime.datetime.now() - start_time).seconds > DEFAULT_BRG_FIELD_UPDATE_TIMEOUT:
126
+ test.rc = TEST_FAILED
127
+ err_print = ','.join([module for module, value in found.items() if not value])
128
+ test.add_reason("Didn't receive {} after {} seconds!".format(err_print, DEFAULT_BRG_FIELD_UPDATE_TIMEOUT))
129
+ break
130
+ return test
131
+
132
+ ########################################################
133
+ # ACTIONS
134
+ ########################################################
135
+
136
+
137
+ def test_action_gw_hb(test):
138
+ # Create randomized 13 bytes hex to send as the gw
139
+ randomized_gw = ''.join(f'{b:02X}' for b in bytes([random.randint(0, 255) for _ in range(13)]))
140
+ randomized_gw = hex_str2int(randomized_gw)
141
+ # send action
142
+ cert_config.send_brg_action(test, ag.ACTION_GW_HB, gw_id=randomized_gw)
143
+ # analysis
144
+ gw_hb_pkt = eval_pkt(f'ActionGwHbV{test.active_brg.api_version}')
145
+ test, mgmt_pkts = cert_common.scan_for_mgmt_pkts(test, [gw_hb_pkt])
146
+ if not mgmt_pkts:
147
+ test.add_reason("Didn't find ACTION GW HB ACK pkts")
148
+ test.rc = TEST_FAILED
149
+ else:
150
+ for p in mgmt_pkts:
151
+ if p[MGMT_PKT].pkt.rssi == 0 or randomized_gw != p[MGMT_PKT].pkt.gw_id:
152
+ print(f'''ERROR: PKT RSSI: {p[MGMT_PKT].pkt.rssi}\nGW_ID:{p[MGMT_PKT].pkt.gw_id}\n
153
+ randomized_gw: {randomized_gw}''')
154
+ test.add_reason("GW ID not found OR RSSI is zero on the ACTION GW HB ACK pkt")
155
+ test.rc = TEST_FAILED
156
+ return test
157
+
158
+
159
+ def test_action_blink(test):
160
+ # send action
161
+ cert_config.send_brg_action(test, ag.ACTION_BLINK)
162
+ # analysis
163
+ test = search_action_ack(test, ag.ACTION_BLINK)
164
+ return test
165
+
166
+
167
+ def test_action_send_hb(test):
168
+ datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
169
+ # config brg to get a non zero value in the tx_queue_watermark parameter
170
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL, BRG_TX_REPETITION], values=[1, 6], module=datapath_module)[0]
171
+ if test.rc == TEST_FAILED:
172
+ return cert_config.config_brg_defaults(test=test, modules=[datapath_module])[0]
173
+
174
+ if not test.internal_brg:
175
+ # sleep to let some pkts wait in queue
176
+ wait = 10
177
+ print(f"waiting for {wait} secs to fill up the brg queue")
178
+ cert_common.wait_time_n_print(wait)
179
+ # send action
180
+ cert_config.send_brg_action(test, ag.ACTION_SEND_HB)
181
+ # analysis
182
+ test, mgmt_pkts = cert_common.scan_for_mgmt_pkts(test, [eval_pkt(f'Brg2GwHbV{test.active_brg.api_version}')])
183
+ if not mgmt_pkts:
184
+ test.add_reason("Didn't find ACTION HB pkt")
185
+ test.rc = TEST_FAILED
186
+ else:
187
+ for p in mgmt_pkts:
188
+ found = {WATERMARK: False, PACER_INC: False}
189
+ # effective_pacer_increment should be 0 when the default value for adaptice_pacer is set (OFF)
190
+ if not p[MGMT_PKT].pkt.effective_pacer_increment:
191
+ found[PACER_INC] = True
192
+ # Skip check for internal brg
193
+ if test.internal_brg:
194
+ found[WATERMARK] = True
195
+ break
196
+ # tx_queue_watermark should not be 0 when brg queue is under stress
197
+ elif p[MGMT_PKT].pkt.tx_queue_watermark:
198
+ found[WATERMARK] = True
199
+ break
200
+ if not found[WATERMARK]:
201
+ test.rc = TEST_FAILED
202
+ test.add_reason(f"tx_queue_watermark ({p[MGMT_PKT].pkt.tx_queue_watermark}) at the BRG HB pkt is zero")
203
+ if not found[PACER_INC]:
204
+ test.rc = TEST_FAILED
205
+ test.add_reason(f"effective_pacer_increment ({p[MGMT_PKT].pkt.effective_pacer_increment}) at the BRG HB pkt is not zero")
206
+ test = cert_config.config_brg_defaults(test=test, modules=[datapath_module])[0]
207
+ # queue can be full so need to wait a few seconds
208
+ if not test.internal_brg:
209
+ cert_common.wait_time_n_print(5)
210
+ return test
211
+
212
+
213
+ def test_action_get_battery_sensor(test):
214
+ if test.active_brg.board_type not in BATTERY_SENSOR_SUPPORTING_BOARD_TYPES:
215
+ test.rc = TEST_SKIPPED
216
+ return test
217
+ # prolog
218
+ functionality_run_print('ACTION_GET_BATTERY_SENSOR')
219
+ # send action
220
+ cert_config.send_brg_action(test, ag.ACTION_GET_BATTERY_SENSOR)
221
+ # analysis
222
+ test = search_action_ack(test, ag.ACTION_GET_BATTERY_SENSOR)
223
+ if test.rc == TEST_FAILED:
224
+ return test
225
+
226
+ start_time = datetime.datetime.now()
227
+ # This timeout is due to queueing si pkt with needed info at the back of the queue
228
+ scan_time = ACTION_SI_PKT_TIMEOUT
229
+ found_packet = False
230
+ while ((datetime.datetime.now() - start_time).seconds <= scan_time):
231
+ custom_pkts = cert_mqtt.get_all_custom_pkts(test.mqttc, test)
232
+ for p in custom_pkts:
233
+ if p[SENSOR_UUID] == f"{ag.SENSOR_SERVICE_ID_BATTERY_SENSOR:06X}":
234
+ print_pkt(p)
235
+ found_packet = True
236
+ break
237
+ if found_packet is True:
238
+ break
239
+ print_update_wait()
240
+ if found_packet is False:
241
+ test.rc = TEST_FAILED
242
+ test.add_reason(f"Didn't find battery sensor data packet within {scan_time} seconds")
243
+ return test
244
+
245
+
246
+ def test_action_get_pof_data(test):
247
+ if test.active_brg.board_type in POF_NOT_SUPPORTING_BOARD_TYPES:
248
+ test.rc = TEST_SKIPPED
249
+ return test
250
+ # send action
251
+ cert_config.send_brg_action(test, ag.ACTION_GET_POF_DATA)
252
+ # analysis
253
+ test = search_action_ack(test, ag.ACTION_GET_POF_DATA)
254
+ if test.rc == TEST_FAILED:
255
+ return test
256
+
257
+ start_time = datetime.datetime.now()
258
+ # This timeout is due to queueing si pkt with needed info at the back of the queue
259
+ scan_time = ACTION_SI_PKT_TIMEOUT
260
+ found_packet = False
261
+ while ((datetime.datetime.now() - start_time).seconds <= scan_time):
262
+ custom_pkts = cert_mqtt.get_all_custom_pkts(test.mqttc, test)
263
+ for p in custom_pkts:
264
+ if p[SENSOR_UUID] == f"{ag.SENSOR_SERVICE_ID_POF_DATA:06X}":
265
+ print_pkt(p)
266
+ found_packet = True
267
+ break
268
+ if found_packet is True:
269
+ break
270
+ print_update_wait()
271
+ if found_packet is False:
272
+ test.rc = TEST_FAILED
273
+ test.add_reason(f"Didn't find pof data packet within {scan_time} seconds")
274
+ return test
275
+
276
+
277
+ def test_action_pl_status(test):
278
+ # send action - Set status to 0 only, if pl is set to 1 BRG works differently
279
+ cert_config.send_brg_action(test, ag.ACTION_PL_STATUS, status=0)
280
+ # analysis
281
+ test = search_action_ack(test, ag.ACTION_PL_STATUS, status=0)
282
+ return test
283
+
284
+
285
+ def test_action_get_module(test):
286
+ # CHECK ONLY FOR ONE MODULE (ModuleDatapath) #
287
+ # send action
288
+ print("\nCHECK ONLY FOR ModuleDatapath\n")
289
+ cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, datapath=1)
290
+ # analysis
291
+ test = search_action_ack(test, ag.ACTION_GET_MODULE, datapath=1)
292
+ test = scan_for_modules(test, [eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')])
293
+ if test.rc == TEST_FAILED:
294
+ return test
295
+
296
+ # CHECK FOR ALL MODULES AT ONCE #
297
+ # send action
298
+ print("\nCHECK FOR ALL MODULES AT ONCE\n")
299
+ cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, interface=1, datapath=1, energy2400=1,
300
+ energy_sub1g=1, calibration=1, pwr_mgmt=1, ext_sensors=1, custom=1)
301
+ # analysis
302
+ test = search_action_ack(test, ag.ACTION_GET_MODULE, interface=1, datapath=1, energy2400=1,
303
+ energy_sub1g=1, calibration=1, pwr_mgmt=1, ext_sensors=1, custom=1)
304
+ test = scan_for_modules(test)
305
+ return test
306
+
307
+
308
+ def test_action_reboot(test):
309
+ # non-default cfg
310
+ test = brg_non_default_modules_cfg(test)
311
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
312
+ return cert_common.test_epilog(test, revert_brgs=True)
313
+ # sample non-default cfg_hash
314
+ test, non_default_hash = cert_common.get_cfg_hash(test)
315
+ if test.active_brg.cfg_hash == non_default_hash:
316
+ test.rc = TEST_FAILED
317
+ test.add_reason(f"Config failed default_hash==non_default==0x{non_default_hash:08X}")
318
+ if test.rc == TEST_FAILED:
319
+ return test
320
+ print(f"\nnon_default_hash: 0x{non_default_hash:08X}\n")
321
+ # send action
322
+ cert_config.send_brg_action(test, ag.ACTION_REBOOT)
323
+ # analysis
324
+ test = cert_common.reboot_config_analysis(test, expected_hash=non_default_hash, timeout=40)
325
+ # epilog
326
+ test = cert_config.config_brg_defaults(test)[0]
327
+ return test
328
+
329
+
330
+ def test_action_restore_defaults(test):
331
+ # non-default cfg
332
+ test = brg_non_default_modules_cfg(test)
333
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
334
+ return cert_common.test_epilog(test, revert_brgs=True)
335
+ # sample non-default cfg_hash
336
+ test, non_default_hash = cert_common.get_cfg_hash(test)
337
+ if test.rc == TEST_FAILED:
338
+ # revert to defaults without restore_defaults action if action failed
339
+ test = cert_config.config_brg_defaults(test)[0]
340
+ return test
341
+ # send action
342
+ cert_config.send_brg_action(test, ag.ACTION_RESTORE_DEFAULTS)
343
+ # analysis
344
+ expected_hash = test.active_brg.cfg_hash
345
+ utPrint("Analyzing Restore Defaults", "BLUE")
346
+ # First 30 for wlt app start + 10 sec extra for brg to settle to recieve its get module action
347
+ cert_common.wait_time_n_print(40)
348
+
349
+ start_time = datetime.datetime.now()
350
+ seq_ids = []
351
+ cfg_once = True
352
+ test.mqttc.flush_pkts()
353
+
354
+ utPrint(f"Get Interface Module from BRG {test.active_brg.id_str}")
355
+ cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, interface=1)
356
+ test = search_action_ack(test, ag.ACTION_GET_MODULE, interface=1)
357
+ if test.rc == TEST_FAILED:
358
+ return test
359
+
360
+ while True:
361
+ # scan for ModuleIf pkt of all api versions to support api version change on update
362
+ pkts = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=[eval_pkt(f'ModuleIfV{test.active_brg.api_version}')])
363
+ for p in pkts:
364
+ if (not seq_ids or p[SEQUENCE_ID] not in seq_ids):
365
+ seq_ids.append(p[SEQUENCE_ID])
366
+ interface = p[MGMT_PKT].pkt
367
+ if interface:
368
+ test.active_brg.api_version = interface.api_version
369
+ print(f"\nGot pkt after {(datetime.datetime.now() - start_time).seconds} sec!")
370
+ print(interface)
371
+ received_hash = interface.cfg_hash
372
+ print(f"\nexpected cfg_hash: 0x{expected_hash:08X}\n"
373
+ f"received cfg_hash: 0x{received_hash:08X}\n"
374
+ f"non_default_hash: 0x{non_default_hash:08X}")
375
+ if received_hash == non_default_hash:
376
+ # test.rc = TEST_FAILED
377
+ test.add_reason("received_hash is equal to non_default_hash, ACTION_RESTORE_DEFAULTS was not received by the brg!")
378
+ # return test
379
+ elif received_hash == expected_hash:
380
+ return test
381
+ else:
382
+ # Default SUB1G EP in the BRG is 0 and in the UT is 9
383
+ # in order to allign BRG cfg to the one after ut.py start script
384
+ # we should configure sub1g ep individually once after reboot in case cfg hash dont match
385
+ if ag.MODULE_ENERGY_SUB1G in test.active_brg.sup_caps and cfg_once:
386
+ cfg_once = False
387
+ cfg_pkt = cert_config.get_default_brg_pkt(test,
388
+ eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}'),
389
+ **{BRG_PATTERN: ag.SUB1G_ENERGY_PATTERN_ISRAEL})
390
+ test = cert_config.brg_configure(test, cfg_pkt=cfg_pkt)[0]
391
+ if test.rc == TEST_FAILED:
392
+ return test
393
+ cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, interface=1)
394
+ print_update_wait()
395
+
396
+ if (datetime.datetime.now() - start_time).seconds > DEFAULT_BRG_FIELD_UPDATE_TIMEOUT:
397
+ test.rc = TEST_FAILED
398
+ test.add_reason(f"Didn't receive expected ModuleIfV{test.active_brg.api_version} pkt "
399
+ f"after {DEFAULT_BRG_FIELD_UPDATE_TIMEOUT} seconds!")
400
+ # revert to defaults without restore_defaults action if action failed
401
+ test = cert_config.config_brg_defaults(test)[0]
402
+ break
403
+ return test
404
+
405
+
406
+ ACTIONS_TEST_MAP = {ag.ACTION_GW_HB: test_action_gw_hb, ag.ACTION_BLINK: test_action_blink,
407
+ ag.ACTION_SEND_HB: test_action_send_hb, ag.ACTION_GET_BATTERY_SENSOR: test_action_get_battery_sensor,
408
+ ag.ACTION_GET_POF_DATA: test_action_get_pof_data, ag.ACTION_PL_STATUS: test_action_pl_status,
409
+ ag.ACTION_GET_MODULE: test_action_get_module, ag.ACTION_REBOOT: test_action_reboot,
410
+ ag.ACTION_RESTORE_DEFAULTS: test_action_restore_defaults}
411
+
412
+
413
+ def run(test):
414
+ test = cert_common.test_prolog(test)
415
+ if test.rc == TEST_FAILED or test.reason != TEST_SUCCESS:
416
+ return cert_common.test_epilog(test)
417
+
418
+ for param in test.params:
419
+ # Run action
420
+ functionality_run_print(param.name)
421
+ test = ACTIONS_TEST_MAP[param.value](test)
422
+ # action Epilog
423
+ generate_log_file(test, param.name)
424
+ field_functionality_pass_fail_print(test, param.name)
425
+ test.set_phase_rc(param.name, test.rc)
426
+ test.add_phase_reason(param.name, test.reason)
427
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
428
+ break
429
+ else:
430
+ test.reset_result()
431
+
432
+ return cert_common.test_epilog(test)
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "brg2brg_ota_test",
3
+ "module": "edge_mgmt",
4
+ "purpose": "TODO",
5
+ "documentaion": "<TEST_DOCUMENTATION_LINK>",
6
+ "initialCondition": "TODO",
7
+ "procedure": ["Test prolog", "TODO", "Test epilog"],
8
+ "expectedOutcome": "TODO",
9
+ "mandatory": 0,
10
+ "multiBridgeTest": 0,
11
+ "gwOnlyTest": 0,
12
+ "allSupportedValues": ["BOOTLOADER", "APP"]
13
+ }
@@ -0,0 +1,94 @@
1
+ from brg_certificate.cert_prints import *
2
+ from brg_certificate.cert_defines import *
3
+ from brg_certificate.wlt_types import *
4
+ import brg_certificate.cert_common as cert_common
5
+ import brg_certificate.cert_config as cert_config
6
+
7
+ # Test Description:
8
+ # Requires 1 GW and 2 BRGs where the BRGs aren't of the same FW version.
9
+ # Initiates BRG2BRG OTA - have the bridge with the newer FW version (source) update the bridge with the older
10
+ # FW version (destination). Source bridge will get a gw2brg message initiating the ota process from the firmware
11
+ # code, making the source bridge copy its image to the destination bridge.
12
+ # For a bootloader image OTA, the gw2brg message includes a "bootloader" field and it is updated to True if the OTA
13
+ # required is for bootloader image. The FW and bootloader images can currently only be updated separately.
14
+
15
+ # Test Defines
16
+ VERSIONS_SAME = "Both bridges FW versions are the same!"
17
+ BL_VERSIONS_SAME = "Both bridges Bootloader versions are the same!"
18
+ BOARDS_MISMATCH = "Bridges are of different board types!"
19
+
20
+
21
+ def run(test):
22
+
23
+ # Test initialization
24
+ is_bl_ota = "BOOTLOADER" in test.params[0].name
25
+
26
+ test = cert_common.test_prolog(test)
27
+ # Initialize bridges
28
+ brg0 = test.brg0
29
+ brg1 = test.brg1
30
+
31
+ # Protections from same version & different board types
32
+ if not is_bl_ota and brg0.version == brg1.version:
33
+ utPrint(VERSIONS_SAME, "RED")
34
+ test.add_reason(VERSIONS_SAME)
35
+ test.rc = TEST_FAILED
36
+ if is_bl_ota and brg0.bl_version == brg1.bl_version:
37
+ utPrint(BL_VERSIONS_SAME, "RED")
38
+ test.add_reason(BL_VERSIONS_SAME)
39
+ test.rc = TEST_FAILED
40
+ if brg0.board_type != brg1.board_type:
41
+ utPrint(BOARDS_MISMATCH, "RED")
42
+ test.add_reason(BOARDS_MISMATCH)
43
+ test.rc = TEST_FAILED
44
+
45
+ if test.rc == TEST_FAILED or test.reason != TEST_SUCCESS:
46
+ return cert_common.test_epilog(test, revert_brgs=True)
47
+
48
+ # Decide on source and destination bridges
49
+ if is_bl_ota:
50
+ if brg0.bl_version > brg1.bl_version:
51
+ src_brg = brg0
52
+ dest_brg = brg1
53
+ else:
54
+ src_brg = brg1
55
+ dest_brg = brg0
56
+ else:
57
+ if brg0.version > brg1.version:
58
+ src_brg = brg0
59
+ dest_brg = brg1
60
+ else:
61
+ src_brg = brg1
62
+ dest_brg = brg0
63
+
64
+ # BLE5 test - configure the destination brg to rx channel 10
65
+ utPrint(f"Configuring destination BRG {dest_brg.id_str} to RX Channel 10!")
66
+ test.active_brg = dest_brg
67
+ test = cert_config.brg_configure_ble5(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K],
68
+ module=eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))[0]
69
+ test.active_brg = src_brg
70
+ time.sleep(5)
71
+
72
+ desired_version_print = src_brg.bl_version if is_bl_ota else src_brg.version
73
+ older_version_print = dest_brg.bl_version if is_bl_ota else dest_brg.version
74
+ utPrint(f"Source {"bootloader" if is_bl_ota else ""} bridge version: {desired_version_print}. "
75
+ f"Destination bridge {"bootloader" if is_bl_ota else ""} version: {older_version_print}", "BLUE")
76
+
77
+ # Send BRG2BRG_OTA message to source bridge
78
+ functionality_run_print(f"BRG2BRG OTA - Source Bridge MAC: {src_brg.id_str}, Destination Bridge MAC: {dest_brg.id_str}")
79
+ brg2brg_ota_pkt = eval_pkt(f'Brg2BrgOtaV{test.active_brg.api_version}')(src_brg_mac=src_brg.id_int,
80
+ dest_brg_mac=dest_brg.id_int,
81
+ seq_id=test.get_seq_id(),
82
+ bootloader=is_bl_ota)
83
+ brg2brg_ota_pkt_downlink = WltPkt(hdr=ag.Hdr(group_id=ag.GROUP_ID_GW2BRG), pkt=brg2brg_ota_pkt)
84
+ # BRG OTA - Flush pkts ONLY before starting to avoid deletion of needed GW Logs
85
+ test.mqttc.flush_pkts()
86
+ cert_config.gw_downlink(test, raw_tx_data=brg2brg_ota_pkt_downlink.dump())
87
+
88
+ # Get version of the destination bridge
89
+ test.active_brg = dest_brg
90
+ # expected_hash=1 due to different cfgs and versions between builds
91
+ test = cert_common.reboot_config_analysis(test=test, expected_hash=1, ble_version=src_brg.version if not is_bl_ota else None,
92
+ bl_version=src_brg.bl_version if is_bl_ota else None, timeout=VER_UPDATE_TIMEOUT)
93
+
94
+ return cert_common.test_epilog(test)
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "brg2brg_ota_test",
3
+ "module": "edge_mgmt",
4
+ "purpose": "TODO",
5
+ "documentaion": "<TEST_DOCUMENTATION_LINK>",
6
+ "initialCondition": "TODO",
7
+ "procedure": ["Test prolog", "TODO", "Test epilog"],
8
+ "expectedOutcome": "TODO",
9
+ "mandatory": 0,
10
+ "multiBridgeTest": 0,
11
+ "gwOnlyTest": 0,
12
+ "allSupportedValues": ["BOOTLOADER", "APP"]
13
+ }
@@ -0,0 +1,87 @@
1
+ from brg_certificate.cert_prints import *
2
+ from brg_certificate.cert_defines import *
3
+ from brg_certificate.wlt_types import *
4
+ import brg_certificate.cert_common as cert_common
5
+ import brg_certificate.cert_config as cert_config
6
+
7
+ # Test Description:
8
+ # Requires 1 GW and 2 BRGs where the BRGs aren't of the same FW version.
9
+ # Initiates BRG2BRG OTA - have the bridge with the newer FW version (source) update the bridge with the older
10
+ # FW version (destination). Source bridge will get a gw2brg message initiating the ota process from the firmware
11
+ # code, making the source bridge copy its image to the destination bridge.
12
+ # For a bootloader image OTA, the gw2brg message includes a "bootloader" field and it is updated to True if the OTA
13
+ # required is for bootloader image. The FW and bootloader images can currently only be updated separately.
14
+
15
+ # Test Defines
16
+ VERSIONS_SAME = "Both bridges FW versions are the same!"
17
+ BL_VERSIONS_SAME = "Both bridges Bootloader versions are the same!"
18
+ BOARDS_MISMATCH = "Bridges are of different board types!"
19
+
20
+
21
+ def run(test):
22
+
23
+ # Test initialization
24
+ is_bl_ota = "BOOTLOADER" in test.params[0].name
25
+
26
+ test = cert_common.test_prolog(test)
27
+ # Initialize bridges
28
+ brg0 = test.brg0
29
+ brg1 = test.brg1
30
+
31
+ # Protections from same version & different board types
32
+ if not is_bl_ota and brg0.version == brg1.version:
33
+ utPrint(VERSIONS_SAME, "RED")
34
+ test.add_reason(VERSIONS_SAME)
35
+ test.rc = TEST_FAILED
36
+ if is_bl_ota and brg0.bl_version == brg1.bl_version:
37
+ utPrint(BL_VERSIONS_SAME, "RED")
38
+ test.add_reason(BL_VERSIONS_SAME)
39
+ test.rc = TEST_FAILED
40
+ if brg0.board_type != brg1.board_type:
41
+ utPrint(BOARDS_MISMATCH, "RED")
42
+ test.add_reason(BOARDS_MISMATCH)
43
+ test.rc = TEST_FAILED
44
+
45
+ if test.rc == TEST_FAILED or test.reason != TEST_SUCCESS:
46
+ return cert_common.test_epilog(test, revert_brgs=True)
47
+
48
+ # Decide on source and destination bridges
49
+ if is_bl_ota:
50
+ if brg0.bl_version > brg1.bl_version:
51
+ src_brg = brg0
52
+ dest_brg = brg1
53
+ else:
54
+ src_brg = brg1
55
+ dest_brg = brg0
56
+ else:
57
+ if brg0.version > brg1.version:
58
+ src_brg = brg0
59
+ dest_brg = brg1
60
+ else:
61
+ src_brg = brg1
62
+ dest_brg = brg0
63
+ test.active_brg = src_brg
64
+
65
+ desired_version_print = src_brg.bl_version if is_bl_ota else src_brg.version
66
+ older_version_print = dest_brg.bl_version if is_bl_ota else dest_brg.version
67
+ utPrint(f"Source {"bootloader" if is_bl_ota else ""} bridge version: {desired_version_print}. "
68
+ f"Destination bridge {"bootloader" if is_bl_ota else ""} version: {older_version_print}", "BLUE")
69
+
70
+ # Send BRG2BRG_OTA message to source bridge
71
+ functionality_run_print(f"BRG2BRG OTA - Source Bridge MAC: {src_brg.id_str}, Destination Bridge MAC: {dest_brg.id_str}")
72
+ brg2brg_ota_pkt = eval_pkt(f'Brg2BrgOtaV{test.active_brg.api_version}')(src_brg_mac=src_brg.id_int,
73
+ dest_brg_mac=dest_brg.id_int,
74
+ seq_id=test.get_seq_id(),
75
+ bootloader=is_bl_ota)
76
+ brg2brg_ota_pkt_downlink = WltPkt(hdr=ag.Hdr(group_id=ag.GROUP_ID_GW2BRG), pkt=brg2brg_ota_pkt)
77
+ # BRG OTA - Flush pkts ONLY before starting to avoid deletion of needed GW Logs
78
+ test.mqttc.flush_pkts()
79
+ cert_config.gw_downlink(test, raw_tx_data=brg2brg_ota_pkt_downlink.dump())
80
+
81
+ # Get version of the destination bridge
82
+ test.active_brg = dest_brg
83
+ # expected_hash=1 due to different cfgs and versions between builds
84
+ test = cert_common.reboot_config_analysis(test=test, expected_hash=1, ble_version=src_brg.version if not is_bl_ota else None,
85
+ bl_version=src_brg.bl_version if is_bl_ota else None, timeout=VER_UPDATE_TIMEOUT)
86
+
87
+ return cert_common.test_epilog(test)
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "leds_test",
3
+ "module": "edge_mgmt",
4
+ "purpose": "TODO",
5
+ "documentaion": "<TEST_DOCUMENTATION_LINK>",
6
+ "initialCondition": "TODO",
7
+ "procedure": ["Test prolog", "TODO", "Test epilog"],
8
+ "expectedOutcome": "TODO",
9
+ "mandatory": 0,
10
+ "multiBridgeTest": 0,
11
+ "gwOnlyTest": 0,
12
+ "allSupportedValues": []
13
+ }