wiliot-certificate 1.4.0a1__py3-none-any.whl → 1.5.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 (77) hide show
  1. brg_certificate/ag/energous_v0_defines.py +12 -12
  2. brg_certificate/ag/energous_v1_defines.py +12 -12
  3. brg_certificate/ag/energous_v2_defines.py +12 -12
  4. brg_certificate/ag/energous_v3_defines.py +12 -12
  5. brg_certificate/ag/energous_v4_defines.py +12 -12
  6. brg_certificate/ag/fanstel_lan_v0_defines.py +12 -12
  7. brg_certificate/ag/fanstel_lte_v0_defines.py +12 -12
  8. brg_certificate/ag/fanstel_wifi_v0_defines.py +12 -12
  9. brg_certificate/ag/minew_lte_v0_defines.py +12 -12
  10. brg_certificate/ag/wlt_cmd_if.html +1 -1
  11. brg_certificate/ag/wlt_types.html +3 -3
  12. brg_certificate/ag/wlt_types_ag.py +12 -12
  13. brg_certificate/brg_certificate.py +9 -6
  14. brg_certificate/cert_common.py +21 -13
  15. brg_certificate/cert_config.py +1 -1
  16. brg_certificate/cert_defines.py +21 -3
  17. brg_certificate/cert_gw_sim.py +6 -4
  18. brg_certificate/cert_mqtt.py +8 -2
  19. brg_certificate/cert_prints.py +7 -5
  20. brg_certificate/cert_protobuf.py +5 -1
  21. brg_certificate/cert_results.py +99 -69
  22. brg_certificate/cert_utils.py +10 -14
  23. brg_certificate/restore_brg.py +2 -0
  24. brg_certificate/tests/calibration/interval_test/interval_test.py +1 -1
  25. brg_certificate/tests/calibration/output_power_test/output_power_test.py +1 -1
  26. brg_certificate/tests/calibration/pattern_test/pattern_test.py +1 -1
  27. brg_certificate/tests/datapath/adaptive_pacer_algo_test/adaptive_pacer_algo_test.py +4 -4
  28. brg_certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +2 -2
  29. brg_certificate/tests/datapath/output_power_test/output_power_test.py +1 -1
  30. brg_certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +1 -1
  31. brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +2 -2
  32. brg_certificate/tests/datapath/pacer_interval_test/pacer_interval_test.py +1 -1
  33. brg_certificate/tests/datapath/pattern_test/pattern_test.py +1 -1
  34. brg_certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +1 -1
  35. brg_certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +1 -1
  36. brg_certificate/tests/datapath/pkt_filter_test/pkt_filter_test.py +1 -1
  37. brg_certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +1 -1
  38. brg_certificate/tests/datapath/rx_channel_test/rx_channel_test.py +1 -1
  39. brg_certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +1 -1
  40. brg_certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +1 -1
  41. brg_certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +2 -2
  42. brg_certificate/tests/datapath/stress_test/stress_test.py +2 -2
  43. brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +1 -1
  44. brg_certificate/tests/datapath/tx_repetition_test/tx_repetition_test.py +1 -1
  45. brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +4 -4
  46. brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +1 -1
  47. brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +1 -1
  48. brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +1 -1
  49. brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +1 -1
  50. brg_certificate/tests/edge_mgmt/stat_test/stat_test.py +1 -1
  51. brg_certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.py +1 -1
  52. brg_certificate/tests/energy2400/output_power_test/output_power_test.py +1 -1
  53. brg_certificate/tests/energy2400/pattern_test/pattern_test.py +1 -1
  54. brg_certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +1 -1
  55. brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +1 -1
  56. brg_certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +1 -1
  57. brg_certificate/tests/energy_sub1g/pattern_test/pattern_test.py +1 -1
  58. brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +1 -1
  59. brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +1 -1
  60. brg_certificate/wltPb_pb2.py +50 -38
  61. brg_certificate/wltPb_pb2.pyi +32 -32
  62. brg_certificate/wlt_types.py +4 -6
  63. common/wlt_logo.png +0 -0
  64. gw_certificate/ag/ut_defines.py +4 -1
  65. gw_certificate/cert_results.py +138 -0
  66. gw_certificate/gw_certificate.py +20 -6
  67. gw_certificate/interface/mqtt.py +1 -0
  68. gw_certificate/interface/uart_if.py +1 -1
  69. gw_certificate/tests/actions.py +0 -1
  70. gw_certificate/tests/connection.py +1 -1
  71. gw_certificate/tests/generic.py +43 -17
  72. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/METADATA +6 -4
  73. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/RECORD +77 -75
  74. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/top_level.txt +1 -0
  75. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/LICENSE +0 -0
  76. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/WHEEL +0 -0
  77. {wiliot_certificate-1.4.0a1.dist-info → wiliot_certificate-1.5.0a1.dist-info}/entry_points.txt +0 -0
