Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
agent: backhaul_manager: wait for dev_set_config in certification
Browse files Browse the repository at this point in the history
https://jira.prplfoundation.org/browse/PPM-143

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.

In case of wired flow the exception is made for the agent running on the same
machine as controller. In that case UCC listener is present only on the controller,
so there is no easy way to send dev_set_config to the agent.

Signed-off-by: Vitalii Komisarenko <[email protected]>
  • Loading branch information
vitalii-komisarenko committed Aug 13, 2020
1 parent fb61391 commit c34522d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
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
8 changes: 6 additions & 2 deletions agent/src/beerocks/slave/agent_ucc_listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ 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; }

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 @@ -73,8 +76,9 @@ class agent_ucc_listener : public beerocks_ucc_listener {
const std::string &m_bridge_iface;
std::string m_bridge_mac;

bool m_in_reset = false;
bool m_reset_completed = false;
bool m_in_reset = false;
bool m_reset_completed = false;
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,23 @@ 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

0 comments on commit c34522d

Please sign in to comment.