-
Notifications
You must be signed in to change notification settings - Fork 32
PPM-338 Move UCI configuration to Agent DB #1590
base: master
Are you sure you want to change the base?
Changes from all commits
1ed9087
198dd29
b940541
fa19acb
bd04912
6d15f7e
6af1e0b
e59af3a
84178c6
8d7e394
b13191f
d6d17b4
f166c0a
ced7c3d
1c890a3
d672a81
9565fce
b9541a9
5477bb5
e3efdfb
c666a11
2831a7d
cb51ce9
9c450e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add doxygen documentation |
||
uint8_t mem_only_psk; | ||
uint8_t backhaul_max_vaps; | ||
uint8_t backhaul_network_enabled; | ||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uint8_t backhaul_preferred_radio_band; | ||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} back_radio; | ||
|
||
bool local_gw; | ||
bool local_controller; | ||
uint8_t operating_mode; | ||
uint8_t management_mode; | ||
uint8_t certification_mode; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it means |
||
uint8_t stop_on_failure_attempts; | ||
uint8_t client_band_steering_enabled; | ||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uint8_t client_optimal_path_roaming_enabled; | ||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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; | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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, | ||||||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
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; | ||||||
} | ||||||
|
@@ -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=***"; | ||||||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
bpl::BPL_WLAN_PARAMS params; | ||||||
if (bpl::cfg_get_wifi_params(iface_name.c_str(), ¶ms) < 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) | ||||||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
<< " channel=" << int(db->device_conf.wlan_settings.channel); | ||||||
|
||||||
// initialize wlan params cache | ||||||
//erase interface cache from map if exists | ||||||
|
@@ -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); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This PR seems like a good opportunity to replace all these C style casts with the preferred C++ style casts |
||||||
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; | ||||||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
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; | ||||||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
LOG(DEBUG) << "rdkb_extensions: " << (unsigned)db->device_conf.rdkb_extensions_enabled; | ||||||
|
||||||
return true; | ||||||
} | ||||||
|
@@ -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 { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -794,7 +794,7 @@ bool slave_thread::handle_cmdu_control_message(Socket *sd, | |
if (request_in->params().use_optional_ssid && | ||
std::string((char *)request_in->params().ssid).empty()) { | ||
//LOG(DEBUG) << "ssid field is empty! using slave ssid -> " << config.ssid; | ||
string_utils::copy_string(request_in->params().ssid, platform_settings.front_ssid, | ||
string_utils::copy_string(request_in->params().ssid, db->device_conf.front_radio.ssid, | ||
message::WIFI_SSID_MAX_LENGTH); | ||
} | ||
|
||
|
@@ -1320,10 +1320,9 @@ bool slave_thread::handle_cmdu_platform_manager_message( | |
return true; | ||
} | ||
|
||
platform_settings = response->platform_settings(); | ||
wlan_settings = response->wlan_settings(); | ||
|
||
auto db = AgentDB::get(); | ||
auto db = AgentDB::get(); | ||
wlan_settings.band_enabled = db->device_conf.wlan_settings.band_enabled; | ||
wlan_settings.channel = db->device_conf.wlan_settings.channel; | ||
|
||
/** | ||
* On GW platform the ethernet interface which is used for backhaul connection must be | ||
|
@@ -1336,9 +1335,8 @@ bool slave_thread::handle_cmdu_platform_manager_message( | |
db->ethernet.mac = network_utils::ZERO_MAC; | ||
} | ||
|
||
configuration_stop_on_failure_attempts = | ||
response->platform_settings().stop_on_failure_attempts; | ||
stop_on_failure_attempts = configuration_stop_on_failure_attempts; | ||
configuration_stop_on_failure_attempts = db->device_conf.stop_on_failure_attempts; | ||
stop_on_failure_attempts = configuration_stop_on_failure_attempts; | ||
|
||
LOG(TRACE) << "goto STATE_CONNECT_TO_BACKHAUL_MANAGER"; | ||
slave_state = STATE_CONNECT_TO_BACKHAUL_MANAGER; | ||
|
@@ -2978,8 +2976,8 @@ bool slave_thread::slave_fsm(bool &call_slave_select) | |
config.hostap_iface.c_str(), message::IFACE_NAME_LENGTH); | ||
|
||
request->sta_iface_filter_low() = config.backhaul_wireless_iface_filter_low; | ||
request->onboarding() = platform_settings.onboarding; | ||
request->certification_mode() = platform_settings.certification_mode; | ||
request->onboarding() = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't you remove this field from the message? |
||
request->certification_mode() = db->device_conf.certification_mode; | ||
|
||
LOG(INFO) << "ACTION_BACKHAUL_REGISTER_REQUEST " | ||
<< " hostap_iface=" << request->hostap_iface(message::IFACE_NAME_LENGTH) | ||
|
@@ -3007,12 +3005,8 @@ bool slave_thread::slave_fsm(bool &call_slave_select) | |
case STATE_JOIN_INIT: { | ||
|
||
auto db = AgentDB::get(); | ||
LOG(DEBUG) << "onboarding: " << int(platform_settings.onboarding); | ||
if (platform_settings.onboarding) { | ||
LOG(TRACE) << "goto STATE_ONBOARDING"; | ||
slave_state = STATE_ONBOARDING; | ||
orenvor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
break; | ||
} else if (!wlan_settings.band_enabled) { | ||
LOG(DEBUG) << "onboarding: " << int(0); | ||
if (!wlan_settings.band_enabled) { | ||
LOG(DEBUG) << "wlan_settings.band_enabled=false"; | ||
LOG(TRACE) << "goto STATE_BACKHAUL_ENABLE"; | ||
slave_state = STATE_BACKHAUL_ENABLE; | ||
|
@@ -3105,14 +3099,16 @@ bool slave_thread::slave_fsm(bool &call_slave_select) | |
// to the backhaul manager will no longer be necessary, and therefore should be be | ||
// removed completely from beerocks including the BPL. | ||
string_utils::copy_string(bh_enable->ssid(message::WIFI_SSID_MAX_LENGTH), | ||
platform_settings.back_ssid, message::WIFI_SSID_MAX_LENGTH); | ||
db->device_conf.back_radio.ssid, | ||
message::WIFI_SSID_MAX_LENGTH); | ||
string_utils::copy_string(bh_enable->pass(message::WIFI_PASS_MAX_LENGTH), | ||
platform_settings.back_pass, message::WIFI_PASS_MAX_LENGTH); | ||
db->device_conf.back_radio.pass, | ||
message::WIFI_PASS_MAX_LENGTH); | ||
bh_enable->security_type() = static_cast<uint32_t>( | ||
platform_to_bwl_security(platform_settings.back_security_type)); | ||
bh_enable->mem_only_psk() = platform_settings.mem_only_psk; | ||
platform_to_bwl_security(db->device_conf.back_radio.security_type)); | ||
bh_enable->mem_only_psk() = db->device_conf.back_radio.mem_only_psk; | ||
bh_enable->backhaul_preferred_radio_band() = | ||
platform_settings.backhaul_preferred_radio_band; | ||
db->device_conf.back_radio.backhaul_preferred_radio_band; | ||
|
||
string_utils::copy_string(bh_enable->wire_iface(message::IFACE_NAME_LENGTH), | ||
db->ethernet.iface_name.c_str(), message::IFACE_NAME_LENGTH); | ||
|
@@ -3367,7 +3363,24 @@ bool slave_thread::slave_fsm(bool &call_slave_select) | |
} | ||
|
||
//Platform Settings | ||
notification->platform_settings() = platform_settings; | ||
notification->platform_settings().client_band_steering_enabled = | ||
db->device_conf.client_band_steering_enabled; | ||
notification->platform_settings().client_optimal_path_roaming_enabled = | ||
db->device_conf.client_optimal_path_roaming_enabled; | ||
notification->platform_settings().dfs_reentry_enabled = | ||
db->device_conf.dfs_reentry_enabled; | ||
notification->platform_settings() | ||
.client_optimal_path_roaming_prefer_signal_strength_enabled = | ||
db->device_conf.client_optimal_path_roaming_prefer_signal_strength_enabled; | ||
notification->platform_settings().client_11k_roaming_enabled = | ||
db->device_conf.client_11k_roaming_enabled; | ||
notification->platform_settings().load_balancing_enabled = | ||
db->device_conf.load_balancing_enabled; | ||
notification->platform_settings().service_fairness_enabled = | ||
db->device_conf.service_fairness_enabled; | ||
notification->platform_settings().rdkb_extensions_enabled = | ||
db->device_conf.rdkb_extensions_enabled; | ||
|
||
notification->platform_settings().local_master = db->device_conf.local_controller; | ||
|
||
//Wlan Settings | ||
|
@@ -3948,7 +3961,7 @@ bool slave_thread::handle_autoconfiguration_wsc(Socket *sd, ieee1905_1::CmduMess | |
// All EasyMesh VAPs will be stored in the platform DB. | ||
// All other VAPs are manual, AKA should not be modified by prplMesh | ||
//////////////////////////////////////////////////////////////////// | ||
if (platform_settings.management_mode != BPL_MGMT_MODE_NOT_MULTIAP) { | ||
if (db->device_conf.management_mode != BPL_MGMT_MODE_NOT_MULTIAP) { | ||
message_com::send_cmdu(ap_manager_socket, cmdu_tx); | ||
} else { | ||
LOG(WARNING) << "non-EasyMesh mode - skip updating VAP credentials"; | ||
|
@@ -4711,7 +4724,7 @@ bool slave_thread::handle_channel_selection_request(Socket *sd, ieee1905_1::Cmdu | |
// and in this case don't switch channel | ||
// | ||
//////////////////////////////////////////////////////////////////// | ||
if (platform_settings.management_mode != BPL_MGMT_MODE_NOT_MULTIAP) { | ||
if (db->device_conf.management_mode != BPL_MGMT_MODE_NOT_MULTIAP) { | ||
message_com::send_cmdu(ap_manager_socket, cmdu_tx); | ||
} else { | ||
LOG(WARNING) << "non-EasyMesh mode - skip channel switch"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,8 +160,7 @@ class slave_thread : public beerocks::socket_thread { | |
std::string backhaul_manager_uds; | ||
std::string platform_manager_uds; | ||
sSlaveConfig config; | ||
beerocks_message::sPlatformSettings platform_settings; // from platform manager // | ||
beerocks_message::sWlanSettings wlan_settings; // from platform manager // | ||
beerocks_message::sWlanSettings wlan_settings; // from platform manager // | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add proper doxygen documentation |
||
beerocks_message::sSonConfig son_config; | ||
beerocks::logging &logger; | ||
std::string master_version; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add doxygen documentation