Skip to content
This repository was archived by the owner on Sep 7, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1ec5ab4
agent: Move front radio configuration to AgentDB
orenvor Aug 4, 2020
a90ff11
agent: Move back radio configuration to AgentDB
orenvor Aug 4, 2020
e0f140c
agent: Move mem_only_psk configuration to AgentDB
orenvor Aug 5, 2020
9684b1c
agent: Move backhaul_max_vaps configuration to AgentDB
orenvor Aug 6, 2020
c6e86bf
agent: Move backhaul_network_enabled configuration to AgentDB
orenvor Aug 6, 2020
7e31c72
agent: Move backhaul_preferred_radio_band configuration to AgentDB
orenvor Aug 6, 2020
e4b3863
agent: Move operating_mode configuration to AgentDB
orenvor Aug 6, 2020
9a2d18a
agent: Move management_mode configuration to AgentDB
orenvor Aug 6, 2020
b5eff11
agent: Move certification_mode configuration to AgentDB
orenvor Aug 6, 2020
00e80bc
agent: Move stop_on_failure_attempts configuration to AgentDB
orenvor Aug 6, 2020
16907ff
agent: Move client_band_steering_enabled configuration to AgentDB
orenvor Aug 6, 2020
f479475
agent: Move client_optimal_path_roaming_enabled configuration to AgentDB
orenvor Aug 6, 2020
50c0a7f
agent: Move dfs_reentry_enabled configuration to AgentDB
orenvor Aug 6, 2020
b12b1dd
agent: Move client_optimal_path_prefer_signal_strength to AgentDB
orenvor Aug 6, 2020
0254f28
agent: Move client_11k_roaming_enabled configuration to AgentDB
orenvor Aug 6, 2020
cd995b3
agent: Move load_balancing_enabled configuration to AgentDB
orenvor Aug 6, 2020
869767a
agent: Move service_fairness_enabled configuration to AgentDB
orenvor Aug 6, 2020
0134cb2
agent: Move rdkb_extensions_enabled configuration to AgentDB
orenvor Aug 6, 2020
5881aa0
agent: remove unused onboarding configuration
orenvor Aug 10, 2020
dde1284
tlvf: beerocks_message::sPlatformSettings remove unused settings
orenvor Aug 9, 2020
ccac7e9
agent: Remove "platform_settings" local variable from son_slave_thread
orenvor Aug 11, 2020
12ca153
agent: Move wlan_settings configuration to AgentDB
orenvor Aug 11, 2020
a9638cc
fixup! agent: Move wlan_settings configuration to AgentDB
orenvor Aug 12, 2020
e355119
tlvf: PLATFORM_SON_SLAVE_REGISTER_RESPONSE remove unused fields
orenvor Aug 12, 2020
9f3ce07
test_flows.py: add timeouts to make tests pass
vitalii-komisarenko Aug 10, 2020
5610ca4
test_gw_repeater: disable operational test for repeaters
vitalii-komisarenko Aug 10, 2020
fb61391
test_flows: send dev_set_config to repeaters before tests
vitalii-komisarenko Aug 10, 2020
de689cf
agent: backhaul_manager: wait for dev_set_config in certification
vitalii-komisarenko Jul 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions agent/src/beerocks/slave/agent_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,41 @@ class AgentDB {
/* Agent Configuration */
struct sDeviceConf {
struct sFrontRadio {

char ssid[beerocks::message::WIFI_SSID_MAX_LENGTH];
char pass[beerocks::message::WIFI_PASS_MAX_LENGTH];
char security_type[beerocks::message::WIFI_SECURITY_TYPE_MAX_LENGTH];
} front_radio;

struct sBackRadio {

char ssid[beerocks::message::WIFI_SSID_MAX_LENGTH];
char pass[beerocks::message::WIFI_PASS_MAX_LENGTH];
char security_type[beerocks::message::WIFI_SECURITY_TYPE_MAX_LENGTH];
uint8_t mem_only_psk;
uint8_t backhaul_max_vaps;
uint8_t backhaul_network_enabled;
uint8_t backhaul_preferred_radio_band;
} back_radio;

bool local_gw;
bool local_controller;
uint8_t operating_mode;
uint8_t management_mode;
uint8_t certification_mode;
uint8_t stop_on_failure_attempts;
uint8_t client_band_steering_enabled;
uint8_t client_optimal_path_roaming_enabled;
uint8_t dfs_reentry_enabled;
uint8_t client_optimal_path_roaming_prefer_signal_strength_enabled;
uint8_t client_11k_roaming_enabled;
uint8_t load_balancing_enabled;
uint8_t service_fairness_enabled;
uint8_t rdkb_extensions_enabled;

struct sWlanSettings {
uint8_t band_enabled;
uint8_t channel;
} wlan_settings;

} device_conf;

/**
Expand Down
7 changes: 5 additions & 2 deletions agent/src/beerocks/slave/agent_ucc_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ std::string agent_ucc_listener::fill_version_reply_string()
*/
void agent_ucc_listener::clear_configuration()
{
m_in_reset = true;
m_reset_completed = false;
m_in_reset = true;
m_reset_completed = false;
m_received_dev_set_config = false;

auto timeout =
std::chrono::steady_clock::now() + std::chrono::seconds(UCC_REPLY_COMPLETE_TIMEOUT_SEC);
Expand Down Expand Up @@ -232,6 +233,8 @@ bool agent_ucc_listener::handle_dev_set_config(std::unordered_map<std::string, s

// Signal to backhaul that it can continue onboarding.
m_in_reset = false;

m_received_dev_set_config = true;
return true;
}

Expand Down
23 changes: 23 additions & 0 deletions agent/src/beerocks/slave/agent_ucc_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ class agent_ucc_listener : public beerocks_ucc_listener {
* again. This function allows the backhaul to signal that it has reached that state.
*/
void reset_completed() { m_reset_completed = true; }

/**
* @brief check if `dev_set_config` has been received
*
* In certification mode the state machine of backhaul manager should stop
* before entering MASTER_DISCOVERY state until dev_set_config (wired backhaul)
* or start_wps_registration (wireless backhaul) is received.
* No code change needed for wireless flow, but for wired one
* we need to remember if `dev_set_config` has been received.
*/
bool has_received_dev_set_config() { return m_received_dev_set_config; }

std::string get_selected_backhaul();
void update_vaps_list(std::string ruid, beerocks_message::sVapsList &vaps);

Expand All @@ -75,6 +87,17 @@ class agent_ucc_listener : public beerocks_ucc_listener {

bool m_in_reset = false;
bool m_reset_completed = false;

/**
* @brief flag telling whether `dev_set_config` has been received
*
* In certification mode the state machine of backhaul manager should stop
* before entering MASTER_DISCOVERY state until dev_set_config (wired backhaul)
* or start_wps_registration (wireless backhaul) is received.
* No code change needed for wireless flow, but for wired one
* we need to remember if `dev_set_config` has been received.
*/
bool m_received_dev_set_config = false;
std::string m_selected_backhaul; // "ETH" or "<RUID of the selected radio>"

std::mutex mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,25 @@ bool backhaul_manager::backhaul_fsm_main(bool &skip_select)
break;
}
case EState::MASTER_DISCOVERY: {

auto db = AgentDB::get();

bool wired_backhaul =
db->backhaul.connection_type == AgentDB::sBackhaul::eConnectionType::Wired;

// In certification mode we want to wait till dev_set_config is received (wired backhaul)
// or start_wps_registration (wireless backhaul).
if (db->device_conf.certification_mode && wired_backhaul &&
!db->device_conf.local_controller) {
if (!m_agent_ucc_listener) {
LOG(ERROR) << "m_agent_ucc_listener == nullptr";
return false;
}

if (!m_agent_ucc_listener->has_received_dev_set_config()) {
break;
}
}

if (network_utils::get_iface_info(bridge_info, db->bridge.iface_name) != 0) {
LOG(ERROR) << "Failed reading addresses from the bridge!";
platform_notify_error(bpl::eErrorCode::BH_READING_DATA_FROM_THE_BRIDGE, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,27 @@ static beerocks::eFreqType bpl_band_to_freq_type(int bpl_band)
}

static bool fill_platform_settings(
std::string iface_name,
std::shared_ptr<beerocks_message::cACTION_PLATFORM_SON_SLAVE_REGISTER_RESPONSE> msg,
main_thread::platform_common_conf_t &platform_common_conf,
std::string iface_name, main_thread::platform_common_conf_t &platform_common_conf,
std::unordered_map<std::string, std::shared_ptr<beerocks_message::sWlanSettings>>
&iface_wlan_params_map,
Socket *sd)
{
auto db = AgentDB::get();

if (bpl::cfg_get_beerocks_credentials(BPL_RADIO_FRONT, msg->platform_settings().front_ssid,
msg->platform_settings().front_pass,
msg->platform_settings().front_security_type) < 0) {
if (bpl::cfg_get_beerocks_credentials(BPL_RADIO_FRONT, db->device_conf.front_radio.ssid,
db->device_conf.front_radio.pass,
db->device_conf.front_radio.security_type) < 0) {
LOG(ERROR) << "Failed reading front Wi-Fi credentials!";
return false;
}

LOG(DEBUG) << "Front Credentials:"
<< " ssid=" << msg->platform_settings().front_ssid
<< " sec=" << msg->platform_settings().front_security_type << " pass=***";
<< " ssid=" << db->device_conf.front_radio.ssid
<< " sec=" << db->device_conf.front_radio.security_type << " pass=***";

if (bpl::cfg_get_beerocks_credentials(BPL_RADIO_BACK, msg->platform_settings().back_ssid,
msg->platform_settings().back_pass,
msg->platform_settings().back_security_type) < 0) {
if (bpl::cfg_get_beerocks_credentials(BPL_RADIO_BACK, db->device_conf.back_radio.ssid,
db->device_conf.back_radio.pass,
db->device_conf.back_radio.security_type) < 0) {
LOG(ERROR) << "Failed reading Wi-Fi back credentials!";
return false;
}
Expand All @@ -90,25 +88,26 @@ static bool fill_platform_settings(
return false;
}

msg->platform_settings().mem_only_psk = mem_only_psk;
db->device_conf.back_radio.mem_only_psk = mem_only_psk;

LOG(DEBUG) << "Back Credentials:"
<< " ssid=" << msg->platform_settings().back_ssid
<< " sec=" << msg->platform_settings().back_security_type
<< " mem_only_psk=" << int(msg->platform_settings().mem_only_psk) << " pass=***";
<< " ssid=" << db->device_conf.back_radio.ssid
<< " sec=" << db->device_conf.back_radio.security_type
<< " mem_only_psk=" << int(db->device_conf.back_radio.mem_only_psk) << " pass=***";

bpl::BPL_WLAN_PARAMS params;
if (bpl::cfg_get_wifi_params(iface_name.c_str(), &params) < 0) {
LOG(ERROR) << "Failed reading '" << iface_name << "' parameters!";
return false;
}
/* update message */
msg->wlan_settings().band_enabled = params.enabled;
msg->wlan_settings().channel = params.channel;
db->device_conf.wlan_settings.band_enabled = params.enabled;
db->device_conf.wlan_settings.channel = params.channel;

LOG(DEBUG) << "wlan settings:"
<< " band_enabled=" << string_utils::bool_str(msg->wlan_settings().band_enabled)
<< " channel=" << int(msg->wlan_settings().channel);
<< " band_enabled="
<< string_utils::bool_str(db->device_conf.wlan_settings.band_enabled)
<< " channel=" << int(db->device_conf.wlan_settings.channel);

// initialize wlan params cache
//erase interface cache from map if exists
Expand Down Expand Up @@ -191,48 +190,45 @@ static bool fill_platform_settings(
db->device_conf.local_gw = (platform_common_conf.operating_mode == BPL_OPER_MODE_GATEWAY ||
platform_common_conf.operating_mode == BPL_OPER_MODE_GATEWAY_WISP);

msg->platform_settings().onboarding = uint8_t(platform_common_conf.onboarding);
msg->platform_settings().dfs_reentry_enabled = uint8_t(platform_common_conf.dfs_reentry);
msg->platform_settings().rdkb_extensions_enabled =
uint8_t(platform_common_conf.rdkb_extensions);
msg->platform_settings().client_band_steering_enabled =
uint8_t(platform_common_conf.band_steering);
msg->platform_settings().client_optimal_path_roaming_enabled =
db->device_conf.dfs_reentry_enabled = uint8_t(platform_common_conf.dfs_reentry);
db->device_conf.rdkb_extensions_enabled = uint8_t(platform_common_conf.rdkb_extensions);
db->device_conf.client_band_steering_enabled = uint8_t(platform_common_conf.band_steering);
db->device_conf.client_optimal_path_roaming_enabled =
uint8_t(platform_common_conf.client_roaming);
msg->platform_settings().client_optimal_path_roaming_prefer_signal_strength_enabled =
db->device_conf.client_optimal_path_roaming_prefer_signal_strength_enabled =
0; // TODO add platform DB flag
msg->platform_settings().client_11k_roaming_enabled =
db->device_conf.client_11k_roaming_enabled =
uint8_t(platform_common_conf.client_roaming || platform_common_conf.band_steering);
msg->platform_settings().operating_mode = uint8_t(platform_common_conf.operating_mode);
msg->platform_settings().management_mode = uint8_t(platform_common_conf.management_mode);
msg->platform_settings().certification_mode = uint8_t(platform_common_conf.certification_mode);
msg->platform_settings().stop_on_failure_attempts =
db->device_conf.operating_mode = uint8_t(platform_common_conf.operating_mode);
db->device_conf.management_mode = uint8_t(platform_common_conf.management_mode);
db->device_conf.certification_mode = uint8_t(platform_common_conf.certification_mode);
db->device_conf.stop_on_failure_attempts =
uint8_t(platform_common_conf.stop_on_failure_attempts);
msg->platform_settings().backhaul_max_vaps = uint8_t(platform_common_conf.backhaul_max_vaps);
msg->platform_settings().backhaul_network_enabled =
db->device_conf.back_radio.backhaul_max_vaps = uint8_t(platform_common_conf.backhaul_max_vaps);
db->device_conf.back_radio.backhaul_network_enabled =
uint8_t(platform_common_conf.backhaul_network_enabled);
msg->platform_settings().backhaul_preferred_radio_band =
db->device_conf.back_radio.backhaul_preferred_radio_band =
uint8_t(bpl_band_to_freq_type(platform_common_conf.backhaul_preferred_radio_band));

msg->platform_settings().load_balancing_enabled = 0; // for v1.3 TODO read from CAL DB
msg->platform_settings().service_fairness_enabled = 0; // for v1.3 TODO read from CAL DB
db->device_conf.load_balancing_enabled = 0; // for v1.3 TODO read from CAL DB
db->device_conf.service_fairness_enabled = 0; // for v1.3 TODO read from CAL DB

LOG(DEBUG) << "iface " << iface_name << " settings:";
LOG(DEBUG) << "onboarding: " << (unsigned)msg->platform_settings().onboarding;
LOG(DEBUG) << "onboarding: " << (unsigned)0;
LOG(DEBUG) << "client_band_steering_enabled: "
<< (unsigned)msg->platform_settings().client_band_steering_enabled;
<< (unsigned)db->device_conf.client_band_steering_enabled;
LOG(DEBUG) << "client_optimal_path_roaming_enabled: "
<< (unsigned)msg->platform_settings().client_optimal_path_roaming_enabled;
<< (unsigned)db->device_conf.client_optimal_path_roaming_enabled;
LOG(DEBUG) << "client_optimal_path_roaming_prefer_signal_strength_enabled: "
<< (unsigned)msg->platform_settings()
.client_optimal_path_roaming_prefer_signal_strength_enabled;
LOG(DEBUG) << "band_enabled: " << (unsigned)msg->wlan_settings().band_enabled;
<< (unsigned)
db->device_conf.client_optimal_path_roaming_prefer_signal_strength_enabled;
LOG(DEBUG) << "band_enabled: " << (unsigned)db->device_conf.wlan_settings.band_enabled;
LOG(DEBUG) << "local_gw: " << db->device_conf.local_gw;
LOG(DEBUG) << "local_controller: " << db->device_conf.local_controller;
LOG(DEBUG) << "dfs_reentry_enabled: " << (unsigned)msg->platform_settings().dfs_reentry_enabled;
LOG(DEBUG) << "dfs_reentry_enabled: " << (unsigned)db->device_conf.dfs_reentry_enabled;
LOG(DEBUG) << "backhaul_preferred_radio_band: "
<< (unsigned)msg->platform_settings().backhaul_preferred_radio_band;
LOG(DEBUG) << "rdkb_extensions: " << (unsigned)msg->platform_settings().rdkb_extensions_enabled;
<< (unsigned)db->device_conf.back_radio.backhaul_preferred_radio_band;
LOG(DEBUG) << "rdkb_extensions: " << (unsigned)db->device_conf.rdkb_extensions_enabled;

return true;
}
Expand Down Expand Up @@ -652,7 +648,7 @@ bool main_thread::handle_cmdu(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx)
do {
LOG(TRACE) << "Trying to read settings of iface:" << strIfaceName
<< ", attempt=" << int(retry_cnt);
if (fill_platform_settings(strIfaceName, register_response, platform_common_conf,
if (fill_platform_settings(strIfaceName, platform_common_conf,
bpl_iface_wlan_params_map, sd)) {
register_response->valid() = 1;
} else {
Expand Down
Loading