From 2486dffd24c1c85915853e1c5227ef4046f65a9c Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Mon, 13 Dec 2021 08:24:06 +0000 Subject: [PATCH] Simulate dump2 Multi-AP setup && Fix a crash --- .gitignore | 3 + dmtree/tr181/wifi.c | 22 +- libbbf_api/dmcommon.c | 2 +- test/files/etc/config/mapcontroller | 168 +-- .../tmp/wifi.dataelements.collector.dump.data | 1045 +++++------------ .../wifi.dataelements.collector.dump2.data | 360 +++--- .../libexec/rpcd/wifi.dataelements.collector | 7 +- 7 files changed, 524 insertions(+), 1083 deletions(-) diff --git a/.gitignore b/.gitignore index 87056b68..2607a911 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ tools/__pycache__ *\.log .libs m4/ +bbf_ubus +memory-report.xml +*.la diff --git a/dmtree/tr181/wifi.c b/dmtree/tr181/wifi.c index 824182f2..a5933df6 100644 --- a/dmtree/tr181/wifi.c +++ b/dmtree/tr181/wifi.c @@ -656,7 +656,7 @@ static json_object *dump2_find_device_object(const char *unique_key) return NULL; } -static json_object *find_radio_object(json_object *device_obj, const char *unique_key) +static json_object *dump_find_radio_object(json_object *device_obj, const char *unique_key) { json_object *radio_arr = NULL; json_object *radio_obj = NULL; @@ -675,6 +675,22 @@ static json_object *find_radio_object(json_object *device_obj, const char *uniqu return NULL; } +static json_object *dump2_find_radio_object(json_object *device_obj, const char *unique_key) +{ + json_object *radio_arr = NULL; + json_object *radio_obj = NULL; + int i = 0; + + dmjson_foreach_obj_in_array(device_obj, radio_arr, radio_obj, i, 1, "RadioList") { + + char *mac = dmjson_get_value(radio_obj, 1, "macaddr"); + if (strcmp(unique_key, mac) == 0) + return radio_obj; + } + + return NULL; +} + static int browseWiFiDataElementsNetworkDeviceInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) { struct wifi_data_element_args wifi_da_device_args = {0}; @@ -734,8 +750,8 @@ static int browseWiFiDataElementsNetworkDeviceRadioInst(struct dmctx *dmctx, DMN continue; wifi_da_radio_args.uci_s = p; - wifi_da_radio_args.dump_obj = find_radio_object(wifi_da_device->dump_obj, key); - wifi_da_radio_args.dump2_obj = find_radio_object(wifi_da_device->dump2_obj, key); + wifi_da_radio_args.dump_obj = dump_find_radio_object(wifi_da_device->dump_obj, key); + wifi_da_radio_args.dump2_obj = dump2_find_radio_object(wifi_da_device->dump2_obj, key); inst = handle_instance(dmctx, parent_node, p->dmmap_section, "wifi_da_device_instance", "wifi_da_device_alias"); diff --git a/libbbf_api/dmcommon.c b/libbbf_api/dmcommon.c index 6f126239..06634e05 100644 --- a/libbbf_api/dmcommon.c +++ b/libbbf_api/dmcommon.c @@ -1567,7 +1567,7 @@ char *base64_decode(const char *src) { int i, j = 0; - if (!src) + if (!src || *src == '\0') return ""; size_t decsize = strlen(src)*6/8; diff --git a/test/files/etc/config/mapcontroller b/test/files/etc/config/mapcontroller index b252698e..917eba58 100644 --- a/test/files/etc/config/mapcontroller +++ b/test/files/etc/config/mapcontroller @@ -1,108 +1,62 @@ - config controller 'controller' - option enabled '1' - option registrar '5 2' - option debug '0' - option enable_sta_steer '0' - option enable_bsta_steer '0' - option use_bcn_metrics '0' - option use_usta_metrics '0' - option primary_vid '1' - option primary_pcp '0' - option backhaul_steer '0' - option beacon_metrics '0' - option usta_metrics '0' - option traffic_separation '0' - option coordinated_cac '0' - -config ap - option band '5' - option ssid '5GHz-main' - option encryption 'sae-mixed' - option vid '100' - option type 'fronthaul' - option network 'lan' - option key 'M7YrYVYh9ULtm3QG' - -config ap - option band '5' - option ssid '5GHz-guest' - option encryption 'sae-mixed' - option vid '200' - option type 'fronthaul' - option network 'lan' - option key 'M7YrYVYh9ULtm3QG' - -config ap - option band '2' - option ssid 'MAP-608D26C4983C-2.4GHz' - option encryption 'sae-mixed' - option vid '100' - option type 'fronthaul' - option network 'lan' - option key 'M7YrYVYh9ULtm3QG' - -config ap - option band '5' - option ssid 'MAP-608D26C4983C-BH-5GHz' - option encryption 'sae' - option vid '1' - option type 'backhaul' - option network 'lan' - option key 'c12bf5457bc6189133d2a803fb09bb5b49e35b0e05d9abe449a5f6025441cc4' - -config ap - option band '2' - option ssid 'MAP-608D26C4983C-BH-2.4GHz' - option encryption 'sae' - option vid '10' - option type 'backhaul' - option network 'lan' - option key 'c12bf5457bc6189133d2a803fb09bb5b49e35b0e05d9abe449a5f6025441cc4' - -config node 'node_021111aabbcc' - option agent_id '02:11:11:aa:bb:cc' - option backhaul_ul_macaddr '00:00:00:00:00:01' - option backhaul_dl_macaddr '06:10:20:30:40:50' - option backhaul_type 'none' - option primary_vid '1' - option primary_pcp '0' - option report_sta_assocfails '1' - option report_sta_assocfails_rate '2' - option report_metric_periodic '0' - option report_scan '0' - list steer_exclude '00:aa:bb:cc:dd:11' - list steer_exclude '00:aa:bb:cc:dd:22' - list steer_exclude '00:aa:bb:cc:dd:33' - list steer_exclude_btm '00:aa:bb:cc:dd:44' - list steer_exclude_btm '00:aa:bb:cc:dd:55' - option steer_disallow '0' - option coordinated_cac '1' - option traffic_separation '1' - option sta_steer '1' - -config radio - option agent_id '02:11:11:aa:bb:cc' - option macaddr '02:12:12:bb:cc:dd' - option band '5' - option steer_policy '0' - option util_threshold '200' - option rcpi_threshold '60' - option report_rcpi_threshold '0' - option report_rcpi_hysteresis_margin '0' - option report_util_threshold '0' - option include_sta_stats '0' - option include_sta_metric '0' - -config radio - option agent_id '02:11:11:aa:bb:cc' - option macaddr '02:12:12:bb:cc:de' - option band '2' - option steer_policy '0' - option util_threshold '200' - option rcpi_threshold '30' - option report_rcpi_threshold '0' - option report_rcpi_hysteresis_margin '0' - option report_util_threshold '0' - option include_sta_stats '0' - option include_sta_metric '0' + option enabled '1' + option registrar '5 2' + option debug '0' + option enable_sta_steer '0' + option enable_bsta_steer '0' + option use_bcn_metrics '0' + option use_usta_metrics '0' + option primary_vid '1' + option primary_pcp '0' + +config interface 'lan' + +config ap + option band '5' + option ssid 'iopsysWrt-44D43771B410' + option encryption 'sae-mixed' + option key 'PCTQ44TNVKK5NU' + option vid '1' + option type 'fronthaul' + option network 'lan' + +config ap + option band '2' + option ssid 'iopsysWrt-44D43771B410' + option encryption 'sae-mixed' + option key 'PCTQ44TNVKK5NU' + option vid '1' + option type 'fronthaul' + option network 'lan' + +config ap + option band '5' + option ssid 'MAP-44D43771B410-BH-5GHz' + option encryption 'sae' + option type 'backhaul' + option vid '1' + option network 'lan' + option key '029be741b7ff7b4caf9b1b3c48c56030fed877c22f5031bc9cf0132d1672c2c' + +config ap + option band '2' + option ssid 'MAP-44D43771B410-BH-2.4GHz' + option encryption 'sae' + option type 'backhaul' + list disallow_bsta '0' + option vid '1' + option network 'lan' + option key '029be741b7ff7b4caf9b1b3c48c56030fed877c22f5031bc9cf0132d1672c2c' + +config node + option agent_id '46:d4:37:71:b4:10' + +config radio + option agent_id '46:d4:37:71:b4:10' + option macaddr '44:d4:37:71:b4:1f' + option band '5' + +config radio + option agent_id '46:d4:37:71:b4:10' + option macaddr '44:d4:37:71:b4:1e' + option band '2' diff --git a/test/files/tmp/wifi.dataelements.collector.dump.data b/test/files/tmp/wifi.dataelements.collector.dump.data index 2158528e..4a170fae 100644 --- a/test/files/tmp/wifi.dataelements.collector.dump.data +++ b/test/files/tmp/wifi.dataelements.collector.dump.data @@ -1,793 +1,300 @@ { - "date": "Thu Dec 9 15:57:41 2021", - "version": "0.2", - "description": "WFA Data Elements", - "TimeStamp": "2021-12-09T15:57:41+01:00", - "name": "wifi", - "data": [ - { - "wfa-dataelements:Network": { - "ID": "", - "NumberOfDevices": 1, - "ControllerID": "02:11:11:aa:bb:cc", - "TimeStamp": "2021-12-09T14:46:53+01:00", - "DeviceList": [ - { - "ID": "02:11:11:aa:bb:cc", - "NumberOfRadios": 2, - "CollectionInterval": 1230, - "RadioList": [ - { - "ID": "AhISu8zd", - "Noise": 95, - "NumberOfBSS": 1, - "Enabled": true, - "NumberOfCurrOpClass": 1, - "NumberOfUnassocSta": 0, - "Utilization": 56, - "Transmit": 0, - "ReceiveSelf": 0, - "RecieveOther": 0, - "BSSList": [ - { - "BSSID": "02:12:12:bb:cc:dd", - "SSID": "iopsysWrt-002207A2F052", - "TimeStamp": "2021-12-09T14:46:53+01:00", - "Enabled": false, - "LastChange": 0, - "NumberofSTA": 0, - "EstServiceParametersBE": "AAAA", - "EstServiceParametersBK": "AAAA", - "EstServiceParameterVO": "AAAA", - "EstServieParameterVI": "AAAA", - "UnicastBytesReceived": 0, - "UnicastBytesSent": 0, - "MulticastBytesReceived": 0, - "MulticastBytesSent": 0, - "BroadcastBytesReceived": 0, - "BroadcastBytesSent": 0, - "STAList": [ + "date": "Mon Dec 13 06:54:32 2021", + "version": "0.2", + "description": "WFA Data Elements", + "TimeStamp": "2021-12-13T06:54:32+01:00", + "name": "wifi", + "data": [ + { + "wfa-dataelements:Network": { + "ID": "", + "NumberOfDevices": 1, + "ControllerID": "46:d4:37:71:b4:10", + "TimeStamp": "2021-12-13T06:06:35+01:00", + "DeviceList": [ + { + "ID": "46:d4:37:71:b4:10", + "NumberOfRadios": 2, + "CollectionInterval": 0, + "RadioList": [ + { + "ID": "RNQ3cbQf", + "Noise": 170, + "NumberOfBSS": 2, + "Enabled": true, + "NumberOfCurrOpClass": 1, + "NumberOfUnassocSta": 0, + "Utilization": 0, + "Transmit": 56, + "ReceiveSelf": 56, + "RecieveOther": 68, + "BSSList": [ + { + "BSSID": "7e:d4:37:71:b4:18", + "SSID": "MAP-44D43771B410-BH-5GHz", + "TimeStamp": "2021-12-13T06:06:35+01:00", + "Enabled": true, + "LastChange": 0, + "NumberofSTA": 0, + "EstServiceParametersBE": "AAAA", + "EstServiceParametersBK": "AAAA", + "EstServiceParametersVO": "AAAA", + "EstServiceParametersVI": "AAAA", + "UnicastBytesReceived": 0, + "UnicastBytesSent": 0, + "MulticastBytesReceived": 0, + "MulticastBytesSent": 30, + "BroadcastBytesReceived": 0, + "BroadcastBytesSent": 0, + "STAList": [ - ] - } - ], - "Capabilites": { - "NumberOfOpClass": 3, - "OperatingClasses": [ - { - "Class": 81, - "MaxTxPower": 20, - "NumberOfNonOperChan": 0, - "NonOperable": [ - 93 - ] - }, - { - "Class": 83, - "MaxTxPower": 20, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ] + }, + { + "BSSID": "44:d4:37:71:b4:1f", + "SSID": "iopsysWrt-44D43771B410", + "TimeStamp": "2021-12-13T06:06:35+01:00", + "Enabled": true, + "LastChange": 0, + "NumberofSTA": 0, + "EstServiceParametersBE": "AAAA", + "EstServiceParametersBK": "AAAA", + "EstServiceParametersVO": "AAAA", + "EstServiceParametersVI": "AAAA", + "UnicastBytesReceived": 0, + "UnicastBytesSent": 0, + "MulticastBytesReceived": 0, + "MulticastBytesSent": 48, + "BroadcastBytesReceived": 0, + "BroadcastBytesSent": 0, + "STAList": [ - ] - }, - { - "Class": 84, - "MaxTxPower": 20, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ] + } + ], + "Capabilites": { + "NumberOfOpClass": 11, + "OperatingClasses": [ + { + "Class": 115, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - } - ], - "HTCapabilities": "Dg==", - "VHTCapabilities": "AA==", - "HECapabilities": "AAA=" - }, - "CurrentOperatingClasses": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 11, - "Class": 4, - "TxPower": 30 - } - ], - "ScanResultList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "NumberOfOpClassScans": 3, - "OpClassScanList": [ - { - "OperatingClass": 81, - "NumberOfChannelScans": 13, - "ChannelScanList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 1, - "NumberofNeighbors": 1, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - { - "StationCount": 1, - "ChannelUtilization": 14, - "BSSID": "02:12:12:bb:cc:de", - "SSID": "iopsysWrt-0022079FB7FC", - "SignalStrengh": -32, - "ChannelBandwidth": 0 - } - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 2, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ + ] + }, + { + "Class": 118, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 3, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ + ] + }, + { + "Class": 121, + "MaxTxPower": 30, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 4, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ + ] + }, + { + "Class": 116, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 5, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ + ] + }, + { + "Class": 119, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 6, - "NumberofNeighbors": 1, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - { - "StationCount": 0, - "ChannelUtilization": 0, - "BSSID": "50:0f:f5:89:20:41", - "SSID": "404 not found", - "SignalStrengh": -27, - "ChannelBandwidth": 1 - } - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 122, + "MaxTxPower": 30, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 117, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 120, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 123, + "MaxTxPower": 30, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 128, + "MaxTxPower": 30, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + }, + { + "Class": 129, + "MaxTxPower": 23, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ + ] + } + ], + "HTCapabilities": "Dg==", + "VHTCapabilities": "AAAAAAIw", + "HECapabilities": "AAA=" + }, + "CurrentOperatingClasses": [ + { + "TimeStamp": "2021-12-13T06:06:36+01:00", + "Channel": 36, + "Class": 128, + "TxPower": 30 + } + ], + "ScanResultList": [ - ] - } - ] - }, - { - "OperatingClass": 83, - "NumberOfChannelScans": 0, - "ChannelScanList": [ + ], + "UnassociatedStaList": [ - ] - }, - { - "OperatingClass": 84, - "NumberOfChannelScans": 0, - "ChannelScanList": [ + ], + "BackhaulSta": { + "MACAddress": "00:00:00:00:00:00" + } + }, + { + "ID": "RNQ3cbQe", + "Noise": 175, + "NumberOfBSS": 2, + "Enabled": true, + "NumberOfCurrOpClass": 1, + "NumberOfUnassocSta": 0, + "Utilization": 0, + "Transmit": 56, + "ReceiveSelf": 0, + "RecieveOther": 128, + "BSSList": [ + { + "BSSID": "7a:d4:37:71:b4:1f", + "SSID": "MAP-44D43771B410-BH-2.4GHz", + "TimeStamp": "2021-12-13T06:06:35+01:00", + "Enabled": true, + "LastChange": 0, + "NumberofSTA": 0, + "EstServiceParametersBE": "AAAA", + "EstServiceParametersBK": "AAAA", + "EstServiceParametersVO": "AAAA", + "EstServiceParametersVI": "AAAA", + "UnicastBytesReceived": 0, + "UnicastBytesSent": 0, + "MulticastBytesReceived": 0, + "MulticastBytesSent": 30, + "BroadcastBytesReceived": 0, + "BroadcastBytesSent": 0, + "STAList": [ - ] - } - ] - } - ], - "UnassociatedStaList": [ + ] + }, + { + "BSSID": "44:d4:37:71:b4:1e", + "SSID": "iopsysWrt-44D43771B410", + "TimeStamp": "2021-12-13T06:06:35+01:00", + "Enabled": true, + "LastChange": 0, + "NumberofSTA": 0, + "EstServiceParametersBE": "AAAA", + "EstServiceParametersBK": "AAAA", + "EstServiceParametersVO": "AAAA", + "EstServiceParametersVI": "AAAA", + "UnicastBytesReceived": 0, + "UnicastBytesSent": 0, + "MulticastBytesReceived": 0, + "MulticastBytesSent": 34, + "BroadcastBytesReceived": 0, + "BroadcastBytesSent": 0, + "STAList": [ - ], - "BackhaulSta": { - "MACAddress": "00:00:00:00:00:00" - } - }, - { - "ID": "AhISu8ze", - "Noise": 90, - "NumberOfBSS": 1, - "Enabled": true, - "NumberOfCurrOpClass": 1, - "NumberOfUnassocSta": 0, - "Utilization": 0, - "Transmit": 156, - "ReceiveSelf": 0, - "RecieveOther": 121, - "BSSList": [ - { - "BSSID": "02:12:12:bb:cc:de", - "SSID": "iopsysWrt-002207A2F052-new", - "TimeStamp": "2021-12-09T14:46:53+01:00", - "Enabled": false, - "LastChange": 0, - "NumberofSTA": 0, - "EstServiceParametersBE": "AAAA", - "EstServiceParametersBK": "AAAA", - "EstServiceParameterVO": "AAAA", - "EstServieParameterVI": "AAAA", - "UnicastBytesReceived": 0, - "UnicastBytesSent": 35, - "MulticastBytesReceived": 0, - "MulticastBytesSent": 0, - "BroadcastBytesReceived": 0, - "BroadcastBytesSent": 0, - "STAList": [ + ] + } + ], + "Capabilites": { + "NumberOfOpClass": 3, + "OperatingClasses": [ + { + "Class": 81, + "MaxTxPower": 20, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - } - ], - "Capabilites": { - "NumberOfOpClass": 13, - "OperatingClasses": [ - { - "Class": 115, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ - 93 - ] - }, - { - "Class": 118, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ] + }, + { + "Class": 83, + "MaxTxPower": 20, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "Class": 121, - "MaxTxPower": 30, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ] + }, + { + "Class": 84, + "MaxTxPower": 20, + "NumberOfNonOperChan": 0, + "NonOperable": [ - ] - }, - { - "Class": 116, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ] + } + ], + "HTCapabilities": "CA==", + "VHTCapabilities": "AAAAAAAA", + "HECapabilities": "AAA=" + }, + "CurrentOperatingClasses": [ + { + "TimeStamp": "2021-12-13T06:06:36+01:00", + "Channel": 6, + "Class": 81, + "TxPower": 20 + } + ], + "ScanResultList": [ - ] - }, - { - "Class": 119, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ + ], + "UnassociatedStaList": [ - ] - }, - { - "Class": 122, - "MaxTxPower": 30, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 117, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 120, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 123, - "MaxTxPower": 30, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 125, - "MaxTxPower": 30, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 128, - "MaxTxPower": 30, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 129, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - }, - { - "Class": 130, - "MaxTxPower": 23, - "NumberOfNonOperChan": 0, - "NonOperable": [ - - ] - } - ], - "HTCapabilities": "Dg==", - "VHTCapabilities": "AA==", - "HECapabilities": "AAA=" - }, - "CurrentOperatingClasses": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 36, - "Class": 128, - "TxPower": 30 - } - ], - "ScanResultList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "NumberOfOpClassScans": 13, - "OpClassScanList": [ - { - "OperatingClass": 115, - "NumberOfChannelScans": 4, - "ChannelScanList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 36, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 40, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 44, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 48, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - } - ] - }, - { - "OperatingClass": 118, - "NumberOfChannelScans": 4, - "ChannelScanList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 52, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 56, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 60, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 64, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - } - ] - }, - { - "OperatingClass": 121, - "NumberOfChannelScans": 11, - "ChannelScanList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 100, - "NumberofNeighbors": 1, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - { - "StationCount": 0, - "ChannelUtilization": 1, - "BSSID": "00:22:07:9f:b7:fd", - "SSID": "iopsysWrt-0022079FB7FC", - "SignalStrengh": -65, - "ChannelBandwidth": 2 - } - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "", - "Channel": 0, - "NumberofNeighbors": 0, - "Noise": 0, - "Utilization": 0, - "NeighborList": [ - - ] - } - ] - }, - { - "OperatingClass": 116, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 119, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 122, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 117, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 120, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 123, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 125, - "NumberOfChannelScans": 6, - "ChannelScanList": [ - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 149, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 153, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 157, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 161, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 165, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - }, - { - "TimeStamp": "2020-07-26T04:53:12+01:00", - "Channel": 169, - "NumberofNeighbors": 0, - "Noise": 100, - "Utilization": 50, - "NeighborList": [ - - ] - } - ] - }, - { - "OperatingClass": 128, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 129, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - }, - { - "OperatingClass": 130, - "NumberOfChannelScans": 0, - "ChannelScanList": [ - - ] - } - ] - } - ], - "UnassociatedStaList": [ - - ], - "BackhaulSta": { - "MACAddress": "00:00:00:00:00:00" - } - } - ] - } - ] - } - } - ] + ], + "BackhaulSta": { + "MACAddress": "00:00:00:00:00:00" + } + } + ] + } + ] + } + } + ] } - diff --git a/test/files/tmp/wifi.dataelements.collector.dump2.data b/test/files/tmp/wifi.dataelements.collector.dump2.data index 66f2df14..dfcc89e0 100644 --- a/test/files/tmp/wifi.dataelements.collector.dump2.data +++ b/test/files/tmp/wifi.dataelements.collector.dump2.data @@ -1,204 +1,160 @@ { - "num_ssid": 1, - "ssidlist": [ - { - "ssid": "5GHz-main", - "band": "5GHz", - "vid": 100, - "security": "WPA" - }, - { - "ssid": "5GHz-guest", - "band": "5GHz", - "vid": 200, - "security": "WPA" - }, - { - "ssid": "MAP-608D26C4983C-2.4GHz", - "band": "2.4GHz", - "vid": 100, - "security": "WPA" - }, - { - "ssid": "MAP-608D26C4983C-BH-5GHz", - "band": "5GHz", - "vid": 100, - "security": "WPA" - }, - { - "ssid": "MAP-608D26C4983C-BH-2.4GHz", - "band": "2.4GHz", - "vid": 100, - "security": "WPA" - } - ], - "num_ap_devices":1, - "APDeviceList": [ - { - "macaddr": "02:11:11:aa:bb:cc", - "manufacturer": "IOPSYS", - "oui": "00:22:07", - "product_class": "AP", - "serialnumber": "12345", - "version": "6.4", - "last_connect_time": "TODO", - "backhaul_type": "TODO", - "backhaul_macaddr": "TODO", - "backhaul_tx_bytes": 0, - "backhaul_rx_bytes": 0, - "backhaul_utilization": 0, - "backhaul_rcpi": 0, - "radar_detections": [ - ], - "MaxReportingRate": 80, - "MultiAPProfile": "TODO", - "MaxVIDs": 4095, - "DFSEnable": true, - "EasyMeshControllerOperationMode": "TODO", - "EasyMeshAgentOperationMode": "TODO", - "Backhaul_BackhaulMACAddress": "TODO", - "Backhaul_BackhaulDeviceID": "TODO", - "Backhaul_CurrentOperatingClassProfileNumberOfEntries": 1, - "Backhaul_CurrentOperatingClassProfile": [ - { - "Class": 10, - "Channel": 15, - "TxPower": -50, - "TimeStamp": "TODO" - } - ], - "Backhaul_BytesSent": 1, - "Backhaul_BytesReceived": 2, - "Backhaul_PacketsSent": 3, - "Backhaul_PacketsReceived": 4, - "Backhaul_ErrorsSent": 5, - "Backhaul_ErrorsReceived": 6, - "Backhaul_LinkUtilization": 7, - "Backhaul_SignalStrength": 8, - "Backhaul_LastDataDownlinkRate": 9, - "Backhaul_LastDataUplinkRate": 10, - "Backhaul_TimeStamp": "TODO", - "num_radios": 2, - "RadioList": [ - { - "ID": "AhISu8zd", - "band": 2, - "standard": "ax", - "channel": 8, - "bandwidth": 40, - "channel_ext": 1, - "mcs": 7, - "txpower": 23, - "channels": [ - - ], - "num_bss": 1, - "APList": [ - { - "bssid": "", - "ssid": "", - "num_steer_assoc_control": 12, - "num_steer_btm": 5, - "num_steer_btm_query": 1, - "num_stations": 1, - "StationList": [ - { - "macaddr": "", - "standard": "a", - "active": true, - "connect_time": 51, - "dl_rate": -52, - "ul_rate": -40, - "rcpi": 55, - "noise": -90, - "tx_bytes": 1, - "rx_bytes": 2, - "tx_packets": 3, - "rx_packets": 4, - "tx_error_packets": 5, - "rx_error_packets": 6, - "tx_retrans_packets": 7 - } - ] - } - ], - "scan_boot_only": true, - "scan_impact": 2, - "scan_interval": 50, - "scan_num_opclass": 1, - "OpClassChannels": [ - { - "OpClass": 10, - "ChannelList": "TODO" - } - ], - "num_CACMethod": 1, - "CACMethod": [ - { - "Method": 12 - } - ] - }, - { - "ID": "AhISu8ze", - "band": 2, - "standard": "ax", - "channel": 8, - "bandwidth": 40, - "channel_ext": 1, - "mcs": 7, - "txpower": 23, - "channels": [ - - ], - "num_bss": 1, - "APList": [ - { - "bssid": "", - "ssid": "", - "num_steer_assoc_control": 12, - "num_steer_btm": 5, - "num_steer_btm_query": 1, - "num_stations": 1, - "StationList": [ - { - "macaddr": "", - "standard": "a", - "active": true, - "connect_time": 51, - "dl_rate": -52, - "ul_rate": -40, - "rcpi": 55, - "noise": -90, - "tx_bytes": 1, - "rx_bytes": 2, - "tx_packets": 3, - "rx_packets": 4, - "tx_error_packets": 5, - "rx_error_packets": 6, - "tx_retrans_packets": 7 - } - ] - } - ], - "scan_boot_only": true, - "scan_impact": 2, - "scan_interval": 50, - "scan_num_opclass": 1, - "OpClassChannels": [ - { - "OpClass": 10, - "ChannelList": "TODO" - } - ], - "num_CACMethod": 1, - "CACMethod": [ - { - "Method": 12 - } - ] - } - ] - } - ] + "num_ssid": 4, + "ssidlist": [ + { + "ssid": "iopsysWrt-44D43771B410", + "band": "5GHz", + "vid": 1, + "security": "WPA3PSK/WPA2PSK+WPA3PSK" + }, + { + "ssid": "iopsysWrt-44D43771B410", + "band": "2.4GHz", + "vid": 1, + "security": "WPA3PSK/WPA2PSK+WPA3PSK" + }, + { + "ssid": "MAP-44D43771B410-BH-5GHz", + "band": "5GHz", + "vid": 1, + "security": "WPA3PSK" + }, + { + "ssid": "MAP-44D43771B410-BH-2.4GHz", + "band": "2.4GHz", + "vid": 1, + "security": "WPA3PSK" + } + ], + "num_ap_devices": 1, + "APDeviceList": [ + { + "macaddr": "46:d4:37:71:b4:10", + "manufacturer": "IOPSYS", + "oui": "00:22:07", + "product_class": "AP", + "serialnumber": "12345", + "version": "6.4", + "last_connect_time": "TODO", + "backhaul_type": "TODO", + "backhaul_macaddr": "TODO", + "backhaul_tx_bytes": 0, + "backhaul_rx_bytes": 0, + "backhaul_utilization": 0, + "backhaul_rcpi": 0, + "radar_detections": [ + + ], + "num_radios": 2, + "RadioList": [ + { + "macaddr": "44:d4:37:71:b4:1f", + "band": 5, + "standard": "ax", + "channel": 36, + "bandwidth": 80, + "channel_ext": 0, + "mcs": 0, + "txpower": 23, + "channels": [ + 36, + 40, + 44, + 48, + 52, + 56, + 60, + 64, + 100, + 104, + 108, + 112, + 116, + 120, + 124, + 128, + 132, + 136, + 140, + 144 + ], + "num_bss": 2, + "APList": [ + { + "bssid": "7e:d4:37:71:b4:18", + "ssid": "MAP-44D43771B410-BH-5GHz", + "num_steer_assoc_control": 0, + "num_steer_btm": 0, + "num_steer_btm_query": 0, + "num_stations": 0, + "StationList": [ + + ] + }, + { + "bssid": "44:d4:37:71:b4:1f", + "ssid": "iopsysWrt-44D43771B410", + "num_steer_assoc_control": 0, + "num_steer_btm": 0, + "num_steer_btm_query": 0, + "num_stations": 0, + "StationList": [ + + ] + } + ] + }, + { + "macaddr": "44:d4:37:71:b4:1e", + "band": 2, + "standard": "ax", + "channel": 6, + "bandwidth": 20, + "channel_ext": 0, + "mcs": 0, + "txpower": 20, + "channels": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 + ], + "num_bss": 2, + "APList": [ + { + "bssid": "7a:d4:37:71:b4:1f", + "ssid": "MAP-44D43771B410-BH-2.4GHz", + "num_steer_assoc_control": 0, + "num_steer_btm": 0, + "num_steer_btm_query": 0, + "num_stations": 0, + "StationList": [ + + ] + }, + { + "bssid": "44:d4:37:71:b4:1e", + "ssid": "iopsysWrt-44D43771B410", + "num_steer_assoc_control": 0, + "num_steer_btm": 0, + "num_steer_btm_query": 0, + "num_stations": 0, + "StationList": [ + + ] + } + ] + } + ] + } + ] } diff --git a/test/files/usr/libexec/rpcd/wifi.dataelements.collector b/test/files/usr/libexec/rpcd/wifi.dataelements.collector index 973c4e5f..37404487 100755 --- a/test/files/usr/libexec/rpcd/wifi.dataelements.collector +++ b/test/files/usr/libexec/rpcd/wifi.dataelements.collector @@ -4,10 +4,15 @@ case "$1" in list) - echo '{ "dump" : {}, "event": {}, "dump2": {} }' + echo '{ "status": {}, "dump" : {}, "event": {}, "dump2": {} }' ;; call) case "$2" in + status) + json_init + json_add_string status available + json_dump + ;; dump) cat /tmp/wifi.dataelements.collector.dump.data 2>/dev/null ;;