wiliot-certificate 1.5.2a1__py3-none-any.whl → 4.4.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 (120) hide show
  1. brg_certificate/ag/energous_v0_defines.py +105 -114
  2. brg_certificate/ag/energous_v1_defines.py +105 -114
  3. brg_certificate/ag/energous_v2_defines.py +105 -114
  4. brg_certificate/ag/energous_v3_defines.py +105 -114
  5. brg_certificate/ag/energous_v4_defines.py +105 -114
  6. brg_certificate/ag/fanstel_lan_v0_defines.py +105 -114
  7. brg_certificate/ag/fanstel_lte_v0_defines.py +105 -114
  8. brg_certificate/ag/fanstel_wifi_v0_defines.py +105 -114
  9. brg_certificate/ag/minew_lte_v0_defines.py +105 -114
  10. brg_certificate/ag/wlt_types.html +983 -150
  11. brg_certificate/ag/wlt_types_ag.py +1326 -248
  12. brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +69 -0
  13. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +101 -0
  14. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +45 -0
  15. brg_certificate/ag/wlt_types_ag_jsons/calibration.json +75 -0
  16. brg_certificate/ag/wlt_types_ag_jsons/custom.json +99 -0
  17. brg_certificate/ag/wlt_types_ag_jsons/datapath.json +133 -8
  18. brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +99 -0
  19. brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +96 -0
  20. brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +113 -0
  21. brg_certificate/ag/wlt_types_ag_jsons/interface.json +157 -0
  22. brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +205 -0
  23. brg_certificate/cert_common.py +61 -11
  24. brg_certificate/cert_config.py +12 -7
  25. brg_certificate/cert_utils.py +3 -1
  26. brg_certificate/certificate_bcc_test_list.txt +0 -2
  27. brg_certificate/certificate_test_list.txt +4 -4
  28. brg_certificate/tests/calibration/interval_test/interval_test.json +1 -1
  29. brg_certificate/tests/calibration/interval_test/interval_test.py +5 -5
  30. brg_certificate/tests/calibration/output_power_test/output_power_test.json +1 -1
  31. brg_certificate/tests/calibration/output_power_test/output_power_test.py +5 -5
  32. brg_certificate/tests/calibration/pattern_test/pattern_test.json +1 -1
  33. brg_certificate/tests/calibration/pattern_test/pattern_test.py +16 -10
  34. brg_certificate/tests/datapath/aging_test/aging_test.py +10 -9
  35. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +8 -13
  36. brg_certificate/tests/datapath/output_power_test/output_power_test.json +1 -1
  37. brg_certificate/tests/datapath/output_power_test/output_power_test.py +5 -5
  38. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +1 -1
  39. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +11 -7
  40. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +11 -4
  41. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +10 -10
  42. brg_certificate/tests/datapath/pattern_test/pattern_test.json +1 -1
  43. brg_certificate/tests/datapath/pattern_test/pattern_test.py +5 -6
  44. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +1 -1
  45. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +10 -9
  46. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +1 -1
  47. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +11 -10
  48. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +1 -1
  49. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +11 -10
  50. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +1 -1
  51. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +11 -10
  52. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +1 -1
  53. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +5 -6
  54. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +39 -37
  55. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +46 -46
  56. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +2 -3
  57. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +21 -17
  58. brg_certificate/tests/datapath/stress_test/stress_test.json +2 -3
  59. brg_certificate/tests/datapath/stress_test/stress_test.py +20 -17
  60. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +1 -1
  61. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +1 -1
  62. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +12 -10
  63. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +1 -1
  64. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +13 -13
  65. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
  66. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +2 -2
  67. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +1 -1
  68. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +5 -5
  69. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +1 -1
  70. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +5 -5
  71. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +1 -1
  72. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +5 -5
  73. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +2 -2
  74. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +256 -278
  75. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +2 -2
  76. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +256 -278
  77. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +3 -3
  78. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +30 -91
  79. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +1 -1
  80. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +5 -5
  81. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +1 -1
  82. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +5 -5
  83. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +2 -2
  84. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +1 -1
  85. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +5 -5
  86. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +2 -2
  87. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +1 -1
  88. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +6 -7
  89. brg_certificate/wltPb_pb2.py +4 -4
  90. brg_certificate/wltPb_pb2.pyi +2 -1
  91. gw_certificate/api_if/gw_capabilities.py +37 -1
  92. gw_certificate/common/serialization_formatter.py +93 -0
  93. gw_certificate/common/wltPb_pb2.py +50 -38
  94. gw_certificate/common/wltPb_pb2.pyi +42 -35
  95. gw_certificate/gw_certificate.py +4 -2
  96. gw_certificate/gw_certificate_cli.py +5 -4
  97. gw_certificate/interface/4.4.91_app.zip +0 -0
  98. gw_certificate/interface/{4.4.52_sd_bl_app.zip → 4.4.91_sd_bl_app.zip} +0 -0
  99. gw_certificate/interface/ble_simulator.py +5 -3
  100. gw_certificate/interface/flash_fw.py +90 -0
  101. gw_certificate/interface/mqtt.py +39 -23
  102. gw_certificate/interface/pkt_generator.py +0 -44
  103. gw_certificate/interface/uart_if.py +25 -12
  104. gw_certificate/tests/actions.py +33 -5
  105. gw_certificate/tests/connection.py +3 -1
  106. gw_certificate/tests/downlink.py +2 -2
  107. gw_certificate/tests/generic.py +5 -4
  108. gw_certificate/tests/registration.py +4 -4
  109. gw_certificate/tests/static/generated_packet_table.py +47 -25
  110. gw_certificate/tests/static/packet_table.csv +10067 -10051
  111. gw_certificate/tests/static/uplink_defines.py +2 -1
  112. gw_certificate/tests/throughput.py +3 -2
  113. gw_certificate/tests/uplink.py +171 -32
  114. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/METADATA +71 -30
  115. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/RECORD +119 -117
  116. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/WHEEL +1 -1
  117. gw_certificate/interface/4.4.52_app.zip +0 -0
  118. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/entry_points.txt +0 -0
  119. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/licenses/LICENSE +0 -0
  120. {wiliot_certificate-1.5.2a1.dist-info → wiliot_certificate-4.4.0.dist-info}/top_level.txt +0 -0
