wiliot-certificate 1.5.1a1__py3-none-any.whl → 1.5.3a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. brg_certificate/ag/energous_v0_defines.py +3 -3
  2. brg_certificate/ag/energous_v1_defines.py +3 -3
  3. brg_certificate/ag/energous_v2_defines.py +3 -3
  4. brg_certificate/ag/energous_v3_defines.py +3 -3
  5. brg_certificate/ag/energous_v4_defines.py +3 -3
  6. brg_certificate/ag/fanstel_lan_v0_defines.py +3 -3
  7. brg_certificate/ag/fanstel_lte_v0_defines.py +3 -3
  8. brg_certificate/ag/fanstel_wifi_v0_defines.py +3 -3
  9. brg_certificate/ag/minew_lte_v0_defines.py +3 -3
  10. brg_certificate/ag/wlt_cmd_if.html +3 -2
  11. brg_certificate/ag/wlt_types.html +3 -3
  12. brg_certificate/ag/wlt_types_ag.py +8 -8
  13. brg_certificate/brg_certificate_cli.py +18 -3
  14. brg_certificate/cert_common.py +134 -28
  15. brg_certificate/cert_config.py +12 -7
  16. brg_certificate/cert_data_sim.py +22 -4
  17. brg_certificate/cert_defines.py +10 -5
  18. brg_certificate/cert_gw_sim.py +4 -2
  19. brg_certificate/cert_mqtt.py +7 -6
  20. brg_certificate/cert_prints.py +14 -1
  21. brg_certificate/cert_protobuf.py +7 -7
  22. brg_certificate/cert_results.py +91 -64
  23. brg_certificate/cert_utils.py +12 -5
  24. brg_certificate/certificate_bcc_sanity_test_list.txt +10 -5
  25. brg_certificate/certificate_bcc_test_list.txt +16 -11
  26. brg_certificate/certificate_sanity_test_list.txt +10 -4
  27. brg_certificate/certificate_test_list.txt +14 -10
  28. brg_certificate/tests/calibration/interval_test/interval_test.json +2 -2
  29. brg_certificate/tests/calibration/interval_test/interval_test.py +1 -1
  30. brg_certificate/tests/calibration/output_power_test/output_power_test.json +3 -2
  31. brg_certificate/tests/calibration/output_power_test/output_power_test.py +1 -1
  32. brg_certificate/tests/calibration/pattern_test/pattern_test.json +2 -2
  33. brg_certificate/tests/calibration/pattern_test/pattern_test.py +27 -28
  34. brg_certificate/tests/datapath/aging_test/aging_test.json +4 -5
  35. brg_certificate/tests/datapath/aging_test/aging_test.py +40 -33
  36. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +2 -2
  37. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +13 -12
  38. brg_certificate/tests/datapath/output_power_test/output_power_test.json +2 -2
  39. brg_certificate/tests/datapath/output_power_test/output_power_test.py +3 -2
  40. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +3 -3
  41. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +7 -4
  42. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +2 -2
  43. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +7 -4
  44. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +2 -2
  45. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +5 -3
  46. brg_certificate/tests/datapath/pattern_test/pattern_test.json +2 -2
  47. brg_certificate/tests/datapath/pattern_test/pattern_test.py +3 -2
  48. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +3 -3
  49. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +12 -5
  50. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +2 -2
  51. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +12 -7
  52. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +2 -2
  53. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +12 -8
  54. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +3 -3
  55. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +8 -6
  56. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +2 -2
  57. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +7 -3
  58. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +3 -3
  59. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +108 -74
  60. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +3 -3
  61. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +129 -119
  62. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +8 -8
  63. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +103 -102
  64. brg_certificate/tests/datapath/stress_test/stress_test.json +14 -15
  65. brg_certificate/tests/datapath/stress_test/stress_test.py +103 -102
  66. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +2 -2
  67. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +8 -3
  68. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +2 -2
  69. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +9 -7
  70. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +2 -2
  71. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +11 -27
  72. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +14 -8
  73. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
  74. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +13 -8
  75. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +2 -2
  76. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +24 -11
  77. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +2 -2
  78. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +6 -5
  79. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.json → periodic_msgs_test/periodic_msgs_test.json} +3 -3
  80. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.py → periodic_msgs_test/periodic_msgs_test.py} +4 -4
  81. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +3 -3
  82. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +3 -2
  83. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +4 -3
  84. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +3 -2
  85. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +3 -3
  86. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +3 -2
  87. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +7 -7
  88. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +270 -295
  89. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +7 -7
  90. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +270 -295
  91. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +12 -6
  92. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +45 -57
  93. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +4 -4
  94. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +130 -207
  95. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +2 -2
  96. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +3 -2
  97. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +4 -3
  98. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +3 -2
  99. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +13 -7
  100. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +119 -126
  101. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +2 -2
  102. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +3 -2
  103. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +18 -0
  104. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +84 -0
  105. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +21 -0
  106. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +306 -0
  107. brg_certificate/wlt_types.py +2 -1
  108. gw_certificate/api_if/gw_capabilities.py +37 -1
  109. gw_certificate/common/serialization_formatter.py +80 -0
  110. gw_certificate/common/wltPb_pb2.py +50 -38
  111. gw_certificate/common/wltPb_pb2.pyi +40 -34
  112. gw_certificate/gw_certificate.py +4 -2
  113. gw_certificate/gw_certificate_cli.py +5 -4
  114. gw_certificate/interface/4.4.82_app.zip +0 -0
  115. gw_certificate/interface/{4.4.52_sd_bl_app.zip → 4.4.82_sd_bl_app.zip} +0 -0
  116. gw_certificate/interface/mqtt.py +39 -23
  117. gw_certificate/interface/pkt_generator.py +0 -44
  118. gw_certificate/interface/uart_if.py +20 -9
  119. gw_certificate/tests/actions.py +33 -5
  120. gw_certificate/tests/connection.py +3 -1
  121. gw_certificate/tests/generic.py +1 -1
  122. gw_certificate/tests/registration.py +4 -4
  123. gw_certificate/tests/static/generated_packet_table.py +47 -25
  124. gw_certificate/tests/static/packet_table.csv +10067 -10051
  125. gw_certificate/tests/static/uplink_defines.py +1 -0
  126. gw_certificate/tests/uplink.py +142 -22
  127. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/METADATA +40 -40
  128. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/RECORD +132 -127
  129. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/WHEEL +1 -1
  130. gw_certificate/interface/4.4.52_app.zip +0 -0
  131. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/entry_points.txt +0 -0
  132. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/licenses/LICENSE +0 -0
  133. {wiliot_certificate-1.5.1a1.dist-info → wiliot_certificate-1.5.3a1.dist-info}/top_level.txt +0 -0
