wiliot-certificate 1.5.0a1__py3-none-any.whl → 1.5.2a1__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 (124) hide show
  1. brg_certificate/ag/energous_v0_defines.py +17 -17
  2. brg_certificate/ag/energous_v1_defines.py +17 -17
  3. brg_certificate/ag/energous_v2_defines.py +17 -17
  4. brg_certificate/ag/energous_v3_defines.py +17 -17
  5. brg_certificate/ag/energous_v4_defines.py +17 -17
  6. brg_certificate/ag/fanstel_lan_v0_defines.py +17 -17
  7. brg_certificate/ag/fanstel_lte_v0_defines.py +17 -17
  8. brg_certificate/ag/fanstel_wifi_v0_defines.py +17 -17
  9. brg_certificate/ag/minew_lte_v0_defines.py +17 -17
  10. brg_certificate/ag/wlt_cmd_if.html +3 -2
  11. brg_certificate/ag/wlt_types.html +0 -1
  12. brg_certificate/ag/wlt_types_ag.py +151 -152
  13. brg_certificate/brg_certificate.py +38 -7
  14. brg_certificate/brg_certificate_cli.py +19 -3
  15. brg_certificate/cert_common.py +92 -55
  16. brg_certificate/cert_config.py +6 -4
  17. brg_certificate/cert_data_sim.py +47 -7
  18. brg_certificate/cert_defines.py +20 -6
  19. brg_certificate/cert_gw_sim.py +10 -6
  20. brg_certificate/cert_mqtt.py +9 -6
  21. brg_certificate/cert_prints.py +14 -1
  22. brg_certificate/cert_protobuf.py +7 -7
  23. brg_certificate/cert_results.py +131 -84
  24. brg_certificate/cert_utils.py +13 -7
  25. brg_certificate/certificate_bcc_sanity_test_list.txt +40 -0
  26. brg_certificate/certificate_bcc_test_list.txt +50 -0
  27. brg_certificate/certificate_sanity_test_list.txt +12 -5
  28. brg_certificate/certificate_test_list.txt +16 -6
  29. brg_certificate/tests/calibration/interval_test/interval_test.json +4 -3
  30. brg_certificate/tests/calibration/output_power_test/output_power_test.json +8 -5
  31. brg_certificate/tests/calibration/pattern_test/pattern_test.json +7 -4
  32. brg_certificate/tests/calibration/pattern_test/pattern_test.py +25 -26
  33. brg_certificate/tests/datapath/aging_test/aging_test.json +19 -0
  34. brg_certificate/tests/datapath/aging_test/aging_test.py +142 -0
  35. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +10 -5
  36. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +12 -11
  37. brg_certificate/tests/datapath/output_power_test/output_power_test.json +7 -4
  38. brg_certificate/tests/datapath/output_power_test/output_power_test.py +2 -1
  39. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +8 -5
  40. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +6 -3
  41. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +7 -4
  42. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +6 -3
  43. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +7 -4
  44. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +4 -2
  45. brg_certificate/tests/datapath/pattern_test/pattern_test.json +8 -5
  46. brg_certificate/tests/datapath/pattern_test/pattern_test.py +2 -1
  47. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +11 -5
  48. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +12 -5
  49. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +10 -4
  50. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +11 -6
  51. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +10 -4
  52. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +11 -7
  53. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +8 -4
  54. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +7 -5
  55. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +7 -4
  56. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +7 -3
  57. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +4 -5
  58. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +107 -73
  59. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +4 -5
  60. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +128 -118
  61. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +15 -23
  62. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +104 -103
  63. brg_certificate/tests/datapath/stress_test/stress_test.json +15 -23
  64. brg_certificate/tests/datapath/stress_test/stress_test.py +104 -110
  65. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +8 -4
  66. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +7 -2
  67. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +8 -4
  68. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +8 -6
  69. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +4 -3
  70. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +2 -38
  71. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +15 -8
  72. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +14 -8
  73. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +11 -7
  74. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +25 -12
  75. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +11 -7
  76. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +48 -3
  77. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.json → periodic_msgs_test/periodic_msgs_test.json} +5 -4
  78. brg_certificate/tests/edge_mgmt/{stat_test/stat_test.py → periodic_msgs_test/periodic_msgs_test.py} +4 -4
  79. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +8 -5
  80. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +2 -1
  81. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +9 -6
  82. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +2 -1
  83. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +8 -5
  84. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +2 -1
  85. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +20 -0
  86. brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +343 -0
  87. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +20 -0
  88. brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +343 -0
  89. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +14 -7
  90. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +45 -57
  91. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +14 -7
  92. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +198 -125
  93. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +7 -4
  94. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +2 -1
  95. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +13 -6
  96. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +2 -1
  97. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +14 -7
  98. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +117 -124
  99. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +7 -4
  100. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +2 -1
  101. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +18 -0
  102. brg_certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +84 -0
  103. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +21 -0
  104. brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +306 -0
  105. brg_certificate/wltPb_pb2.py +15 -15
  106. brg_certificate/wltPb_pb2.pyi +8 -2
  107. brg_certificate/wlt_types.py +2 -1
  108. gw_certificate/cert_results.py +11 -4
  109. gw_certificate/gw_certificate.py +0 -2
  110. gw_certificate/gw_certificate_cli.py +3 -3
  111. gw_certificate/interface/uart_if.py +1 -1
  112. gw_certificate/tests/actions.py +7 -1
  113. gw_certificate/tests/registration.py +2 -1
  114. gw_certificate/tests/uplink.py +26 -35
  115. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/METADATA +46 -42
  116. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/RECORD +120 -112
  117. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/WHEEL +1 -1
  118. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.json +0 -13
  119. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +0 -76
  120. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +0 -13
  121. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +0 -398
  122. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/entry_points.txt +0 -0
  123. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info/licenses}/LICENSE +0 -0
  124. {wiliot_certificate-1.5.0a1.dist-info → wiliot_certificate-1.5.2a1.dist-info}/top_level.txt +0 -0