@@ -7433,21 +7433,21 @@ class ModuleExtSensorsV7():
7433
7433
  self.unused2 = d[14]
7434
7434
 
7435
7435
  class ModuleCustomV12():
7436
- def __init__(self, raw='', module_type=MODULE_CUSTOM, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, state_threshold=LIS2DW12_DEFAULTS_STATE_THRESHOLD, wake_up_duration=LIS2DW12_DEFAULTS_WAKE_UP_DURATION, sleep_duration=LIS2DW12_DEFAULTS_SLEEP_DURATION, unused1=0):
7436
+ def __init__(self, raw='', module_type=MODULE_CUSTOM, msg_type=BRG_MGMT_MSG_TYPE_CFG_SET, api_version=API_VERSION_V12, seq_id=0, brg_mac=0, motion_sensitivity_threshold=LIS2DW12_DEFAULTS_STATE_THRESHOLD, s2d_transition_time=LIS2DW12_DEFAULTS_WAKE_UP_DURATION, d2s_transition_time=LIS2DW12_DEFAULTS_SLEEP_DURATION, unused1=0):
7437
7437
  self.module_type = module_type
7438
7438
  self.msg_type = msg_type
7439
7439
  self.api_version = api_version
7440
7440
  self.seq_id = seq_id
7441
7441
  self.brg_mac = brg_mac
7442
- self.state_threshold = state_threshold # 31 [mg] resolution
7443
- self.wake_up_duration = wake_up_duration # 3 [sec] resolution
7444
- self.sleep_duration = sleep_duration # 5 [sec] resolution
7442
+ self.motion_sensitivity_threshold = motion_sensitivity_threshold # 31 [mg] resolution
7443
+ self.s2d_transition_time = s2d_transition_time # 3 [sec] resolution
7444
+ self.d2s_transition_time = d2s_transition_time # 5 [sec] resolution
7445
7445
  self.unused1 = unused1
7446
7446
  if raw:
7447
7447
  self.set(raw)
7448
7448
 
7449
7449
  def __repr__(self) -> str:
7450
- return "\n==> Packet module_custom_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['state_threshold', f"0x{self.state_threshold:X} ({self.state_threshold})"],['wake_up_duration', f"0x{self.wake_up_duration:X} ({self.wake_up_duration})"],['sleep_duration', f"0x{self.sleep_duration:X} ({self.sleep_duration})"]], tablefmt="texttable")
7450
+ return "\n==> Packet module_custom_v12 <==\n" + tabulate.tabulate([['module_type', f"0x{self.module_type:X} ({self.module_type})"],['msg_type', f"0x{self.msg_type:X} ({self.msg_type})"],['api_version', f"0x{self.api_version:X} ({self.api_version})"],['seq_id', f"0x{self.seq_id:X} ({self.seq_id})"],['brg_mac', f"0x{self.brg_mac:X} ({self.brg_mac})"],['motion_sensitivity_threshold', f"0x{self.motion_sensitivity_threshold:X} ({self.motion_sensitivity_threshold})"],['s2d_transition_time', f"0x{self.s2d_transition_time:X} ({self.s2d_transition_time})"],['d2s_transition_time', f"0x{self.d2s_transition_time:X} ({self.d2s_transition_time})"]], tablefmt="texttable")
7451
7451
 
7452
7452
  def __eq__(self, other):
