From dedefbf52646ec47d45cea37e169b83f41558b9c Mon Sep 17 00:00:00 2001 From: Moran Shoeg Date: Sun, 8 Mar 2020 17:00:39 +0000 Subject: [PATCH] Agent: Add media info on front radio interfaces in Topology Response The controller needs to be able to add and remove the radio node from its database based on the data that is coming from the Topology Response message. Add dummy data on the wireless fronthaul interfaces in the tlvDeviceInformation which is in the Topology Response message. The reason that it is dummy values is that this is something that cannot be done at this moment because the MediaType field must be computed with information obtained through NL80211_CMD_GET_WIPHY command of DWPAL, which is currently not supported. See "Send standard NL80211 commands using DWPAL #782 The filled band data is based on the information we have about the band but it is not accurate. The fields ap_channel_bandwidth, ap_channel_center_frequency_index1 and ap_channel_center_frequency_index2 we could get (the bw for sure, the others not so sure), but it not worth it since it will require to create more internal messaging which will be deleted after moving to a unified Agent (#435). Signed-off-by: Moran Shoeg --- .../backhaul_manager_thread.cpp | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp index 22d81ed333..5b338d174a 100644 --- a/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp +++ b/agent/src/beerocks/slave/backhaul_manager/backhaul_manager_thread.cpp @@ -25,6 +25,7 @@ * over time this list is going to get very long */ #include +#include #include #include #include @@ -1977,6 +1978,50 @@ bool backhaul_manager::handle_1905_topology_query(ieee1905_1::CmduMessageRx &cmd // This is something that cannot be done at this moment because the MediaType field // must be computed with information obtained through NL80211_CMD_GET_WIPHY command of DWPAL, // which is currently not supported. See "Send standard NL80211 commands using DWPAL #782" + // For now, fill from radio data with dummy values based on information we have. + for (const auto soc : slaves_sockets) { + std::shared_ptr localInterfaceInfo = + tlvDeviceInformation->create_local_interface_list(); + localInterfaceInfo->mac() = network_utils::mac_from_string(soc->radio_mac); + + ieee1905_1::eMediaType media_type = ieee1905_1::eMediaType::UNKNONWN_MEDIA; + if (soc->freq_type == beerocks::eFreqType::FREQ_24G) { + media_type = ieee1905_1::eMediaType::IEEE_802_11N_2_4_GHZ; + } else if (soc->freq_type == beerocks::eFreqType::FREQ_5G) { + media_type = ieee1905_1::eMediaType::IEEE_802_11AC_5_GHZ; + } else { + LOG(ERROR) << "Unsupported freq_type=" << int(soc->freq_type) + << ", iface=" << soc->hostap_iface; + return false; + } + localInterfaceInfo->media_type() = media_type; + + ieee1905_1::s802_11SpecificInformation media_info = {}; + localInterfaceInfo->alloc_media_info(sizeof(media_info)); + + // BSSID of a fronthaulradio interface is something that is not defined well. + // Put zeros for now. + media_info.network_membership = network_utils::ZERO_MAC; + + media_info.role = ieee1905_1::eRole::AP; + + // TODO: The Backhaul manager does not hold the information on the front radios. + // For now, put zeros and when the Agent management will be move to unified Agent thread + // this field will be filled. #435 + media_info.ap_channel_bandwidth = 0; + media_info.ap_channel_center_frequency_index1 = 0; + media_info.ap_channel_center_frequency_index2 = 0; + + auto *media_info_ptr = localInterfaceInfo->media_info(0); + if (media_info_ptr == nullptr) { + LOG(ERROR) << "media_info is nullptr"; + return false; + } + + std::copy_n(reinterpret_cast(&media_info), sizeof(media_info), media_info_ptr); + + tlvDeviceInformation->add_local_interface_list(localInterfaceInfo); + } auto tlvSupportedService = cmdu_tx.addClass(); if (!tlvSupportedService) {