Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion orchagent/dash/dashhaorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ void DashHaOrch::updateHaScopeStateForSwitchOwner(const std::string &key, const
ha_state = SAI_DASH_HA_STATE_DEAD;
break;
case dash::types::HA_ROLE_SWITCHING_TO_ACTIVE:
return;
ha_state = SAI_DASH_HA_STATE_INITIALIZING_TO_ACTIVE;
break;
default:
ha_state = SAI_DASH_HA_STATE_DEAD;
}
Expand Down
19 changes: 19 additions & 0 deletions tests/mock_tests/dashhaorch_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,25 @@ namespace dashhaorch_ut
RemoveHaSet();
}

TEST_F(DashHaOrchTestSwitchOwner, SwitchOwnerSwitchingToActiveInitializesStateAndProcessesBfdSessions)
{
CreateSwitchOwnerDpuScopeHaSet();
CreateHaScope();

CreateSoftwareBfdSession();
EXPECT_EQ(m_mockBfdOrch->createSoftwareBfdSession_invoked_times, 0);

SetHaScopeHaRole("switching_to_active");

auto& scope_entry = m_dashHaOrch->getHaScopeEntries().find("HA_SET_1")->second;
EXPECT_EQ(scope_entry.ha_state, SAI_DASH_HA_STATE_INITIALIZING_TO_ACTIVE);
EXPECT_EQ(to_sai(scope_entry.metadata.ha_role()), SAI_DASH_HA_ROLE_SWITCHING_TO_ACTIVE);
EXPECT_EQ(m_mockBfdOrch->createSoftwareBfdSession_invoked_times, 1);

RemoveHaScope();
RemoveHaSet();
}

TEST_F(DashHaOrchTest, DpuOwnerSetRoleDoesNotUpdateState)
{
// DPU owner (default CreateHaSet uses "dpu" owner)
Expand Down
Loading