@@ -3,336 +3,278 @@ from brg_certificate.cert_defines import *
3
3
  from brg_certificate.wlt_types import *
4
4
  import brg_certificate.cert_common as cert_common
5
5
  import brg_certificate.cert_config as cert_config
6
- import random
7
6
 
8
7
  # Test Description:
9
- # This test is to verify the functionality of both signal indicator tx (tx_brg) and rx (rx_brg) at BRG level.
10
- # rssi_threshold = phase 0 , check the if rssi value is between 0 to -25.
11
- # brg0_rx_brg1_tx = phase 1+2
12
- # phase 1 - One BRG will be configured as signal indicator tx, and the other as signal indicator rx, and we expect to see signal indicator packets only from the rx BRG according to the tx params (repetition and cycle params).
13
- # phase 2 - Same as phase 1, but with different tx params configured.
14
- # brg0_none_brg1_rx = phase 3 - One rx BRG without any tx BRG. We don't expect to see any signal indicator packets. This phase is to verify the brg module logic is working properly, and no tag packet is accidentally being treated as signal indicator packet.
15
- # brg0_rxtx_brg1_rxtx = phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect
16
- # to see signal indicator packets from both BRG's, according to the tx params.
17
- # brg0_tx_brg1_none = phase 5 - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicatopr packets.
18
- # that way we can assure the logic within the receiver is not confused by the signal indicator uuid as external sensor.
8
+ # This test is to verify the functionality of both signal indicator tx (tx_brg) and rx (rx_brg) at BRG level.
9
+ # We will configure several signal indicator params during the test, and check the functionality of the signal indicator logic
10
+ # for each of them.
11
+ # It is important to execute the test with several setups: 2 Fanstel BRG's, 2 Minew BRG's and 1 Fanstel and 1 Minew BRG.
12
+ # At first, we will configure several tx signal indicator params and check for ack's, to verify all indicated params were
13
+ # received at the cloud.
14
+ # Then, we will examine the signal indicator end-2-end logic with both transmitter and receiver:
15
+ # phase 1 - One BRG will be configured as signal indicator tx, and the other as signal indicator rx, and we expect to see
16
+ # signal indicator packets only from the tx BRG, and according to the tx params (to check the repetition and cycle params).
17
+ # phase 2 - Same as phase 1, but with different tx params configured.
18
+ # phase 3 - One rx BRG without any tx BRG. We don't expect to see any signal indicator packets. This phase is to verify the
19
+ # brg module logic is working properly, and no tag packet is accidentally being treated as signal indicator packet.
20
+ # phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect
21
+ # to see signal indicator packets from both BRG's, according to the tx params.
22
+ # phase 5 - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicatopr packets.
23
+ # that way we can assure the logic within the receiver is not confused by the signal indicator uuid as external sensor.
24
+
19
25
 