@@ -5,331 +5,276 @@ import brg_certificate.cert_common as cert_common
5
5
  import brg_certificate.cert_config as cert_config
6
6
 
7
7
  # Test Description:
8
- # This test is to verify the functionality of both signal indicator tx (tx_brg) and rx (rx_brg) at BRG level.
9
- # rssi_threshold = phase 0 , check the if rssi value is between 0 to -25.
10
- # brg0_rx_brg1_tx = phase 1+2
11
- # phase 1 - One BRG will be configured as signal indicator tx, and the other as signal indicator rx,
12
- # 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.
15
- # This phase is to verify the brg module logic is working properly,
16
- # and no tag packet is accidentally being treated as signal indicator packet.
17
- # brg0_rxtx_brg1_rxtx = phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one.
18
- # we expect to see signal indicator packets from both BRG's, according to the tx params.
19
- # brg0_tx_brg1_none = phase 5 - One BRG will be configured as signal indicator tx,
20
- # but no rx, so we don't expect to receive signal indicator packets.
21
- # 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
+
22
25
 
23
26
  # Test MACROS #
24
- NUM_OF_TX_CYCLES = 2
25
- DEFAULT_SCAN_TIME = 60
26
- SCAN_DELAY_TIME = 5
27
- BLE4_LISTEN_PERIOD = 15
28
- BLE4_BROADCAST_DURATION = BLE4_LISTEN_PERIOD + 1
29
-
30
-
31
- # Test functions #
32
- def terminate_test(test, phase, revert_rx_brg=False, revert_tx_brg=False, modules=[]):
33
- # Temp solution for internal_brg test because test_epilog doesn't support both internal brg and test.brgs
34
- utPrint(f"Terminating test (phase={phase})!!!!!!!!\n", "BLUE")
35
- if revert_rx_brg:
36
- restore_modules = [modules[1]] if (test.internal_brg or phase != 4) else modules
37
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
38
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
39
- test, response = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)
40
- if response == NO_RESPONSE and test.exit_on_param_failure:
41
- test.rc = TEST_FAILED
42
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert modules "
43
- f"{restore_modules} to default configuration!")
44
-
45
- if revert_tx_brg:
46
- restore_modules = [modules[0]] if (test.internal_brg or phase != 4) else modules
47
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
48
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
49
- test, response = cert_config.config_brg_defaults(test, modules=restore_modules, ble5=True)
50
- if response == NO_RESPONSE and test.exit_on_param_failure:
51
- test.rc = TEST_FAILED
52
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert modules"
53
- f"{restore_modules} to default configuration!")
54
- return cert_common.test_epilog(test)
55
-
56
-
57
- def brg0_tx_brg1_none(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
58
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
59
-
60
- # Phase 5 - Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
61
- # The receiver isn't receiving any signal indicator packets.
62
- phase = "brg0_tx_brg1_none"
63
- tx_signal_ind_cycle = 15
64
- tx_signal_ind_rep = 1
65
- utPrint(f"TX BRG without RX - cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
66
- # restore default configuration for receiver #
67
- utPrint(f"Configuring BRG {rx_brg_.id_str} to default", "BOLD")
68
- restore_modules = [modules[1]] if (test.internal_brg) else modules
69
- test = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)[0]
70
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
71
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
72
- 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
+
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
73
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
74
48
  # configuring transmitter #
75
49
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
76
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
77
- 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]
78
53
  if test.rc == TEST_FAILED:
