wiliot-certificate 1.3.0a1__py3-none-any.whl → 1.4.0a1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. brg_certificate/__init__.py +0 -0
  2. brg_certificate/ag/energous_v0_defines.py +925 -0
  3. brg_certificate/ag/energous_v1_defines.py +931 -0
  4. brg_certificate/ag/energous_v2_defines.py +925 -0
  5. brg_certificate/ag/energous_v3_defines.py +925 -0
  6. brg_certificate/ag/energous_v4_defines.py +925 -0
  7. brg_certificate/ag/fanstel_lan_v0_defines.py +925 -0
  8. brg_certificate/ag/fanstel_lte_v0_defines.py +925 -0
  9. brg_certificate/ag/fanstel_wifi_v0_defines.py +925 -0
  10. brg_certificate/ag/minew_lte_v0_defines.py +925 -0
  11. brg_certificate/ag/wlt_cmd_if.html +102 -0
  12. brg_certificate/ag/wlt_types.html +6114 -0
  13. brg_certificate/ag/wlt_types_ag.py +7840 -0
  14. brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +142 -0
  15. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +785 -0
  16. brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +139 -0
  17. brg_certificate/ag/wlt_types_ag_jsons/calibration.json +394 -0
  18. brg_certificate/ag/wlt_types_ag_jsons/custom.json +515 -0
  19. brg_certificate/ag/wlt_types_ag_jsons/datapath.json +672 -0
  20. brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +550 -0
  21. brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +595 -0
  22. brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +598 -0
  23. brg_certificate/ag/wlt_types_ag_jsons/interface.json +938 -0
  24. brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +1234 -0
  25. brg_certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +105 -0
  26. brg_certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +77 -0
  27. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +61 -0
  28. brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +110 -0
  29. brg_certificate/brg_certificate.py +191 -0
  30. brg_certificate/brg_certificate_cli.py +47 -0
  31. brg_certificate/cert_common.py +828 -0
  32. brg_certificate/cert_config.py +395 -0
  33. brg_certificate/cert_data_sim.py +188 -0
  34. brg_certificate/cert_defines.py +337 -0
  35. brg_certificate/cert_gw_sim.py +285 -0
  36. brg_certificate/cert_mqtt.py +373 -0
  37. brg_certificate/cert_prints.py +181 -0
  38. brg_certificate/cert_protobuf.py +88 -0
  39. brg_certificate/cert_results.py +300 -0
  40. brg_certificate/cert_utils.py +358 -0
  41. brg_certificate/certificate_sanity_test_list.txt +36 -0
  42. brg_certificate/certificate_test_list.txt +43 -0
  43. brg_certificate/config/eclipse.json +10 -0
  44. brg_certificate/config/hivemq.json +10 -0
  45. brg_certificate/config/mosquitto.json +10 -0
  46. brg_certificate/config/mosquitto.md +95 -0
  47. brg_certificate/config/wiliot-dev.json +10 -0
  48. brg_certificate/restore_brg.py +59 -0
  49. brg_certificate/tests/calibration/interval_test/interval_test.json +13 -0
  50. brg_certificate/tests/calibration/interval_test/interval_test.py +28 -0
  51. brg_certificate/tests/calibration/output_power_test/output_power_test.json +13 -0
  52. brg_certificate/tests/calibration/output_power_test/output_power_test.py +28 -0
  53. brg_certificate/tests/calibration/pattern_test/pattern_test.json +13 -0
  54. brg_certificate/tests/calibration/pattern_test/pattern_test.py +70 -0
  55. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.json +13 -0
  56. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +76 -0
  57. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +13 -0
  58. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +83 -0
  59. brg_certificate/tests/datapath/output_power_test/output_power_test.json +13 -0
  60. brg_certificate/tests/datapath/output_power_test/output_power_test.py +27 -0
  61. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +13 -0
  62. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +43 -0
  63. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +13 -0
  64. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +63 -0
  65. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +13 -0
  66. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +50 -0
  67. brg_certificate/tests/datapath/pattern_test/pattern_test.json +13 -0
  68. brg_certificate/tests/datapath/pattern_test/pattern_test.py +28 -0
  69. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +13 -0
  70. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +51 -0
  71. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +13 -0
  72. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +54 -0
  73. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +13 -0
  74. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +55 -0
  75. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +13 -0
  76. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +73 -0
  77. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.json +13 -0
  78. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +41 -0
  79. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +21 -0
  80. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +184 -0
  81. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +21 -0
  82. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +210 -0
  83. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +30 -0
  84. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +203 -0
  85. brg_certificate/tests/datapath/stress_test/stress_test.json +30 -0
  86. brg_certificate/tests/datapath/stress_test/stress_test.py +210 -0
  87. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +13 -0
  88. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +113 -0
  89. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +13 -0
  90. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +79 -0
  91. brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +13 -0
  92. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +432 -0
  93. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +13 -0
  94. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +94 -0
  95. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +13 -0
  96. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +87 -0
  97. brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +13 -0
  98. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +210 -0
  99. brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +13 -0
  100. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +83 -0
  101. brg_certificate/tests/edge_mgmt/stat_test/stat_test.json +13 -0
  102. brg_certificate/tests/edge_mgmt/stat_test/stat_test.py +48 -0
  103. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +13 -0
  104. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +26 -0
  105. brg_certificate/tests/energy2400/output_power_test/output_power_test.json +13 -0
  106. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +27 -0
  107. brg_certificate/tests/energy2400/pattern_test/pattern_test.json +13 -0
  108. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +28 -0
  109. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +13 -0
  110. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +398 -0
  111. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +13 -0
  112. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +153 -0
  113. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +13 -0
  114. brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +264 -0
  115. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +13 -0
  116. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +27 -0
  117. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.json +13 -0
  118. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +26 -0
  119. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +13 -0
  120. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +397 -0
  121. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +13 -0
  122. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +27 -0
  123. brg_certificate/wltPb_pb2.py +72 -0
  124. brg_certificate/wltPb_pb2.pyi +227 -0
  125. brg_certificate/wlt_types.py +114 -0
  126. gw_certificate/api/extended_api.py +7 -1531
  127. gw_certificate/api_if/200/data.json +106 -0
  128. gw_certificate/api_if/200/logs.json +12 -0
  129. gw_certificate/api_if/200/status.json +47 -0
  130. gw_certificate/api_if/201/data.json +98 -0
  131. gw_certificate/api_if/201/logs.json +12 -0
  132. gw_certificate/api_if/201/status.json +53 -0
  133. gw_certificate/api_if/202/data.json +83 -0
  134. gw_certificate/api_if/202/logs.json +12 -0
  135. gw_certificate/api_if/202/status.json +60 -0
  136. gw_certificate/api_if/203/data.json +85 -0
  137. gw_certificate/api_if/203/logs.json +12 -0
  138. gw_certificate/api_if/203/status.json +63 -0
  139. gw_certificate/api_if/204/data.json +85 -0
  140. gw_certificate/api_if/204/logs.json +12 -0
  141. gw_certificate/api_if/204/status.json +63 -0
  142. gw_certificate/api_if/205/data.json +85 -0
  143. gw_certificate/api_if/205/logs.json +12 -0
  144. gw_certificate/api_if/205/status.json +63 -0
  145. gw_certificate/api_if/api_validation.py +0 -2
  146. gw_certificate/common/analysis_data_bricks.py +18 -1413
  147. gw_certificate/common/debug.py +0 -21
  148. gw_certificate/common/utils.py +1 -212
  149. gw_certificate/common/utils_defines.py +0 -87
  150. gw_certificate/gw_certificate.py +9 -7
  151. gw_certificate/gw_certificate_cli.py +39 -23
  152. gw_certificate/interface/4.4.52_app.zip +0 -0
  153. gw_certificate/interface/4.4.52_sd_bl_app.zip +0 -0
  154. gw_certificate/interface/ble_simulator.py +0 -32
  155. gw_certificate/interface/if_defines.py +1 -0
  156. gw_certificate/interface/mqtt.py +96 -19
  157. gw_certificate/interface/nrfutil-linux +0 -0
  158. gw_certificate/interface/nrfutil-mac +0 -0
  159. gw_certificate/interface/nrfutil.exe +0 -0
  160. gw_certificate/interface/pkt_generator.py +0 -82
  161. gw_certificate/interface/uart_if.py +73 -43
  162. gw_certificate/templates/results.html +1 -1
  163. gw_certificate/tests/__init__.py +1 -2
  164. gw_certificate/tests/actions.py +134 -9
  165. gw_certificate/tests/connection.py +10 -5
  166. gw_certificate/tests/downlink.py +2 -4
  167. gw_certificate/tests/generic.py +62 -12
  168. gw_certificate/tests/registration.py +78 -27
  169. gw_certificate/tests/static/generated_packet_table.py +12 -48
  170. gw_certificate/tests/static/packet_table.csv +10048 -10048
  171. gw_certificate/tests/static/references.py +2 -1
  172. gw_certificate/tests/static/uplink_defines.py +0 -7
  173. gw_certificate/tests/throughput.py +7 -12
  174. gw_certificate/tests/uplink.py +83 -43
  175. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/METADATA +59 -8
  176. wiliot_certificate-1.4.0a1.dist-info/RECORD +198 -0
  177. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/WHEEL +1 -1
  178. wiliot_certificate-1.4.0a1.dist-info/entry_points.txt +3 -0
  179. wiliot_certificate-1.4.0a1.dist-info/top_level.txt +2 -0
  180. gw_certificate/interface/packet_error.py +0 -22
  181. wiliot_certificate-1.3.0a1.dist-info/RECORD +0 -51
  182. wiliot_certificate-1.3.0a1.dist-info/entry_points.txt +0 -2
  183. wiliot_certificate-1.3.0a1.dist-info/top_level.txt +0 -1
  184. {wiliot_certificate-1.3.0a1.dist-info → wiliot_certificate-1.4.0a1.dist-info}/LICENSE +0 -0
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "rx_rate_gen2",
3
+ "module": "DataPath",
4
+ "purpose": [
5
+ "Verify the accuracy of the RX rate value"
6
+ ],
7
+ "documentation": "https://community.wiliot.com/customers/s/article/Wiliot-Network-Data-Path-Module-Pacing",
8
+ "initialCondition": "Bridge set to default configuration",
9
+ "procedure": [
10
+ "mid_values - Sanity check: Generate packets with delays of 1, 5, and 0.5 seconds. Check address values 192, 243, and 128. Verify that the address value is 0 for the first packet.",
11
+ "diff_pacer - Generate packets with a 1-second delay and pacer intervals of 30 and 60. Ensure the address value remains 192.",
12
+ "min_value - Minimum value: Generate packets with a 0.1-second delay. Verify that the address value is 1.",
13
+ "max_value - Maximum value: Generate packets with a 70-second delay and a pacer interval of 80. Verify that the address value is 255.",
14
+ "diff_rate - alpha filter: Generate packets with delay 0.5 second and change to 3 second, according the delay changing verify the tolerance address value"
15
+ ],
16
+ "expectedOutcome": "verify that the address value we received matches the expected value, with a tolerance of up to five percent.",
17
+ "mandatory": 1,
18
+ "multiBridgeTest": 0,
19
+ "gwOnlyTest": 0,
20
+ "allSupportedValues": ["mid_values", "diff_pacer", "min_value", "max_value", "diff_rate"]
21
+ }
@@ -0,0 +1,184 @@
1
+
2
+ from brg_certificate.cert_prints import *
3
+ from brg_certificate.cert_defines import *
4
+ from brg_certificate.wlt_types import *
5
+ import brg_certificate.cert_common as cert_common
6
+ import brg_certificate.cert_config as cert_config
7
+ import brg_certificate.cert_data_sim as cert_data_sim
8
+ import time
9
+
10
+ def cal_scan_time(test, delay, pacer_interval):
11
+ # Calculate the scan time to ensure at least 5 packets are captured in data scan
12
+ # define the num of packet that you want to get
13
+ num_of_sending_pkt = 2 # actually it will be 3 because the first one always send
14
+ delay = delay/1000
15
+ if delay < pacer_interval :
16
+ scan_time =(pacer_interval*num_of_sending_pkt)+10
17
+ elif pacer_interval <= delay:
18
+ scan_time = (delay*num_of_sending_pkt)+10
19
+ # verify scan time value
20
+ if scan_time < (2*pacer_interval):
21
+ print(f"scan time is too low in related to pacer interval")
22
+ test.rc == TEST_FAILED
23
+ test.add_reason(f"scan time is too low in related to pacer interval value")
24
+ return test, scan_time
25
+
26
+ def scan_and_compare(test, pacer_interval, delay ,expected_address_value):
27
+ pixel_sim_thread = cert_data_sim.DataSimThread(test=test, num_of_pixels=1, duplicates=3, delay=delay, pkt_types=[0], pixels_type=GEN2)
28
+ pixel_sim_thread.start()
29
+ test, scan_time = cal_scan_time(test, delay, pacer_interval)
30
+ df = cert_common.data_scan(test, scan_time=scan_time, brg_data=(not test.internal_brg), gw_data=test.internal_brg)
31
+ pixel_sim_thread.stop()
32
+ cert_mqtt.dump_pkts(test, log="rx_rate")
33
+ cert_common.display_data(df, tbc=True, nfpkt=True, rssi=True, dir=test.dir)
34
+
35
+ if df.empty:
36
+ print(f"df is empty")
37
+ else:
38
+ df = df[[TAG_ID, TBC]]
39
+ print(f"df:\n {df}")
40
+ tag_counts = df[TAG_ID].value_counts()
41
+ print(f"Tag counts:\n{tag_counts.to_string(header=False)}")
42
+ most_common_tag = tag_counts.idxmax()
43
+ print(f"Most common tag: {most_common_tag}")
44
+ df = df[df[TAG_ID] == most_common_tag]
45
+
46
+ tag = df.iloc[0][TAG_ID]
47
+ # iloc [1:] to skip the first value of tbc_values which could be 0 sometimes.
48
+ actual_address_value = df.iloc[1:][TBC].mean() # extract the tbc value from df
49
+ print(f"\nactual address value: {actual_address_value}\nexpected address value: {expected_address_value}")
50
+ THRESHOLD_ADDRESS_VALUE = 5
51
+ # check if the actual address value is in the range of -+5 of the expected address value
52
+ if not ((expected_address_value-THRESHOLD_ADDRESS_VALUE) <= actual_address_value <= (expected_address_value+THRESHOLD_ADDRESS_VALUE)):
53
+ print(f"\n Address value for tag {tag} is {actual_address_value} when the expected value: {expected_address_value}!\n")
54
+ test.rc = TEST_FAILED
55
+ test.add_reason(f"Address value for tag {tag} is {actual_address_value} instead of {expected_address_value}!")
56
+ if test.params == [mid_values] and delay == 1000:
57
+ # checking 0 value in the first packet.
58
+ first_row = df.iloc[0][TBC]
59
+ second_row = df.iloc[1][TBC]
60
+ if first_row != 0 and second_row != 0:
61
+ test.rc = TEST_FAILED
62
+ test.add_reason(f"first tbc value is not 0 as supposed to be while sanity checking")
63
+ return test
64
+
65
+ def mid_values(test, datapath_module):
66
+ # mid values - Sanity check: Generate packets with delays of 1, 5, and 0.5 seconds. Check address values 192, 243, and 128. Verify that the address value is 0 for the first packet.
67
+ SANITY_DELAY_ADDRESS_VALUES = { 1000: 192, 5000: 243, 500: 128 }
68
+ for delay, expected_address_value in SANITY_DELAY_ADDRESS_VALUES.items():
69
+ pacer_interval = 1
70
+ test = scan_and_compare(test, pacer_interval=pacer_interval, delay=delay, expected_address_value=expected_address_value)
71
+ time.sleep(2)
72
+ return test
73
+
74
+ def diff_pacer(test, datapath_module):
75
+ # diff pacer - Generate packets with a 1-second delay and pacer intervals of 30 and 60. Ensure the address value remains 192.
76
+ SANITY_ADDRESS_VALUE = 192
77
+ PACER_INTERVAL_LIST = [30, 60]
78
+ delay = 1000 # 1 sec
79
+ for pacer_interval in PACER_INTERVAL_LIST:
80
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL], values=[pacer_interval], module=datapath_module)[0]
81
+ if test.rc ==TEST_FAILED:
82
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
83
+ return test
84
+ test = scan_and_compare(test, pacer_interval=pacer_interval, delay=delay, expected_address_value=SANITY_ADDRESS_VALUE)
85
+ time.sleep(2)
86
+ return test
87
+
88
+ def min_value(test, datapath_module):
89
+ # min_value - Minimum value: Generate packets with a 0.1-second delay. Verify that the address value is 1.
90
+ MIN_ADDRESS_VALUE = 1
91
+ pacer_interval = 1
92
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL], values=[pacer_interval], module=datapath_module)[0]
93
+ if test.rc ==TEST_FAILED:
94
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
95
+ return test
96
+ delay = 100
97
+ test = scan_and_compare(test, pacer_interval=pacer_interval ,delay=delay, expected_address_value=MIN_ADDRESS_VALUE)
98
+ time.sleep(2)
99
+ return test
100
+
101
+ def max_value(test, datapath_module):
102
+ # max value - Maximum value: Generate packets with a 70-second delay and a pacer interval of 80. Verify that the address value is 255.
103
+ MAX_ADDRESS_VALUE = 255
104
+ pacer_interval = 80
105
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL], values=[pacer_interval], module=datapath_module)[0]
106
+ if test.rc ==TEST_FAILED:
107
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
108
+ return test
109
+ delay = 70000
110
+ test = scan_and_compare(test, pacer_interval=pacer_interval ,delay=delay, expected_address_value=MAX_ADDRESS_VALUE)
111
+ time.sleep(2)
112
+ return test
113
+
114
+ def diff_rate(test, datapath_module):
115
+ # diff rate - a filter: Generate packets with delay 1 and change to 5, according the delay change test the tolerance address value
116
+ pacer_interval = 1
117
+ delay_duration = [[500, 5], [3000, 3]]
118
+ first_delay = delay_duration[0][0]
119
+ first_duration = delay_duration[0][1]
120
+ second_delay = delay_duration[1][0]
121
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL], values=[pacer_interval], module=datapath_module)[0]
122
+ if test.rc ==TEST_FAILED:
123
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
124
+ return test
125
+ pixel_sim_thread = cert_data_sim.DataSimThread(test=test, num_of_pixels=1, duplicates=2, delay=first_delay, pkt_types=[0],pixels_type=GEN2)
126
+ pixel_sim_thread.start()
127
+ time_sleep = first_duration-((first_delay/1000)/2)
128
+ print(f"time_sleep:{time_sleep}")
129
+ time.sleep(time_sleep)
130
+ pixel_sim_thread.delay = second_delay
131
+ scan_time = sum(duration for _, duration in delay_duration)+20
132
+ df = cert_common.data_scan(test, scan_time=scan_time, brg_data=(not test.internal_brg), gw_data=test.internal_brg)
133
+ pixel_sim_thread.stop()
134
+ df = df[[TAG_ID, TBC]]
135
+ print(f"df: {df}")
136
+
137
+ #NOTE: all the next code rows are specific for the values: delay 0.5 and 3, and in relation address values 128 and 235
138
+ # check if the last tbc value is as we expected for delay 3 sec we need to get 235 according to LUT table
139
+ # we define tolerance of +-2 units for address value
140
+ if df.iloc[-1][TBC] not in range(232, 237):
141
+ test.rc = TEST_FAILED
142
+ test.add_reason(f"Last tbc value is not within the range of 232 to 236 as expected with delay:{second_delay/1000} sec")
143
+
144
+ # verify the first tbc value
145
+ first_tbc = df.iloc[0][TBC]
146
+ if first_tbc not in range(123,134):
147
+ test.rc = TEST_FAILED
148
+ test.add_reason(f"tbc value of last packet before the delay change is incorrect")
149
+
150
+ # check the first change of tbc value after delay changing
151
+ second_tbc = df.iloc[1][TBC]
152
+ expected_address_value = 200
153
+ if not expected_address_value-2 <= second_tbc <= expected_address_value+2:
154
+ test.rc = TEST_FAILED
155
+ test.add_reason(f"the first change of address value is not correct, alpha filter probably is not define well")
156
+ return test
157
+
158
+ def run(test):
159
+ # "Test prolog"
160
+ datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
161
+ test = cert_common.test_prolog(test)
162
+ if test.rc == TEST_FAILED or test.reason != TEST_SUCCESS:
163
+ return cert_common.test_epilog(test)
164
+
165
+ pacer_interval =1
166
+ test = cert_config.brg_configure(test, fields=[BRG_PACER_INTERVAL], values=[pacer_interval], module=datapath_module)[0]
167
+ if test.rc ==TEST_FAILED:
168
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
169
+ return test
170
+
171
+ RX_RATE_TEST_MAP = {"mid_values": mid_values, "diff_pacer": diff_pacer, "min_value": min_value, "max_value": max_value, "diff_rate": diff_rate }
172
+ for param in test.params:
173
+ functionality_run_print(param.name)
174
+ test = RX_RATE_TEST_MAP[param.value](test, datapath_module)
175
+ generate_log_file(test, param.name)
176
+ field_functionality_pass_fail_print(test, param.name)
177
+ test.set_phase_rc(param.name, test.rc)
178
+ test.add_phase_reason(param.name, test.reason)
179
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
180
+ break
181
+ else:
182
+ test.reset_result()
183
+
184
+ return cert_common.test_epilog(test)
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "rx_rate_gen3",
3
+ "module": "DataPath",
4
+ "purpose": [
5
+ "Verify the accuracy of the RX rate value"
6
+ ],
7
+ "documentation": "https://community.wiliot.com/customers/s/article/Wiliot-Network-Data-Path-Module-Pacing",
8
+ "initialCondition": "Bridge set to default configuration",
9
+ "procedure": [
10
+ "mid_values - Sanity check: Generate packets with delays of 1, 5, and 0.5 seconds. Check address values 192, 243, and 128. Verify that the address value is 0 for the first packet.",
11
+ "diff_pacer - Generate packets with a 1-second delay and pacer intervals of 30 and 60. Ensure the address value remains 192.",
12
+ "min_value - Minimum value: Generate packets with a 0.1-second delay. Verify that the address value is 1.",
13
+ "max_value - Maximum value: Generate packets with a 70-second delay and a pacer interval of 80. Verify that the address value is 255.",
14
+ "diff_rate - alpha filter: Generate packets with delay 0.5 second and change to 3 second, according the delay changing verify the tolerance address value"
15
+ ],
16
+ "expectedOutcome": "verify that the address value we received matches the expected value, with a tolerance of up to five percent.",
17
+ "mandatory": 1,
18
+ "multiBridgeTest": 0,
19
+ "gwOnlyTest": 0,
20
+ "allSupportedValues": ["mid_values", "diff_pacer", "min_value", "max_value", "diff_rate"]
21
+ }
@@ -0,0 +1,210 @@
1
+
2
+ from brg_certificate.cert_prints import *
3
+ from brg_certificate.cert_defines import *
4
+ from brg_certificate.wlt_types import *
5
+ import brg_certificate.cert_common as cert_common
6
+ import brg_certificate.cert_config as cert_config
7
+ import brg_certificate.cert_data_sim as cert_data_sim
8
+ import time
9
+
10
+ SANITY_ADDRESS_VALUE = 192
11
+ DELAY_FOR_SANITY_1 = 1000 # 1 sec
12
+ SANITY_DELAY_ADDRESS_VALUES = { 1000: 192, 5000: 243, 500: 128 }
13
+ MIN_ADDRESS_VALUE = 1
14
+ MAX_ADDRESS_VALUE = 255
15
+ PACER_INTERVAL_LIST = [30, 60]
16
+ THRESHOLD_ADDRESS_VALUE = 5
17
+
18
+ def cal_scan_time(test, delay, pacer_interval):
19
+ # Calculate the scan time to ensure at least 5 packets are captured in data scan
20
+ # define the num of packet that you want to get
21
+ num_of_sending_pkt = 3 # actually it will be 3 because the first one always send
22
+ delay = delay/1000
23
+ if delay < pacer_interval :
24
+ scan_time =(pacer_interval*num_of_sending_pkt)+10
25
+ elif pacer_interval <= delay:
26
+ scan_time = (delay*num_of_sending_pkt)+10
27
+ # verify scan time value
28
+ if scan_time < (2*pacer_interval):
29
+ print(f"scan time is too low in related to pacer interval ")
30
+ test.rc == TEST_FAILED
31
+ test.add_reason(f"scan time is too low in related to pacer interval value")
32
+ return test, scan_time
33
+
34
+ def scan_and_compare(test, pacer_interval, delay ,expected_address_value):
35
+
36
+ pixel_sim_thread = cert_data_sim.DataSimThread(test=test, num_of_pixels=1, duplicates=3, delay=delay, pkt_types=[0], pixels_type=GEN3)
37
+ pixel_sim_thread.start()
38
+ test, scan_time = cal_scan_time(test, delay, pacer_interval)
39
+ df = cert_common.data_scan(test, brg_data=(not test.internal_brg), gw_data=test.internal_brg, scan_time=scan_time, per_pkt_type=False, pkt_filter_cfg=0, flush_pkts=True, first_pkt_is_start_time=False)
40
+ pixel_sim_thread.stop()
41
+ cert_mqtt.dump_pkts(test, log="rx_rate")
42
+ cert_common.display_data(df, tbc=True, nfpkt=True, rssi=True, dir=test.dir)
43
+
44
+ # Divided the dataframe by tag_id and continue with df's tag that has the highest number of rows.
45
+ tag_counts = df[TAG_ID].value_counts()
46
+ print(f"Tag counts:\n{tag_counts.to_string(header=False)}")
47
+ most_common_tag = tag_counts.idxmax()
48
+ print(f"Most common tag: {most_common_tag}")
49
+ df = df[df[TAG_ID] == most_common_tag]
50
+ if df.empty:
51
+ print(f"df is empty")
52
+ return test
53
+ else:
54
+ df = df[[TAG_ID, TBC, PACKET_TYPE, DATETIME]]
55
+ print(f"df:\n {df}")
56
+
57
+ tag = df.iloc[0][TAG_ID]
58
+ # extract the tbc value from df
59
+ # case we defined pkt_type = [0,1]
60
+ if df.iloc[0][TBC] == 0 and df.iloc[1][TBC] == 0:
61
+ actual_address_value = df.iloc[2:][TBC].mean()
62
+ # case we defined pkt_type = [0] or [1]
63
+ elif df.iloc[0][TBC] == 0 and df.iloc[1][TBC] != 0:
64
+ actual_address_value = df.iloc[1:][TBC].mean()
65
+ else:
66
+ actual_address_value = df.iloc[1:][TBC].mean()
67
+ print(f"\nactual_address_value: {actual_address_value}\nexpected address value: {expected_address_value}")
68
+
69
+ # check if the actual address value is in the range of 5% of the expected address value
70
+ if not ((expected_address_value-THRESHOLD_ADDRESS_VALUE) <= actual_address_value <= (expected_address_value+THRESHOLD_ADDRESS_VALUE)):
71
+ print(f"\n Address value for tag {tag} is {actual_address_value} when the expected value: {expected_address_value}!\n")
72
+ test.rc = TEST_FAILED
73
+ test.add_reason(f"Address value for tag {tag} is {actual_address_value} instead of {expected_address_value}!")
74
+
75
+ if test.params == [mid_values] and delay == 1000:
76
+ # these following lines for checking 0 value in the first packet.
77
+ first_row = df.iloc[0][TBC]
78
+ second_row = df.iloc[1][TBC]
79
+ if first_row != 0 and second_row != 0:
80
+ test.rc = TEST_FAILED
81
+ test.add_reason(f"first tbc value is not 0 as supposed to be while sanity checking")
82
+ return test
83
+
84
+ def mid_values(test, datapath_module):
85
+ # mid values - Sanity check: Generate packets with delays of 1, 5, and 0.5 seconds. Check address values 192, 243, and 128. Verify that the address value is 0 for the first packet.
86
+ for delay, expected_address_value in SANITY_DELAY_ADDRESS_VALUES.items():
87
+ pacer_interval = 1
88
+ test = scan_and_compare(test, pacer_interval=pacer_interval, delay=delay, expected_address_value=expected_address_value)
89
+ # delete comment after review - the reason for this sleep because I saw tag_id that moving from loop to loop
90
+ time.sleep(2)
91
+ return test
92
+
93
+ def diff_pacer(test, datapath_module):
94
+ # diff pacer - Generate packets with a 1-second delay and pacer intervals of 30 and 60. Ensure the address value remains 192.
95
+ delay = 1000 # 1 sec
96
+ #TODO: does it mather the configuration
97
+ fields = [BRG_PACER_INTERVAL]
98
+ for pacer_interval in PACER_INTERVAL_LIST:
99
+ test = cert_config.brg_configure(test, fields=fields, values=[pacer_interval], module=datapath_module)[0]
100
+ if test.rc ==TEST_FAILED:
101
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
102
+ return test
103
+ test = scan_and_compare(test, pacer_interval=pacer_interval, delay=delay, expected_address_value=SANITY_ADDRESS_VALUE)
104
+ time.sleep(2)
105
+ return test
106
+
107
+ def min_value(test, datapath_module):
108
+ # min value - Minimum value: Generate packets with a 0.1-second delay. Verify that the address value is 1.
109
+ pacer_interval = 1
110
+ fields = [BRG_PACER_INTERVAL]
111
+ test = cert_config.brg_configure(test, fields=fields, values=[pacer_interval], module=datapath_module)[0]
112
+ if test.rc ==TEST_FAILED:
113
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
114
+ return test
115
+ delay = 100
116
+ test = scan_and_compare(test, pacer_interval=pacer_interval ,delay=delay, expected_address_value=MIN_ADDRESS_VALUE)
117
+ time.sleep(2)
118
+ return test
119
+
120
+ def max_value(test, datapath_module):
121
+ # max value - Maximum value: Generate packets with a 70-second delay and a pacer interval of 80. Verify that the address value is 255.
122
+ pacer_interval = 80
123
+ fields = [BRG_PACER_INTERVAL]
124
+ test = cert_config.brg_configure(test, fields=fields, values=[pacer_interval], module=datapath_module)[0]
125
+ if test.rc ==TEST_FAILED:
126
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
127
+ return test
128
+ delay = 70000
129
+ test = scan_and_compare(test, pacer_interval=pacer_interval ,delay=delay, expected_address_value=MAX_ADDRESS_VALUE)
130
+ time.sleep(2)
131
+ return test
132
+
133
+ def diff_rate(test, datapath_module):
134
+ # diff rate - a filter: Generate packets with delay 1 and change to 5, according the delay change test the tolerance address value
135
+ pacer_interval = 1
136
+ delay = {500:5, 3000:30} # key=delay and value = the duration it will be activated
137
+ first_delay = list(delay.keys())[0]
138
+ first_duration = list(delay.values())[0]
139
+ second_delay = list(delay.keys())[1]
140
+ second_duration = list(delay.values())[1]
141
+
142
+ fields = [BRG_PACER_INTERVAL]
143
+ test = cert_config.brg_configure(test, fields=fields, values=[pacer_interval], module=datapath_module)[0]
144
+ if test.rc ==TEST_FAILED:
145
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
146
+ return test
147
+ pixel_sim_thread = cert_data_sim.DataSimThread(test=test, num_of_pixels=1, duplicates=3, delay=first_delay, pkt_types=[0], pixels_type=GEN3)
148
+ pixel_sim_thread.start()
149
+ time_sleep = first_duration-((first_delay/1000)/2)
150
+ print(f"sleep for {time_sleep} sec\n")
151
+ time.sleep(time_sleep)
152
+ pixel_sim_thread.delay = second_delay
153
+ print(f"changing delay value to {second_delay}\n")
154
+ scan_time = sum(delay.values())
155
+ df = cert_common.data_scan(test, scan_time=scan_time+20, brg_data=(not test.internal_brg), gw_data=test.internal_brg)
156
+ pixel_sim_thread.stop()
157
+ if df.empty:
158
+ print(f"df is empty")
159
+ return test
160
+ else:
161
+ df = df[[TAG_ID, TBC, PACKET_TYPE]]
162
+ print(f"df:\n {df}")
163
+ #NOTE: all next rows are specific for the values: delay 0.5 and 3, and in relation address values 128 and 235
164
+ #check if the last tbc value is as we expected for delay 3 sec we need to get 235 according to LUT table
165
+ # we define tolerance of +-2 units for address value
166
+ if df.iloc[-1][TBC] not in range(232, 237):
167
+ test.rc = TEST_FAILED
168
+ test.add_reason(f"Last tbc value is not within the range of 232 to 236 as expected with delay:{second_delay/1000} sec")
169
+ # verify the first tbc value
170
+ first_tbc = df.iloc[0][TBC]
171
+ if first_tbc not in range(123,136):
172
+ test.rc = TEST_FAILED
173
+ test.add_reason(f"tbc value of last packet before the delay change is wrong")
174
+
175
+ # check the first change of tbc value after delay changing
176
+ second_tbc = df.iloc[1][TBC]
177
+ expected_address_value = 200
178
+ if not expected_address_value-2 <= second_tbc <= expected_address_value+2:
179
+ test.rc = TEST_FAILED
180
+ test.add_reason(f"first change of address value is not correct, alpha filter probably is not define well")
181
+ return test
182
+
183
+ def run(test):
184
+ # "Test prolog"
185
+ datapath_module = eval_pkt(f'ModuleDatapathV{test.active_brg.api_version}')
186
+ test = cert_common.test_prolog(test)
187
+ if test.rc == TEST_FAILED or test.reason != TEST_SUCCESS:
188
+ return cert_common.test_epilog(test)
189
+
190
+ fields = [BRG_PACER_INTERVAL]
191
+ pacer_interval =1
192
+ test = cert_config.brg_configure(test, fields=fields, values=[pacer_interval], module=datapath_module)[0]
193
+ if test.rc ==TEST_FAILED:
194
+ test.add_reason(f"Didn't succeed to config pacer interval {pacer_interval}")
195
+ return test
196
+
197
+ RX_RATE_TEST_MAP = {"mid_values":mid_values, "diff_pacer":diff_pacer, "min_value": min_value, "max_value":max_value, "diff_rate":diff_rate }
198
+ for param in test.params:
199
+ functionality_run_print(param.name)
200
+ test = RX_RATE_TEST_MAP[param.value](test, datapath_module)
201
+ generate_log_file(test, param.name)
202
+ field_functionality_pass_fail_print(test, param.name)
203
+ test.set_phase_rc(param.name, test.rc)
204
+ test.add_phase_reason(param.name, test.reason)
205
+ if test.rc == TEST_FAILED and test.exit_on_param_failure:
206
+ break
207
+ else:
208
+ test.reset_result()
209
+
210
+ return cert_common.test_epilog(test)
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "stress test",
3
+ "module": "DataPath",
4
+ "purpose": [
5
+ "verify the functionality of the bridge under stress conditions",
6
+ "verify that the algorithms 'adaptive repetition' and 'adaptive pacer' are working correctly",
7
+ "verify an edge case where the repetition stable and we got a lot of packets in short time"
8
+ ],
9
+ "documentation": [
10
+ "https://community.wiliot.com/customers/s/article/Wiliot-Network-Data-Path-Module-Relaying-data",
11
+ "add more links here - about adaptive repetition, adaptive pacer"
12
+ ],
13
+ "initialCondition": "Bridge configured to defaults",
14
+ "procedure": [
15
+ "Test prolog",
16
+ "define simulation with 200 packets with 0 delay(0.02 sec) ",
17
+ "rep 3 - config pacer interval 15, then check repetition value = 3, tx_queue = 0-20, pacer increment = 0, brg latency = 0, num of tags = all tags ",
18
+ "rep 2 - config pacer interval 9, then check repetition value = 2, tx_queue = 20-40, pacer increment = 0, brg latency = 0-200, num of tags = all tags",
19
+ "rep 1 - config pacer interval 6, then check repetition value = 1, tx_queue = 40-60, pacer increment = 0, brg latency = 200-300, num of tags = all tags",
20
+ "rep 1 adaptive pacer - config pacer interval 1 , then check repetition value = 1, tx_queue > 60, pacer increment = 3 , brg latency > 300 , num of tags = all tags",
21
+ "pixels burst - config pacer interval 15, then add more 200 packets with 0 delay(0.02 sec), then check repetition value = 1 and not 2",
22
+ "Test epilog"
23
+ ],
24
+ "expectedOutcome": "all metrics values will be as expected then the bridge is working correctly and the algorithms are working correctly",
25
+ "mandatory": 1,
26
+ "multiBridgeTest": 0,
27
+ "gwOnlyTest": 0,
28
+ "allSupportedValues": ["rep3", "rep2", "rep1", "rep1_adaptive_pacer", "pixels_burst"]
29
+
30
+ }