20
26
  # Test MACROS #
21
- DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
22
- NUM_OF_SCANNING_tx_signal_ind_cycle = 2
23
- DEFAULT_SCAN_TIME = 60
24
- SCAN_DELAY_TIME = 5
25
- BOARD_TYPES_2_POLARIZATION_ANT_LIST = [ag.BOARD_TYPE_MINEW_SINGLE_BAND_V0, ag.BOARD_TYPE_MINEW_DUAL_BAND_V0, ag.BOARD_TYPE_ENERGOUS_V2, ag.BOARD_TYPE_ERM_V0, ag.BOARD_TYPE_ERM_V1]
26
- BLE4_LISTEN_PERIOD = 15
27
- BLE4_BROADCAST_DURATION = BLE4_LISTEN_PERIOD + 1
28
-
29
- # Test functions #
30
- def mqtt_scan_n_create_log_file(test, duration, phase):
31
- test.mqttc.flush_pkts()
32
- mqtt_scan_wait(test, duration=duration)
33
- generate_log_file(test, f"{phase}")
34
-
35
- def get_all_signal_ind_pkt(test=None, rx_brg=None, tx_brg=None):
36
- if rx_brg == test.brg1:
37
- all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(mqttc=test.mqttc, test=test)
38
- elif rx_brg == test.brg0:
39
- all_sensor_packets = cert_mqtt.get_all_sensor_pkts(mqttc=test.mqttc, test=test)
40
- signal_ind_pkts = []
41
- for p in all_sensor_packets:
42
- if p[SENSOR_UUID] == "{:06X}".format(ag.SENSOR_SERVICE_ID_SIGNAL_INDICATOR) and p[BRIDGE_ID] == rx_brg.id_str and (p[SENSOR_ID] == tx_brg.id_alias or hex_str2int(p[SENSOR_ID]) == tx_brg.id_str):
43
- signal_ind_pkts.append(p)
44
- return signal_ind_pkts
45
-
46
- def expected_signal_ind_pkts_calc(tx_brg, rx_brg):
47
- if (tx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
48
- tx_brg_ant_polarization_num = 2
49
- else:
50
- tx_brg_ant_polarization_num = 1
51
- if (rx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
52
- rx_brg_ant_polarization_num = 2
53
- result = [(NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num) - 1,
54
- NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num]
55
- else:
56
- rx_brg_ant_polarization_num = 1
57
- result = [NUM_OF_SCANNING_tx_signal_ind_cycle * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num]
58
- return result
59
-
60
- def terminate_test(test, phase, revert_rx_brg=False, revert_tx_brg=False, modules=[]):
61
- # Temp solution for internal_brg test because test_epilog doesn't support both internal brg and test.brgs
62
- utPrint(f"Terminating test (phase={phase})!!!!!!!!\n", "BLUE")
63
- if revert_rx_brg:
64
- restore_modules = [modules[1]] if (test.internal_brg or phase != 4) else modules
65
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
66
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
67
- test, response = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)
68
- if response == NO_RESPONSE and test.exit_on_param_failure:
69
- test.rc = TEST_FAILED
70
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert modules "
71
- f"{restore_modules} to default configuration!")
72
-
73
- if revert_tx_brg:
74
- restore_modules = [modules[0]] if (test.internal_brg or phase != 4) else modules
75
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
76
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
77
- test, response = cert_config.config_brg_defaults(test, modules=restore_modules, ble5=True)
78
- if response == NO_RESPONSE and test.exit_on_param_failure:
79
- test.rc = TEST_FAILED
80
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert modules"
81
- f"{restore_modules} to default configuration!")
82
- return cert_common.test_epilog(test)
83
-
84
- def brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
85
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
86
-
87
- # Phase 5 - Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
88
- # The receiver isn't receiving any signal indicator packets.
89
- phase = "brg0_tx_brg1_none"
90
- tx_signal_ind_cycle = 15
91
- tx_signal_ind_rep = 1
92
- utPrint(f"TX BRG without RX - cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
93
- # restore default configuration for receiver #
94
- utPrint(f"Configuring BRG {rx_brg_.id_str} to default", "BOLD")
95
- restore_modules = [modules[1]] if (test.internal_brg) else modules
96
- test = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)[0]
97
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
98
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
99
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't revert to default configuration!")
27
+ NUM_OF_SCANNING_CYCLE = 5
28
+ DEFAULT_SCAN_TIME = 30
29
+ SCAN_DELAY_TIME = 3
30
+ BLE4_BROADCAST_DURATION = ag.BLE5_PARAM_PRIMARY_CHANNEL_SCAN_CYCLE // 1000 + 1
31
+
100
32
 