7453
7453
  if other and set(other.__dict__.keys()) == set(self.__dict__.keys()):
@@ -7456,14 +7456,14 @@ class ModuleCustomV12():
7456
7456
  self.msg_type == other.msg_type and
7457
7457
  self.api_version == other.api_version and
7458
7458
  self.brg_mac == other.brg_mac and
7459
- self.state_threshold == other.state_threshold and
7460
- self.wake_up_duration == other.wake_up_duration and
7461
- self.sleep_duration == other.sleep_duration
7459
+ self.motion_sensitivity_threshold == other.motion_sensitivity_threshold and
7460
+ self.s2d_transition_time == other.s2d_transition_time and
7461
+ self.d2s_transition_time == other.d2s_transition_time
7462
7462
  )
7463
7463
  return False
7464
7464
 
7465
7465
  def dump(self):
7466
- string = bitstruct.pack("u4u4u8u8u48u8u8u8u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, ((self.state_threshold-0)//31), ((self.wake_up_duration-0)//3), ((self.sleep_duration-0)//5), self.unused1)
7466
+ string = bitstruct.pack("u4u4u8u8u48u8u8u8u96", self.module_type, self.msg_type, self.api_version, self.seq_id, self.brg_mac, ((self.motion_sensitivity_threshold-0)//31), ((self.s2d_transition_time-0)//3), ((self.d2s_transition_time-0)//5), self.unused1)
7467
7467
  return string.hex().upper()
7468
7468
 
7469
7469
  def set(self, string):
@@ -7473,9 +7473,9 @@ class ModuleCustomV12():
7473
7473
  self.api_version = d[2]
7474
7474
  self.seq_id = d[3]
7475
7475
  self.brg_mac = d[4]
7476
- self.state_threshold = ((d[5]*31)+0)
7477
- self.wake_up_duration = ((d[6]*3)+0)
7478
- self.sleep_duration = ((d[7]*5)+0)
7476
+ self.motion_sensitivity_threshold = ((d[5]*31)+0)
7477
+ self.s2d_transition_time = ((d[6]*3)+0)
7478
+ self.d2s_transition_time = ((d[7]*5)+0)
7479
7479
  self.unused1 = d[8]
7480
7480
 
7481
7481
  class ModuleCustomV11():
@@ -3,7 +3,7 @@
3
3
  import sys
4
4
  import os
5
5
  sys.path.insert(0, os.path.abspath(".."))
6
- import argparse
6
+ import webbrowser
7
7
  import glob
8
8
  import datetime
9
9
  import tabulate
@@ -156,7 +156,7 @@ def main(args):
156
156
  test.update_overall_rc()
157
157
  if test.rc == TEST_FAILED:
158
158
  failures += 1
159
- if "versions_test" in test.module_name and "EXITING UT" in test.reason:
159
+ if "versions_test" in test.module_name and f"EXITING CERTIFICATE" in test.reason:
160
160
  exit_on_test_failure = True
161
161
  print(f"Test Duration: {test.duration}")
162
162
  print(tabulate.tabulate([[i+1, i+1-(failures+skipped), skipped, failures, len(tests)]],
@@ -177,12 +177,15 @@ def main(args):
177
177
  print(tabulate.tabulate([[i+1, i+1-(failures+skipped), skipped, failures, len(tests)]],
178
178
  headers=["FINISHED", "PASSED", "SKIPPED", "FAILED", "TOTAL"], tablefmt="pretty"))
179
179
 
180
- print(WIL_UT_TEXT)
180
+ print(WIL_CERT_TEXT)
181
181
  print_warn(get_important_tests_info())
182
- print_pass_or_fail(not failures, "Wiliot UT")
182
+ print_pass_or_fail(not failures, f"Wiliot Certificate")
183
183
 
184
- cert_results.generate_results_files(html=True, pdf=True, failures=failures, skipped=skipped, duration=duration, brg_version=brg_version,
185
- tests=tests, pipeline=cert_common.pipeline_running())
184
+ pipeline = cert_common.pipeline_running()
185
+ cert_results.generate_results_files(html=True, pdf=True, failures=failures, skipped=skipped, start_time=start_time, duration=duration, brg_version=brg_version,
186
+ brg=args.brg, gw_ble_version = gw_version[BLE_VERSION], gw_ble_mac = internal_brg.id_str, tests=tests, pipeline=pipeline)
187
+ if not pipeline:
188
+ webbrowser.open('file://' + os.path.realpath(os.path.join(BASE_DIR, UT_RESULT_FILE_PDF)))
186
189
 
187
190
  if failures:
188
191
  sys.exit(-1)
@@ -13,7 +13,7 @@ import math, random
13
13
  DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
14
14
 
15
15
  # Returns a 12 chars long hex string
16
- int2mac_get = lambda int_val: "{:012X}".format(int_val)
16
+ int2mac_get = lambda int_val: f"{int_val:012X}"
17
17
 
18
18
  def name_to_val(name):
19
19
  return globals()[name]
@@ -35,8 +35,8 @@ def test_prolog(test):
35
35
  test.mqttc.flush_pkts()
36
36
 
37
37
  #TODO - remove/check status later on in the test
38
- test.set_phase_rc(PROLOG, rc=test.rc)
39
- test.add_phase_reason(PROLOG, reason=test.reason)
38
+ test.set_phase_rc(PRE_CONFIG, rc=test.rc)
39
+ test.add_phase_reason(PRE_CONFIG, reason=test.reason)
40
40
  #
41
41
 
42
42
  return test
@@ -59,37 +59,37 @@ def test_epilog(test, revert_brgs=False, revert_gws=False, modules=[], brg1_modu
59
59
  test.add_phase_reason(TEST_BODY, test.reason)
60
60
 
61
61
  test.reset_result()
62
- test.set_phase_rc(EPILOG, TEST_PASSED)
62
+ test.set_phase_rc(RESTORE_CONFIG, TEST_PASSED)
63
63
 
64
64
  if revert_brgs:
65
65
  res2 = DONE
66
66
  test, res = cert_config.config_brg_defaults(test, modules=modules, ble5=ble5)
67
67
  # TODO - REMOVE when rc is re-designed
68
- test.set_phase_rc(EPILOG, test.rc)
68
+ test.set_phase_rc(RESTORE_CONFIG, test.rc)
69
69
  test.reset_result()
70
70
  #
71
71
  if test.brg1 and test.multi_brg:
72
72
  brg1_modules = modules if not brg1_modules else brg1_modules
73
73
  test, res2 = cert_config.config_brg1_defaults(test, modules=brg1_modules)
74
74
  # TODO - REMOVE when rc is re-designed
75
- test.set_phase_rc(EPILOG, test.rc)
75
+ test.set_phase_rc(RESTORE_CONFIG, test.rc)
76
76
  test.reset_result()
77
77
  #
78
78
  if res == NO_RESPONSE or res2 == NO_RESPONSE:
79
79
  txt = "Failed: Revert BRGs to defaults"
80
80
  utPrint(txt, "RED")
81
- test.add_phase_reason(EPILOG, txt)
81
+ test.add_phase_reason(RESTORE_CONFIG, txt)
82
82
 
83
83
  if revert_gws:
84
84
  test, res = cert_config.config_gw_defaults(test)
85
85
  # TODO - REMOVE when rc is re-designed
86
- test.set_phase_rc(EPILOG, test.rc)
86
+ test.set_phase_rc(RESTORE_CONFIG, test.rc)
87
87
  test.reset_result()
88
88
  #
89
89
  if res == NO_RESPONSE:
90
90
  txt = "Failed: Revert GW to defaults"
91
91
  utPrint(txt, "RED")
92
- test.add_phase_reason(EPILOG, txt)
92
+ test.add_phase_reason(RESTORE_CONFIG, txt)
93
93
 
94
94
  test.mqttc.flush_pkts()
95
95
  test.end_time = datetime.datetime.now()
@@ -101,7 +101,7 @@ def test_epilog(test, revert_brgs=False, revert_gws=False, modules=[], brg1_modu
101
101
  and test.get_phase_rc(TEST_BODY) == TEST_FAILED):
102
102
  print("Setting rc to TEST_PASSED for pipeline after BRG OTA succeeded")
103
103
  test.set_phase_rc(TEST_BODY, TEST_PASSED)
104
- test.set_phase_rc(EPILOG, TEST_PASSED)
104
+ test.set_phase_rc(RESTORE_CONFIG, TEST_PASSED)
105
105
 
106
106
  test_epilog_print(test)
107
107
  return test
@@ -259,7 +259,11 @@ time_in_sec = lambda t : t.seconds + t.microseconds / 1000000
259
259
 
260
260
  def get_all_brg_pkts(test):
261
261
  utPrint(f"Collecting all BRG pkts", "BLUE")
262
- return cert_mqtt.get_unified_data_pkts(test)
262
+ return cert_mqtt.get_unified_data_pkts(test, only_active_brg=True)
263
+
264
+ def get_all_brgs_pkts(test):
265
+ utPrint(f"Collecting all BRG pkts", "BLUE")
266
+ return cert_mqtt.get_unified_data_pkts(test, only_active_brg=False)
263
267
 
264
268
  def get_pkts_data_frame(test, gw_data=False, brg_data=False, per_pkt_type=False):
265
269
  pkts = []
@@ -591,7 +595,7 @@ def display_data(df, csv=True, nfpkt=False, pkt_cntr_diff=False, cer_per_tag=Fal
591
595
  f.write(g.to_html(full_html=False, include_plotlyjs='cdn', include_mathjax='cdn'))
592
596
  f.write("<br>")
593
597
  if csv:
594
- df.to_csv(os.path.join(dir, f"{name_prefix}all_data.csv"), index=False)
598
+ df.to_csv(os.path.join(BASE_DIR, dir, f"{name_prefix}all_data.csv"), index=False)
595
599
 
596
600
  return ttfp_graph
597
601
 
@@ -599,7 +603,11 @@ def single_log_search(test, s, found, fail_on_find=False, print_logs=True, addit
599
603
  res = False
600
604
  for p in test.mqttc._userdata[PKTS].status:
601
605
  if GW_LOGS in p.body:
602
- logs = p.body[GW_LOGS][LOGS] if test.protobuf else p.body[GW_LOGS]
606
+ if test.protobuf and p.body[GW_LOGS]:
607
+ # handle protobuf structure (when GW_LOGS is not empty)
608
+ logs = p.body[GW_LOGS][LOGS]
609
+ else:
610
+ logs = p.body[GW_LOGS]
603
611
  for log in logs:
604
612
  if any([s in log]) and any([additional_log in log]) and (log not in found):
605
613
  print(f"Log: {log}, Additional Log: {additional_log}")
@@ -87,7 +87,7 @@ def create_gw_downlink_pkt(test, raw_tx_data="", is_ota=False, version="", max_d
87
87
 
88
88
  def get_default_gw_dict(test=None):
89
89
  return dict({WLT_SERVER: test.server if test else PROD, GW_MODE: BLE_WIFI, USE_STAT_LOC: False,
90
- SERIALIZATION_FORMAT: PROTOBUF})
90
+ SERIALIZATION_FORMAT: PROTOBUF, ACL:dict({ACL_MODE: ACL_DENY , ACL_BRIDGE_IDS:[]})})
91
91
 
92
92
  def config_gw_defaults(test, version=""):
93
93
  utPrint(f"Configuring gateway {test.gw} to defaults", "BLUE")
@@ -1,7 +1,13 @@
1
1
  # Files
2
2
  import os
3
+ import importlib.metadata
3
4
  # BASE_DIR should be initiated in the same dir as brg_certificate.py
4
5
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
6
+ # CERT_VERSION handling - local/PyPi
7
+ if "wiliot-certificate" in importlib.metadata.packages_distributions():
8
+ CERT_VERSION = importlib.metadata.version("wiliot-certificate")
9
+ else:
10
+ CERT_VERSION = "local-dev"
5
11
  CERT_MQTT_LOG_FILE = "cert_mqtt_log.json"
6
12
  DATA_SIM_LOG_FILE = "data_sim_log.txt"
7
13
  UT_RESULT_FILE_HTML = "results.html"
@@ -60,6 +66,15 @@ PROD = "prod"
60
66
  SERIALIZATION_FORMAT = "serializationFormat"
61
67
  PROTOBUF = "Protobuf"
62
68
  JSON = "JSON"
69
+ ACL = "accessControlList"
70
+ ACL_MODE = "mode"
71
+ ACL_MODE_ALLOW = "mode_allow"
72
+ ACL_BRIDGE_IDS = "bridgeIds"
73
+ ACL_IDS = "ids"
74
+ ACL_DENY = "deny"
75
+ ACL_ALLOW = "allow"
76
+ ACL_DENY_VALUE = 0
77
+ ACL_ALLOW_VALUE = 1
63
78
 
64
79
  GET_INFO_ACTION = "getGwInfo"
65
80
  REBOOT_GW_ACTION = "rebootGw"
@@ -81,6 +96,7 @@ TRANPARENT_PKT_LEN = 31 * 2
81
96
 
82
97
  # Simulator defines
83
98
  GW_SIM_BLE_MAC_ADDRESS = 'GW_SIM_BLE_MAC_ADDRESS'
99
+ GW_APP_VERSION_HEADER = 'WILIOT_GW_BLE_CHIP_SW_VER'
84
100
  GW_SIM_PREFIX = 'SIM'
85
101
  DATA_SIMULATION = 'sim'
86
102
  DATA_REAL_TAGS = 'tags'
@@ -135,6 +151,8 @@ NUM_VAL = "numberValue"
135
151
  GW_STATUS = "gatewayStatus"
136
152
  BRG_UPGRADE = "bridgeUpgrade"
137
153
  REBOOT_PKT = "rebootPacket"
154
+ CONFIG = "config"
155
+ ACL_VALUE = "aclValue"
138
156
 
139
157
  # Custom broker
140
158
  CUSTOM_BROKER_ENABLE = "customBroker"
@@ -197,6 +215,7 @@ GW_LONGITUDE_DEFAULT = -117.0839
197
215
  # Set to work with default when versions tests only pass through new api ver
198
216
  GW_API_VER_DEFAULT = "201"
199
217
  GW_API_VER_OLD = "200"
218
+ GW_API_VER_LATEST = "205"
200
219
  BRG_CFG_HAS_LEN = 2
201
220
  CLEAR_DATA_PATH_TIMEOUT = 10
202
221
  ACTION_LONG_TIMEOUT = 120
@@ -216,7 +235,6 @@ TEST_SKIPPED = 1
216
235
  TEST_INIT = 2
217
236
  NO_RESPONSE = "NO_RESPONSE"
218
237
  DONE = "DONE"
219
- TEST_SUCCESS = ":)"
220
238
  MGMT_PKT = "mgmt_pkt"
221
239
  UNIFIED_PKT = "unified_pkt"
222
240
  SIDE_INFO_SENSOR_PKT = "side_info_sensor_pkt"
@@ -240,9 +258,9 @@ TEST = "test"
240
258
  MULTI_BRG_TEST = "multiBridgeTest" # used for multi brg tests
241
259
  GW_ONLY_TEST = "gwOnlyTest" # used for gw only tests
242
260
  ALL_SUPPORTED_VALUES = "allSupportedValues"
243
- PROLOG = "Prolog"
261
+ PRE_CONFIG = "Pre config"
244
262
  TEST_BODY = "Test Body"
245
- EPILOG = "Epilog"
263
+ RESTORE_CONFIG = "Restore config"
246
264
 
247
265
  # test reasons
248
266
  NO_PARAMS_GIVEN = "No parameters given!"
@@ -13,7 +13,6 @@ import brg_certificate.cert_utils as cert_utils
13
13
 
14
14
  # Generic Defines
15
15
  SERIAL_TIMEOUT = 0.1 # TODO decide about the right value
16
- GW_APP_VERSION_HEADER = 'WILIOT_GW_BLE_CHIP_SW_VER'
17
16
  STOP_ADVERTISING = '!stop_advertising'
18
17
  RESET_GW = '!reset'
19
18
  DEDUPLICATION_PKTS = '!deduplication_pkts'
@@ -82,12 +81,13 @@ def prep_gw(args, mqttc, start_time):
82
81
  gw = args.gw
83
82
  protobuf = False
84
83
  internal_brg_mac_addr = os.getenv(GW_SIM_BLE_MAC_ADDRESS)
84
+ internal_brg_ble_ver = os.getenv(GW_APP_VERSION_HEADER)
85
85
  if not internal_brg_mac_addr:
86
86
  cert_utils.handle_error(f"ERROR: Didn't receive {GW_SIM_BLE_MAC_ADDRESS} response!", start_time)
87
87
  internal_brg = cert_utils.ut_prep_brg(args, mqttc, start_time, gw, internal_brg_mac_addr, "prod", protobuf)
88
88
  if internal_brg.api_version != ag.API_VERSION_LATEST:
89
89
  cert_utils.handle_error(f"ERROR: Certificate FW api_version={internal_brg.api_version} instead of api_version={ag.API_VERSION_LATEST}! Please upgrade the FW!", start_time)
90
- return gw, internal_brg, "prod", {BLE_VERSION:"0.0.0", WIFI_VERSION:"0.0.0"}, protobuf
90
+ return gw, internal_brg, "prod", {BLE_VERSION:internal_brg_ble_ver, WIFI_VERSION:"0.0.0"}, protobuf
91
91
 
92
92
  ##############################################
93
93
  # UART FUNCTIONS
@@ -113,9 +113,10 @@ def gw_app_reponse(ble_serial):
113
113
  input = read_from_ble(ble_serial)
114
114
  if GW_APP_VERSION_HEADER in input:
115
115
  print(input)
116
- ble_mac_address = re.search('WILIOT_GW_BLE_CHIP_MAC_ADDRESS=([0-9A-F]{12})', input).group(1)
116
+ ble_chip_sw_ver = re.search(r'WILIOT_GW_BLE_CHIP_SW_VER=(\d+\.\d+\.\d+)', input).group(1)
117
+ ble_mac_address = re.search(r'WILIOT_GW_BLE_CHIP_MAC_ADDRESS=([0-9A-F]{12})', input).group(1)
117
118
  print("success!")
118
- return TEST_PASSED, ble_mac_address
119
+ return TEST_PASSED, ble_mac_address, ble_chip_sw_ver
119
120
  print("failure!")
120
121
  return TEST_FAILED, ''
121
122
 
@@ -264,6 +265,7 @@ def gw_sim_run(port, gw_id, analyze_interference=False):
264
265
  print("ERROR: didn't get version response!")
265
266
  return
266
267
  os.environ[GW_SIM_BLE_MAC_ADDRESS] = gw_app_res[1]
268
+ os.environ[GW_APP_VERSION_HEADER] = gw_app_res[2]
267
269
  write_to_ble(ble_serial, STOP_ADVERTISING, sleep=2)
268
270
  write_to_ble(ble_serial, f"{CONNECTIVITY_STATUS} 1 1")
269
271
 
@@ -170,6 +170,11 @@ def on_message_protobuf(mqttc, userdata, message):
170
170
  if pb_decoded is True:
171
171
  pb_msg_dict = MessageToDict(pb_msg)
172
172
  # Align formats with JSON (bytes to hex strings)
173
+ if 'status' in message.topic:
174
+ if GW_STATUS in pb_msg_dict and ACL_IDS in pb_msg_dict[GW_STATUS][CONFIG][ACL][ACL_VALUE]:
175
+ ids_list = pb_msg_dict[GW_STATUS][CONFIG][ACL][ACL_VALUE][ACL_IDS]
176
+ for idx, id in enumerate(ids_list):
177
+ ids_list[idx] = base64.b64decode(id).hex().upper()
173
178
  if 'data' in message.topic and PACKETS in pb_msg_dict.keys():
174
179
  for idx, pkt in enumerate(pb_msg_dict[PACKETS]):
175
180
  pb_msg_dict[PACKETS][idx][PAYLOAD] = base64.b64decode(pkt[PAYLOAD]).hex().upper()
@@ -353,13 +358,14 @@ def get_brg2gw_mgmt_pkts(mqttc, test=None, mgmt_types=[]):
353
358
  pkts = [p for p in brg2gw_mgmt_pkts if test.active_brg.id_str in p[PAYLOAD]]
354
359
  return pkts
355
360
 
356
- def get_unified_data_pkts(test):
361
+ def get_unified_data_pkts(test, only_active_brg=True):
357
362
  all_unified_pkts, pkts = [], get_all_sim_data_pkts(test.mqttc) if test.data == DATA_SIMULATION else get_all_data_pkts(test.mqttc)
358
363
  for p in pkts:
359
364
  if UNIFIED_PKT in p:
360
365
  all_unified_pkts += [p]
361
366
  pkts = all_unified_pkts
362
- pkts = [p for p in all_unified_pkts if p[ALIAS_BRIDGE_ID] == test.active_brg.id_alias]
367
+ if only_active_brg:
368
+ pkts = [p for p in all_unified_pkts if p[ALIAS_BRIDGE_ID] == test.active_brg.id_alias]
363
369
  print(f"\nCollected {len(pkts)} unified data pkts")
364
370
  return pkts
365
371
 
@@ -22,11 +22,13 @@ color = lambda c, t : COLORS["BOLD"]+COLORS[c]+t+COLORS["ENDC"]
22
22
  pipeline_running = lambda : True if 'BITBUCKET_BUILD_NUMBER' in os.environ else False
23
23
  camelcase_to_title = lambda s: ' '.join(word.capitalize() for word in re.split('(?=[A-Z])', s))
24
24
  SEP = '\n' + '#'*100 + '\n'
25
- WIL_UT_TEXT = r'''
26
- __ _____ _ ___ ___ _____ _ _ _____
27
- \ \ / /_ _| | |_ _/ _ \_ _| | | | |_ _|
28
- \ \/\/ / | || |__ | | (_) || | | |_| | | |
29
- \_/\_/ |___|____|___\___/ |_| \___/ |_|
25
+ WIL_CERT_TEXT = r'''
26
+ __ _____ _ ___ ___ _____ ____ _____ ____ _____ ___ _____ ___ ____ _ _____ _____
27
+ \ \ / /_ _| | |_ _/ _ \_ _| / ___| ____| _ \_ _|_ _| ___|_ _/ ___| / \|_ _| ____|
28
+ \ \ /\ / / | || | | | | | || | | | | _| | |_) || | | || |_ | | | / _ \ | | | _|
29
+ \ V V / | || |___ | | |_| || | | |___| |___| _ < | | | || _| | | |___ / ___ \| | | |___
30
+ \_/\_/ |___|_____|___\___/ |_| \____|_____|_| \_\|_| |___|_| |___\____/_/ \_\_| |_____|
31
+
30
32
  '''
31
33
 
32
34
  hex_str2int = lambda s : int(s, 16)
@@ -39,7 +39,7 @@ def gw_cfg_pb(msg: dict):
39
39
  # Skip GW_MODE since it doesn't exist today and harm the parsing in PB
40
40
  if GW_MODE == key:
41
41
  continue
42
- pb_value = wpb.Value()
42
+ pb_value = wpb.GatewayConfigValue()
43
43
  if isinstance(val, int):
44
44
  pb_value.integerValue = val
45
45
  elif isinstance(val, float):
@@ -48,6 +48,10 @@ def gw_cfg_pb(msg: dict):
48
48
  pb_value.stringValue = val
49
49
  elif isinstance(val, bool):
50
50
  pb_value.boolValue = val
51
+ elif isinstance(val, dict) and key == ACL:
52
+ pb_value.aclValue.mode_allow = ACL_DENY_VALUE if msg[ADDITIONAL][ACL][ACL_MODE] == ACL_DENY else ACL_ALLOW_VALUE
53
+ ids_bytes = [bytes.fromhex(id) for id in msg[ADDITIONAL][ACL][ACL_BRIDGE_IDS]]
54
+ pb_value.aclValue.ids.extend(ids_bytes)
51
55
  else:
52
56
  raise ValueError(f"Unsupported value type for key '{key}': {type(val)}")
53
57
  pb_msg.gatewayConfig.config[key].CopyFrom(pb_value)