diff --git a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp index 99a5a1e560..2490da7f8a 100644 --- a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp +++ b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.cpp @@ -18,6 +18,8 @@ #include #include +#include +#include #include #include @@ -659,6 +661,33 @@ bool monitor_thread::create_ap_metrics_response(uint16_t mid, return true; } +bool monitor_thread::create_beacon_metrics_response(uint16_t mid, + const bwl::SBeaconResponse11k &hal_data) +{ + auto beacon_response = + cmdu_tx.create(mid, ieee1905_1::eMessageType::BEACON_METRICS_RESPONSE_MESSAGE); + + if (!beacon_response) { + LOG(ERROR) << "Failed to create BEACON_METRICS_RESPONSE_MESSAGE"; + return false; + } + + auto beacon_metrics_response_tlv = cmdu_tx.addClass(); + + if (!beacon_metrics_response_tlv) { + LOG(ERROR) << "Failed addClass"; + return false; + } + + // TODO: Add filling up the correct data according to the specification. + + std::copy_n(hal_data.sta_mac.oct, sizeof(hal_data.sta_mac.oct), + beacon_metrics_response_tlv->associated_sta_mac().oct); + beacon_response->finalize(); + + return true; +} + bool monitor_thread::update_sta_stats() { auto poll_cnt = mon_db.get_poll_cnt(); @@ -1381,6 +1410,8 @@ bool monitor_thread::handle_cmdu_ieee1905_1_message(Socket &sd, ieee1905_1::Cmdu return handle_ap_metrics_query(sd, cmdu_rx); case ieee1905_1::eMessageType::MULTI_AP_POLICY_CONFIG_REQUEST_MESSAGE: return handle_multi_ap_policy_config_request(sd, cmdu_rx); + case ieee1905_1::eMessageType::BEACON_METRICS_QUERY_MESSAGE: + return handle_beacon_metrics_query(sd, cmdu_rx); default: LOG(ERROR) << "Unknown CMDU message type: " << std::hex << int(cmdu_message_type); } @@ -1480,6 +1511,88 @@ bool monitor_thread::handle_ap_metrics_query(Socket &sd, ieee1905_1::CmduMessage return message_com::send_cmdu(slave_socket, cmdu_tx); } +bool monitor_thread::handle_beacon_metrics_query(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx) +{ + const auto mid = cmdu_rx.getMessageId(); + int dialog_token; + auto beacon_metrics_query_tlv = cmdu_rx.getClass(); + if (!beacon_metrics_query_tlv) { + LOG(ERROR) << "Beacon Metrics Query CMDU mid=" << mid + << " does not have Beacon Metric Query TLV"; + return false; + } + + bwl::SBeaconRequest11k bwl_request; + + bwl_request.measurement_mode = beerocks::MEASURE_MODE_ACTIVE; + bwl_request.channel = beacon_metrics_query_tlv->channel_number(); + bwl_request.op_class = beacon_metrics_query_tlv->operating_class(); + bwl_request.repeats = 0; + bwl_request.rand_ival = beerocks::BEACON_MEASURE_DEFAULT_RANDOMIZATION_INTERVAL; + + bwl_request.duration = beerocks::BEACON_MEASURE_DEFAULT_ACTIVE_DURATION; + + std::copy_n(beacon_metrics_query_tlv->associated_sta_mac().oct, sizeof(bwl_request.sta_mac.oct), + bwl_request.sta_mac.oct); + + std::copy_n(beacon_metrics_query_tlv->bssid().oct, sizeof(bwl_request.bssid.oct), + bwl_request.bssid.oct); + + bwl_request.parallel = 0; + bwl_request.enable = 0; + bwl_request.request = 1; + bwl_request.report = beacon_metrics_query_tlv->reporting_detail_value(); + bwl_request.mandatory_duration = 0; + bwl_request.expected_reports_count = 1; + bwl_request.use_optional_ssid = 0; + + auto ap_ch_report_length = beacon_metrics_query_tlv->ap_channel_reports_list_length(); + + if (ap_ch_report_length != 0 && bwl_request.channel != 255) { + LOG(ERROR) << "inconsistency between channel report length and channel number. please take " + "look at the specification. v1 17.2.27"; + return false; + } + + if (ap_ch_report_length > 1) { + // the reason we support only 1 channel list is that the hostapd does not support more + // there is no way to tell it for which operating class which channels to use + LOG(ERROR) + << "too many channles requested (the maximum is 237, current support is only for 1): " + << +ap_ch_report_length; + return false; + } + + // we support only one + if (1 == ap_ch_report_length) { + + // get the first (and currently only) structure from the list + auto channel = beacon_metrics_query_tlv->ap_channel_reports_list(0); + if (!std::get<0>(channel)) { + LOG(ERROR) << "there should be a structure at index 0, but it wasn't found"; + return false; + } + + // the number of channels, excluding the first operating class + bwl_request.use_optional_ap_ch_report = + std::get<1>(channel).ap_channel_report_list_length() - 1; + + // the first index in the tlv's channel-report-list is the operating class, + // we skip it. using pointer arithmethics and copying one element less from the source (we skip the operation class) + for (int idx = 0; idx < bwl_request.use_optional_ap_ch_report; ++idx) { + bwl_request.ap_ch_report[idx] = *std::get<1>(channel).ap_channel_report_list(idx + 1); + } + + auto request = mon_wlan_hal->sta_beacon_11k_request(bwl_request, dialog_token); + + if (!request) { + LOG(ERROR) << "BWL method sta_beacon_11k_request failed."; + return false; + } + } + return true; +} + bool monitor_thread::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t event_ptr) { if (!event_ptr) { @@ -1568,62 +1681,19 @@ bool monitor_thread::hal_event_handler(bwl::base_wlan_hal::hal_event_ptr_t event case Event::RRM_Beacon_Response: { auto hal_data = static_cast(data); - int id = 0; LOG(INFO) << "Received beacon measurement response on BSSID: " << (sMacAddr &)hal_data->bssid << ", dialog_token: " << int(hal_data->dialog_token); - // TODO: Can be changed to iterator loop? - auto event_map = pending_11k_events.equal_range("RRM_EVENT_BEACON_REP_RXED"); - for (auto it = event_map.first; it != event_map.second;) { - if ((it->second.dialog_token == hal_data->dialog_token) || - (hal_data->dialog_token == 0)) { - - id = it->second.id; - - auto response = message_com::create_vs_message< - beerocks_message::cACTION_MONITOR_CLIENT_BEACON_11K_RESPONSE>(cmdu_tx, id); - if (response == nullptr) { - LOG(ERROR) - << "Failed building cACTION_MONITOR_CLIENT_BEACON_11K_RESPONSE message!"; - break; - } - - // TODO: TEMPORARY CONVERSION! - response->params().channel = hal_data->channel; - response->params().op_class = hal_data->op_class; - response->params().dialog_token = hal_data->dialog_token; - response->params().measurement_token = hal_data->measurement_token; - response->params().rep_mode = hal_data->rep_mode; - response->params().phy_type = hal_data->phy_type; - response->params().frame_type = hal_data->frame_type; - response->params().rcpi = hal_data->rcpi; - response->params().rsni = hal_data->rsni; - response->params().ant_id = hal_data->ant_id; - response->params().duration = hal_data->duration; - response->params().parent_tsf = hal_data->parent_tsf; - response->params().start_time = hal_data->start_time; - response->params().new_ch_width = hal_data->new_ch_width; - response->params().new_ch_center_freq_seg_0 = hal_data->new_ch_center_freq_seg_0; - response->params().new_ch_center_freq_seg_1 = hal_data->new_ch_center_freq_seg_1; - response->params().use_optional_wide_band_ch_switch = - hal_data->use_optional_wide_band_ch_switch; - std::copy_n(hal_data->sta_mac.oct, sizeof(response->params().sta_mac.oct), - response->params().sta_mac.oct); - std::copy_n(hal_data->bssid.oct, sizeof(response->params().bssid.oct), - response->params().bssid.oct); - - it = pending_11k_events.erase(it); - LOG(INFO) << "Sending beacon measurement reponse on BSSID: " - << response->params().bssid << " to task_id: " << id; - - message_com::send_cmdu(slave_socket, cmdu_tx); - break; - } else { - ++it; - } + if (!create_beacon_metrics_response(0, *hal_data)) { + LOG(ERROR) << "Failed create_beacon_metrics_response."; + return false; } + LOG(DEBUG) << "Sending BEACON_METRICS_RESPONSE to slave_socket."; + + return message_com::send_cmdu(slave_socket, cmdu_tx); + } break; case Event::AP_Enabled: { diff --git a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.h b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.h index c82a43f736..335d2b8482 100644 --- a/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.h +++ b/agent/src/beerocks/fronthaul_manager/monitor/monitor_thread.h @@ -82,6 +82,15 @@ class monitor_thread : public beerocks::socket_thread { */ bool create_ap_metrics_response(uint16_t mid, const std::vector &bssid_list); + /** + * @brief Creates Beacon Metrics Response message + * + * @param mid Message ID. + * @param hal_data Data received from hostapd. + * @return True on success and false otherwise. + */ + bool create_beacon_metrics_response(uint16_t mid, const bwl::SBeaconResponse11k &hal_data); + bool update_ap_stats(); bool update_sta_stats(); @@ -146,6 +155,7 @@ class monitor_thread : public beerocks::socket_thread { bool handle_multi_ap_policy_config_request(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool handle_ap_metrics_query(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); + bool handle_beacon_metrics_query(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); }; } // namespace son diff --git a/agent/src/beerocks/slave/son_slave_thread.cpp b/agent/src/beerocks/slave/son_slave_thread.cpp index 0c32c532cc..f5194994ac 100644 --- a/agent/src/beerocks/slave/son_slave_thread.cpp +++ b/agent/src/beerocks/slave/son_slave_thread.cpp @@ -376,6 +376,8 @@ bool slave_thread::handle_cmdu_monitor_ieee1905_1_message(Socket &sd, switch (cmdu_message_type) { case ieee1905_1::eMessageType::AP_METRICS_RESPONSE_MESSAGE: return handle_monitor_ap_metrics_response(sd, cmdu_rx); + case ieee1905_1::eMessageType::BEACON_METRICS_RESPONSE_MESSAGE: + return handle_monitor_beacon_metrics_response(sd, cmdu_rx); default: LOG(ERROR) << "Unknown CMDU message type: " << std::hex << int(cmdu_message_type); return false; @@ -4320,25 +4322,15 @@ bool slave_thread::handle_client_steering_request(Socket *sd, ieee1905_1::CmduMe bool slave_thread::handle_beacon_metrics_query(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx) { - auto mid = cmdu_rx.getMessageId(); - LOG(DEBUG) << "Received BEACON_METRICS_QUERY_MESSAGE, mid=" << std::hex << int(mid); - - // create vs message - auto request_out = - message_com::create_vs_message( - cmdu_tx, mid); - if (request_out == nullptr) { - LOG(ERROR) << "Failed building ACTION_MONITOR_CLIENT_BEACON_11K_REQUEST message!"; - return false; - } - - if (!gate::load(request_out, cmdu_rx)) { - LOG(ERROR) << "faild translating 1905 message to vs message"; + const auto mid = cmdu_rx.getMessageId(); + LOG(DEBUG) << "Forwarding BEACON_METRICS_QUERY_MESSAGE to monitor_socket, mid=" << std::hex + << int(mid); + uint16_t length = message_com::get_uds_header(cmdu_rx)->length; + cmdu_rx.swap(); // swap back before forwarding + if (!message_com::forward_cmdu_to_uds(monitor_socket, cmdu_rx, length)) { + LOG(ERROR) << "Failed forwarding BEACON_METRICS_QUERY_MESSAGE message to monitor_socket"; return false; } - - message_com::send_cmdu(monitor_socket, cmdu_tx); - return true; } @@ -4373,6 +4365,45 @@ bool slave_thread::handle_monitor_ap_metrics_response(Socket &sd, return true; } +bool slave_thread::handle_monitor_beacon_metrics_response(Socket &sd, + ieee1905_1::CmduMessageRx &cmdu_rx) +{ + const auto mid = cmdu_rx.getMessageId(); + LOG(DEBUG) << "Forwarding BEACON_METRICS_RESPONSE_MESSAGE to controller, mid=" << std::hex + << int(mid); + + auto monitor_beacon_response = cmdu_rx.getClass(); + + if (!monitor_beacon_response) { + LOG(ERROR) << "Failed getClass"; + return false; + } + + auto beacon_response = + cmdu_tx.create(mid, ieee1905_1::eMessageType::BEACON_METRICS_RESPONSE_MESSAGE); + + if (!beacon_response) { + LOG(ERROR) << "Failed to create BEACON_METRICS_RESPONSE_MESSAGE"; + return false; + } + + auto beacon_metrics_response_tlv = cmdu_tx.addClass(); + + if (!beacon_metrics_response_tlv) { + LOG(ERROR) << "Failed addClass"; + return false; + } + + // TODO: Add filling up the correct data according to the specification. + + beacon_metrics_response_tlv->associated_sta_mac() = + monitor_beacon_response->associated_sta_mac(); + + beacon_response->finalize(); + + return send_cmdu_to_controller(cmdu_tx); +} + bool slave_thread::handle_channel_preference_query(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx) { const auto mid = cmdu_rx.getMessageId(); diff --git a/agent/src/beerocks/slave/son_slave_thread.h b/agent/src/beerocks/slave/son_slave_thread.h index 8ac74efda6..a250960ffc 100644 --- a/agent/src/beerocks/slave/son_slave_thread.h +++ b/agent/src/beerocks/slave/son_slave_thread.h @@ -225,6 +225,7 @@ class slave_thread : public beerocks::socket_thread { bool send_operating_channel_report(); bool handle_ap_metrics_query(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool handle_monitor_ap_metrics_response(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); + bool handle_monitor_beacon_metrics_response(Socket &sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool handle_channel_preference_query(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool handle_channel_selection_request(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx); bool channel_selection_get_channel_preference(ieee1905_1::CmduMessageRx &cmdu_rx); diff --git a/controller/src/beerocks/master/son_actions.cpp b/controller/src/beerocks/master/son_actions.cpp index f628f30035..aa2c349617 100644 --- a/controller/src/beerocks/master/son_actions.cpp +++ b/controller/src/beerocks/master/son_actions.cpp @@ -318,7 +318,7 @@ void son_actions::handle_dead_node(std::string mac, std::string hostap_mac, db & } /* - * set all nodes in the subtree as disconnected + * set all nodes in the subtree as disconnected */ if (mac_type != beerocks::TYPE_CLIENT) { @@ -505,3 +505,70 @@ bool son_actions::send_ap_config_renew_msg(ieee1905_1::CmduMessageTx &cmdu_tx, d return result; } + +bool son_actions::send_beacon_metrics_query_msg(ieee1905_1::CmduMessageTx &cmdu_tx, db &database, + const sMacAddr &sta_mac) +{ + std::string bssid = database.get_node_parent(tlvf::mac_to_string(sta_mac)); + std::string radio_mac = database.get_node_parent_radio(bssid); + auto agent_mac = database.get_node_parent_ire(bssid); + + auto measurement_request = + cmdu_tx.create(0, ieee1905_1::eMessageType::BEACON_METRICS_QUERY_MESSAGE); + + if (!measurement_request) { + LOG(ERROR) << "Failed building BEACON_METRICS_QUERY_MESSAGE"; + return false; + } + + auto tlvBeaconMtericsQuery = cmdu_tx.addClass(); + + if (!tlvBeaconMtericsQuery) { + LOG(ERROR) << "Failed addClass"; + return false; + } + + tlvBeaconMtericsQuery->associated_sta_mac() = sta_mac; + tlvBeaconMtericsQuery->operating_class() = + database.get_hostap_operating_class(tlvf::mac_from_string(bssid)); + tlvBeaconMtericsQuery->channel_number() = database.get_node_channel(bssid); + tlvBeaconMtericsQuery->bssid() = tlvf::mac_from_string(bssid); + + // According to the 10.3.3 from EMR1 specification + // reporting_detail_value should be 1 for minimize + // the disruption potentially caused to the ongoing + // traffic of the specified STA + tlvBeaconMtericsQuery->reporting_detail_value() = 1; + + auto ssid = database.get_hostap_ssid(bssid); + + tlvBeaconMtericsQuery->ssid_length() = ssid.length(); + + if (!tlvBeaconMtericsQuery->alloc_ssid(ssid.length() + 1)) { + LOG(ERROR) << "Failed allocage buffer for SSID"; + return false; + } + tlvBeaconMtericsQuery->set_ssid(ssid); + + if (tlvBeaconMtericsQuery->channel_number() != 255) { + + // If the value of Channel Number field is not set to 255, + // h (ap_channel_reports_num) is set to 0. + tlvBeaconMtericsQuery->ap_channel_reports_num() = 0; + } else { + // TODO: If the value of the Number of AP Channel Reports field (h) + // in the query is greater than zero and the value of the + // Channel Number field in the query is 255, then h AP Channel + // Report subelements shall be included in the 802.11 Beacon request, + // each containing thespecified Operating Class and Channel List. + LOG(DEBUG) << "Unsupported condition: channel_number == 255"; + } + + // TODO: find the correct value for elemnt_id_list_length() + tlvBeaconMtericsQuery->elemnt_id_list_length() = 0; + + LOG(DEBUG) << "Send BEACON_METRICS_QUERY_MESSAGE for sta: " << sta_mac; + son_actions::send_cmdu_to_agent(agent_mac, cmdu_tx, database, radio_mac); + + return true; +} diff --git a/controller/src/beerocks/master/son_actions.h b/controller/src/beerocks/master/son_actions.h index fba85f867b..edaa4003b1 100644 --- a/controller/src/beerocks/master/son_actions.h +++ b/controller/src/beerocks/master/son_actions.h @@ -18,6 +18,7 @@ #include #include #include +#include #define CLI_LOG(a) LOG(a) @@ -59,6 +60,8 @@ class son_actions { db &database, const std::string &radio_mac = std::string()); static bool send_ap_config_renew_msg(ieee1905_1::CmduMessageTx &cmdu_tx, db &database, const sMacAddr &al_mac); + static bool send_beacon_metrics_query_msg(ieee1905_1::CmduMessageTx &cmdu_tx, db &database, + const sMacAddr &sta_mac); private: static bool diff --git a/controller/src/beerocks/master/son_management.cpp b/controller/src/beerocks/master/son_management.cpp index 360471ca8f..bfbb803fd5 100644 --- a/controller/src/beerocks/master/son_management.cpp +++ b/controller/src/beerocks/master/son_management.cpp @@ -387,43 +387,54 @@ void son_management::handle_cli_message(Socket *sd, auto agent_mac = database.get_node_parent_ire(hostap_mac); LOG(DEBUG) << "CLI beacon request for " << client_mac << " to " << hostap_mac; - auto request = message_com::create_vs_message< - beerocks_message::cACTION_CONTROL_CLIENT_BEACON_11K_REQUEST>(cmdu_tx); - if (request == nullptr) { - LOG(ERROR) << "Failed building ACTION_CONTROL_CLIENT_BEACON_11K_REQUEST message!"; + auto beacon_metrics_request = + cmdu_tx.create(0, ieee1905_1::eMessageType::BEACON_METRICS_QUERY_MESSAGE); + if (!beacon_metrics_request) { + LOG(ERROR) << "Failed create BEACON_METRICS_QUERY_MESSAGE"; + isOK = false; + break; + } + + auto beacon_metrics_request_tlv = cmdu_tx.addClass(); + + if (!beacon_metrics_request_tlv) { + LOG(ERROR) << "Failed create BEACON_METRICS_QUERY_MESSAGE"; + isOK = false; + break; + } + beacon_metrics_request_tlv->associated_sta_mac() = cli_request->client_mac(); + + beacon_metrics_request_tlv->operating_class() = cli_request->op_class(); + beacon_metrics_request_tlv->channel_number() = cli_request->channel(); + beacon_metrics_request_tlv->bssid() = cli_request->bssid(); + beacon_metrics_request_tlv->reporting_detail_value() = 1; + beacon_metrics_request_tlv->ssid_length() = beerocks::message::WIFI_SSID_MAX_LENGTH; + + if (!beacon_metrics_request_tlv->alloc_ssid(beerocks::message::WIFI_SSID_MAX_LENGTH)) { + LOG(ERROR) << "Couldn't allocate memory for SSID."; isOK = false; break; } - //TODO: set params values - request->params().measurement_mode = - cli_request - ->measurement_mode(); // son::eWiFiMeasurementMode11K. Should be replaced with string "passive"/"active"/"table" - request->params().channel = cli_request->channel(); - request->params().op_class = cli_request->op_class(); - request->params().repeats = - cli_request - ->repeats(); // '0' = once, '65535' = repeats until cancel request, other (1-65534) = specific num of repeats - request->params().rand_ival = - cli_request - ->rand_ival(); // random interval - specifies the upper bound of the random delay to be used prior to making the measurement, expressed in units of TUs [=1024usec] - request->params().duration = - cli_request->duration(); // measurement duration, expressed in units of TUs [=1024usec] - request->params().sta_mac = cli_request->client_mac(); - request->params().bssid = - cli_request - ->bssid(); // the bssid which will be reported. for all bssid, use wildcard "ff:ff:ff:ff:ff:ff" - - request->params().expected_reports_count = 1; - - // Optional: - if (cli_request->use_optional_ssid()) { - request->params().use_optional_ssid = 1; // bool - string_utils::copy_string(request->params().ssid, (char *)cli_request->ssid(), - beerocks::message::WIFI_SSID_MAX_LENGTH); + + beacon_metrics_request_tlv->set_ssid((char *)cli_request->ssid()); + + if (beacon_metrics_request_tlv->channel_number() != 255) { + + // If the value of Channel Number field is not set to 255, + // h (ap_channel_reports_num) is set to 0. + beacon_metrics_request_tlv->ap_channel_reports_num() = 0; } else { - request->params().use_optional_ssid = 0; + // TODO: If the value of the Number of AP Channel Reports field (h) + // in the query is greater than zero and the value of the + // Channel Number field in the query is 255, then h AP Channel + // Report subelements shall be included in the 802.11 Beacon request, + // each containing thespecified Operating Class and Channel List. + LOG(DEBUG) << "Unsupported condition: channel_number == 255"; } + // TODO: find the correct value for elemnt_id_list_length() + beacon_metrics_request_tlv->elemnt_id_list_length() = 0; + const auto parent_radio = database.get_node_parent_radio(hostap_mac); son_actions::send_cmdu_to_agent(agent_mac, cmdu_tx, database, parent_radio); diff --git a/controller/src/beerocks/master/tasks/association_handling_task.cpp b/controller/src/beerocks/master/tasks/association_handling_task.cpp index d8b6377323..8f34a1b754 100644 --- a/controller/src/beerocks/master/tasks/association_handling_task.cpp +++ b/controller/src/beerocks/master/tasks/association_handling_task.cpp @@ -132,37 +132,11 @@ void association_handling_task::work() TASK_LOG(DEBUG) << "started association_handling_task, looking for beacon measurement " "capabilities on " << sta_mac; - std::string bssid = database.get_node_parent(sta_mac); - std::string radio_mac = database.get_node_parent_radio(bssid); - auto agent_mac = database.get_node_parent_ire(bssid); - - auto measurement_request = message_com::create_vs_message< - beerocks_message::cACTION_CONTROL_CLIENT_BEACON_11K_REQUEST>(cmdu_tx, id); - - if (measurement_request == nullptr) { - LOG(ERROR) << "Failed building ACTION_CONTROL_CLIENT_BEACON_11K_REQUEST message!"; + if (!son::son_actions::send_beacon_metrics_query_msg(cmdu_tx, database, + tlvf::mac_from_string(sta_mac))) { + LOG(ERROR) << "Failed sending BEACON_METRICS_QUERY_MESSAGE for sta: " << sta_mac; return; } - measurement_request->params().measurement_mode = - beerocks::MEASURE_MODE_ACTIVE; // son::eMeasurementMode11K "passive"/"active"/"table" - measurement_request->params().channel = database.get_node_channel(bssid); - measurement_request->params().op_class = - database.get_hostap_operating_class(tlvf::mac_from_string(bssid)); - measurement_request->params().rand_ival = beerocks:: - BEACON_MEASURE_DEFAULT_RANDOMIZATION_INTERVAL; // random interval - specifies the upper bound of the random delay to be used prior to making the measurement, expressed in units of TUs [=1024usec] - measurement_request->params().duration = beerocks:: - BEACON_MEASURE_DEFAULT_ACTIVE_DURATION; // measurement duration, expressed in units of TUs [=1024usec] - measurement_request->params().sta_mac = tlvf::mac_from_string(sta_mac); - measurement_request->params().bssid = tlvf::mac_from_string(bssid); - //measurement_request.params.use_optional_ssid = true; - measurement_request->params().expected_reports_count = 1; - //mapf::utils::copy_string(measurement_request.params.ssid, database.get_hostap_vap_ssid(bssid).c_str(), sizeof(measurement_request.params.ssid)); - add_pending_mac(radio_mac, beerocks_message::ACTION_CONTROL_CLIENT_BEACON_11K_RESPONSE); - TASK_LOG(DEBUG) << "requested beacon measurement request from sta: " << sta_mac - << " on bssid: " << bssid; - - son_actions::send_cmdu_to_agent(agent_mac, cmdu_tx, database, radio_mac); - set_responses_timeout(BEACON_MEASURE_REQ_TIME_SPAN); break; } @@ -397,8 +371,8 @@ void association_handling_task::finalize_new_connection() } else { LOG(INFO) << "handoff complete for " << sta_mac; - /* - * kill existing roaming task + /* + * kill existing roaming task */ int prev_roaming_task = database.get_roaming_task_id(sta_mac); LOG(DEBUG) << "kill prev_roaming_task " << prev_roaming_task; diff --git a/controller/src/beerocks/master/tasks/optimal_path_task.cpp b/controller/src/beerocks/master/tasks/optimal_path_task.cpp index 1692ef04b7..84bd5264cd 100644 --- a/controller/src/beerocks/master/tasks/optimal_path_task.cpp +++ b/controller/src/beerocks/master/tasks/optimal_path_task.cpp @@ -37,7 +37,7 @@ using namespace son; * example), missed the probe or due to the AP bad reception. * There is a high probability to get responsiveness less than 100% and therefore, the * threshold was changed to 50% as part of demo optimizations. -* This hardcoded threshold is temporary and shall be revised in the future. +* This hardcoded threshold is temporary and shall be revised in the future. * update: increasing to 80% since in bandsteering scenario there are only 2 radios * and 50% means optimal path always will fail to find an additional candidate. */ @@ -328,20 +328,11 @@ void optimal_path_task::work() TASK_LOG(DEBUG) << "requested 11K beacon measurement request from sta: " << sta_mac << " on bssid: " << vap_mac; - auto request = message_com::create_vs_message< - beerocks_message::cACTION_CONTROL_CLIENT_BEACON_11K_REQUEST>(cmdu_tx, id); - if (request == nullptr) { - LOG(ERROR) - << "Failed building ACTION_CONTROL_CLIENT_BEACON_11K_REQUEST message!"; - break; + if (!son::son_actions::send_beacon_metrics_query_msg( + cmdu_tx, database, tlvf::mac_from_string(sta_mac))) { + LOG(ERROR) << "Failed sending BEACON_METRICS_QUERY_MESSAGE"; } - request->params() = measurement_request; - - son_actions::send_cmdu_to_agent(current_agent_mac, cmdu_tx, database, - current_hostap); - - set_responses_timeout(BEACON_MEASUREMENT_REQUEST_TIMEOUT_MSEC); iterator_element_counter++; potential_ap_iter++; diff --git a/framework/tlvf/AutoGenerated/include/tlvf/wfa_map/tlvBeaconMetricsQuery.h b/framework/tlvf/AutoGenerated/include/tlvf/wfa_map/tlvBeaconMetricsQuery.h index 24bd8199c2..eddb3ae98d 100644 --- a/framework/tlvf/AutoGenerated/include/tlvf/wfa_map/tlvBeaconMetricsQuery.h +++ b/framework/tlvf/AutoGenerated/include/tlvf/wfa_map/tlvBeaconMetricsQuery.h @@ -49,6 +49,7 @@ class tlvBeaconMetricsQuery : public BaseClass bool set_ssid(const std::string& str); bool set_ssid(const char buffer[], size_t size); bool alloc_ssid(size_t count = 1); + uint8_t& ap_channel_reports_num(); uint8_t& ap_channel_reports_list_length(); std::tuple ap_channel_reports_list(size_t idx); std::shared_ptr create_ap_channel_reports_list(); @@ -74,6 +75,7 @@ class tlvBeaconMetricsQuery : public BaseClass char* m_ssid = nullptr; size_t m_ssid_idx__ = 0; int m_lock_order_counter__ = 0; + uint8_t* m_ap_channel_reports_num = nullptr; uint8_t* m_ap_channel_reports_list_length = nullptr; cApChannelReports* m_ap_channel_reports_list = nullptr; size_t m_ap_channel_reports_list_idx__ = 0; diff --git a/framework/tlvf/AutoGenerated/src/tlvf/wfa_map/tlvBeaconMetricsQuery.cpp b/framework/tlvf/AutoGenerated/src/tlvf/wfa_map/tlvBeaconMetricsQuery.cpp index 0b8516a33b..16c3cf1cf0 100644 --- a/framework/tlvf/AutoGenerated/src/tlvf/wfa_map/tlvBeaconMetricsQuery.cpp +++ b/framework/tlvf/AutoGenerated/src/tlvf/wfa_map/tlvBeaconMetricsQuery.cpp @@ -98,6 +98,7 @@ bool tlvBeaconMetricsQuery::alloc_ssid(size_t count) { size_t move_length = getBuffRemainingBytes(src) - len; std::copy_n(src, move_length, dst); } + m_ap_channel_reports_num = (uint8_t *)((uint8_t *)(m_ap_channel_reports_num) + len); m_ap_channel_reports_list_length = (uint8_t *)((uint8_t *)(m_ap_channel_reports_list_length) + len); m_ap_channel_reports_list = (cApChannelReports *)((uint8_t *)(m_ap_channel_reports_list) + len); m_elemnt_id_list_length = (uint8_t *)((uint8_t *)(m_elemnt_id_list_length) + len); @@ -112,6 +113,10 @@ bool tlvBeaconMetricsQuery::alloc_ssid(size_t count) { return true; } +uint8_t& tlvBeaconMetricsQuery::ap_channel_reports_num() { + return (uint8_t&)(*m_ap_channel_reports_num); +} + uint8_t& tlvBeaconMetricsQuery::ap_channel_reports_list_length() { return (uint8_t&)(*m_ap_channel_reports_list_length); } @@ -284,6 +289,7 @@ size_t tlvBeaconMetricsQuery::get_initial_size() class_size += sizeof(sMacAddr); // bssid class_size += sizeof(uint8_t); // reporting_detail_value class_size += sizeof(uint8_t); // ssid_length + class_size += sizeof(uint8_t); // ap_channel_reports_num class_size += sizeof(uint8_t); // ap_channel_reports_list_length class_size += sizeof(uint8_t); // elemnt_id_list_length return class_size; @@ -353,6 +359,12 @@ bool tlvBeaconMetricsQuery::init() LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(char) * (ssid_length) << ") Failed!"; return false; } + m_ap_channel_reports_num = reinterpret_cast(m_buff_ptr__); + if (!buffPtrIncrementSafe(sizeof(uint8_t))) { + LOG(ERROR) << "buffPtrIncrementSafe(" << std::dec << sizeof(uint8_t) << ") Failed!"; + return false; + } + if(m_length && !m_parse__){ (*m_length) += sizeof(uint8_t); } m_ap_channel_reports_list_length = reinterpret_cast(m_buff_ptr__); if (!m_parse__) *m_ap_channel_reports_list_length = 0; if (!buffPtrIncrementSafe(sizeof(uint8_t))) { diff --git a/framework/tlvf/yaml/tlvf/wfa_map/tlvBeaconMetricsQuery.yaml b/framework/tlvf/yaml/tlvf/wfa_map/tlvBeaconMetricsQuery.yaml index 830f4ff7f8..0e89c852f1 100644 --- a/framework/tlvf/yaml/tlvf/wfa_map/tlvBeaconMetricsQuery.yaml +++ b/framework/tlvf/yaml/tlvf/wfa_map/tlvBeaconMetricsQuery.yaml @@ -20,6 +20,7 @@ tlvBeaconMetricsQuery: ssid: _type: char _length: [ ssid_length ] + ap_channel_reports_num: uint8_t ap_channel_reports_list_length: _type: uint8_t _length_var: True