33
+ def test_rssi_threshold(test):
34
+ cycle, rep = 5, 4
35
+ rx_brg_ = test.brg1 # when internal_brg test this is the internal_brg
36
+ tx_brg_ = test.brg0
37
+ rssi_threshold = -25
38
+
39
+ utPrint(f"TX BRG with RX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
40
+ # configuring receiver #
41
+ utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
42
+ is_ble5 = not test.internal_brg
43
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD],
44
+ values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR, rssi_threshold], ble5=is_ble5, wait=True)[0]
45
+ if test.rc == TEST_FAILED:
46
+ test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
47
+ return test
101
48
  # configuring transmitter #
102
49
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
103
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep], ble5=True)[0]
50
+ wait = not test.internal_brg
51
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
52
+ values=[cycle, rep], ble5=True, wait=wait)[0]
104
53
  if test.rc == TEST_FAILED:
105
54
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
106
-
107
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
108
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
109
- f"repetition = {tx_signal_ind_rep}", "BOLD")
110
-
55
+ return test
56
+ utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {cycle},"
57
+ f"repetition = {rep}", "BOLD")
111
58
  # phase analysis #
112
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle*tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
113
- expected_signal_ind_pkts = [0]
114
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
115
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
59
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
60
+ mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE * cycle) + SCAN_DELAY_TIME, "rssi_threshold")
61
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
62
+ for p in received_signal_ind_pkts:
63
+ print(f"rssi value: {p[RSSI]}")
64
+ rssi_threshold_viloation_pkts = [p for p in received_signal_ind_pkts if p[RSSI] >= -1 * rssi_threshold]
65
+ if rssi_threshold_viloation_pkts:
116
66
  test.rc = TEST_FAILED
117
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG {rx_brg_.id_str}")
67
+ test.add_reason(f"rssi_threshold phase failed - BRG {rx_brg_.id_str} echoed"
68
+ f" {len(rssi_threshold_viloation_pkts)} signal indicator packets\n with RSSI weaker than {rssi_threshold}")
69
+ return test
118
70
 
119
- # Revert bridges to BLE4 before next loop
120
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
121
- test, response = cert_config.config_brg1_defaults(test, modules=[datapath_module], ble5=True)
122
- if response == NO_RESPONSE and test.exit_on_param_failure:
123
- test.rc = TEST_FAILED
124
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert datapath_module to default configuration!")
125
71
 
