wiliot-certificate 1.3.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 (51) hide show
  1. gw_certificate/__init__.py +0 -0
  2. gw_certificate/ag/ut_defines.py +361 -0
  3. gw_certificate/ag/wlt_types.py +85 -0
  4. gw_certificate/ag/wlt_types_ag.py +5310 -0
  5. gw_certificate/ag/wlt_types_data.py +64 -0
  6. gw_certificate/api/extended_api.py +1547 -0
  7. gw_certificate/api_if/__init__.py +0 -0
  8. gw_certificate/api_if/api_validation.py +40 -0
  9. gw_certificate/api_if/gw_capabilities.py +18 -0
  10. gw_certificate/common/analysis_data_bricks.py +1455 -0
  11. gw_certificate/common/debug.py +63 -0
  12. gw_certificate/common/utils.py +219 -0
  13. gw_certificate/common/utils_defines.py +102 -0
  14. gw_certificate/common/wltPb_pb2.py +72 -0
  15. gw_certificate/common/wltPb_pb2.pyi +227 -0
  16. gw_certificate/gw_certificate.py +138 -0
  17. gw_certificate/gw_certificate_cli.py +70 -0
  18. gw_certificate/interface/ble_simulator.py +91 -0
  19. gw_certificate/interface/ble_sniffer.py +189 -0
  20. gw_certificate/interface/if_defines.py +35 -0
  21. gw_certificate/interface/mqtt.py +469 -0
  22. gw_certificate/interface/packet_error.py +22 -0
  23. gw_certificate/interface/pkt_generator.py +720 -0
  24. gw_certificate/interface/uart_if.py +193 -0
  25. gw_certificate/interface/uart_ports.py +20 -0
  26. gw_certificate/templates/results.html +241 -0
  27. gw_certificate/templates/stage.html +22 -0
  28. gw_certificate/templates/table.html +6 -0
  29. gw_certificate/templates/test.html +38 -0
  30. gw_certificate/tests/__init__.py +11 -0
  31. gw_certificate/tests/actions.py +131 -0
  32. gw_certificate/tests/bad_crc_to_PER_quantization.csv +51 -0
  33. gw_certificate/tests/connection.py +181 -0
  34. gw_certificate/tests/downlink.py +174 -0
  35. gw_certificate/tests/generic.py +161 -0
  36. gw_certificate/tests/registration.py +288 -0
  37. gw_certificate/tests/static/__init__.py +0 -0
  38. gw_certificate/tests/static/connection_defines.py +9 -0
  39. gw_certificate/tests/static/downlink_defines.py +9 -0
  40. gw_certificate/tests/static/generated_packet_table.py +209 -0
  41. gw_certificate/tests/static/packet_table.csv +10051 -0
  42. gw_certificate/tests/static/references.py +4 -0
  43. gw_certificate/tests/static/uplink_defines.py +20 -0
  44. gw_certificate/tests/throughput.py +244 -0
  45. gw_certificate/tests/uplink.py +683 -0
  46. wiliot_certificate-1.3.0a1.dist-info/LICENSE +21 -0
  47. wiliot_certificate-1.3.0a1.dist-info/METADATA +113 -0
  48. wiliot_certificate-1.3.0a1.dist-info/RECORD +51 -0
  49. wiliot_certificate-1.3.0a1.dist-info/WHEEL +5 -0
  50. wiliot_certificate-1.3.0a1.dist-info/entry_points.txt +2 -0
  51. wiliot_certificate-1.3.0a1.dist-info/top_level.txt +1 -0
File without changes
@@ -0,0 +1,40 @@
1
+ import os
2
+ import json
3
+ from jsonschema import Draft202012Validator
4
+ import pkg_resources
5
+ from enum import Enum
6
+
7
+ from gw_certificate.ag.ut_defines import GW_CONF, GW_API_VERSION
8
+ from gw_certificate.common.debug import debug_print
9
+
10
+ class MESSAGE_TYPES(Enum):
11
+ STATUS = "status"
12
+ DATA = "data"
13
+ LOGS = "logs"
14
+
15
+ # TODO Can we use GW_API_VER_DEFAULT from ag.ut_defines instead after we auto-generate again?
16
+ LATEST_API = "205"
17
+ api_version = LATEST_API
18
+
19
+ def validate_message(message_type: MESSAGE_TYPES, message: dict) -> tuple[bool, str]:
20
+ """
21
+ Validate MQTT message
22
+ :type message_type: MESSAGE_TYPES
23
+ :param message_type: MQTT message type
24
+ :type message: dict
25
+ :param message: MQTT Message
26
+ :return: tuple (bool, str)
27
+ """
28
+ global api_version
29
+
30
+ # NOTE When Connection test is not ran (using the -tests flag), default api_version is the latest
31
+ if message_type == MESSAGE_TYPES.STATUS:
32
+ api_version = message[GW_CONF][GW_API_VERSION]
33
+ debug_print(f'API version set as {api_version} according to the status message.')
34
+ json_path = pkg_resources.resource_filename(__name__, f"{api_version}/{message_type.value}.json")
35
+ with open(json_path) as f:
36
+ relevant_schema = json.load(f)
37
+ validator = Draft202012Validator(relevant_schema)
38
+ valid = validator.is_valid(message)
39
+ errors = [e for e in validator.iter_errors(message)]
40
+ return (valid, errors)
@@ -0,0 +1,18 @@
1
+ from dataclasses import dataclass
2
+ from typing import Literal
3
+
4
+ @dataclass
5
+ class GWCapabilities:
6
+ tagMetadataCouplingSupported: bool = False
7
+ downlinkSupported: bool = False
8
+ bridgeOtaUpgradeSupported: bool = False
9
+ fwUpgradeSupported: bool = False
10
+ geoLocationSupport: bool = False
11
+
12
+ @staticmethod
13
+ def get_capabilities():
14
+ return list(GWCapabilities.__dataclass_fields__.keys())
15
+
16
+ def set_capability(self, capability, value:bool):
17
+ assert capability in GWCapabilities.get_capabilities(), f'{capability} is not a valid capability'
18
+ setattr(self, capability, value)