79
54
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
80
-
81
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
82
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
83
- f"repetition = {tx_signal_ind_rep}", "BOLD")
84
-
55
+ return test
56
+ utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {cycle},"
57
+ f"repetition = {rep}", "BOLD")
85
58
  # phase analysis #
86
- mqtt_scan_n_create_log_file(test, (NUM_OF_TX_CYCLES * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
87
- expected_signal_ind_pkts = [0]
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")
88
61
  received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
89
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
90
- test.rc = TEST_FAILED
91
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG {rx_brg_.id_str}")
92
-
93
- # Revert bridges to BLE4 before next loop
94
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
95
- test, response = cert_config.config_brg1_defaults(test, modules=[datapath_module], ble5=True)
96
- if response == NO_RESPONSE and test.exit_on_param_failure:
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:
97
66
  test.rc = TEST_FAILED
98
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert datapath_module to default configuration!")
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
99
70
 
100
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
101
- test, response = cert_config.config_brg_defaults(test, modules=[datapath_module], ble5=True)
102
- if response == NO_RESPONSE and test.exit_on_param_failure:
103
- test.rc = TEST_FAILED
104
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert datapath module to default configuration!")
105
-
106
- # Test epilog
107
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
108
-
109
-
110
- def brg0_rxtx_brg1_rxtx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
111
- phase = "brg0_rxtx_brg1_rxtx"
112
-
113
- if not test.internal_brg:
114
- # Phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one.
115
- # expecting to see signal indicator packets from both BRG's, according to the tx params.
116
- utPrint("Both BRG's are transmitter and receivers, with different values\n", "BLUE")
117
-
118
- # configuring first BRG (tx_brg_) #
119
- tx_brg_signal_indicator_cycle = 15
120
- tx_brg_signal_indicator_rep = 3
121
- # configuring first brg (tx_brg_) as receiver
122
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
123
- cert_config.brg_configure_ble5(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0],
124
- values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], wait=False)
125
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
126
- utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
127
-
128
- # configuring transmitter #
129
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
130
- test = cert_config.brg_configure(test=test, module=energy2400_module,
131
- fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
132
- values=[tx_brg_signal_indicator_cycle, tx_brg_signal_indicator_rep])[0]
133
- if test.rc == TEST_FAILED:
134
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
135
-
136
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
137
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_brg_signal_indicator_cycle},"
138
- f"repetition = {tx_brg_signal_indicator_rep}", "BOLD")
139
-
140
- # configuring second brg (rx_brg_) as receiver
141
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
142
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module,
143
- fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
144
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
145
- utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
146
-
147
- # configuring second brg (rx_brg_) as transmitter
148
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
149
- rx_brg_signal_indicator_cycle = 15
150
- rx_brg_signal_indicator_rep = 4
151
- test = cert_config.brg1_configure(test=test, module=energy2400_module,
152
- fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
153
- values=[rx_brg_signal_indicator_cycle, rx_brg_signal_indicator_rep], ble5=True)[0]
154
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
155
- if test.rc == TEST_FAILED:
156
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
157
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {rx_brg_signal_indicator_cycle},"
158
- f"repetition = {rx_brg_signal_indicator_rep}")
159
-
160
- # phase analysis #
161
- mqtt_scan_n_create_log_file(test,
162
- NUM_OF_TX_CYCLES * max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) + SCAN_DELAY_TIME,
163
- phase)
164
-
165
- # Analyzing tx_brg_ performance as receiver
166
- utPrint(f"Analyzing tx_brg {tx_brg_.id_str} performance as a Receiver\n", "BOLD")
167
- rx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / rx_brg_signal_indicator_cycle
168
- expected_signal_ind_pkts = [int(x * rx_brg_tx_cycles) for x in cert_common.exp_sig_ind_pkts(rx_brg_, tx_brg_, NUM_OF_TX_CYCLES)]
169
- received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=tx_brg_, tx_brg=rx_brg_)
170
- txt = f"""Phase {phase} - BRG {tx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets,"
171
- " expected {expected_signal_ind_pkts} packets"""
172
- print(txt)
173
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
174
- test.rc = TEST_FAILED
175
- test.add_reason(txt)
176
-
177
- # Analyzing rx_brg_ performance as receiver
178
- utPrint(f"Analyzing rx_brg {rx_brg_.id_str} performance as a Receiver\n", "BOLD")
179
- tx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / tx_brg_signal_indicator_cycle
180
- expected_signal_ind_pkts = [int(x * tx_brg_tx_cycles) for x in cert_common.exp_sig_ind_pkts(rx_brg_, tx_brg_)]
181
- received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
182
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)}"
183
- " packets, expected {expected_signal_ind_pkts} packets"""
184
- print(txt)
185
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
186
- test.rc = TEST_FAILED
187
- test.add_reason(txt)
188
- else:
189
- test.add_reason("skip for internal BRG")
190
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
191
71
 