126
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
127
- test, response = cert_config.config_brg_defaults(test, modules=[datapath_module], ble5=True)
128
- if response == NO_RESPONSE and test.exit_on_param_failure:
129
- test.rc = TEST_FAILED
130
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert datapath module to default configuration!")
131
-
132
- # Test epilog
133
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
134
-
135
- def brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
136
- phase = "brg0_rxtx_brg1_rxtx"
137
-
138
- if not test.internal_brg:
139
- # Phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one.
140
- # expecting to see signal indicator packets from both BRG's, according to the tx params.
141
- utPrint(f"Both BRG's are transmitter and receivers, with different values\n", "BLUE")
142
-
143
- # configuring first BRG (tx_brg_) #
144
- tx_brg_signal_indicator_cycle = 15
145
- tx_brg_signal_indicator_rep = 3
146
- # configuring first brg (tx_brg_) as receiver
147
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
148
- cert_config.brg_configure_ble5(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], wait=False)
149
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
150
- utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
151
-
152
- # configuring transmitter #
153
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
154
- test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_brg_signal_indicator_cycle, tx_brg_signal_indicator_rep])[0]
155
- if test.rc == TEST_FAILED:
156
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
157
-
158
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
159
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_brg_signal_indicator_cycle},"
160
- f"repetition = {tx_brg_signal_indicator_rep}", "BOLD")
161
-
162
- # configuring second brg (rx_brg_) as receiver
163
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
164
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
165
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
166
- utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
167
-
168
- # configuring second brg (rx_brg_) as transmitter
169
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
170
- rx_brg_signal_indicator_cycle = 15
171
- rx_brg_signal_indicator_rep = 4
172
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[rx_brg_signal_indicator_cycle, rx_brg_signal_indicator_rep], ble5=True)[0]
173
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
174
- if test.rc == TEST_FAILED:
175
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
176
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {rx_brg_signal_indicator_cycle},"
177
- f"repetition = {rx_brg_signal_indicator_rep}")
178
-
179
- # phase analysis #
180
- mqtt_scan_n_create_log_file(test, NUM_OF_SCANNING_tx_signal_ind_cycle * max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) + SCAN_DELAY_TIME, phase)
181
-
182
- # Analyzing tx_brg_ performance as receiver
183
- utPrint(f"Analyzing tx_brg {tx_brg_.id_str} performance as a Receiver\n", "BOLD")
184
- rx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / rx_brg_signal_indicator_cycle
185
- expected_signal_ind_pkts = [int(x * rx_brg_tx_cycles) for x in expected_signal_ind_pkts_calc(rx_brg_, tx_brg_)]
186
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=tx_brg_, tx_brg=rx_brg_)
187
- txt = f"""Phase {phase} - BRG {tx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
188
- print(txt)
189
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
190
- test.rc = TEST_FAILED
191
- test.add_reason(txt)
192
-
193
- # Analyzing rx_brg_ performance as receiver
194
- utPrint(f"Analyzing rx_brg {rx_brg_.id_str} performance as a Receiver\n", "BOLD")
195
- tx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / tx_brg_signal_indicator_cycle
196
- expected_signal_ind_pkts = [int(x * tx_brg_tx_cycles) for x in expected_signal_ind_pkts_calc(rx_brg_, tx_brg_)]
197
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
198
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
199
- print(txt)
200
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
201
- test.rc = TEST_FAILED
202
- test.add_reason(txt)
203
- else:
204
- test.add_reason("skip for internal BRG")
205
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
206
-
207
- def brg0_none_brg1_rx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
208
- phase = "brg0_none_brg1_rx"
209
- # Phase 3 - Rx BRG without tx.Expecting no signal indicator packets to be received.
210
- tx_signal_ind_cycle = ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE
211
- tx_signal_ind_rep = ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP
212
- utPrint(f"RX BRG without TX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
213
-
72
+ def test_brg0_tx_brg1_rx(test):
73
+
74
+ tx_brg_ = test.brg0
75
+ rx_brg_ = test.brg1 # when internal_brg test this is the internal_brg
76
+ cycle, rep = 8, 4
77
+
78
+ utPrint(f"TX BRG with RX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
79
+ # configuring receiver #
80
+ utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
81
+ is_ble5 = not test.internal_brg
82
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
83
+ values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=is_ble5, wait=True)[0]
84
+ if test.rc == TEST_FAILED:
85
+ test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
86
+ return test
214
87
  # configuring transmitter #
88
+ wait = not test.internal_brg
215
89
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
216
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
217
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
90
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400,
91
+ fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
92
+ values=[cycle, rep], ble5=True, wait=wait)[0]
93
+ if test.rc == TEST_FAILED:
94
+ test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
95
+ return test
96
+ utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {cycle},"
97
+ f"repetition = {rep}", "BOLD")
98
+ # phase analysis #
99
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
100
+ mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE * cycle) + SCAN_DELAY_TIME, f"brg0_rx_brg1_tx_{cycle}_{rep}")
101
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
102
+
103
+ if cert_common.sig_ind_pkts_fail_analysis(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE, received_signal_ind_pkts):
104
+ test.rc = TEST_FAILED
105
+ expected_signal_ind_pkts = cert_common.exp_sig_ind_pkts2(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE)
106
+ test.add_reason(f"brg0_rx_brg1_tx phase failed - BRG {rx_brg_.id_str} received wrong number of "
107
+ f"signal indicator packets\nreceived {len(received_signal_ind_pkts)} packets, "
108
+ f"expected {expected_signal_ind_pkts} packets")
109
+ print(received_signal_ind_pkts) # TODO: logging print(debug)
110
+ print([[p[TIMESTAMP], p[SENSOR_PKT].pkt.rx_antenna] for p in received_signal_ind_pkts])
111
+
112
+ test = cert_common.rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE)
113
+ test = cert_common.output_power_check(test, received_signal_ind_pkts, tx_brg_)
114
+ test = cert_common.rssi_check(test, received_signal_ind_pkts)
115
+
116
+ return test
117
+
118
+
119
+ def test_brg0_none_brg1_rx(test):
120
+ cycle, rep = ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP
121
+ tx_brg_ = test.brg0
122
+ rx_brg_ = test.brg1 # when internal_brg test this is the internal_brg
123
+ utPrint(f"RX BRG without TX- cycle = {cycle}, repetition = {rep}\n", "BLUE")
124
+ # configuring receiver #
125
+ utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
126
+ is_ble5 = not test.internal_brg
127
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
128
+ values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=is_ble5, wait=True)[0]
218
129
  if test.rc == TEST_FAILED:
219
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
220
- utPrint(f"BRG {tx_brg_.id_str} configured to default!!! cycle = {tx_signal_ind_cycle},"f"repetition = {tx_signal_ind_rep}", "BOLD")
221
-
130
+ test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
131
+ return test
132
+ utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
133
+
222
134
  # phase analysis #
223
- mqtt_scan_n_create_log_file(test, DEFAULT_SCAN_TIME, phase)
135
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
136
+ mqtt_scan_n_create_log_file(test, DEFAULT_SCAN_TIME, "brg0_none_brg1_rx")
224
137
  expected_signal_ind_pkts = [0]
225
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
138
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
226
139
  if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
227
140
  test.rc = TEST_FAILED
228
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG"
229
- f"{rx_brg_.id_str}")
230
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
231
-
232
- def brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
233
- phase = "brg0_rx_brg1_tx"
234
- cycle_rep = [(30,3), (60,4)]
235
- for tx_signal_ind_cycle, tx_signal_ind_rep in cycle_rep:
236
-
237
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
238
- # configuring receiver #
239
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
240
- test = cert_config.brg_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep])[0]
241
- if test.rc == TEST_FAILED:
242
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
141
+ test.add_reason(f"brg0_rx_brg1_tx phase failed - BRG {rx_brg_.id_str} received wrong number of "
142
+ f"signal indicator packets\n received {len(received_signal_ind_pkts)} packets, "
143
+ f"expected {expected_signal_ind_pkts} packets")
243
144
 
244
- # configuring transmitter #
245
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
246
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
247
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
248
- if test.rc == TEST_FAILED:
249
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
250
-
251
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"f"repetition = {tx_signal_ind_rep}", "BOLD")
252
-
253
- # phase analysis
254
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
255
- expected_signal_ind_pkts = expected_signal_ind_pkts_calc(tx_brg_, rx_brg_)
256
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
257
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
258
- print(txt)
259
- #TODO: change condition
260
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
261
- test.rc = TEST_FAILED
262
- test.add_reason(txt)
263
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
264
-
265
- def rssi_threshold(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
266
- phase = "rssi_threshold"
267
- # RSSI Threshold
268
- rssi_threshold = -25
269
- tx_signal_ind_cycle = 15
270
- tx_signal_ind_rep = 3
271
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
272
-
273
- # configuring receiver #
274
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
275
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR, rssi_threshold], ble5=True)[0]
276
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
145
+ return test
277
146
 
147
+
148
+ def test_brg0_rxtx_brg1_rxtx(test):
149
+
150
+ if test.internal_brg:
151
+ # Can't scan on ble5 with internal brg because config won't be received
152
+ test.add_reason("skip for internal BRG")
153
+ test.rc = TEST_SKIPPED
154
+ return test
155
+
156
+ tx_cycle, tx_rep = 5, 4
157
+ rx_cycle, rx_rep = 5, 4
158
+ tx_brg_ = test.brg0
159
+ rx_brg_ = test.brg1
160
+ utPrint("Both BRG's are transmitter and receivers, with different values\n", "BLUE")
161
+ # configuring first brg (tx_brg_) as receiver
162
+ utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
163
+ test = cert_config.brg_configure(test=test, module=tx_brg_.sensors, fields=[BRG_SENSOR0],
164
+ values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
278
165
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
279
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
280
-
281
- # configuring transmitter #
166
+ test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
167
+ return test
168
+ utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
169
+ # configuring first brg (tx_brg_) as transmitter
282
170
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
283
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP], values=[tx_signal_ind_cycle, tx_signal_ind_rep],ble5=True)[0]
284
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
285
- if test.rc == TEST_FAILED:
171
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
172
+ values=[tx_cycle, tx_rep], ble5=True)[0]
173
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
286
174
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
175
+ return test
176
+ utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle={tx_cycle}, repetition={tx_rep}", "BOLD")
177
+
178
+ # configuring second brg (rx_brg_) as receiver
179
+ utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
180
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.sensors, fields=[BRG_SENSOR0],
181
+ values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
182
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
183
+ test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
184
+ return test
185
+ utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
186
+
187
+ # configuring second brg (rx_brg_) as transmitter (already configured as rx)
188
+ utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
189
+ test = cert_config.brg1_configure(test=test, module=rx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
190
+ values=[rx_cycle, rx_rep], ble5=True)[0]
191
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
192
+ test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
193
+ return test
194
+ utPrint(f"BRG {rx_brg_.id_str} configured to be transmitter - cycle={rx_cycle}, repetition={rx_rep}")
287
195
 
288
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
289
- f"repetition = {tx_signal_ind_rep}", "BOLD")
290
196
  # phase analysis #
291
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_tx_signal_ind_cycle * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
292
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
293
- rssi_threshold_viloation_pkts = [p for p in received_signal_ind_pkts if p[RSSI] >= -1*rssi_threshold]
294
- if rssi_threshold_viloation_pkts:
197
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
198
+ mqtt_scan_n_create_log_file(test, NUM_OF_SCANNING_CYCLE * max(tx_cycle, rx_cycle) + SCAN_DELAY_TIME, "brg0_rxtx_brg1_rxtx")
199
+
200
+ # Analyzing tx_brg_ performance as receiver
201
+ utPrint(f"Analyzing tx_brg {tx_brg_.id_str} performance as a Receiver\n", "BOLD")
202
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=tx_brg_, tx_brg=rx_brg_)
203
+ if cert_common.sig_ind_pkts_fail_analysis(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE, received_signal_ind_pkts):
204
+ test.rc = TEST_FAILED
205
+ expected_signal_ind_pkts = cert_common.exp_sig_ind_pkts2(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE)
206
+ test.add_reason(f"brg0_rxtx_brg1_rxtx phase failed - BRG {tx_brg_.id_str} received wrong number of "
207
+ f"signal indicator packets\nreceived {len(received_signal_ind_pkts)} packets, "
208
+ f"expected {expected_signal_ind_pkts} packets")
209
+ print(received_signal_ind_pkts) # TODO: logging print(debug)
210
+
211
+ # Analyzing rx_brg_ performance as receiver
212
+ utPrint(f"Analyzing rx_brg {rx_brg_.id_str} performance as a Receiver\n", "BOLD")
213
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
214
+ if cert_common.sig_ind_pkts_fail_analysis(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE, received_signal_ind_pkts):
295
215
  test.rc = TEST_FAILED
296
- test.add_reason(f"rssi_threshold phase failed - BRG {rx_brg_.id_str} echoed" +
297
- f" {len(rssi_threshold_viloation_pkts)} signal indicator packets\n with RSSI weaker than {rssi_threshold}")
298
- field_functionality_pass_fail_print(test, 'phase', phase)
299
-
300
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
216
+ expected_signal_ind_pkts = cert_common.exp_sig_ind_pkts2(tx_brg_, rx_brg_, NUM_OF_SCANNING_CYCLE)
217
+ test.add_reason(f"brg0_rxtx_brg1_rxtx phase failed - BRG {rx_brg_.id_str} received wrong number of "
218
+ f"signal indicator packets\n received {len(received_signal_ind_pkts)} packets, "
219
+ f"expected {expected_signal_ind_pkts} packets")
220
+ print(received_signal_ind_pkts) # TODO: logging print(debug)
221
+ # NOTE: We skipped the antenna and output power checks for this phase
222
+ return test
301
223
 
302
224
 
303
- SIGNAL_INDICATOR_TEST_MAP = {
304
- "rssi_threshold" : rssi_threshold, # phase 0
305
- "brg0_rx_brg1_tx": brg0_rx_brg1_tx, # phase 1 + 2
306
- "brg0_none_brg1_rx": brg0_none_brg1_rx, # phase 3
307
- "brg0_rxtx_brg1_rxtx": brg0_rxtx_brg1_rxtx, # phase 4, skip for internal brg
308
- "brg0_tx_brg1_none": brg0_tx_brg1_none} # phase 5
225
+ def test_brg0_tx_brg1_none(test):
226
+ # Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
227
+ # The receiver isn't receiving any signal indicator packets.
228
+ cycle, rep = 4, 3
229
+ tx_brg_ = test.brg0
230
+ rx_brg_ = test.brg1 # when internal_brg test this is the internal_brg
231
+ utPrint(f"TX BRG without RX - cycle = {cycle}, repetition = {rep}\n", "BLUE")
232
+ # configuring transmitter #
233
+ utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
234
+ wait = not test.internal_brg
235
+ test = cert_config.brg_configure(test=test, module=tx_brg_.energy2400, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
236
+ values=[cycle, rep], ble5=True, wait=wait)[0]
237
+ if test.rc == TEST_FAILED:
238
+ test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
239
+ return test
309
240
 
310
- def run(test):
241
+ # phase analysis #
242
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
243
+ mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE * cycle) + SCAN_DELAY_TIME, "brg0_tx_brg1_none")
244
+ expected_signal_ind_pkts = [0]
245
+ received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
246
+ if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
247
+ test.rc = TEST_FAILED
248
+ test.add_reason(f"brg0_tx_brg1_none phase failed - received signal indicator packet from BRG"
249
+ f"{rx_brg_.id_str}")
250
+ test = cert_common.output_power_check(test, received_signal_ind_pkts, tx_brg_)
311
251
 
312
- # Test modules evaluation #
313
- energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
314
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
315
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
252
+ return test
316
253
 
317
- # Transmitter related defines #
318
- tx_brg_ = test.brg0
319
- tx_module = energy2400_module
320
254
 
321
- # Receiver related defines #
322
- rx_brg_ = test.brg1
255
+ SIGNAL_INDICATOR_TEST_MAP = {"rssi_threshold": test_rssi_threshold, "brg0_tx_brg1_rx": test_brg0_tx_brg1_rx,
256
+ "brg0_none_brg1_rx": test_brg0_none_brg1_rx, "brg0_rxtx_brg1_rxtx": test_brg0_rxtx_brg1_rxtx,
257
+ "brg0_tx_brg1_none": test_brg0_tx_brg1_none}
323
258
 
324
- # Modules list #
325
- modules = [tx_module, ext_sensors_module]
326
259
 
260
+ def run(test):
327
261
  # Test prolog
328
262
  test = cert_common.test_prolog(test)
329
- test = cert_config.brg_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K], module=datapath_module)[0]
330
- test = cert_config.brg1_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K], module=datapath_module)[0]
331
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
332
- return terminate_test(test, phase=1, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
333
- for param in test.params:
334
- functionality_run_print(param.name)
335
- test = SIGNAL_INDICATOR_TEST_MAP[param.value](test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules)
263
+
264
+ # Configure to scan ble5 channel during all the test
265
+ test = cert_config.brg_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K],
266
+ module=test.brg0.datapath, ble5=True)[0]
267
+ if test.rc == TEST_FAILED:
268
+ return cert_common.test_epilog(test, revert_brgs=True, modules=[test.brg0.datapath], ble5=True)
269
+ test = cert_config.brg1_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_250K], module=test.brg1.datapath)[0]
270
+ if test.rc == TEST_FAILED:
271
+ is_ble5 = not test.internal_brg
272
+ return cert_common.test_epilog(test, revert_brgs=True, modules=[test.brg0.datapath],
273
+ brg1_modules=[test.brg1.datapath], ble5=is_ble5)
274
+
275
+ for param in test.params:
276
+ phase_run_print(param.name)
277
+ test = SIGNAL_INDICATOR_TEST_MAP[param.value](test)
336
278
  generate_log_file(test, param.name)
337
279
  field_functionality_pass_fail_print(test, param.name)
338
280
  test.set_phase_rc(param.name, test.rc)
@@ -341,6 +283,39 @@ def run(test):
341
283
  break
342
284
  else:
343
285
  test.reset_result()
344
-
345
- return cert_common.test_epilog(test, revert_brgs=True, modules=[energy2400_module, ext_sensors_module],
346
- brg1_modules=[energy2400_module, ext_sensors_module])
286
+
287
+ # Reset to defaults after every phase (don't fail the phase on that)
288
+ test = cert_config.config_brg_defaults(test, modules=[test.brg0.energy2400, test.brg0.sensors], ble5=True, wait=False)[0]
289
+ # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec, we configured 2 modules here
290
+ print_update_wait(2 * BLE4_BROADCAST_DURATION)
291
+ if test.rc == TEST_FAILED:
292
+ test.add_reason("Failed to restore brg0 to defaults")
293
+ else:
294
+ is_ble5 = not test.internal_brg
295
+ wait = test.internal_brg
296
+ test = cert_config.config_brg1_defaults(test, modules=[test.brg1.energy2400, test.brg1.sensors], ble5=is_ble5, wait=wait)[0]
297
+ # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec, we configured 2 modules here
298
+ print_update_wait(2 * BLE4_BROADCAST_DURATION)
299
+ if test.rc == TEST_FAILED:
300
+ test.add_reason("Failed to restore brg0 to defaults")
301
+ if test.rc == TEST_FAILED:
302
+ test.set_phase_rc(param.name, test.rc)
303
+ test.add_phase_reason(param.name, test.reason)
304
+ if test.exit_on_param_failure:
305
+ break
306
+ else:
307
+ test.reset_result()
308
+
309
+ # Revert to defaults here and not in epilog
310
+ test = cert_config.config_brg_defaults(test, modules=[test.brg0.datapath], ble5=True, wait=False)[0]
311
+ if test.rc == TEST_FAILED:
312
+ test.add_reason("Failed to revert brg0 datapath to defaults")
313
+ else:
314
+ is_ble5 = not test.internal_brg
315
+ wait = test.internal_brg
316
+ test = cert_config.config_brg1_defaults(test, modules=[test.brg1.datapath], ble5=is_ble5, wait=wait)[0]
317
+ if test.rc == TEST_FAILED:
318
+ test.add_reason("Failed to revert brg1 datapath to defaults")
319
+ print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
320
+
321
+ return cert_common.test_epilog(test, revert_brgs=False)