@@ -1,76 +0,0 @@
1
- # This test check for the algo of the adaptive pacer - run with 1 gw & 1 brg
2
- # In order to have a lot of stress on the BRG you best use ble sim with pacer_algo_test_pkts.csv
3
- from brg_certificate.cert_prints import *
4
- from brg_certificate.cert_defines import *
5
- from brg_certificate.wlt_types import *
6
- import brg_certificate.cert_common as cert_common
7
- import brg_certificate.cert_config as cert_config
8
-
9
- def effective_pacer_increment_highest_get(test):
10
- cert_config.send_brg_action(test, ag.ACTION_SEND_HB)
11
- test, mgmt_pkts = cert_common.scan_for_mgmt_pkts(test, [eval_pkt(f'Brg2GwHbV{test.active_brg.api_version}')])
12
- highest = 0
13
- if mgmt_pkts:
14
- for p in mgmt_pkts:
15
- if p[MGMT_PKT].pkt.effective_pacer_increment:
16
- highest = p[MGMT_PKT].pkt.effective_pacer_increment if p[MGMT_PKT].pkt.effective_pacer_increment > highest else highest
17
- return highest
18
-
19
- def run(test):
20
-
21
- fields = [BRG_ADAPTIVE_PACER, BRG_PACER_INTERVAL, BRG_PKT_FILTER, BRG_TX_REPETITION]
22
- values = [ag.ADAPTIVE_PACER_ON, 1, ag.PKT_FILTER_TEMP_ADVANCED_AND_DEBUG_PKTS, 1]
23
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
24
- calib_module = eval_pkt(f'ModuleCalibrationV{test.active_brg.api_version}')
25
-
26
- test = cert_common.test_prolog(test)
27
- if test.rc == TEST_FAILED:
28
- return cert_common.test_epilog(test)
29
-
30
- # Turn on adaptive pacer and set cfgs to help activating adaptive pacer algo
31
- test = cert_config.brg_configure(test, fields=fields, values=values, module=datapath_module)[0]
32
- if test.rc == TEST_FAILED:
33
- return cert_common.test_epilog(test, revert_brgs=True, modules=[datapath_module])
34
- test = cert_config.brg_configure(test, fields=[BRG_CALIB_INTERVAL], values=[30], module=calib_module)[0]
35
- if test.rc == TEST_FAILED:
36
- return cert_common.test_epilog(test, revert_brgs=True, modules=[calib_module])
37
-
38
- # Wait for tx rep algo to work & then activate pacing algo
39
- # Checking effective_pacer_increment every minute untill its
40
- # stable for 3 mins to start checking tags actual pacing
41
- effective_pacer_increment = False
42
- last_incarement = 0
43
- count = 0
44
- for i in range(10):
45
- effective_pacer_increment = effective_pacer_increment_highest_get(test)
46
- print(f"Current eff_pacer_increment = {effective_pacer_increment}, i = {i}")
47
-
48
- if effective_pacer_increment == 0:
49
- if i == 10:
50
- test.rc == TEST_FAILED
51
- test.add_reason("The effective_pacer_increment is 0 after 10 minutes")
52
- return cert_common.test_epilog(test)
53
- cert_common.wait_time_n_print(15)
54
- continue
55
-
56
- if last_incarement == effective_pacer_increment:
57
- count += 1
58
- if count == 3:
59
- break
60
- else:
61
- last_incarement = effective_pacer_increment
62
-
63
- if count != 3:
64
- test.rc == TEST_FAILED
65
- test.add_reason("The effective_pacer_increment havn't been stable for 10 minutes")
66
- return cert_common.test_epilog(test)
67
-
68
- df = cert_common.data_scan(test, scan_time=60, brg_data=(not test.internal_brg), gw_data=test.internal_brg)
69
- cert_mqtt.dump_pkts(test, log=str(values))
70
- cert_common.display_data(df, nfpkt=True, pkt_cntr_diff=True, cer_per_tag=True, name_prefix=test.module_name, dir=test.dir)
71
-
72
- test = cert_common.pacing_analysis(test, df=df, pacer_interval=1+effective_pacer_increment)
73
- if test.rc == TEST_FAILED:
74
- return cert_common.test_epilog(test, revert_brgs=True, modules=[datapath_module, calib_module])
75
-
76
- return cert_common.test_epilog(test, revert_brgs=True, modules=[datapath_module, calib_module])
@@ -1,13 +0,0 @@
1
- {
2
- "name": "signal_indicator_functionality_ble5_test",
3
- "module": "energy2400",
4
- "purpose": "TODO",
5
- "documentaion": "<TEST_DOCUMENTATION_LINK>",
6
- "initialCondition": "TODO",
7
- "procedure": ["Test prolog", "TODO", "Test epilog"],
8
- "expectedOutcome": "TODO",
9
- "mandatory": 0,
10
- "multiBridgeTest": 1,
11
- "gwOnlyTest": 0,
12
- "allSupportedValues": ["RX_CHANNEL_10_250K", "RX_CHANNEL_10_500K"]
13
- }
@@ -1,398 +0,0 @@
1
- from brg_certificate.cert_prints import *
2
- from brg_certificate.cert_defines import *
3
- from brg_certificate.wlt_types import *
4
- import brg_certificate.cert_common as cert_common
5
- import brg_certificate.cert_config as cert_config
6
- import random
7
-
8
- # 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
- # We will configure several signal indicator params during the test, and check the functionality of the signal indicator logic
11
- # for each of them.
12
- # 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.
13
- # At first, we will configure several tx signal indicator params and check for ack's, to verify all indicated params were
14
- # received at the cloud.
15
- # Then, we will examine the signal indicator end-2-end logic with both transmitter and receiver:
16
- # phase 1 - One BRG will be configured as signal indicator tx, and the other as signal indicator rx, and we expect to see
17
- # signal indicator packets only from the tx BRG, and according to the tx params (to check the repetition and cycle params).
18
- # phase 2 - Same as phase 1, but with different tx params configured.
19
- # 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
20
- # brg module logic is working properly, and no tag packet is accidentally being treated as signal indicator packet.
21
- # phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one. we expect
22
- # to see signal indicator packets from both BRG's, according to the tx params.
23
- # phase 5 - One BRG will be configured as signal indicator tx, but no rx, so we don't expect to receive signal indicatopr packets.
24
- # that way we can assure the logic within the receiver is not confused by the signal indicator uuid as external sensor.
25
-
26
- # Test MACROS #
27
- DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
28
- NUM_OF_SCANNING_CYCLE = 2
29
- DEFAULT_SCAN_TIME = 60
30
- SCAN_DELAY_TIME = 5
31
- 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]
32
- VALUES_DICT = {0:(15,3),1:(30,3),2:(60,4),3:(ag.BRG_DEFAULT_SIGNAL_INDICATOR_CYCLE, ag.BRG_DEFAULT_SIGNAL_INDICATOR_REP),4:[(15,3),(15,4)],5:(15,1)}
33
- CYCLE_IDX = 0
34
- REP_IDX = 1
35
- TX_BRG_IDX = 0
36
- RX_BRG_IDX = 1
37
- BLE4_LISTEN_PERIOD = 15
38
- BLE4_BROADCAST_DURATION = BLE4_LISTEN_PERIOD + 1
39
-
40
- # Helper function #
41
- def get_phase_tx_params_values(phase, brg):
42
- if phase == 4:
43
- return VALUES_DICT[phase][brg][CYCLE_IDX] , VALUES_DICT[phase][brg][REP_IDX]
44
- else:
45
- return VALUES_DICT[phase][CYCLE_IDX], VALUES_DICT[phase][REP_IDX]
46
-
47
- # Test functions #
48
- def mqtt_scan_n_create_log_file(test, duration, phase, value):
49
- test.mqttc.flush_pkts()
50
- mqtt_scan_wait(test, duration=duration)
51
- generate_log_file(test, f"{phase}_{value}")
52
-
53
- def get_all_signal_ind_pkt(test=None, rx_brg=None, tx_brg=None):
54
- if rx_brg == test.brg1:
55
- all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(mqttc=test.mqttc, test=test)
56
- elif rx_brg == test.brg0:
57
- all_sensor_packets = cert_mqtt.get_all_sensor_pkts(mqttc=test.mqttc, test=test)
58
- signal_ind_pkts = []
59
- for p in all_sensor_packets:
60
- 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):
61
- signal_ind_pkts.append(p)
62
- return signal_ind_pkts
63
-
64
- def expected_signal_ind_pkts_calc(tx_brg, rx_brg):
65
- if (tx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
66
- tx_brg_ant_polarization_num = 2
67
- else:
68
- tx_brg_ant_polarization_num = 1
69
- if (rx_brg.board_type in BOARD_TYPES_2_POLARIZATION_ANT_LIST):
70
- rx_brg_ant_polarization_num = 2
71
- else:
72
- rx_brg_ant_polarization_num = 1
73
- return NUM_OF_SCANNING_CYCLE * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
74
-
75
- def terminate_test(test, phase=0, revert_rx_brg=False, revert_tx_brg=False, modules=[]):
76
- # Temp solution for internal_brg test because test_epilog doesn't support both internal brg and test.brgs
77
- utPrint(f"Terminating test (phase={phase})!!!!!!!!\n", "BLUE")
78
- if revert_rx_brg:
79
- restore_modules = [modules[1]] if (test.internal_brg or phase != 4) else modules
80
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
81
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
82
- test, response = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)
83
- if response == NO_RESPONSE and test.exit_on_param_failure:
84
- test.rc = TEST_FAILED
85
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert modules "
86
- f"{restore_modules} to default configuration!")
87
-
88
- if revert_tx_brg:
89
- restore_modules = [modules[0]] if (test.internal_brg or phase != 4) else modules
90
- restore_modules.append(eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}'))
91
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
92
- test, response = cert_config.config_brg_defaults(test, modules=restore_modules, ble5=True)
93
- if response == NO_RESPONSE and test.exit_on_param_failure:
94
- test.rc = TEST_FAILED
95
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert modules"
96
- f"{restore_modules} to default configuration!")
97
- return cert_common.test_epilog(test)
98
-
99
- # Test execution #
100
- def run(test):
101
-
102
- # Test modules evaluation #
103
- energy2400_module = eval_pkt(f'ModuleEnergy2400V{test.active_brg.api_version}')
104
- ext_sensors_module = eval_pkt(f'ModuleExtSensorsV{test.active_brg.api_version}')
105
- datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
106
-
107
- # Transmitter related defines #
108
- tx_brg_ = test.brg0
109
- tx_module = energy2400_module
110
-
111
- # Receiver related defines #
112
- rx_brg_ = test.brg1
113
-
114
- # RSSI Threshold
115
- rssi_threshold = -25
116
-
117
- # Modules list #
118
- modules = [tx_module, ext_sensors_module]
119
-
120
- # Test prolog
121
- test = cert_common.test_prolog(test)
122
- if test.rc == TEST_FAILED:
123
- return terminate_test(test)
124
-
125
- for param in test.params:
126
- test = cert_config.brg_configure(test, fields=[BRG_RX_CHANNEL], values=[param.value], module=datapath_module)[0]
127
- test = cert_config.brg1_configure(test, fields=[BRG_RX_CHANNEL], values=[param.value], module=datapath_module)[0]
128
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
129
- return terminate_test(test, phase=1, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
130
-
131
- phase = 0
132
- tx_signal_ind_cycle, tx_signal_ind_rep = get_phase_tx_params_values(phase, TX_BRG_IDX)
133
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
134
- # configuring receiver #
135
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver with RSSI Threshold of {rssi_threshold}", "BOLD")
136
- 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]
137
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
138
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
139
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
140
- # configuring transmitter #
141
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
142
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
143
- signal_indicator_cycle=tx_signal_ind_cycle, signal_indicator_rep=tx_signal_ind_rep))
144
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
145
- if test.rc == TEST_FAILED:
146
- test.add_reason(f"BRG {tx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
147
- return test
148
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
149
- f"repetition = {tx_signal_ind_rep}", "BOLD")
150
- # phase analysis #
151
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase, f"rssi_threshold")
152
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
153
- rssi_threshold_viloation_pkts = [p for p in received_signal_ind_pkts if p[RSSI] >= -1*rssi_threshold]
154
- if rssi_threshold_viloation_pkts:
155
- test.rc = TEST_FAILED
156
- test.add_reason(f"rssi_threshold phase failed - BRG {rx_brg_.id_str} echoed" +
157
- f" {len(rssi_threshold_viloation_pkts)} signal indicator packets\n with RSSI weaker than {rssi_threshold}")
158
- field_functionality_pass_fail_print(test, 'phase', phase)
159
- if test.rc == TEST_FAILED:
160
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
161
-
162
- phase = 1
163
- functionality_run_print(f"phase {phase}")
164
- # Phase 1 - Tx BRG with rx. expecting the receiver to receive signal indicator packets from the transmitter
165
- # according to the tx params.
166
- tx_signal_ind_cycle, tx_signal_ind_rep = get_phase_tx_params_values(phase, TX_BRG_IDX)
167
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
168
- # configuring receiver #
169
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
170
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
171
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
172
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator receiver configuration!")
173
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
174
- # configuring transmitter #
175
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
176
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
177
- signal_indicator_cycle=tx_signal_ind_cycle, signal_indicator_rep=tx_signal_ind_rep))
178
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
179
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
180
- f"repetition = {tx_signal_ind_rep}", "BOLD")
181
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
182
- # phase analysis
183
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE * tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase, value=param.name)
184
- expected_signal_ind_pkts = expected_signal_ind_pkts_calc(tx_brg_, rx_brg_)
185
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
186
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets:
187
- received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
188
- print(txt)
189
- if (not len(received_signal_ind_pkts) or
190
- len(received_signal_ind_pkts) < expected_signal_ind_pkts or
191
- len(received_signal_ind_pkts) > expected_signal_ind_pkts):
192
- test.rc = TEST_FAILED
193
- test.add_reason(txt)
194
- test.set_phase_rc(param.name, test.rc)
195
- test.add_phase_reason(param.name, test.reason)
196
- field_functionality_pass_fail_print(test, 'phase', phase)
197
- if test.rc == TEST_FAILED:
198
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
199
-
200
- phase = 2
201
- functionality_run_print(f"phase {phase}")
202
- # Phase 2 - Tx BRG with rx. tx params changed from last values configured in phase 1
203
- # expecting the receiver to receive signal indicator packets from the transmitter according to the tx params.
204
- tx_signal_ind_cycle, tx_signal_ind_rep = get_phase_tx_params_values(phase, TX_BRG_IDX)
205
- utPrint(f"TX BRG with RX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
206
- # configuring transmitter #
207
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
208
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
209
- signal_indicator_cycle=tx_signal_ind_cycle, signal_indicator_rep=tx_signal_ind_rep))
210
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
211
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_signal_ind_cycle},"
212
- f"repetition = {tx_signal_ind_rep}", "BOLD")
213
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
214
- # phase analysis #
215
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE*tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase, value=param.value)
216
- expected_signal_ind_pkts = expected_signal_ind_pkts_calc(tx_brg_, rx_brg_)
217
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
218
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets:
219
- received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
220
- print(txt)
221
- if (not len(received_signal_ind_pkts) or
222
- len(received_signal_ind_pkts) < expected_signal_ind_pkts or
223
- len(received_signal_ind_pkts) > expected_signal_ind_pkts):
224
- test.rc = TEST_FAILED
225
- test.add_reason(txt)
226
- test.set_phase_rc(param.name, test.rc)
227
- test.add_phase_reason(param.name, test.reason)
228
- field_functionality_pass_fail_print(test, 'phase', phase)
229
- if test.rc == TEST_FAILED:
230
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
231
-
232
- phase = 3
233
- functionality_run_print(f"phase {phase}")
234
- # Phase 3 - Rx BRG without tx.Expecting no signal indicator packets to be received.
235
- tx_signal_ind_cycle, tx_signal_ind_rep = get_phase_tx_params_values(phase, TX_BRG_IDX)
236
- utPrint(f"RX BRG without TX- cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
237
- # configuring transmitter to no TX #
238
- utPrint(f"Configuring BRG {tx_brg_.id_str} to default", "BOLD")
239
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
240
- signal_indicator_cycle=tx_signal_ind_cycle, signal_indicator_rep=tx_signal_ind_rep))
241
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
242
- utPrint(f"BRG {tx_brg_.id_str} configured to default!!! cycle = {tx_signal_ind_cycle},"
243
- f"repetition = {tx_signal_ind_rep}", "BOLD")
244
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
245
- # phase analysis #
246
- mqtt_scan_n_create_log_file(test, DEFAULT_SCAN_TIME, phase, value=param.value)
247
- expected_signal_ind_pkts = 0
248
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
249
- if len(received_signal_ind_pkts) != expected_signal_ind_pkts:
250
- test.rc = TEST_FAILED
251
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG"
252
- f"{rx_brg_.id_str}")
253
- test.set_phase_rc(param.name, test.rc)
254
- test.add_phase_reason(param.name, test.reason)
255
- field_functionality_pass_fail_print(test, 'phase', phase)
256
- if test.rc == TEST_FAILED:
257
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)
258
-
259
- if not test.internal_brg:
260
- phase = 4
261
- functionality_run_print(f"phase {phase}")
262
- # Phase 4 - Both BRG's will be configured to be transmitters and receivers, with different tx params for each one.
263
- # expecting to see signal indicator packets from both BRG's, according to the tx params.
264
- utPrint(f"Both BRG's are transmitter and receivers, with different values\n", "BLUE")
265
-
266
- # configuring first BRG (tx_brg_) #
267
- tx_brg_signal_indicator_cycle, tx_brg_signal_indicator_rep = get_phase_tx_params_values(phase, TX_BRG_IDX)
268
- # configuring first brg (tx_brg_) as receiver
269
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
270
- cert_config.brg_configure_ble5(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], wait=False)
271
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
272
- utPrint(f"BRG {tx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
273
- # configuring first brg (tx_brg_) as transmitter
274
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
275
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
276
- signal_indicator_cycle=tx_brg_signal_indicator_cycle, signal_indicator_rep=tx_brg_signal_indicator_rep))
277
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
278
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
279
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {tx_brg_signal_indicator_cycle},"
280
- f"repetition = {tx_brg_signal_indicator_rep}", "BOLD")
281
-
282
- # configuring second brg (rx_brg_) as receiver
283
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Receiver", "BOLD")
284
- test = cert_config.brg1_configure(test=test, module=ext_sensors_module, fields=[BRG_SENSOR0], values=[ag.EXTERNAL_SENSORS_SIGNAL_INDICATOR], ble5=True)[0]
285
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
286
- utPrint(f"BRG {rx_brg_.id_str} successfully configured as Signal Indicator Receiver\n", "BOLD")
287
- rx_brg_signal_indicator_cycle, rx_brg_signal_indicator_rep = get_phase_tx_params_values(phase, RX_BRG_IDX)
288
- # configuring second brg (rx_brg_) as transmitter
289
- utPrint(f"Configuring BRG {rx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
290
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=rx_brg_.id_int,
291
- signal_indicator_cycle=rx_brg_signal_indicator_cycle, signal_indicator_rep=rx_brg_signal_indicator_rep))
292
- test = cert_config.brg1_configure(test=test, cfg_pkt=transmitter_cfg_pkt, ble5=True)[0]
293
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
294
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't receive signal indicator transmitter configuration!")
295
- test.set_phase_rc(param.name, test.rc)
296
- test.add_phase_reason(param.name, test.reason)
297
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
298
- utPrint(f"BRG {tx_brg_.id_str} configured to be transmitter - cycle = {rx_brg_signal_indicator_cycle},"
299
- f"repetition = {rx_brg_signal_indicator_rep}")
300
-
301
- # phase analysis #
302
- mqtt_scan_n_create_log_file(test, NUM_OF_SCANNING_CYCLE * max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) + SCAN_DELAY_TIME, phase, value=param.value)
303
-
304
- # Analysing tx_brg_ performance as receiver
305
- rx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / rx_brg_signal_indicator_cycle
306
- expected_signal_ind_pkts = int(expected_signal_ind_pkts_calc(rx_brg_, tx_brg_) * rx_brg_tx_cycles)
307
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=tx_brg_, tx_brg=rx_brg_)
308
- txt = f"""Phase {phase} - BRG {tx_brg_.id_str} signal indicator packets:
309
- received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
310
- print(txt)
311
- if (not len(received_signal_ind_pkts) or
312
- len(received_signal_ind_pkts) < expected_signal_ind_pkts or
313
- len(received_signal_ind_pkts) > expected_signal_ind_pkts):
314
- test.rc = TEST_FAILED
315
- test.add_reason(txt)
316
- test.set_phase_rc(param.name, test.rc)
317
- test.add_phase_reason(param.name, test.reason)
318
- if test.rc == TEST_FAILED:
319
- field_functionality_pass_fail_print(test, 'phase', phase)
320
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
321
-
322
- # Analysing rx_brg_ performance as receiver
323
- tx_brg_tx_cycles = max(tx_brg_signal_indicator_cycle, rx_brg_signal_indicator_cycle) / tx_brg_signal_indicator_cycle
324
- expected_signal_ind_pkts = int(expected_signal_ind_pkts_calc(tx_brg_, rx_brg_) * tx_brg_tx_cycles)
325
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
326
- txt = f"""Phase {phase} - BRG {rx_brg_.id_str} signal indicator packets:
327
- received {len(received_signal_ind_pkts)} packets, expected {expected_signal_ind_pkts} packets"""
328
- print(txt)
329
- if (not len(received_signal_ind_pkts) or
330
- len(received_signal_ind_pkts) < expected_signal_ind_pkts or
331
- len(received_signal_ind_pkts) > expected_signal_ind_pkts):
332
- test.rc = TEST_FAILED
333
- test.add_reason(txt)
334
- test.set_phase_rc(param.name, test.rc)
335
- test.add_phase_reason(param.name, test.reason)
336
- if test.rc == TEST_FAILED:
337
- field_functionality_pass_fail_print(test,'phase',phase)
338
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
339
- field_functionality_pass_fail_print(test, 'phase', phase)
340
-
341
- phase = 5 if not test.internal_brg else 4
342
- functionality_run_print(f"phase {phase}")
343
- # for internal_brg this is phase 4 !!!!!!!!!!!!!!!!
344
- # Phase 5 - Tx BRG without rx. just waiting for packets to be sent from the transmitter and verify
345
- # The receiver isn't receiving any signal indicator packets.
346
- tx_signal_ind_cycle, tx_signal_ind_rep = get_phase_tx_params_values(5, TX_BRG_IDX)
347
- utPrint(f"TX BRG without RX - cycle = {tx_signal_ind_cycle}, repetition = {tx_signal_ind_rep}\n", "BLUE")
348
- # restore default configuration for receiver #
349
- utPrint(f"Configuring BRG {rx_brg_.id_str} to default", "BOLD")
350
- restore_modules = [modules[1]] if (test.internal_brg) else modules
351
- test = cert_config.config_brg1_defaults(test, modules=restore_modules, ble5=True)[0]
352
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
353
- if test.rc == TEST_FAILED and test.exit_on_param_failure:
354
- test.add_reason(f"BRG {rx_brg_.id_str}: didn't revert to default configuration!")
355
- test.set_phase_rc(param.name, test.rc)
356
- test.add_phase_reason(param.name, test.reason)
357
- return terminate_test(test, phase=phase, revert_rx_brg=True,revert_tx_brg=True, modules=modules)
358
- # configuring transmitter #
359
- utPrint(f"Configuring BRG {tx_brg_.id_str} as Signal Indicator Transmitter", "BOLD")
360
- transmitter_cfg_pkt = WltPkt(hdr=DEFAULT_HDR, pkt=tx_module(seq_id=random.randrange(99), brg_mac=tx_brg_.id_int,
361
- signal_indicator_cycle=tx_signal_ind_cycle, signal_indicator_rep=tx_signal_ind_rep))
362
- cert_config.brg_configure_ble5(test=test, cfg_pkt=transmitter_cfg_pkt, wait=False)
363
- print_update_wait(BLE4_BROADCAST_DURATION) # BLE5 configuration can take up to BLE4_BROADCAST_DURATION sec
364
-
365
- # phase analysis #
366
- mqtt_scan_n_create_log_file(test, (NUM_OF_SCANNING_CYCLE*tx_signal_ind_cycle) + SCAN_DELAY_TIME, phase, value=param.value)
367
- expected_signal_ind_pkts = 0
368
- received_signal_ind_pkts = get_all_signal_ind_pkt(test=test, rx_brg=rx_brg_, tx_brg=tx_brg_)
369
- if len(received_signal_ind_pkts) != expected_signal_ind_pkts:
370
- test.rc = TEST_FAILED
371
- test.add_reason(f"Phase {phase} failed - received signal indicator packet from BRG"
372
- f"{rx_brg_.id_str}")
373
- test.set_phase_rc(param.name, test.rc)
374
- test.add_phase_reason(param.name, test.reason)
375
- field_functionality_pass_fail_print(test, 'phase', phase)
376
- if test.rc == TEST_FAILED:
377
- return terminate_test(test, phase=phase, revert_rx_brg=False, revert_tx_brg=True, modules=modules)
378
-
379
- # Revert bridges to BLE4 before next loop
380
- utPrint(f"reverting rx_brg {test.brg1.id_str} to defaults\n", "BOLD")
381
- test, response = cert_config.config_brg1_defaults(test, modules=[datapath_module], ble5=True)
382
- if response == NO_RESPONSE and test.exit_on_param_failure:
383
- test.rc = TEST_FAILED
384
- test.add_reason(f"BRG {test.brg1.id_str} didn't revert datapath_module to default configuration!")
385
-
386
- utPrint(f"reverting tx_brg {test.brg0.id_str} to defaults\n", "BOLD")
387
- test, response = cert_config.config_brg_defaults(test, modules=[datapath_module], ble5=True)
388
- if response == NO_RESPONSE and test.exit_on_param_failure:
389
- test.rc = TEST_FAILED
390
- test.add_reason(f"BRG {test.brg0.id_str} didn't revert datapath module to default configuration!")
391
-
392
- # Save the param result and reset the test result
393
- test.set_phase_rc(param.name, test.rc)
394
- test.add_phase_reason(param.name, test.reason)
395
- test.reset_result()
396
-
397
- # Test epilog
398
- return terminate_test(test, phase=phase, revert_rx_brg=True, revert_tx_brg=True, modules=modules)