wiliot-certificate 4.5.0__py3-none-any.whl → 4.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.
- certificate/ag/wlt_types_ag_jsons/brg2brg_ota.json +211 -0
- certificate/ag/wlt_types_ag_jsons/brg2gw_hb.json +894 -0
- certificate/ag/wlt_types_ag_jsons/brg2gw_hb_sleep.json +184 -0
- certificate/ag/wlt_types_ag_jsons/calibration.json +490 -0
- certificate/ag/wlt_types_ag_jsons/custom.json +614 -0
- certificate/ag/wlt_types_ag_jsons/datapath.json +900 -0
- certificate/ag/wlt_types_ag_jsons/energy2400.json +670 -0
- certificate/ag/wlt_types_ag_jsons/energySub1g.json +691 -0
- certificate/ag/wlt_types_ag_jsons/externalSensor.json +727 -0
- certificate/ag/wlt_types_ag_jsons/interface.json +1095 -0
- certificate/ag/wlt_types_ag_jsons/powerManagement.json +1439 -0
- certificate/ag/wlt_types_ag_jsons/side_info_sensor.json +105 -0
- certificate/ag/wlt_types_ag_jsons/signal_indicator_data.json +77 -0
- certificate/ag/wlt_types_ag_jsons/unified_echo_ext_pkt.json +126 -0
- certificate/ag/wlt_types_ag_jsons/unified_echo_pkt.json +175 -0
- certificate/ag/wlt_types_ag_jsons/unified_sensor_pkt.json +65 -0
- certificate/cert_common.py +46 -75
- certificate/cert_config.py +18 -43
- certificate/cert_data_sim.py +9 -12
- certificate/cert_defines.py +0 -9
- certificate/cert_gw_sim.py +7 -35
- certificate/cert_mqtt.py +5 -15
- certificate/cert_prints.py +0 -1
- certificate/cert_results.py +37 -56
- certificate/cert_utils.py +15 -27
- certificate/certificate.py +5 -12
- certificate/certificate_cli.py +13 -10
- certificate/certificate_eth_test_list.txt +4 -6
- certificate/certificate_sanity_test_list.txt +2 -3
- certificate/certificate_test_list.txt +4 -5
- certificate/tests/calibration/interval_test/interval_test.json +0 -1
- certificate/tests/calibration/output_power_test/output_power_test.json +0 -1
- certificate/tests/calibration/pattern_test/pattern_test.json +0 -1
- certificate/tests/cloud_connectivity/acl_ext_adv_test/acl_ext_adv_test.json +1 -2
- certificate/tests/cloud_connectivity/acl_test/acl_test.json +1 -2
- certificate/tests/cloud_connectivity/acl_test/acl_test.py +15 -13
- certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.json +1 -2
- certificate/tests/cloud_connectivity/brg_ota_test/brg_ota_test.py +6 -8
- certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.json +1 -2
- certificate/tests/cloud_connectivity/channel_scan_behaviour_test/channel_scan_behaviour_test.py +3 -3
- certificate/tests/cloud_connectivity/connection_test/connection_test.json +0 -1
- certificate/tests/cloud_connectivity/connection_test/connection_test.py +13 -6
- certificate/tests/cloud_connectivity/downlink_test/downlink_test.json +0 -1
- certificate/tests/cloud_connectivity/downlink_test/downlink_test.py +4 -1
- certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.json +1 -2
- certificate/tests/cloud_connectivity/ext_adv_stress_test/ext_adv_stress_test.py +14 -20
- certificate/tests/cloud_connectivity/reboot_test/reboot_test.json +0 -1
- certificate/tests/cloud_connectivity/reboot_test/reboot_test.py +0 -2
- certificate/tests/cloud_connectivity/registration_test/registration_test.json +0 -1
- certificate/tests/cloud_connectivity/registration_test/registration_test_cli.py +1 -1
- certificate/tests/cloud_connectivity/stress_test/stress_test.json +1 -2
- certificate/tests/cloud_connectivity/stress_test/stress_test.py +16 -20
- certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.json +0 -1
- certificate/tests/cloud_connectivity/uplink_ext_adv_test/uplink_ext_adv_test.py +2 -1
- certificate/tests/cloud_connectivity/uplink_test/uplink_test.json +0 -1
- certificate/tests/cloud_connectivity/uplink_test/uplink_test.py +20 -28
- certificate/tests/datapath/aging_test/aging_test.json +0 -1
- certificate/tests/datapath/aging_test/aging_test.py +3 -7
- certificate/tests/datapath/event_ble5_test/event_ble5_test.json +2 -3
- certificate/tests/datapath/event_ble5_test/event_ble5_test.py +13 -7
- certificate/tests/datapath/event_test/event_test.json +2 -3
- certificate/tests/datapath/event_test/event_test.py +10 -5
- certificate/tests/datapath/num_of_tags_test/num_of_tags_test.json +2 -3
- certificate/tests/datapath/num_of_tags_test/num_of_tags_test.py +5 -9
- certificate/tests/datapath/output_power_test/output_power_test.json +0 -1
- certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.json +0 -1
- certificate/tests/datapath/pacer_interval_ble5_test/pacer_interval_ble5_test.py +4 -4
- certificate/tests/datapath/pacer_interval_test/pacer_interval_test.json +0 -1
- certificate/tests/datapath/pattern_test/pattern_test.json +0 -1
- certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.json +0 -1
- certificate/tests/datapath/pkt_filter_ble5_chl21_test/pkt_filter_ble5_chl21_test.py +5 -5
- certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.json +0 -1
- certificate/tests/datapath/pkt_filter_ble5_test/pkt_filter_ble5_test.py +5 -5
- certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.json +0 -1
- certificate/tests/datapath/pkt_filter_brg2gw_ext_adv_test/pkt_filter_brg2gw_ext_adv_test.py +8 -10
- certificate/tests/datapath/pkt_filter_gen3_test/pkt_filter_gen3_test.json +0 -1
- certificate/tests/datapath/pkt_filter_test/pkt_filter_test.json +0 -1
- certificate/tests/datapath/rssi_threshold_test/rssi_threshold_test.json +1 -2
- certificate/tests/datapath/rx_channel_hopping_test/rx_channel_hopping_test.json +0 -1
- certificate/tests/datapath/rx_channel_test/rx_channel_test.json +0 -1
- certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.json +0 -1
- certificate/tests/datapath/rx_rate_gen2_test/rx_rate_gen2_test.py +1 -1
- certificate/tests/datapath/rx_rate_gen3_test/rx_rate_gen3_test.json +0 -1
- certificate/tests/datapath/stress_gen3_test/stress_gen3_test.json +0 -1
- certificate/tests/datapath/stress_gen3_test/stress_gen3_test.py +0 -3
- certificate/tests/datapath/stress_test/stress_test.json +0 -1
- certificate/tests/datapath/stress_test/stress_test.py +0 -3
- certificate/tests/datapath/tx_repetition_test/tx_repetition_test.json +0 -1
- certificate/tests/edge_mgmt/action_blink_test/action_blink_test.json +0 -1
- certificate/tests/edge_mgmt/action_get_battery_sensor_test/action_get_battery_sensor_test.json +0 -1
- certificate/tests/edge_mgmt/action_get_module_test/action_get_module_test.json +0 -1
- certificate/tests/edge_mgmt/action_get_pof_data_test/action_get_pof_data_test.json +0 -1
- certificate/tests/edge_mgmt/action_gw_hb_test/action_gw_hb_test.json +0 -1
- certificate/tests/edge_mgmt/action_reboot_test/action_reboot_test.json +0 -1
- certificate/tests/edge_mgmt/action_restore_defaults_test/action_restore_defaults_test.json +0 -1
- certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.json +0 -1
- certificate/tests/edge_mgmt/action_send_hb_test/action_send_hb_test.py +14 -18
- certificate/tests/edge_mgmt/periodic_msgs_test/periodic_msgs_test.json +0 -1
- certificate/tests/energy2400/duty_cycle_test/duty_cycle_test.json +0 -1
- certificate/tests/energy2400/output_power_test/output_power_test.json +0 -1
- certificate/tests/energy2400/pattern_test/pattern_test.json +0 -1
- certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.json +0 -1
- certificate/tests/energy2400/signal_indicator_ble5_test/signal_indicator_ble5_test.py +3 -4
- certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.json +9 -9
- certificate/tests/energy2400/signal_indicator_ext_adv_test/signal_indicator_ext_adv_test.py +271 -113
- certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.json +0 -1
- certificate/tests/energy2400/signal_indicator_test/signal_indicator_test.py +1 -1
- certificate/tests/energy_sub1g/duty_cycle_test/duty_cycle_test.json +0 -1
- certificate/tests/energy_sub1g/pattern_test/pattern_test.json +0 -1
- certificate/tests/pwr_mgmt/pwr_mgmt_test/pwr_mgmt_test.json +0 -1
- certificate/tests/sensors/ext_sensor_test/ext_sensor_test.json +0 -1
- certificate/tests/sensors/ext_sensor_test/ext_sensor_test.py +9 -4
- common/api_if/api_validation.py +2 -8
- common/web/templates/generator.html +79 -141
- common/web/web_utils.py +56 -78
- gui_certificate/server.py +78 -283
- gui_certificate/templates/cert_run.html +113 -179
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/METADATA +38 -27
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/RECORD +123 -109
- certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.json +0 -15
- certificate/tests/cloud_connectivity/deduplication_test/deduplication_test.py +0 -80
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/WHEEL +0 -0
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/entry_points.txt +0 -0
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/licenses/LICENSE +0 -0
- {wiliot_certificate-4.5.0.dist-info → wiliot_certificate-4.5.0a1.dist-info}/top_level.txt +0 -0
|
@@ -21,53 +21,24 @@
|
|
|
21
21
|
<h1 style="color:#00AB83">{{ title }}</h1>
|
|
22
22
|
<hr>
|
|
23
23
|
<form class="form-horizontal" id="form" action="">
|
|
24
|
-
<div class="row mb-3">
|
|
25
|
-
<div class="col-md-6">
|
|
26
|
-
<label for="filter_category" class="form-label"><strong>Filter by Type:</strong></label>
|
|
27
|
-
<select class="form-select" id="filter_category" name="filter_category" onchange="applyFilters()">
|
|
28
|
-
<option value="">All Types</option>
|
|
29
|
-
{% for cat in categories %}
|
|
30
|
-
<option value="{{ cat }}" {% if cat == filter_category or (not filter_category and cat == 'Module') %}selected{% endif %}>{{ cat }}</option>
|
|
31
|
-
{% endfor %}
|
|
32
|
-
</select>
|
|
33
|
-
</div>
|
|
34
|
-
<div class="col-md-6">
|
|
35
|
-
<label for="filter_version" class="form-label"><strong>Filter by API Version:</strong></label>
|
|
36
|
-
<select class="form-select" id="filter_version" name="filter_version" onchange="applyFilters()">
|
|
37
|
-
<option value="">All Versions</option>
|
|
38
|
-
{% for ver in api_versions %}
|
|
39
|
-
<option value="{{ ver }}" {% if ver == filter_version or (not filter_version and ver|int == API_VERSION_LATEST) %}selected{% endif %}>V{{ ver }}</option>
|
|
40
|
-
{% endfor %}
|
|
41
|
-
</select>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
<hr>
|
|
45
24
|
<div id="builder_form">
|
|
46
25
|
{% for n in pkt_types_list %}
|
|
47
|
-
<div class="form-check form-check-inline
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<input class="form-check-input" type="radio" name="radios" value="{{ n }}" id="radio_{{ n }}"
|
|
51
|
-
{% if n == wanted_pkt_type %}checked{% endif %} onclick="show();">
|
|
52
|
-
<label class="form-check-label" for="radio_{{ n }}">{{ n }}</label>
|
|
26
|
+
<div class="form-check form-check-inline">
|
|
27
|
+
<input class="form-check-input" type="radio" name="radios" value="{{ n }}" onclick="show();">
|
|
28
|
+
<label class="form-check-label" for="{{ n }}">{{ n }}</label>
|
|
53
29
|
</div>
|
|
54
30
|
{% endfor %}
|
|
55
31
|
{% for n,p in pkt_types.items() %}
|
|
56
|
-
<div id="{{ n }}_form"
|
|
32
|
+
<div id="{{ n }}_form">
|
|
57
33
|
<hr>
|
|
58
34
|
{% for k,v in p.__dict__.items() %}
|
|
59
35
|
<div class="row">
|
|
60
36
|
<label for="{{ n }}_{{ k }}" class="col-sm-2">{{ k }}:</label>
|
|
61
|
-
{%
|
|
62
|
-
|
|
63
|
-
{% if saved_value %}
|
|
64
|
-
{% set display_value = saved_value %}
|
|
65
|
-
{% elif k == 'brg_mac' or k == 'pkt_size' or k == 'ad_type' or k == 'uuid_msb' or k == 'uuid_lsb' or k == 'group_id' %}
|
|
66
|
-
{% set display_value = '0x' + ('%0x' % v).upper() %}
|
|
37
|
+
{% if k == 'brg_mac' or k == 'pkt_size' or k == 'ad_type' or k == 'uuid_msb' or k == 'uuid_lsb' or k == 'group_id' %}
|
|
38
|
+
<input type="text" class="col-sm-4" name="{{ n }}_{{ k }}" value="{{ '0x'+('%0x' % v).upper() }}">
|
|
67
39
|
{% else %}
|
|
68
|
-
{
|
|
40
|
+
<input type="text" class="col-sm-4" name="{{ n }}_{{ k }}" value="{{ v }}">
|
|
69
41
|
{% endif %}
|
|
70
|
-
<input type="text" class="col-sm-4" name="{{ n }}_{{ k }}" value="{{ display_value }}">
|
|
71
42
|
</div>
|
|
72
43
|
{% endfor %}
|
|
73
44
|
</div>
|
|
@@ -92,119 +63,86 @@
|
|
|
92
63
|
<br>
|
|
93
64
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
|
94
65
|
<script>
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
} else {
|
|
118
|
-
container.style.display = 'none';
|
|
119
|
-
// Uncheck if hidden
|
|
120
|
-
if (radio.checked) {
|
|
121
|
-
radio.checked = false;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const form = document.getElementById('form');
|
|
128
|
-
const group_id_brg2gw = {{ GROUP_ID_BRG2GW }};
|
|
129
|
-
const group_id_gw2brg = {{ GROUP_ID_GW2BRG }};
|
|
130
|
-
const group_id_side_info_sensor = {{ GROUP_ID_SIDE_INFO_SENSOR }};
|
|
131
|
-
const group_id_side_info = {{ GROUP_ID_SIDE_INFO }};
|
|
132
|
-
const group_id_signal_indicator = {{ GROUP_ID_SIGNAL_INDICATOR }};
|
|
133
|
-
const group_id_unified_v0 = {{ GROUP_ID_UNIFIED_PKT_V0 }};
|
|
134
|
-
const group_id_unified_v1 = {{ GROUP_ID_UNIFIED_PKT_V1 }};
|
|
135
|
-
const group_id_unified_v2 = {{ GROUP_ID_UNIFIED_PKT_V2 }};
|
|
136
|
-
const group_id_unified_ext_v0 = {{ GROUP_ID_BLE5_EXTENDED_V0 }};
|
|
137
|
-
const group_id_unified_ext_v1 = {{ GROUP_ID_BLE5_EXTENDED_V1 }};
|
|
138
|
-
var pktTypes = {{ pkt_types_list | tojson | safe }};
|
|
139
|
-
|
|
140
|
-
function showPktForm(pktType) {
|
|
141
|
-
// Hide all packet forms
|
|
142
|
-
pktTypes.forEach(function(type) {
|
|
143
|
-
var formEl = document.getElementById(type + "_form");
|
|
144
|
-
if (formEl) formEl.style.display = 'none';
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// Show appropriate header and packet form
|
|
148
|
-
if (pktType && pktType.includes("Unified")) {
|
|
149
|
-
document.getElementById("Hdr_form").style.display = 'none';
|
|
150
|
-
document.getElementById("DataHdr_form").style.display = 'block';
|
|
151
|
-
var default_value = 0;
|
|
152
|
-
if (pktType.includes("V0")) {
|
|
153
|
-
default_value = pktType.includes("Ext") ? group_id_unified_ext_v0 : group_id_unified_v0;
|
|
154
|
-
} else if (pktType.includes("V1")) {
|
|
155
|
-
default_value = pktType.includes("Ext") ? group_id_unified_ext_v1 : group_id_unified_v1;
|
|
156
|
-
} else if (pktType.includes("V2")) {
|
|
157
|
-
default_value = group_id_unified_v2;
|
|
66
|
+
function show()
|
|
67
|
+
{
|
|
68
|
+
const form = document.getElementById('form');
|
|
69
|
+
const group_id_brg2gw = {{ GROUP_ID_BRG2GW }};
|
|
70
|
+
const group_id_gw2brg = {{ GROUP_ID_GW2BRG }};
|
|
71
|
+
const group_id_side_info_sensor = {{ GROUP_ID_SIDE_INFO_SENSOR }};
|
|
72
|
+
const group_id_side_info = {{ GROUP_ID_SIDE_INFO }};
|
|
73
|
+
const group_id_signal_indicator = {{ GROUP_ID_SIGNAL_INDICATOR }};
|
|
74
|
+
const group_id_unified_v0 = {{ GROUP_ID_UNIFIED_PKT_V0 }};
|
|
75
|
+
const group_id_unified_v1 = {{ GROUP_ID_UNIFIED_PKT_V1 }};
|
|
76
|
+
const group_id_unified_v2 = {{ GROUP_ID_UNIFIED_PKT_V2 }};
|
|
77
|
+
const group_id_unified_ext_v0 = {{ GROUP_ID_BLE5_EXTENDED_V0 }};
|
|
78
|
+
const group_id_unified_ext_v1 = {{ GROUP_ID_BLE5_EXTENDED_V1 }};
|
|
79
|
+
var radios = document.getElementsByName("radios");
|
|
80
|
+
var pktTypes = {{ pkt_types_list | tojson | safe }};
|
|
81
|
+
console.log(pktTypes)
|
|
82
|
+
var forms = [];
|
|
83
|
+
|
|
84
|
+
for (var i = 0; i < pktTypes.length; i++) {
|
|
85
|
+
forms[i] = document.getElementById(pktTypes[i]+"_form");
|
|
86
|
+
if (pktTypes[i] != "Hdr"){
|
|
87
|
+
forms[i].style.display = 'none';
|
|
158
88
|
}
|
|
159
|
-
|
|
160
|
-
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for(var i = 0; i < radios.length; i++) {
|
|
92
|
+
radios[i].onclick = function() {
|
|
93
|
+
for(var j = 0; j < radios.length; j++) {
|
|
94
|
+
forms[j].style.display = 'none';
|
|
161
95
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
document.getElementById("DataHdr_form").style.display = 'none';
|
|
165
|
-
var default_value = 0;
|
|
166
|
-
if (pktType && pktType.includes("Brg2Gw")) {
|
|
167
|
-
default_value = group_id_brg2gw;
|
|
168
|
-
} else if (pktType && pktType.includes("Gw2Brg")) {
|
|
169
|
-
default_value = group_id_gw2brg;
|
|
170
|
-
} else if (pktType && pktType.includes("SignalIndicator")) {
|
|
171
|
-
default_value = group_id_signal_indicator;
|
|
172
|
-
} else if (pktType && pktType.includes("SideInfoSensor")) {
|
|
173
|
-
default_value = group_id_side_info_sensor;
|
|
174
|
-
} else if (pktType && pktType.includes("SideInfo")) {
|
|
175
|
-
default_value = group_id_side_info;
|
|
96
|
+
if (this.value == "DataHdr"){
|
|
97
|
+
document.getElementById("Hdr_form").style.display = 'none';
|
|
176
98
|
}
|
|
177
|
-
|
|
99
|
+
else{
|
|
100
|
+
document.getElementById("Hdr_form").style.display = 'block';
|
|
101
|
+
var default_value = 0;
|
|
102
|
+
if (this.value.includes("Brg2Gw")){
|
|
103
|
+
default_value = group_id_brg2gw;
|
|
104
|
+
}
|
|
105
|
+
else if (this.value.includes("Gw2Brg")){
|
|
106
|
+
default_value = group_id_gw2brg;
|
|
107
|
+
}
|
|
108
|
+
else if (this.value.includes("SignalIndicator")){
|
|
109
|
+
default_value = group_id_signal_indicator;
|
|
110
|
+
}
|
|
111
|
+
else if (this.value.includes("SideInfoSensor")){
|
|
112
|
+
default_value = group_id_side_info_sensor;
|
|
113
|
+
}
|
|
114
|
+
else if (this.value.includes("SideInfo")){
|
|
115
|
+
default_value = group_id_side_info;
|
|
116
|
+
}
|
|
117
|
+
else if (this.value.includes("Unified")){
|
|
118
|
+
if (this.value.includes("V0")){
|
|
119
|
+
if (this.value.includes("Ext")){
|
|
120
|
+
default_value = group_id_unified_ext_v0
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
default_value = group_id_unified_v0
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (this.value.includes("V1")){
|
|
127
|
+
if (this.value.includes("Ext")){
|
|
128
|
+
default_value = group_id_unified_ext_v1
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
default_value = group_id_unified_v1
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (this.value.includes("V2")){
|
|
135
|
+
default_value = group_id_unified_v2
|
|
136
|
+
}
|
|
137
|
+
}
|
|
178
138
|
form.elements.Hdr_group_id.value = "0x" + default_value.toString(16).toUpperCase();
|
|
179
139
|
}
|
|
140
|
+
console.log(this.value)
|
|
141
|
+
document.getElementById(this.value + "_form").style.display = 'block';
|
|
180
142
|
}
|
|
181
|
-
|
|
182
|
-
// Show the selected packet form
|
|
183
|
-
if (pktType) {
|
|
184
|
-
var pktForm = document.getElementById(pktType + "_form");
|
|
185
|
-
if (pktForm) pktForm.style.display = 'block';
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function show() {
|
|
190
|
-
// Set up click handlers
|
|
191
|
-
var radios = document.getElementsByName("radios");
|
|
192
|
-
for (var i = 0; i < radios.length; i++) {
|
|
193
|
-
radios[i].onclick = function() {
|
|
194
|
-
showPktForm(this.value);
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Show form for checked radio (if any)
|
|
199
|
-
for (var i = 0; i < radios.length; i++) {
|
|
200
|
-
if (radios[i].checked) {
|
|
201
|
-
showPktForm(radios[i].value);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
143
|
}
|
|
205
144
|
}
|
|
206
|
-
|
|
207
|
-
show(); // Initialize form display (will show selected packet form if one is checked)
|
|
145
|
+
show();
|
|
208
146
|
</script>
|
|
209
147
|
</body>
|
|
210
148
|
</html>
|
common/web/web_utils.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
from flask import render_template, request
|
|
3
|
+
import inspect
|
|
3
4
|
import argparse
|
|
4
5
|
import json
|
|
5
6
|
import re
|
|
@@ -27,7 +28,7 @@ FDM = "FDM"
|
|
|
27
28
|
CERT_WEB = "CERTIFICATE WEB"
|
|
28
29
|
|
|
29
30
|
# Defines to update jinja_env globals
|
|
30
|
-
GLOBAL_DEFINES_TO_UPDATE = {k:v for k,v in ag.__dict__.items() if 'GROUP_ID' in k
|
|
31
|
+
GLOBAL_DEFINES_TO_UPDATE = {k:v for k,v in ag.__dict__.items() if 'GROUP_ID' in k}
|
|
31
32
|
|
|
32
33
|
TestSchema = Dict[str, Any]
|
|
33
34
|
ModuleSchema = Dict[str, Any]
|
|
@@ -62,90 +63,46 @@ def utils_parser(app):
|
|
|
62
63
|
def utils_generator(app):
|
|
63
64
|
title = "Packet Generator"
|
|
64
65
|
output = ""
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return int(x, 16)
|
|
69
|
-
try:
|
|
70
|
-
return int(x)
|
|
71
|
-
except ValueError:
|
|
72
|
-
return default
|
|
73
|
-
|
|
74
|
-
def build_and_dump_pkt(pkt_type):
|
|
75
|
-
pkt_template = getattr(ag, pkt_type)()
|
|
76
|
-
pkt_params = {
|
|
77
|
-
k: parse_int_input(request.args.get(f"{pkt_type}_{k}"), pkt_template.__dict__.get(k, 0))
|
|
78
|
-
for k in pkt_template.__dict__.keys()
|
|
79
|
-
}
|
|
80
|
-
pkt = getattr(ag, pkt_type)(**pkt_params)
|
|
81
|
-
try:
|
|
82
|
-
return pkt.dump()
|
|
83
|
-
except Exception as e:
|
|
84
|
-
return f"<br>Error encoding {pkt_type} (bit structure error): {str(e)}<br>"
|
|
85
|
-
|
|
86
|
-
# Build packet types dictionary
|
|
87
|
-
dont_generate_strs = ["Cfg", "SideInfo"]
|
|
66
|
+
wanted_pkt_type = request.args.get('radios')
|
|
67
|
+
pkt = None
|
|
68
|
+
dont_generate = ["Generic", "Gw2BrgHb", "PktTypesMask", "WltPkt"]
|
|
88
69
|
wlt_pkt_types = {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
70
|
+
name: cls()
|
|
71
|
+
for name, cls in inspect.getmembers(ag, inspect.isclass)
|
|
72
|
+
if cls.__module__ == ag.__name__ and name not in dont_generate
|
|
92
73
|
}
|
|
74
|
+
# Find selected pkt type
|
|
75
|
+
for name ,p in wlt_pkt_types.items():
|
|
76
|
+
if name == wanted_pkt_type:
|
|
77
|
+
pkt = p
|
|
78
|
+
break
|
|
93
79
|
|
|
94
|
-
#
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if
|
|
100
|
-
|
|
101
|
-
elif pkt_name.startswith('Module'):
|
|
102
|
-
category = 'Module'
|
|
103
|
-
elif pkt_name.startswith('Action'):
|
|
104
|
-
category = 'Action'
|
|
105
|
-
elif pkt_name.startswith('Brg2Brg'):
|
|
106
|
-
category = 'Brg2Brg'
|
|
107
|
-
elif pkt_name.startswith('Brg2Gw'):
|
|
108
|
-
category = 'Brg2Gw'
|
|
109
|
-
elif pkt_name.startswith('Sensor'):
|
|
110
|
-
category = 'Sensor'
|
|
80
|
+
# Handle Hdr
|
|
81
|
+
hdr = wlt_pkt_types['Hdr']
|
|
82
|
+
wlt_pkt_types = {'Hdr': hdr, **{k: v for k, v in wlt_pkt_types.items() if k != 'Hdr'}} # Put 'Hdr' first
|
|
83
|
+
hdr_string = ""
|
|
84
|
+
for k in hdr.__dict__.keys():
|
|
85
|
+
if not request.args.get(f"Hdr_{k}"):
|
|
86
|
+
hdr_string += "{}={},".format(k, str(hdr.__dict__[k]))
|
|
111
87
|
else:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
version_match = re.search(r'V(\d+)$', pkt_name)
|
|
116
|
-
api_version = version_match.group(1) if version_match else None
|
|
117
|
-
|
|
118
|
-
pkt_metadata[pkt_name] = {
|
|
119
|
-
'category': category,
|
|
120
|
-
'api_version': api_version
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
# Get unique categories and API versions for filters
|
|
124
|
-
categories = sorted(set(m['category'] for m in pkt_metadata.values()))
|
|
125
|
-
api_versions = sorted(set(m['api_version'] for m in pkt_metadata.values() if m['api_version']),
|
|
126
|
-
key=lambda x: int(x) if x else 0, reverse=True)
|
|
127
|
-
|
|
128
|
-
wanted_pkt_type = request.args.get('radios')
|
|
129
|
-
if wanted_pkt_type:
|
|
130
|
-
# Determine header type and build header
|
|
131
|
-
hdr_type = 'DataHdr' if 'Unified' in wanted_pkt_type else 'Hdr'
|
|
132
|
-
output += build_and_dump_pkt(hdr_type)
|
|
133
|
-
output += build_and_dump_pkt(wanted_pkt_type)
|
|
134
|
-
|
|
135
|
-
# Get filter values to preserve them
|
|
136
|
-
filter_category = request.args.get('filter_category', '')
|
|
137
|
-
filter_version = request.args.get('filter_version', '')
|
|
138
|
-
|
|
139
|
-
# Get all form values to preserve them (convert MultiDict to regular dict, taking first value)
|
|
140
|
-
form_values = {k: v for k, v in request.args.items()}
|
|
88
|
+
hdr_string += "{}={},".format(k, str(request.args.get(f"Hdr_{k}")))
|
|
89
|
+
hdr = eval_pkt(f"Hdr({hdr_string[:-1]})")
|
|
90
|
+
output += hdr.dump()
|
|
141
91
|
|
|
92
|
+
# Handle selected pkt
|
|
93
|
+
if pkt:
|
|
94
|
+
pkt_string = ""
|
|
95
|
+
for k in pkt.__dict__.keys():
|
|
96
|
+
if not request.args.get(f"{type(pkt).__name__}_{k}"):
|
|
97
|
+
pkt_string += "{}={},".format(k, str(0))
|
|
98
|
+
else:
|
|
99
|
+
pkt_string += "{}={},".format(k, str(request.args.get(f"{type(pkt).__name__}_{k}")))
|
|
100
|
+
pkt = eval_pkt(f"{type(pkt).__name__}({pkt_string[0:-1]})")
|
|
101
|
+
output += pkt.dump()
|
|
142
102
|
print(output)
|
|
143
103
|
return render_template('generator.html',
|
|
144
104
|
app=app, title=title, output=txt2html(output),
|
|
145
|
-
pkt_types=wlt_pkt_types, pkt_types_list=
|
|
146
|
-
pkt_metadata=pkt_metadata, categories=categories, api_versions=api_versions,
|
|
147
|
-
wanted_pkt_type=wanted_pkt_type, form_values=form_values,
|
|
148
|
-
filter_category=filter_category, filter_version=filter_version)
|
|
105
|
+
pkt_types=wlt_pkt_types, pkt_types_list=[k for k in wlt_pkt_types.keys() if k != 'Hdr'])
|
|
149
106
|
|
|
150
107
|
def utils_tag2brg(app):
|
|
151
108
|
title = "Tag to Bridge Packet Converter"
|
|
@@ -338,6 +295,26 @@ def _read_json_safe(p: Path) -> Dict[str, Any]:
|
|
|
338
295
|
except Exception:
|
|
339
296
|
return {}
|
|
340
297
|
|
|
298
|
+
def _tooltip(meta: Dict[str, Any], fallback: str) -> str:
|
|
299
|
+
if not meta:
|
|
300
|
+
return fallback
|
|
301
|
+
# prefer human fields; keep it short
|
|
302
|
+
parts: List[str] = []
|
|
303
|
+
# for k in ("name", "title"):
|
|
304
|
+
# if isinstance(meta.get(k), str):
|
|
305
|
+
# parts.append(meta[k].strip())
|
|
306
|
+
for k in ("description", "desc", "objective", "purpose"):
|
|
307
|
+
if isinstance(meta.get(k), str):
|
|
308
|
+
parts.append(meta[k].strip())
|
|
309
|
+
break
|
|
310
|
+
if parts:
|
|
311
|
+
return "\n".join(parts[:2])
|
|
312
|
+
try:
|
|
313
|
+
s = json.dumps(meta, ensure_ascii=False, separators=(",", ":"))
|
|
314
|
+
return s[:240] + ("…" if len(s) > 240 else "")
|
|
315
|
+
except Exception:
|
|
316
|
+
return fallback
|
|
317
|
+
|
|
341
318
|
def scan_tests_dir(root: str | Path) -> Dict[str, Any]:
|
|
342
319
|
"""
|
|
343
320
|
Expect: <root>/<module>/<test>/{<test>.py, <test>.json}
|
|
@@ -382,12 +359,13 @@ def scan_tests_dir(root: str | Path) -> Dict[str, Any]:
|
|
|
382
359
|
"id": tid,
|
|
383
360
|
"module": mod_dir.name,
|
|
384
361
|
"name": test_dir.name,
|
|
362
|
+
# "label": test_dir.name.replace("_", " "),
|
|
385
363
|
"label": meta.get('name', test_dir.name.replace("_", " ")),
|
|
386
364
|
"dir": str(test_dir),
|
|
387
365
|
"py": str(py) if py else "",
|
|
388
366
|
"json_path": str(j) if j else "",
|
|
389
367
|
"meta": meta,
|
|
390
|
-
"tooltip": meta
|
|
368
|
+
"tooltip": _tooltip(meta, test_dir.name),
|
|
391
369
|
}
|
|
392
370
|
tests.append(item)
|
|
393
371
|
if py:
|