72
+ def test_brg0_tx_brg1_rx(test):
192
73
 
193
- def brg0_none_brg1_rx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
194
- phase = "brg0_none_brg1_rx"
195
- # Phase 3 - Rx BRG without tx.Expecting no signal indicator packets to be received.
196
- tx_signal_ind_cycle = ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE
197
- tx_signal_ind_rep = ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP
198
- utPrint(f"RX BRG without TX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
74
+ tx_brg_ = test.brg0
75
+ rx_brg_ = test.brg1 # when internal_brg test this is the internal_brg
76
+ cycle, rep = 8, 4
199
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
200
87
  # configuring transmitter #
88
+ wait = not test.internal_brg
201
89
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
202
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
203
- values=[tx_signal_ind_cycle, tx_signal_ind_rep], ble5=True)[0]
204
- 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]
205
93
  if test.rc == TEST_FAILED:
206
94
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
207
- utPrint(f"BRG {tx_brg_.id_str} configured to default!!! cycle = {tx_signal_ind_cycle},"f"repetition = {tx_signal_ind_rep}", "BOLD")
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]
129
+ if test.rc == TEST_FAILED:
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")
208
133
 
209
134
  # phase analysis #
210
- 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")
211
137
  expected_signal_ind_pkts = [0]
212
138
  received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
213
139
  if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
214
140
  test.rc = TEST_FAILED
215
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG"
216
- f"{rx_brg_.id_str}")
217
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
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")
218
144
 
145
+ return test
219
146
 
