wiliot-certificate 4.4.3__py3-none-any.whl → 4.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {brg_certificate → certificate}/ag/wlt_cmd_if.html +10 -4
- {brg_certificate → certificate}/ag/wlt_types_ag.py +1878 -519
- certificate/cert_common.py +1488 -0
- certificate/cert_config.py +480 -0
- {brg_certificate → certificate}/cert_data_sim.py +134 -46
- {brg_certificate → certificate}/cert_defines.py +129 -128
- {brg_certificate → certificate}/cert_gw_sim.py +183 -53
- {brg_certificate → certificate}/cert_mqtt.py +179 -64
- {brg_certificate → certificate}/cert_prints.py +35 -33
- {brg_certificate → certificate}/cert_protobuf.py +15 -6
- {brg_certificate → certificate}/cert_results.py +240 -64
- certificate/cert_utils.py +634 -0
- certificate/certificate.py +205 -0
- certificate/certificate_cli.py +76 -0
- certificate/certificate_eth_test_list.txt +76 -0
- certificate/certificate_sanity_test_list.txt +66 -0
- certificate/certificate_test_list.txt +76 -0
- {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.json +3 -2
- {brg_certificate → certificate}/tests/calibration/interval_test/interval_test.py +7 -6
- certificate/tests/calibration/output_power_test/output_power_test.json +23 -0
- certificate/tests/calibration/output_power_test/output_power_test.py +39 -0
- {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.json +2 -1
- {brg_certificate → certificate}/tests/calibration/pattern_test/pattern_test.py +20 -15
- certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.json +15 -0
- certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.py +140 -0
- certificate/tests/cloud_connectivity/acl_test/acl_test.json +15 -0
- certificate/tests/cloud_connectivity/acl_test/acl_test.py +96 -0
- certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.json +19 -0
- certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.py +41 -0
- certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.json +19 -0
- certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py +215 -0
- certificate/tests/cloud_connectivity/connection_test/connection_test.json +18 -0
- certificate/tests/cloud_connectivity/connection_test/connection_test.py +67 -0
- certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.json +15 -0
- certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.py +80 -0
- certificate/tests/cloud_connectivity/downlink_test/downlink_test.json +21 -0
- certificate/tests/cloud_connectivity/downlink_test/downlink_test.py +201 -0
- certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.json +17 -0
- certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.py +104 -0
- certificate/tests/cloud_connectivity/reboot_test/reboot_test.json +18 -0
- certificate/tests/cloud_connectivity/reboot_test/reboot_test.py +59 -0
- certificate/tests/cloud_connectivity/registration_test/registration_test.json +20 -0
- certificate/tests/cloud_connectivity/registration_test/registration_test.py +384 -0
- certificate/tests/cloud_connectivity/registration_test/registration_test_cli.py +90 -0
- certificate/tests/cloud_connectivity/stress_test/stress_test.json +17 -0
- certificate/tests/cloud_connectivity/stress_test/stress_test.py +101 -0
- certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.json +25 -0
- certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.py +92 -0
- certificate/tests/cloud_connectivity/uplink_test/uplink_test.json +20 -0
- certificate/tests/cloud_connectivity/uplink_test/uplink_test.py +169 -0
- {brg_certificate → certificate}/tests/datapath/aging_test/aging_test.json +2 -1
- certificate/tests/datapath/aging_test/aging_test.py +142 -0
- certificate/tests/datapath/event_ble5_test/event_ble5_test.json +17 -0
- certificate/tests/datapath/event_ble5_test/event_ble5_test.py +89 -0
- certificate/tests/datapath/event_test/event_test.json +17 -0
- certificate/tests/datapath/event_test/event_test.py +80 -0
- {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.json +4 -3
- {brg_certificate → certificate}/tests/datapath/num_of_tags_test/num_of_tags_test.py +19 -13
- certificate/tests/datapath/output_power_test/output_power_test.json +23 -0
- {brg_certificate → certificate}/tests/datapath/output_power_test/output_power_test.py +17 -6
- {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +2 -1
- {brg_certificate → certificate}/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +13 -11
- {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.json +2 -1
- {brg_certificate → certificate}/tests/datapath/pacer_interval_test/pacer_interval_test.py +9 -7
- {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.json +3 -2
- {brg_certificate → certificate}/tests/datapath/pattern_test/pattern_test.py +18 -6
- certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.json +20 -0
- certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.py +61 -0
- {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +2 -1
- {brg_certificate → certificate}/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +15 -14
- certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.json +19 -0
- certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.py +85 -0
- {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +2 -1
- {brg_certificate → certificate}/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.py +10 -9
- {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.json +2 -1
- {brg_certificate → certificate}/tests/datapath/pkt_filter_test/pkt_filter_test.py +10 -9
- {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +3 -2
- {brg_certificate → certificate}/tests/datapath/rssi_threshold_test/rssi_threshold_test.py +9 -8
- brg_certificate/tests/datapath/output_power_test/output_power_test.json → certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.json +6 -4
- certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.py +77 -0
- {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.json +3 -2
- {brg_certificate → certificate}/tests/datapath/rx_channel_test/rx_channel_test.py +7 -6
- {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +8 -7
- {brg_certificate → certificate}/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +113 -73
- {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +8 -7
- {brg_certificate → certificate}/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.py +112 -72
- {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.json +4 -3
- {brg_certificate → certificate}/tests/datapath/stress_gen3_test/stress_gen3_test.py +15 -11
- {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.json +4 -3
- {brg_certificate → certificate}/tests/datapath/stress_test/stress_test.py +15 -11
- {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.json +3 -1
- {brg_certificate → certificate}/tests/datapath/tx_repetition_test/tx_repetition_test.py +14 -13
- certificate/tests/edge_mgmt/action_blink_test/action_blink_test.json +15 -0
- certificate/tests/edge_mgmt/action_blink_test/action_blink_test.py +24 -0
- certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.json +15 -0
- certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.py +43 -0
- certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.json +15 -0
- certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.py +42 -0
- certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.json +15 -0
- certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.py +44 -0
- certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.json +16 -0
- certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.py +42 -0
- certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.json +15 -0
- certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.py +49 -0
- certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.json +15 -0
- certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.py +102 -0
- certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.json +15 -0
- certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.py +45 -0
- {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.json +3 -2
- {brg_certificate → certificate}/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.py +22 -11
- {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.json +2 -1
- {brg_certificate → certificate}/tests/energy2400/duty_cycle_test/duty_cycle_test.py +7 -6
- certificate/tests/energy2400/output_power_test/output_power_test.json +23 -0
- {brg_certificate → certificate}/tests/energy2400/output_power_test/output_power_test.py +17 -6
- {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.json +2 -1
- {brg_certificate → certificate}/tests/energy2400/pattern_test/pattern_test.py +7 -6
- certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +26 -0
- certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +379 -0
- certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.json +20 -0
- certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.py +173 -0
- certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +24 -0
- certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +350 -0
- {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +2 -1
- {brg_certificate → certificate}/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.py +7 -6
- {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.json +2 -1
- {brg_certificate → certificate}/tests/energy_sub1g/pattern_test/pattern_test.py +7 -6
- {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +2 -1
- {brg_certificate → certificate}/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.py +10 -10
- {brg_certificate → certificate}/tests/sensors/ext_sensor_test/ext_sensor_test.json +5 -4
- certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +450 -0
- certificate/wlt_types.py +122 -0
- {gw_certificate → common}/api_if/202/status.json +6 -0
- {gw_certificate → common}/api_if/203/status.json +6 -0
- {gw_certificate → common}/api_if/204/status.json +6 -0
- common/api_if/206/data.json +85 -0
- common/api_if/206/status.json +69 -0
- common/api_if/api_validation.py +91 -0
- common/web/templates/generator.html +210 -0
- common/web/templates/index.html +20 -0
- common/web/templates/menu.html +54 -0
- common/web/templates/parser.html +53 -0
- {brg_certificate/ag → common/web/templates}/wlt_types.html +1216 -191
- common/web/web_utils.py +399 -0
- {brg_certificate → common}/wltPb_pb2.py +14 -12
- {gw_certificate/common → common}/wltPb_pb2.pyi +16 -2
- gui_certificate/gui_certificate_cli.py +14 -0
- gui_certificate/server.py +1267 -0
- gui_certificate/templates/cert_run.html +1273 -0
- wiliot_certificate-4.5.0.dist-info/METADATA +99 -0
- wiliot_certificate-4.5.0.dist-info/RECORD +168 -0
- {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0.dist-info}/WHEEL +1 -1
- wiliot_certificate-4.5.0.dist-info/entry_points.txt +5 -0
- wiliot_certificate-4.5.0.dist-info/top_level.txt +3 -0
- brg_certificate/ag/energous_v0_defines.py +0 -925
- brg_certificate/ag/energous_v1_defines.py +0 -931
- brg_certificate/ag/energous_v2_defines.py +0 -925
- brg_certificate/ag/energous_v3_defines.py +0 -925
- brg_certificate/ag/energous_v4_defines.py +0 -925
- brg_certificate/ag/fanstel_lan_v0_defines.py +0 -925
- brg_certificate/ag/fanstel_lte_v0_defines.py +0 -925
- brg_certificate/ag/fanstel_wifi_v0_defines.py +0 -925
- brg_certificate/ag/minew_lte_v0_defines.py +0 -925
- brg_certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +0 -142
- brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +0 -785
- brg_certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +0 -139
- brg_certificate/ag/wlt_types_ag_jsons/calibration.json +0 -394
- brg_certificate/ag/wlt_types_ag_jsons/custom.json +0 -515
- brg_certificate/ag/wlt_types_ag_jsons/datapath.json +0 -672
- brg_certificate/ag/wlt_types_ag_jsons/energy2400.json +0 -550
- brg_certificate/ag/wlt_types_ag_jsons/energySub1g.json +0 -595
- brg_certificate/ag/wlt_types_ag_jsons/externalSensor.json +0 -598
- brg_certificate/ag/wlt_types_ag_jsons/interface.json +0 -938
- brg_certificate/ag/wlt_types_ag_jsons/powerManagement.json +0 -1234
- brg_certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +0 -105
- brg_certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +0 -77
- brg_certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +0 -61
- brg_certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +0 -110
- brg_certificate/brg_certificate.py +0 -225
- brg_certificate/brg_certificate_cli.py +0 -63
- brg_certificate/cert_common.py +0 -923
- brg_certificate/cert_config.py +0 -402
- brg_certificate/cert_utils.py +0 -362
- brg_certificate/certificate_bcc_sanity_test_list.txt +0 -40
- brg_certificate/certificate_bcc_test_list.txt +0 -48
- brg_certificate/certificate_sanity_test_list.txt +0 -43
- brg_certificate/certificate_test_list.txt +0 -53
- brg_certificate/config/eclipse.json +0 -10
- brg_certificate/config/hivemq.json +0 -10
- brg_certificate/config/mosquitto.json +0 -10
- brg_certificate/config/mosquitto.md +0 -95
- brg_certificate/config/wiliot-dev.json +0 -10
- brg_certificate/restore_brg.py +0 -61
- brg_certificate/tests/calibration/output_power_test/output_power_test.json +0 -16
- brg_certificate/tests/calibration/output_power_test/output_power_test.py +0 -28
- brg_certificate/tests/datapath/aging_test/aging_test.py +0 -143
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.json +0 -16
- brg_certificate/tests/datapath/pacer_interval_tags_count_test/pacer_interval_tags_count_test.py +0 -73
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.json +0 -17
- brg_certificate/tests/datapath/tx_repetition_algo_test/tx_repetition_algo_test.py +0 -118
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.json +0 -14
- brg_certificate/tests/edge_mgmt/actions_test/actions_test.py +0 -396
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.json +0 -20
- brg_certificate/tests/edge_mgmt/brg2brg_ota_ble5_test/brg2brg_ota_ble5_test.py +0 -94
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.json +0 -19
- brg_certificate/tests/edge_mgmt/brg2brg_ota_test/brg2brg_ota_test.py +0 -87
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.json +0 -17
- brg_certificate/tests/edge_mgmt/leds_test/leds_test.py +0 -223
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.json +0 -17
- brg_certificate/tests/edge_mgmt/ota_test/ota_test.py +0 -128
- brg_certificate/tests/energy2400/output_power_test/output_power_test.json +0 -16
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.json +0 -20
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_250k_test/signal_indicator_ble5_10_250k_test.py +0 -321
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.json +0 -20
- brg_certificate/tests/energy2400/signal_indicator_ble5_10_500k_test/signal_indicator_ble5_10_500k_test.py +0 -321
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.json +0 -20
- brg_certificate/tests/energy2400/signal_indicator_sub1g_2_4_test/signal_indicator_sub1g_2_4_test.py +0 -141
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +0 -20
- brg_certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +0 -276
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.json +0 -20
- brg_certificate/tests/energy_sub1g/signal_indicator_functionality_test/signal_indicator_functionality_test.py +0 -390
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.json +0 -16
- brg_certificate/tests/energy_sub1g/signal_indicator_test/signal_indicator_test.py +0 -28
- brg_certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +0 -305
- brg_certificate/wltPb_pb2.pyi +0 -234
- brg_certificate/wlt_types.py +0 -113
- gw_certificate/ag/ut_defines.py +0 -364
- gw_certificate/ag/wlt_types.py +0 -85
- gw_certificate/ag/wlt_types_ag.py +0 -5310
- gw_certificate/ag/wlt_types_data.py +0 -64
- gw_certificate/api/extended_api.py +0 -23
- gw_certificate/api_if/200/data.json +0 -106
- gw_certificate/api_if/200/status.json +0 -47
- gw_certificate/api_if/201/data.json +0 -98
- gw_certificate/api_if/201/status.json +0 -53
- gw_certificate/api_if/205/logs.json +0 -12
- gw_certificate/api_if/api_validation.py +0 -38
- gw_certificate/api_if/gw_capabilities.py +0 -54
- gw_certificate/cert_results.py +0 -145
- gw_certificate/common/analysis_data_bricks.py +0 -60
- gw_certificate/common/debug.py +0 -42
- gw_certificate/common/serialization_formatter.py +0 -93
- gw_certificate/common/utils.py +0 -8
- gw_certificate/common/utils_defines.py +0 -15
- gw_certificate/common/wltPb_pb2.py +0 -84
- gw_certificate/gw_certificate.py +0 -154
- gw_certificate/gw_certificate_cli.py +0 -87
- gw_certificate/interface/4.4.93_app.zip +0 -0
- gw_certificate/interface/4.4.93_sd_bl_app.zip +0 -0
- gw_certificate/interface/ble_simulator.py +0 -61
- gw_certificate/interface/ble_sniffer.py +0 -189
- gw_certificate/interface/flash_fw.py +0 -90
- gw_certificate/interface/if_defines.py +0 -36
- gw_certificate/interface/mqtt.py +0 -563
- gw_certificate/interface/nrfutil-linux +0 -0
- gw_certificate/interface/nrfutil-mac +0 -0
- gw_certificate/interface/nrfutil.exe +0 -0
- gw_certificate/interface/pkt_generator.py +0 -594
- gw_certificate/interface/uart_if.py +0 -236
- gw_certificate/interface/uart_ports.py +0 -20
- gw_certificate/templates/results.html +0 -241
- gw_certificate/templates/stage.html +0 -22
- gw_certificate/templates/table.html +0 -6
- gw_certificate/templates/test.html +0 -38
- gw_certificate/tests/__init__.py +0 -10
- gw_certificate/tests/actions.py +0 -289
- gw_certificate/tests/bad_crc_to_PER_quantization.csv +0 -51
- gw_certificate/tests/connection.py +0 -188
- gw_certificate/tests/downlink.py +0 -172
- gw_certificate/tests/generic.py +0 -238
- gw_certificate/tests/registration.py +0 -340
- gw_certificate/tests/static/__init__.py +0 -0
- gw_certificate/tests/static/connection_defines.py +0 -9
- gw_certificate/tests/static/downlink_defines.py +0 -9
- gw_certificate/tests/static/generated_packet_table.py +0 -195
- gw_certificate/tests/static/packet_table.csv +0 -10067
- gw_certificate/tests/static/references.py +0 -5
- gw_certificate/tests/static/uplink_defines.py +0 -14
- gw_certificate/tests/throughput.py +0 -240
- gw_certificate/tests/uplink.py +0 -853
- wiliot_certificate-4.4.3.dist-info/METADATA +0 -211
- wiliot_certificate-4.4.3.dist-info/RECORD +0 -210
- wiliot_certificate-4.4.3.dist-info/entry_points.txt +0 -3
- wiliot_certificate-4.4.3.dist-info/top_level.txt +0 -3
- {brg_certificate → certificate}/__init__.py +0 -0
- {gw_certificate → common}/api_if/202/data.json +0 -0
- {gw_certificate/api_if/200 → common/api_if/202}/logs.json +0 -0
- {gw_certificate → common}/api_if/203/data.json +0 -0
- {gw_certificate/api_if/201 → common/api_if/203}/logs.json +0 -0
- {gw_certificate → common}/api_if/204/data.json +0 -0
- {gw_certificate/api_if/202 → common/api_if/204}/logs.json +0 -0
- {gw_certificate → common}/api_if/205/data.json +0 -0
- {gw_certificate/api_if/203 → common/api_if/205}/logs.json +0 -0
- {gw_certificate → common}/api_if/205/status.json +0 -0
- {gw_certificate/api_if/204 → common/api_if/206}/logs.json +0 -0
- {gw_certificate → common/api_if}/__init__.py +0 -0
- {gw_certificate/api_if → gui_certificate}/__init__.py +0 -0
- {wiliot_certificate-4.4.3.dist-info → wiliot_certificate-4.5.0.dist-info}/licenses/LICENSE +0 -0
brg_certificate/cert_common.py
DELETED
|
@@ -1,923 +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_config as cert_config
|
|
5
|
-
import brg_certificate.cert_mqtt as cert_mqtt
|
|
6
|
-
import datetime
|
|
7
|
-
# from ut_te import ut_rtsa
|
|
8
|
-
import pandas as pd
|
|
9
|
-
import os
|
|
10
|
-
import plotly.express as px
|
|
11
|
-
import math, random
|
|
12
|
-
|
|
13
|
-
DEFAULT_HDR = ag.Hdr(group_id=ag.GROUP_ID_GW2BRG)
|
|
14
|
-
|
|
15
|
-
# Returns a 12 chars long hex string
|
|
16
|
-
int2mac_get = lambda int_val: f"{int_val:012X}"
|
|
17
|
-
|
|
18
|
-
# Returns True if running with bridge with cloud connectivity, else False
|
|
19
|
-
is_bcc_running = lambda test: not (test.sim_mqttc == test.mqttc)
|
|
20
|
-
|
|
21
|
-
# Returns True if running from PyPi package, else False
|
|
22
|
-
is_cert_running = lambda : not (CERT_VERSION == LOCAL_DEV)
|
|
23
|
-
|
|
24
|
-
def name_to_val(name):
|
|
25
|
-
return globals()[name]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_prolog(test):
|
|
29
|
-
"""
|
|
30
|
-
kicks off the test:
|
|
31
|
-
- sets test start time
|
|
32
|
-
- checks to see if brg is DB for DB-only tests
|
|
33
|
-
- setups spectrum analyzer configuration if needed
|
|
34
|
-
|
|
35
|
-
:param WltTest test: test to be started
|
|
36
|
-
:return test: returns the test
|
|
37
|
-
"""
|
|
38
|
-
test.start_time = datetime.datetime.now()
|
|
39
|
-
|
|
40
|
-
test_run_print(test)
|
|
41
|
-
|
|
42
|
-
test.mqttc.flush_pkts()
|
|
43
|
-
|
|
44
|
-
#TODO - remove/check status later on in the test
|
|
45
|
-
test.set_phase_rc(PRE_CONFIG, rc=test.rc)
|
|
46
|
-
test.add_phase_reason(PRE_CONFIG, reason=test.reason)
|
|
47
|
-
#
|
|
48
|
-
|
|
49
|
-
return test
|
|
50
|
-
|
|
51
|
-
def test_epilog(test, revert_brgs=False, revert_gws=False, modules=[], brg1_modules=[], ble5=False):
|
|
52
|
-
"""
|
|
53
|
-
closes off the test:
|
|
54
|
-
- sets test end time and duration
|
|
55
|
-
- reverts gw/brgs/both to defaults
|
|
56
|
-
- prints test results
|
|
57
|
-
|
|
58
|
-
:param WltTest test: test to be finished
|
|
59
|
-
:param bool revert_brgs: reverts brgs to defaults (default ep and config), defaults to False
|
|
60
|
-
:param bool revert_gws: reverts gws to defaults (default config), defaults to False
|
|
61
|
-
:return test: returns the test
|
|
62
|
-
"""
|
|
63
|
-
# TODO - REMOVE when rc is re-designed
|
|
64
|
-
if test.get_phase_by_name(TEST_BODY):
|
|
65
|
-
test.set_phase_rc(TEST_BODY, test.rc)
|
|
66
|
-
test.add_phase_reason(TEST_BODY, test.reason)
|
|
67
|
-
|
|
68
|
-
test.reset_result()
|
|
69
|
-
test.set_phase_rc(RESTORE_CONFIG, TEST_PASSED)
|
|
70
|
-
|
|
71
|
-
if revert_brgs:
|
|
72
|
-
res2 = DONE
|
|
73
|
-
test, res = cert_config.config_brg_defaults(test, modules=modules, ble5=ble5)
|
|
74
|
-
# TODO - REMOVE when rc is re-designed
|
|
75
|
-
test.set_phase_rc(RESTORE_CONFIG, test.rc)
|
|
76
|
-
test.reset_result()
|
|
77
|
-
#
|
|
78
|
-
if test.brg1 and test.multi_brg:
|
|
79
|
-
brg1_modules = modules if not brg1_modules else brg1_modules
|
|
80
|
-
test, res2 = cert_config.config_brg1_defaults(test, modules=brg1_modules)
|
|
81
|
-
# TODO - REMOVE when rc is re-designed
|
|
82
|
-
test.set_phase_rc(RESTORE_CONFIG, test.rc)
|
|
83
|
-
test.reset_result()
|
|
84
|
-
#
|
|
85
|
-
if res == NO_RESPONSE or res2 == NO_RESPONSE:
|
|
86
|
-
txt = "Failed: Revert BRGs to defaults"
|
|
87
|
-
utPrint(txt, "RED")
|
|
88
|
-
test.add_phase_reason(RESTORE_CONFIG, txt)
|
|
89
|
-
|
|
90
|
-
if revert_gws:
|
|
91
|
-
test, res = cert_config.config_gw_defaults(test)
|
|
92
|
-
# TODO - REMOVE when rc is re-designed
|
|
93
|
-
test.set_phase_rc(RESTORE_CONFIG, test.rc)
|
|
94
|
-
test.reset_result()
|
|
95
|
-
#
|
|
96
|
-
if res == NO_RESPONSE:
|
|
97
|
-
txt = "Failed: Revert GW to defaults"
|
|
98
|
-
utPrint(txt, "RED")
|
|
99
|
-
test.add_phase_reason(RESTORE_CONFIG, txt)
|
|
100
|
-
|
|
101
|
-
test.mqttc.flush_pkts()
|
|
102
|
-
test.end_time = datetime.datetime.now()
|
|
103
|
-
test.duration = str(test.end_time - test.start_time).split(".")[0]
|
|
104
|
-
|
|
105
|
-
# patch for nightly pipeline - as long as brg ver is updated, continue
|
|
106
|
-
if ("ota_test" in test.module_name and not "brg2brg" in test.module_name and
|
|
107
|
-
(BRG_VER_SUCCESS in test.get_phase_reason(TEST_BODY) or WANTED_VER_SAME in test.get_phase_reason(TEST_BODY))
|
|
108
|
-
and test.get_phase_rc(TEST_BODY) == TEST_FAILED):
|
|
109
|
-
print("Setting rc to TEST_PASSED for pipeline after BRG OTA succeeded")
|
|
110
|
-
test.set_phase_rc(TEST_BODY, TEST_PASSED)
|
|
111
|
-
test.set_phase_rc(RESTORE_CONFIG, TEST_PASSED)
|
|
112
|
-
|
|
113
|
-
test_epilog_print(test)
|
|
114
|
-
return test
|
|
115
|
-
|
|
116
|
-
def get_gw_versions(test):
|
|
117
|
-
"""
|
|
118
|
-
returns gw ble and wifi versions
|
|
119
|
-
|
|
120
|
-
:param WltTest test: test (with gw) to be checked
|
|
121
|
-
:return dict[str, str]: dictionary with BLE_VERSION and WIFI_VERSION
|
|
122
|
-
"""
|
|
123
|
-
test.mqttc.flush_pkts()
|
|
124
|
-
cert_config.gw_info_action(test)
|
|
125
|
-
found = False
|
|
126
|
-
gw_ble_version, gw_wifi_version = "", ""
|
|
127
|
-
start_time = datetime.datetime.now()
|
|
128
|
-
while not found:
|
|
129
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
130
|
-
if GW_INFO in p.body:
|
|
131
|
-
print("Config pkts:")
|
|
132
|
-
print_pkt(p.body)
|
|
133
|
-
if test.protobuf:
|
|
134
|
-
gw_ble_version = p.body[GW_INFO][ENTRIES][BLE_VERSION][STR_VAL]
|
|
135
|
-
gw_wifi_version = p.body[GW_INFO][ENTRIES][WIFI_VERSION][STR_VAL]
|
|
136
|
-
else:
|
|
137
|
-
gw_ble_version = p.body[GW_INFO][BLE_VERSION]
|
|
138
|
-
gw_wifi_version = p.body[GW_INFO][WIFI_VERSION]
|
|
139
|
-
print(f"current versions: wifi {gw_wifi_version} ble {gw_ble_version}")
|
|
140
|
-
found = True
|
|
141
|
-
print_update_wait()
|
|
142
|
-
if (datetime.datetime.now() - start_time).seconds > DEFAULT_GW_FIELD_UPDATE_TIMEOUT:
|
|
143
|
-
test.rc = TEST_FAILED
|
|
144
|
-
test.add_reason(f"{GW_INFO} not found after {DEFAULT_BRG_FIELD_UPDATE_TIMEOUT} seconds!")
|
|
145
|
-
break
|
|
146
|
-
return {BLE_VERSION:gw_ble_version, WIFI_VERSION:gw_wifi_version}
|
|
147
|
-
|
|
148
|
-
def get_gw_geolocation(test):
|
|
149
|
-
"""
|
|
150
|
-
returns gw latitude and longitude from a gw_info action
|
|
151
|
-
|
|
152
|
-
:param WltTest test: test (with gw) to be checked
|
|
153
|
-
:return dict[str, float]: dictionary with GW_LATITUDE and GW_LONGITUDE
|
|
154
|
-
"""
|
|
155
|
-
test.mqttc.flush_pkts()
|
|
156
|
-
cert_config.gw_info_action(test)
|
|
157
|
-
found = False
|
|
158
|
-
gw_lat, gw_lng = 0.0, 0.0
|
|
159
|
-
start_time = datetime.datetime.now()
|
|
160
|
-
while not found:
|
|
161
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
162
|
-
if GW_INFO in p.body:
|
|
163
|
-
print_pkt(p.body)
|
|
164
|
-
if test.protobuf:
|
|
165
|
-
gw_lat = p.body[GW_INFO][ENTRIES][GW_LATITUDE][NUM_VAL]
|
|
166
|
-
gw_lng = p.body[GW_INFO][ENTRIES][GW_LONGITUDE][NUM_VAL]
|
|
167
|
-
else:
|
|
168
|
-
gw_lat = p.body[GW_INFO][GW_LATITUDE]
|
|
169
|
-
gw_lng = p.body[GW_INFO][GW_LONGITUDE]
|
|
170
|
-
print(f"gw_lat:{gw_lat} \ngw_lng:{gw_lng}")
|
|
171
|
-
found = True
|
|
172
|
-
print_update_wait()
|
|
173
|
-
if (datetime.datetime.now() - start_time).seconds > DEFAULT_GW_FIELD_UPDATE_TIMEOUT:
|
|
174
|
-
test.rc = TEST_FAILED
|
|
175
|
-
test.add_reason(f"{GW_INFO} not found after {DEFAULT_BRG_FIELD_UPDATE_TIMEOUT} seconds!")
|
|
176
|
-
break
|
|
177
|
-
return test, {GW_LATITUDE:gw_lat, GW_LONGITUDE:gw_lng}
|
|
178
|
-
|
|
179
|
-
def get_gw_info(test):
|
|
180
|
-
"""
|
|
181
|
-
gets gw info json dict from a gw_info action
|
|
182
|
-
|
|
183
|
-
:param WltTest test: test with gw that it's info will be retreived
|
|
184
|
-
:return str/dict[str, str]: json info dict from an info pkt OR a NO_RESPONSE str
|
|
185
|
-
"""
|
|
186
|
-
test.mqttc.flush_pkts()
|
|
187
|
-
# Always send gw info in both JSON and protobuf
|
|
188
|
-
cert_config.gw_info_action(test)
|
|
189
|
-
test.protobuf = not test.protobuf
|
|
190
|
-
cert_config.gw_info_action(test)
|
|
191
|
-
test.protobuf = not test.protobuf
|
|
192
|
-
|
|
193
|
-
start_time = datetime.datetime.now()
|
|
194
|
-
while (datetime.datetime.now() - start_time).seconds < DEFAULT_GW_FIELD_UPDATE_TIMEOUT:
|
|
195
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
196
|
-
if GW_INFO in p.body:
|
|
197
|
-
print_pkt(p.body)
|
|
198
|
-
return p.body
|
|
199
|
-
print_update_wait()
|
|
200
|
-
return NO_RESPONSE
|
|
201
|
-
|
|
202
|
-
def get_logs(test):
|
|
203
|
-
"""
|
|
204
|
-
gets logs info json dict from a gw_logs action
|
|
205
|
-
|
|
206
|
-
:param WltTest test: test with gw that it's info will be retreived
|
|
207
|
-
:return str/dict[str, str]: json info dict from an info pkt OR a NO_RESPONSE str
|
|
208
|
-
"""
|
|
209
|
-
test.mqttc.flush_pkts()
|
|
210
|
-
cert_config.gw_logs_action(test)
|
|
211
|
-
start_time = datetime.datetime.now()
|
|
212
|
-
while (datetime.datetime.now() - start_time).seconds < DEFAULT_GW_FIELD_UPDATE_TIMEOUT:
|
|
213
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
214
|
-
if GET_LOGS:
|
|
215
|
-
print_pkt(p.body)
|
|
216
|
-
return p.body
|
|
217
|
-
print_update_wait()
|
|
218
|
-
return NO_RESPONSE
|
|
219
|
-
|
|
220
|
-
def get_brg_cfg_pkts(test, last=False, cfg_info=False):
|
|
221
|
-
"""
|
|
222
|
-
gets brg cfg data pkts (payload)
|
|
223
|
-
|
|
224
|
-
:param WltTest test: test to be scanned (it's first brg is the default brg to be scanned for)
|
|
225
|
-
:param bool last: set to True to get only the last pkt caught, defaults to False
|
|
226
|
-
:param bool cfg_info: set to True to get cfg info sent by the brg (msg_type=1 instead of 5 which is the default for this function), defaults to False
|
|
227
|
-
:param int brg_mac: specific brg_mac in case we want to get cfg pkts for a specific brg different than the default, defaults to 0
|
|
228
|
-
:param bool module: Indicates we look for a module pkt as ack for config change
|
|
229
|
-
:return str/list[str]: cfg pkts payloads list/last cfg pkt payload received
|
|
230
|
-
"""
|
|
231
|
-
pkts = []
|
|
232
|
-
msg_type = ag.BRG_MGMT_MSG_TYPE_CFG_SET
|
|
233
|
-
if cfg_info:
|
|
234
|
-
msg_type = ag.BRG_MGMT_MSG_TYPE_CFG_INFO
|
|
235
|
-
|
|
236
|
-
for p in cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test):
|
|
237
|
-
brg2gw_cfg = p[MGMT_PKT].pkt
|
|
238
|
-
if type(brg2gw_cfg).__name__ in [module.__name__ for module in test.active_brg.modules]:
|
|
239
|
-
if brg2gw_cfg.msg_type == msg_type:
|
|
240
|
-
pkts += [p[PAYLOAD]]
|
|
241
|
-
if pkts and last:
|
|
242
|
-
return pkts[-1]
|
|
243
|
-
return pkts
|
|
244
|
-
|
|
245
|
-
def get_brg_hb_pkts(test, last=False, brg_id_str=""):
|
|
246
|
-
"""
|
|
247
|
-
gets brg hb data pkts (payload)
|
|
248
|
-
|
|
249
|
-
:param WltTest test: test to be scanned (it's first brg is the default brg to be scanned for)
|
|
250
|
-
:param bool last:set to True to get only the last pkt caught, defaults to False
|
|
251
|
-
:param str brg_id: specific brg_id in case we want to get hb pkts for a specific brg different than the default, defaults to ""
|
|
252
|
-
:return str/list[str]: hb pkts payloads list/last hb pkt payload received
|
|
253
|
-
"""
|
|
254
|
-
pkts = []
|
|
255
|
-
if brg_id_str == "" and test.active_brg:
|
|
256
|
-
brg_id_str = test.active_brg.id_str
|
|
257
|
-
for p in cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, brg_id_str):
|
|
258
|
-
brg2gw_hb = p[MGMT_PKT].pkt
|
|
259
|
-
if brg_id_str and type(brg2gw_hb) == eval_pkt(f'Brg2GwHbV{test.active_brg.api_version}'):
|
|
260
|
-
pkts += [p[PAYLOAD]]
|
|
261
|
-
elif not brg_id_str and type(brg2gw_hb) == eval_pkt(f'Brg2GwHbV{test.active_brg.api_version}'):
|
|
262
|
-
pkts += [p[PAYLOAD]]
|
|
263
|
-
if pkts and last:
|
|
264
|
-
return pkts[len(pkts)-1]
|
|
265
|
-
return pkts
|
|
266
|
-
|
|
267
|
-
time_in_sec = lambda t : t.seconds + t.microseconds / 1000000
|
|
268
|
-
|
|
269
|
-
# Pandas DataFrame documentation: https://pandas.pydata.org/docs/reference/frame.html
|
|
270
|
-
|
|
271
|
-
def get_all_brg_pkts(test):
|
|
272
|
-
utPrint(f"Collecting all BRG pkts", "BLUE")
|
|
273
|
-
return cert_mqtt.get_unified_data_pkts(test, only_active_brg=True)
|
|
274
|
-
|
|
275
|
-
def get_all_brgs_pkts(test):
|
|
276
|
-
utPrint(f"Collecting all BRG pkts", "BLUE")
|
|
277
|
-
return cert_mqtt.get_unified_data_pkts(test, only_active_brg=False)
|
|
278
|
-
|
|
279
|
-
def get_pkts_data_frame(test, gw_data=False, brg_data=False, per_pkt_type=False):
|
|
280
|
-
pkts = []
|
|
281
|
-
tags_last_pkt_cntr = {}
|
|
282
|
-
tags_received_per_src = {}
|
|
283
|
-
tbc = None
|
|
284
|
-
gw_pkts = 0
|
|
285
|
-
brg_pkts = 0
|
|
286
|
-
all_data = {TIMESTAMP:[],TAG_ID:[],SRC_ID:[],NFPKT:[],TBC:[],PACKET_CNTR:[],PKT_CNTR_DIFF:[],CER:[],RSSI:[],BRG_LATENCY:[],PAYLOAD:[],SEQUENCE_ID:[],GW_ID:[], PACKET_TYPE:[]}
|
|
287
|
-
if gw_data:
|
|
288
|
-
pkts += cert_mqtt.get_internal_brg_unified_data_pkts(test)
|
|
289
|
-
if brg_data:
|
|
290
|
-
if test.brg1 and test.multi_brg:
|
|
291
|
-
pkts += get_all_brg_pkts(test)
|
|
292
|
-
test.active_brg = test.brg1
|
|
293
|
-
pkts += get_all_brg_pkts(test)
|
|
294
|
-
test.active_brg = test.brg0
|
|
295
|
-
else:
|
|
296
|
-
pkts += get_all_brg_pkts(test)
|
|
297
|
-
for p in pkts:
|
|
298
|
-
# Protection from pkts of type "test_mode" from old tags
|
|
299
|
-
if type(p[DECODED_DATA][PACKET_TYPE]) == str or p[DECODED_DATA][PACKET_TYPE] == None:
|
|
300
|
-
print(f"Skipped packet {p}")
|
|
301
|
-
continue
|
|
302
|
-
if per_pkt_type:
|
|
303
|
-
tag_id = p[DECODED_DATA][TAG_ID] + "_" + str(p[DECODED_DATA][PACKET_TYPE])
|
|
304
|
-
else:
|
|
305
|
-
tag_id = p[DECODED_DATA][TAG_ID]
|
|
306
|
-
|
|
307
|
-
if UNIFIED_PKT in p:
|
|
308
|
-
src_id = p[ALIAS_BRIDGE_ID]
|
|
309
|
-
nfpkt = p[UNIFIED_PKT].pkt.nfpkt
|
|
310
|
-
rssi = p[UNIFIED_PKT].pkt.rssi
|
|
311
|
-
brg_latency = p[UNIFIED_PKT].pkt.brg_latency
|
|
312
|
-
if isinstance(p[UNIFIED_PKT].pkt, ag.UnifiedEchoPktV1) or isinstance(p[UNIFIED_PKT].pkt, ag.UnifiedEchoExtPkt):
|
|
313
|
-
tbc = p[UNIFIED_PKT].pkt.tbc
|
|
314
|
-
|
|
315
|
-
all_data[TIMESTAMP] += [p[TIMESTAMP]]
|
|
316
|
-
all_data[TAG_ID] += [tag_id]
|
|
317
|
-
all_data[GW_ID] += [p[GW_ID]]
|
|
318
|
-
all_data[SRC_ID] += [src_id]
|
|
319
|
-
all_data[NFPKT] += [nfpkt]
|
|
320
|
-
all_data[TBC] += [tbc]
|
|
321
|
-
all_data[PACKET_CNTR] += [p[DECODED_DATA][PACKET_CNTR]]
|
|
322
|
-
all_data[RSSI] += [rssi]
|
|
323
|
-
all_data[BRG_LATENCY] += [brg_latency]
|
|
324
|
-
all_data[PAYLOAD] += [p[PAYLOAD]]
|
|
325
|
-
all_data[SEQUENCE_ID] += [p[SEQUENCE_ID]]
|
|
326
|
-
all_data[PACKET_TYPE] += [p[DECODED_DATA][PACKET_TYPE]]
|
|
327
|
-
|
|
328
|
-
# handling pkt_cntr_diff
|
|
329
|
-
pkt_cntr_diff = (p[DECODED_DATA][PACKET_CNTR] - tags_last_pkt_cntr[tag_id])%255 if tag_id and tag_id in tags_received_per_src and src_id and src_id in tags_received_per_src[tag_id] else None
|
|
330
|
-
all_data[PKT_CNTR_DIFF] += [pkt_cntr_diff]
|
|
331
|
-
cer = 1-(nfpkt/pkt_cntr_diff) if pkt_cntr_diff else None
|
|
332
|
-
all_data[CER] += [cer]
|
|
333
|
-
|
|
334
|
-
# saving last pkt_cntr per tag
|
|
335
|
-
tags_last_pkt_cntr[tag_id] = p[DECODED_DATA][PACKET_CNTR]
|
|
336
|
-
|
|
337
|
-
# saving all srcs a tag was received from
|
|
338
|
-
if tag_id and src_id:
|
|
339
|
-
if tag_id not in tags_received_per_src:
|
|
340
|
-
tags_received_per_src[tag_id] = [src_id]
|
|
341
|
-
elif not src_id in tags_received_per_src[tag_id]:
|
|
342
|
-
tags_received_per_src[tag_id] += [src_id]
|
|
343
|
-
|
|
344
|
-
if gw_data:
|
|
345
|
-
if src_id == test.internal_id_alias():
|
|
346
|
-
gw_pkts += 1
|
|
347
|
-
if brg_data:
|
|
348
|
-
if src_id != test.internal_id_alias():
|
|
349
|
-
brg_pkts += 1
|
|
350
|
-
|
|
351
|
-
if gw_data:
|
|
352
|
-
print(f"Found {gw_pkts} gw_tags_pkts")
|
|
353
|
-
if brg_data:
|
|
354
|
-
print(f"Found {brg_pkts} brg_tags_pkts")
|
|
355
|
-
|
|
356
|
-
df = pd.DataFrame.from_dict(all_data)
|
|
357
|
-
df = df.sort_values(by=TIMESTAMP)
|
|
358
|
-
return df
|
|
359
|
-
|
|
360
|
-
def data_scan(test, gw_data=False, brg_data=False, scan_time=0, per_pkt_type=False, pkt_filter_cfg=0, flush_pkts=True, first_pkt_is_start_time=False):
|
|
361
|
-
# MQTT scan
|
|
362
|
-
if flush_pkts:
|
|
363
|
-
test.mqttc.flush_pkts()
|
|
364
|
-
start_time = datetime.datetime.now()
|
|
365
|
-
if scan_time:
|
|
366
|
-
mqtt_scan_start(test, scan_time)
|
|
367
|
-
chars = ["|", "/", "-", "\\"]
|
|
368
|
-
start_time = datetime.datetime.now()
|
|
369
|
-
i = 0
|
|
370
|
-
while not test.rc:
|
|
371
|
-
cur_duration = (datetime.datetime.now() - start_time).seconds
|
|
372
|
-
if cur_duration >= scan_time:
|
|
373
|
-
break
|
|
374
|
-
if pipeline_running():
|
|
375
|
-
sys.stdout.write(".")
|
|
376
|
-
else:
|
|
377
|
-
sys.stdout.write("\r"+chars[i%4]*20+" "+str(cur_duration)+" "+chars[i%4]*20+" {} pkts captured".format(len(test.mqttc._userdata[PKTS].data)))
|
|
378
|
-
sys.stdout.flush()
|
|
379
|
-
time.sleep(0.25)
|
|
380
|
-
i += 1
|
|
381
|
-
print("\n")
|
|
382
|
-
|
|
383
|
-
if per_pkt_type:
|
|
384
|
-
cert_mqtt.dump_pkts(test, log=str(pkt_filter_cfg))
|
|
385
|
-
if pkt_filter_cfg == ag.PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT:
|
|
386
|
-
# When PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT we don't want to split the tags to be per pkt_type
|
|
387
|
-
per_pkt_type = False
|
|
388
|
-
df = get_pkts_data_frame(test, gw_data=gw_data, brg_data=brg_data, per_pkt_type=per_pkt_type)
|
|
389
|
-
if not df.empty:
|
|
390
|
-
df['gw_id'] = test.internal_id_alias()
|
|
391
|
-
if first_pkt_is_start_time:
|
|
392
|
-
start_time = min(df[TIMESTAMP])
|
|
393
|
-
df[TIMESTAMP_DELTA] = (df[TIMESTAMP]- start_time) / 1000
|
|
394
|
-
else:
|
|
395
|
-
df[TIMESTAMP_DELTA] = (df[TIMESTAMP] / 1000) - start_time.timestamp()
|
|
396
|
-
return df
|
|
397
|
-
|
|
398
|
-
def pacing_analysis(test, pacer_interval, df, pkt_filter_cfg=ag.PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT, num_of_pixels=0, is_ble5_test=False):
|
|
399
|
-
ROUND = 3
|
|
400
|
-
|
|
401
|
-
# Validate pkts amount
|
|
402
|
-
if df[TAG_ID].nunique() == 0:
|
|
403
|
-
if pkt_filter_cfg == ag.PKT_FILTER_DISABLE_FORWARDING:
|
|
404
|
-
print("Packets echo disabled and no packets were found accordingly")
|
|
405
|
-
else:
|
|
406
|
-
test.rc = TEST_FAILED
|
|
407
|
-
test.add_reason("No packets found!\nMake sure you have an energizing BRG around you.")
|
|
408
|
-
print(test.reason)
|
|
409
|
-
return test
|
|
410
|
-
elif pkt_filter_cfg == ag.PKT_FILTER_DISABLE_FORWARDING:
|
|
411
|
-
test.rc = TEST_FAILED
|
|
412
|
-
test.add_reason("Packets were found while packets echo is turned off!")
|
|
413
|
-
print(test.reason)
|
|
414
|
-
return test
|
|
415
|
-
|
|
416
|
-
# Verify received pkt types are correct when cfg is not PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT
|
|
417
|
-
if pkt_filter_cfg != ag.PKT_FILTER_RANDOM_FIRST_ARRIVING_PKT:
|
|
418
|
-
for pkt_type in list(df[PACKET_TYPE].unique()):
|
|
419
|
-
if ((pkt_filter_cfg & (1 << pkt_type)) == 0
|
|
420
|
-
and not (is_ble5_test and (test.internal_brg or is_bcc_running(test)) and pkt_type == ag.PKT_TYPE_BLE5_EXTENDED_TEMP_ADVANCED)):
|
|
421
|
-
test.rc = TEST_FAILED
|
|
422
|
-
test.add_reason(f"Tag is of packet type {pkt_type} which is turned off in packet_types_mask configuration!")
|
|
423
|
-
return test
|
|
424
|
-
|
|
425
|
-
# Verify the tags count according to simulation data and pkt_filter_cfg
|
|
426
|
-
tags_count = len(list(df[TAG_ID].unique()))
|
|
427
|
-
if test.data == DATA_SIMULATION and num_of_pixels:
|
|
428
|
-
if is_ble5_test and is_bcc_running(test):
|
|
429
|
-
# In ble5 bcc packet type 2 extended uploaded as is without splitting to ble4 packets
|
|
430
|
-
expected_tags_count = num_of_pixels
|
|
431
|
-
elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_ADVANCED_PKTS or pkt_filter_cfg == ag.PKT_FILTER_TEMP_AND_DEBUG_PKTS:
|
|
432
|
-
expected_tags_count = num_of_pixels * 2
|
|
433
|
-
elif pkt_filter_cfg == ag.PKT_FILTER_TEMP_ADVANCED_AND_DEBUG_PKTS:
|
|
434
|
-
expected_tags_count = num_of_pixels * 3
|
|
435
|
-
else:
|
|
436
|
-
expected_tags_count = num_of_pixels
|
|
437
|
-
if tags_count != expected_tags_count:
|
|
438
|
-
test.rc = TEST_FAILED
|
|
439
|
-
test.add_reason(f"Expected {expected_tags_count} pixels but found {tags_count}!")
|
|
440
|
-
print(test.reason)
|
|
441
|
-
return test
|
|
442
|
-
|
|
443
|
-
# Verify the tags pacer interval
|
|
444
|
-
failed_tags = 0
|
|
445
|
-
for tag in list(df[TAG_ID].unique()):
|
|
446
|
-
pkts = df.query('tag_id == @tag')
|
|
447
|
-
avg_pacer = round(pkts.timestamp.diff().mean(skipna=True)/1000, ROUND)
|
|
448
|
-
print(f"Tag: {tag} avg_pacer={avg_pacer} num_of_pkts={len(pkts)}")
|
|
449
|
-
if ((avg_pacer / pacer_interval) < PACER_INTERVAL_THRESHOLD_HIGH and (pacer_interval - avg_pacer) > 1):
|
|
450
|
-
failed_tags += 1
|
|
451
|
-
test.rc = TEST_FAILED
|
|
452
|
-
print(f"Tag {tag} with diff_time {list(pkts.timestamp.diff().div(1000))}, avg_pacer={avg_pacer} exceeds {PACER_INTERVAL_THRESHOLD_HIGH} minimum threshold!")
|
|
453
|
-
if test.data == DATA_SIMULATION and (avg_pacer / pacer_interval) > PACER_INTERVAL_CEIL_THRESHOLD:
|
|
454
|
-
failed_tags += 1
|
|
455
|
-
print(f"Tag {tag} with diff_time {list(pkts.timestamp.diff().div(1000))}, avg_pacer={avg_pacer} exceeds {PACER_INTERVAL_CEIL_THRESHOLD} maximum threshold!")
|
|
456
|
-
if failed_tags/tags_count > 0.2: # Fail the test on ceil threshold only when more than 20 % tag failed
|
|
457
|
-
test.add_reason(f"{failed_tags}/{tags_count} tags with wrong time diff")
|
|
458
|
-
test.rc = TEST_FAILED
|
|
459
|
-
|
|
460
|
-
return test
|
|
461
|
-
|
|
462
|
-
def reboot_config_analysis(test, expected_hash, timeout=ACTION_LONG_TIMEOUT, ble_version=None, bl_version=None):
|
|
463
|
-
utPrint("Analyzing Reboot", "BLUE")
|
|
464
|
-
# start with a 5 sec wait time before searching interface to allow the BRG to reboot
|
|
465
|
-
time.sleep(5)
|
|
466
|
-
|
|
467
|
-
start_time = datetime.datetime.now()
|
|
468
|
-
seq_ids = []
|
|
469
|
-
found = {ag.MODULE_IF : False, ag.MODULE_DATAPATH: False}
|
|
470
|
-
received_hash = 0
|
|
471
|
-
# Flush data pkts only to keep the GW logs which are in status topic
|
|
472
|
-
test.mqttc.flush_data_pkts()
|
|
473
|
-
|
|
474
|
-
while not all(found.values()):
|
|
475
|
-
# scan for ModuleIf and ModuleDatapath pkts of all api versions to support api version change on update
|
|
476
|
-
# ModuleDatapath arrival shows that the BLE really rebooted
|
|
477
|
-
if_pkts_list = [eval_pkt(f'ModuleIfV{i}') for i in range(ag.API_VERSION_V9, ag.API_VERSION_LATEST+1)]
|
|
478
|
-
datapath_pkts_list = [eval_pkt(f'ModuleDatapathV{i}') for i in range(ag.API_VERSION_V9, ag.API_VERSION_LATEST+1)]
|
|
479
|
-
pkts = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=if_pkts_list+datapath_pkts_list)
|
|
480
|
-
for p in pkts:
|
|
481
|
-
if (not seq_ids or p[SEQUENCE_ID] not in seq_ids):
|
|
482
|
-
seq_ids.append(p[SEQUENCE_ID])
|
|
483
|
-
module_pkt = p[MGMT_PKT].pkt
|
|
484
|
-
if not found[module_pkt.module_type]:
|
|
485
|
-
print("\nGot {} packet after {} sec!".format(type(module_pkt).__name__, (datetime.datetime.now() - start_time).seconds))
|
|
486
|
-
print(module_pkt)
|
|
487
|
-
if module_pkt.module_type == ag.MODULE_IF:
|
|
488
|
-
test.active_brg.api_version = module_pkt.api_version
|
|
489
|
-
print(f"received ModuleIfV{test.active_brg.api_version} pkt:")
|
|
490
|
-
# get received cfg_hash & expected cfg_hash
|
|
491
|
-
received_hash = module_pkt.cfg_hash
|
|
492
|
-
print(f"\nexpected cfg_hash: {hex(expected_hash)}")
|
|
493
|
-
print(f"received cfg_hash: {hex(received_hash)}")
|
|
494
|
-
# brg version update (OTA) analysis
|
|
495
|
-
if ble_version:
|
|
496
|
-
brg_version = f"{module_pkt.major_ver}.{module_pkt.minor_ver}.{module_pkt.patch_ver}"
|
|
497
|
-
print(f"\nBRG version: {brg_version}, expected version: {ble_version}")
|
|
498
|
-
# compare wanted version to received version
|
|
499
|
-
if brg_version == ble_version:
|
|
500
|
-
test.add_reason(BRG_VER_SUCCESS)
|
|
501
|
-
# ALSO compare received cfg_hash to expected cfg_hash
|
|
502
|
-
# expected_hash will be 1 if api_version was updated
|
|
503
|
-
if received_hash == expected_hash or expected_hash == 1:
|
|
504
|
-
found[module_pkt.module_type] = True
|
|
505
|
-
elif bl_version:
|
|
506
|
-
brg_bl_version = module_pkt.bl_version
|
|
507
|
-
print(f"\nBRG bootloader version: {brg_bl_version}, expected bootloader version: {bl_version}")
|
|
508
|
-
# compare wanted version to received version
|
|
509
|
-
if brg_bl_version == bl_version:
|
|
510
|
-
test.add_reason(BRG_BL_VER_SUCCESS)
|
|
511
|
-
found[module_pkt.module_type] = True
|
|
512
|
-
# analysis of any other reboot actions with no version update (relevant only for api version 8 or higher)
|
|
513
|
-
# compare received cfg_hash to expected cfg_hash
|
|
514
|
-
elif received_hash == expected_hash:
|
|
515
|
-
found[module_pkt.module_type] = True
|
|
516
|
-
else:
|
|
517
|
-
found[module_pkt.module_type] = True
|
|
518
|
-
print_update_wait()
|
|
519
|
-
|
|
520
|
-
if (datetime.datetime.now() - start_time).seconds > timeout:
|
|
521
|
-
test.rc = TEST_FAILED
|
|
522
|
-
unfound = [f'{ag.MODULES_DICT[m]}{test.active_brg.api_version}' for m in found if not found[m]]
|
|
523
|
-
test.add_reason(f"{unfound} not received in {timeout} sec")
|
|
524
|
-
break
|
|
525
|
-
return test
|
|
526
|
-
|
|
527
|
-
def scan_for_mgmt_pkts(test, mgmt_type):
|
|
528
|
-
|
|
529
|
-
start_time = datetime.datetime.now()
|
|
530
|
-
# Search for module packets
|
|
531
|
-
found = False
|
|
532
|
-
ret_pkts = []
|
|
533
|
-
while DEFAULT_BRG_FIELD_UPDATE_TIMEOUT > (datetime.datetime.now() - start_time).seconds:
|
|
534
|
-
print_update_wait()
|
|
535
|
-
pkts_collected = cert_mqtt.get_brg2gw_mgmt_pkts(test.mqttc, test, mgmt_types=mgmt_type)
|
|
536
|
-
if pkts_collected:
|
|
537
|
-
#TODO: logging print
|
|
538
|
-
# utPrint("Found brg2gw_mgmt_pkts:", "GREEN")
|
|
539
|
-
seq_ids = []
|
|
540
|
-
for p in pkts_collected:
|
|
541
|
-
if seq_ids == [] or p[SEQUENCE_ID] not in seq_ids:
|
|
542
|
-
seq_ids.append(p[SEQUENCE_ID])
|
|
543
|
-
#TODO: Logging print
|
|
544
|
-
# print(p[MGMT_PKT].pkt)
|
|
545
|
-
ret_pkts.append(p)
|
|
546
|
-
found = True
|
|
547
|
-
break
|
|
548
|
-
if not found:
|
|
549
|
-
test.rc = TEST_FAILED
|
|
550
|
-
test.add_reason(f"Didn't receive {mgmt_type[0].__name__} pkt after {DEFAULT_BRG_FIELD_UPDATE_TIMEOUT} seconds!")
|
|
551
|
-
return test, ret_pkts
|
|
552
|
-
|
|
553
|
-
# Plotly graphing libraries documentation: https://plotly.com/python/
|
|
554
|
-
|
|
555
|
-
def display_data(df, csv=True, nfpkt=False, pkt_cntr_diff=False, cer_per_tag=False, tbc=False, rssi=False, ttfp=False, start_time=None, name_prefix="", dir=""):
|
|
556
|
-
print("\nGenerating data analysis graphs and CSV file\n")
|
|
557
|
-
df[DATETIME] = df[TIMESTAMP].apply(lambda x: datetime.datetime.fromtimestamp(x/1e3))
|
|
558
|
-
df = df.sort_values(by=DATETIME)
|
|
559
|
-
symbol_sequence = ["hourglass", "bowtie", "cross", "x"]
|
|
560
|
-
all_graphs = []
|
|
561
|
-
ttfp_graph = None
|
|
562
|
-
# insert new start_time to override timestamp_delta from data_scan()
|
|
563
|
-
if start_time:
|
|
564
|
-
df[TIMESTAMP_DELTA] = (df[TIMESTAMP] / 1000) - start_time.timestamp()
|
|
565
|
-
if nfpkt:
|
|
566
|
-
nfpkt_graph = px.scatter(df, title=NFPKT, x=DATETIME, y=NFPKT, color=TAG_ID, symbol=SRC_ID, symbol_sequence=symbol_sequence)
|
|
567
|
-
nfpkt_graph.update_traces(marker=dict(size=12, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers'))
|
|
568
|
-
all_graphs.append(nfpkt_graph)
|
|
569
|
-
if rssi:
|
|
570
|
-
rssi_graph = px.scatter(df, title=RSSI, x=DATETIME, y=RSSI, color=TAG_ID, symbol=SRC_ID, symbol_sequence=symbol_sequence)
|
|
571
|
-
rssi_graph.update_traces(marker=dict(size=12, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers'))
|
|
572
|
-
all_graphs.append(rssi_graph)
|
|
573
|
-
if pkt_cntr_diff:
|
|
574
|
-
pkt_cntr_diff_graph = px.scatter(df, title=PKT_CNTR_DIFF, x=DATETIME, y=PKT_CNTR_DIFF, color=TAG_ID, symbol=SRC_ID, symbol_sequence=symbol_sequence)
|
|
575
|
-
pkt_cntr_diff_graph.update_traces(marker=dict(size=12, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers'))
|
|
576
|
-
all_graphs.append(pkt_cntr_diff_graph)
|
|
577
|
-
if cer_per_tag:
|
|
578
|
-
cer_per_tag_graph = px.scatter(df, title=CER, x=DATETIME, y=CER, color=TAG_ID, symbol=SRC_ID, symbol_sequence=symbol_sequence)
|
|
579
|
-
cer_per_tag_graph.update_traces(marker=dict(size=12, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers'))
|
|
580
|
-
all_graphs.append(cer_per_tag_graph)
|
|
581
|
-
if tbc:
|
|
582
|
-
tbc_graph = px.scatter(df, title=TBC, x=DATETIME, y=TBC, color=TAG_ID, symbol=SRC_ID, symbol_sequence=symbol_sequence)
|
|
583
|
-
tbc_graph.update_traces(marker=dict(size=12, line=dict(width=2, color='DarkSlateGrey')), selector=dict(mode='markers'))
|
|
584
|
-
all_graphs.append(tbc_graph)
|
|
585
|
-
if ttfp:
|
|
586
|
-
data = {TIMESTAMP_DELTA:[], TAGS_COUNT:[], NEW_TAGS:[]}
|
|
587
|
-
tags_count = []
|
|
588
|
-
# iterate all integers from 0 to the largest timestamp_delta as values for X
|
|
589
|
-
for i in range(int(math.ceil(df[TIMESTAMP_DELTA].iloc[-1]))+1):
|
|
590
|
-
new_tags = []
|
|
591
|
-
# for every timestamp_delta value (i) add all NEW tags received in that timestamp_delta
|
|
592
|
-
for row in df.query('timestamp_delta < @i').itertuples(index=False):
|
|
593
|
-
if not row.tag_id in tags_count and not row.tag_id in new_tags:
|
|
594
|
-
new_tags += [row.tag_id]
|
|
595
|
-
tags_count += new_tags
|
|
596
|
-
data[TIMESTAMP_DELTA] += ([i])
|
|
597
|
-
data[TAGS_COUNT] += [len(tags_count)]
|
|
598
|
-
data[NEW_TAGS] += [new_tags]
|
|
599
|
-
ttfp_graph = px.line(pd.DataFrame(data), x=TIMESTAMP_DELTA, y=TAGS_COUNT, title=TTFP,hover_data=[TIMESTAMP_DELTA,TAGS_COUNT,NEW_TAGS], markers=True)
|
|
600
|
-
all_graphs.append(ttfp_graph)
|
|
601
|
-
#generate
|
|
602
|
-
with open(os.path.join(BASE_DIR, dir, f"{name_prefix}data_graphs.html"), 'w') as f:
|
|
603
|
-
for g in all_graphs:
|
|
604
|
-
f.write(g.to_html(full_html=False, include_plotlyjs='cdn', include_mathjax='cdn'))
|
|
605
|
-
f.write("<br>")
|
|
606
|
-
if csv:
|
|
607
|
-
df.to_csv(os.path.join(BASE_DIR, dir, f"{name_prefix}all_data.csv"), index=False)
|
|
608
|
-
|
|
609
|
-
return ttfp_graph
|
|
610
|
-
|
|
611
|
-
def single_log_search(test, s, found, fail_on_find=False, print_logs=True, additional_log=""):
|
|
612
|
-
res = False
|
|
613
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
614
|
-
if GW_LOGS in p.body:
|
|
615
|
-
if test.protobuf and p.body[GW_LOGS]:
|
|
616
|
-
# handle protobuf structure (when GW_LOGS is not empty)
|
|
617
|
-
logs = p.body[GW_LOGS][LOGS]
|
|
618
|
-
else:
|
|
619
|
-
logs = p.body[GW_LOGS]
|
|
620
|
-
for log in logs:
|
|
621
|
-
if any([s in log]) and any([additional_log in log]) and (log not in found):
|
|
622
|
-
print(f"Log: {log}, Additional Log: {additional_log}")
|
|
623
|
-
found += [log]
|
|
624
|
-
res = True
|
|
625
|
-
if fail_on_find:
|
|
626
|
-
if test.rc == TEST_PASSED:
|
|
627
|
-
test= test.add_reason("Test functionality passed")
|
|
628
|
-
test.add_reason(f"Found {s}")
|
|
629
|
-
test.rc = TEST_FAILED
|
|
630
|
-
print(found)
|
|
631
|
-
return test, res, found
|
|
632
|
-
if print_logs:
|
|
633
|
-
print_pkt(s)
|
|
634
|
-
return test, res, found
|
|
635
|
-
|
|
636
|
-
def gw_logs_search(test, strings, scan_time=GW_LOG_PERIOD+5, print_logs=False, fail_on_find=False):
|
|
637
|
-
"""searching for specific logs in mqtt status topic in GW_LOGS field
|
|
638
|
-
|
|
639
|
-
:param WltTest test: test running
|
|
640
|
-
:param [str] strings: list of logs to search
|
|
641
|
-
:param int scan_time: time to scan for logs, defaults to GW_LOG_PERIOD+5
|
|
642
|
-
:return WltTest: test with updated results
|
|
643
|
-
"""
|
|
644
|
-
start_time = datetime.datetime.now()
|
|
645
|
-
print(f"Searching for {strings} log in MQTT status topic.\nFail on find is set to {fail_on_find}")
|
|
646
|
-
found = []
|
|
647
|
-
while (len(strings) > len(found)):
|
|
648
|
-
for s in strings:
|
|
649
|
-
test, res, found = single_log_search(test, s, found, fail_on_find, print_logs)
|
|
650
|
-
if res:
|
|
651
|
-
break
|
|
652
|
-
if (datetime.datetime.now() - start_time).seconds >= scan_time:
|
|
653
|
-
if not fail_on_find:
|
|
654
|
-
test.add_reason(f"Didnt find logs in [{scan_time}] seconds")
|
|
655
|
-
print(test.reason)
|
|
656
|
-
test.rc = TEST_FAILED
|
|
657
|
-
break
|
|
658
|
-
if test.rc == TEST_PASSED:
|
|
659
|
-
if not fail_on_find:
|
|
660
|
-
print(f"SUCCESS found all [{strings}]")
|
|
661
|
-
else:
|
|
662
|
-
print(f"SUCCESS Didnt find [{strings}]")
|
|
663
|
-
return test
|
|
664
|
-
|
|
665
|
-
def gw_action_status_search(test, action_idx, status_code):
|
|
666
|
-
"""searching for action returned status code in mqtt status topic in ACTION field
|
|
667
|
-
|
|
668
|
-
:param WltTest test: test running
|
|
669
|
-
:param int action_idx: sent action index
|
|
670
|
-
:param int status_code: expected status code for action
|
|
671
|
-
:return WltTest: test with updated results
|
|
672
|
-
"""
|
|
673
|
-
start_time = datetime.datetime.now()
|
|
674
|
-
print(f"Searching for action idx ({action_idx}) update log in MQTT status topic")
|
|
675
|
-
while (datetime.datetime.now() - start_time).seconds < GW_LOG_PERIOD:
|
|
676
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
677
|
-
# JSON
|
|
678
|
-
if ((ACTION in p.body) and (p.body[ACTION] == action_idx) and
|
|
679
|
-
(STATUS_CODE_STR in p.body) and (p.body[STATUS_CODE_STR] == status_code)):
|
|
680
|
-
return test
|
|
681
|
-
# Protobuf - when succeed status is not sent
|
|
682
|
-
if ((ACTION_STATUS in p.body) and (p.body[ACTION_STATUS][ACTION] == action_idx) and
|
|
683
|
-
(STATUS_CODE not in p.body[ACTION_STATUS])):
|
|
684
|
-
return test
|
|
685
|
-
test.add_reason(f"action_idx={action_idx} status_code={status_code} not found in logs after {GW_LOG_PERIOD} seconds\n")
|
|
686
|
-
print(test.reason)
|
|
687
|
-
test.rc = TEST_FAILED
|
|
688
|
-
return test
|
|
689
|
-
|
|
690
|
-
def get_gw_logs_packets(test, last=False, print_log=True):
|
|
691
|
-
"""
|
|
692
|
-
gets gw logs pkts
|
|
693
|
-
:param WltTest test: test with gw that it's info will be retreived
|
|
694
|
-
:param bool last: set to True to get only the last pkt caught, defaults to False
|
|
695
|
-
:return pkt/list[pkt]: logs pkts list/last status pkt received
|
|
696
|
-
"""
|
|
697
|
-
cert_config.gw_logs_action(test)
|
|
698
|
-
pkts = []
|
|
699
|
-
for p in test.mqttc._userdata[PKTS].status:
|
|
700
|
-
if GW_LOGS in p.body:
|
|
701
|
-
if print_log:
|
|
702
|
-
print("GW logs packet:\n", p.body[GW_LOGS])
|
|
703
|
-
logs = p.body[GW_LOGS][LOGS] if test.protobuf else p.body[GW_LOGS]
|
|
704
|
-
pkts += [log for log in logs]
|
|
705
|
-
if pkts and last:
|
|
706
|
-
return pkts[len(pkts)-1]
|
|
707
|
-
return pkts
|
|
708
|
-
|
|
709
|
-
def wait_time_n_print(secs):
|
|
710
|
-
utPrint(f"Waiting for {secs} seconds", "CYAN")
|
|
711
|
-
while secs:
|
|
712
|
-
print_update_wait()
|
|
713
|
-
secs -= 1
|
|
714
|
-
|
|
715
|
-
def get_module_if_pkt(test):
|
|
716
|
-
cert_config.send_brg_action(test, ag.ACTION_GET_MODULE, interface=1)
|
|
717
|
-
test, pkts = scan_for_mgmt_pkts(test, mgmt_type=[eval_pkt(f'ModuleIfV{test.active_brg.api_version}'),
|
|
718
|
-
eval_pkt(f'ModuleIfV{test.active_brg.api_version - 1}'),])
|
|
719
|
-
if test.rc == TEST_FAILED:
|
|
720
|
-
return test, NO_RESPONSE
|
|
721
|
-
else:
|
|
722
|
-
print(pkts[-1][MGMT_PKT].pkt)
|
|
723
|
-
return test, pkts[-1][MGMT_PKT].pkt
|
|
724
|
-
|
|
725
|
-
def get_cfg_hash(test):
|
|
726
|
-
utPrint(f"Fetching BRG cfg hash for BRG {test.active_brg.id_str}", "BLUE")
|
|
727
|
-
test, module_if_pkt = get_module_if_pkt(test)
|
|
728
|
-
if test.rc == TEST_FAILED:
|
|
729
|
-
return test, 0
|
|
730
|
-
else:
|
|
731
|
-
return test, module_if_pkt.cfg_hash
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
def brg_restore_defaults_check(test):
|
|
735
|
-
print("Starting Restore Defaults Check")
|
|
736
|
-
start_time = datetime.datetime.now()
|
|
737
|
-
found = False
|
|
738
|
-
revived = False
|
|
739
|
-
output = ""
|
|
740
|
-
while not found:
|
|
741
|
-
last_pkt = get_brg_cfg_pkts(test=test, cfg_info=True, last=True)
|
|
742
|
-
if last_pkt:
|
|
743
|
-
print(f"Got pkt after {(datetime.datetime.now() - start_time).seconds} sec!")
|
|
744
|
-
wlt_pkt = WltPkt(last_pkt)
|
|
745
|
-
print(f"SUCCESS: Found pkt from brg: {wlt_pkt}")
|
|
746
|
-
found = True # exit
|
|
747
|
-
revived = True
|
|
748
|
-
output = "SUCCESS: brg is alive and restored to defaults!"
|
|
749
|
-
if (datetime.datetime.now() - start_time).seconds > ACTION_LONG_TIMEOUT:
|
|
750
|
-
print(f"FAILURE: Can't find bridge! Didn't get config pkt after {ACTION_LONG_TIMEOUT} seconds!")
|
|
751
|
-
break
|
|
752
|
-
print_update_wait()
|
|
753
|
-
return test, revived, output
|
|
754
|
-
|
|
755
|
-
# Pwr Mgmt
|
|
756
|
-
def brg_pwr_mgmt_turn_on(test):
|
|
757
|
-
utPrint("Sending pwr_mgmt static mode configuration - 30 seconds ON, 60 seconds SLEEP!", "BLUE")
|
|
758
|
-
module = test.active_brg.pwr_mgmt
|
|
759
|
-
# send pwr mgmt module packet
|
|
760
|
-
wltpkt = WltPkt(hdr=DEFAULT_HDR, pkt=module(module_type=ag.MODULE_PWR_MGMT, msg_type=ag.BRG_MGMT_MSG_TYPE_CFG_SET,
|
|
761
|
-
api_version=ag.API_VERSION_LATEST,seq_id=random.randrange(99),
|
|
762
|
-
brg_mac=test.active_brg.id_int, static_on_duration=30, static_sleep_duration=60,
|
|
763
|
-
dynamic_leds_on=0,dynamic_keep_alive_period=0, dynamic_keep_alive_scan=0,
|
|
764
|
-
dynamic_on_duration=0,dynamic_sleep_duration=0))
|
|
765
|
-
test = cert_config.brg_configure(test=test, cfg_pkt=wltpkt, module=module)[0]
|
|
766
|
-
|
|
767
|
-
if test.rc == TEST_FAILED:
|
|
768
|
-
test.add_reason("Turning pwr mgmt ON failed, Didn't receive GW MEL pwr mgmt ON pkt")
|
|
769
|
-
else:
|
|
770
|
-
utPrint("SUCCESS! pwr mgmt static mode turned on!", "GREEN")
|
|
771
|
-
return test, wltpkt
|
|
772
|
-
|
|
773
|
-
def brg_pwr_mgmt_turn_off(test):
|
|
774
|
-
utPrint("Turning pwr mgmt OFF - sending default configuration!", "BLUE")
|
|
775
|
-
module = test.active_brg.pwr_mgmt
|
|
776
|
-
start_time = datetime.datetime.now()
|
|
777
|
-
wltpkt = WltPkt(hdr=DEFAULT_HDR, pkt=module(module_type=ag.MODULE_PWR_MGMT, msg_type=ag.BRG_MGMT_MSG_TYPE_CFG_SET,
|
|
778
|
-
api_version=ag.API_VERSION_LATEST,seq_id=random.randrange(99),
|
|
779
|
-
brg_mac=test.active_brg.id_int,static_leds_on=1,
|
|
780
|
-
static_keep_alive_period=0,static_keep_alive_scan=0,
|
|
781
|
-
static_on_duration=0,static_sleep_duration=0,
|
|
782
|
-
dynamic_leds_on=0,dynamic_keep_alive_period=0,
|
|
783
|
-
dynamic_keep_alive_scan=0,dynamic_on_duration=0,dynamic_sleep_duration=0))
|
|
784
|
-
found = NOT_FOUND
|
|
785
|
-
while found != DONE:
|
|
786
|
-
test, found = cert_config.brg_configure(test=test, cfg_pkt=wltpkt, module=module, wait=False)
|
|
787
|
-
if ((datetime.datetime.now() - start_time).seconds > (ag.PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD + 1)):
|
|
788
|
-
test.add_reason(f"Didn't receive GW MEL pwr mgmt OFF ack after {ag.PWR_MGMT_DEFAULTS_KEEP_ALIVE_PERIOD + 1} seconds")
|
|
789
|
-
test.rc = TEST_FAILED
|
|
790
|
-
break
|
|
791
|
-
print_update_wait()
|
|
792
|
-
if found == DONE:
|
|
793
|
-
utPrint(f"FOUND off pkt after {(datetime.datetime.now() - start_time)} secs", "GREEN")
|
|
794
|
-
utPrint("SUCCESS! pwr mgmt static mode turned off!", "GREEN")
|
|
795
|
-
return test
|
|
796
|
-
|
|
797
|
-
# LEDs tests funcs
|
|
798
|
-
def check_input_n_try_again(value):
|
|
799
|
-
# check for valid input char - only 'Y', 'y', 'N' or 'n'
|
|
800
|
-
while value.lower() != 'y' and value.lower() != 'n':
|
|
801
|
-
utPrint("Wrong input, Please try Again!\n", "RED")
|
|
802
|
-
value = input()
|
|
803
|
-
return value
|
|
804
|
-
|
|
805
|
-
# Executed only when the received value is 'n'!
|
|
806
|
-
def value_check_if_y(test, received_value, stage):
|
|
807
|
-
# check if the received value is different from the expected value
|
|
808
|
-
if 'y' != received_value.lower():
|
|
809
|
-
test.rc = TEST_FAILED
|
|
810
|
-
test.add_reason(f"{stage} failed")
|
|
811
|
-
return test
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
##########################################
|
|
815
|
-
# Signal Indicator functions
|
|
816
|
-
##########################################
|
|
817
|
-
def dual_polarization_ant_boards_get():
|
|
818
|
-
return [ag.BOARD_TYPE_MINEW_SINGLE_BAND_V0, ag.BOARD_TYPE_MINEW_DUAL_BAND_V0,
|
|
819
|
-
ag.BOARD_TYPE_ENERGOUS_V2, ag.BOARD_TYPE_ERM_V0, ag.BOARD_TYPE_ERM_V1,
|
|
820
|
-
ag.BOARD_TYPE_MINEW_POE_V0]
|
|
821
|
-
|
|
822
|
-
def exp_sig_ind_pkts(tx_brg, rx_brg, cycles):
|
|
823
|
-
if tx_brg.board_type in dual_polarization_ant_boards_get():
|
|
824
|
-
tx_brg_ant_polarization_num = 2
|
|
825
|
-
else:
|
|
826
|
-
tx_brg_ant_polarization_num = 1
|
|
827
|
-
if rx_brg.board_type in dual_polarization_ant_boards_get():
|
|
828
|
-
rx_brg_ant_polarization_num = 2
|
|
829
|
-
else:
|
|
830
|
-
rx_brg_ant_polarization_num = 1
|
|
831
|
-
|
|
832
|
-
expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
|
|
833
|
-
# Allow missing 1 pkt
|
|
834
|
-
return [expected - 1, expected]
|
|
835
|
-
|
|
836
|
-
def exp_sig_ind_pkts2(tx_brg, rx_brg, cycles):
|
|
837
|
-
if tx_brg.board_type in dual_polarization_ant_boards_get():
|
|
838
|
-
tx_brg_ant_polarization_num = 2
|
|
839
|
-
else:
|
|
840
|
-
tx_brg_ant_polarization_num = 1
|
|
841
|
-
if rx_brg.board_type in dual_polarization_ant_boards_get():
|
|
842
|
-
rx_brg_ant_polarization_num = 2
|
|
843
|
-
else:
|
|
844
|
-
rx_brg_ant_polarization_num = 1
|
|
845
|
-
|
|
846
|
-
expected = cycles * tx_brg_ant_polarization_num * rx_brg_ant_polarization_num
|
|
847
|
-
return expected
|
|
848
|
-
|
|
849
|
-
def sig_ind_pkts_fail_analysis(tx_brg, rx_brg, cycles, received_pkts):
|
|
850
|
-
|
|
851
|
-
expected = exp_sig_ind_pkts2(tx_brg, rx_brg, cycles)
|
|
852
|
-
print(f"Expected pkts: {expected}, Received pkts: {len(received_pkts)}")
|
|
853
|
-
# Allow missing 25% max
|
|
854
|
-
if int(0.75 * expected) <= len(received_pkts) <= int(1.25 * expected):
|
|
855
|
-
return False
|
|
856
|
-
return True
|
|
857
|
-
|
|
858
|
-
def get_all_sig_ind_pkts(test=None, rx_brg=None, tx_brg=None):
|
|
859
|
-
if rx_brg == test.brg1:
|
|
860
|
-
all_sensor_packets = cert_mqtt.get_all_brg1_ext_sensor_pkts(test=test)
|
|
861
|
-
elif rx_brg == test.brg0:
|
|
862
|
-
all_sensor_packets = cert_mqtt.get_all_sensor_pkts(test=test)
|
|
863
|
-
signal_ind_pkts = []
|
|
864
|
-
for p in all_sensor_packets:
|
|
865
|
-
if (p[SENSOR_UUID] == f"{ag.SENSOR_SERVICE_ID_SIGNAL_INDICATOR:06X}" and
|
|
866
|
-
p[BRIDGE_ID] == rx_brg.id_str and p[SENSOR_ID] == tx_brg.id_alias):
|
|
867
|
-
signal_ind_pkts.append(p)
|
|
868
|
-
return signal_ind_pkts
|
|
869
|
-
|
|
870
|
-
def output_power_check(test, received_signal_ind_pkts, tx_brg_):
|
|
871
|
-
|
|
872
|
-
output_power_default = tx_brg_.datapath().output_power
|
|
873
|
-
|
|
874
|
-
for p in received_signal_ind_pkts:
|
|
875
|
-
if p[SENSOR_PKT].pkt.output_power != output_power_default:
|
|
876
|
-
test.rc = TEST_FAILED
|
|
877
|
-
test.add_reason("output power of internal brg is incorrect!\n"
|
|
878
|
-
f"got:{p[SENSOR_PKT].pkt.output_power}, expected: {output_power_default}\n")
|
|
879
|
-
return test
|
|
880
|
-
|
|
881
|
-
def rssi_check(test, received_signal_ind_pkts):
|
|
882
|
-
threshold_rssi = [0, 80]
|
|
883
|
-
for p in received_signal_ind_pkts:
|
|
884
|
-
if not threshold_rssi[0] < p[RSSI] < threshold_rssi[1]:
|
|
885
|
-
test.rc = TEST_FAILED
|
|
886
|
-
test.add_reason("rssi value is wrong, out of 0 to 80 ")
|
|
887
|
-
|
|
888
|
-
return test
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
def rx_tx_antenna_check(test, received_signal_ind_pkts, tx_brg_, rx_brg_, cycles):
|
|
892
|
-
|
|
893
|
-
# Allow to miss 1 packet or get 1 extra packet
|
|
894
|
-
expected = range(int(cycles * 0.5), cycles + 2)
|
|
895
|
-
|
|
896
|
-
received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=0))
|
|
897
|
-
if received not in expected:
|
|
898
|
-
test.rc = TEST_FAILED
|
|
899
|
-
test.add_reason(f"rx_ant=0 tx_ant=0 expected={cycles} received={received}")
|
|
900
|
-
|
|
901
|
-
if tx_brg_.board_type in dual_polarization_ant_boards_get():
|
|
902
|
-
received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=0, tx_ant=1))
|
|
903
|
-
if received not in expected:
|
|
904
|
-
test.rc = TEST_FAILED
|
|
905
|
-
test.add_reason(f"rx_ant=0 tx_ant=1 expected={cycles} received={received}")
|
|
906
|
-
|
|
907
|
-
if rx_brg_.board_type in dual_polarization_ant_boards_get():
|
|
908
|
-
received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=0))
|
|
909
|
-
if received not in expected:
|
|
910
|
-
test.rc = TEST_FAILED
|
|
911
|
-
test.add_reason(f"rx_ant=1 tx_ant=0 expected={cycles} received={received}")
|
|
912
|
-
|
|
913
|
-
if (rx_brg_.board_type in dual_polarization_ant_boards_get() and
|
|
914
|
-
tx_brg_.board_type in dual_polarization_ant_boards_get()):
|
|
915
|
-
received = len(get_polar_signal_ind_pkt(received_signal_ind_pkts, rx_ant=1, tx_ant=1))
|
|
916
|
-
if received not in expected:
|
|
917
|
-
test.rc = TEST_FAILED
|
|
918
|
-
test.add_reason(f"rx_ant=1 tx_ant=1 expected={cycles} received={received}")
|
|
919
|
-
return test
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
def get_polar_signal_ind_pkt(pkts, rx_ant, tx_ant):
|
|
923
|
-
return [p for p in pkts if p[SENSOR_PKT].pkt.rx_antenna == rx_ant and p[SENSOR_PKT].pkt.tx_antenna == tx_ant]
|