220
- def brg0_rx_brg1_tx(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
221
- phase = "brg0_rx_brg1_tx"
222
- cycle_rep = [(30, 3), (60, 4)]
223
- for tx_signal_ind_cycle, tx_signal_ind_rep in cycle_rep:
224
147
 
225
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
226
- # configuring receiver #
227
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
228
- test = cert_config.brg_configure(test=test, module=energy2400_module,
229
- fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
230
- values=[tx_signal_ind_cycle, tx_signal_ind_rep])[0]
231
- if test.rc == TEST_FAILED:
232
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
233
-
234
- # configuring transmitter #
235
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
236
- test = cert_config.brg1_configure(test=test, module=energy2400_module,
237
- fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
238
- values=[tx_signal_ind_cycle, tx_signal_ind_rep], ble5=True)[0]
239
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
240
- if test.rc == TEST_FAILED:
241
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
242
-
243
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle={tx_signal_ind_cycle}, repetition={tx_signal_ind_rep}", "BOLD")
244
-
245
- # phase analysis
246
- mqtt_scan_n_create_log_file(test, (NUM_OF_TX_CYCLES * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
247
- expected_signal_ind_pkts = cert_common.exp_sig_ind_pkts(tx_brg_, rx_brg_, NUM_OF_TX_CYCLES)
248
- received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
249
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets: received {len(received_signal_ind_pkts)} packets,"
250
- expected {expected_signal_ind_pkts} packets"""
251
- print(txt)
252
- # TODO: change condition
253
- if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
254
- test.rc = TEST_FAILED
255
- test.add_reason(txt)
256
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
257
-
258
-
259
- def rssi_threshold(test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules):
260
- phase = "rssi_threshold"
261
- # RSSI Threshold
262
- rssi_threshold = -25
263
- tx_signal_ind_cycle = 15
264
- tx_signal_ind_rep = 3
265
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
148
+ def test_brg0_rxtx_brg1_rxtx(test):
266
149
 
267
- # configuring receiver #
268
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
269
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0, BRG_RSSI_THRESHOLD],
270
- values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR, rssi_threshold], ble5=True)[0]
271
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
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]
165
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
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
170
+ utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
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:
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")
272
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]
273
182
  if test.rc == TEST_FAILED and test.exit_on_param_failure:
274
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}")
195
+
196
+ # phase analysis #
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")
275
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):
215
+ test.rc = TEST_FAILED
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
223
+
224
+
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")
276
232
  # configuring transmitter #
277
233
  utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
278
- test = cert_config.brg1_configure(test=test, module=energy2400_module, fields=[BRG_SIGNAL_INDICATOR_CYCLE, BRG_SIGNAL_INDICATOR_REP],
279
- values=[tx_signal_ind_cycle, tx_signal_ind_rep], ble5=True)[0]
280
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
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]
281
237
  if test.rc == TEST_FAILED:
282
238
  test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
239
+ return test
283
240
 
284
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
285
- f"repetition = {tx_signal_ind_rep}", "BOLD")
286
241
  # phase analysis #
287
- mqtt_scan_n_create_log_file(test, (NUM_OF_TX_CYCLES * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase)
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]
288
245
  received_signal_ind_pkts = cert_common.get_all_sig_ind_pkts(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
289
- rssi_threshold_viloation_pkts = [p for p in received_signal_ind_pkts if p[RSSI] >= -1 * rssi_threshold]
290
- if rssi_threshold_viloation_pkts:
246
+ if len(received_signal_ind_pkts) not in expected_signal_ind_pkts:
291
247
  test.rc = TEST_FAILED
292
- test.add_reason(f"rssi_threshold phase failed - BRG {rx_brg_.id_str} echoed"
293
- f" {len(rssi_threshold_viloation_pkts)} signal indicator packets\n with RSSI weaker than {rssi_threshold}")
294
- field_functionality_pass_fail_print(test, 'phase', phase)
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_)
295
251
 
296
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
252
+ return test
297
253
 
298
254
 
299
- SIGNAL_INDICATOR_TEST_MAP = {
300
- "rssi_threshold": rssi_threshold, # phase 0
301
- "brg0_rx_brg1_tx": brg0_rx_brg1_tx, # phase 1 + 2
302
- "brg0_none_brg1_rx": brg0_none_brg1_rx, # phase 3
303
- "brg0_rxtx_brg1_rxtx": brg0_rxtx_brg1_rxtx, # phase 4, skip for internal brg
304
- "brg0_tx_brg1_none": brg0_tx_brg1_none} # phase 5
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}
305
258
 
306
259
 
307
260
  def run(test):
308
-
309
- # Test modules evaluation #
310
- energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
311
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
312
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
313
-
314
- # Transmitter related defines #
315
- tx_brg_ = test.brg0
316
- tx_module = energy2400_module
317
-
318
- # Receiver related defines #
319
- rx_brg_ = test.brg1
320
-
321
- # Modules list #
322
- modules = [tx_module, ext_sensors_module]
323
-
324
261
  # Test prolog
325
262
  test = cert_common.test_prolog(test)
326
- test = cert_config.brg_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_500K], module=datapath_module)[0]
327
- test = cert_config.brg1_configure(test, fields=[BRG_RX_CHANNEL], values=[ag.RX_CHANNEL_10_500K], module=datapath_module)[0]
328
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
329
- return terminate_test(test, phase=1, revert_rx_brg=True, revert_tx_brg=True, modules=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_500K],
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_500K], 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
+
330
275
  for param in test.params:
331
- functionality_run_print(param.name)
332
- test = SIGNAL_INDICATOR_TEST_MAP[param.value](test, energy2400_module, ext_sensors_module, tx_brg_, rx_brg_, modules)
276
+ phase_run_print(param.name)
277
+ test = SIGNAL_INDICATOR_TEST_MAP[param.value](test)
333
278
  generate_log_file(test, param.name)
334
279
  field_functionality_pass_fail_print(test, param.name)
335
280
  test.set_phase_rc(param.name, test.rc)
@@ -339,5 +284,38 @@ def run(test):
339
284
  else:
340
285
  test.reset_result()
341
286
 
342
- return cert_common.test_epilog(test, revert_brgs=True, modules=[energy2400_module, ext_sensors_module],
343
- brg1_modules=[energy2400_module, ext_sensors_module])
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)
@@ -53,9 +53,9 @@ def terminate_test(test, revert_rx_brg=False, revert_tx_brg=False, rx_modules=[]
53
53
  def run(test):
54
54
 
55
55
  # Test modules evaluation #
56
- energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
57
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
58
- energy_sub1g_module = eval_pkt(f'ModuleEnergySub1GV{test.active_brg.api_version}')
56
+ energy2400_module = test.active_brg.energy2400
57
+ ext_sensors_module = test.active_brg.sensors
58
+ energy_sub1g_module = test.active_brg.energy_sub1g
59
59
 
60
60
  # Transmitter related defines #
61
61
  tx_brg_ = test.brg0